@ofrnsb/whiteboard 0.0.0-stage → 0.1.1

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 CHANGED
@@ -1,3 +1,71 @@
1
- # Temporary Holding Version
1
+ # Whiteboard
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ A live whiteboard people and an AI agent draw on together. Three parts:
4
+
5
+ - **The view** (React): pan, zoom, sticky notes, sections, shapes, ink, arrows routed around everything, the agent's
6
+ cursor and plan while it draws, history with replay, and keeping or undoing the agent's work.
7
+ - **The model** (`/core`, no React): the board, its versioned edits, and the layout engines the agent uses to draw an
8
+ explanation beat by beat, sections of notes, or a timeline.
9
+ - **`whiteboard-core`** (CLI): one JSON request on stdin, one JSON answer on stdout, so a backend in any language uses
10
+ the same model.
11
+
12
+ ## Install
13
+
14
+ ```sh
15
+ npm install @ofrnsb/whiteboard motion react react-dom
16
+ ```
17
+
18
+ ## Show a board
19
+
20
+ ```tsx
21
+ import { Whiteboard, httpTransport } from "@ofrnsb/whiteboard";
22
+ import "@ofrnsb/whiteboard/style.css";
23
+
24
+ <Whiteboard
25
+ boardId="brd_1"
26
+ boardRef="WB-2611-AB12"
27
+ title="Collections flow"
28
+ transport={httpTransport("/api/boards/WB-2611-AB12")}
29
+ onAsk={(question) => sendToAgent(question)}
30
+ />;
31
+ ```
32
+
33
+ The board loads, polls and saves through its `transport`. `httpTransport(url)` speaks this protocol:
34
+
35
+ | Request | Answer |
36
+ | --- | --- |
37
+ | `GET url` / `GET url?since=N` | `{ board }`, or `{ same: true, version, activity, pendingBatch }` when still at N |
38
+ | `GET url?history=1` | `{ board, history }` |
39
+ | `GET url?at=N` | `{ board }` as it was at version N |
40
+ | `PATCH url { ops }` | `{ board }` after a person's edits |
41
+ | `POST url { restore: N }`, `{ keepBatch }`, `{ undoBatch }` | `{ board }` |
42
+
43
+ Pass your own `BoardTransport` to reach a server another way (signed requests, a websocket, memory in tests).
44
+
45
+ ## Serve boards
46
+
47
+ Every answer above comes from the model in `/core` (`createBoard`, `editBoard`, `snapshot`, `historyOf`, `boardAt`,
48
+ `restoreBoard`, `keepBatch`, `undoBatch`), or from the CLI with the same names:
49
+
50
+ ```sh
51
+ echo '{"cmd":"create","owner":{"tenantId":"org-1"},"input":{"title":"Plan"},"ops":[],"by":"Ani"}' | npx whiteboard-core
52
+ ```
53
+
54
+ ## Give your agent the tools
55
+
56
+ `toolSpecs(show, names)` returns the agent's tools (create, draw, update, read) with their descriptions and JSON
57
+ schemas. For each call, `planCreate`, `planDraw` and `planUpdate` return the steps to save in order; save each one
58
+ and wait its `pauseMs`, so everyone with the board open sees it grow. `readBoard` gives the agent the board as text.
59
+
60
+ The CLI serves the same: `{"cmd":"tools"}`, `{"cmd":"plan","tool":"draw","input":{...},"board":...}`,
61
+ `{"cmd":"step",...}`, `{"cmd":"read",...}`.
62
+
63
+ ## Develop
64
+
65
+ ```sh
66
+ npm install
67
+ npm test
68
+ npm run build
69
+ ```
70
+
71
+ Publish with `npm publish` (public by `publishConfig`); `prepublishOnly` typechecks, tests and builds first.
@@ -0,0 +1,540 @@
1
+ declare const ILLUSTRATIONS: readonly ["invoice", "receipt", "banknote", "coin", "wallet", "credit-card", "bank", "piggy-bank", "safe", "cash-register", "calculator", "ledger", "budget", "tax", "refund", "loan", "audit", "currency-dollar", "file-text", "file-check", "file-spreadsheet", "clipboard-check", "rubber-stamp", "signature", "trending-up", "bar-chart", "line-chart", "pie-chart", "darts", "trophy", "medal", "rocket", "bulb", "milestone", "kanban", "layout-dashboard", "presentation", "calendar", "calendar-check", "clock", "hourglass", "timer", "phone", "mail", "chat", "messages", "megaphone", "bell-ring", "user", "users", "briefcase", "id-card", "office-chair", "truck", "van", "forklift", "warehouse", "factory", "store", "shopping-cart", "cargo-ship", "route", "map-pin", "globe", "barcode", "archive", "toolbox", "alert-triangle", "check-circle", "shield-check", "lock", "courthouse", "hammer", "scale", "search", "flag", "stop-sign", "signpost", "database", "server", "cloud", "settings", "refresh", "laptop", "exchange"];
2
+ type Illustration = (typeof ILLUSTRATIONS)[number];
3
+ declare const isIllustration: (x: unknown) => x is Illustration;
4
+
5
+ declare const LINE_ICONS: readonly ["phone", "phone-call", "phone-incoming", "phone-missed", "headset", "message-circle", "message-square", "messages-square", "mail", "send", "bell", "megaphone", "user", "users", "user-check", "user-x", "user-plus", "contact", "crown", "star", "heart", "handshake", "briefcase", "building", "landmark", "store", "house", "credit-card", "wallet", "banknote", "coins", "piggy-bank", "receipt", "percent", "badge-dollar-sign", "hand-coins", "globe", "plane", "map-pin", "car", "database", "server", "cloud", "cpu", "bot", "brain", "sparkles", "wand", "zap", "plug", "workflow", "network", "git-branch", "layers", "boxes", "package", "truck", "search", "list-checks", "clipboard-check", "clipboard-list", "file-text", "files", "folder", "book-open", "notebook-pen", "pencil", "calculator", "chart-bar", "chart-line", "chart-pie", "chart-no-axes-combined", "trending-up", "trending-down", "target", "gauge", "activity", "funnel", "calendar", "calendar-check", "calendar-clock", "clock", "timer", "hourglass", "repeat", "refresh-cw", "infinity", "rocket", "flag", "milestone", "check", "circle-check", "x", "circle-x", "octagon-x", "shield", "shield-check", "lock", "key", "eye", "thumbs-up", "thumbs-down", "lightbulb", "info", "scale", "gavel", "award", "trophy", "gift", "ticket", "tag", "shopping-cart", "smartphone", "laptop", "monitor", "wifi", "arrow-right", "arrow-down", "arrow-up-right", "corner-down-right", "split", "merge", "plus", "minus", "equal", "ban", "hand", "pointer"];
6
+ type LineIcon = (typeof LINE_ICONS)[number];
7
+ declare const isLineIcon: (x: unknown) => x is LineIcon;
8
+
9
+ type BoardMode = "whiteboard" | "sheet" | "tasks";
10
+ /** Tints for slips and boxes; paper, ink and red are the ledger's own (ink = the highlighted element, red = what needs action). */
11
+ /** outline = an empty frame of a box (not built yet); new = the accent edge (new in this step). Both for staged pictures. */
12
+ /** orange, peach and sand are the warm card tones of an illustrated timeline. */
13
+ declare const NOTE_COLORS: readonly ["yellow", "blue", "green", "pink", "purple", "gray", "paper", "ink", "red", "outline", "new", "orange", "peach", "sand"];
14
+ type NoteColor = (typeof NOTE_COLORS)[number];
15
+ /** What a board item is drawn as. Older boards have none: those are notes. */
16
+ /**
17
+ * track: the thick winding road a timeline runs along (its path is `points`); pill: a milestone marker on it ("Hari 7");
18
+ * dot: a small numbered step between milestones; cell: one cell of a matrix (calendar, swimlane);
19
+ * sticker: a large free-standing illustration with no card around it (a truck on the road, a bank by the title).
20
+ */
21
+ declare const SHAPES: readonly ["note", "box", "text", "ellipse", "cloud", "cylinder", "ink", "track", "pill", "dot", "cell", "sticker", "diamond", "triangle", "pentagon", "hexagon", "parallelogram"];
22
+ /** Shapes that hold a title and words inside an outline. */
23
+ declare const OUTLINED: Set<"track" | "pill" | "dot" | "cell" | "note" | "sticker" | "cloud" | "diamond" | "triangle" | "pentagon" | "hexagon" | "parallelogram" | "ellipse" | "box" | "cylinder" | "text" | "ink">;
24
+ type Shape = (typeof SHAPES)[number];
25
+ declare const TEXT_SIZES: readonly ["s", "m", "l", "xl"];
26
+ type TextSize = (typeof TEXT_SIZES)[number];
27
+ type WbNote = {
28
+ id: string;
29
+ text: string;
30
+ x: number;
31
+ y: number;
32
+ w: number;
33
+ h: number;
34
+ color: NoteColor;
35
+ frame: string | null;
36
+ owner?: string;
37
+ due?: string;
38
+ by: string;
39
+ shape?: Shape;
40
+ /** Bold first line of a box ("Agent core") above its text. */
41
+ title?: string;
42
+ /** The illustration drawn large at the top of a card, by name from ILLUSTRATIONS ("truck", "invoice"). */
43
+ icon?: string;
44
+ /** Drawn in marker: outline, words and drawing in this ink, no fill. */
45
+ pen?: Pen;
46
+ /** A sketched outline drawn as dashes: optional, planned, or a loose group. */
47
+ dashed?: boolean;
48
+ size?: TextSize;
49
+ /** Pen strokes: x,y pairs relative to the item's top-left. */
50
+ points?: number[];
51
+ /** Pen pressure per point (0..1), only when the device gave real pressure; without it the stroke simulates it. */
52
+ pressure?: number[];
53
+ /** A pen stroke's width in board units, set from the zoom it was drawn at so it keeps its size on screen. */
54
+ weight?: number;
55
+ /** How a pen stroke is drawn: a clean nib (the default) or a marker. */
56
+ brush?: (typeof BRUSHES)[number];
57
+ };
58
+ declare const BRUSHES: readonly ["pena", "spidol"];
59
+ type WbFrame = {
60
+ id: string;
61
+ title: string;
62
+ x: number;
63
+ y: number;
64
+ w: number;
65
+ h: number;
66
+ subtitle?: string;
67
+ };
68
+ /** `auto`: the board routes the wire itself, around every item. */
69
+ declare const ROUTES: readonly ["straight", "elbow", "curve", "auto"];
70
+ /** `layer`: how deep in the explanation the wire runs (0 the main flow, up to 9); it sets the wire's colour. */
71
+ type WbLink = {
72
+ id: string;
73
+ from: string;
74
+ to: string;
75
+ label?: string;
76
+ route?: (typeof ROUTES)[number];
77
+ dashed?: boolean;
78
+ arrow?: "end" | "both" | "none";
79
+ layer?: number;
80
+ };
81
+ declare const MAX_LAYER = 9;
82
+ declare const COL_TYPES: readonly ["text", "number", "money", "date", "select", "check"];
83
+ type ColType = (typeof COL_TYPES)[number];
84
+ type CellValue = string | number | boolean | null;
85
+ type SheetCol = {
86
+ id: string;
87
+ name: string;
88
+ type: ColType;
89
+ options?: string[];
90
+ formula?: string;
91
+ total?: "sum" | "avg" | "count" | null;
92
+ width?: number;
93
+ };
94
+ type SheetRow = {
95
+ id: string;
96
+ cells: Record<string, CellValue>;
97
+ };
98
+ type SheetTab = {
99
+ id: string;
100
+ name: string;
101
+ columns: SheetCol[];
102
+ rows: SheetRow[];
103
+ };
104
+ /** What changed last, so the UI can outline it ("each new edit is outlined so you can track changes"). */
105
+ /** One change, with the ops that made it, so any browser can animate it or step back through the board's history. */
106
+ type BoardEdit = {
107
+ at: string;
108
+ by: string;
109
+ agent: boolean;
110
+ what: string;
111
+ keys: string[];
112
+ version?: number;
113
+ ops?: BoardOp[];
114
+ /** The piece of agent work this edit belongs to (see BoardActivity.batch). */
115
+ batch?: string;
116
+ /** Set on a batch's edits when a person keeps or undoes that piece of agent work. */
117
+ decided?: {
118
+ by: string;
119
+ at: string;
120
+ how: "kept" | "undone";
121
+ };
122
+ /** The agent's one-line reason for this change, read out when the history is replayed ("Hari 21 ditambah: maks. 1 reminder per 7 hari"). */
123
+ why?: string;
124
+ /** A beat of a told board: `what` is the sentence said while it was drawn, so the board shows that, not the kind of item. */
125
+ told?: boolean;
126
+ };
127
+ /** Where the agent is about to put something: shown as faint footprints before each item is drawn into its place. */
128
+ type PlannedItem = {
129
+ id: string;
130
+ kind: "frame" | "track" | "pill" | "dot" | "card" | "sticker" | "text" | "cell" | "shape";
131
+ x: number;
132
+ y: number;
133
+ w: number;
134
+ h: number;
135
+ };
136
+ /** Who is working on the board right now; fresh for BOARD_ACTIVITY_MS after `at`. Teammates see the agent working live. */
137
+ type BoardActivity = {
138
+ by: string;
139
+ agent: boolean;
140
+ what: string;
141
+ at: string;
142
+ chatId?: string;
143
+ keys?: string[];
144
+ /** The agent's plan for this piece of work: every item it is about to add, set when the work starts. */
145
+ plan?: PlannedItem[];
146
+ /** One piece of agent work (one tool call): its edits share it, so the whole piece can be kept or undone together. */
147
+ batch?: string;
148
+ };
149
+ /** The board as it was before the oldest edit still kept, so history can be rebuilt as base + the ops of each kept edit. */
150
+ type BoardBase = {
151
+ version: number;
152
+ title: string;
153
+ frames: WbFrame[];
154
+ notes: WbNote[];
155
+ links: WbLink[];
156
+ tabs: SheetTab[];
157
+ };
158
+ type Board = {
159
+ id: string;
160
+ ref: string;
161
+ tenantId: string;
162
+ unitId: string;
163
+ projectId: string | null;
164
+ title: string;
165
+ mode: BoardMode;
166
+ createdBy: string;
167
+ createdAt: string;
168
+ updatedAt: string;
169
+ updatedBy: string;
170
+ version: number;
171
+ frames: WbFrame[];
172
+ notes: WbNote[];
173
+ links: WbLink[];
174
+ tabs: SheetTab[];
175
+ edits: BoardEdit[];
176
+ /** Conversations that made, changed or read the board, newest first. Boards saved before this have none. */
177
+ chats?: BoardChat[];
178
+ activity?: BoardActivity;
179
+ base?: BoardBase;
180
+ };
181
+ type BoardChat = {
182
+ chatId: string;
183
+ userId: string;
184
+ at: string;
185
+ what: "created" | "edited" | "read";
186
+ };
187
+ type BoardOp = {
188
+ op: "title";
189
+ title: string;
190
+ } | {
191
+ op: "note.add";
192
+ note: Partial<WbNote> & {
193
+ id: string;
194
+ text: string;
195
+ x: number;
196
+ y: number;
197
+ };
198
+ } | {
199
+ op: "note.update";
200
+ id: string;
201
+ patch: Partial<Omit<WbNote, "id" | "by">>;
202
+ } | {
203
+ op: "note.remove";
204
+ id: string;
205
+ } | {
206
+ op: "frame.add";
207
+ frame: Partial<WbFrame> & {
208
+ id: string;
209
+ title: string;
210
+ x: number;
211
+ y: number;
212
+ };
213
+ } | {
214
+ op: "frame.update";
215
+ id: string;
216
+ patch: Partial<Omit<WbFrame, "id">>;
217
+ }
218
+ /** Moves the frame and every note inside it. */
219
+ | {
220
+ op: "frame.move";
221
+ id: string;
222
+ dx: number;
223
+ dy: number;
224
+ } | {
225
+ op: "frame.remove";
226
+ id: string;
227
+ keepNotes?: boolean;
228
+ } | {
229
+ op: "link.add";
230
+ link: WbLink;
231
+ } | {
232
+ op: "link.update";
233
+ id: string;
234
+ patch: Partial<Omit<WbLink, "id" | "from" | "to">>;
235
+ } | {
236
+ op: "link.remove";
237
+ id: string;
238
+ } | {
239
+ op: "tab.add";
240
+ tab: {
241
+ id: string;
242
+ name: string;
243
+ columns?: SheetCol[];
244
+ };
245
+ } | {
246
+ op: "tab.rename";
247
+ tab: string;
248
+ name: string;
249
+ } | {
250
+ op: "tab.remove";
251
+ tab: string;
252
+ } | {
253
+ op: "col.add";
254
+ tab: string;
255
+ col: SheetCol;
256
+ at?: number;
257
+ } | {
258
+ op: "col.update";
259
+ tab: string;
260
+ id: string;
261
+ patch: Partial<Omit<SheetCol, "id">>;
262
+ } | {
263
+ op: "col.remove";
264
+ tab: string;
265
+ id: string;
266
+ } | {
267
+ op: "row.add";
268
+ tab: string;
269
+ row: SheetRow;
270
+ at?: number;
271
+ } | {
272
+ op: "row.remove";
273
+ tab: string;
274
+ id: string;
275
+ } | {
276
+ op: "cell.set";
277
+ tab: string;
278
+ row: string;
279
+ col: string;
280
+ value: CellValue;
281
+ }
282
+ /** Server only (never accepted from a browser): puts back the whole content of an earlier version. */
283
+ | {
284
+ op: "restore";
285
+ to: BoardBase;
286
+ };
287
+ declare const NOTE_W: 200;
288
+ declare const NOTE_H: 120;
289
+ declare const MAX_NOTES: 400;
290
+ declare const MAX_ROWS: 2000;
291
+ declare const MAX_COLS: 40;
292
+ /** Emoji never reach the board: illustrations are drawings, and an emoji font varies by device. */
293
+ /**
294
+ * A task board is a sheet seen as lanes, so any process fits it (To do/Doing/Done, Lead/Won, Admitted/Ward/Discharged):
295
+ * its first tab, the first choice column as the lane, the first text column as the card title, every other column a
296
+ * field on the card. Moving a card is setting its lane cell, with the same history, undo and live edits as a sheet.
297
+ */
298
+ declare function taskShape(b: Pick<Board, "tabs">): {
299
+ tab: SheetTab;
300
+ lane: SheetCol;
301
+ title: SheetCol;
302
+ lanes: string[];
303
+ fields: SheetCol[];
304
+ } | null;
305
+ /** The ops that lay out a new task board: one tab, its title and lane columns first, then the other fields and the cards. */
306
+ declare function taskBoardOps(o: {
307
+ tab: string;
308
+ title: string;
309
+ lane: string;
310
+ lanes: string[];
311
+ fields: Omit<SheetCol, "id">[];
312
+ cards: Record<string, CellValue>[];
313
+ }): BoardOp[];
314
+ declare const noEmoji: (s: string) => string;
315
+ /** A card's illustration is one of the board's drawings by name; anything else (an emoji, a word) is dropped. */
316
+ declare function validIcon(s?: string): Illustration | LineIcon | undefined;
317
+ /** Marker colours of a sketched item: its outline, words and drawing are all in that one ink. */
318
+ declare const PENS: readonly ["black", "blue", "green", "red", "purple", "orange"];
319
+ type Pen = (typeof PENS)[number];
320
+ declare const uid: (prefix: string) => string;
321
+ /** The frame a point falls in, topmost (last drawn) first. */
322
+ declare function frameAt(b: Pick<Board, "frames">, x: number, y: number): string | null;
323
+ declare function minSize(shape?: Shape): {
324
+ w: number;
325
+ h: number;
326
+ };
327
+ /**
328
+ * Applies ops to a copy of the board. Ops on things that no longer exist (someone else removed them) are skipped,
329
+ * so two people editing at once never break the board; the later edit to the same field wins.
330
+ */
331
+ declare function applyOps(board: Board, ops: BoardOp[], by: string, now?: string): Board;
332
+ /** The keys an op touches, for outlining what the agent changed. */
333
+ declare function opKeys(ops: BoardOp[]): string[];
334
+ /** The content of a board, as kept in its base and carried by a restore. */
335
+ declare const contentOf: (b: Pick<Board, "version" | "title" | "frames" | "notes" | "links" | "tabs">) => BoardBase;
336
+ /** One step of the history as the browser lists it; `replayable` is false where the ops were too big to keep. */
337
+ type HistoryItem = {
338
+ version: number;
339
+ at: string;
340
+ by: string;
341
+ agent: boolean;
342
+ what: string;
343
+ why?: string;
344
+ keys: string[];
345
+ replayable: boolean;
346
+ batch?: string;
347
+ decided?: BoardEdit["decided"];
348
+ told?: boolean;
349
+ };
350
+ declare function historyOf(board: Board): HistoryItem[];
351
+ /** Where a piece of work is about to put things: one footprint per added note or frame, in the order they will land. */
352
+ declare function planOf(ops: BoardOp[], max?: number): PlannedItem[];
353
+ /** The latest piece of agent work nobody has kept or undone yet: what every viewer is asked to decide on. */
354
+ type PendingBatch = {
355
+ id: string;
356
+ by: string;
357
+ what: string;
358
+ why?: string;
359
+ keys: string[];
360
+ at: string;
361
+ };
362
+ declare function pendingBatchOf(board: Pick<Board, "edits">): PendingBatch | null;
363
+ /** The board as it was at `version`, rebuilt from its base; null when that version is no longer kept (or never was). */
364
+ declare function boardAt(board: Board, version: number): Board | null;
365
+ /** Folds an edit into the base when it is trimmed from the history, so base + the rest still rebuild the board. */
366
+ declare function foldIntoBase(base: BoardBase, e: BoardEdit, shell: Board): BoardBase;
367
+ type BuildStep = {
368
+ kind: "frame" | "road" | "marks" | "cards" | "changes" | "links" | "stickers";
369
+ ops: BoardOp[];
370
+ };
371
+ /**
372
+ * Splits a drawing into the steps a designer would take: heading and frames, the road, milestones, cards in reading
373
+ * order (along the road for a timeline, top to bottom then left to right otherwise, `perStep` at a time), other changes,
374
+ * the lines between things, then free stickers. Dependencies hold: frames before what sits in them, items before links.
375
+ */
376
+ declare function stepsOf(ops: BoardOp[], perStep?: number): BuildStep[];
377
+ type Section = {
378
+ title: string;
379
+ subtitle?: string;
380
+ notes: {
381
+ text: string;
382
+ title?: string;
383
+ icon?: string;
384
+ owner?: string;
385
+ due?: string;
386
+ color?: NoteColor;
387
+ }[];
388
+ };
389
+ type LayoutKind = "columns" | "timeline" | "grid";
390
+ type Heading = {
391
+ title: string;
392
+ subtitle?: string;
393
+ icon?: string;
394
+ };
395
+ declare const colorFor: (title: string, fallback: NoteColor) => NoteColor;
396
+ /** Ops that place sections as frames of sticky notes, starting right of anything already on the board; a heading goes on top. */
397
+ declare function layoutOps(sections: Section[], layout: LayoutKind, origin?: {
398
+ x: number;
399
+ y: number;
400
+ }, palette?: NoteColor[], heading?: Heading): {
401
+ ops: BoardOp[];
402
+ frameIds: string[];
403
+ };
404
+ /** Where new sections go: to the right of everything already on the board. */
405
+ declare function nextOrigin(b: Pick<Board, "frames" | "notes">): {
406
+ x: number;
407
+ y: number;
408
+ };
409
+ declare function tidyOps(b: Board): BoardOp[];
410
+ /** Column names a formula refers to, for validation. */
411
+ declare const formulaRefs: (src: string) => string[] | null;
412
+ /** Evaluates a formula for one row; null when a referenced cell is empty or the formula is malformed. */
413
+ declare function evalFormula(src: string, value: (name: string) => number | null): number | null;
414
+ /** A cell as shown: stored value, or the formula's result (formulas may use other formula columns, without cycles). */
415
+ declare function cellValue(t: SheetTab, r: SheetRow, c: SheetCol, seen?: Set<string>): CellValue;
416
+ declare function columnTotal(t: SheetTab, c: SheetCol): number | null;
417
+ /** The sheet tab as plain rows, every formula computed: for the agent to read and for CSV export. */
418
+ declare function tabRows(t: SheetTab): {
419
+ columns: SheetCol[];
420
+ rows: CellValue[][];
421
+ };
422
+ /** The board as text for the agent: frames with their notes (ids kept so it can move them), or sheet tabs as rows. */
423
+ declare function boardText(b: Board, only?: Set<string>, maxRows?: 200): string;
424
+ type Range = {
425
+ r0: number;
426
+ r1: number;
427
+ c0: number;
428
+ c1: number;
429
+ };
430
+ /** The range as tab-separated text: raw numbers, formulas computed, checks as Ya/Tidak. */
431
+ declare function rangeTsv(t: SheetTab, g: Range): string;
432
+ /**
433
+ * Ops that paste text at the range's top-left. Rows past the end are added; formula columns and columns past the
434
+ * last are skipped; a single value fills the whole range. Returns the pasted area so the UI can select it.
435
+ */
436
+ declare function pasteOps(t: SheetTab, g: Range, text: string, newId?: () => string): {
437
+ ops: BoardOp[];
438
+ area: Range;
439
+ };
440
+ type DrawItem = {
441
+ key?: string;
442
+ shape?: Exclude<Shape, "ink" | "track" | "cell">;
443
+ pen?: Pen;
444
+ dashed?: boolean;
445
+ title?: string;
446
+ text?: string;
447
+ icon?: string;
448
+ color?: NoteColor;
449
+ size?: TextSize;
450
+ owner?: string;
451
+ due?: string;
452
+ /** diagram: [column, row]. */
453
+ at?: [number, number];
454
+ /** timeline: the milestone label on the road ("Hari 7", "Minggu 2"). */
455
+ when?: string;
456
+ /** matrix: [column name or index, row name or index]. */
457
+ cell?: [string | number, string | number];
458
+ /** free: where this item sits in the section's own space, [x, y, width, height]. */
459
+ box?: [number, number, number, number];
460
+ };
461
+ /** A line the agent draws by hand in a free section: an underline, a ring, a bracket, a curved arrow. */
462
+ type DrawStroke = {
463
+ points: [number, number][];
464
+ color?: Pen | "yellow";
465
+ width?: "s" | "m" | "l";
466
+ marker?: boolean;
467
+ };
468
+ /** A mark made on an item the way a person marks a whiteboard: the board draws it properly round or under that item. */
469
+ type DrawMark = {
470
+ on: string;
471
+ kind: "ring" | "underline" | "highlight" | "cross" | "tick";
472
+ color?: Pen | "yellow";
473
+ };
474
+ type DrawSection = {
475
+ key?: string;
476
+ title: string;
477
+ subtitle?: string;
478
+ /**
479
+ * stack: full-width bars top to bottom; grid: tiles in columns; row: side by side; flow: side by side joined by arrows;
480
+ * diagram: each item at [column, row]; timeline: a road with a milestone per item (`when`) and the cards alternating above and below it;
481
+ * matrix: a table of cells (`columns` across, `rows` down, e.g. weekdays × weeks or stages × owners) with each item in its `cell`.
482
+ * free: no recipe at all; every item sits at its own `box` and `strokes` are drawn over them, so the picture is composed for this content.
483
+ */
484
+ layout: "stack" | "grid" | "row" | "flow" | "diagram" | "timeline" | "matrix" | "free";
485
+ /** free: lines drawn by hand over the items. */
486
+ strokes?: DrawStroke[];
487
+ /** free: rings, underlines, highlights, crosses and ticks on keyed items. */
488
+ marks?: DrawMark[];
489
+ /** matrix: header labels across and down. */
490
+ across?: string[];
491
+ down?: string[];
492
+ columns?: number;
493
+ /** Place beside the previous section instead of below it. */
494
+ beside?: boolean;
495
+ items: DrawItem[];
496
+ };
497
+ type DrawConnector = {
498
+ from: string;
499
+ to: string;
500
+ label?: string;
501
+ route?: (typeof ROUTES)[number];
502
+ dashed?: boolean;
503
+ arrow?: "end" | "both" | "none";
504
+ };
505
+ type DrawSpec = {
506
+ heading?: Heading;
507
+ sections: DrawSection[];
508
+ connectors?: DrawConnector[];
509
+ };
510
+ /**
511
+ * Ops that draw a heading and sections below everything already on the board (a new area, as when a plan is added
512
+ * under its open questions), plus connectors between items by key ("section-key" names a whole section).
513
+ * Returns the ids given to each key so later edits can address them.
514
+ */
515
+ declare function drawOps(b: Pick<Board, "frames" | "notes">, spec: DrawSpec, ids?: () => string): {
516
+ ops: BoardOp[];
517
+ keys: Record<string, string>;
518
+ area: {
519
+ x: number;
520
+ y: number;
521
+ w: number;
522
+ h: number;
523
+ };
524
+ };
525
+ /** The original section kinds: a frame with boxes or notes stacked, in a grid, in a row, in a flow, or at diagram positions. */
526
+ /** Points through which a hand would pass, made into one flowing line (Catmull-Rom), so three points never read as a broken scribble. */
527
+ declare function smoothPoints(pts: readonly (readonly [number, number])[], per?: number): [number, number][];
528
+ /** The strokes of a mark on a box, as a person would make it: a ring that overshoots where it closes, a line that is not quite straight. */
529
+ declare function markStrokes(kind: DrawMark["kind"], bx: number, by: number, bw: number, bh: number): [number, number][][];
530
+ /**
531
+ * Ops that carry an existing timeline on: the road is drawn further with the same wave, and each new item gets its
532
+ * dot, milestone and card on the side the alternation calls for, tied to its milestone. `track` names the road (by id);
533
+ * without one, the last road on the board. Null when the board has no road to extend.
534
+ */
535
+ declare function extendTimelineOps(b: Pick<Board, "notes">, items: DrawItem[], trackId?: string, ids?: () => string): {
536
+ ops: BoardOp[];
537
+ keys: Record<string, string>;
538
+ } | null;
539
+
540
+ export { boardText as $, type NoteColor as A, type BoardOp as B, COL_TYPES as C, type DrawConnector as D, PENS as E, type Pen as F, type Range as G, type Heading as H, ILLUSTRATIONS as I, SHAPES as J, type Section as K, LINE_ICONS as L, MAX_COLS as M, NOTE_COLORS as N, OUTLINED as O, type PlannedItem as P, type SheetCol as Q, ROUTES as R, type Shape as S, type TextSize as T, type SheetRow as U, type SheetTab as V, type WbLink as W, TEXT_SIZES as X, type WbFrame as Y, applyOps as Z, boardAt as _, type Board as a, cellValue as a0, colorFor as a1, columnTotal as a2, contentOf as a3, drawOps as a4, evalFormula as a5, extendTimelineOps as a6, foldIntoBase as a7, formulaRefs as a8, frameAt as a9, historyOf as aa, isIllustration as ab, isLineIcon as ac, layoutOps as ad, markStrokes as ae, minSize as af, nextOrigin as ag, noEmoji as ah, opKeys as ai, pasteOps as aj, pendingBatchOf as ak, planOf as al, rangeTsv as am, smoothPoints as an, stepsOf as ao, tabRows as ap, taskBoardOps as aq, taskShape as ar, tidyOps as as, uid as at, validIcon as au, type WbNote as b, type BoardActivity as c, type BoardMode as d, type PendingBatch as e, type BoardChat as f, BRUSHES as g, type BoardBase as h, type BoardEdit as i, type BuildStep as j, type CellValue as k, type ColType as l, type DrawItem as m, type DrawMark as n, type DrawSection as o, type DrawSpec as p, type DrawStroke as q, type HistoryItem as r, type Illustration as s, type LayoutKind as t, type LineIcon as u, MAX_LAYER as v, MAX_NOTES as w, MAX_ROWS as x, NOTE_H as y, NOTE_W as z };