Bento, the office suite that fits in a file
TypeScript mit-licenseofficeoffice-365office-suiteoffice-toolsoffice365open-sourcepowerpointself-hostedsingle-page-appslidesslideshareslideshowslideshow-galleryslideshow-makerslideshows
spaces: daily notes, where the date is data and the title is display (#253)
nyblneta15c538cd384
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.ymlindex bb09fbcd..ff4d66e5 100644--- a/.github/workflows/ci.yml+++ b/.github/workflows/ci.yml@@ -144,6 +144,19 @@ jobs:# reported by the process it hangs.run: node scripts/test-spaces-agent.ts+ - name: Spaces journal rig (several timezones)+ # Every part of a daily note that can be wrong is wrong QUIETLY and on+ # someone else's machine: "today" in UTC is the wrong day for hours at+ # a time outside Greenwich, adding 86,400,000 ms is not adding a day on+ # the two DST boundaries, and `new Date('2026-08-06')` is UTC midnight+ # by spec. A date test that only ever runs in one timezone has not been+ # run — so this runs in five, including a half-hour DST offset.+ run: |+ for tz in UTC Europe/Berlin America/Los_Angeles Pacific/Kiritimati Australia/Lord_Howe; do+ echo "--- $tz"+ TZ=$tz node scripts/test-spaces-journal.ts+ done+- name: Magic notes evaluator (several timezones)# Two failure modes, and the second is what would make the feature worse# than not having it: a WRONG answer (silent, confident, in somebody'sdiff --git a/docs/DECISIONS.md b/docs/DECISIONS.mdindex b0425d51..04838815 100644--- a/docs/DECISIONS.md+++ b/docs/DECISIONS.md@@ -273,6 +273,46 @@ where the file left off. That rule does not exist yet because spaces has nosession; `scripts/test-sync-shape.ts` carries the evidence and the note so itcannot be written without it.+---++## 2026-08-06 — A journal entry is a page with a DATE on it, and the date is never the title++**Decision.** `page.journal` holds an ISO `YYYY-MM-DD`. That field, not the+page title, is what makes a page a daily entry. The title starts as the same+ISO string and the author may rename it freely.++**Why not Logseq's model.** Logseq derives a journal from its page title,+formatted by `:journal/page-title-format`. Their own tracker carries the+consequence — "Changing journal filename format causes blank journals and data+loss" (logseq/logseq#4019) — because the moment the format changes, yesterday's+journals stop being journals. A title is display; a date is data. Three things+follow from separating them, and none are available to a title-derived design:+the FILE is locale-neutral (a space written in Tokyo shows a Lisbon reader their+own format, because the label is rendered through `Intl` at display time and+never stored, per PLATFORM §8); search, grep and the Markdown export all see+`2026-08-06`, which sorts and is unambiguous in every locale; and a build that+predates journals renders an ordinary page and round-trips the field untouched.++**Created on demand, never one page per day.** Logseq makes a journal page every+day you open the app — on a filesystem that is a cheap empty file. A space is+ONE file people mail to each other, so a page per unopened day is permanent+weight for nothing.++**Entries sort by DATE in `doc.pages`, not by creation.** Inserting each new+entry after the Journal page gives reverse-creation order, which looks sorted+until someone backfills yesterday. Found by looking at the sidebar in a browser+after the node rig was already green.++**The date arithmetic is the whole risk, and it fails on other people's+machines.** `toISOString().slice(0,10)` is UTC, so "today" is the wrong day for+hours at a time outside Greenwich; `+ 86_400_000` is not a day on the two DST+boundaries each year; `new Date('2026-08-06')` is UTC midnight by spec. A+digit-shaped non-date like `2026-13-99` must be REJECTED rather than formatted,+because every Date-based formatter silently rolls it into some other real day.+`scripts/test-spaces-journal.ts` runs in five timezones in CI, including+Australia/Lord_Howe's half-hour DST offset — a date test that runs in one+timezone has not been run.+## 2026-08-06 — One CRDT engine, two document shapes, and the shape is never on the wire**Decision.** `kernel/src/sync/crdt.ts` takes a `DocShape` at construction: twodiff --git a/scripts/test-spaces-journal.ts b/scripts/test-spaces-journal.tsnew file mode 100644index 00000000..54bddcd8--- /dev/null+++ b/scripts/test-spaces-journal.ts@@ -0,0 +1,197 @@+#!/usr/bin/env node+// SPDX-License-Identifier: MIT+// Copyright (c) 2026 The Bento authors+// Daily notes — the date arithmetic, and the shape of an entry.+//+// node scripts/test-spaces-journal.ts+// TZ=Pacific/Kiritimati node scripts/test-spaces-journal.ts+//+// WHY A RIG FOR SOMETHING THIS SMALL. Every part of a journal that can be+// wrong is wrong QUIETLY, and on someone else's machine:+//+// · "Today" computed in UTC is the wrong day for hours at a time, for+// everyone who does not live in Greenwich. The writer notices when their+// evening notes land on tomorrow's page.+// · Adding 86,400,000 milliseconds is not adding a day. Twice a year it skips+// one or repeats one, and only in timezones that observe DST — so it passes+// every test run in UTC and fails in March in Berlin.+// · `new Date('2026-08-06')` is UTC midnight BY SPEC, which is the 5th for+// every reader in the Americas.+//+// This file is run under several TZ values in CI for exactly that reason: a+// date test that only ever runs in one timezone is a date test that has not+// been run.++import { todayISO, stepDay, journalLabel, journalShort, isJournal, journalsOf, journalFor, planJournal, journalHome } from '../spaces/src/journal.ts'+import { parseDoc, FORMAT } from '../spaces/src/model.ts'+import type { SpacesDoc, Page } from '../spaces/src/model.ts'++let failures = 0+let checks = 0+function ok(cond: boolean, msg: string) {+ checks+++ if (!cond) { failures++; console.log(` FAIL ${msg}`) }+ else console.log(` ok ${msg}`)+}++console.log(`bento/spaces journals (TZ=${process.env.TZ ?? Intl.DateTimeFormat().resolvedOptions().timeZone})\n`)++// ---- today is the READER'S today -------------------------------------------+{+ // 23:30 local on 6 August. In UTC+14 that is already the 7th in UTC terms+ // going one way, and in UTC-11 the 5th going the other — the exact window+ // where toISOString() lies.+ const late = new Date(2026, 7, 6, 23, 30, 0)+ ok(todayISO(late) === '2026-08-06',+ `late-evening local time is still today (got ${todayISO(late)})`)+ const early = new Date(2026, 7, 6, 0, 15, 0)+ ok(todayISO(early) === '2026-08-06',+ `just-after-midnight local time is today (got ${todayISO(early)})`)++ // the control: this is what the naive implementation would have produced+ const naive = late.toISOString().slice(0, 10)+ console.log(` (toISOString would have said ${naive} for 23:30 on the 6th)`)+}++// ---- a day is a calendar day, not 86,400,000 ms ----------------------------+{+ ok(stepDay('2026-08-06', 1) === '2026-08-07', 'forward one day')+ ok(stepDay('2026-08-06', -1) === '2026-08-05', 'back one day')+ ok(stepDay('2026-08-31', 1) === '2026-09-01', 'over a month end')+ ok(stepDay('2026-12-31', 1) === '2027-01-01', 'over a year end')+ ok(stepDay('2026-01-01', -1) === '2025-12-31', 'back over a year end')+ ok(stepDay('2024-02-28', 1) === '2024-02-29', 'into a leap day')+ ok(stepDay('2024-03-01', -1) === '2024-02-29', 'back into a leap day')+ ok(stepDay('2025-02-28', 1) === '2025-03-01', 'and past it in a common year')++ // THE DST CASES. In Europe/London the clocks go forward on 2026-03-29 and+ // back on 2026-10-25; those days are 23 and 25 hours long. Epoch arithmetic+ // lands mid-day and truncates to the wrong date.+ ok(stepDay('2026-03-28', 1) === '2026-03-29', 'across a spring-forward boundary')+ ok(stepDay('2026-03-29', 1) === '2026-03-30', '…and off it again')+ ok(stepDay('2026-10-24', 1) === '2026-10-25', 'across an autumn-back boundary')+ ok(stepDay('2026-10-25', 1) === '2026-10-26', '…and off it again')++ // stepping out and back is the identity, every day of a year+ let roundTrips = true+ let cur = '2026-01-01'+ for (let i = 0; i < 365; i++) {+ if (stepDay(stepDay(cur, 1), -1) !== cur) { roundTrips = false; break }+ cur = stepDay(cur, 1)+ }+ ok(roundTrips, 'forward-then-back is the identity for every day of a year')+ ok(cur === '2027-01-01', `365 steps from 2026-01-01 lands on 2027-01-01 (got ${cur})`)+}++// ---- the label is the reader's, and never stored ---------------------------+{+ const en = journalLabel('2026-08-06', 'en-GB')+ const ja = journalLabel('2026-08-06', 'ja-JP')+ const de = journalLabel('2026-08-06', 'de-DE')+ ok(en.includes('2026') && /august/i.test(en), `en-GB reads as a date (${en})`)+ ok(ja !== en && ja.includes('2026'), `ja-JP differs from en-GB (${ja})`)+ ok(de !== en && /august/i.test(de), `de-DE differs too (${de})`)+ ok(journalLabel('2026-08-06', 'en-GB') === en, 'and is deterministic')+ ok(journalShort('2026-08-06', 'en-GB').length < en.length, 'the short form is shorter')++ // a value that is not a date is handed back untouched rather than becoming+ // "Invalid Date" — this string came out of a file someone sent you+ ok(journalLabel('not a date') === 'not a date', 'a non-date label falls back to itself')+ ok(journalLabel('') === '', 'and so does an empty one')+ ok(journalShort('2026-13-99') === '2026-13-99', 'an impossible date is not reformatted')+}++// ---- an entry is a page with a date ----------------------------------------+{+ const page = (extra: Record<string, unknown>): Page =>+ ({ id: 'p', title: 't', blocks: [], ...extra } as Page)+ ok(isJournal(page({ journal: '2026-08-06' })), 'a page with an ISO date is an entry')+ ok(!isJournal(page({})), 'a page without one is not')+ ok(!isJournal(page({ journal: '6 August 2026' })), 'a formatted date is NOT a date — only ISO counts')+ ok(!isJournal(page({ journal: 12345 })), 'and neither is a number')+ ok(!isJournal(page({ journal: '2026-8-6' })), 'nor an unpadded one, which would sort wrong')+ // digit-shaped but not a date: every Date-based formatter rolls this over+ // into some OTHER real day, so it must be rejected rather than displayed as+ // a confident wrong answer+ ok(!isJournal(page({ journal: '2026-13-99' })), 'and an impossible date is not a date')+ ok(!isJournal(page({ journal: '2025-02-29' })), 'nor 29 February in a common year')+ ok(isJournal(page({ journal: '2024-02-29' })), '…which IS a date in a leap year')+}++// ---- planning: idempotent, ordered, and pre-order safe ----------------------+const load = (pages: unknown[]): SpacesDoc => {+ const r = parseDoc(JSON.stringify({+ format: FORMAT, version: 1, docId: 'd', title: 'S', home: (pages[0] as { id: string })?.id,+ theme: { background: '#fff', color: '#000', accent: '#f00', measure: 720 }, pages,+ }))+ if (!r.ok) throw new Error('fixture did not parse')+ return r.doc+}+const apply = (doc: SpacesDoc, plan: ReturnType<typeof planJournal>) => {+ for (const { page, after } of plan.add) {+ const at = after ? doc.pages.findIndex((p) => p.id === after) : -1+ if (at >= 0) doc.pages.splice(at + 1, 0, page)+ else doc.pages.push(page)+ }+}+{+ const doc = load([{ id: 'p1', title: 'Welcome', blocks: [{ id: 'b1', type: 'p', html: 'hi' }] }])+ const first = planJournal(doc, '2026-08-06')+ ok(first.add.length === 2, 'the first entry brings its Journal page with it')+ apply(doc, first)+ ok(!!journalHome(doc), 'the Journal page is marked as the home for entries')+ ok(journalFor(doc, '2026-08-06')?.id === first.page.id, 'and the entry is findable by date')++ // idempotent: the button, the shortcut and the agent verb all land here+ const again = planJournal(doc, '2026-08-06')+ ok(again.add.length === 0 && again.page.id === first.page.id,+ 'planning the same day twice adds nothing and returns the same page')++ const second = planJournal(doc, '2026-08-07')+ ok(second.add.length === 1, 'a later entry reuses the existing Journal page')+ apply(doc, second)++ // newest first — the order a journal is read in+ ok(journalsOf(doc).map((p) => p.journal).join(',') === '2026-08-07,2026-08-06',+ 'entries list newest first')++ // …and so does doc.pages ITSELF, which is what the sidebar renders. Writing+ // the days out of order is the normal case — you backfill yesterday — and+ // inserting each new entry straight after the Journal page would give+ // reverse-CREATION order, which looks sorted until it is not.+ const back = planJournal(doc, '2026-08-04')+ apply(doc, back)+ const mid = planJournal(doc, '2026-08-06') // already exists+ ok(mid.add.length === 0, 'backfilling a day that exists adds nothing')+ const later = planJournal(doc, '2026-08-09')+ apply(doc, later)+ const order = doc.pages.filter((p) => p.journal).map((p) => p.journal).join(',')+ ok(order === '2026-08-09,2026-08-07,2026-08-06,2026-08-04',+ `doc.pages holds entries newest-first however they were written (got ${order})`)++ // PRE-ORDER: a child must follow its parent, or the sidebar cannot be built+ const at = new Map(doc.pages.map((p, i) => [p.id, i]))+ const broken = doc.pages.filter((p) => p.parent && (at.get(p.parent) ?? 1e9) >= (at.get(p.id) ?? -1))+ ok(broken.length === 0, `every entry follows the Journal page in doc.pages (${broken.length} out of order)`)++ // the title is the ISO date: locale-neutral in the file, and the same for+ // every reader who opens it+ ok(first.page.title === '2026-08-06', 'the stored title is the ISO date, not a localized string')+ // …and renaming it does NOT stop the page being that day's entry+ first.page.title = 'Monday — sprint kickoff'+ ok(isJournal(first.page) && journalFor(doc, '2026-08-06')?.id === first.page.id,+ 'renaming an entry does not unmake it — the date is the truth, the title is display')+}++// ---- an archived entry leaves the list, not the file -----------------------+{+ const doc = load([{ id: 'p1', title: 'W', blocks: [{ id: 'b1', type: 'p', html: '' }] }])+ const plan = planJournal(doc, '2026-08-06')+ apply(doc, plan)+ ;(journalFor(doc, '2026-08-06') as Page).archived = true+ ok(journalsOf(doc).length === 0, 'an archived entry drops out of the journal list')+ ok(!!journalFor(doc, '2026-08-06'), '…but is still in the file, and still findable by date')+}++console.log(`\n${checks - failures}/${checks} checks passed`)+if (failures) process.exit(1)diff --git a/spaces/CHANGELOG.md b/spaces/CHANGELOG.mdindex 8453abb2..412c4c20 100644--- a/spaces/CHANGELOG.md+++ b/spaces/CHANGELOG.md@@ -140,6 +140,24 @@ Versions follow `0.MINOR.PATCH` while pre-1.0.`bento.calc('20% of 340')` answers the same way for an agent.+- **Daily notes.** `⌘⇧J` opens today's journal — a page per day, made the first+ time you write in it rather than one for every day you happen to open the+ file. Arrows either side of the date walk to yesterday and tomorrow, and the+ entries nest under a **Journal** page, newest first, however out of order you+ wrote them.++ An entry is an ordinary page, so it searches, links, back-links, prints and+ exports like everything else — and you can rename one to "Monday — sprint+ kickoff" without it ceasing to be that day's. The date, not the title, is+ what makes it a journal. Logseq derives the same thing from a formatted page+ title, and their tracker carries the data loss that follows when the format+ changes.++ The date is stored as `2026-08-06` and SHOWN in your own language and format —+ Japanese readers see 2026年8月6日木曜日, German readers Donnerstag, 6. August+ 2026, from the same file. `bento.journal()` opens today's for an agent, and+ `bento.journal('2026-08-06')` any day's.+## [0.1.0] — 2026-08-03First release.diff --git a/spaces/README.md b/spaces/README.mdindex ea00dbd3..862c35fd 100644--- a/spaces/README.md+++ b/spaces/README.md@@ -71,6 +71,7 @@ load contract and format additivity.| `src/model.ts` | the format, `buildIndex()` (tree, backlinks), id repair || `src/sanitize.ts` | the inline allowlist — the only thing between a file someone mailed you and script execution || `src/store.ts` | undo, and the **typing run** |+| `src/journal.ts` | daily notes — the date is `page.journal`, never the title || `src/calc.ts` | magic notes — the evaluator behind a line ending in `=`. No eval, ever || `src/render.ts` | model → DOM, shared by the editor, reading view and print || `src/highlight.ts` | the code lexer — text → `{kind, a, b}` ranges, no DOM, no strings |diff --git a/spaces/src/editor.ts b/spaces/src/editor.tsindex 795bc691..b71eecd0 100644--- a/spaces/src/editor.ts+++ b/spaces/src/editor.ts@@ -23,6 +23,9 @@ import { countOutsideTags, replaceOutsideTags } from './findreplace'import { asksForAnswer, evaluate, format, pageContext } from './calc'import { t, locale } from './i18n'import { openAbout } from './about'+import {+ todayISO, stepDay, journalLabel, journalShort, isJournal, planJournal,+} from './journal'import { canWriteInPlace } from '../../kernel/src/save.ts'import { ICONS, type IconName } from './icons'import { internAsset, prepareImage, humanBytes, IMAGE_EMBED_BUDGET, blobToDataUri } from './assets'@@ -180,6 +183,7 @@ export class Editor {keep?: (b: HTMLButtonElement) => void}> = [{ icon: 'page', label: t('New page'), hint: '⌘⌥N', run: () => this.newPage() },+ { icon: 'book', label: t("Today's journal"), hint: '⌘⇧J', run: () => this.openJournal() },{ icon: 'board', label: t('New issue'), hint: '⌘⇧I', run: () => this.newIssue() },{ icon: 'tag', label: t('Make this page an issue'), hint: t('Adds status, priority, assignee, estimate'),run: () => this.makeIssue() },@@ -548,7 +552,7 @@ export class Editor {const ico = el('span', 'sp-tree-ico')ico.innerHTML = pageIcon(page.icon)const label = document.createElement('span')- label.textContent = page.title || t('Untitled')+ label.textContent = this.pageLabel(page)a.append(ico, label)a.draggable = truea.addEventListener('click', (e) => { e.preventDefault(); s.goToPage(page.id); this.closeDrawer() })@@ -599,7 +603,7 @@ export class Editor {const ico = el('span', 'sp-tree-ico')ico.innerHTML = pageIcon(page.icon)const label = document.createElement('span')- label.textContent = page.title || t('Untitled')+ label.textContent = this.pageLabel(page)a.append(ico, label)a.addEventListener('click', (e) => { e.preventDefault(); s.goToPage(page.id); this.closeDrawer() })const un = document.createElement('button')@@ -644,6 +648,53 @@ export class Editor {})}+ /**+ * The reader's own name for a page.+ *+ * An entry stores its title as the ISO date — locale-neutral in the file, the+ * same for every reader, and what search and the Markdown export see. The+ * SIDEBAR shows it in the reader's own format, because "2026-08-06" is a key+ * and "Thu 6 Aug" is a date. An entry the author has RENAMED keeps its name:+ * the rename was the point.+ */+ pageLabel(page: { title: string; journal?: unknown }): string {+ if (isJournal(page as never) && page.title === page.journal) {+ return journalShort(String(page.journal), locale())+ }+ return page.title || t('Untitled')+ }++ /**+ * Open a day's entry, creating it if this is the first note of the day.+ *+ * ONE COMMIT for the whole plan (the Journal page and the entry, when both+ * are new), so ⌘Z takes back "I opened today's journal" in a single step+ * rather than leaving a stray empty parent behind.+ */+ openJournal(iso = todayISO()): void {+ const s = this.store+ if (s.readOnly) return+ const plan = planJournal(s.doc, iso)+ if (plan.add.length) {+ s.commit(() => {+ for (const { page, after } of plan.add) {+ const at = after ? s.doc.pages.findIndex((p) => p.id === after) : -1+ if (at >= 0) s.doc.pages.splice(at + 1, 0, page)+ else s.doc.pages.push(page)+ }+ })+ }+ s.goToPage(plan.page.id)+ this.status(journalLabel(iso, locale()))+ }++ /** The day before or after the entry in view. */+ stepJournal(n: number): void {+ const cur = this.store.page+ if (!cur || !isJournal(cur)) return+ this.openJournal(stepDay(String(cur.journal), n))+ }+newPage(parent?: string): void {const page = newPage(t('Untitled'))if (parent) page.parent = parent@@ -689,6 +740,50 @@ export class Editor {inner.prepend(pick)}+ // A DAY HAS A DAY EITHER SIDE OF IT. Without this, reaching yesterday means+ // finding it in the sidebar, which is the one navigation a journal should+ // never need. The strip carries the reader's own long-form date because the+ // title above it is the ISO key, and a date nobody can read at a glance is+ // not much of a journal.+ if (inner && isJournal(page)) {+ const iso = String(page.journal)+ const nav = el('div', 'sp-jnav')+ const step = (n: number, glyph: string, title: string) => {+ const b = document.createElement('button')+ b.type = 'button'+ b.className = 'sp-jstep'+ b.textContent = glyph+ b.title = title+ b.setAttribute('aria-label', title)+ b.addEventListener('click', () => this.stepJournal(n))+ return b+ }+ nav.append(step(-1, '‹', t('The day before')), step(1, '›', t('The day after')))+ if (iso !== todayISO()) {+ const today = document.createElement('button')+ today.type = 'button'+ today.className = 'sp-jstep sp-jtoday'+ today.textContent = t('Today')+ today.addEventListener('click', () => this.openJournal())+ nav.append(today)+ }+ inner.prepend(nav)++ // THE HEADING READS AS A DATE, not as a key. The title is stored as the+ // ISO string so the file is locale-neutral and sorts — but "2026-08-01"+ // as a page's own H1 is a filename, not a day.+ //+ // Slides solves the same shape for dynamic fields by swapping the RAW+ // token back while editing, and that is deliberately NOT copied here: a+ // `{{page}}` token is something the author means to keep, whereas an ISO+ // date is a key nobody wants to type. Someone renaming an entry starts+ // from the date they can read and appends to it — which is the rename+ // they were going to make anyway. The date itself lives in `journal` and+ // is untouched by any of it, so a renamed entry is still that day's.+ const h = inner.querySelector<HTMLElement>('[data-page-title]')+ if (h && page.title === iso) h.textContent = journalLabel(iso, locale())+ }+if (trail.length) {const crumb = el('nav', 'sp-crumb')crumb.setAttribute('aria-label', t('Breadcrumb'))@@ -1798,6 +1893,7 @@ export class Editor {if (mod && e.key.toLowerCase() === 'p') { e.preventDefault(); this.openPrint(); return }if (mod && e.key.toLowerCase() === 'f') { e.preventDefault(); this.openFind(); return }if (mod && e.altKey && e.key.toLowerCase() === 'n') { e.preventDefault(); this.newPage(); return }+ if (mod && e.shiftKey && e.key.toLowerCase() === 'j') { e.preventDefault(); this.openJournal(); return }// `[` collapses the page list, as in slides. Bare, not modified: it only// reaches here when nothing is being edited (the text path returns above,// where `[` is the page-link trigger).diff --git a/spaces/src/i18n/de.ts b/spaces/src/i18n/de.tsindex dbb97ed6..2c96e519 100644--- a/spaces/src/i18n/de.ts+++ b/spaces/src/i18n/de.ts@@ -133,6 +133,8 @@ export const de: Catalog = {"Space name": "Space-Name","Take it elsewhere": "Woanders weitermachen","That file could not be read as an image": "Diese Datei konnte nicht als Bild gelesen werden",+ "The day after": "Der Tag danach",+ "The day before": "Der Tag davor","The document block is not shaped like a space — {detail}.": "Der Dokumentblock ist nicht wie ein Space aufgebaut — {detail}.","The document block is not valid JSON — {detail}.": "Der Dokumentblock ist kein gültiges JSON — {detail}.","The whole space": "Der ganze Space",@@ -150,6 +152,8 @@ export const de: Catalog = {"This space is encrypted. Saves stay encrypted.": "Dieser Space ist verschlüsselt. Speichern bleibt verschlüsselt.","This space is locked": "Dieser Space ist gesperrt","Tip": "Tipp",+ "Today": "Heute",+ "Today's journal": "Heutiges Journal","Type / for blocks, [[ to link a page": "Tippe / für Blöcke, [[ für einen Seitenlink","Undo (⌘Z)": "Rückgängig (⌘Z)","Unlock": "Entsperren",diff --git a/spaces/src/i18n/es.ts b/spaces/src/i18n/es.tsindex f0fe115a..181baa23 100644--- a/spaces/src/i18n/es.ts+++ b/spaces/src/i18n/es.ts@@ -133,6 +133,8 @@ export const es: Catalog = {"Space name": "Nombre del espacio","Take it elsewhere": "Llévatelo a otra parte","That file could not be read as an image": "No se pudo leer ese archivo como imagen",+ "The day after": "El día siguiente",+ "The day before": "El día anterior","The document block is not shaped like a space — {detail}.": "El bloque del documento no tiene la forma de un espacio — {detail}.","The document block is not valid JSON — {detail}.": "El bloque del documento no es JSON válido — {detail}.","The whole space": "Todo el espacio",@@ -150,6 +152,8 @@ export const es: Catalog = {"This space is encrypted. Saves stay encrypted.": "Este espacio está cifrado. Los guardados siguen cifrados.","This space is locked": "Este espacio está bloqueado","Tip": "Consejo",+ "Today": "Hoy",+ "Today's journal": "Diario de hoy","Type / for blocks, [[ to link a page": "Escribe / para bloques, [[ para enlazar una página","Undo (⌘Z)": "Deshacer (⌘Z)","Unlock": "Desbloquear",diff --git a/spaces/src/i18n/fr.ts b/spaces/src/i18n/fr.tsindex 11159c05..eb2fa4a6 100644--- a/spaces/src/i18n/fr.ts+++ b/spaces/src/i18n/fr.ts@@ -133,6 +133,8 @@ export const fr: Catalog = {"Space name": "Nom de l’espace","Take it elsewhere": "Emportez-le ailleurs","That file could not be read as an image": "Ce fichier n’a pas pu être lu comme une image",+ "The day after": "Le lendemain",+ "The day before": "La veille","The document block is not shaped like a space — {detail}.": "Le bloc de document n’a pas la forme d’un espace — {detail}.","The document block is not valid JSON — {detail}.": "Le bloc de document n’est pas du JSON valide — {detail}.","The whole space": "Tout l’espace",@@ -150,6 +152,8 @@ export const fr: Catalog = {"This space is encrypted. Saves stay encrypted.": "Cet espace est chiffré. Les enregistrements restent chiffrés.","This space is locked": "Cet espace est verrouillé","Tip": "Astuce",+ "Today": "Aujourd’hui",+ "Today's journal": "Journal du jour","Type / for blocks, [[ to link a page": "Tapez / pour les blocs, [[ pour lier une page","Undo (⌘Z)": "Annuler (⌘Z)","Unlock": "Déverrouiller",diff --git a/spaces/src/i18n/it.ts b/spaces/src/i18n/it.tsindex d151f854..6b993904 100644--- a/spaces/src/i18n/it.ts+++ b/spaces/src/i18n/it.ts@@ -133,6 +133,8 @@ export const it: Catalog = {"Space name": "Nome dello spazio","Take it elsewhere": "Portalo altrove","That file could not be read as an image": "Impossibile leggere quel file come immagine",+ "The day after": "Il giorno dopo",+ "The day before": "Il giorno prima","The document block is not shaped like a space — {detail}.": "Il blocco del documento non ha la forma di uno spazio — {detail}.","The document block is not valid JSON — {detail}.": "Il blocco del documento non è JSON valido — {detail}.","The whole space": "L’intero spazio",@@ -150,6 +152,8 @@ export const it: Catalog = {"This space is encrypted. Saves stay encrypted.": "Questo spazio è cifrato. I salvataggi restano cifrati.","This space is locked": "Questo spazio è bloccato","Tip": "Suggerimento",+ "Today": "Oggi",+ "Today's journal": "Diario di oggi","Type / for blocks, [[ to link a page": "Digita / per i blocchi, [[ per collegare una pagina","Undo (⌘Z)": "Annulla (⌘Z)","Unlock": "Sblocca",diff --git a/spaces/src/i18n/ja.ts b/spaces/src/i18n/ja.tsindex e5473bdf..fa59b4d1 100644--- a/spaces/src/i18n/ja.ts+++ b/spaces/src/i18n/ja.ts@@ -133,6 +133,8 @@ export const ja: Catalog = {"Space name": "スペース名","Take it elsewhere": "外に持ち出す","That file could not be read as an image": "そのファイルは画像として読み込めませんでした",+ "The day after": "翌日",+ "The day before": "前日","The document block is not shaped like a space — {detail}.": "ドキュメントブロックがスペースの形をしていません — {detail}。","The document block is not valid JSON — {detail}.": "ドキュメントブロックが正しい JSON ではありません — {detail}。","The whole space": "スペース全体",@@ -150,6 +152,8 @@ export const ja: Catalog = {"This space is encrypted. Saves stay encrypted.": "このスペースは暗号化されています。保存しても暗号化されたままです。","This space is locked": "このスペースはロックされています","Tip": "ヒント",+ "Today": "今日",+ "Today's journal": "今日のジャーナル","Type / for blocks, [[ to link a page": "/ でブロック、[[ でページにリンク","Undo (⌘Z)": "元に戻す (⌘Z)","Unlock": "ロック解除",diff --git a/spaces/src/i18n/packed.ts b/spaces/src/i18n/packed.tsindex 7a00732c..183d910c 100644--- a/spaces/src/i18n/packed.ts+++ b/spaces/src/i18n/packed.ts@@ -172,6 +172,8 @@ export const PACKED: Record<string, ReadonlyArray<string | 0>> = {"Take it elsewhere": ["外に持ち出す","把内容带走","把內容帶走","Llévatelo a otra parte","Emportez-le ailleurs","Woanders weitermachen","Portalo altrove","Levar para outro lado"],"That file could not be read as an image": ["そのファイルは画像として読み込めませんでした","无法将该文件作为图片读取","無法將該檔案讀取為圖片","No se pudo leer ese archivo como imagen","Ce fichier n’a pas pu être lu comme une image","Diese Datei konnte nicht als Bild gelesen werden","Impossibile leggere quel file come immagine","Não foi possível ler esse ficheiro como imagem"],"That is {n} files — importing them all may take a moment. Continue?": ["{n} 個のファイルがあります。すべて読み込むには少し時間がかかります。続けますか?","一共 {n} 个文件,全部导入需要一点时间。继续吗?","共 {n} 個檔案,全部匯入需要一點時間。要繼續嗎?","Son {n} archivos: importarlos todos puede tardar un momento. ¿Continuar?","Cela fait {n} fichiers — tout importer peut prendre un moment. Continuer ?","Das sind {n} Dateien — der Import kann einen Moment dauern. Fortfahren?","Sono {n} file — importarli tutti può richiedere un momento. Continuare?","São {n} ficheiros — importar todos pode demorar um momento. Continuar?"],+ "The day after": ["翌日","后一天","後一天","El día siguiente","Le lendemain","Der Tag danach","Il giorno dopo","O dia seguinte"],+ "The day before": ["前日","前一天","前一天","El día anterior","La veille","Der Tag davor","Il giorno prima","O dia anterior"],"The document block is not shaped like a space — {detail}.": ["ドキュメントブロックがスペースの形をしていません — {detail}。","文档数据块的结构不像一个空间 — {detail}。","檔案中的文件資料結構不像一個空間 — {detail}。","El bloque del documento no tiene la forma de un espacio — {detail}.","Le bloc de document n’a pas la forme d’un espace — {detail}.","Der Dokumentblock ist nicht wie ein Space aufgebaut — {detail}.","Il blocco del documento non ha la forma di uno spazio — {detail}.","O bloco do documento não tem a forma de um espaço — {detail}."],"The document block is not valid JSON — {detail}.": ["ドキュメントブロックが正しい JSON ではありません — {detail}。","文档数据块不是有效的 JSON — {detail}。","檔案中的文件資料不是有效的 JSON — {detail}。","El bloque del documento no es JSON válido — {detail}.","Le bloc de document n’est pas du JSON valide — {detail}.","Der Dokumentblock ist kein gültiges JSON — {detail}.","Il blocco del documento non è JSON valido — {detail}.","O bloco do documento não é JSON válido — {detail}."],"The images in these notes come to {size} so far, and they all travel inside the file. Keep embedding them?": ["これらのノートの画像はすでに {size} あり、すべてファイルの中を一緒に運ばれます。埋め込みを続けますか?","这些笔记里的图片已经有 {size},而且都会随文件一起走。继续嵌入吗?","這些筆記裡的圖片已經有 {size},而且都會隨檔案一起走。要繼續嵌入嗎?","Las imágenes de estas notas suman ya {size} y todas viajan dentro del archivo. ¿Seguir incrustándolas?","Les images de ces notes font déjà {size}, et elles voyagent toutes dans le fichier. Continuer à les intégrer ?","Die Bilder in diesen Notizen ergeben bisher {size}, und sie reisen alle in der Datei mit. Weiter einbetten?","Le immagini di queste note sono già {size} e viaggiano tutte dentro il file. Continuare a incorporarle?","As imagens destas notas já somam {size} e viajam todas dentro do ficheiro. Continuar a incorporá-las?"],@@ -195,6 +197,8 @@ export const PACKED: Record<string, ReadonlyArray<string | 0>> = {"This space is locked": ["このスペースはロックされています","此空间已锁定","此空間已鎖定","Este espacio está bloqueado","Cet espace est verrouillé","Dieser Space ist gesperrt","Questo spazio è bloccato","Este espaço está bloqueado"],"Those files could not be read": ["それらのファイルは読み込めませんでした","这些文件无法读取","這些檔案無法讀取","No se pudieron leer esos archivos","Ces fichiers n’ont pas pu être lus","Diese Dateien konnten nicht gelesen werden","Non è stato possibile leggere quei file","Não foi possível ler esses ficheiros"],"Tip": ["ヒント","提示","提示","Consejo","Astuce","Tipp","Suggerimento","Dica"],+ "Today": ["今日","今天","今天","Hoy","Aujourd’hui","Heute","Oggi","Hoje"],+ "Today's journal": ["今日のジャーナル","今天的日志","今天的日誌","Diario de hoy","Journal du jour","Heutiges Journal","Diario di oggi","Diário de hoje"],"Turn into…": ["種類を変更…","转换为…","轉換為…","Convertir en…","Convertir en…","Umwandeln in…","Converti in…","Converter em…"],"Type / for blocks, [[ to link a page": ["/ でブロック、[[ でページにリンク","输入 / 插入块,[[ 链接页面","輸入 / 插入區塊,輸入 [[ 連結頁面","Escribe / para bloques, [[ para enlazar una página","Tapez / pour les blocs, [[ pour lier une page","Tippe / für Blöcke, [[ für einen Seitenlink","Digita / per i blocchi, [[ per collegare una pagina","Escreva / para blocos, [[ para ligar uma página"],"Undo (⌘Z)": ["元に戻す (⌘Z)","撤销 (⌘Z)","還原 (⌘Z)","Deshacer (⌘Z)","Annuler (⌘Z)","Rückgängig (⌘Z)","Annulla (⌘Z)","Desfazer (⌘Z)"],diff --git a/spaces/src/i18n/pt.ts b/spaces/src/i18n/pt.tsindex 4ad58dd4..b79b2dab 100644--- a/spaces/src/i18n/pt.ts+++ b/spaces/src/i18n/pt.ts@@ -133,6 +133,8 @@ export const pt: Catalog = {"Space name": "Nome do espaço","Take it elsewhere": "Levar para outro lado","That file could not be read as an image": "Não foi possível ler esse ficheiro como imagem",+ "The day after": "O dia seguinte",+ "The day before": "O dia anterior","The document block is not shaped like a space — {detail}.": "O bloco do documento não tem a forma de um espaço — {detail}.","The document block is not valid JSON — {detail}.": "O bloco do documento não é JSON válido — {detail}.","The whole space": "Todo o espaço",@@ -150,6 +152,8 @@ export const pt: Catalog = {"This space is encrypted. Saves stay encrypted.": "Este espaço está encriptado. Continua encriptado sempre que guardar.","This space is locked": "Este espaço está bloqueado","Tip": "Dica",+ "Today": "Hoje",+ "Today's journal": "Diário de hoje","Type / for blocks, [[ to link a page": "Escreva / para blocos, [[ para ligar uma página","Undo (⌘Z)": "Desfazer (⌘Z)","Unlock": "Desbloquear",diff --git a/spaces/src/i18n/zh-Hans.ts b/spaces/src/i18n/zh-Hans.tsindex 9c74aba0..7e55d3e1 100644--- a/spaces/src/i18n/zh-Hans.ts+++ b/spaces/src/i18n/zh-Hans.ts@@ -133,6 +133,8 @@ export const zh_Hans: Catalog = {"Space name": "空间名称","Take it elsewhere": "把内容带走","That file could not be read as an image": "无法将该文件作为图片读取",+ "The day after": "后一天",+ "The day before": "前一天","The document block is not shaped like a space — {detail}.": "文档数据块的结构不像一个空间 — {detail}。","The document block is not valid JSON — {detail}.": "文档数据块不是有效的 JSON — {detail}。","The whole space": "整个空间",@@ -150,6 +152,8 @@ export const zh_Hans: Catalog = {"This space is encrypted. Saves stay encrypted.": "此空间已加密。保存时仍保持加密。","This space is locked": "此空间已锁定","Tip": "提示",+ "Today": "今天",+ "Today's journal": "今天的日志","Type / for blocks, [[ to link a page": "输入 / 插入块,[[ 链接页面","Undo (⌘Z)": "撤销 (⌘Z)","Unlock": "解锁",diff --git a/spaces/src/i18n/zh-Hant.ts b/spaces/src/i18n/zh-Hant.tsindex 05617ff4..61114e1e 100644--- a/spaces/src/i18n/zh-Hant.ts+++ b/spaces/src/i18n/zh-Hant.ts@@ -133,6 +133,8 @@ export const zh_Hant: Catalog = {"Space name": "空間名稱","Take it elsewhere": "把內容帶走","That file could not be read as an image": "無法將該檔案讀取為圖片",+ "The day after": "後一天",+ "The day before": "前一天","The document block is not shaped like a space — {detail}.": "檔案中的文件資料結構不像一個空間 — {detail}。","The document block is not valid JSON — {detail}.": "檔案中的文件資料不是有效的 JSON — {detail}。","The whole space": "整個空間",@@ -150,6 +152,8 @@ export const zh_Hant: Catalog = {"This space is encrypted. Saves stay encrypted.": "此空間已加密。往後的儲存也會維持加密。","This space is locked": "此空間已鎖定","Tip": "提示",+ "Today": "今天",+ "Today's journal": "今天的日誌","Type / for blocks, [[ to link a page": "輸入 / 插入區塊,輸入 [[ 連結頁面","Undo (⌘Z)": "還原 (⌘Z)","Unlock": "解鎖",diff --git a/spaces/src/journal.ts b/spaces/src/journal.tsnew file mode 100644index 00000000..c9b21899--- /dev/null+++ b/spaces/src/journal.ts@@ -0,0 +1,193 @@+// SPDX-License-Identifier: MIT+// Copyright (c) 2026 The Bento authors+// Daily notes: a journal entry is a page with a date on it.+//+// THE MODEL, and why it is not Logseq's. Logseq derives a journal from its+// PAGE TITLE, formatted by `:journal/page-title-format`. That is the one thing+// worth not copying: their own tracker carries "Changing journal filename+// format causes blank journals and data loss" (logseq/logseq#4019 and the+// discuss thread behind it), because the moment the format changes, yesterday's+// journals stop being journals. A title is display; a date is data.+//+// So `page.journal` holds an ISO `YYYY-MM-DD` and that is the truth. The title+// is an ordinary title — it starts as the same ISO string and the author may+// rename it to "Monday — sprint kickoff" without the page ceasing to be that+// day's entry. Three things fall out:+//+// · The FILE is locale-neutral. A space written in Tokyo and opened in Lisbon+// shows each reader their own date format, because the label is rendered+// from `journal` through Intl at display time and never stored. Same rule as+// every other string in this app: language follows the viewer, never the+// document (PLATFORM §8).+// · Search, grep and the Markdown export all see `2026-08-06`, which sorts and+// is unambiguous in every locale — unlike "06/08/2026".+// · An older build that has never heard of journals renders an ordinary page+// with an ordinary title, and round-trips `journal` untouched. Additive, per+// PLATFORM §3.+//+// A JOURNAL IS A PAGE, exactly as an issue is a page. It searches, links,+// back-links, prints, exports, undoes and (when collaboration lands) merges+// like everything else, because it IS everything else. Nothing here introduces+// a second kind of thing.+//+// CREATED ON DEMAND, NOT ONE PER DAY FOREVER. Logseq makes a journal page every+// day you open the app; on a filesystem that is a cheap empty file. This whole+// document is ONE file that people mail to each other, so a page per unopened+// day is permanent weight for nothing. Today's entry appears when you ask for+// it.++import type { SpacesDoc, Page } from './model.ts'+import { newPage } from './model.ts'++/** The page-tree parent every entry hangs from, so the sidebar stays a tree+ * rather than a wall of dates. Mirrors the tracker's Tracker page. */+export const JOURNAL_HOME_TITLE = 'Journal'++/** A page IS an entry when it carries a date. Not a flag, not a page type —+ * remove the date and it is an ordinary page again, with everything on it+ * intact. */+export const isJournal = (p: Page): boolean => typeof p.journal === 'string' && isISO(p.journal)++const SHAPE = /^\d{4}-\d{2}-\d{2}$/++/**+ * A REAL date, not merely a digit-shaped string.+ *+ * `2026-13-99` matches the shape and is not a date, and every Date-based+ * formatter will silently roll it over into some OTHER real date — so a+ * nonsense value in a hand-edited or mailed file would be displayed as a+ * confident wrong day rather than as itself. The round trip is the check:+ * build the date, ask what it thinks it is, and require the same string back.+ */+export function isISO(v: string): boolean {+ if (!SHAPE.test(v)) return false+ const [y, m, d] = v.split('-').map(Number)+ const at = new Date(y, m - 1, d)+ return at.getFullYear() === y && at.getMonth() === m - 1 && at.getDate() === d+}++/**+ * Today, in the READER'S OWN TIMEZONE.+ *+ * `new Date().toISOString().slice(0,10)` is the bug this exists to avoid: it+ * is UTC, so for anyone east of Greenwich after their evening cutoff — and+ * anyone west of it before theirs — "today" is the wrong day for several hours+ * out of every twenty-four. A journal is about the writer's day, not the prime+ * meridian's.+ */+export function todayISO(now: Date = new Date()): string {+ return toISO(now.getFullYear(), now.getMonth() + 1, now.getDate())+}++const pad = (n: number) => String(n).padStart(2, '0')+const toISO = (y: number, m: number, d: number) => `${y}-${pad(m)}-${pad(d)}`++/**+ * The day `n` days from `iso`, on the CALENDAR.+ *+ * Not `+ n * 86400000`: a day is not always 86,400 seconds. On the two+ * daylight-saving boundaries each year it is 23 or 25 hours, and epoch+ * arithmetic silently skips or repeats a date. Handing the components to the+ * Date constructor lets it do the rollover — month lengths, leap years and+ * DST — which is the one piece of date work worth delegating.+ *+ * Parsed component-wise for the same reason `todayISO` exists: `new+ * Date('2026-08-06')` is UTC MIDNIGHT by spec, so it is the previous day for+ * every reader west of Greenwich.+ */+export function stepDay(iso: string, n: number): string {+ const [y, m, d] = iso.split('-').map(Number)+ const at = new Date(y, m - 1, d + n)+ return toISO(at.getFullYear(), at.getMonth() + 1, at.getDate())+}++/**+ * The reader's own name for a date — "Thursday, 6 August 2026".+ *+ * Rendered, never stored. Intl is in every browser this app supports and costs+ * nothing in the shell, where a date library would cost more than the feature.+ * A locale Intl cannot honour falls back to the ISO string, which is wrong in+ * nobody's language rather than misleading in one.+ */+export function journalLabel(iso: string, locale?: string): string {+ if (!isISO(iso)) return iso+ const [y, m, d] = iso.split('-').map(Number)+ try {+ return new Intl.DateTimeFormat(locale, {+ weekday: 'long', year: 'numeric', month: 'long', day: 'numeric',+ }).format(new Date(y, m - 1, d))+ } catch {+ return iso+ }+}++/** A short label for a tight space — "Thu 6 Aug". */+export function journalShort(iso: string, locale?: string): string {+ if (!isISO(iso)) return iso+ const [y, m, d] = iso.split('-').map(Number)+ try {+ return new Intl.DateTimeFormat(locale, { weekday: 'short', month: 'short', day: 'numeric' })+ .format(new Date(y, m - 1, d))+ } catch {+ return iso+ }+}++/** Every entry, NEWEST FIRST — the order a journal is read in. */+export function journalsOf(doc: SpacesDoc): Page[] {+ return doc.pages.filter((p) => isJournal(p) && !p.archived)+ .sort((a, b) => String(b.journal).localeCompare(String(a.journal)))+}++/** The entry for a date, if the space already has one. */+export const journalFor = (doc: SpacesDoc, iso: string): Page | undefined =>+ doc.pages.find((p) => isJournal(p) && p.journal === iso)++/** The page entries hang from, if it exists. */+export const journalHome = (doc: SpacesDoc): Page | undefined =>+ doc.pages.find((p) => p.journalHome === true)++/**+ * The pages a space needs so that `iso` has an entry — as a PLAN, applied by+ * the caller inside one commit.+ *+ * Returns what already exists rather than creating a duplicate, so calling it+ * twice in a day is idempotent — which matters, because the topbar button, the+ * shortcut and the agent verb all land here.+ *+ * ORDER: an entry is inserted directly after the Journal page, so the newest+ * is first in the sidebar and `doc.pages` stays in pre-order (a child must+ * follow its parent — the invariant the whole format rests on).+ */+export interface JournalPlan {+ /** the entry — existing, or newly minted */+ page: Page+ /** pages to add, in the order they must be inserted */+ add: Array<{ page: Page; after?: string }>+}++export function planJournal(doc: SpacesDoc, iso: string): JournalPlan {+ const existing = journalFor(doc, iso)+ if (existing) return { page: existing, add: [] }++ const add: JournalPlan['add'] = []+ let home = journalHome(doc)+ if (!home) {+ home = newPage(JOURNAL_HOME_TITLE, { icon: 'book', journalHome: true })+ add.push({ page: home })+ }+ // The title starts as the ISO date: locale-neutral in the file, sortable,+ // greppable, and the same for every reader. The UI shows a localized label.+ const page = newPage(iso, { parent: home.id, journal: iso })++ // WHERE IT GOES: after the last entry NEWER than this one, so the list reads+ // newest-first whatever order the days were written in. Inserting blindly+ // after the Journal page gives reverse-CREATION order instead, which looks+ // like a sorted list until someone backfills yesterday and it silently is+ // not one. Entries stay contiguous under their parent either way, so the+ // pre-order invariant holds.+ const newer = doc.pages.filter((p) => isJournal(p) && String(p.journal) > iso)+ const anchor = newer.length ? newer[newer.length - 1].id : home.id+ add.push({ page, after: anchor })+ return { page, add }+}diff --git a/spaces/src/main.ts b/spaces/src/main.tsindex 1deb9dd0..893b54e2 100644--- a/spaces/src/main.ts+++ b/spaces/src/main.ts@@ -24,6 +24,7 @@ import {type Plan, type PlanError, type IssueQuery,} from './agent'import { starterDoc } from './starter'+import { todayISO, isISO, journalFor } from './journal'import { textOf } from './sanitize'import { evaluate, format, pageContext } from './calc'import { buildSpacePreview } from './preview'@@ -355,6 +356,23 @@ function boot(doc: SpacesDoc, repaired: string[], frozen?: 'policy' | 'version')* / menu, no way to type — so an agent creating one would hand a human a* page they cannot write in.*/+ /**+ * Today's entry, or any day's — created if it does not exist yet.+ *+ * The same path the button and ⌘⇧J take, so an agent writing a daily note+ * lands in the same page a person would, and calling it twice in a day+ * returns the same page rather than making a second one.+ *+ * `date` is an ISO `YYYY-MM-DD`. Anything else is refused rather than+ * guessed at: "06/08/2026" is two different days depending on who wrote it.+ */+ journal: (date?: string) => {+ if (store.readOnly) return null+ const iso = date === undefined ? todayISO() : String(date)+ if (!isISO(iso)) return null+ editor.openJournal(iso)+ return journalFor(store.doc, iso)?.id ?? null+ },/*** Work out an expression the way a line ending in `=` would.*diff --git a/spaces/src/model.ts b/spaces/src/model.tsindex 126162dc..cdb34329 100644--- a/spaces/src/model.ts+++ b/spaces/src/model.ts@@ -103,6 +103,19 @@ export interface Page {icon?: string/** flat, pre-order; nesting via Block.parent */blocks: Block[]+ /**+ * This page IS the daily entry for an ISO `YYYY-MM-DD` date.+ *+ * The DATE, not the title, is what makes a journal a journal — see+ * src/journal.ts. Logseq derives the same thing from a formatted page title+ * and their tracker carries the data loss that follows when the format+ * changes; a title is display and this is data. Absent on every other page,+ * so a build that predates journals renders an ordinary page and round-trips+ * the field untouched.+ */+ journal?: string+ /** the one page daily entries hang from, so the sidebar stays a tree */+ journalHome?: boolean/** out of the sidebar, still searchable and linkable, and ENUMERATED at* share time — an author archived a page precisely because it was sensitive */archived?: booleandiff --git a/spaces/src/starter.ts b/spaces/src/starter.tsindex 691de08e..1f2e2e98 100644--- a/spaces/src/starter.ts+++ b/spaces/src/starter.ts@@ -88,6 +88,7 @@ export function starterDoc(): SpacesDoc {b('bullet', '<a href="#p/sd-tracker">Tracker</a> — the same pages, on a board'),b('bullet', '<a href="#p/sd-limits">Sharing & limits</a> — what this file can and cannot do'),b('p', 'The sidebar holds the whole tree. Drag a page onto another to nest it.'),+ b('p', 'And <code>⌘⇧J</code> opens today\u2019s journal — a page per day, made when you first write in it.'),],},{diff --git a/spaces/src/styles.css b/spaces/src/styles.cssindex 36383c9d..21967e34 100644--- a/spaces/src/styles.css+++ b/spaces/src/styles.css@@ -988,6 +988,16 @@ button.sp-issue-set:hover { background: var(--chrome-2); border-color: #b9c3d2;.sp-prop-val { background: none; }}+/* Journal: the day strip above an entry's title. Quiet by default — it is+ navigation, not content — and the date reads at the weight of a subtitle. */+.sp-jnav { display: flex; align-items: center; gap: 6px; margin: 0 0 6px; }+.sp-jdate { font-size: 13px; color: var(--muted); }+.sp-jstep {+ border: 0; background: none; cursor: pointer; color: var(--muted);+ font: inherit; font-size: 13px; line-height: 1; padding: 3px 6px; border-radius: 6px;+}+.sp-jstep:hover { background: var(--chrome-2); color: var(--ink); }+.sp-jtoday { margin-inline-start: 2px; }/* Magic notes. The answer is OUTPUT, not text: it sits beside the line in theaccent, lighter than the writing, so a page of prose with one sum in itstill reads as prose. The ghost preview is the same thing at half strength —