Bläck StudioPlugin SDK v1.0.0 · API 4
Contents

Start

Building

Beyond Bläck Studio

How it runs

Sharing

Look up

The dashboard

While no book is open, the welcome screen is the writer's dashboard: cards from plugins, in place of its quote. Turned off, a plugin's card goes, and with none on, the quote is back. This needs "apiVersion": 2: a Bläck Studio that speaks only API 1 says the plugin needs a newer Bläck Studio.

export default class WordsToday extends Plugin {
  onload() {
    this.addDashboardWidget({ id: 'today', name: 'Today', size: 'half', order: 20, render: () => <Today app={this.app} /> })
  }
}
  • addDashboardWidget({ id, name, size?, order?, render }): a card, 'half' the dashboard's width (the default) or 'full'. Cards go by order, lower first (100 if not given), then by name. Window only. These are where a card starts: the writer can drag it elsewhere, and widen or narrow it, and Bläck Studio keeps that. A card the writer hasn't placed yet (one just turned on) goes after the rest.
  • app.library, with the library:read permission:
    • books(): the books on the recent list and every book of their series, each summed up from its files: title, words, goal and deadline, the day's goal, the words written each day (history), scenes by status, its series and its place in it, and the scene written in last with how it ends now. Every card asks as the screen shows; they're read once for all.
    • activity(): the latest saved versions (git), zip backups, and each book's last push of its history, failed or not.
    • open(path, { select? }): opens one of them, at one of its documents.
  • app.ui.startSprint(minutes): a writing sprint in the open book.

Draw with Bläck Studio's own classes, so a card looks like the rest: dash-big (a large number), dash-muted (a quiet line), dash-rows and dash-row (a list of rows, a name at the start and a number at the end), dash-bar with a <span style="width: 40%"> in it (progress; done makes it green), dash-quote (a passage of the book), dash-warn, and the buttons' btn, btn primary, btn ghost sm. The six on Bläck Studio's list share their helpers, in shared/.