@black-studio/plugin 1.3.0 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -0
- package/index.d.ts +20 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -94,6 +94,12 @@ var __blackPlugin = class extends __black.require('@black/plugin').Plugin {
|
|
|
94
94
|
- 10: `app.folder` and `project:folder`, `network:ask`,
|
|
95
95
|
`app.net.streamBytes`, `during`, `addVersionHistory`, `project.flush` and
|
|
96
96
|
`project.getProjectData`
|
|
97
|
+
- 11: data kept with one item and with the whole project, and text fields
|
|
98
|
+
merged letter by letter
|
|
99
|
+
- 12: entries of a kind the plugin defines, `project.addToDictionary`,
|
|
100
|
+
`project.picture`, `project.storyTime` and continuity checks
|
|
101
|
+
- 13: series from book importers
|
|
102
|
+
- 14: `app.ui.sprint` and `app.format`
|
|
97
103
|
- **`sandboxed`:** runs the plugin in a separate worker, apart from the
|
|
98
104
|
window (see below).
|
|
99
105
|
- **`locales`:** the plugin's name and description in other languages, by
|
|
@@ -641,6 +647,12 @@ export default class WordsToday extends Plugin {
|
|
|
641
647
|
- `open(path, { select? })`: opens one of these books, at one of its
|
|
642
648
|
documents.
|
|
643
649
|
- **`app.ui.startSprint(minutes)`**: starts a writing sprint in the open book.
|
|
650
|
+
- **`app.ui.sprint()`** (API 14): the length of sprint the writer chose last,
|
|
651
|
+
to offer them, and the sprint running in the open book, if any. Start the
|
|
652
|
+
app's sprint at that length rather than keeping a timer of your own.
|
|
653
|
+
- **`app.format`** (API 14): `number(n)` and `date(iso)`, written as the app
|
|
654
|
+
writes them for the writer's region ("1 500" or "1,500"). Use them for
|
|
655
|
+
figures the writer sees beside the app's own.
|
|
644
656
|
|
|
645
657
|
Draw cards with Bläck Studio's classes, so they look like the rest of the
|
|
646
658
|
dashboard:
|
package/index.d.ts
CHANGED
|
@@ -132,7 +132,8 @@ export interface Manifest {
|
|
|
132
132
|
}
|
|
133
133
|
|
|
134
134
|
/** `entry` is a sheet of a kind a plugin defines (defineKind, API 12). */
|
|
135
|
-
|
|
135
|
+
/** `chapter` is a chapter line in the manuscript, which starts a chapter and names it (its title, or '' for its number only). */
|
|
136
|
+
export type NodeType = 'text' | 'folder' | 'character' | 'place' | 'note' | 'research' | 'file' | 'entry' | 'chapter'
|
|
136
137
|
|
|
137
138
|
/** The icons a kind of entry may use, from the app's own. API 12. */
|
|
138
139
|
export type KindIcon =
|
|
@@ -251,7 +252,7 @@ export interface LibraryBook {
|
|
|
251
252
|
/** The word target (0 for none) and the deadline (YYYY-MM-DD, or '' for none). */
|
|
252
253
|
target: number
|
|
253
254
|
deadline: string
|
|
254
|
-
/** The daily
|
|
255
|
+
/** The daily target (0 for none). */
|
|
255
256
|
sessionTarget: number
|
|
256
257
|
/** Words written per day, keyed by date (YYYY-MM-DD, in the writer's time zone). Empty for a book that isn't counted. */
|
|
257
258
|
history: Record<string, number>
|
|
@@ -281,6 +282,16 @@ export interface App {
|
|
|
281
282
|
readonly apiVersion: number
|
|
282
283
|
/** The language of the app's interface: 'en', 'sv'… */
|
|
283
284
|
readonly language: string
|
|
285
|
+
/**
|
|
286
|
+
* Numbers and dates written as the app writes them. The app follows the writer's region, which can differ from the
|
|
287
|
+
* interface's language: "1 500" in a Swedish region, "1,500" in a British one. Use it for every number the writer
|
|
288
|
+
* reads beside the app's own. API 14: check that it exists.
|
|
289
|
+
*/
|
|
290
|
+
readonly format?: {
|
|
291
|
+
number(n: number): string
|
|
292
|
+
/** A date (an ISO date or date and time) with the month as a word: "4 Dec 2026". */
|
|
293
|
+
date(iso: string): string
|
|
294
|
+
}
|
|
284
295
|
|
|
285
296
|
/**
|
|
286
297
|
* The open book. Changing it needs "project:write". Every change can be undone, and the app takes a snapshot
|
|
@@ -451,6 +462,13 @@ export interface App {
|
|
|
451
462
|
choose(opts: { title: string; options: { value: string; label: string; detail?: string }[] }): Promise<string | null>
|
|
452
463
|
/** Starts a writing sprint of 1 to 600 minutes in the open book, like the status bar's sprint. Throws if no book is open. API 2. */
|
|
453
464
|
startSprint(minutes: number): void
|
|
465
|
+
/**
|
|
466
|
+
* The writer's sprint: `minutes` is the length they chose last in the app (25 if they never have), which is the
|
|
467
|
+
* length to offer them. `running` is the sprint going in the open book, if there is one, with when it ends (ISO)
|
|
468
|
+
* and the words written in it so far. Start a sprint with startSprint(minutes) rather than a timer of your own, so
|
|
469
|
+
* the status bar shows it and Statistics keeps it. API 14: check that it exists.
|
|
470
|
+
*/
|
|
471
|
+
sprint?(): Promise<{ minutes: number; running: { minutes: number; endsAt: string; words: number } | null }>
|
|
454
472
|
/**
|
|
455
473
|
* Shows a list of the marks from one of this plugin's highlighters in the current document, each with its
|
|
456
474
|
* surrounding text. The app selects the mark the writer picks. Resolves to false if there are no marks or
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@black-studio/plugin",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"description": "Write plugins for Bläck Studio: the plugin API's types, and a build that turns TypeScript or JSX source into a plugin folder.",
|
|
5
5
|
"keywords": ["black-studio", "plugin", "writing"],
|
|
6
6
|
"homepage": "https://blackstudio.app/developers/",
|