Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
165a3d1f27 | ||
|
|
c9afc16c53 | ||
|
|
ff15470a06 | ||
|
|
984a0ab44f | ||
|
|
695141383f | ||
|
|
a0a3b50d94 | ||
|
|
621bef0d29 | ||
|
|
e8ba4cd2ad | ||
|
|
5a9b7bfff8 | ||
|
|
72a61e49ee | ||
|
|
069456799e | ||
|
|
12209155dc | ||
|
|
e027ac4a9e | ||
|
|
26a1a481ac | ||
|
|
b617c275eb | ||
|
|
bb842b55b4 | ||
|
|
0eb529e604 | ||
|
|
ece066caf8 | ||
|
|
b064a64142 | ||
|
|
ec3ad7d384 | ||
|
|
d22b53253e | ||
|
|
61c191505e | ||
|
|
c5282dbdef | ||
|
|
dc9e4c3200 | ||
|
|
6a1a044566 | ||
|
|
3c7b6741f5 | ||
|
|
abf4d6ccf7 | ||
|
|
141121878f | ||
|
|
6a89660cf4 | ||
|
|
44c2dd2abc | ||
|
|
49c8da9863 | ||
|
|
993017f669 | ||
|
|
e0c3deee86 | ||
|
|
7331a455ad | ||
|
|
7a5be506e0 | ||
|
|
765c6f3b47 | ||
|
|
846726a5c7 | ||
|
|
e92903a7aa | ||
|
|
7bf1223673 | ||
|
|
a36c8ab6f4 | ||
|
|
eeb6059fe5 | ||
|
|
2e8ac7047f | ||
|
|
a692dc9a34 | ||
|
|
6978401613 | ||
|
|
3c4fc2d91c | ||
|
|
4278507ae2 | ||
|
|
99a3ea80ae |
No files matched your search
@@ -0,0 +1,527 @@
|
|||||||
|
# Waypoint Sidebar — Technical Documentation
|
||||||
|
|
||||||
|
> Obsidian plugin (id: `waypoint-sidebar`) providing a unified sidebar with calendar, recent files, and custom bookmarks. Replaces separate Calendar and Bookmarks core plugins.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Architecture Overview
|
||||||
|
|
||||||
|
```
|
||||||
|
src/
|
||||||
|
├── main.ts Plugin entry — lifecycle, commands, events, data persistence
|
||||||
|
├── settings.ts Interface definitions + DEFAULT_SETTINGS / DEFAULT_DATE_SYSTEM constants
|
||||||
|
├── settings-tab.ts PluginSettingTab UI — calendar, periodic, date systems, recent, display, about
|
||||||
|
├── models/
|
||||||
|
│ └── bookmark.ts BookmarkItem + WaypointData interfaces
|
||||||
|
├── utils/
|
||||||
|
│ ├── date-utils.ts Moment.js helpers: period formatting, month grid, navigation
|
||||||
|
│ ├── date-systems.ts Pure date-system filename helpers (no `obsidian` import, unit-testable)
|
||||||
|
│ └── path-utils.ts Pure path helper: rename remapping (no `obsidian` import, unit-testable)
|
||||||
|
└── views/
|
||||||
|
└── waypoint-view.ts ItemView subclass — full sidebar rendering + interaction
|
||||||
|
```
|
||||||
|
|
||||||
|
**Build:** `npm run build` runs `tsc --noEmit` first, then esbuild bundles `src/main.ts` → `main.js`. The typecheck is a real gate — esbuild strips types without checking them, so without it type errors would ship. `npm run typecheck` runs the check alone; `npm run dev` (watch) stays ungated for speed. TypeScript strict-null + `noImplicitAny`, ESNext modules, ES6 target, `lib` floor at ES2017.
|
||||||
|
|
||||||
|
**Data persistence:** Single `data.json` via Obsidian `Plugin.loadData()/saveData()`. Top-level keys: `settings` (merged with `DEFAULT_SETTINGS`), `waypointData` (bookmark tree **and** recent files). Recent files are persisted under `waypointData.recentFiles` and reloaded on startup; writes are debounced 300ms so rapid file opens collapse into one save.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Plugin Lifecycle
|
||||||
|
|
||||||
|
### `onload()`
|
||||||
|
|
||||||
|
1. **Load data** — reads `data.json` exactly once, then `applySettings(saved)` and `applyWaypointData(saved)` merge its partial data over defaults.
|
||||||
|
2. **Register view** — `WAYPOINT_VIEW_TYPE = "waypoint-view"` maps to `WaypointView` factory `(leaf) => new WaypointView(leaf, this)`.
|
||||||
|
3. **Settings tab** — `WaypointSettingTab` receives the live `settings` object + `() => this.redrawAll()` callback for live preview.
|
||||||
|
4. **Register commands** (see Commands section below).
|
||||||
|
5. **Register events** — `file-open`, `vault:create`, `vault:delete`, `vault:rename`, `vault:modify`.
|
||||||
|
6. **Auto-open** — On `onLayoutReady`, if no existing leaves of the view type, opens one in the left sidebar.
|
||||||
|
7. **Midnight refresh** — 10-minute `setInterval` checks if `new Date().toDateString()` changed; if so, calls `redrawAll()` (calendar day indicators refresh).
|
||||||
|
|
||||||
|
### `onunload()`
|
||||||
|
|
||||||
|
Detaches all leaves of `WAYPOINT_VIEW_TYPE`.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Data Models
|
||||||
|
|
||||||
|
### WaypointSettings
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
interface WaypointSettings {
|
||||||
|
calendar: CalendarSettings; // week start, indicator visibility/style, daily indicator colour
|
||||||
|
daily: PeriodNoteSettings;
|
||||||
|
reusePeriodicNoteTabs: boolean; // defaults to false; all periodic-note openers reuse an open tab
|
||||||
|
weekly: PeriodNoteSettings;
|
||||||
|
monthly: PeriodNoteSettings;
|
||||||
|
quarterly: PeriodNoteSettings;
|
||||||
|
yearly: PeriodNoteSettings;
|
||||||
|
dateSystems: DateSystemSettings[]; // day-scoped systems beyond the daily note, in menu order
|
||||||
|
recentFiles: RecentFilesSettings; // maxItems, show, omittedPaths[], omittedTags[], types[]
|
||||||
|
display: DisplaySettings; // px sizing for bookmark rows, fonts, icons, calendar cells
|
||||||
|
}
|
||||||
|
|
||||||
|
interface PeriodNoteSettings {
|
||||||
|
folder: string; // e.g. "periodic/daily"
|
||||||
|
templateFile: string; // path without .md, e.g. "Templates/Daily note"
|
||||||
|
nameFormat: string; // moment.js format string
|
||||||
|
typeProperty: string; // frontmatter type value, e.g. "daily-note"
|
||||||
|
}
|
||||||
|
|
||||||
|
interface CalendarSettings {
|
||||||
|
firstDayOfWeek: number; // 0 = Sunday, 1 = Monday
|
||||||
|
showNoteIndicators: boolean; // show or hide all calendar markers
|
||||||
|
indicatorMode: 'any' | 'systems'; // defaults to systems; one neutral dot or one per date system
|
||||||
|
dailyIndicatorColor: string; // daily's colour in systems mode
|
||||||
|
}
|
||||||
|
|
||||||
|
interface RecentFilesSettings {
|
||||||
|
maxItems: number; // default 50, per kind (opened / changed)
|
||||||
|
show: 'all' | 'opened' | 'changed'; // header switch, default 'all'
|
||||||
|
omittedPaths: string[]; // regex patterns (one per line)
|
||||||
|
omittedTags: string[]; // regex patterns for frontmatter/inline tags
|
||||||
|
types: { type: string; icon: string }[]; // frontmatter types with a row icon each
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Migration in `applySettings`: the saved `filterTags`, `showTypeFilter` (the removed type filter), and `updateOn` (both kinds are always tracked) are dropped.
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
interface DisplaySettings {
|
||||||
|
rowSize: number; // px, base height of bookmark items (18–40)
|
||||||
|
rowSpacing: number; // px, gap between items (0–12)
|
||||||
|
indentSize: number; // px, indent per depth level (8–32)
|
||||||
|
fontSize: number; // px, font size for bookmark labels (10–18)
|
||||||
|
iconSize: number; // px, icon size (12–24)
|
||||||
|
calendarCellSize: number; // px, calendar day cell height (20–48)
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
`dateSystems` holds the user's configured date systems in menu order — see the Date Systems section for the `DateSystemSettings` shape and the two systems shipped by default.
|
||||||
|
|
||||||
|
### BookmarkItem (recursive tree)
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
interface BookmarkItem {
|
||||||
|
id: string; // "bm-{timestamp}-{random4}"
|
||||||
|
type: 'file' | 'group' | 'separator' | 'spacer';
|
||||||
|
label: string; // display text (empty for separator/spacer)
|
||||||
|
filePath: string; // vault-relative path (empty for non-file types)
|
||||||
|
icon: string; // Lucide icon name
|
||||||
|
children: BookmarkItem[]; // nested items (groups contain children)
|
||||||
|
collapsed: boolean; // group collapse state
|
||||||
|
indent: number; // depth level (0 = root)
|
||||||
|
}
|
||||||
|
|
||||||
|
interface WaypointData {
|
||||||
|
bookmarks: BookmarkItem[];
|
||||||
|
recentFiles: { path: string; basename: string }[];
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
The bookmark tree is stored under `waypointData.bookmarks` and rendered recursively. Groups contain children; files/separators/spacers are leaf nodes. `waypointData.recentFiles` holds the persisted recent-files list (mirrored into the live `plugin.recentFiles` array on load).
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Commands
|
||||||
|
|
||||||
|
### Period note navigation (with default hotkeys)
|
||||||
|
|
||||||
|
| ID | Name | Hotkey |
|
||||||
|
|---|---|---|
|
||||||
|
| `waypoint-go-to-daily` | Go to daily note | `Mod+Shift+Alt+D` |
|
||||||
|
| `waypoint-go-to-weekly` | Go to weekly note | `Mod+Shift+Alt+W` |
|
||||||
|
| `waypoint-go-to-monthly` | Go to monthly note | `Mod+Shift+Alt+M` |
|
||||||
|
| `waypoint-go-to-quarterly` | Go to quarterly note | `Mod+Shift+Alt+Q` |
|
||||||
|
| `waypoint-go-to-yearly` | Go to yearly note | `Mod+Shift+Alt+Y` |
|
||||||
|
|
||||||
|
All five commands call `openPeriodNote(period, moment())` — opening or creating the current period's note. **Periodic Notes → Use existing tabs** defaults to off. When enabled, the shared opener focuses a Markdown tab for the exact configured file path, including in another pane or window, without reopening the file or resetting its editor position. This also applies to next/previous navigation and regular calendar clicks. With no matching tab, normal note creation/opening is unchanged. Explicit open-in-new-tab actions still win; existing duplicate tabs are not closed.
|
||||||
|
|
||||||
|
### Next/Previous period (no default hotkeys)
|
||||||
|
|
||||||
|
10 commands generated in a loop: `waypoint-go-to-{next|prev}-{daily|weekly|monthly|quarterly|yearly}`.
|
||||||
|
|
||||||
|
These call `navigatePeriodNote(direction)` which:
|
||||||
|
1. Gets the active file's basename.
|
||||||
|
2. Calls `detectPeriodType(basename)` — **settings-driven**, not hardcoded regexes. It reads `settings.{daily,weekly,monthly,quarterly,yearly}.nameFormat` and tries `moment(basename, nameFormat, true).isValid()` (strict parsing) in order day → week → month → quarter → year, returning the first match as `{ period, date }`. Periods with an empty `nameFormat` are skipped; returns `null` if nothing matches. Changing a name format in settings therefore keeps next/prev navigation working.
|
||||||
|
3. Adds ±1 period (quarters add ±3 months).
|
||||||
|
4. Calls `openPeriodNote` for the new date.
|
||||||
|
|
||||||
|
### Other commands
|
||||||
|
|
||||||
|
| ID | Name |
|
||||||
|
|---|---|
|
||||||
|
| `waypoint-open-view` | Open Waypoint sidebar |
|
||||||
|
| `waypoint-add-bookmark` | Add current file as Waypoint bookmark |
|
||||||
|
| `waypoint-open-date` | Open daily note for a date… — `DatePickerModal` (`src/modals/date-picker-modal.ts`, native `<input type="date">`), then `showDateInViews(date)` and `openPeriodNote('day', date)` |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Date Systems
|
||||||
|
|
||||||
|
A **date system** is a folder of notes whose filenames begin with a date. Daily notes, a journal and meeting notes are all the same shape, so they share one settings model, one discovery pass and one creation path.
|
||||||
|
|
||||||
|
### `DateSystemSettings`
|
||||||
|
|
||||||
|
interface DateSystemSettings {
|
||||||
|
id: string; // stable across edits + reordering, so settings rows can key on it
|
||||||
|
name: string; // menu label, e.g. "Journal"
|
||||||
|
folder: string; // e.g. "periodic/journal"
|
||||||
|
nameFormat: string; // moment format string; may contain "{title}"
|
||||||
|
templateFile: string; // may omit the .md extension
|
||||||
|
typeProperty: string; // fallback frontmatter `type:` value
|
||||||
|
icon: string; // Lucide icon name for the menu item
|
||||||
|
indicatorColor: string; // calendar dot colour in systems mode
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Configured systems live in `settings.dateSystems`, where array order is menu order. `DEFAULT_DATE_SYSTEM` (in `settings.ts`, typed `Omit<DateSystemSettings, 'id'>`) supplies the field defaults for a newly added row **and** the merge base for saved ones, so a system persisted before a field existed still loads with that field defined. `DEFAULT_SETTINGS.dateSystems` ships two:
|
||||||
|
|
||||||
|
| `id` | `name` | Folder | `nameFormat` | Indicator colour | Notes per date |
|
||||||
|
|---|---|---|---|---|---|
|
||||||
|
| `journal` | Journal | `periodic/journal` | `YYYY-MM-DD - [Journal]` | green (`#22c55e`) | one |
|
||||||
|
| `meetings` | Meeting | `periodic/meetings` | `YYYY-MM-DD - {title}` | violet (`#a855f7`) | many |
|
||||||
|
|
||||||
|
The default calendar mode is `systems`, while `any` preserves the older one-neutral-dot behaviour. Existing installs that silently persisted the pre-`systems` default of `any` are promoted to `systems` exactly once, on load, via a `data.json`-level `indicatorModeMigrated` flag; a value chosen after that flag is set (including `any`) is never touched again. Template file fields in both Periodic Notes and Date systems use `TemplateFileSuggest`, an `AbstractInputSuggest<TFile>` (the same base class Templater's own template pickers use — Obsidian's native fuzzy-suggest popup, not an unstyled `<datalist>`), searching every Markdown path in the vault. `AbstractInputSuggest` requires Obsidian ≥1.4.10, hence `manifest.json`'s `minAppVersion`.
|
||||||
|
|
||||||
|
### Templater folder triggers
|
||||||
|
|
||||||
|
Waypoint deliberately does not evaluate Templater syntax. For an interactive Templater template, configure Templater's **Trigger Templater on new file creation** mode for the relevant folder, then leave that date system's `templateFile` blank in Waypoint. Waypoint creates a safe fallback note from `typeProperty` and the selected `YYYY-MM-DD` date; Templater's folder trigger owns the rendered content, prompts, scripts, and cursor placement.
|
||||||
|
|
||||||
|
The target filename is the contract between them. A calendar-created journal note is already named `YYYY-MM-DD - Journal`; a meeting is already `YYYY-MM-DD - {title}`. Templates must extract the date from `tp.file.title`, not `tp.date` or `tp.file.creation_date()`, because those refer to when Templater runs rather than the date selected in the calendar.
|
||||||
|
|
||||||
|
The journal template may retain a manual fallback: only prompt for a date and rename when `tp.file.title` does **not** match the date-system filename. That preserves manual note creation without a prompt or rename race on calendar creation.
|
||||||
|
|
||||||
|
### The `{title}` convention
|
||||||
|
|
||||||
|
`nameFormat` is a moment format string, so literal text needs bracket escaping — `YYYY-MM-DD - [Journal]` — the same convention the periodic formats `GGGG-[W]WW` and `YYYY-[Q]Q` already use.
|
||||||
|
|
||||||
|
When the format contains `{title}`, the system holds **many** notes per date: the text before the token is the date prefix used to discover them, and the token marks where a typed free-text title goes on creation. Without the token, a date maps to **exactly one** filename.
|
||||||
|
|
||||||
|
**Why the token is split out before moment sees the string:** `t`, `i`, `l` and `e` are all live moment format tokens — `l` on its own expands to an entire localized date. Passing `{title}` through `date.format()` would expand those letters and destroy the placeholder, with no way to recover it afterwards. `splitNameFormat()` therefore cuts the format at the token *first*, and callers format `before` and `after` separately, then join the two results around the title. It is also why discovery matches on formatted affixes instead of on a regex derived from the raw format.
|
||||||
|
|
||||||
|
### Helpers (`src/utils/date-systems.ts`)
|
||||||
|
|
||||||
|
Imports nothing from `'obsidian'` — callers make every moment call and pass the resulting strings in, which keeps the module unit-testable in plain node (same rationale as `path-utils.ts`).
|
||||||
|
|
||||||
|
| Export | Signature | Purpose |
|
||||||
|
|---|---|---|
|
||||||
|
| `TITLE_TOKEN` | `'{title}'` | The literal placeholder. |
|
||||||
|
| `splitNameFormat(nameFormat)` | `string → NameFormatParts` | `{ before, after, hasTitle }` — the format cut around the token. |
|
||||||
|
| `isInFolder(path, folder)` | `string, string → boolean` | Path sits in `folder` or any subfolder. An empty folder means the vault root, so everything matches. |
|
||||||
|
| `matchesSystemName(basename, before, after, hasTitle)` | `string, string, string, boolean → boolean` | One-per-date: the basename must equal `before + after`. Many-per-date: prefix/suffix match, since the middle is free text. |
|
||||||
|
| `titleFromBasename(basename, before, after)` | `string, string, string → string` | Strips the affixes to recover the menu label; falls back to the whole basename when they do not line up. |
|
||||||
|
| `sanitizeTitle(title)` | `string → string` | Collapses filename-illegal and link-syntax characters (`\ / : * ? " < > \| # ^ [ ]`) to `-`, squeezes runs of whitespace, trims — so a typed "Meeting w/ Mark" still yields a creatable filename. |
|
||||||
|
| `formatHasDateToken(nameFormat)` | `string → boolean` | Strips bracket-escaped literals out of `before`, then looks for any moment date token. Drives the settings warning. |
|
||||||
|
`matchesSystemName` deliberately returns `false` for a many-per-date format whose `before` is empty (a format of just `{title}`): an empty date prefix would otherwise claim every file in the folder for every date. The settings tab flags formats with no date token, and `findDateSystemNotes()` excludes them from the menu; `openDateSystemNote()` also refuses them. An unfinished or invalid row therefore cannot create `.md` or a static filename.
|
||||||
|
|
||||||
|
### Plugin API (`main.ts`)
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
interface DateSystemNote {
|
||||||
|
file: TFile;
|
||||||
|
label: string; // free-text title for many-per-date systems, else the system name
|
||||||
|
}
|
||||||
|
|
||||||
|
interface DateSystemNotes {
|
||||||
|
system: DateSystemSettings;
|
||||||
|
notes: DateSystemNote[];
|
||||||
|
multiple: boolean; // nameFormat carries {title}
|
||||||
|
}
|
||||||
|
|
||||||
|
interface DateSystemIndicator {
|
||||||
|
id: string;
|
||||||
|
name: string;
|
||||||
|
color: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
dateSystems(): DateSystemSettings[]
|
||||||
|
findDateSystemNotes(date: moment.Moment): DateSystemNotes[]
|
||||||
|
getDateSystemIndicators(dates: moment.Moment[]): Map<string, DateSystemIndicator[]>
|
||||||
|
openDateSystemNote(
|
||||||
|
system: DateSystemSettings,
|
||||||
|
date: moment.Moment,
|
||||||
|
opts?: { title?: string; leaf?: WorkspaceLeaf; reuseExistingLeaf?: boolean },
|
||||||
|
): Promise<void>
|
||||||
|
```
|
||||||
|
|
||||||
|
**`getDateSystemIndicators(dates)`** — returns one `{ id, name, color }` marker per configured system with one or more notes on a requested day. The calendar calls it once for the visible month only in `indicatorMode: 'systems'`. It makes one vault pass, caches the result by displayed dates and date-system settings, and invalidates it on markdown create/delete/rename or any Settings change. It does not run on ordinary markdown edits: content edits cannot change a filename-derived indicator.
|
||||||
|
|
||||||
|
**`dateSystems()`** — every day-scoped system in menu order: the daily periodic note, synthesized into a `DateSystemSettings` from `settings.daily`, followed by `settings.dateSystems`. The daily note is therefore not a special case in any consumer.
|
||||||
|
|
||||||
|
**`findDateSystemNotes(date)`** — **one** vault scan per call, not one per system. It formats each usable system's `before`/`after` affixes for `date` once, then walks the markdown file list a single time, bucketing each file into the system that claims it (`isInFolder` + `matchesSystemName`). Systems whose formats have no date token are omitted rather than offering an unsafe create action. It returns the remaining `DateSystemNotes` in `dateSystems()` order, each bucket sorted by basename. The calendar's day context menu is built from exactly one of these calls per right-click.
|
||||||
|
|
||||||
|
**`openDateSystemNote(system, date, opts)`** — the single opener for every dated note:
|
||||||
|
|
||||||
|
1. **Filename** — `splitNameFormat(system.nameFormat)`, format `before` and `after` against `date`, and for a many-per-date system join `sanitizeTitle(opts.title)` between them. Append `.md`; prepend `system.folder` when it is set.
|
||||||
|
2. **Existing note** — a `vault.getFileByPath()` hit is opened as-is, never overwritten. A date that already has notes can still gain another in a many-per-date system, because the title makes the filename unique.
|
||||||
|
3. **Missing note** — created via `createDatedNote`, then opened.
|
||||||
|
4. **Leaf** — an explicit `opts.leaf` always wins (middle-click and Ctrl/Cmd-click pass a tab leaf). Otherwise, when `opts.reuseExistingLeaf` is true, scan Markdown leaves by `getViewState().state.file` so deferred tabs also match; compare the complete file path, not the basename. Await `workspace.revealLeaf(existing)` to reveal/load the tab, then call `workspace.setActiveLeaf(existing, { focus: true })` to activate it and focus its editor. Return without calling `openFile`, preserving editor position. With no matching tab, or when reuse is disabled, open in `workspace.getLeaf(false)` as before.
|
||||||
|
|
||||||
|
### Note creation (`createDatedNote`)
|
||||||
|
|
||||||
|
A single creation path shared by periodic notes and date systems; it replaced the period-only `createPeriodNote`.
|
||||||
|
|
||||||
|
1. With a non-empty `system.templateFile`, reads it (appending `.md` when omitted) and creates the note with its raw contents. This is for plain, non-Templater templates.
|
||||||
|
2. With no template, the note is created with minimal frontmatter instead: `type: {system.typeProperty}` + `date: YYYY-MM-DD`. Use this mode with a Templater folder trigger, which replaces that fallback content with its rendered template.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Period Note Creation (`openPeriodNote`)
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
openPeriodNote(
|
||||||
|
period: 'day' | 'week' | 'month' | 'quarter' | 'year',
|
||||||
|
date: moment.Moment,
|
||||||
|
leaf?: WorkspaceLeaf,
|
||||||
|
): Promise<void>
|
||||||
|
```
|
||||||
|
|
||||||
|
Single unified opener — there is no separate `openPeriodNoteInLeaf`, and since the date-systems refactor there is no separate creation path either. `openPeriodNote` synthesizes the period's `PeriodNoteSettings` into a `DateSystemSettings` (`folder`, `nameFormat`, `templateFile` and `typeProperty` carry over verbatim; a period format never contains `{title}`, so a period maps to exactly one filename) and delegates to `openDateSystemNote(system, date, { leaf, reuseExistingLeaf: settings.reusePeriodicNoteTabs })`. All five periodic-note types therefore share the same tab-reuse policy, with an explicit `leaf` taking precedence.
|
||||||
|
|
||||||
|
Filename building, the existence check, template-or-frontmatter creation and leaf selection are therefore documented once, under Date Systems above.
|
||||||
|
|
||||||
|
Middle-click handlers in the view pass an explicit tab leaf: `openPeriodNote(period, date, this.app.workspace.getLeaf('tab'))`.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Event Handling
|
||||||
|
|
||||||
|
### `file-open`
|
||||||
|
|
||||||
|
Records the previously active path in `previouslyActive` (valid for `PENDING_SAVE_GRACE_MS` = 5 s) and the new one in `activePath`, then `recordRecentFile(file, 'opened')`: sets `openedAt` and clears `changedInBackground`.
|
||||||
|
|
||||||
|
### `vault:modify`
|
||||||
|
|
||||||
|
`onFileChange(file)` (guarded to `TFile`) calls `recordRecentFile(file, 'changed', isBackgroundChange(file))`: sets `changedAt`, and `changedInBackground` when the file is neither `getActiveFile()` nor left less than 5 s ago (its editor flushing a pending save after a tab switch). When the file already leads both the `all` and `changed` orderings and the dot does not change — the editor saving while you type — only the timestamp moves and no redraw happens.
|
||||||
|
|
||||||
|
### `vault:create` / `vault:delete`
|
||||||
|
|
||||||
|
Both update the markdown-basename set used for calendar note indicators, then trigger `broadcastRedraw()` — telling all WaypointView instances to re-render (needed for the indicators and for stale recent file references). After layout-ready, `create` also goes through `onFileChange` (synced or plugin-created notes); the initial vault scan fires `create` for every file before layout-ready and is skipped.
|
||||||
|
|
||||||
|
### `vault:rename`
|
||||||
|
|
||||||
|
1. Updates the markdown-basename set (old basename out, new basename in).
|
||||||
|
2. Remaps the `recentFiles` entry through `remapRenamedPath(entry.path, oldPath, newPath)`.
|
||||||
|
3. Remaps every bookmark `filePath` through the same helper.
|
||||||
|
|
||||||
|
`remapRenamedPath(path, oldPath, newPath)` (in `src/utils/path-utils.ts`) returns the updated path when `path` **is** `oldPath` (a plain file rename) *or* is nested under it (`path.startsWith(oldPath + '/')`, i.e. a folder rename/move), and `null` when the path is unaffected. This is why moving a folder no longer orphans the bookmarks inside it. The helper deliberately imports nothing from `'obsidian'` so it stays pure and unit-testable in plain node.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Recent Files (persisted)
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
recentFiles: { path: string; basename: string; changedInBackground?: boolean }[] // RecentFileEntry
|
||||||
|
```
|
||||||
|
|
||||||
|
Backed by `waypointData.recentFiles` in `data.json`, so the list survives vault reload. `applyWaypointData(saved)` restores it; entries saved before per-kind timestamps get small descending `openedAt` values (or `changedAt` if the old `updateOn` was `'file-edit'`), keeping their order and sorting after anything new.
|
||||||
|
|
||||||
|
**Ordering and trimming** (`src/utils/recent-files.ts`, pure): `recentFilesFor(entries, show)` lists entries with an `openedAt` (`opened`), a `changedAt` (`changed`), or either (`all`, by the later of the two), most recent first. `trimRecentFiles(entries, max)` keeps an entry while it is among the `max` most recently opened **or** the `max` most recently changed, so a burst of synced changes cannot evict opened files. `this.recentFiles` is stored in `all` order.
|
||||||
|
|
||||||
|
**Update flow:**
|
||||||
|
1. `recordRecentFile(file, kind, background)` — omission check, stamp (creating the entry if needed), `trimRecentFiles`.
|
||||||
|
2. `persistRecentFiles()` — mirrors the array into `waypointData.recentFiles` and schedules a debounced (300ms) `saveWaypointData()`.
|
||||||
|
3. Calls `broadcastRedraw()` unless the change was quiet (see `vault:modify`).
|
||||||
|
|
||||||
|
**Omitted paths/tags:** Both filters are applied in `recordRecentFile`. `omittedPaths` entries are treated as regexes tested against `file.path`; `omittedTags` entries are regexes tested against the file's tags, read via `getAllTags(metadataCache.getFileCache(file))` with the leading `#` stripped. An invalid regex is skipped rather than throwing.
|
||||||
|
|
||||||
|
**`enforceRecentFilesLimit()`:** Called from the settings-change callback — re-trims when `maxItems` is lowered and persists the result.
|
||||||
|
|
||||||
|
**On file not found:** When clicking a recent file that no longer exists, `focusFile()` shows a Notice and removes the stale entry from `recentFiles`.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Sidebar View (`WaypointView`)
|
||||||
|
|
||||||
|
Extends `ItemView`. View type: `"waypoint-view"`, icon: `compass`.
|
||||||
|
|
||||||
|
### Rendering (`redraw`)
|
||||||
|
|
||||||
|
Called on every change. Full DOM rebuild — `contentEl.empty()`, then Favorites and Recent Files inside a `.waypoint-lists` wrapper, then the Calendar:
|
||||||
|
|
||||||
|
1. **Favorites** (`renderFavorites(lists)`) — bookmark tree
|
||||||
|
2. **Recent Files** (`renderRecentFiles(lists)`) — flat list
|
||||||
|
3. **Calendar** (`renderCalendar`) — month grid, `.waypoint-calendar-section`
|
||||||
|
|
||||||
|
`.waypoint-calendar-section` gets `margin-top: auto`, pushing it to the bottom of the sidebar. On desktop `.waypoint-lists` is `display: contents`, so the whole view scrolls as before. On mobile (`.is-mobile`) the wrapper becomes the only scroller and the view itself stops scrolling, so the full calendar is always on screen when the drawer opens.
|
||||||
|
|
||||||
|
### Calendar Panel
|
||||||
|
|
||||||
|
**State:** `currentDisplayMonth` (0-indexed), `currentDisplayYear` — allows navigating months independently of today. `selectedDate` — day reached through the date picker or the "Open date" command (`showDate(date)`), drawn as `.is-selected`; Today and ◀/▶ clear it.
|
||||||
|
|
||||||
|
**Layout:**
|
||||||
|
|
||||||
|
```
|
||||||
|
┌────────────────────────────────────┐
|
||||||
|
│ Q2 Jun 2026 ◀ Today ▶ │ ← breadcrumb (clickable) + nav
|
||||||
|
├──┬───┬───┬───┬───┬───┬───┬───┤
|
||||||
|
│24│ S │ M │ T │ W │ T │ F │ S │ ← header row + week# col
|
||||||
|
├──┼───┼───┼───┼───┼───┼───┼───┤
|
||||||
|
│25│ 1 │ 2 │ 3 │... ← day cells (clickable)
|
||||||
|
└──┴───┴───┴───┴───┴───┴───┴───┘
|
||||||
|
```
|
||||||
|
|
||||||
|
- **Breadcrumb:** Q-label, 3-letter month (`MMM`), year — each clickable to open that period note. Weekday headers are single letters.
|
||||||
|
- **Nav buttons:** ◀/▶ shift month ±1. "Today" resets to current month. The `calendar-search` button calls `showPicker()` on a hidden native `<input type="date">` (`.waypoint-calendar-pick-input`); picking a date calls `showDate()` — the calendar jumps to that month and marks the day without opening or creating a note.
|
||||||
|
- **Week number column:** Clicking a week number opens the weekly note for that week's Monday; middle-clicking opens it in a new tab.
|
||||||
|
- **Day cells:** Left-click opens the daily note, middle-click opens it in a new tab, right-click opens the day context menu (below). `.other-month` is muted; `.today` has an inset accent ring; hover receives a quiet fill. With `indicatorMode: 'any'`, `.has-note` shows the existing single neutral dot through the O(1) `plugin.hasNoteForDate(dateStr)` lookup. With `indicatorMode: 'systems'`, the view calls `getDateSystemIndicators()` once for the month and renders one tooltip-labelled coloured dot per matching daily/journal/meeting/custom system.
|
||||||
|
- **Grid generation:** `getMonthGrid(year, month, firstDayOfWeek)` in `date-utils.ts` produces up to 6 weeks, each with 7 `CalendarDay` objects containing `moment`, `dayOfMonth`, `isToday`, `isCurrentMonth`, `isoWeekNumber`.
|
||||||
|
|
||||||
|
**Day context menu (right-click):** Built from a single `plugin.findDateSystemNotes(day.date)` call. The first entry is a non-clickable header showing the full date. Then, per system in `dateSystems()` order:
|
||||||
|
|
||||||
|
- Each existing note, labelled with its `DateSystemNote.label` and the system's `icon`. Click opens it in the current leaf; Ctrl/Cmd-click opens it in a new tab.
|
||||||
|
- A create entry (icon `plus`) labelled `New {lowercased system name} note`. Many-per-date systems always show one, with a trailing ellipsis because it first opens a `PromptModal` for the title (`New meeting note…`). A one-per-date system shows one without the ellipsis only while its note is missing (`New journal note`); once the note exists, the existing-note entry is all it gets.
|
||||||
|
|
||||||
|
Every label is derived from `system.name`, so a renamed or newly added system needs no view changes. Left-click and middle-click on the cell are untouched.
|
||||||
|
|
||||||
|
### Recent Files Panel
|
||||||
|
|
||||||
|
Renders `recentFilesFor(plugin.recentFiles, settings.show)` as Obsidian-native `nav-file` elements using the file explorer's CSS classes (`tree-item`, `nav-file-title`, `nav-file-title-content`).
|
||||||
|
|
||||||
|
**Header switch** (`.waypoint-recent-show`): `all` / `opened` / `changed`, saved to `settings.recentFiles.show`.
|
||||||
|
|
||||||
|
**Type icons** (`.waypoint-recent-icon`): a file whose frontmatter `type` matches a configured type with an icon shows that Lucide icon before its name. Once any type has an icon, every row reserves the slot so names stay aligned.
|
||||||
|
|
||||||
|
**Per-file features:**
|
||||||
|
- **Active indicator:** `.is-active` class if path matches `workspace.getActiveFile()`.
|
||||||
|
- **Remove button:** × icon, appears on hover (`.waypoint-recent-remove`), drops the entry from `plugin.recentFiles`, calls `persistRecentFiles()`, then redraws.
|
||||||
|
- **Background-change dot:** `.waypoint-recent-changed` after the name when `changedInBackground` is set, with tooltip "Changed in the background". Cleared when the file is opened.
|
||||||
|
- **Drag:** Uses `app.dragManager.dragFile()` for native Obsidian drag.
|
||||||
|
- **Hover preview:** Triggers `hover-link` event for Obsidian's page preview popup.
|
||||||
|
- **Context menu:** "Open in new tab" + Obsidian's native `file-menu` event.
|
||||||
|
- **Click:** `Keymap.isModEvent(event)` determines if opening in new leaf; otherwise same leaf.
|
||||||
|
- **Middle click:** Opens in new tab.
|
||||||
|
|
||||||
|
### Bookmarks/Favorites Panel
|
||||||
|
|
||||||
|
**Empty state:** Right-click on "Waypoint Bookmarks" header shows add menu:
|
||||||
|
- Add current file → `addBookmark(path, basename, 'file')`
|
||||||
|
- New group → `addBookmark('', 'New Group', 'group', 'folder')`
|
||||||
|
- Add separator → `addBookmark('', '', 'separator')`
|
||||||
|
- Add spacer → `addBookmark('', '', 'spacer')`
|
||||||
|
|
||||||
|
**Rendering:** `renderBookmarkList(container, items, depth)` recursively renders items with `paddingLeft: 8 + depth * 16px` for indentation.
|
||||||
|
|
||||||
|
**Item types:**
|
||||||
|
| Type | Render | Behavior |
|
||||||
|
|---|---|---|
|
||||||
|
| `file` | icon + label | Click opens file. Tooltip = filePath. |
|
||||||
|
| `group` | chevron + icon + label | Click toggles `collapsed`. Children rendered in nested `waypoint-bookmark-children` div (hidden when collapsed). |
|
||||||
|
| `separator` | horizontal line (::after pseudo-element) | No click handler. Context menu for delete. |
|
||||||
|
| `spacer` | 14px empty div | No click handler. Context menu for delete. |
|
||||||
|
|
||||||
|
**Drag-and-drop:** All bookmark items are draggable. Drop indicators show a 3px accent border above/below the target. On drop:
|
||||||
|
1. Remove dragged item from its current position (recursive search).
|
||||||
|
2. Insert at the target position (before or after based on cursor Y position relative to target midY).
|
||||||
|
3. If target not found (edge case), push to root.
|
||||||
|
4. Save + redraw.
|
||||||
|
|
||||||
|
**Context menu (right-click):**
|
||||||
|
- File items: "Open in new tab"
|
||||||
|
- File/Group items: "Rename" (opens `PromptModal`), "Change icon" (opens `IconSuggestModal`)
|
||||||
|
- "Move to group" submenu: Lists all available groups (excluding self + descendants) + "(Root)" for ungrouping
|
||||||
|
- Group items: "Expand/Collapse", "Add bookmark here", "New sub-group"
|
||||||
|
- All items: "Insert separator above/below", "Insert spacer above/below", "Remove"
|
||||||
|
|
||||||
|
**Move to group (`moveBookmarkToGroup`):**
|
||||||
|
1. Remove item from current position.
|
||||||
|
2. If targetGroupId: find group, set `item.indent = group.indent + 1`, push to group's children.
|
||||||
|
3. If null (root): set `item.indent = 0`, push to `waypointData.bookmarks`.
|
||||||
|
|
||||||
|
**Prompt modal (`PromptModal`):** Simple Modal with a text input plus Cancel and CTA buttons. Enter key submits. Constructed as `new PromptModal(app, options, onSubmit)`, where `options` is `{ title, placeholder?, initialValue?, cta? }` and `cta` (the submit button label) defaults to `Save`. Generalized from the old rename-only `RenameModal` so the calendar's day context menu can reuse it to prompt for a note title.
|
||||||
|
|
||||||
|
**Icon picker (`IconSuggestModal`):** Modal with:
|
||||||
|
- Live preview of selected icon.
|
||||||
|
- Search input with 60ms debounce.
|
||||||
|
- Grid of matching icons (max 80 shown), loaded from `https://cdn.jsdelivr.net/npm/lucide-static@0.517.0/tags.json` with fallback to `https://lucide.dev/api/tags` and a hardcoded `FALLBACK_ICONS` object (~300 icons). The fetch result is cached for the session, so at most one network round-trip happens no matter how often the picker is opened.
|
||||||
|
- Click to select, **No icon** button to clear, Save/Cancel buttons.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## CSS Architecture (`styles.css`)
|
||||||
|
|
||||||
|
All classes prefixed with `waypoint-`. Uses Obsidian CSS variables throughout:
|
||||||
|
|
||||||
|
- `--font-ui-small`, `--font-ui-medium`, `--font-semibold`, `--font-medium`, `--font-light`
|
||||||
|
- `--text-muted`, `--text-faint`, `--text-accent`, `--text-on-accent`, `--text-error`
|
||||||
|
- `--background-modifier-border`, `--background-modifier-active-hover`, `--background-modifier-hover`, `--background-primary`, `--background-primary-alt`, `--background-secondary`
|
||||||
|
- `--interactive-accent`
|
||||||
|
- `--cursor-link` (pointer cursor, with a `pointer` fallback)
|
||||||
|
|
||||||
|
Key layout:
|
||||||
|
- `.waypoint-view` — flex column, `overflow-y: auto` (hidden on mobile, where `.waypoint-lists` scrolls instead), 8px padding.
|
||||||
|
- `.waypoint-section` — `flex-shrink: 0`, 16px bottom margin. `.waypoint-calendar-section` gets `margin-top: auto` (pins calendar to bottom).
|
||||||
|
- `.waypoint-settings-tabs` — wraps onto several rows; on mobile the tabs become rounded pills without the underline overlap.
|
||||||
|
- `.waypoint-calendar` — padded, bordered surface with separated day cells for clear scan lines.
|
||||||
|
- Calendar table — `table-layout: fixed`, `border-collapse: separate`, 2px horizontal / 3px vertical cell spacing.
|
||||||
|
- `.waypoint-day.today` — accent text with an inset accent ring, avoiding layout shifts.
|
||||||
|
- `.waypoint-day.has-note::after` — neutral single-dot indicator.
|
||||||
|
- `.waypoint-day-indicators` / `.waypoint-day-indicator` — compact ordered dot row; `--waypoint-indicator-color` carries each configured system colour.
|
||||||
|
- `.waypoint-bm-chevron` — `rotate(-90deg)` on collapsed groups.
|
||||||
|
- `.waypoint-bm-drop-line` / `.waypoint-bm-drop-below` — 3px accent border for drag indicators.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Date Utilities (`date-utils.ts`)
|
||||||
|
|
||||||
|
All use Obsidian's bundled `moment` (not the npm package).
|
||||||
|
|
||||||
|
| Function | Signature | Returns |
|
||||||
|
|---|---|---|
|
||||||
|
| `getPeriodInfo(date)` | `Moment → PeriodInfo` | `{day, week, month, quarter, year}` strings for the date |
|
||||||
|
| `getQuarterString(date)` | `Moment → string` | e.g. `"2026-Q3"` |
|
||||||
|
| `getTodayPeriod()` | `() → PeriodInfo` | Current date's period info |
|
||||||
|
| `getMonthGrid(year, month, firstDayOfWeek)` | `number, number, number → CalendarWeek[]` | Up to 6 weeks, each with 7 `CalendarDay` objects |
|
||||||
|
| `formatDateLabel(date)` | `Moment → string` | `"June 1st, 2026"` |
|
||||||
|
| `formatMonthLabel(date)` | `Moment → string` | `"June 2026"` |
|
||||||
|
| `formatQuarterLabel(date)` | `Moment → string` | `"Q3 2026"` |
|
||||||
|
| `navigateDate(date, period, delta)` | `Moment, period, number → Moment` | Clones + adds delta (quarters: delta×3 months) |
|
||||||
|
| `formatPeriodName(date, format)` | `Moment, string → string` | `date.format(format)` wrapper |
|
||||||
|
| `getISOWeek(date)` | `Moment → number` | `date.isoWeek()` |
|
||||||
|
|
||||||
|
**`getMonthGrid` algorithm:**
|
||||||
|
1. Find the first day to display by subtracting `(firstOfMonth.day() - firstDayOfWeek + 7) % 7` days from the 1st.
|
||||||
|
2. Iterate day-by-day, building 7-day weeks.
|
||||||
|
3. Each `CalendarDay` tracks: `date` (Moment), `dayOfMonth`, `isToday`, `isCurrentMonth`, `isoWeekNumber`.
|
||||||
|
4. Week's `weekNumber` = first day's ISO week number.
|
||||||
|
5. Safety break after 6 weeks.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Settings Persistence
|
||||||
|
|
||||||
|
Settings and waypoint data share a single `data.json` via Obsidian's `Plugin.loadData()/saveData()`:
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
// loadData() returns:
|
||||||
|
{
|
||||||
|
settings: { calendar: {...}, daily: {...}, ... },
|
||||||
|
waypointData: { bookmarks: [...] }
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
`onload()` reads `data.json` once, then `applySettings(saved)` and `applyWaypointData(saved)` merge partial persisted values over defaults. `persistAll()` writes both in-memory keys through one promise chain; it never re-reads stale disk state. Recent-file writes additionally go through the 300ms debounce in `persistRecentFiles()`.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Redraw Mechanism
|
||||||
|
|
||||||
|
`broadcastRedraw()` iterates all leaves of `WAYPOINT_VIEW_TYPE` and calls `view.redraw()` on each. `redraw()` is a full DOM rebuild (no virtual DOM, no diffing). This is triggered by:
|
||||||
|
|
||||||
|
- File open/create/delete/rename/modify events
|
||||||
|
- Bookmark add/remove/update
|
||||||
|
- Period navigation
|
||||||
|
- Settings changes (via `onSettingsChange` callback)
|
||||||
|
- Midnight detection (10-min interval)
|
||||||
|
|
||||||
|
The sidebar is re-rendered from scratch on every change. For a small sidebar this is acceptable; for larger bookmark lists it may cause flicker.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Known Limitations / Gaps
|
||||||
|
|
||||||
|
1. **No virtual DOM** — Full rebuild on every redraw. Bookmark drag/drop, rename, and any change tears down and rebuilds the entire sidebar. For a small sidebar this is acceptable; for larger bookmark lists it may cause flicker.
|
||||||
|
2. **IconSuggestModal fetches from CDN** — Network dependency for the Lucide tag list. The fetch happens at most once per session (the result is cached) and falls back to the hardcoded `FALLBACK_ICONS` list on failure, but a first-open with no network still degrades to that reduced list.
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2026 Olivier
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
@@ -0,0 +1,152 @@
|
|||||||
|
# Waypoint Sidebar — QA Checklist
|
||||||
|
|
||||||
|
## Bookmarks: Middle Click
|
||||||
|
|
||||||
|
- [ ] Middle-click on a **file bookmark** opens the file in a new tab
|
||||||
|
- [ ] Middle-click on a **group bookmark with a linked file** opens that file in a new tab
|
||||||
|
- [ ] Middle-click on a **group bookmark with no file** does nothing (no error)
|
||||||
|
- [ ] Ctrl/Cmd+click on a **file bookmark** opens in a new leaf (same as Obsidian default)
|
||||||
|
- [ ] Ctrl/Cmd+click on a **group bookmark with a linked file** opens in a new leaf
|
||||||
|
- [ ] Ctrl/Cmd+click on a **group bookmark with no file** still toggles collapse
|
||||||
|
- [ ] Regular left-click on a **file bookmark** opens the file in the same leaf
|
||||||
|
- [ ] Regular left-click on a **group with a file** opens the file (does NOT toggle collapse)
|
||||||
|
- [ ] Regular left-click on a **group without a file** toggles collapse
|
||||||
|
|
||||||
|
## Bookmarks: Parent Notes (File as Group)
|
||||||
|
|
||||||
|
- [ ] Right-click header → "Add as parent note" creates a group with the current file linked
|
||||||
|
- [ ] Clicking the parent note row opens the linked file
|
||||||
|
- [ ] Clicking the chevron toggles collapse of children
|
||||||
|
- [ ] Children render correctly under the parent note (indented)
|
||||||
|
- [ ] Collapsing the parent hides its children
|
||||||
|
- [ ] A **file bookmark** that has children shows a chevron
|
||||||
|
- [ ] Clicking the chevron on a file bookmark toggles its children
|
||||||
|
- [ ] Clicking the file bookmark row itself still opens the file
|
||||||
|
- [ ] Drag-and-drop still works for reordering items inside/outside parent notes
|
||||||
|
|
||||||
|
## Bookmarks: No Default Icon
|
||||||
|
|
||||||
|
- [ ] New file bookmarks have **no icon** (empty space where icon was)
|
||||||
|
- [ ] New groups have **no icon** (empty space where folder icon was)
|
||||||
|
- [ ] "Add bookmark here" from group context menu creates child with no icon
|
||||||
|
- [ ] "Add child note" from group context menu creates child with no icon
|
||||||
|
- [ ] Existing bookmarks with icons still show their icons (no regression)
|
||||||
|
- [ ] Right-click → "Change icon" still works to add an icon later
|
||||||
|
|
||||||
|
## Bookmarks: Icon Search (Lucide Tags)
|
||||||
|
|
||||||
|
- [ ] Open the icon picker → type "meeting" → should find `calendar` (tag match)
|
||||||
|
- [ ] Type "heart" → should find `heart`, `red-heart`, etc.
|
||||||
|
- [ ] Type "arrow" → should find all arrow icons
|
||||||
|
- [ ] Type a tag keyword like "fitness" → should find `activity`, `dumbbell`, etc.
|
||||||
|
- [ ] Clear search (empty input) → shows first 80 icons
|
||||||
|
- [ ] Set an icon on a bookmark, reopen the picker, click "No icon" → the previously-set icon is cleared
|
||||||
|
- [ ] Click an icon → preview updates, grid highlights selection
|
||||||
|
- [ ] Click Save → icon applied, click Cancel → no change
|
||||||
|
- [ ] Test with **network offline** → falls back to FALLBACK_ICONS list
|
||||||
|
|
||||||
|
## Bookmarks: General (Regression)
|
||||||
|
|
||||||
|
- [ ] Drag-and-drop reordering still works between all item types
|
||||||
|
- [ ] Rename still works (right-click → Rename)
|
||||||
|
- [ ] Remove still works (right-click → Remove)
|
||||||
|
- [ ] Move to group still works (right-click → group submenu)
|
||||||
|
- [ ] Separators and spacers still render and can be dragged/deleted
|
||||||
|
- [ ] "Insert separator above/below" and "Insert spacer above/below" still work
|
||||||
|
- [ ] Hover preview (page preview popup) still works on file bookmarks
|
||||||
|
- [ ] Right-click context menu on a file bookmark still shows native Obsidian file-menu items
|
||||||
|
- [ ] Bookmarks persist across vault reload
|
||||||
|
- [ ] Move a folder containing bookmarked files to a new location → those bookmarks survive and still open the moved files
|
||||||
|
|
||||||
|
## Periodic Notes: Reuse Existing Tabs
|
||||||
|
|
||||||
|
- [ ] An existing configuration without `reusePeriodicNoteTabs` loads with the toggle off
|
||||||
|
- [ ] Enable **Periodic Notes → Use existing tabs**, reload the plugin, and verify it stays enabled
|
||||||
|
- [ ] For each of daily, weekly, monthly, quarterly, and yearly: open the current note in another pane, run its **Go to…** command repeatedly → that tab becomes active, its editor position is preserved, and no duplicate opens
|
||||||
|
- [ ] For each type, a note with the same basename in another folder is not reused; the configured path opens or is created normally
|
||||||
|
- [ ] Regular calendar clicks and next/previous navigation focus existing periodic-note tabs when enabled
|
||||||
|
- [ ] With the toggle off, all five commands retain their original active-leaf opening behaviour
|
||||||
|
- [ ] With the toggle on, an explicit open-in-new-tab action still creates a new tab
|
||||||
|
- [ ] A deferred periodic-note tab or a periodic-note tab in a pop-out window is revealed and focused instead of duplicated
|
||||||
|
|
||||||
|
## Calendar (Regression)
|
||||||
|
|
||||||
|
- [ ] Calendar renders with correct month grid
|
||||||
|
- [ ] Click on a day → opens/creates daily note
|
||||||
|
- [ ] Click on week number → opens/creates weekly note
|
||||||
|
- [ ] Middle-click on a week number → opens/creates the weekly note in a new tab, with no console error
|
||||||
|
- [ ] Click Q/M/Y breadcrumb → opens respective period note
|
||||||
|
- [ ] ◀/▶ navigation shifts month
|
||||||
|
- [ ] "Today" button returns to current month
|
||||||
|
- [ ] Note indicator dots show on days with existing .md files
|
||||||
|
- [ ] Today is highlighted with accent border
|
||||||
|
|
||||||
|
## Calendar: System-coloured indicators
|
||||||
|
|
||||||
|
- [ ] Calendar → Indicator style → **Single dot** keeps one neutral dot for an existing date-named note
|
||||||
|
- [ ] Calendar → Indicator style → **Colour by note system** shows a blue dot for Daily, green for Journal, and violet for Meeting by default
|
||||||
|
- [ ] A day holding multiple meeting notes still shows exactly one Meeting dot
|
||||||
|
- [ ] A day holding Daily, Journal, and Meeting notes shows three compact dots in that order
|
||||||
|
- [ ] Hover each coloured dot → its date-system name is identified by a tooltip
|
||||||
|
- [ ] Change Daily/Journal/Meeting indicator colours in Settings → the visible calendar refreshes immediately
|
||||||
|
- [ ] Add a custom date system with its own colour and a matching note → its dot appears in system order
|
||||||
|
- [ ] Create, delete, or rename a date-system note → coloured dots refresh without changing months
|
||||||
|
- [ ] An install that previously had **Single dot** as its silently-defaulted, never-touched setting shows **Colour by note system** after upgrading and reloading the plugin
|
||||||
|
- [ ] After that one-time change, manually selecting **Single dot** and reloading again keeps **Single dot** — the migration never re-fires
|
||||||
|
- [ ] Typing in any Template file field opens Obsidian's native fuzzy-suggest popup (matching the look of Templater's own template pickers), not a plain browser dropdown
|
||||||
|
|
||||||
|
## Calendar: Date systems
|
||||||
|
|
||||||
|
- [ ] Right-click a date with a daily note, journal note, and meeting note → full-date header, then all three systems appear in the menu
|
||||||
|
- [ ] Right-click a date with no date-system notes → each single-note system offers a create action and the many-note system offers “New …”
|
||||||
|
- [ ] Right-click a date with one meeting → the existing meeting and “New meeting note…” both appear
|
||||||
|
- [ ] Create a second meeting for the same date → it is created with that date prefix and both meetings appear on the next right-click
|
||||||
|
- [ ] Ctrl/Cmd-click an existing date-system menu entry → it opens in a new tab
|
||||||
|
- [ ] Submit an empty title for a new many-note system → a clear notice appears and no malformed file is created
|
||||||
|
- [ ] Add a date system in Settings → Date systems → it appears in the day menu
|
||||||
|
- [ ] Reorder and delete date systems → the day menu immediately follows the configured order and removes the deleted system
|
||||||
|
- [ ] Enter a non-empty name format with no date token → Settings shows the inline warning
|
||||||
|
- [ ] Left-click a day still opens/creates its daily note; middle-click still opens it in a new tab
|
||||||
|
|
||||||
|
- [ ] With Templater folder mappings for journal and meetings, create a date-system note → Templater expands `<% … %>` syntax rather than leaving it literal
|
||||||
|
- [ ] Create a journal from the calendar → no duplicate date prompt and no rename; its frontmatter `date` equals the selected calendar day
|
||||||
|
- [ ] Create a meeting from the calendar for a non-today date → its frontmatter `date` equals the selected calendar day
|
||||||
|
|
||||||
|
## Recent Files (Regression)
|
||||||
|
|
||||||
|
- [ ] Opening a file adds it to recent files
|
||||||
|
- [ ] Most recent file appears at the top
|
||||||
|
- [ ] Active file is highlighted
|
||||||
|
- [ ] Remove button (×) works on hover
|
||||||
|
- [ ] Left-click opens file, middle-click opens in new tab
|
||||||
|
- [ ] Right-click shows "Open in new tab" + native file menu
|
||||||
|
- [ ] Hover preview popup works
|
||||||
|
|
||||||
|
## Calendar: Date picker and "Open date" command
|
||||||
|
|
||||||
|
- [ ] The calendar-search button right of ▶ opens the native date picker (desktop popup, mobile sheet)
|
||||||
|
- [ ] Picking a date jumps the calendar to that month and fills that day with the accent colour; no note is opened or created
|
||||||
|
- [ ] "Today" or ◀/▶ clears the picked-day highlight
|
||||||
|
- [ ] Command "Open daily note for a date…" opens a modal prefilled with today; Enter or Open opens/creates that day's daily note and the calendar shows its month with the day marked
|
||||||
|
- [ ] Cancel or Escape closes the modal without opening anything
|
||||||
|
|
||||||
|
## Recent Files: Opened / changed, background dot, type icons
|
||||||
|
|
||||||
|
- [ ] The header switch beside "Recent Files" shows all / opened / changed; the choice survives a reload
|
||||||
|
- [ ] "opened" lists only files you opened; "changed" lists files that changed (yours and background); "all" orders by the later of the two
|
||||||
|
- [ ] A file changed while another note is active (sync, another plugin) moves to the top of all/changed with a dot; tooltip "Changed in the background"
|
||||||
|
- [ ] Opening that file clears the dot
|
||||||
|
- [ ] Editing the active note never shows a dot; neither does switching tabs right after typing (late save of the note you just left)
|
||||||
|
- [ ] Typing in the active note does not rebuild the sidebar on every save
|
||||||
|
- [ ] A note created in the background (e.g. synced) appears with a dot; a note you create and open yourself does not keep one
|
||||||
|
- [ ] Vault startup does not flood the list with every file
|
||||||
|
- [ ] With Max items = N, many background changes do not push out the N most recently opened files
|
||||||
|
- [ ] An existing list from before this version keeps its order (all entries appear under "opened")
|
||||||
|
- [ ] File types: add a type, pick an icon in the picker, matching recent files show the icon; names stay aligned; trash removes the type
|
||||||
|
- [ ] Settings → Recent Files has no "Type filter" toggle and no pills appear above the list; an old saved `filterTags`/`showTypeFilter` loads without error and is dropped
|
||||||
|
|
||||||
|
## Mobile
|
||||||
|
|
||||||
|
- [ ] Opening the left drawer shows the whole calendar at the bottom; bookmarks and recent files scroll above it
|
||||||
|
- [ ] The date button fits inside the calendar header next to ◀ Today ▶
|
||||||
|
- [ ] Settings tabs wrap onto several rows instead of overflowing
|
||||||
@@ -2,10 +2,17 @@
|
|||||||
|
|
||||||
Calendar, recent files, and custom bookmarks sidebar for Obsidian.
|
Calendar, recent files, and custom bookmarks sidebar for Obsidian.
|
||||||
|
|
||||||
|
## v1.10.0
|
||||||
|
|
||||||
|
- Calendar weekday headings use single English letters and month names use English abbreviations.
|
||||||
|
- Removed Recent Files type-filter pills and their toggle; **File types** icons and **Omitted tags** remain available.
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
|
|
||||||
- **Calendar panel** — month grid with clickable days, week numbers, period indicators (day/week/month/quarter/year)
|
- **Calendar panel** — refined month grid; left-click a day opens its daily note, middle-click opens it in a tab, and right-click reveals every configured note system for that date. The date button beside **Today** jumps to any date.
|
||||||
- **Recent files** — track recently opened/edited files
|
- **Calendar indicators** — retain a single neutral note dot or show a coloured dot per daily, journal, meeting, or custom date system
|
||||||
|
- **Recent files** — files you opened and files that changed. The switch beside the title shows all, only opened, or only changed files. A dot marks a file changed in the background (sync, another plugin) until you open it. Give frontmatter types (meeting, daily-note…) an icon under **Settings → Recent Files → File types**.
|
||||||
|
- **Mobile** — the whole calendar stays on screen when the sidebar opens; the lists above it scroll on their own.
|
||||||
- **Favorites** — custom bookmarks with groups, icons, and rename
|
- **Favorites** — custom bookmarks with groups, icons, and rename
|
||||||
|
|
||||||
## Commands
|
## Commands
|
||||||
@@ -18,6 +25,39 @@ Calendar, recent files, and custom bookmarks sidebar for Obsidian.
|
|||||||
| Go to quarterly note | `Ctrl+Shift+Alt+Q` |
|
| Go to quarterly note | `Ctrl+Shift+Alt+Q` |
|
||||||
| Go to yearly note | `Ctrl+Shift+Alt+Y` |
|
| Go to yearly note | `Ctrl+Shift+Alt+Y` |
|
||||||
| Next/Previous daily/weekly/monthly/quarterly/yearly note | — |
|
| Next/Previous daily/weekly/monthly/quarterly/yearly note | — |
|
||||||
|
| Open daily note for a date… | — |
|
||||||
|
|
||||||
|
Under **Settings → Waypoint Sidebar → Periodic Notes**, turn on **Use existing tabs** to switch to a daily, weekly, monthly, quarterly, or yearly note's tab if it is already open. This works with the five **Go to…** commands, next/previous navigation, and regular calendar clicks. If the note is not open, it opens or is created as usual. The setting is off by default. It keeps your place in the note and leaves existing duplicate tabs alone. Choosing to open a new tab still opens a new tab.
|
||||||
|
|
||||||
|
## Date systems
|
||||||
|
|
||||||
|
Right-click any calendar day to open its **date systems** menu. The daily note always appears first; left-click behaviour is unchanged. The included defaults match this vault's common layouts:
|
||||||
|
|
||||||
|
| System | Folder | Name format | Behaviour |
|
||||||
|
|---|---|---|---|
|
||||||
|
| Journal | `periodic/journal` | `YYYY-MM-DD - [Journal]` | Opens or creates one journal note for the date |
|
||||||
|
| Meeting | `periodic/meetings` | `YYYY-MM-DD - {title}` | Lists every meeting for the date and can create another |
|
||||||
|
|
||||||
|
Configure systems in **Settings → Waypoint Sidebar → Date systems**. Each system has a folder, filename format, template, fallback frontmatter type, Lucide icon, and indicator colour. Template file fields autocomplete every Markdown path in the vault.
|
||||||
|
|
||||||
|
`Name format` uses moment.js tokens. Bracket-escape literal text: `YYYY-MM-DD - [Journal]`. Add `{title}` when a date can have multiple notes; it is replaced with the title requested when creating a note. Without `{title}`, the system has exactly one note per date.
|
||||||
|
|
||||||
|
Ctrl/Cmd-click a menu entry opens it in a new tab.
|
||||||
|
|
||||||
|
### Calendar indicators
|
||||||
|
|
||||||
|
Under **Settings → Waypoint Sidebar → Calendar**, choose either:
|
||||||
|
|
||||||
|
- **Colour by note system** — the default; one compact coloured dot per configured date system that has a note on that day. Hover a dot to identify its system.
|
||||||
|
- **Single dot** — a neutral marker for any note whose filename is exactly the date.
|
||||||
|
|
||||||
|
Daily uses the Calendar tab’s colour picker. Journal, Meeting, and every custom system have their own **Indicator colour** picker under **Date systems**. The defaults are blue for Daily, green for Journal, and violet for Meeting.
|
||||||
|
|
||||||
|
### Templater folder templates
|
||||||
|
|
||||||
|
If a date system uses a Templater folder mapping, leave its Waypoint **Template file** field blank. Waypoint then creates a safe fallback note while Templater owns prompts, scripts, cursors, and rendered content.
|
||||||
|
|
||||||
|
The selected calendar date is encoded in the filename. Templater templates should derive their `date` from `tp.file.title`, not from `tp.date` or `tp.file.creation_date()`. A journal template can retain a prompt-and-rename fallback for manual note creation, but it must skip that flow when the filename already follows `YYYY-MM-DD - Journal`.
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
|
|||||||
@@ -2,15 +2,22 @@
|
|||||||
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
|
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var $=Object.defineProperty;var z=Object.getOwnPropertyDescriptor;var H=Object.getOwnPropertyNames;var _=Object.prototype.hasOwnProperty;var U=(f,d)=>{for(var t in d)$(f,t,{get:d[t],enumerable:!0})},K=(f,d,t,e)=>{if(d&&typeof d=="object"||typeof d=="function")for(let n of H(d))!_.call(f,n)&&n!==t&&$(f,n,{get:()=>d[n],enumerable:!(e=z(d,n))||e.enumerable});return f};var X=f=>K($({},"__esModule",{value:!0}),f);var ee={};U(ee,{default:()=>R});module.exports=X(ee);var u=require("obsidian");var j={calendar:{firstDayOfWeek:1,showNoteIndicators:!0},daily:{folder:"periodic/daily",templateFile:"Templates/Daily note",nameFormat:"YYYY-MM-DD",typeProperty:"daily-note"},weekly:{folder:"periodic/weekly",templateFile:"Templates/Weekly note",nameFormat:"GGGG-[W]WW",typeProperty:"weekly-note"},monthly:{folder:"periodic/monthly",templateFile:"Templates/Monthly note",nameFormat:"YYYY-MM",typeProperty:"monthly-note"},quarterly:{folder:"periodic/quarterly",templateFile:"Templates/Quarterly note",nameFormat:"YYYY-[Q]Q",typeProperty:"quarterly-note"},yearly:{folder:"periodic/yearly",templateFile:"Templates/Yearly note",nameFormat:"YYYY",typeProperty:"yearly-note"},recentFiles:{maxItems:50,updateOn:"file-open",omittedPaths:[],omittedTags:[]}};var g=require("obsidian"),W=class extends g.PluginSettingTab{constructor(d,t,e,n){super(d,t),this.plugin=t,this.settings=e,this.onSettingsChange=n}display(){let{containerEl:d}=this;d.empty(),new g.Setting(d).setHeading().setName("Calendar"),new g.Setting(d).setName("First day of week").setDesc("Which day the calendar week starts on.").addDropdown(n=>{n.addOption("0","Sunday").addOption("1","Monday").setValue(String(this.settings.calendar.firstDayOfWeek)).onChange(r=>{this.settings.calendar.firstDayOfWeek=parseInt(r,10),this.saveAndRefresh()})}),new g.Setting(d).setName("Show note indicators").setDesc("Show a dot on days that have existing notes.").addToggle(n=>{n.setValue(this.settings.calendar.showNoteIndicators).onChange(r=>{this.settings.calendar.showNoteIndicators=r,this.saveAndRefresh()})}),new g.Setting(d).setHeading().setName("Periodic Note Paths"),this.addPeriodNoteSettings("Daily",this.settings.daily),this.addPeriodNoteSettings("Weekly",this.settings.weekly),this.addPeriodNoteSettings("Monthly",this.settings.monthly),this.addPeriodNoteSettings("Quarterly",this.settings.quarterly),this.addPeriodNoteSettings("Yearly",this.settings.yearly),new g.Setting(d).setHeading().setName("Recent Files"),new g.Setting(d).setName("Max items").setDesc("Maximum number of recent files to track.").addText(n=>{n.inputEl.setAttr("type","number"),n.inputEl.setAttr("placeholder","50"),n.setValue(String(this.settings.recentFiles.maxItems)),n.inputEl.onblur=()=>{let r=parseInt(n.getValue(),10);!isNaN(r)&&r>0&&(this.settings.recentFiles.maxItems=r,this.saveAndRefresh())}}),new g.Setting(d).setName("Update on").setDesc("When to add a file to the recent list.").addDropdown(n=>{n.addOption("file-open","File opened").addOption("file-edit","File changed").setValue(this.settings.recentFiles.updateOn).onChange(r=>{this.settings.recentFiles.updateOn=r,this.saveAndRefresh()})});let t=new DocumentFragment;t.appendText("Regex patterns for paths to exclude. One per line."),new g.Setting(d).setName("Omitted paths").setDesc(t).addTextArea(n=>{n.inputEl.setAttr("rows",4),n.setPlaceholder(`^archives/
|
var ne=Object.defineProperty;var ke=Object.getOwnPropertyDescriptor;var be=Object.getOwnPropertyNames;var De=Object.prototype.hasOwnProperty;var Se=(c,d)=>{for(var e in d)ne(c,e,{get:d[e],enumerable:!0})},Fe=(c,d,e,n)=>{if(d&&typeof d=="object"||typeof d=="function")for(let a of be(d))!De.call(c,a)&&a!==e&&ne(c,a,{get:()=>d[a],enumerable:!(n=ke(d,a))||n.enumerable});return c};var xe=c=>Fe(ne({},"__esModule",{value:!0}),c);var Ae={};Se(Ae,{default:()=>ee});module.exports=xe(Ae);var y=require("obsidian");var G={name:"",folder:"",nameFormat:"YYYY-MM-DD - {title}",templateFile:"",typeProperty:"",icon:"file",indicatorColor:"#64748b"},M={calendar:{firstDayOfWeek:1,showNoteIndicators:!0,indicatorMode:"systems",dailyIndicatorColor:"#3b82f6"},daily:{folder:"periodic/daily",templateFile:"Templates/Daily note",nameFormat:"YYYY-MM-DD",typeProperty:"daily-note"},reusePeriodicNoteTabs:!1,weekly:{folder:"periodic/weekly",templateFile:"Templates/Weekly note",nameFormat:"GGGG-[W]WW",typeProperty:"weekly-note"},monthly:{folder:"periodic/monthly",templateFile:"Templates/Monthly note",nameFormat:"YYYY-MM",typeProperty:"monthly-note"},quarterly:{folder:"periodic/quarterly",templateFile:"Templates/Quarterly note",nameFormat:"YYYY-[Q]Q",typeProperty:"quarterly-note"},yearly:{folder:"periodic/yearly",templateFile:"Templates/Yearly note",nameFormat:"YYYY",typeProperty:"yearly-note"},dateSystems:[{id:"journal",name:"Journal",folder:"periodic/journal",nameFormat:"YYYY-MM-DD - [Journal]",templateFile:"",typeProperty:"journal",icon:"book-open",indicatorColor:"#22c55e"},{id:"meetings",name:"Meeting",folder:"periodic/meetings",nameFormat:"YYYY-MM-DD - {title}",templateFile:"",typeProperty:"meeting",icon:"users",indicatorColor:"#a855f7"}],recentFiles:{maxItems:50,show:"all",omittedPaths:[],omittedTags:[],types:[]},display:{rowSize:26,rowSpacing:2,indentSize:16,fontSize:13,iconSize:16,calendarCellSize:32}};var f=require("obsidian");var me="{title}";function V(c){let d=c.indexOf(me);return d<0?{before:c,after:"",hasTitle:!1}:{before:c.slice(0,d),after:c.slice(d+me.length),hasTitle:!0}}function ae(c,d){if(!d)return!0;let e=d.endsWith("/")?d:`${d}/`;return c.startsWith(e)}function ie(c,d,e,n){return n?!d||c.length<d.length+e.length?!1:c.startsWith(d)&&c.endsWith(e):c===d+e}function ue(c,d,e){let n=c.startsWith(d)?d.length:0,a=e&&c.endsWith(e)?c.length-e.length:c.length;return a<=n?c:c.slice(n,a).trim()||c}var Te=/[\\/:*?"<>|#^[\]]/g;function ge(c){return c.replace(Te,"-").replace(/\s+/g," ").trim()}function W(c){let{before:d}=V(c),e=d.replace(/\[[^\]]*\]/g,"");return/[YMDQGWEwdgeo]/.test(e)}var h=require("obsidian");var B=require("obsidian");function ye(c,d,e){let n=(0,B.moment)({year:c,month:d,day:1}),a=(0,B.moment)(n).endOf("month"),t=(0,B.moment)(n).subtract((n.day()-e+7)%7,"days"),i=(0,B.moment)().startOf("day"),r=[],s=(0,B.moment)(t);for(;s.isBefore(a)||s.month()===d;){let o=[];for(let l=0;l<7;l++)o.push({date:(0,B.moment)(s),dayOfMonth:s.date(),isToday:s.isSame(i,"day"),isCurrentMonth:s.month()===d,isoWeekNumber:s.isoWeek()}),s.add(1,"day");if(r.push({weekNumber:o[0].isoWeekNumber,days:o}),r.length>=6)break}return r}function Ee(c,d){return d==="opened"?c.openedAt:d==="changed"||c.openedAt===void 0?c.changedAt:c.changedAt===void 0?c.openedAt:Math.max(c.openedAt,c.changedAt)}function R(c,d){let e=[];for(let n of c){let a=Ee(n,d);a!==void 0&&e.push({entry:n,key:a})}return e.sort((n,a)=>a.key-n.key),e.map(n=>n.entry)}function j(c,d){let e=new Set([...R(c,"opened").slice(0,d),...R(c,"changed").slice(0,d)]);return R(c,"all").filter(n=>e.has(n))}var E="waypoint-view";function Me(c){return c.dragManager}var O=class extends h.ItemView{constructor(e,n){super(e);this.redraw=()=>{this.contentEl.empty(),this.contentEl.addClass("waypoint-view");let e=this.plugin.settings.display;this.contentEl.style.setProperty("--wp-row-size",e.rowSize+"px"),this.contentEl.style.setProperty("--wp-row-spacing",e.rowSpacing+"px"),this.contentEl.style.setProperty("--wp-indent-size",e.indentSize+"px"),this.contentEl.style.setProperty("--wp-font-size",e.fontSize+"px"),this.contentEl.style.setProperty("--wp-icon-size",e.iconSize+"px"),this.contentEl.style.setProperty("--wp-cal-cell-size",e.calendarCellSize+"px");let n=this.contentEl.createDiv({cls:"waypoint-lists"});this.renderFavorites(n),this.renderRecentFiles(n),this.renderCalendar()};this.currentDisplayMonth=(0,h.moment)().month();this.currentDisplayYear=(0,h.moment)().year();this.dragId=null;this.dropZones=new WeakMap;this.selectedDate=null;this.plugin=n}getViewType(){return E}getDisplayText(){return"Waypoint"}getIcon(){return"compass"}async onOpen(){this.redraw()}async onClose(){}showDate(e){this.currentDisplayMonth=e.month(),this.currentDisplayYear=e.year(),this.selectedDate=e.clone(),this.redraw()}renderCalendar(){var le;let n=this.contentEl.createDiv({cls:"waypoint-section waypoint-calendar-section"}).createDiv({cls:"waypoint-calendar"}),a=(0,h.moment)(),t=(0,h.moment)({year:this.currentDisplayYear,month:this.cuLine truncated
|
||||||
\\.png$`),n.setValue(this.settings.recentFiles.omittedPaths.join(`
|
\\.png$`),t.setValue(this.settings.recentFiles.omittedPaths.join(`
|
||||||
`)),n.inputEl.onblur=()=>{this.settings.recentFiles.omittedPaths=n.getValue().split(`
|
`)),t.inputEl.onblur=()=>{this.settings.recentFiles.omittedPaths=t.getValue().split(`
|
||||||
`).filter(r=>r.trim()),this.saveAndRefresh()}});let e=new DocumentFragment;e.appendText("Regex patterns for frontmatter tags to exclude. One per line."),new g.Setting(d).setName("Omitted tags").setDesc(e).addTextArea(n=>{n.inputEl.setAttr("rows",4),n.setPlaceholder(`ignore
|
`).filter(i=>i.trim()),this.saveAndRefresh()}});let a=new DocumentFragment;a.appendText("Regex patterns for frontmatter tags to exclude. One per line."),new f.Setting(e).setName("Omitted tags").setDesc(a).addTextArea(t=>{t.inputEl.setAttr("rows",4),t.setPlaceholder(`ignore
|
||||||
archive`),n.setValue(this.settings.recentFiles.omittedTags.join(`
|
archive`),t.setValue(this.settings.recentFiles.omittedTags.join(`
|
||||||
`)),n.inputEl.onblur=()=>{this.settings.recentFiles.omittedTags=n.getValue().split(`
|
`)),t.inputEl.onblur=()=>{this.settings.recentFiles.omittedTags=t.getValue().split(`
|
||||||
`).filter(r=>r.trim()),this.saveAndRefresh()}})}addPeriodNoteSettings(d,t){new g.Setting(this.containerEl).setHeading().setName(d),new g.Setting(this.containerEl).setName("Folder").setDesc(`Folder path for ${d.toLowerCase()} notes.`).addText(e=>{e.setPlaceholder("periodic/daily"),e.setValue(t.folder),e.onChange(n=>{t.folder=n,this.saveAndRefresh()})}),new g.Setting(this.containerEl).setName("Name format").setDesc(`Date format for ${d.toLowerCase()} note filenames (moment.js format).`).addText(e=>{e.setPlaceholder("yyyy-MM-dd"),e.setValue(t.nameFormat),e.onChange(n=>{t.nameFormat=n,this.saveAndRefresh()})}),new g.Setting(this.containerEl).setName("Template file").setDesc("Path to the template file (without .md extension).").addText(e=>{e.setPlaceholder("Templates/Daily note"),e.setValue(t.templateFile),e.onChange(n=>{t.templateFile=n,this.saveAndRefresh()})}),new g.Setting(this.containerEl).setName("Type property").setDesc("Value for the 'type' frontmatter property.").addText(e=>{e.setPlaceholder("daily-note"),e.setValue(t.typeProperty),e.onChange(n=>{t.typeProperty=n,this.saveAndRefresh()})})}async saveAndRefresh(){await this.plugin.saveData(this.settings),this.onSettingsChange()}};var h=require("obsidian");var T=require("obsidian");function Q(f,d,t){let e=(0,T.moment)({year:f,month:d,day:1}),n=(0,T.moment)(e).endOf("month"),r=(0,T.moment)(e).subtract((e.day()-t+7)%7,"days"),a=(0,T.moment)().startOf("day"),s=[],o=(0,T.moment)(r);for(;o.isBefore(n)||o.month()===d;){let i=[];for(let l=0;l<7;l++)i.push({date:(0,T.moment)(o),dayOfMonth:o.date(),isToday:o.isSame(a,"day"),isCurrentMonth:o.month()===d,isoWeekNumber:o.isoWeek()}),o.add(1,"day");if(s.push({weekNumber:i[0].isoWeekNumber,days:i}),s.length>=6)break}return s}var b="waypoint-view",Y=class extends h.ItemView{constructor(t,e){super(t);this.redraw=()=>{this.contentEl.empty(),this.contentEl.addClass("waypoint-view"),this.renderFavorites(),this.renderRecentFiles(),this.renderCalendar()};this.currentDisplayMonth=(0,h.moment)().month();this.currentDisplayYear=(0,h.moment)().year();this.dragId=null;this.plugin=e}getViewType(){return b}getDisplayText(){return"Waypoint"}getIcon(){return"compass"}async onOpen(){this.redraw()}async onClose(){}renderCalendar(){let t=this.contentEl.createDiv({cls:"waypoint-section"});t.createDiv({cls:"waypoint-section-header",text:"Calendar"});let e=t.createDiv({cls:"waypoint-calendar"}),n=(0,h.moment)(),r=(0,h.moment)({year:this.currentDisplayYear,month:this.currentDisplayMonth,day:1}),a=e.createDiv({cls:"waypoint-calendar-top"}),s=a.createDiv({cls:"waypoint-calendar-breadcrumb"}),o=r.format("[Q]Q");s.createSpan({cls:"waypoint-clickable",text:o}).addEventListener("click",()=>{this.plugin.openPeriodNote("quarter",r)});let l=r.format("MMMM");s.createSpan({cls:"waypoint-clickable",text:l}).addEventListener("click",()=>{this.plugin.openPeriodNote("month",r)});let c=r.format("YYYY");s.createSpan({cls:"waypoint-clickable",text:c}).addEventListener("click",()=>{this.plugin.openPeriodNote("year",r)});let D=a.createDiv({cls:"waypoint-calendar-today-group"}),I=D.createEl("button",{cls:"waypoint-calendar-nav-btn"});(0,h.setIcon)(I,"chevron-left"),I.addEventListener("click",()=>this.navigateMonth(-1)),D.createEl("button",{cls:"waypoint-calendar-today-btn",text:"Today"}).addEventListener("click",()=>{this.currentDisplayMonth=(0,h.moment)().month(),this.currentDisplayYear=(0,h.moment)().year(),this.redraw()});let M=D.createEl("button",{cls:"waypoint-calendar-nav-btn"});(0,h.setIcon)(M,"chevron-right"),M.addEventListener("click",()=>this.navigateMonth(1));let E=e.createEl("table"),x=E.createEl("thead").createEl("tr");x.createEl("th",{text:""});let y=["sun","mon","tue","wed","thu","fri","sat"],N=this.plugin.settings.calendar.firstDayOfWeek;for(let v=0;v<7;v++){let S=(N+v)%7;x.createEl("th",{text:y[S]})}let w=E.createEl("tbody"),C=Q(this.currentDisplayYear,this.currentDisplayMonth,this.plugin.settings.calendar.firstDayOfWeek);for(let v of C){let S=w.createEl("tr"),B=S.createEl("td",{cls:"waypoint-weeknum"});B.setText(String(v.weekNumber)),B.addEventListener("click",()=>{let k=v.days[0].date;this.plugin.openPeriodNote("week",k)});for(let k of v.days){let P=S.createEl("td",{cls:"waypoint-day"});if(P.setText(String(k.dayOfMonth)),k.isCurrentMonth||P.addClass("other-month"),k.isToday&&P.addClass("today"),this.plugin.settings.calendar.showNoteIndicators){let O=k.date.format("YYYY-MM-DD");this.plugin.app.vault.getFiles().some(V=>V.extension==="md"&&V.basename===O)&&P.addClass("has-note")}P.addEventListener("click",()=>{this.plugin.openPeriodNote("day",k.date)})}}}navigateMonth(t){let e=(0,h.moment)({year:this.currentDisplayYear,month:this.currentDisplayMonth}).add(t,"month");this.currentDisplayMonth=e.month(),this.currentDisplayYear=e.year(),this.redraw()}renderRecentFiles(){let t=this.contentEl.createDiv({cls:"waypoint-section waypoint-recent-files"});if(t.createDiv({cls:"waypoint-section-header",text:"Recent Files"}),this.plugin.recentFiles.length===0){
Line truncated
|
`).filter(i=>i.trim()),this.saveAndRefresh()}}),this.renderRecentTypes(e)}renderRecentTypes(e){let n=this.settings.recentFiles.types;new f.Setting(e).setHeading().setName("File types").setDesc("Frontmatter `type` values. A type's icon shows beside matching recent files."),n.forEach((a,t)=>{new f.Setting(e).addText(i=>{i.setPlaceholder("meeting"),i.setValue(a.type),i.inputEl.onblur=()=>{let r=i.getValue().trim();r!==a.type&&(a.type=r,this.saveAndRefresh())}}).addExtraButton(i=>{i.setIcon(a.icon||"image-off").setTooltip(a.icon?`Icon: ${a.icon}`:"Choose icon").onClick(()=>{new H(this.app,a.icon,r=>{a.icon=r,this.saveAndRefresh(),this.display()}).open()})}).addExtraButton(i=>{i.setIcon("trash").setTooltip("Remove this type").onClick(()=>{n.splice(t,1),this.saveAndRefresh(),this.display()})})}),new f.Setting(e).addButton(a=>{a.setButtonText("Add type").onClick(()=>{n.push({type:"",icon:""}),this.display()})})}renderDisplayTab(e){new f.Setting(e).setHeading().setName("Bookmarks"),this.addSliderSetting(e,"Row size","Height of bookmark items.",this.settings.display,"rowSize",18,40,1,"px"),this.addSliderSetting(e,"Row spacing","Gap between bookmark items.",this.settings.display,"rowSpacing",0,12,1,"px"),this.addSliderSetting(e,"Indent size","Indent per nesting depth.",this.settings.display,"indentSize",8,32,2,"px"),this.addSliderSetting(e,"Font size","Label font size.",this.settings.display,"fontSize",10,18,1,"px"),this.addSliderSetting(e,"Icon size","Bookmark icon size.",this.settings.display,"iconSize",12,24,1,"px"),new f.Setting(e).setHeading().setName("Calendar"),this.addSliderSetting(e,"Cell size","Height of calendar day cells.",this.settings.display,"calendarCellSize",20,48,2,"px"),new f.Setting(e).addButton(n=>n.setButtonText("Reset to defaults").onClick(()=>{this.settings.display={...M.display},this.saveAndRefresh(),this.display()}))}addSliderSetting(e,n,a,t,i,r,s,o,l){let p=new f.Setting(e).setName(n).setDesc(`${a} (${t[i]}${l})`);p.addSlider(u=>{u.setLimits(r,s,o).setValue(t[i]).setDynamicTooltip().onChange(D=>{t[i]=D,p.setDesc(`${a} (${D}${l})`),this.saveAndRefresh()})})}async saveAndRefresh(){await this.plugin.saveSettings(),this.onSettingsChange()}renderAboutTab(e){let n=this.plugin.manifest.version,a=e.createDiv();a.style.display="flex",a.style.alignItems="center",a.style.gap="12px",a.style.marginBottom="16px";let t=a.createDiv();t.style.display="flex",t.style.alignItems="center",t.style.justifyContent="center",t.style.width="48px",t.style.height="48px",t.style.borderRadius="12px",t.style.background="var(--interactive-accent)",t.style.color="var(--text-on-accent)",t.style.fontSize="24px",(0,f.setIcon)(t,"compass");let i=a.createDiv(),r=i.createEl("h2",{text:"Waypoint Sidebar"});r.style.margin="0",r.style.lineHeight="1.2";let s=i.createDiv({text:`v${n}`});s.style.color="var(--text-muted)",s.style.fontSize="var(--font-ui-small)";let o=e.createDiv();o.style.marginBottom="20px",o.style.lineHeight="1.6",o.style.color="var(--text-normal)",o.innerHTML=["<p><strong>Waypoint</strong> is a sidebar plugin that brings three essential panels into one view:</p>",'<ul style="padding-left: 20px; margin: 8px 0;">',"<li><strong>Calendar</strong> \u2014 a monthly grid for your periodic notes (daily, weekly, monthly, quarterly, yearly). Click any day, week, or month to open or create the corresponding note.</li>","<li><strong>Recent Files</strong> \u2014 a list of recently opened and changed files with type icons, drag-and-drop, and right-click actions.</li>","<li><strong>Bookmarks</strong> \u2014 custom bookmarks with icons, groups, nesting, and drag-and-drop reordering. Separate from Obsidian's native bookmarks.</li>","</ul>",'<p style="color: var(--text-muted); font-size: var(--font-ui-small);">Made by Olivier. Licensed under MIT.</p>'].join(`
|
||||||
type: ${a.typeProperty}
|
`)}};var J=require("obsidian"),Z=class extends J.Modal{constructor(e,n,a){super(e);this.initialDate=n;this.onSubmit=a}onOpen(){this.titleEl.setText("Open date");let e=this.contentEl.createEl("input",{type:"date",value:this.initialDate.format("YYYY-MM-DD")});e.style.width="100%",e.style.marginBottom="12px",e.focus();let n=()=>{let t=(0,J.moment)(e.value,"YYYY-MM-DD",!0);t.isValid()&&(this.close(),this.onSubmit(t))};e.addEventListener("keydown",t=>{t.key==="Enter"&&n()});let a=this.contentEl.createDiv({cls:"modal-button-container"});a.createEl("button",{text:"Cancel"}).addEventListener("click",()=>this.close()),a.createEl("button",{text:"Open",cls:"mod-cta"}).addEventListener("click",n)}onClose(){this.contentEl.empty()}};function se(c,d,e){return!c||!d?null:c===d?e:c.startsWith(d+"/")?e+c.slice(d.length):null}var ee=class extends y.Plugin{constructor(){super(...arguments);this.recentFiles=[];this.savePromise=Promise.resolve();this.markdownBasenames=new Set;this.dateSystemIndicators=null;this.dateSystemIndicatorKey="";this.indicatorModeMigrated=!1;this.previouslyActive=null;this.activePath=null}async onload(){console.debug("Waypoint: loading plugin v"+this.manifest.version);let e=await this.loadData(),n=this.applySettings(e);this.applyWaypointData(e),n&&this.persistAll(),this.registerView(E,s=>new O(s,this)),this.addSettingTab(new U(this.app,this,this.settings,()=>{this.enforceRecentFilesLimit(),this.invalidateDateSystemIndicators(),this.redrawAll()})),this.addCommand({id:"waypoint-open-view",name:"Open Waypoint sidebar",callback:async()=>{let s=this.app.workspace.getLeavesOfType(E);if(s.length>0)await this.app.workspace.revealLeaf(s[0]);else{let o=this.app.workspace.getLeftLeaf(!1);o&&(await o.setViewState({type:E}),await this.app.workspace.revealLeaf(o))}}}),this.addCommand({id:"waypoint-add-bookmark",name:"Add current file as Waypoint bookmark",callback:async()=>{let s=this.app.workspace.getActiveFile();if(!s){new y.Notice("No active file");return}this.addBookmark(s.path,s.basename,"file"),new y.Notice(`Bookmarked: ${s.basename}`)}}),this.addCommand({id:"waypoint-go-to-daily",name:"Go to daily note",hotkeys:[{modifiers:["Mod","Shift","Alt"],key:"d"}],callback:async()=>{await this.openPeriodNote("day",(0,y.moment)())}}),this.addCommand({id:"waypoint-go-to-weekly",name:"Go to weekly note",hotkeys:[{modifiers:["Mod","Shift","Alt"],key:"w"}],callback:async()=>{await this.openPeriodNote("week",(0,y.moment)())}}),this.addCommand({id:"waypoint-go-to-monthly",name:"Go to monthly note",hotkeys:[{modifiers:["Mod","Shift","Alt"],key:"m"}],callback:async()=>{await this.openPeriodNote("month",(0,y.moment)())}}),this.addCommand({id:"waypoint-go-to-quarterly",name:"Go to quarterly note",hotkeys:[{modifiers:["Mod","Shift","Alt"],key:"q"}],callback:async()=>{await this.openPeriodNote("quarter",(0,y.moment)())}}),this.addCommand({id:"waypoint-go-to-yearly",name:"Go to yearly note",hotkeys:[{modifiers:["Mod","Shift","Alt"],key:"y"}],callback:async()=>{await this.openPeriodNote("year",(0,y.moment)())}}),this.addCommand({id:"waypoint-open-date",name:"Open daily note for a date\u2026",callback:()=>{new Z(this.app,(0,y.moment)(),s=>{this.showDateInViews(s),this.openPeriodNote("day",s)}).open()}});let a=["next","prev"],t=["daily","weekly","monthly","quarterly","yearly"],i={next:"Next",prev:"Previous"};for(let s of t)for(let o of a){let l=`waypoint-go-to-${o}-${s}`,p=`${i[o]} ${s} note`;this.addCommand({id:l,name:p,callback:async()=>{await this.navigatePeriodNote(o)}})}this.registerEvent(this.app.workspace.on("file-open",s=>{s&&this.onFileOpen(s)})),this.registerEvent(this.app.vault.on("create",s=>this.onVaultCreate(s))),this.registerEvent(this.app.vault.on("delete",s=>this.onVaultDelete(s))),this.registerEvent(this.app.vault.on("rename",(s,o)=>this.onRename(s,o))),this.registerEvent(this.app.vault.on("modify",s=>this.onFileChange(s))),this.app.workspace.onLayoutReady(()=>{if(this.buildMarkdownIndex(),this.app.workspace.getLeavesOfType(E).length===0){let o=this.app.workspace.getLeftLeaf(!1);o&&o.setViewState({type:E})}else this.broadcastRedraw()});let r=new Date().toDateString();this.registerInterval(window.setInterval(()=>{let s=new Date().toDateString();s!==r&&(r=s,this.redrawAll())},6e5))}async onunload(){this.app.workspace.detachLeavesOfType(E)}applySettings(e){var r,s;let n=(e==null?void 0:e.settings)||{};this.settings=Object.assign({},M,n),this.settings.recentFiles=Object.assign({},M.recentFiles,n.recentFiles||{});let a=this.settings.recentFiles;this.settings.recentFiles.types=Array.isArray((r=n.recentFiles)==null?void 0:r.types)?n.recentFiles.types.map(o=>({...o})):[],delete a.filterTags,delete a.showTypeFilter,delete a.updateOn,this.settings.calendar=Object.assign({},M.calendar,n.calendar||{}),this.settings.display=Object.assign({},M.display,n.display||{});for(let o of Ce)this.settings[o]=Object.assign({},M[o],n[o]||{});this.settings.dateSystems=Array.isArray(n.dateSystems)?n.dateSystems.map(o=>{let l=M.dateSystems.find(p=
Line truncated
|
||||||
date: ${e.format("YYYY-MM-DD")}
|
${oe(u)}
|
||||||
|
Check Settings \u2192 Waypoint Sidebar \u2192 Periodic Notes.`,q),null}let s=n.templateFile,o=this.resolveTemplateFile(s),l;if(o)try{l=await this.app.vault.read(o)}catch(u){return new y.Notice(`Waypoint: could not read the template "${o.path}" for the ${t} note.
|
||||||
|
`+oe(u),q),null}else l=`---
|
||||||
|
type: ${n.typeProperty}
|
||||||
|
date: ${a.format("YYYY-MM-DD")}
|
||||||
---
|
---
|
||||||
|
|
||||||
`;i=await this.app.vault.create(o,c)}}catch(l){new u.Notice(`Failed to create ${r.label.toLowerCase()} note: ${l.message}`);return}new u.Notice(`Created ${r.label.toLowerCase()} note: ${s}`)}i&&await this.app.workspace.getLeaf(!1).openFile(i)}detectPeriodType(t){return/^\d{4}-\d{2}-\d{2}$/.test(t)?{period:"day",date:(0,u.moment)(t,"YYYY-MM-DD")}:/^\d{4}-W\d{2}$/.test(t)?{period:"week",date:(0,u.moment)(t,"GGGG-[W]WW")}:/^\d{4}-\d{2}$/.test(t)?{period:"month",date:(0,u.moment)(t,"YYYY-MM")}:/^\d{4}-Q[1-4]$/.test(t)?{period:"quarter",date:(0,u.moment)(t,"YYYY-[Q]Q")}:/^\d{4}$/.test(t)?{period:"year",date:(0,u.moment)(t,"YYYY")}:null}async navigatePeriodNote(t){let e=this.app.workspace.getActiveFile();if(!e){new u.Notice("No active file");return}let n=this.detectPeriodType(e.basename);if(!n){new u.Notice("Current file is not a periodic note (daily/weekly/monthly/quarterly/yearly)");return}let{period:r,date:a}=n;if(!a.isValid()){new u.Notice(`Could not parse date from filename: ${e.basename}`);return}let s=t==="next"?1:-1,o=r==="quarter"?a.clone().add(s*3,"months"):a.clone().add(s,`${r}s`);await this.openPeriodNote(r,o)}redrawAll(){this.broadcastRedraw()}broadcastRedraw(){let t=this.app.workspace.getLeavesOfType(b);for(let e of t)e.view instanceof Y&&e.view.redraw()}async getNotesForDate(t){return this.app.vault.getFiles().filter(e=>e.extension==="md"&&e.basename===t)}async hasNoteForDate(t){return this.app.vault.getFiles().some(e=>e.extension==="md"&&e.basename===t)}};
|
`;let p;try{p=await this.app.vault.create(e,l)}catch(u){return new y.Notice(`Waypoint: could not create the ${t} note at "${e}".
|
||||||
|
${oe(u)}`,q),null}return s&&!o?new y.Notice(`Created ${t} note: ${p.basename}
|
||||||
|
Template "${s}" was not found, so a basic note was created instead.`,q):new y.Notice(`Created ${t} note: ${p.basename}`),p}async ensureFolderExists(e){if(!e||this.app.vault.getAbstractFileByPath(e)instanceof y.TFolder)return;let n="";for(let a of e.split("/"))if(a&&(n=n?`${n}/${a}`:a,!(this.app.vault.getAbstractFileByPath(n)instanceof y.TFolder)))try{await this.app.vault.createFolder(n)}catch(t){if(!(this.app.vault.getAbstractFileByPath(n)instanceof y.TFolder))throw t}}resolveTemplateFile(e){if(!e)return null;let n=e.toLowerCase().endsWith(".md")?e:`${e}.md`;return this.app.vault.getFileByPath(n)}detectPeriodType(e){for(let n of fe){let a=this.settings[X[n].key].nameFormat;if(!a)continue;let t=(0,y.moment)(e,a,!0);if(t.isValid())return{period:n,date:t}}return null}async navigatePeriodNote(e){let n=this.app.workspace.getActiveFile();if(!n){new y.Notice("No active file");return}let a=this.detectPeriodType(n.basename);if(!a){let o=fe.map(l=>`${X[l].label.toLowerCase()} "${this.settings[X[l].key].nameFormat}"`).join(", ");new y.Notice(`Waypoint: "${n.basename}" does not match any configured periodic note format.
|
||||||
|
Expected one of: ${o}.`,q);return}let{period:t,date:i}=a,r=e==="next"?1:-1,s=t==="quarter"?i.clone().add(r*3,"months"):i.clone().add(r,`${t}s`);await this.openPeriodNote(t,s)}redrawAll(){this.broadcastRedraw()}broadcastRedraw(){let e=this.app.workspace.getLeavesOfType(E);for(let n of e)n.view instanceof O&&n.view.redraw()}showDateInViews(e){for(let n of this.app.workspace.getLeavesOfType(E))n.view instanceof O&&n.view.showDate(e)}},Ce=["daily","weekly","monthly","quarterly","yearly"],X={day:{key:"daily",label:"Daily"},week:{key:"weekly",label:"Weekly"},month:{key:"monthly",label:"Monthly"},quarter:{key:"quarterly",label:"Quarterly"},year:{key:"yearly",label:"Yearly"}},fe=["day","week","month","quarter","year"];function ve(c){return c.slice(c.lastIndexOf("/")+1).replace(/\.[^/.]+$/,"")}var q=1e4,Le=5e3;function oe(c){return c instanceof Error?c.message:String(c)}function $(c,d){return d?c.format(d):""}
|
||||||
+2
-2
@@ -1,8 +1,8 @@
|
|||||||
{
|
{
|
||||||
"id": "waypoint-sidebar",
|
"id": "waypoint-sidebar",
|
||||||
"name": "Waypoint Sidebar",
|
"name": "Waypoint Sidebar",
|
||||||
"version": "1.2.0",
|
"version": "1.10.0",
|
||||||
"minAppVersion": "0.16.3",
|
"minAppVersion": "1.4.10",
|
||||||
"description": "Calendar, recent files, and custom bookmarks sidebar.",
|
"description": "Calendar, recent files, and custom bookmarks sidebar.",
|
||||||
"author": "Olivier",
|
"author": "Olivier",
|
||||||
"isDesktopOnly": false
|
"isDesktopOnly": false
|
||||||
|
|||||||
Generated
+2
-2
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "waypoint",
|
"name": "waypoint",
|
||||||
"version": "1.0.0",
|
"version": "1.8.0",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "waypoint",
|
"name": "waypoint",
|
||||||
"version": "1.0.0",
|
"version": "1.8.0",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"builtin-modules": "4.0.0",
|
"builtin-modules": "4.0.0",
|
||||||
|
|||||||
+3
-2
@@ -1,11 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "waypoint",
|
"name": "waypoint",
|
||||||
"version": "1.2.0",
|
"version": "1.10.0",
|
||||||
"description": "Calendar, recent files, and custom bookmarks sidebar.",
|
"description": "Calendar, recent files, and custom bookmarks sidebar.",
|
||||||
"main": "main.js",
|
"main": "main.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "node esbuild.config.mjs",
|
"dev": "node esbuild.config.mjs",
|
||||||
"build": "node esbuild.config.mjs production"
|
"typecheck": "node node_modules/typescript/bin/tsc --noEmit",
|
||||||
|
"build": "npm run typecheck && node esbuild.config.mjs production"
|
||||||
},
|
},
|
||||||
"keywords": [],
|
"keywords": [],
|
||||||
"author": "Olivier",
|
"author": "Olivier",
|
||||||
|
|||||||
+759
-143
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,48 @@
|
|||||||
|
// ── Date picker modal ──
|
||||||
|
|
||||||
|
import { App, Modal, moment } from 'obsidian';
|
||||||
|
|
||||||
|
/** Native date input (the OS picker on mobile), confirmed with Enter or Open. */
|
||||||
|
export class DatePickerModal extends Modal {
|
||||||
|
constructor(
|
||||||
|
app: App,
|
||||||
|
private initialDate: moment.Moment,
|
||||||
|
private onSubmit: (date: moment.Moment) => void,
|
||||||
|
) {
|
||||||
|
super(app);
|
||||||
|
}
|
||||||
|
|
||||||
|
onOpen(): void {
|
||||||
|
this.titleEl.setText('Open date');
|
||||||
|
|
||||||
|
const input = this.contentEl.createEl('input', {
|
||||||
|
type: 'date',
|
||||||
|
value: this.initialDate.format('YYYY-MM-DD'),
|
||||||
|
});
|
||||||
|
input.style.width = '100%';
|
||||||
|
input.style.marginBottom = '12px';
|
||||||
|
input.focus();
|
||||||
|
|
||||||
|
const submit = (): void => {
|
||||||
|
// A date input's value is always ISO (YYYY-MM-DD), or empty when incomplete.
|
||||||
|
const date = moment(input.value, 'YYYY-MM-DD', true);
|
||||||
|
if (!date.isValid()) return;
|
||||||
|
this.close();
|
||||||
|
this.onSubmit(date);
|
||||||
|
};
|
||||||
|
|
||||||
|
input.addEventListener('keydown', (e) => {
|
||||||
|
if (e.key === 'Enter') submit();
|
||||||
|
});
|
||||||
|
|
||||||
|
const btnContainer = this.contentEl.createDiv({ cls: 'modal-button-container' });
|
||||||
|
btnContainer.createEl('button', { text: 'Cancel' })
|
||||||
|
.addEventListener('click', () => this.close());
|
||||||
|
btnContainer.createEl('button', { text: 'Open', cls: 'mod-cta' })
|
||||||
|
.addEventListener('click', submit);
|
||||||
|
}
|
||||||
|
|
||||||
|
onClose(): void {
|
||||||
|
this.contentEl.empty();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -11,6 +11,18 @@ export interface BookmarkItem {
|
|||||||
indent: number;
|
indent: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface RecentFileEntry {
|
||||||
|
path: string;
|
||||||
|
basename: string;
|
||||||
|
/** Epoch ms of the last open; absent if never opened while tracked. */
|
||||||
|
openedAt?: number;
|
||||||
|
/** Epoch ms of the last change (yours or not); absent if never changed while tracked. */
|
||||||
|
changedAt?: number;
|
||||||
|
/** Changed while not the active file (sync, another plugin…); cleared once opened. */
|
||||||
|
changedInBackground?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
export interface WaypointData {
|
export interface WaypointData {
|
||||||
bookmarks: BookmarkItem[];
|
bookmarks: BookmarkItem[];
|
||||||
|
recentFiles: RecentFileEntry[];
|
||||||
}
|
}
|
||||||
+520
-83
@@ -1,12 +1,44 @@
|
|||||||
import { Setting, PluginSettingTab, App, Plugin } from 'obsidian';
|
import { Setting, PluginSettingTab, App, setIcon, AbstractInputSuggest, TFile } from 'obsidian';
|
||||||
import { WaypointSettings, DEFAULT_SETTINGS, PeriodNoteSettings } from 'src/settings';
|
import type WaypointPlugin from 'src/main';
|
||||||
|
import { WaypointSettings, DEFAULT_SETTINGS, DEFAULT_DATE_SYSTEM, PeriodNoteSettings } from 'src/settings';
|
||||||
|
import { formatHasDateToken } from 'src/utils/date-systems';
|
||||||
|
import { IconSuggestModal } from 'src/views/waypoint-view';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Vault-wide Markdown-file suggester for template-path fields, matching
|
||||||
|
* Obsidian's native suggest popup (same base class Templater's own template
|
||||||
|
* pickers use) rather than the browser's unstyled `<datalist>` dropdown.
|
||||||
|
*/
|
||||||
|
class TemplateFileSuggest extends AbstractInputSuggest<TFile> {
|
||||||
|
constructor(app: App, private inputEl: HTMLInputElement) {
|
||||||
|
super(app, inputEl);
|
||||||
|
}
|
||||||
|
|
||||||
|
getSuggestions(query: string): TFile[] {
|
||||||
|
const q = query.toLowerCase();
|
||||||
|
return this.app.vault.getMarkdownFiles()
|
||||||
|
.filter(file => file.path.toLowerCase().includes(q))
|
||||||
|
.slice(0, 200);
|
||||||
|
}
|
||||||
|
|
||||||
|
renderSuggestion(file: TFile, el: HTMLElement): void {
|
||||||
|
el.setText(file.path.replace(/\.md$/, ''));
|
||||||
|
}
|
||||||
|
|
||||||
|
selectSuggestion(file: TFile): void {
|
||||||
|
this.setValue(file.path.replace(/\.md$/, ''));
|
||||||
|
this.inputEl.trigger('input');
|
||||||
|
this.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export class WaypointSettingTab extends PluginSettingTab {
|
export class WaypointSettingTab extends PluginSettingTab {
|
||||||
private plugin: Plugin;
|
private plugin: WaypointPlugin;
|
||||||
private settings: WaypointSettings;
|
private settings: WaypointSettings;
|
||||||
private onSettingsChange: () => void;
|
private onSettingsChange: () => void;
|
||||||
|
private activeTab: 'calendar' | 'periodic' | 'systems' | 'recent' | 'display' | 'about' = 'calendar';
|
||||||
|
|
||||||
constructor(app: App, plugin: Plugin, settings: WaypointSettings, onSettingsChange: () => void) {
|
constructor(app: App, plugin: WaypointPlugin, settings: WaypointSettings, onSettingsChange: () => void) {
|
||||||
super(app, plugin);
|
super(app, plugin);
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
this.settings = settings;
|
this.settings = settings;
|
||||||
@@ -17,10 +49,58 @@ export class WaypointSettingTab extends PluginSettingTab {
|
|||||||
const { containerEl } = this;
|
const { containerEl } = this;
|
||||||
containerEl.empty();
|
containerEl.empty();
|
||||||
|
|
||||||
// ── Calendar Section ──
|
// ── Tab bar ──
|
||||||
new Setting(containerEl).setHeading().setName('Calendar');
|
const tabBar = containerEl.createDiv({ cls: 'waypoint-settings-tabs' });
|
||||||
|
const tabs = [
|
||||||
|
{ key: 'calendar' as const, label: 'Calendar' },
|
||||||
|
{ key: 'periodic' as const, label: 'Periodic Notes' },
|
||||||
|
{ key: 'systems' as const, label: 'Date systems' },
|
||||||
|
{ key: 'recent' as const, label: 'Recent Files' },
|
||||||
|
{ key: 'display' as const, label: 'Display' },
|
||||||
|
{ key: 'about' as const, label: 'About' },
|
||||||
|
];
|
||||||
|
|
||||||
new Setting(containerEl)
|
for (const tab of tabs) {
|
||||||
|
const btn = tabBar.createEl('button', {
|
||||||
|
cls: `waypoint-settings-tab${this.activeTab === tab.key ? ' is-active' : ''}`,
|
||||||
|
text: tab.label,
|
||||||
|
});
|
||||||
|
btn.addEventListener('click', () => {
|
||||||
|
this.activeTab = tab.key;
|
||||||
|
this.display();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
const tabContent = containerEl.createDiv({ cls: 'waypoint-settings-content' });
|
||||||
|
|
||||||
|
switch (this.activeTab) {
|
||||||
|
case 'calendar':
|
||||||
|
this.renderCalendarTab(tabContent);
|
||||||
|
break;
|
||||||
|
case 'periodic':
|
||||||
|
this.renderPeriodicTab(tabContent);
|
||||||
|
break;
|
||||||
|
case 'systems':
|
||||||
|
this.renderSystemsTab(tabContent);
|
||||||
|
break;
|
||||||
|
case 'recent':
|
||||||
|
this.renderRecentTab(tabContent);
|
||||||
|
break;
|
||||||
|
case 'display':
|
||||||
|
this.renderDisplayTab(tabContent);
|
||||||
|
break;
|
||||||
|
case 'about':
|
||||||
|
this.renderAboutTab(tabContent);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ═══════════════════════════════
|
||||||
|
// Calendar tab
|
||||||
|
// ═══════════════════════════════
|
||||||
|
|
||||||
|
private renderCalendarTab(container: HTMLElement): void {
|
||||||
|
new Setting(container)
|
||||||
.setName('First day of week')
|
.setName('First day of week')
|
||||||
.setDesc('Which day the calendar week starts on.')
|
.setDesc('Which day the calendar week starts on.')
|
||||||
.addDropdown((dropdown) => {
|
.addDropdown((dropdown) => {
|
||||||
@@ -34,7 +114,7 @@ export class WaypointSettingTab extends PluginSettingTab {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
new Setting(containerEl)
|
new Setting(container)
|
||||||
.setName('Show note indicators')
|
.setName('Show note indicators')
|
||||||
.setDesc('Show a dot on days that have existing notes.')
|
.setDesc('Show a dot on days that have existing notes.')
|
||||||
.addToggle((toggle) => {
|
.addToggle((toggle) => {
|
||||||
@@ -46,21 +126,263 @@ export class WaypointSettingTab extends PluginSettingTab {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// ── Periodic Note Settings ──
|
new Setting(container)
|
||||||
new Setting(containerEl).setHeading().setName('Periodic Note Paths');
|
.setName('Indicator style')
|
||||||
|
.setDesc('Show one neutral dot for any dated note, or one coloured dot for each configured date system.')
|
||||||
|
.addDropdown((dropdown) => {
|
||||||
|
dropdown
|
||||||
|
.addOption('any', 'Single dot')
|
||||||
|
.addOption('systems', 'Colour by note system')
|
||||||
|
.setValue(this.settings.calendar.indicatorMode)
|
||||||
|
.onChange((value: 'any' | 'systems') => {
|
||||||
|
this.settings.calendar.indicatorMode = value;
|
||||||
|
this.saveAndRefresh();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
this.addPeriodNoteSettings('Daily', this.settings.daily);
|
new Setting(container)
|
||||||
this.addPeriodNoteSettings('Weekly', this.settings.weekly);
|
.setName('Daily indicator colour')
|
||||||
this.addPeriodNoteSettings('Monthly', this.settings.monthly);
|
.setDesc('Colour for daily-note dots when using “Colour by note system”.')
|
||||||
this.addPeriodNoteSettings('Quarterly', this.settings.quarterly);
|
.addColorPicker((color) => {
|
||||||
this.addPeriodNoteSettings('Yearly', this.settings.yearly);
|
color
|
||||||
|
.setValue(this.settings.calendar.dailyIndicatorColor)
|
||||||
|
.onChange((value) => {
|
||||||
|
this.settings.calendar.dailyIndicatorColor = value;
|
||||||
|
this.saveAndRefresh();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// ── Recent Files Section ──
|
// ═══════════════════════════════
|
||||||
new Setting(containerEl).setHeading().setName('Recent Files');
|
// Periodic Notes tab
|
||||||
|
// ═══════════════════════════════
|
||||||
|
|
||||||
new Setting(containerEl)
|
private renderPeriodicTab(container: HTMLElement): void {
|
||||||
|
new Setting(container)
|
||||||
|
.setName('Use existing tabs')
|
||||||
|
.setDesc('If a periodic note is already open, switch to its tab instead of opening it again.')
|
||||||
|
.addToggle((toggle) => {
|
||||||
|
toggle
|
||||||
|
.setValue(this.settings.reusePeriodicNoteTabs)
|
||||||
|
.onChange((value) => {
|
||||||
|
this.settings.reusePeriodicNoteTabs = value;
|
||||||
|
this.saveAndRefresh();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
this.addPeriodNoteSettings(container, 'Daily', this.settings.daily);
|
||||||
|
this.addPeriodNoteSettings(container, 'Weekly', this.settings.weekly);
|
||||||
|
this.addPeriodNoteSettings(container, 'Monthly', this.settings.monthly);
|
||||||
|
this.addPeriodNoteSettings(container, 'Quarterly', this.settings.quarterly);
|
||||||
|
this.addPeriodNoteSettings(container, 'Yearly', this.settings.yearly);
|
||||||
|
}
|
||||||
|
|
||||||
|
private addPeriodNoteSettings(container: HTMLElement, label: string, period: PeriodNoteSettings): void {
|
||||||
|
new Setting(container).setHeading().setName(label);
|
||||||
|
|
||||||
|
new Setting(container)
|
||||||
|
.setName('Folder')
|
||||||
|
.setDesc(`Folder path for ${label.toLowerCase()} notes.`)
|
||||||
|
.addText((text) => {
|
||||||
|
text.setPlaceholder('periodic/daily');
|
||||||
|
text.setValue(period.folder);
|
||||||
|
text.onChange((value) => {
|
||||||
|
period.folder = value;
|
||||||
|
this.saveAndRefresh();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
new Setting(container)
|
||||||
|
.setName('Name format')
|
||||||
|
.setDesc(`Date format for ${label.toLowerCase()} note filenames (moment.js format).`)
|
||||||
|
.addText((text) => {
|
||||||
|
text.setPlaceholder('yyyy-MM-dd');
|
||||||
|
text.setValue(period.nameFormat);
|
||||||
|
text.onChange((value) => {
|
||||||
|
period.nameFormat = value;
|
||||||
|
this.saveAndRefresh();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
new Setting(container)
|
||||||
|
.setName('Template file')
|
||||||
|
.setDesc('Path to the template file. The .md extension is optional.')
|
||||||
|
.addText((text) => {
|
||||||
|
text.setPlaceholder('Templates/Daily note');
|
||||||
|
text.setValue(period.templateFile);
|
||||||
|
new TemplateFileSuggest(this.app, text.inputEl);
|
||||||
|
text.onChange((value) => {
|
||||||
|
period.templateFile = value;
|
||||||
|
this.saveAndRefresh();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
new Setting(container)
|
||||||
|
.setName('Type property')
|
||||||
|
.setDesc(`Value for the 'type' frontmatter property.`)
|
||||||
|
.addText((text) => {
|
||||||
|
text.setPlaceholder('daily-note');
|
||||||
|
text.setValue(period.typeProperty);
|
||||||
|
text.onChange((value) => {
|
||||||
|
period.typeProperty = value;
|
||||||
|
this.saveAndRefresh();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// ═══════════════════════════════
|
||||||
|
// Date systems tab
|
||||||
|
// ═══════════════════════════════
|
||||||
|
|
||||||
|
private renderSystemsTab(container: HTMLElement): void {
|
||||||
|
const intro = new DocumentFragment();
|
||||||
|
intro.createDiv({ text: 'A date system is a folder of notes whose filenames start with a date. Each one appears in the calendar\'s right-click menu for that day.' });
|
||||||
|
intro.createDiv({ text: 'The daily note is configured under Periodic Notes and always comes first in that menu.' });
|
||||||
|
intro.createDiv({ text: 'Name format is a moment.js format. Literal words need bracket escaping, e.g. YYYY-MM-DD - [Journal].' });
|
||||||
|
intro.createDiv({ text: 'Include {title} for systems that hold many notes per date, such as meetings: the text before the token finds the existing notes, and the token marks where a typed title goes. Without it, a date has exactly one note.' });
|
||||||
|
|
||||||
|
new Setting(container)
|
||||||
|
.setHeading()
|
||||||
|
.setName('Date systems')
|
||||||
|
.setDesc(intro);
|
||||||
|
|
||||||
|
this.settings.dateSystems.forEach((system, i, arr) => {
|
||||||
|
new Setting(container)
|
||||||
|
.setHeading()
|
||||||
|
.setName(system.name || 'Untitled system')
|
||||||
|
.addExtraButton((btn) => {
|
||||||
|
btn
|
||||||
|
.setIcon('arrow-up')
|
||||||
|
.setTooltip('Move up')
|
||||||
|
.setDisabled(i === 0)
|
||||||
|
.onClick(async () => {
|
||||||
|
if (i === 0) return;
|
||||||
|
const above = arr[i - 1];
|
||||||
|
arr[i - 1] = arr[i];
|
||||||
|
arr[i] = above;
|
||||||
|
await this.saveAndRefresh();
|
||||||
|
this.display();
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.addExtraButton((btn) => {
|
||||||
|
btn
|
||||||
|
.setIcon('arrow-down')
|
||||||
|
.setTooltip('Move down')
|
||||||
|
.setDisabled(i === arr.length - 1)
|
||||||
|
.onClick(async () => {
|
||||||
|
if (i === arr.length - 1) return;
|
||||||
|
const below = arr[i + 1];
|
||||||
|
arr[i + 1] = arr[i];
|
||||||
|
arr[i] = below;
|
||||||
|
await this.saveAndRefresh();
|
||||||
|
this.display();
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.addExtraButton((btn) => {
|
||||||
|
btn
|
||||||
|
.setIcon('trash')
|
||||||
|
.setTooltip('Delete this date system')
|
||||||
|
.onClick(async () => {
|
||||||
|
arr.splice(i, 1);
|
||||||
|
await this.saveAndRefresh();
|
||||||
|
this.display();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
this.addSystemTextSetting(container,
|
||||||
|
'Name', 'Label shown in the calendar right-click menu.',
|
||||||
|
system, 'name', 'Journal',
|
||||||
|
);
|
||||||
|
this.addSystemTextSetting(container,
|
||||||
|
'Folder', 'Folder these notes live in.',
|
||||||
|
system, 'folder', 'periodic/journal',
|
||||||
|
);
|
||||||
|
|
||||||
|
const formatSetting = this.addSystemTextSetting(container,
|
||||||
|
'Name format', 'Filename format (moment.js format). Include {title} for many notes per date.',
|
||||||
|
system, 'nameFormat', 'YYYY-MM-DD - {title}',
|
||||||
|
);
|
||||||
|
// A blank row is still being filled in, so only warn once something was typed.
|
||||||
|
if (system.nameFormat && !formatHasDateToken(system.nameFormat)) {
|
||||||
|
formatSetting.descEl.createDiv({
|
||||||
|
cls: 'waypoint-settings-warning',
|
||||||
|
text: 'This name format has no date placeholder, so it will never match or create dated notes.',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
this.addSystemTextSetting(container,
|
||||||
|
'Template file', 'Path to the template file. The .md extension is optional.',
|
||||||
|
system, 'templateFile', 'resources/template/journal', true,
|
||||||
|
);
|
||||||
|
this.addSystemTextSetting(container,
|
||||||
|
'Type property', `Fallback value for the 'type' frontmatter property, used when no template is found.`,
|
||||||
|
system, 'typeProperty', 'journal-note',
|
||||||
|
);
|
||||||
|
this.addSystemTextSetting(container,
|
||||||
|
'Icon', 'Lucide icon name for the menu item. Browse names at lucide.dev.',
|
||||||
|
system, 'icon', 'book-open',
|
||||||
|
);
|
||||||
|
|
||||||
|
new Setting(container)
|
||||||
|
.setName('Indicator colour')
|
||||||
|
.setDesc('Colour for this system’s dot when using “Colour by note system”.')
|
||||||
|
.addColorPicker((color) => {
|
||||||
|
color
|
||||||
|
.setValue(system.indicatorColor)
|
||||||
|
.onChange((value) => {
|
||||||
|
system.indicatorColor = value;
|
||||||
|
this.saveAndRefresh();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
new Setting(container)
|
||||||
|
.addButton((btn) =>
|
||||||
|
btn
|
||||||
|
.setButtonText('Add date system')
|
||||||
|
.setCta()
|
||||||
|
.onClick(async () => {
|
||||||
|
this.settings.dateSystems.push(Object.assign(
|
||||||
|
{ id: `ds-${Date.now()}-${Math.random().toString(36).slice(2, 6)}` },
|
||||||
|
DEFAULT_DATE_SYSTEM,
|
||||||
|
));
|
||||||
|
await this.saveAndRefresh();
|
||||||
|
this.display();
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Returns the Setting so callers can append validation notices to its description. */
|
||||||
|
private addSystemTextSetting<K extends string>(
|
||||||
|
container: HTMLElement,
|
||||||
|
name: string,
|
||||||
|
desc: string,
|
||||||
|
obj: Record<K, string>,
|
||||||
|
key: K,
|
||||||
|
placeholder: string,
|
||||||
|
suggestTemplates?: boolean,
|
||||||
|
): Setting {
|
||||||
|
return new Setting(container)
|
||||||
|
.setName(name)
|
||||||
|
.setDesc(desc)
|
||||||
|
.addText((text) => {
|
||||||
|
text.setPlaceholder(placeholder);
|
||||||
|
text.setValue(obj[key]);
|
||||||
|
if (suggestTemplates) new TemplateFileSuggest(this.app, text.inputEl);
|
||||||
|
text.onChange((value) => {
|
||||||
|
obj[key] = value;
|
||||||
|
this.saveAndRefresh();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// ═══════════════════════════════
|
||||||
|
// Recent Files tab
|
||||||
|
// ═══════════════════════════════
|
||||||
|
|
||||||
|
private renderRecentTab(container: HTMLElement): void {
|
||||||
|
new Setting(container)
|
||||||
.setName('Max items')
|
.setName('Max items')
|
||||||
.setDesc('Maximum number of recent files to track.')
|
.setDesc('How many recently opened files, and separately how many recently changed files, to keep. A burst of synced changes cannot push out the files you opened.')
|
||||||
.addText((text) => {
|
.addText((text) => {
|
||||||
text.inputEl.setAttr('type', 'number');
|
text.inputEl.setAttr('type', 'number');
|
||||||
text.inputEl.setAttr('placeholder', '50');
|
text.inputEl.setAttr('placeholder', '50');
|
||||||
@@ -74,23 +396,9 @@ export class WaypointSettingTab extends PluginSettingTab {
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
new Setting(containerEl)
|
|
||||||
.setName('Update on')
|
|
||||||
.setDesc('When to add a file to the recent list.')
|
|
||||||
.addDropdown((dropdown) => {
|
|
||||||
dropdown
|
|
||||||
.addOption('file-open', 'File opened')
|
|
||||||
.addOption('file-edit', 'File changed')
|
|
||||||
.setValue(this.settings.recentFiles.updateOn)
|
|
||||||
.onChange((value: 'file-open' | 'file-edit') => {
|
|
||||||
this.settings.recentFiles.updateOn = value;
|
|
||||||
this.saveAndRefresh();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
const pathDesc = new DocumentFragment();
|
const pathDesc = new DocumentFragment();
|
||||||
pathDesc.appendText('Regex patterns for paths to exclude. One per line.');
|
pathDesc.appendText('Regex patterns for paths to exclude. One per line.');
|
||||||
new Setting(containerEl)
|
new Setting(container)
|
||||||
.setName('Omitted paths')
|
.setName('Omitted paths')
|
||||||
.setDesc(pathDesc)
|
.setDesc(pathDesc)
|
||||||
.addTextArea((text) => {
|
.addTextArea((text) => {
|
||||||
@@ -105,7 +413,7 @@ export class WaypointSettingTab extends PluginSettingTab {
|
|||||||
|
|
||||||
const tagDesc = new DocumentFragment();
|
const tagDesc = new DocumentFragment();
|
||||||
tagDesc.appendText('Regex patterns for frontmatter tags to exclude. One per line.');
|
tagDesc.appendText('Regex patterns for frontmatter tags to exclude. One per line.');
|
||||||
new Setting(containerEl)
|
new Setting(container)
|
||||||
.setName('Omitted tags')
|
.setName('Omitted tags')
|
||||||
.setDesc(tagDesc)
|
.setDesc(tagDesc)
|
||||||
.addTextArea((text) => {
|
.addTextArea((text) => {
|
||||||
@@ -117,62 +425,191 @@ export class WaypointSettingTab extends PluginSettingTab {
|
|||||||
this.saveAndRefresh();
|
this.saveAndRefresh();
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.renderRecentTypes(container);
|
||||||
}
|
}
|
||||||
|
|
||||||
private addPeriodNoteSettings(label: string, period: PeriodNoteSettings): void {
|
/** Frontmatter types with an icon each. */
|
||||||
new Setting(this.containerEl).setHeading().setName(label);
|
private renderRecentTypes(container: HTMLElement): void {
|
||||||
|
const types = this.settings.recentFiles.types;
|
||||||
|
|
||||||
new Setting(this.containerEl)
|
new Setting(container)
|
||||||
.setName('Folder')
|
.setHeading()
|
||||||
.setDesc(`Folder path for ${label.toLowerCase()} notes.`)
|
.setName('File types')
|
||||||
.addText((text) => {
|
.setDesc('Frontmatter `type` values. A type\'s icon shows beside matching recent files.');
|
||||||
text.setPlaceholder('periodic/daily');
|
|
||||||
text.setValue(period.folder);
|
types.forEach((entry, i) => {
|
||||||
text.onChange((value) => {
|
new Setting(container)
|
||||||
period.folder = value;
|
.addText((text) => {
|
||||||
|
text.setPlaceholder('meeting');
|
||||||
|
text.setValue(entry.type);
|
||||||
|
text.inputEl.onblur = () => {
|
||||||
|
const value = text.getValue().trim();
|
||||||
|
if (value === entry.type) return;
|
||||||
|
entry.type = value;
|
||||||
|
this.saveAndRefresh();
|
||||||
|
};
|
||||||
|
})
|
||||||
|
.addExtraButton((btn) => {
|
||||||
|
btn
|
||||||
|
.setIcon(entry.icon || 'image-off')
|
||||||
|
.setTooltip(entry.icon ? `Icon: ${entry.icon}` : 'Choose icon')
|
||||||
|
.onClick(() => {
|
||||||
|
new IconSuggestModal(this.app, entry.icon, (icon) => {
|
||||||
|
entry.icon = icon;
|
||||||
|
this.saveAndRefresh();
|
||||||
|
this.display();
|
||||||
|
}).open();
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.addExtraButton((btn) => {
|
||||||
|
btn
|
||||||
|
.setIcon('trash')
|
||||||
|
.setTooltip('Remove this type')
|
||||||
|
.onClick(() => {
|
||||||
|
types.splice(i, 1);
|
||||||
|
this.saveAndRefresh();
|
||||||
|
this.display();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
new Setting(container)
|
||||||
|
.addButton((btn) => {
|
||||||
|
btn
|
||||||
|
.setButtonText('Add type')
|
||||||
|
.onClick(() => {
|
||||||
|
types.push({ type: '', icon: '' });
|
||||||
|
this.display();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// ═══════════════════════════════
|
||||||
|
// Display tab
|
||||||
|
// ═══════════════════════════════
|
||||||
|
|
||||||
|
private renderDisplayTab(container: HTMLElement): void {
|
||||||
|
new Setting(container).setHeading().setName('Bookmarks');
|
||||||
|
|
||||||
|
this.addSliderSetting(container,
|
||||||
|
'Row size', 'Height of bookmark items.',
|
||||||
|
this.settings.display, 'rowSize', 18, 40, 1, 'px',
|
||||||
|
);
|
||||||
|
this.addSliderSetting(container,
|
||||||
|
'Row spacing', 'Gap between bookmark items.',
|
||||||
|
this.settings.display, 'rowSpacing', 0, 12, 1, 'px',
|
||||||
|
);
|
||||||
|
this.addSliderSetting(container,
|
||||||
|
'Indent size', 'Indent per nesting depth.',
|
||||||
|
this.settings.display, 'indentSize', 8, 32, 2, 'px',
|
||||||
|
);
|
||||||
|
this.addSliderSetting(container,
|
||||||
|
'Font size', 'Label font size.',
|
||||||
|
this.settings.display, 'fontSize', 10, 18, 1, 'px',
|
||||||
|
);
|
||||||
|
this.addSliderSetting(container,
|
||||||
|
'Icon size', 'Bookmark icon size.',
|
||||||
|
this.settings.display, 'iconSize', 12, 24, 1, 'px',
|
||||||
|
);
|
||||||
|
|
||||||
|
new Setting(container).setHeading().setName('Calendar');
|
||||||
|
|
||||||
|
this.addSliderSetting(container,
|
||||||
|
'Cell size', 'Height of calendar day cells.',
|
||||||
|
this.settings.display, 'calendarCellSize', 20, 48, 2, 'px',
|
||||||
|
);
|
||||||
|
|
||||||
|
new Setting(container)
|
||||||
|
.addButton((btn) =>
|
||||||
|
btn
|
||||||
|
.setButtonText('Reset to defaults')
|
||||||
|
.onClick(() => {
|
||||||
|
this.settings.display = { ...DEFAULT_SETTINGS.display };
|
||||||
|
this.saveAndRefresh();
|
||||||
|
this.display();
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
private addSliderSetting<K extends string>(
|
||||||
|
container: HTMLElement,
|
||||||
|
name: string,
|
||||||
|
desc: string,
|
||||||
|
obj: Record<K, number>,
|
||||||
|
key: K,
|
||||||
|
min: number,
|
||||||
|
max: number,
|
||||||
|
step: number,
|
||||||
|
unit: string,
|
||||||
|
): void {
|
||||||
|
const setting = new Setting(container)
|
||||||
|
.setName(name)
|
||||||
|
.setDesc(`${desc} (${obj[key]}${unit})`);
|
||||||
|
|
||||||
|
setting.addSlider((slider) => {
|
||||||
|
slider
|
||||||
|
.setLimits(min, max, step)
|
||||||
|
.setValue(obj[key])
|
||||||
|
.setDynamicTooltip()
|
||||||
|
.onChange((value) => {
|
||||||
|
obj[key] = value;
|
||||||
|
setting.setDesc(`${desc} (${value}${unit})`);
|
||||||
this.saveAndRefresh();
|
this.saveAndRefresh();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
new Setting(this.containerEl)
|
|
||||||
.setName('Name format')
|
|
||||||
.setDesc(`Date format for ${label.toLowerCase()} note filenames (moment.js format).`)
|
|
||||||
.addText((text) => {
|
|
||||||
text.setPlaceholder('yyyy-MM-dd');
|
|
||||||
text.setValue(period.nameFormat);
|
|
||||||
text.onChange((value) => {
|
|
||||||
period.nameFormat = value;
|
|
||||||
this.saveAndRefresh();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
new Setting(this.containerEl)
|
|
||||||
.setName('Template file')
|
|
||||||
.setDesc(`Path to the template file (without .md extension).`)
|
|
||||||
.addText((text) => {
|
|
||||||
text.setPlaceholder('Templates/Daily note');
|
|
||||||
text.setValue(period.templateFile);
|
|
||||||
text.onChange((value) => {
|
|
||||||
period.templateFile = value;
|
|
||||||
this.saveAndRefresh();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
new Setting(this.containerEl)
|
|
||||||
.setName('Type property')
|
|
||||||
.setDesc(`Value for the 'type' frontmatter property.`)
|
|
||||||
.addText((text) => {
|
|
||||||
text.setPlaceholder('daily-note');
|
|
||||||
text.setValue(period.typeProperty);
|
|
||||||
text.onChange((value) => {
|
|
||||||
period.typeProperty = value;
|
|
||||||
this.saveAndRefresh();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private async saveAndRefresh(): Promise<void> {
|
private async saveAndRefresh(): Promise<void> {
|
||||||
await this.plugin.saveData(this.settings);
|
await this.plugin.saveSettings();
|
||||||
this.onSettingsChange();
|
this.onSettingsChange();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ═══════════════════════════════
|
||||||
|
// About tab
|
||||||
|
// ═══════════════════════════════
|
||||||
|
|
||||||
|
private renderAboutTab(container: HTMLElement): void {
|
||||||
|
const version = this.plugin.manifest.version;
|
||||||
|
|
||||||
|
const header = container.createDiv();
|
||||||
|
header.style.display = 'flex';
|
||||||
|
header.style.alignItems = 'center';
|
||||||
|
header.style.gap = '12px';
|
||||||
|
header.style.marginBottom = '16px';
|
||||||
|
|
||||||
|
const icon = header.createDiv();
|
||||||
|
icon.style.display = 'flex';
|
||||||
|
icon.style.alignItems = 'center';
|
||||||
|
icon.style.justifyContent = 'center';
|
||||||
|
icon.style.width = '48px';
|
||||||
|
icon.style.height = '48px';
|
||||||
|
icon.style.borderRadius = '12px';
|
||||||
|
icon.style.background = 'var(--interactive-accent)';
|
||||||
|
icon.style.color = 'var(--text-on-accent)';
|
||||||
|
icon.style.fontSize = '24px';
|
||||||
|
setIcon(icon, 'compass');
|
||||||
|
|
||||||
|
const titleGroup = header.createDiv();
|
||||||
|
const title = titleGroup.createEl('h2', { text: 'Waypoint Sidebar' });
|
||||||
|
title.style.margin = '0';
|
||||||
|
title.style.lineHeight = '1.2';
|
||||||
|
const subtitle = titleGroup.createDiv({ text: `v${version}` });
|
||||||
|
subtitle.style.color = 'var(--text-muted)';
|
||||||
|
subtitle.style.fontSize = 'var(--font-ui-small)';
|
||||||
|
|
||||||
|
const desc = container.createDiv();
|
||||||
|
desc.style.marginBottom = '20px';
|
||||||
|
desc.style.lineHeight = '1.6';
|
||||||
|
desc.style.color = 'var(--text-normal)';
|
||||||
|
desc.innerHTML = [
|
||||||
|
`<p><strong>Waypoint</strong> is a sidebar plugin that brings three essential panels into one view:</p>`,
|
||||||
|
`<ul style="padding-left: 20px; margin: 8px 0;">`,
|
||||||
|
`<li><strong>Calendar</strong> — a monthly grid for your periodic notes (daily, weekly, monthly, quarterly, yearly). Click any day, week, or month to open or create the corresponding note.</li>`,
|
||||||
|
`<li><strong>Recent Files</strong> — a list of recently opened and changed files with type icons, drag-and-drop, and right-click actions.</li>`,
|
||||||
|
`<li><strong>Bookmarks</strong> — custom bookmarks with icons, groups, nesting, and drag-and-drop reordering. Separate from Obsidian's native bookmarks.</li>`,
|
||||||
|
`</ul>`,
|
||||||
|
`<p style="color: var(--text-muted); font-size: var(--font-ui-small);">Made by Olivier. Licensed under MIT.</p>`,
|
||||||
|
].join('\n');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
+102
-2
@@ -1,3 +1,5 @@
|
|||||||
|
import type { RecentFilesShow } from 'src/utils/recent-files';
|
||||||
|
|
||||||
// ── Waypoint Settings ──
|
// ── Waypoint Settings ──
|
||||||
|
|
||||||
export interface PeriodNoteSettings {
|
export interface PeriodNoteSettings {
|
||||||
@@ -7,32 +9,98 @@ export interface PeriodNoteSettings {
|
|||||||
typeProperty: string;
|
typeProperty: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A folder of notes whose filenames begin with a date — the vault's "systems":
|
||||||
|
* daily notes, a journal, meeting notes.
|
||||||
|
*
|
||||||
|
* `nameFormat` is a moment format string, so literal text needs bracket
|
||||||
|
* escaping (`YYYY-MM-DD - [Journal]`). When it contains `{title}` the system
|
||||||
|
* holds many notes per date and the token marks where the free-text title
|
||||||
|
* goes; without it a date maps to exactly one filename.
|
||||||
|
*/
|
||||||
|
export interface DateSystemSettings {
|
||||||
|
/** Stable across edits and reordering, so the settings UI can key rows. */
|
||||||
|
id: string;
|
||||||
|
/** Shown in the calendar's right-click menu. */
|
||||||
|
name: string;
|
||||||
|
folder: string;
|
||||||
|
nameFormat: string;
|
||||||
|
templateFile: string;
|
||||||
|
typeProperty: string;
|
||||||
|
/** Lucide icon name for the menu item. */
|
||||||
|
icon: string;
|
||||||
|
/** CSS colour for this system's calendar indicator. */
|
||||||
|
indicatorColor: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Field defaults for a newly added system, and the merge base for saved ones. */
|
||||||
|
export const DEFAULT_DATE_SYSTEM: Omit<DateSystemSettings, 'id'> = {
|
||||||
|
name: '',
|
||||||
|
folder: '',
|
||||||
|
nameFormat: 'YYYY-MM-DD - {title}',
|
||||||
|
templateFile: '',
|
||||||
|
typeProperty: '',
|
||||||
|
icon: 'file',
|
||||||
|
indicatorColor: '#64748b',
|
||||||
|
};
|
||||||
|
|
||||||
export interface CalendarSettings {
|
export interface CalendarSettings {
|
||||||
firstDayOfWeek: number; // 0=Sunday, 1=Monday
|
firstDayOfWeek: number; // 0=Sunday, 1=Monday
|
||||||
showNoteIndicators: boolean;
|
showNoteIndicators: boolean;
|
||||||
|
/** Single neutral dot, or a dot per day-scoped date system. */
|
||||||
|
indicatorMode: 'any' | 'systems';
|
||||||
|
/** Colour used by the synthesized daily system in `systems` mode. */
|
||||||
|
dailyIndicatorColor: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** A frontmatter `type` value and its icon in Recent Files. */
|
||||||
|
export interface RecentFileType {
|
||||||
|
type: string;
|
||||||
|
/** Lucide icon name; empty for none. */
|
||||||
|
icon: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface RecentFilesSettings {
|
export interface RecentFilesSettings {
|
||||||
|
/** Kept per kind: the N most recently opened plus the N most recently changed. */
|
||||||
maxItems: number;
|
maxItems: number;
|
||||||
updateOn: 'file-open' | 'file-edit';
|
/** Header filter: opened files, changed files, or both. */
|
||||||
|
show: RecentFilesShow;
|
||||||
omittedPaths: string[];
|
omittedPaths: string[];
|
||||||
omittedTags: string[];
|
omittedTags: string[];
|
||||||
|
/** Frontmatter types with an icon each. */
|
||||||
|
types: RecentFileType[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface DisplaySettings {
|
||||||
|
rowSize: number; // px, base height of bookmark items (20–40)
|
||||||
|
rowSpacing: number; // px, gap between items (0–12)
|
||||||
|
indentSize: number; // px, indent per depth level (8–32)
|
||||||
|
fontSize: number; // px, font size for bookmark labels (10–18)
|
||||||
|
iconSize: number; // px, icon size (12–24)
|
||||||
|
calendarCellSize: number; // px, calendar day cell height (20–48)
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface WaypointSettings {
|
export interface WaypointSettings {
|
||||||
calendar: CalendarSettings;
|
calendar: CalendarSettings;
|
||||||
daily: PeriodNoteSettings;
|
daily: PeriodNoteSettings;
|
||||||
|
/** Focus an open tab when opening a periodic note without an explicit leaf. */
|
||||||
|
reusePeriodicNoteTabs: boolean;
|
||||||
weekly: PeriodNoteSettings;
|
weekly: PeriodNoteSettings;
|
||||||
monthly: PeriodNoteSettings;
|
monthly: PeriodNoteSettings;
|
||||||
quarterly: PeriodNoteSettings;
|
quarterly: PeriodNoteSettings;
|
||||||
yearly: PeriodNoteSettings;
|
yearly: PeriodNoteSettings;
|
||||||
|
/** Day-scoped systems beyond the daily note, in menu order. */
|
||||||
|
dateSystems: DateSystemSettings[];
|
||||||
recentFiles: RecentFilesSettings;
|
recentFiles: RecentFilesSettings;
|
||||||
|
display: DisplaySettings;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const DEFAULT_SETTINGS: WaypointSettings = {
|
export const DEFAULT_SETTINGS: WaypointSettings = {
|
||||||
calendar: {
|
calendar: {
|
||||||
firstDayOfWeek: 1, // Monday
|
firstDayOfWeek: 1, // Monday
|
||||||
showNoteIndicators: true,
|
showNoteIndicators: true,
|
||||||
|
indicatorMode: 'systems',
|
||||||
|
dailyIndicatorColor: '#3b82f6',
|
||||||
},
|
},
|
||||||
daily: {
|
daily: {
|
||||||
folder: 'periodic/daily',
|
folder: 'periodic/daily',
|
||||||
@@ -40,6 +108,7 @@ export const DEFAULT_SETTINGS: WaypointSettings = {
|
|||||||
nameFormat: 'YYYY-MM-DD',
|
nameFormat: 'YYYY-MM-DD',
|
||||||
typeProperty: 'daily-note',
|
typeProperty: 'daily-note',
|
||||||
},
|
},
|
||||||
|
reusePeriodicNoteTabs: false,
|
||||||
weekly: {
|
weekly: {
|
||||||
folder: 'periodic/weekly',
|
folder: 'periodic/weekly',
|
||||||
templateFile: 'Templates/Weekly note',
|
templateFile: 'Templates/Weekly note',
|
||||||
@@ -64,10 +133,41 @@ export const DEFAULT_SETTINGS: WaypointSettings = {
|
|||||||
nameFormat: 'YYYY',
|
nameFormat: 'YYYY',
|
||||||
typeProperty: 'yearly-note',
|
typeProperty: 'yearly-note',
|
||||||
},
|
},
|
||||||
|
dateSystems: [
|
||||||
|
{
|
||||||
|
id: 'journal',
|
||||||
|
name: 'Journal',
|
||||||
|
folder: 'periodic/journal',
|
||||||
|
nameFormat: 'YYYY-MM-DD - [Journal]',
|
||||||
|
templateFile: '',
|
||||||
|
typeProperty: 'journal',
|
||||||
|
icon: 'book-open',
|
||||||
|
indicatorColor: '#22c55e',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'meetings',
|
||||||
|
name: 'Meeting',
|
||||||
|
folder: 'periodic/meetings',
|
||||||
|
nameFormat: 'YYYY-MM-DD - {title}',
|
||||||
|
templateFile: '',
|
||||||
|
typeProperty: 'meeting',
|
||||||
|
icon: 'users',
|
||||||
|
indicatorColor: '#a855f7',
|
||||||
|
},
|
||||||
|
],
|
||||||
recentFiles: {
|
recentFiles: {
|
||||||
maxItems: 50,
|
maxItems: 50,
|
||||||
updateOn: 'file-open',
|
show: 'all',
|
||||||
omittedPaths: [],
|
omittedPaths: [],
|
||||||
omittedTags: [],
|
omittedTags: [],
|
||||||
|
types: [],
|
||||||
|
},
|
||||||
|
display: {
|
||||||
|
rowSize: 26,
|
||||||
|
rowSpacing: 2,
|
||||||
|
indentSize: 16,
|
||||||
|
fontSize: 13,
|
||||||
|
iconSize: 16,
|
||||||
|
calendarCellSize: 32,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
@@ -0,0 +1,103 @@
|
|||||||
|
// ── Date system filename helpers ──
|
||||||
|
//
|
||||||
|
// A "date system" is a folder of notes whose filenames begin with a date:
|
||||||
|
//
|
||||||
|
// periodic/daily/2026-09-07.md one per date
|
||||||
|
// periodic/journal/2026-09-07 - Journal.md one per date
|
||||||
|
// periodic/meetings/2026-09-07 - Meeting w Mark.md many per date
|
||||||
|
//
|
||||||
|
// The system's `nameFormat` is a moment format string. When it contains
|
||||||
|
// `{title}` the system holds many notes per date: the part before the token is
|
||||||
|
// the date prefix used to find them, and the token marks where a free-text
|
||||||
|
// title goes when creating one.
|
||||||
|
//
|
||||||
|
// This module imports nothing from 'obsidian' so it stays unit-testable in
|
||||||
|
// plain node. Callers do the moment formatting and pass the results in.
|
||||||
|
|
||||||
|
export const TITLE_TOKEN = '{title}';
|
||||||
|
|
||||||
|
export interface NameFormatParts {
|
||||||
|
/** Moment format for the text before the title. */
|
||||||
|
before: string;
|
||||||
|
/** Moment format for the text after the title. Empty for most systems. */
|
||||||
|
after: string;
|
||||||
|
/** True when the format carries a title token, i.e. many notes per date. */
|
||||||
|
hasTitle: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Split a name format around its title token.
|
||||||
|
*
|
||||||
|
* The split has to happen before moment sees the string: `t`, `i`, `l` and `e`
|
||||||
|
* are all live moment tokens, so formatting `{title}` directly would mangle it.
|
||||||
|
*/
|
||||||
|
export function splitNameFormat(nameFormat: string): NameFormatParts {
|
||||||
|
const idx = nameFormat.indexOf(TITLE_TOKEN);
|
||||||
|
if (idx < 0) return { before: nameFormat, after: '', hasTitle: false };
|
||||||
|
return {
|
||||||
|
before: nameFormat.slice(0, idx),
|
||||||
|
after: nameFormat.slice(idx + TITLE_TOKEN.length),
|
||||||
|
hasTitle: true,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Whether `path` sits in `folder` or any subfolder. An empty folder is the vault root. */
|
||||||
|
export function isInFolder(path: string, folder: string): boolean {
|
||||||
|
if (!folder) return true;
|
||||||
|
const prefix = folder.endsWith('/') ? folder : `${folder}/`;
|
||||||
|
return path.startsWith(prefix);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether `basename` is a note of a system whose formatted name parts are
|
||||||
|
* `before` and `after`.
|
||||||
|
*
|
||||||
|
* One-per-date systems must match the whole basename. Many-per-date systems
|
||||||
|
* match on the date prefix, since the middle is a free-text title.
|
||||||
|
*/
|
||||||
|
export function matchesSystemName(
|
||||||
|
basename: string,
|
||||||
|
before: string,
|
||||||
|
after: string,
|
||||||
|
hasTitle: boolean,
|
||||||
|
): boolean {
|
||||||
|
if (!hasTitle) return basename === before + after;
|
||||||
|
// A format of just `{title}` formats to an empty prefix, which would claim
|
||||||
|
// every file in the folder for every date. Treat it as matching nothing;
|
||||||
|
// the settings tab flags the format as missing a date instead.
|
||||||
|
if (!before) return false;
|
||||||
|
if (basename.length < before.length + after.length) return false;
|
||||||
|
return basename.startsWith(before) && basename.endsWith(after);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The free-text part of a many-per-date basename, for use as a menu label.
|
||||||
|
* Falls back to the whole basename when the affixes do not line up.
|
||||||
|
*/
|
||||||
|
export function titleFromBasename(basename: string, before: string, after: string): string {
|
||||||
|
const start = basename.startsWith(before) ? before.length : 0;
|
||||||
|
const end = after && basename.endsWith(after)
|
||||||
|
? basename.length - after.length
|
||||||
|
: basename.length;
|
||||||
|
if (end <= start) return basename;
|
||||||
|
return basename.slice(start, end).trim() || basename;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Characters Obsidian rejects in filenames, plus the link-syntax characters
|
||||||
|
* (`#^[]|`) it refuses to index cleanly. Collapsed to a dash so a typed title
|
||||||
|
* like "Meeting w/ Mark" still produces a creatable filename.
|
||||||
|
*/
|
||||||
|
const ILLEGAL_FILENAME_CHARS = /[\\/:*?"<>|#^[\]]/g;
|
||||||
|
|
||||||
|
export function sanitizeTitle(title: string): string {
|
||||||
|
return title.replace(ILLEGAL_FILENAME_CHARS, '-').replace(/\s+/g, ' ').trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Whether a name format resolves to a usable date prefix at all. */
|
||||||
|
export function formatHasDateToken(nameFormat: string): boolean {
|
||||||
|
const { before } = splitNameFormat(nameFormat);
|
||||||
|
// Strip bracket-escaped literals, then look for any moment date token.
|
||||||
|
const unescaped = before.replace(/\[[^\]]*\]/g, '');
|
||||||
|
return /[YMDQGWEwdgeo]/.test(unescaped);
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
// ── Path helpers ──
|
||||||
|
// Pure functions only: no 'obsidian' imports, so this stays unit-testable in plain node.
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remap a stored vault path after a rename.
|
||||||
|
*
|
||||||
|
* Obsidian's `vault.on('rename')` fires for folders as well as files, so a
|
||||||
|
* stored path can be affected either because it *is* the renamed item or
|
||||||
|
* because it lives inside a renamed folder.
|
||||||
|
*
|
||||||
|
* The nested check requires a `/` boundary, so renaming `notes/foo` leaves
|
||||||
|
* `notes/foobar.md` untouched.
|
||||||
|
*
|
||||||
|
* @returns the updated path, or `null` when `path` is unaffected.
|
||||||
|
*/
|
||||||
|
export function remapRenamedPath(path: string, oldPath: string, newPath: string): string | null {
|
||||||
|
if (!path || !oldPath) return null;
|
||||||
|
if (path === oldPath) return newPath;
|
||||||
|
if (path.startsWith(oldPath + '/')) return newPath + path.slice(oldPath.length);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
// ── Recent files ordering ──
|
||||||
|
//
|
||||||
|
// Pure helpers (no 'obsidian' import) shared by the plugin, which trims the
|
||||||
|
// stored list, and the view, which filters it for display.
|
||||||
|
|
||||||
|
import type { RecentFileEntry } from 'src/models/bookmark';
|
||||||
|
|
||||||
|
/** Which recent files the sidebar lists. */
|
||||||
|
export type RecentFilesShow = 'all' | 'opened' | 'changed';
|
||||||
|
|
||||||
|
/** The timestamp `show` sorts by, or undefined when the entry is not listed. */
|
||||||
|
function sortKey(entry: RecentFileEntry, show: RecentFilesShow): number | undefined {
|
||||||
|
if (show === 'opened') return entry.openedAt;
|
||||||
|
if (show === 'changed') return entry.changedAt;
|
||||||
|
if (entry.openedAt === undefined) return entry.changedAt;
|
||||||
|
if (entry.changedAt === undefined) return entry.openedAt;
|
||||||
|
return Math.max(entry.openedAt, entry.changedAt);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Entries listed under `show`, most recent first. */
|
||||||
|
export function recentFilesFor(entries: RecentFileEntry[], show: RecentFilesShow): RecentFileEntry[] {
|
||||||
|
const keyed: { entry: RecentFileEntry; key: number }[] = [];
|
||||||
|
for (const entry of entries) {
|
||||||
|
const key = sortKey(entry, show);
|
||||||
|
if (key !== undefined) keyed.push({ entry, key });
|
||||||
|
}
|
||||||
|
keyed.sort((a, b) => b.key - a.key);
|
||||||
|
return keyed.map(k => k.entry);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Keep an entry while it is among the `max` most recently opened OR the `max`
|
||||||
|
* most recently changed files, so a burst of synced changes cannot push out
|
||||||
|
* the files you opened. Returns the kept entries most recent first.
|
||||||
|
*/
|
||||||
|
export function trimRecentFiles(entries: RecentFileEntry[], max: number): RecentFileEntry[] {
|
||||||
|
const kept = new Set<RecentFileEntry>([
|
||||||
|
...recentFilesFor(entries, 'opened').slice(0, max),
|
||||||
|
...recentFilesFor(entries, 'changed').slice(0, max),
|
||||||
|
]);
|
||||||
|
return recentFilesFor(entries, 'all').filter(entry => kept.has(entry));
|
||||||
|
}
|
||||||
+686
-386
File diff suppressed because it is too large.
Load diff
+294
-27
@@ -13,7 +13,7 @@
|
|||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.waypoint-view .waypoint-section:last-child {
|
.waypoint-view .waypoint-calendar-section {
|
||||||
margin-top: auto;
|
margin-top: auto;
|
||||||
margin-bottom: 0;
|
margin-bottom: 0;
|
||||||
}
|
}
|
||||||
@@ -27,25 +27,54 @@
|
|||||||
margin-bottom: 4px;
|
margin-bottom: 4px;
|
||||||
padding-bottom: 4px;
|
padding-bottom: 4px;
|
||||||
border-bottom: 1px solid var(--background-modifier-border);
|
border-bottom: 1px solid var(--background-modifier-border);
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.waypoint-header-more {
|
||||||
|
margin-left: auto;
|
||||||
|
background: none;
|
||||||
|
border: none;
|
||||||
|
cursor: var(--cursor-link, pointer);
|
||||||
|
color: var(--text-faint);
|
||||||
|
padding: 2px 4px;
|
||||||
|
border-radius: 4px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
transition: color 80ms, background 80ms;
|
||||||
|
box-shadow: none;
|
||||||
|
opacity: 0.6;
|
||||||
|
}
|
||||||
|
|
||||||
|
.waypoint-header-more:hover {
|
||||||
|
color: var(--text-normal);
|
||||||
|
background: none;
|
||||||
|
opacity: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ── Calendar ── */
|
/* ── Calendar ── */
|
||||||
|
|
||||||
.waypoint-calendar {
|
.waypoint-calendar {
|
||||||
font-size: var(--font-ui-small);
|
font-size: var(--font-ui-small);
|
||||||
|
padding: 8px;
|
||||||
|
border: 1px solid var(--background-modifier-border);
|
||||||
|
border-radius: 10px;
|
||||||
|
background: var(--background-primary-alt);
|
||||||
}
|
}
|
||||||
|
|
||||||
.waypoint-calendar-top {
|
.waypoint-calendar-top {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
margin-bottom: 6px;
|
margin-bottom: 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.waypoint-calendar-breadcrumb {
|
.waypoint-calendar-breadcrumb {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 6px;
|
gap: 4px;
|
||||||
font-size: var(--font-ui-medium);
|
font-size: var(--font-ui-medium);
|
||||||
font-weight: var(--font-semibold);
|
font-weight: var(--font-semibold);
|
||||||
padding: 2px 0;
|
padding: 2px 0;
|
||||||
@@ -53,9 +82,10 @@
|
|||||||
|
|
||||||
.waypoint-calendar-breadcrumb .waypoint-clickable {
|
.waypoint-calendar-breadcrumb .waypoint-clickable {
|
||||||
color: var(--text-muted);
|
color: var(--text-muted);
|
||||||
cursor: var(--cursor);
|
cursor: var(--cursor-link, pointer);
|
||||||
padding: 1px 4px;
|
padding: 2px 4px;
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
|
transition: color 80ms, background-color 80ms;
|
||||||
}
|
}
|
||||||
|
|
||||||
.waypoint-calendar-breadcrumb .waypoint-clickable:hover {
|
.waypoint-calendar-breadcrumb .waypoint-clickable:hover {
|
||||||
@@ -65,23 +95,39 @@
|
|||||||
|
|
||||||
.waypoint-calendar .waypoint-separator {
|
.waypoint-calendar .waypoint-separator {
|
||||||
color: var(--text-faint);
|
color: var(--text-faint);
|
||||||
margin: 0 2px;
|
margin: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.waypoint-calendar-today-group {
|
.waypoint-calendar-today-group {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 2px;
|
gap: 1px;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Anchors the native picker under the date button without taking space. */
|
||||||
|
.waypoint-calendar-today-group .waypoint-calendar-pick-input {
|
||||||
|
position: absolute;
|
||||||
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
|
width: 1px;
|
||||||
|
height: 1px;
|
||||||
|
padding: 0;
|
||||||
|
border: 0;
|
||||||
|
opacity: 0;
|
||||||
|
pointer-events: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.waypoint-calendar-today-group button {
|
.waypoint-calendar-today-group button {
|
||||||
background: none;
|
background: none;
|
||||||
border: none;
|
border: none;
|
||||||
cursor: var(--cursor);
|
cursor: var(--cursor-link, pointer);
|
||||||
padding: 2px 6px;
|
padding: 2px 5px;
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
color: var(--text-muted);
|
color: var(--text-muted);
|
||||||
font-size: var(--font-ui-small);
|
font-size: var(--font-ui-small);
|
||||||
|
transition: color 80ms, background-color 80ms;
|
||||||
|
box-shadow: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.waypoint-calendar-today-group button:hover {
|
.waypoint-calendar-today-group button:hover {
|
||||||
@@ -96,29 +142,34 @@
|
|||||||
.waypoint-calendar table {
|
.waypoint-calendar table {
|
||||||
table-layout: fixed;
|
table-layout: fixed;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
border-collapse: collapse;
|
border-collapse: separate;
|
||||||
|
border-spacing: 2px 3px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.waypoint-calendar th,
|
.waypoint-calendar th,
|
||||||
.waypoint-calendar td {
|
.waypoint-calendar td {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
padding: 2px 1px;
|
padding: 0;
|
||||||
font-size: var(--font-ui-small);
|
font-size: var(--font-ui-small);
|
||||||
}
|
}
|
||||||
|
|
||||||
.waypoint-calendar th {
|
.waypoint-calendar th {
|
||||||
|
padding-bottom: 2px;
|
||||||
font-weight: var(--font-medium);
|
font-weight: var(--font-medium);
|
||||||
color: var(--text-faint);
|
color: var(--text-faint);
|
||||||
font-size: calc(var(--font-ui-small) * 0.85);
|
font-size: calc(var(--font-ui-small) * 0.78);
|
||||||
|
letter-spacing: 0.04em;
|
||||||
|
text-transform: uppercase;
|
||||||
}
|
}
|
||||||
|
|
||||||
.waypoint-calendar .waypoint-weeknum {
|
.waypoint-calendar .waypoint-weeknum {
|
||||||
font-size: calc(var(--font-ui-small) * 0.75);
|
width: 18px;
|
||||||
|
font-size: calc(var(--font-ui-small) * 0.72);
|
||||||
color: var(--text-faint);
|
color: var(--text-faint);
|
||||||
font-weight: var(--font-light);
|
font-weight: var(--font-light);
|
||||||
cursor: var(--cursor);
|
cursor: var(--cursor-link, pointer);
|
||||||
padding: 2px 0;
|
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
|
transition: color 80ms, background-color 80ms;
|
||||||
}
|
}
|
||||||
|
|
||||||
.waypoint-calendar .waypoint-weeknum:hover {
|
.waypoint-calendar .waypoint-weeknum:hover {
|
||||||
@@ -127,40 +178,106 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.waypoint-calendar .waypoint-day {
|
.waypoint-calendar .waypoint-day {
|
||||||
cursor: var(--cursor);
|
cursor: var(--cursor-link, pointer);
|
||||||
padding: 3px 0;
|
height: var(--wp-cal-cell-size, 32px);
|
||||||
|
box-sizing: border-box;
|
||||||
|
padding: 2px 0 7px;
|
||||||
border-radius: 6px;
|
border-radius: 6px;
|
||||||
position: relative;
|
position: relative;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
vertical-align: middle;
|
||||||
|
transition: color 80ms, background-color 80ms, box-shadow 80ms;
|
||||||
}
|
}
|
||||||
|
|
||||||
.waypoint-calendar .waypoint-day:hover {
|
.waypoint-calendar .waypoint-day:hover {
|
||||||
background-color: var(--background-modifier-active-hover);
|
background-color: var(--background-modifier-hover);
|
||||||
}
|
}
|
||||||
|
|
||||||
.waypoint-calendar .waypoint-day.other-month {
|
.waypoint-calendar .waypoint-day.other-month {
|
||||||
opacity: 0.35;
|
color: var(--text-faint);
|
||||||
|
opacity: 0.5;
|
||||||
}
|
}
|
||||||
|
|
||||||
.waypoint-calendar .waypoint-day.today {
|
.waypoint-calendar .waypoint-day.today {
|
||||||
color: var(--text-accent);
|
color: var(--text-accent);
|
||||||
border: 1px solid var(--text-accent);
|
|
||||||
font-weight: var(--font-semibold);
|
font-weight: var(--font-semibold);
|
||||||
|
box-shadow: inset 0 0 0 1px var(--text-accent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.waypoint-calendar .waypoint-day.today:hover {
|
||||||
|
background-color: var(--background-modifier-active-hover);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Day jumped to with the date picker or the "Open date" command. */
|
||||||
|
.waypoint-calendar .waypoint-day.is-selected {
|
||||||
|
color: var(--text-on-accent);
|
||||||
|
background-color: var(--interactive-accent);
|
||||||
|
}
|
||||||
|
|
||||||
|
.waypoint-calendar .waypoint-day.is-selected:hover {
|
||||||
|
background-color: var(--interactive-accent-hover);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Lists wrap only so mobile can scroll them apart from the calendar. */
|
||||||
|
.waypoint-lists {
|
||||||
|
display: contents;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Mobile drawer: the whole calendar stays on screen; the lists scroll above it. */
|
||||||
|
.is-mobile .waypoint-view {
|
||||||
|
overflow-y: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.is-mobile .waypoint-view .waypoint-lists {
|
||||||
|
display: block;
|
||||||
|
flex: 1 1 auto;
|
||||||
|
min-height: 0;
|
||||||
|
overflow-y: auto;
|
||||||
|
margin-bottom: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Mobile's wide default buttons push the date button out of the calendar. */
|
||||||
|
.is-mobile .waypoint-calendar-today-group button {
|
||||||
|
width: auto;
|
||||||
|
padding: 4px 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Single-dot mode preserves the pre-date-systems indicator. */
|
||||||
.waypoint-calendar .waypoint-day.has-note::after {
|
.waypoint-calendar .waypoint-day.has-note::after {
|
||||||
content: '';
|
content: '';
|
||||||
display: block;
|
position: absolute;
|
||||||
|
left: 50%;
|
||||||
|
bottom: 3px;
|
||||||
width: 4px;
|
width: 4px;
|
||||||
height: 4px;
|
height: 4px;
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
background-color: var(--text-faint);
|
background-color: var(--text-faint);
|
||||||
margin: 0 auto;
|
transform: translateX(-50%);
|
||||||
}
|
}
|
||||||
|
|
||||||
.waypoint-calendar .waypoint-day.today.has-note::after {
|
.waypoint-calendar .waypoint-day.today.has-note::after {
|
||||||
background-color: var(--text-accent);
|
background-color: var(--text-accent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Colour-by-system mode: one dot per matching system, in Settings order. */
|
||||||
|
.waypoint-day-indicators {
|
||||||
|
position: absolute;
|
||||||
|
right: 0;
|
||||||
|
bottom: 3px;
|
||||||
|
left: 0;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
gap: 3px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.waypoint-day-indicator {
|
||||||
|
width: 5px;
|
||||||
|
height: 5px;
|
||||||
|
border-radius: 50%;
|
||||||
|
background-color: var(--waypoint-indicator-color);
|
||||||
|
box-shadow: 0 0 0 1px var(--background-primary);
|
||||||
|
}
|
||||||
|
|
||||||
/* ── Recent Files ── */
|
/* ── Recent Files ── */
|
||||||
|
|
||||||
.waypoint-recent-files .nav-file {
|
.waypoint-recent-files .nav-file {
|
||||||
@@ -171,6 +288,8 @@
|
|||||||
padding: 2px 28px 2px 4px;
|
padding: 2px 28px 2px 4px;
|
||||||
font-size: var(--font-ui-small);
|
font-size: var(--font-ui-small);
|
||||||
position: relative;
|
position: relative;
|
||||||
|
/* Obsidian's baseline alignment puts the type icon above the text's centre. */
|
||||||
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.waypoint-recent-files .waypoint-recent-remove {
|
.waypoint-recent-files .waypoint-recent-remove {
|
||||||
@@ -179,7 +298,7 @@
|
|||||||
top: 50%;
|
top: 50%;
|
||||||
transform: translateY(-50%);
|
transform: translateY(-50%);
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
cursor: var(--cursor);
|
cursor: var(--cursor-link, pointer);
|
||||||
color: var(--text-faint);
|
color: var(--text-faint);
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
@@ -197,15 +316,74 @@
|
|||||||
color: var(--text-accent);
|
color: var(--text-accent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Header switch: all / opened / changed. */
|
||||||
|
.waypoint-recent-show {
|
||||||
|
margin-left: auto;
|
||||||
|
display: flex;
|
||||||
|
gap: 2px;
|
||||||
|
text-transform: none;
|
||||||
|
letter-spacing: normal;
|
||||||
|
font-weight: var(--font-normal);
|
||||||
|
}
|
||||||
|
|
||||||
|
.waypoint-recent-show-option {
|
||||||
|
font-size: var(--font-ui-smaller);
|
||||||
|
color: var(--text-faint);
|
||||||
|
padding: 0 6px;
|
||||||
|
border-radius: 10px;
|
||||||
|
cursor: var(--cursor-link, pointer);
|
||||||
|
user-select: none;
|
||||||
|
transition: color 80ms, background 80ms;
|
||||||
|
}
|
||||||
|
|
||||||
|
.waypoint-recent-show-option:hover {
|
||||||
|
color: var(--text-normal);
|
||||||
|
background: var(--background-modifier-hover);
|
||||||
|
}
|
||||||
|
|
||||||
|
.waypoint-recent-show-option.is-active {
|
||||||
|
color: var(--text-normal);
|
||||||
|
background: var(--background-modifier-active-hover);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Icon of the file's configured frontmatter type; empty slots keep names aligned. */
|
||||||
|
.waypoint-recent-files .waypoint-recent-icon {
|
||||||
|
flex-shrink: 0;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
width: 16px;
|
||||||
|
/* Same box with or without an icon, and shorter than a text line, so rows keep one height. */
|
||||||
|
height: 14px;
|
||||||
|
margin-right: 6px;
|
||||||
|
color: var(--text-muted);
|
||||||
|
transform: translateY(-1px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.waypoint-recent-files .waypoint-recent-icon svg {
|
||||||
|
width: 14px;
|
||||||
|
height: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Changed in the background (sync, another plugin) since last opened. */
|
||||||
|
.waypoint-recent-files .waypoint-recent-changed {
|
||||||
|
flex-shrink: 0;
|
||||||
|
width: 6px;
|
||||||
|
height: 6px;
|
||||||
|
margin-left: 6px;
|
||||||
|
border-radius: 50%;
|
||||||
|
background-color: var(--interactive-accent);
|
||||||
|
}
|
||||||
|
|
||||||
/* ── Favorites ── */
|
/* ── Favorites ── */
|
||||||
|
|
||||||
.waypoint-favorites .waypoint-bookmark-item {
|
.waypoint-favorites .waypoint-bookmark-item {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 4px;
|
gap: var(--wp-row-spacing, 4px);
|
||||||
padding: 2px 8px 2px 4px;
|
padding: 2px 8px 2px 4px;
|
||||||
font-size: var(--font-ui-small);
|
font-size: var(--wp-font-size, 13px);
|
||||||
cursor: var(--cursor);
|
min-height: var(--wp-row-size, 26px);
|
||||||
|
cursor: var(--cursor-link, pointer);
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
user-select: none;
|
user-select: none;
|
||||||
position: relative;
|
position: relative;
|
||||||
@@ -219,6 +397,8 @@
|
|||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
|
width: var(--wp-icon-size, 16px);
|
||||||
|
height: var(--wp-icon-size, 16px);
|
||||||
}
|
}
|
||||||
|
|
||||||
.waypoint-favorites .waypoint-bookmark-item .waypoint-bm-label {
|
.waypoint-favorites .waypoint-bookmark-item .waypoint-bm-label {
|
||||||
@@ -243,13 +423,34 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.waypoint-favorites .waypoint-bookmark-children {
|
.waypoint-favorites .waypoint-bookmark-children {
|
||||||
padding-left: 16px;
|
padding-left: var(--wp-indent-size, 16px);
|
||||||
}
|
}
|
||||||
|
|
||||||
.waypoint-favorites .waypoint-bookmark-children.collapsed {
|
.waypoint-favorites .waypoint-bookmark-children.collapsed {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[data-type="waypoint-view"] button.waypoint-header-more,
|
||||||
|
button.waypoint-calendar-nav-btn,
|
||||||
|
button.waypoint-calendar-today-btn {
|
||||||
|
background-color: transparent;
|
||||||
|
box-shadow: none;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.waypoint-calendar-breadcrumb {
|
||||||
|
gap: 4px;
|
||||||
|
|
||||||
|
.waypoint-clickable {
|
||||||
|
padding: 0px;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
background-color: transparent;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* ── Drag-and-drop ── */
|
/* ── Drag-and-drop ── */
|
||||||
|
|
||||||
.waypoint-bm-dragging {
|
.waypoint-bm-dragging {
|
||||||
@@ -265,6 +466,11 @@
|
|||||||
border-bottom: 3px solid var(--text-accent) !important;
|
border-bottom: 3px solid var(--text-accent) !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.waypoint-favorites .waypoint-bm-drop-into {
|
||||||
|
background-color: var(--background-modifier-active-hover) !important;
|
||||||
|
border-radius: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
/* ── Separator & Spacer ── */
|
/* ── Separator & Spacer ── */
|
||||||
|
|
||||||
.waypoint-favorites .waypoint-bookmark-item.waypoint-bookmark-separator {
|
.waypoint-favorites .waypoint-bookmark-item.waypoint-bookmark-separator {
|
||||||
@@ -292,3 +498,64 @@
|
|||||||
cursor: grab;
|
cursor: grab;
|
||||||
background: transparent;
|
background: transparent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ── Settings Tabs ── */
|
||||||
|
|
||||||
|
.waypoint-settings-tabs {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: 4px;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
border-bottom: 1px solid var(--background-modifier-border);
|
||||||
|
padding-bottom: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.waypoint-settings-tab {
|
||||||
|
background: none;
|
||||||
|
border: none;
|
||||||
|
cursor: var(--cursor-link, pointer);
|
||||||
|
color: var(--text-muted);
|
||||||
|
padding: 6px 14px;
|
||||||
|
border-radius: 6px 6px 0 0;
|
||||||
|
font-size: var(--font-ui-small);
|
||||||
|
font-weight: var(--font-medium);
|
||||||
|
transition: color 100ms, background 100ms;
|
||||||
|
}
|
||||||
|
|
||||||
|
.waypoint-settings-tab:hover {
|
||||||
|
color: var(--text-normal);
|
||||||
|
background: var(--background-modifier-hover);
|
||||||
|
}
|
||||||
|
|
||||||
|
.waypoint-settings-tab.is-active {
|
||||||
|
color: var(--text-accent);
|
||||||
|
background: var(--background-modifier-active-hover);
|
||||||
|
border-bottom: 2px solid var(--text-accent);
|
||||||
|
margin-bottom: -9px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Wrapped rows cannot sit on the bar's bottom border, so mobile tabs are pills. */
|
||||||
|
.is-mobile .waypoint-settings-tab {
|
||||||
|
border-radius: 6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.is-mobile .waypoint-settings-tab.is-active {
|
||||||
|
border-bottom: none;
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ── Icon picker ── */
|
||||||
|
|
||||||
|
/* Sits left of Cancel/Save so clearing reads as a separate, secondary action. */
|
||||||
|
.waypoint-icon-clear {
|
||||||
|
margin-right: auto;
|
||||||
|
cursor: var(--cursor-link, pointer);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ── Settings: date systems ── */
|
||||||
|
|
||||||
|
.waypoint-settings-warning {
|
||||||
|
margin-top: 4px;
|
||||||
|
color: var(--text-error);
|
||||||
|
font-size: var(--font-ui-smaller);
|
||||||
|
}
|
||||||
@@ -1,5 +1,13 @@
|
|||||||
- [ ] when user middle clicks on a bookmark, it should open in a new tab
|
- [x] bookmarks
|
||||||
- [ ] the sidebar should never scroll. the content of recent files should wrap after 10 files or so (no sidebar visible)
|
- [x] when user middle clicks on a bookmark, it should open in a new tab
|
||||||
- [ ] it should be possible to add a separator line and/or an empty space
|
- [x] in the bookmarks, i want to have notes that are parents to other notes
|
||||||
- [ ] by default, the bookmark should have no icon
|
- [x] by default, the bookmark should have no icon
|
||||||
- [ ]
|
- [x] the way to search for icons should be improved. on the lucide icon website, the search works by more than only the icon's title. i want to be able to load all the icon (not by default though)
|
||||||
|
- [x] add a right click menu on the recent files to make them bookmarks
|
||||||
|
- [x] improve the drag and drop to have identations and groups
|
||||||
|
- [x] calendar
|
||||||
|
- [x] middle click on a date/week/etc. should open it in a new tab
|
||||||
|
- [x] i want to improve the look of the calendar. more space, a bit more height
|
||||||
|
- [x] when i hover over something that's clickable, I should see the correct cursor
|
||||||
|
- [x] recent files
|
||||||
|
- [x] I want to be able to filter the recent files. i want to have a little tag, that when i selectt, wsill show only recents notes where type == meeting, type == person
|
||||||
+2
-1
@@ -15,7 +15,8 @@
|
|||||||
"DOM",
|
"DOM",
|
||||||
"ES5",
|
"ES5",
|
||||||
"ES6",
|
"ES6",
|
||||||
"ES7"
|
"ES7",
|
||||||
|
"ES2017"
|
||||||
],
|
],
|
||||||
"paths": {
|
"paths": {
|
||||||
"src/*": ["./src/*"]
|
"src/*": ["./src/*"]
|
||||||
|
|||||||
Reference in new issue
Block a user