Something went wrong

Thank you for being patient! We're working hard on resolving the issue

Plugin Data Providers - Lona Docs Log in

Plugin Data Providers

Pure event/task data extraction shared across DOM and CLI. Each provider takes a Sheet + a date range and emits the event / task / list items the renderer for that row type expects.

Why

DOM rendering and CLI inspection both want "give me the events this calendar row will display today". Rather than each platform re-implementing the extraction, providers live alongside the rows-side per-type spec catalog and both platforms reach for the same function.

       ┌─────────────────────┐
       │  PerTypeSpec        │
       │  (id, role,         │
       │   dataProvider?)    │
       └───────┬─────────────┘
               │
        ┌──────┴──────┐
        ▼             ▼
   DOM renderer   CLI inspector
        │             │
        └──────┬──────┘
               ▼
   Same calendarListDataProvider(...) call

Built-in providers

import {
  calendarAllDayDataProvider,
  calendarTimedEventsDataProvider,
  calendarListDataProvider,
  tasksDataProvider,
} from "@tento-lona/sheets";
ProviderReturnsUsed by
calendarAllDayDataProviderEventItemFullDay[]timeline[row].event, column.calendar (all-day band)
calendarTimedEventsDataProviderEventItemPartialDay[]timeline[column].event, grid.event, column.calendar (timed band)
calendarListDataProviderEventItem[] (sorted, unioned across visible calendars)column.calendar list mode
tasksDataProviderTaskCalendarItem[]column.task, timeline[row].task, grid.task

Provider interface

interface CalendarSubcolumnDataProvider {
  events(input: {
    sheet: Sheet;
    row: SheetRow;
    range: DateRange;
    subcolumns: readonly CalendarSubcolumn[];
  }): EventItem[];
}

interface TimelineItemProvider {
  items(input: {
    sheet: Sheet;
    row: SheetRow;
    range: DateRange;
  }): TimelineItem[];
}

Pure functions — no IO, no async. Inputs come from the rows-side Sheet + the platform's column/range context.

Custom providers

App code can register custom providers on a PerTypeSpec if a plugin needs cross-platform data extraction:

import { PerTypeSpec, calendarListDataProvider } from "@tento-lona/sheets";

export const MY_PROVIDER_SPEC: PerTypeSpec = {
  id: "my.thing",
  role: "renderer",
  dataProvider: {
    items: ({ sheet, row, range }) => {
      // ... extract items from sheet/row state
      return [...];
    },
  },
};

Then both DOM and CLI per-type plugins for my.thing consume it via spec.dataProvider.

See also