tcm-ts.txt / code
reminders . reminders
lib/
Apps
App
Types
Change
Color
Day
Device
List
Reminder
Smart
Browser
Home
ListView
NewReminder
Row
Status
database
deleteList
deleteReminder
loadAll
saveList
saveReminder
useDevice
useInstall
useOnline
useToday
write
Shared
Back
COLORS
DAY_WORDS
Glyph
MONTHS
SMART
WEEKDAYS
addDays
channel
counts
dayOf
done
dueLabel
inView
isOverdue
isSmart
onChange
opened
others
pwa
quickAdd
remindersIn
stamp
starter
toggleDone
viewAt
weekday
Tests
testDays
testQuickAdd
testViews
Files
appicon
icon
styles
reminders
lib/ 23 definitions
Apps
App () => Element Reminders, kept on this device: the lists (the smart ones, and yours), and the list the URL names. Every change is shown at once and saved to the device's database; another tab or window of the app shows it too.
Types
Change type What changes the device's data (and saves it).
Color type The colors a list can have, as Apple's Reminders has them.
Day type A day, as `YYYY-MM-DD`: a reminder is due on a day, wherever you are when it is.
Device type What the device has: its lists and reminders (undefined until they're read).
List type A list of reminders, one of "My Lists".
Reminder type A reminder, as this device keeps it (in its database: `store.ts`): in a List, maybe due on a day, maybe flagged, and done or not.
Smart type The lists that gather reminders from every list, by what they have in common.
Browser
Home ({ device, today, view, onNewList, }: { device?: Device | undefined; today: string; view: string; o… The lists: the smart ones as tiles, then yours, each with how many reminders it has.
ListView ({ view, device, today, change, }: { view: string; device?: Device | undefined; today: string; chan… A list's reminders, with a field for a new one. A reminder ticked off stays where it was, done, until the list is left, as Apple's does: so a tick by mistake is untaken at once.
NewReminder ({ view, today, list, onAdd, }: { view: string; today: string; list?: string | undefined; onAdd: (r… The field a new reminder is typed in: a day at its end and `!` are read (quickAdd). In a smart list, it goes in the first of your lists, due today in Today and Scheduled, flagged in Flagged.
Row ({ r, today, color, listName, onTick, onChange, onDelete, }: { r: Reminder; today: string; color: C… A reminder: its tick, its title and notes (edited where they are), when it's due, and whether it's flagged.
Status () => Element What the app says about itself: that it's offline (and works), that a new version is ready, that it installs.
database () => Promise<IDBDatabase>
deleteList (id: string, reminders: readonly Reminder[]) => Promise<void> Delete a list, and the reminders in it.
deleteReminder (id: string) => Promise<void> Delete a reminder.
loadAll () => Promise<{ lists: List[]; reminders: Reminder[]; }> Everything on this device: its lists and reminders. The first time, starter's, saved. And the first time something's saved, the browser is asked to keep it (persistent storage), rather than clear it when space runs low.
saveList (l: List) => Promise<void> Save a list, new or changed.
saveReminder (r: Reminder) => Promise<void> Save a reminder, new or changed.
useDevice () => readonly [Device | undefined, Dispatch<SetStateAction<Device | undefined>>] The device's lists and reminders, read again when another tab or window changes them.
useInstall () => (() => void) | undefined Install the app, where the browser offers it to the page (Chrome's `beforeinstallprompt`): undefined elsewhere.
useOnline () => boolean Whether the device is online.
useToday () => string Today, where the device is: again when the app comes back on screen (an installed app stays open overnight).
write (change: (stores: { lists: IDBObjectStore; reminders: IDBObjectStore; }) => void) => Promise<void> Change the database in one transaction, then tell the app's other tabs.
Shared
Back () => Element Back to the lists: on a phone, where a list is a page of its own.
COLORS readonly Color[]
DAY_WORDS Record<string, number>
Glyph ({ name }: { name: "list" | Smart; }) => Element The app's icons, drawn as lines: the smart lists', a list's, and a flag.
MONTHS string[]
SMART readonly { id: Smart; name: string; color: Color; }[] The smart lists, in the order the home screen shows them, each with its name and color.
WEEKDAYS string[]
addDays (day: string, n: number) => string The day `n` days after `day` (before it, for a negative `n`).
channel () => BroadcastChannel
counts (all: readonly Reminder[], lists: readonly List[], today: string) => Record<string, number> How many reminders each view has: what the home screen shows beside each list.
dayOf (date: Date) => string The day a moment is, where the device is.
done <T>(req: IDBRequest<T>) => Promise<T> A request's result, once it's done.
dueLabel (due: string, today: string) => string A due day as a list shows it, from `today`: "Today", "Tomorrow", "Yesterday", the weekday within the next week, or the date (with its year if it isn't this year's).
inView (view: string, r: Reminder, today: string) => boolean Whether a reminder belongs in a view: a smart list (SMART), or one of the lists by its id. Today has what's due today or before; done reminders are only in Completed.
isOverdue (r: Reminder, today: string) => boolean Whether a reminder that isn't done was due before today.
isSmart (view: string) => view is Smart Whether a view's id names a smart list rather than one of the lists.
onChange (f: () => void) => () => void Run `f` when another tab or window of the app changes something; returns a function that stops it.
opened Map<string, Promise<IDBDatabase>> The device's database, opened once per tab: lists and reminders, each by id.
others Map<string, BroadcastChannel> The other tabs and windows of the app on this device, told when something changes.
pwa { name: string; short_name: string; description: string; theme_color: string; background_color: str… Reminders' web app manifest, as the spec has it, written as an object. Its icons are files of the codebase, used like any definition: icon (an .svg, sharp at every size: the tab's) and appicon (a .png, 512×512: the home screen's, iOS's included). The build reads each file's type and size, and keeps it by its content. Shortcuts' URLs are the app's paths: `/` is the app, wherever it's served.
quickAdd (text: string, today: string) => { title: string; due?: string | undefined; flagged: boolean; } A reminder typed in one line, as the new reminder field reads it: a day at the end ("today", "tomorrow", a weekday, which is the next one, or "next week"), and `!` for flagged, each taken out of the title.
remindersIn (view: string, all: readonly Reminder[], today: string) => Reminder[] A view's reminders, in its order: by due day where days matter (Today, Scheduled), the latest done first in Completed, and otherwise as they were made.
stamp () => { id: string; created: number; } A new reminder's or list's id, and when it's made: this device's.
starter (now: number) => { lists: List[]; reminders: Reminder[]; } What a device starts with: a list, and reminders that say what to try.
toggleDone (r: Reminder) => Reminder A reminder done now, or, if it was done, not done.
viewAt (path: string) => string | undefined The list a path shows: a smart list's (`/today`), or one of yours (`/lists/<id>`); none at `/`.
weekday (day: string) => number The day of the week a day is: 0 is Sunday.
Tests
testDays () => void Days are local days: the day after the last of the month is the first of the next.
testQuickAdd () => void One line makes a reminder: a day at its end, `!` for flagged.
testViews () => void Each view has the reminders it says, in its order; done ones only in Completed.
Files
appicon file
icon file
styles file