@yudaocode/univer-boards 0.0.0-stage → 1.6.218
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/LICENSE +190 -0
- package/README.md +37 -2
- package/lib/cjs/facade/index.js +357 -0
- package/lib/cjs/facade/index.js.map +1 -0
- package/lib/cjs/index.js +6113 -0
- package/lib/cjs/index.js.map +1 -0
- package/lib/es/facade/index.js +360 -0
- package/lib/es/facade/index.js.map +1 -0
- package/lib/es/index.js +6059 -0
- package/lib/es/index.js.map +1 -0
- package/lib/types/facade/index.d.ts +148 -0
- package/lib/types/index.d.ts +673 -0
- package/package.json +61 -3
|
@@ -0,0 +1,673 @@
|
|
|
1
|
+
import * as _univerjs_core from '@univerjs/core';
|
|
2
|
+
import { Disposable, Plugin, Injector, IUniverInstanceService, ICommandService, UnitModel, UniverInstanceType, ICommand, IMutation } from '@univerjs/core';
|
|
3
|
+
import { Observable } from 'rxjs';
|
|
4
|
+
|
|
5
|
+
type BoardGridStyle = 'dots' | 'lines' | 'none';
|
|
6
|
+
interface IBoardViewport {
|
|
7
|
+
panX: number;
|
|
8
|
+
panY: number;
|
|
9
|
+
zoom: number;
|
|
10
|
+
}
|
|
11
|
+
type BoardStickyColor = 'yellow' | 'pink' | 'blue' | 'green' | 'purple' | 'orange' | 'mint' | 'gray';
|
|
12
|
+
interface IBoardStickyColorSpec {
|
|
13
|
+
fill: string;
|
|
14
|
+
border: string;
|
|
15
|
+
text: string;
|
|
16
|
+
badgeFill: string;
|
|
17
|
+
}
|
|
18
|
+
declare const BOARD_STICKY_PALETTE: Record<BoardStickyColor, IBoardStickyColorSpec>;
|
|
19
|
+
declare function resolveStickyPalette(color?: string): IBoardStickyColorSpec;
|
|
20
|
+
type BoardShapeType = 'rect' | 'roundRect' | 'ellipse' | 'diamond' | 'parallelogram' | 'cylinder' | 'hexagon' | 'cloud' | 'document' | 'actor' | 'callout';
|
|
21
|
+
type BoardRouteType = 'straight' | 'orthogonal' | 'curved';
|
|
22
|
+
type BoardPortSide = 'top' | 'right' | 'bottom' | 'left' | 'center';
|
|
23
|
+
type BoardConnectorMarker = 'none' | 'arrow' | 'diamond' | 'filledDiamond' | 'triangle' | 'crowsFootOne' | 'crowsFootMany';
|
|
24
|
+
type BoardMindmapDirection = 'right' | 'left' | 'both';
|
|
25
|
+
type BoardEntityCardKind = 'erd' | 'uml' | 'kanbanCard';
|
|
26
|
+
type BoardChartType = 'bar' | 'line' | 'pie' | 'radar';
|
|
27
|
+
type BoardElementType = 'frame' | 'swimlane' | 'sticky' | 'shape' | 'text' | 'connector' | 'ink' | 'mindmap' | 'entityCard' | 'table' | 'chart' | 'image';
|
|
28
|
+
interface IBoardElementBase {
|
|
29
|
+
id: string;
|
|
30
|
+
type: BoardElementType;
|
|
31
|
+
x: number;
|
|
32
|
+
y: number;
|
|
33
|
+
width: number;
|
|
34
|
+
height: number;
|
|
35
|
+
rotation?: number;
|
|
36
|
+
locked?: boolean;
|
|
37
|
+
hidden?: boolean;
|
|
38
|
+
frameId?: string;
|
|
39
|
+
opacity?: number;
|
|
40
|
+
metadata?: Record<string, unknown>;
|
|
41
|
+
}
|
|
42
|
+
interface IBoardFrameElement extends IBoardElementBase {
|
|
43
|
+
type: 'frame';
|
|
44
|
+
title: string;
|
|
45
|
+
backgroundColor?: string;
|
|
46
|
+
borderColor?: string;
|
|
47
|
+
locked?: boolean;
|
|
48
|
+
}
|
|
49
|
+
interface IBoardSwimlaneItem {
|
|
50
|
+
id: string;
|
|
51
|
+
title: string;
|
|
52
|
+
size: number;
|
|
53
|
+
color?: string;
|
|
54
|
+
}
|
|
55
|
+
interface IBoardSwimlaneElement extends IBoardElementBase {
|
|
56
|
+
type: 'swimlane';
|
|
57
|
+
title: string;
|
|
58
|
+
orientation: 'horizontal' | 'vertical';
|
|
59
|
+
lanes: IBoardSwimlaneItem[];
|
|
60
|
+
backgroundColor?: string;
|
|
61
|
+
borderColor?: string;
|
|
62
|
+
headerSize?: number;
|
|
63
|
+
}
|
|
64
|
+
interface IBoardStickyElement extends IBoardElementBase {
|
|
65
|
+
type: 'sticky';
|
|
66
|
+
text: string;
|
|
67
|
+
color: BoardStickyColor | string;
|
|
68
|
+
author?: string;
|
|
69
|
+
votes: string[];
|
|
70
|
+
tags?: string[];
|
|
71
|
+
}
|
|
72
|
+
interface IBoardShapeElement extends IBoardElementBase {
|
|
73
|
+
type: 'shape';
|
|
74
|
+
shapeType: BoardShapeType;
|
|
75
|
+
text: string;
|
|
76
|
+
fill: string;
|
|
77
|
+
stroke: string;
|
|
78
|
+
strokeWidth: number;
|
|
79
|
+
textColor: string;
|
|
80
|
+
rotation?: number;
|
|
81
|
+
dashed?: boolean;
|
|
82
|
+
fontSize?: number;
|
|
83
|
+
}
|
|
84
|
+
interface IBoardTextElement extends IBoardElementBase {
|
|
85
|
+
type: 'text';
|
|
86
|
+
text: string;
|
|
87
|
+
fontSize: number;
|
|
88
|
+
fontWeight: 'normal' | 'bold' | number;
|
|
89
|
+
color: string;
|
|
90
|
+
align: 'left' | 'center' | 'right';
|
|
91
|
+
}
|
|
92
|
+
interface IBoardConnectorEndpoint {
|
|
93
|
+
elementId?: string;
|
|
94
|
+
port?: BoardPortSide;
|
|
95
|
+
x?: number;
|
|
96
|
+
y?: number;
|
|
97
|
+
}
|
|
98
|
+
interface IBoardConnectorElement extends IBoardElementBase {
|
|
99
|
+
type: 'connector';
|
|
100
|
+
routeType: BoardRouteType;
|
|
101
|
+
from?: IBoardConnectorEndpoint;
|
|
102
|
+
to?: IBoardConnectorEndpoint;
|
|
103
|
+
waypoints?: Array<{
|
|
104
|
+
x: number;
|
|
105
|
+
y: number;
|
|
106
|
+
}>;
|
|
107
|
+
label?: string;
|
|
108
|
+
stroke: string;
|
|
109
|
+
strokeWidth: number;
|
|
110
|
+
dashed?: boolean;
|
|
111
|
+
startMarker?: BoardConnectorMarker;
|
|
112
|
+
endMarker?: BoardConnectorMarker;
|
|
113
|
+
}
|
|
114
|
+
interface IBoardInkPoint {
|
|
115
|
+
x: number;
|
|
116
|
+
y: number;
|
|
117
|
+
pressure?: number;
|
|
118
|
+
}
|
|
119
|
+
interface IBoardInkElement extends IBoardElementBase {
|
|
120
|
+
type: 'ink';
|
|
121
|
+
points: IBoardInkPoint[];
|
|
122
|
+
stroke: string;
|
|
123
|
+
strokeWidth: number;
|
|
124
|
+
opacity: number;
|
|
125
|
+
}
|
|
126
|
+
interface IBoardMindmapElement extends IBoardElementBase {
|
|
127
|
+
type: 'mindmap';
|
|
128
|
+
text: string;
|
|
129
|
+
parentId?: string;
|
|
130
|
+
collapsed?: boolean;
|
|
131
|
+
branchColor?: string;
|
|
132
|
+
direction?: BoardMindmapDirection;
|
|
133
|
+
fill?: string;
|
|
134
|
+
textColor?: string;
|
|
135
|
+
}
|
|
136
|
+
interface IBoardEntityField {
|
|
137
|
+
name: string;
|
|
138
|
+
type: string;
|
|
139
|
+
pk?: boolean;
|
|
140
|
+
fk?: boolean;
|
|
141
|
+
visibility?: '+' | '-' | '#';
|
|
142
|
+
}
|
|
143
|
+
interface IBoardEntityCardElement extends IBoardElementBase {
|
|
144
|
+
type: 'entityCard';
|
|
145
|
+
cardKind: BoardEntityCardKind;
|
|
146
|
+
title: string;
|
|
147
|
+
stereotype?: string;
|
|
148
|
+
fields: IBoardEntityField[];
|
|
149
|
+
methods?: string[];
|
|
150
|
+
headerColor?: string;
|
|
151
|
+
assignee?: string;
|
|
152
|
+
statusTag?: string;
|
|
153
|
+
}
|
|
154
|
+
interface IBoardTableElement extends IBoardElementBase {
|
|
155
|
+
type: 'table';
|
|
156
|
+
title?: string;
|
|
157
|
+
headers: string[];
|
|
158
|
+
rows: string[][];
|
|
159
|
+
headerFill?: string;
|
|
160
|
+
borderColor?: string;
|
|
161
|
+
}
|
|
162
|
+
interface IBoardChartSeries {
|
|
163
|
+
name: string;
|
|
164
|
+
values: number[];
|
|
165
|
+
color?: string;
|
|
166
|
+
}
|
|
167
|
+
interface IBoardChartElement extends IBoardElementBase {
|
|
168
|
+
type: 'chart';
|
|
169
|
+
chartType: BoardChartType;
|
|
170
|
+
title: string;
|
|
171
|
+
categories: string[];
|
|
172
|
+
series: IBoardChartSeries[];
|
|
173
|
+
}
|
|
174
|
+
interface IBoardImageElement extends IBoardElementBase {
|
|
175
|
+
type: 'image';
|
|
176
|
+
src: string;
|
|
177
|
+
caption?: string;
|
|
178
|
+
fit?: 'contain' | 'cover';
|
|
179
|
+
}
|
|
180
|
+
type IBoardElement = IBoardFrameElement | IBoardSwimlaneElement | IBoardStickyElement | IBoardShapeElement | IBoardTextElement | IBoardConnectorElement | IBoardInkElement | IBoardMindmapElement | IBoardEntityCardElement | IBoardTableElement | IBoardChartElement | IBoardImageElement;
|
|
181
|
+
interface IBoardCommentReply {
|
|
182
|
+
id: string;
|
|
183
|
+
author: string;
|
|
184
|
+
text: string;
|
|
185
|
+
createdAt: number;
|
|
186
|
+
}
|
|
187
|
+
interface IBoardCommentPin {
|
|
188
|
+
id: string;
|
|
189
|
+
x: number;
|
|
190
|
+
y: number;
|
|
191
|
+
author: string;
|
|
192
|
+
text: string;
|
|
193
|
+
createdAt: number;
|
|
194
|
+
resolved?: boolean;
|
|
195
|
+
elementId?: string;
|
|
196
|
+
replies?: IBoardCommentReply[];
|
|
197
|
+
}
|
|
198
|
+
interface IBoardUnitData {
|
|
199
|
+
id: string;
|
|
200
|
+
name: string;
|
|
201
|
+
rev: number;
|
|
202
|
+
viewport: IBoardViewport;
|
|
203
|
+
gridStyle: BoardGridStyle;
|
|
204
|
+
backgroundColor: string;
|
|
205
|
+
snapToGrid?: boolean;
|
|
206
|
+
elementOrder: string[];
|
|
207
|
+
elements: Record<string, IBoardElement>;
|
|
208
|
+
frameOrder: string[];
|
|
209
|
+
comments: IBoardCommentPin[];
|
|
210
|
+
}
|
|
211
|
+
declare const MINDMAP_BRANCH_PALETTE: string[];
|
|
212
|
+
declare function createDefaultBoardElement(type: BoardElementType, partial?: Partial<IBoardElement> & Record<string, unknown>): IBoardElement;
|
|
213
|
+
|
|
214
|
+
interface IImportCsvStickiesOptions {
|
|
215
|
+
originX?: number;
|
|
216
|
+
originY?: number;
|
|
217
|
+
frameTitle?: string;
|
|
218
|
+
columns?: number;
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* RFC-4180 compliant CSV parser handling quoted multi-line fields and escaped `""`.
|
|
222
|
+
*/
|
|
223
|
+
declare function parseRfc4180Csv(csvText: string): string[][];
|
|
224
|
+
/**
|
|
225
|
+
* Exports sticky notes, inline tables, and ER/UML entity cards from the board to RFC-4180 `.csv`.
|
|
226
|
+
*/
|
|
227
|
+
declare function exportBoardToCsv(snapshot: IBoardUnitData): string;
|
|
228
|
+
/**
|
|
229
|
+
* Imports `.csv` rows as organized sticky notes arranged inside an enclosing presentation `Frame`.
|
|
230
|
+
*/
|
|
231
|
+
declare function importCsvToBoardStickies(csvText: string, options?: IImportCsvStickiesOptions): IBoardElement[];
|
|
232
|
+
|
|
233
|
+
interface IExportBoardPdfOptions {
|
|
234
|
+
/** `'full'` renders a single full-board bounds page; `'frames'` renders one PDF page per `Frame` in `frameOrder` */
|
|
235
|
+
mode?: 'full' | 'frames';
|
|
236
|
+
/** Alias for `mode: 'frames'` */
|
|
237
|
+
perFrame?: boolean;
|
|
238
|
+
/** Optional explicit single frame ID to export */
|
|
239
|
+
frameId?: string;
|
|
240
|
+
padding?: number;
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* Exports a board snapshot to vector PDF bytes (`Uint8Array`) via `pdf-lib`.
|
|
244
|
+
* Supports either a single full-board bounds page (`mode: 'full'`) OR one PDF page
|
|
245
|
+
* per `Frame` in `frameOrder` (`mode: 'frames'` / `perFrame: true`).
|
|
246
|
+
*/
|
|
247
|
+
declare function exportBoardToPdfBytes(snapshot: IBoardUnitData, options?: IExportBoardPdfOptions): Promise<Uint8Array>;
|
|
248
|
+
|
|
249
|
+
interface IExportBoardPptxOptions {
|
|
250
|
+
/** `'frames'` (default when frames exist) creates 1 slide per Frame; `'single'` fits entire board onto 1 slide */
|
|
251
|
+
mode?: 'frames' | 'single';
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
* Pure-TS OpenXML `.pptx` exporter turning each `Frame` (or the whole board) into
|
|
255
|
+
* native PowerPoint slides with editable `<p:sp>` shapes, sticky notes, text, and `<p:cxnSp>` connectors.
|
|
256
|
+
*/
|
|
257
|
+
declare function exportBoardToPptxBytes(snapshot: IBoardUnitData, options?: IExportBoardPptxOptions): Uint8Array;
|
|
258
|
+
|
|
259
|
+
/**
|
|
260
|
+
* Browser helper that renders `exportBoardToSvg` onto an HTML `<canvas>` and returns
|
|
261
|
+
* a `data:image/png;base64,...` or `data:image/jpeg;base64,...` Data URL.
|
|
262
|
+
* Gracefully returns a `data:image/svg+xml;base64,...` URL when invoked in headless Node without `<canvas>`.
|
|
263
|
+
*/
|
|
264
|
+
declare function exportBoardToRasterDataUrl(snapshot: IBoardUnitData, format?: 'png' | 'jpeg', scale?: number): Promise<string>;
|
|
265
|
+
|
|
266
|
+
interface IExportBoardSvgOptions {
|
|
267
|
+
frameId?: string;
|
|
268
|
+
padding?: number;
|
|
269
|
+
includeBackground?: boolean;
|
|
270
|
+
includeGrid?: boolean;
|
|
271
|
+
includeComments?: boolean;
|
|
272
|
+
}
|
|
273
|
+
interface IBoardBounds {
|
|
274
|
+
x: number;
|
|
275
|
+
y: number;
|
|
276
|
+
width: number;
|
|
277
|
+
height: number;
|
|
278
|
+
}
|
|
279
|
+
declare function escapeXml(raw: string): string;
|
|
280
|
+
declare function computeBoardBounds(snapshot: IBoardUnitData, frameId?: string, padding?: number): IBoardBounds;
|
|
281
|
+
declare function buildShapeSvgPath(shapeType: BoardShapeType, x: number, y: number, w: number, h: number): string;
|
|
282
|
+
/**
|
|
283
|
+
* Exports the entire board or a specific `frameId` to a standalone, crisp vector `.svg` document.
|
|
284
|
+
*/
|
|
285
|
+
declare function exportBoardToSvg(snapshot: IBoardUnitData, options?: IExportBoardSvgOptions): string;
|
|
286
|
+
|
|
287
|
+
type MermaidDiagramKind = 'flowchart' | 'sequenceDiagram' | 'classDiagram' | 'erDiagram' | 'mindmap';
|
|
288
|
+
type FlowchartDirection = 'TD' | 'TB' | 'LR' | 'RL' | 'BT';
|
|
289
|
+
interface IParseMermaidOptions {
|
|
290
|
+
originX?: number;
|
|
291
|
+
originY?: number;
|
|
292
|
+
direction?: FlowchartDirection;
|
|
293
|
+
idPrefix?: string;
|
|
294
|
+
}
|
|
295
|
+
interface IExportBoardMermaidOptions {
|
|
296
|
+
diagramType?: 'auto' | MermaidDiagramKind;
|
|
297
|
+
direction?: FlowchartDirection;
|
|
298
|
+
frameId?: string;
|
|
299
|
+
}
|
|
300
|
+
interface IMermaidPresetTemplate {
|
|
301
|
+
key: string;
|
|
302
|
+
title: string;
|
|
303
|
+
diagramType: MermaidDiagramKind;
|
|
304
|
+
code: string;
|
|
305
|
+
}
|
|
306
|
+
declare const MERMAID_PRESET_TEMPLATES: IMermaidPresetTemplate[];
|
|
307
|
+
declare function detectMermaidDiagramType(mermaidCode: string): MermaidDiagramKind;
|
|
308
|
+
/**
|
|
309
|
+
* Clean-room pure-TS Mermaid parser converting `flowchart`, `sequenceDiagram`,
|
|
310
|
+
* `classDiagram`, `erDiagram`, and `mindmap` code into real, individually editable
|
|
311
|
+
* `IBoardElement[]` (frames, shapes, entityCards, stickies, mindmap nodes, and smart connectors).
|
|
312
|
+
*/
|
|
313
|
+
declare function parseMermaidToBoardElements(mermaidCode: string, options?: IParseMermaidOptions): IBoardElement[];
|
|
314
|
+
/**
|
|
315
|
+
* Reverse compiler inspecting board elements & connectors (or mindmap tree / ER / UML cards)
|
|
316
|
+
* and emitting clean, valid Mermaid `flowchart TD`, `erDiagram`, `classDiagram`, `sequenceDiagram`, or `mindmap` code.
|
|
317
|
+
*/
|
|
318
|
+
declare function exportBoardToMermaid(snapshot: IBoardUnitData, options?: IExportBoardMermaidOptions): string;
|
|
319
|
+
|
|
320
|
+
type BoardExportFormat = 'svg' | 'pdf' | 'pptx' | 'csv' | 'png' | 'jpeg' | 'mermaid';
|
|
321
|
+
interface IBoardExportEvent {
|
|
322
|
+
unitId: string;
|
|
323
|
+
format: BoardExportFormat;
|
|
324
|
+
byteLength: number;
|
|
325
|
+
}
|
|
326
|
+
interface IBoardIoAdapter {
|
|
327
|
+
name?: string;
|
|
328
|
+
onSave?: (snapshot: IBoardUnitData) => Promise<void> | void;
|
|
329
|
+
}
|
|
330
|
+
interface IBoardIoService {
|
|
331
|
+
readonly exported$: Observable<IBoardExportEvent>;
|
|
332
|
+
setAdapter(adapter: IBoardIoAdapter): void;
|
|
333
|
+
getAdapter(): IBoardIoAdapter;
|
|
334
|
+
exportSvg(snapshot: IBoardUnitData, options?: IExportBoardSvgOptions): string;
|
|
335
|
+
exportPdf(snapshot: IBoardUnitData, options?: IExportBoardPdfOptions): Promise<Uint8Array>;
|
|
336
|
+
exportPptx(snapshot: IBoardUnitData, options?: IExportBoardPptxOptions): Uint8Array;
|
|
337
|
+
exportCsv(snapshot: IBoardUnitData): string;
|
|
338
|
+
exportRasterDataUrl(snapshot: IBoardUnitData, format?: 'png' | 'jpeg', scale?: number): Promise<string>;
|
|
339
|
+
exportMermaid(snapshot: IBoardUnitData, options?: IExportBoardMermaidOptions): string;
|
|
340
|
+
parseMermaid(mermaidCode: string, options?: IParseMermaidOptions): IBoardElement[];
|
|
341
|
+
importCsvStickies(csvText: string, options?: IImportCsvStickiesOptions): IBoardElement[];
|
|
342
|
+
}
|
|
343
|
+
declare const IBoardIoService: _univerjs_core.IdentifierDecorator<IBoardIoService>;
|
|
344
|
+
declare class BoardIoService extends Disposable implements IBoardIoService {
|
|
345
|
+
private _adapter;
|
|
346
|
+
private readonly _exported$;
|
|
347
|
+
readonly exported$: Observable<IBoardExportEvent>;
|
|
348
|
+
dispose(): void;
|
|
349
|
+
setAdapter(adapter: IBoardIoAdapter): void;
|
|
350
|
+
getAdapter(): IBoardIoAdapter;
|
|
351
|
+
exportSvg(snapshot: IBoardUnitData, options?: IExportBoardSvgOptions): string;
|
|
352
|
+
exportPdf(snapshot: IBoardUnitData, options?: IExportBoardPdfOptions): Promise<Uint8Array>;
|
|
353
|
+
exportPptx(snapshot: IBoardUnitData, options?: IExportBoardPptxOptions): Uint8Array;
|
|
354
|
+
exportCsv(snapshot: IBoardUnitData): string;
|
|
355
|
+
exportRasterDataUrl(snapshot: IBoardUnitData, format?: 'png' | 'jpeg', scale?: number): Promise<string>;
|
|
356
|
+
exportMermaid(snapshot: IBoardUnitData, options?: IExportBoardMermaidOptions): string;
|
|
357
|
+
parseMermaid(mermaidCode: string, options?: IParseMermaidOptions): IBoardElement[];
|
|
358
|
+
importCsvStickies(csvText: string, options?: IImportCsvStickiesOptions): IBoardElement[];
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
interface IUniverBoardsConfig {
|
|
362
|
+
io?: IBoardIoAdapter;
|
|
363
|
+
}
|
|
364
|
+
declare const UNIVER_BOARDS_PLUGIN_NAME = "UNIVER_BOARDS_PLUGIN";
|
|
365
|
+
declare class UniverBoardsPlugin extends Plugin {
|
|
366
|
+
private readonly _config;
|
|
367
|
+
protected readonly _injector: Injector;
|
|
368
|
+
private readonly _univerInstanceService;
|
|
369
|
+
private readonly _commandService;
|
|
370
|
+
static pluginName: string;
|
|
371
|
+
static packageName: string;
|
|
372
|
+
constructor(_config: Partial<IUniverBoardsConfig> | undefined, _injector: Injector, _univerInstanceService: IUniverInstanceService, _commandService: ICommandService);
|
|
373
|
+
onStarting(): void;
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
interface IBoardUnitPropsPatch {
|
|
377
|
+
name?: string;
|
|
378
|
+
viewport?: Partial<IBoardViewport>;
|
|
379
|
+
gridStyle?: BoardGridStyle;
|
|
380
|
+
backgroundColor?: string;
|
|
381
|
+
snapToGrid?: boolean;
|
|
382
|
+
frameOrder?: string[];
|
|
383
|
+
elementOrder?: string[];
|
|
384
|
+
}
|
|
385
|
+
declare class BoardUnitModel extends UnitModel<IBoardUnitData, UniverInstanceType.UNIVER_BOARD> {
|
|
386
|
+
readonly type = UniverInstanceType.UNIVER_BOARD;
|
|
387
|
+
private _snapshot;
|
|
388
|
+
private readonly _name$;
|
|
389
|
+
readonly name$: Observable<string>;
|
|
390
|
+
private readonly _snapshotChanged$;
|
|
391
|
+
readonly snapshotChanged$: Observable<IBoardUnitData>;
|
|
392
|
+
constructor(snapshot?: Partial<IBoardUnitData>);
|
|
393
|
+
dispose(): void;
|
|
394
|
+
getUnitId(): string;
|
|
395
|
+
setName(name: string): void;
|
|
396
|
+
getName(): string;
|
|
397
|
+
getSnapshot(): IBoardUnitData;
|
|
398
|
+
save(): IBoardUnitData;
|
|
399
|
+
getRev(): number;
|
|
400
|
+
incrementRev(): void;
|
|
401
|
+
setRev(rev: number): void;
|
|
402
|
+
getViewport(): IBoardViewport;
|
|
403
|
+
getElement(elementId: string): IBoardElement | undefined;
|
|
404
|
+
getElementsMap(): Record<string, IBoardElement>;
|
|
405
|
+
getElementOrder(): string[];
|
|
406
|
+
getElementsOrdered(): IBoardElement[];
|
|
407
|
+
getFramesOrdered(): IBoardFrameElement[];
|
|
408
|
+
getElementsInFrame(frameId: string): IBoardElement[];
|
|
409
|
+
getComments(): IBoardCommentPin[];
|
|
410
|
+
/** Internal synchronous mutators called exclusively by registered IMutation handlers */
|
|
411
|
+
__applySnapshot(nextSnapshot: IBoardUnitData): void;
|
|
412
|
+
__addElements(elements: IBoardElement[], insertAtBack?: boolean): void;
|
|
413
|
+
__updateElements(updates: Array<{
|
|
414
|
+
id: string;
|
|
415
|
+
element: IBoardElement;
|
|
416
|
+
}>): void;
|
|
417
|
+
__removeElements(elementIds: string[]): void;
|
|
418
|
+
__setViewport(viewport: Partial<IBoardViewport>): void;
|
|
419
|
+
__updateBoardProps(patch: IBoardUnitPropsPatch): void;
|
|
420
|
+
__setComments(comments: IBoardCommentPin[]): void;
|
|
421
|
+
private _notifyChange;
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
declare function createDefaultBoardUnitData(partial?: Partial<IBoardUnitData>): IBoardUnitData;
|
|
425
|
+
/**
|
|
426
|
+
* Rich showcase board preset featuring:
|
|
427
|
+
* 1. System Architecture Flowchart Frame
|
|
428
|
+
* 2. ER Database Model Frame (with Crow's Foot connectors)
|
|
429
|
+
* 3. Product Mindmap Frame (auto-laid out via `layoutBoardMindmap`)
|
|
430
|
+
* 4. Sprint Retrospective Swimlane & Sticky Voting Frame
|
|
431
|
+
*/
|
|
432
|
+
declare function createSampleArchitectureBoardData(partial?: Partial<IBoardUnitData>): IBoardUnitData;
|
|
433
|
+
|
|
434
|
+
interface IBoardPoint {
|
|
435
|
+
x: number;
|
|
436
|
+
y: number;
|
|
437
|
+
}
|
|
438
|
+
interface IBoardRect {
|
|
439
|
+
x: number;
|
|
440
|
+
y: number;
|
|
441
|
+
width: number;
|
|
442
|
+
height: number;
|
|
443
|
+
}
|
|
444
|
+
interface IBoardConnectorComputedPath {
|
|
445
|
+
points: IBoardPoint[];
|
|
446
|
+
svgPath: string;
|
|
447
|
+
labelPosition: IBoardPoint;
|
|
448
|
+
startPort: BoardPortSide;
|
|
449
|
+
endPort: BoardPortSide;
|
|
450
|
+
startAngleRad: number;
|
|
451
|
+
endAngleRad: number;
|
|
452
|
+
bounds: IBoardRect;
|
|
453
|
+
}
|
|
454
|
+
declare function getElementPortPoint(element: IBoardElement, port: BoardPortSide): IBoardPoint;
|
|
455
|
+
declare function resolveAutoPortPair(fromEl: IBoardElement | undefined, toEl: IBoardElement | undefined, fallbackFrom: IBoardPoint, fallbackTo: IBoardPoint, explicitFromPort?: BoardPortSide, explicitToPort?: BoardPortSide): {
|
|
456
|
+
fromPort: BoardPortSide;
|
|
457
|
+
toPort: BoardPortSide;
|
|
458
|
+
};
|
|
459
|
+
/**
|
|
460
|
+
* Pure-TS Board Smart Connector Router supporting `'straight'`, `'orthogonal'` (Manhattan),
|
|
461
|
+
* and `'curved'` (smooth cubic Bezier) routes between element ports or free coordinates.
|
|
462
|
+
*/
|
|
463
|
+
declare function computeBoardConnectorPath(connector: IBoardConnectorElement, elements: Record<string, IBoardElement> | IBoardElement[]): IBoardConnectorComputedPath;
|
|
464
|
+
|
|
465
|
+
interface IMindmapLayoutOptions {
|
|
466
|
+
horizontalGap?: number;
|
|
467
|
+
verticalGap?: number;
|
|
468
|
+
}
|
|
469
|
+
declare function getMindmapDescendantIds(elements: Record<string, IBoardElement> | IBoardElement[], nodeId: string): string[];
|
|
470
|
+
declare function isMindmapNodeCollapsedHidden(node: IBoardMindmapElement, map: Record<string, IBoardElement>): boolean;
|
|
471
|
+
declare function layoutBoardMindmap(elements: IBoardElement[], rootId?: string, options?: IMindmapLayoutOptions): IBoardElement[];
|
|
472
|
+
declare function layoutBoardMindmap(elements: Record<string, IBoardElement>, rootId?: string, options?: IMindmapLayoutOptions): Record<string, IBoardElement>;
|
|
473
|
+
|
|
474
|
+
type BoardActiveTool = 'select' | 'hand' | 'frame' | 'swimlane' | 'sticky' | 'shape' | 'text' | 'connector' | 'ink' | 'mindmap' | 'entityCard' | 'table' | 'chart' | 'comment' | 'laser';
|
|
475
|
+
interface IBoardPresentationState {
|
|
476
|
+
active: boolean;
|
|
477
|
+
frameIndex: number;
|
|
478
|
+
laserActive: boolean;
|
|
479
|
+
}
|
|
480
|
+
interface IBoardWorkshopTimerState {
|
|
481
|
+
durationSec: number;
|
|
482
|
+
remainingSec: number;
|
|
483
|
+
running: boolean;
|
|
484
|
+
}
|
|
485
|
+
interface IBoardSelectionService {
|
|
486
|
+
readonly selectedIds$: Observable<string[]>;
|
|
487
|
+
readonly editingElementId$: Observable<string | null>;
|
|
488
|
+
readonly activeTool$: Observable<BoardActiveTool>;
|
|
489
|
+
readonly activeShapeType$: Observable<BoardShapeType>;
|
|
490
|
+
readonly activeStickyColor$: Observable<BoardStickyColor>;
|
|
491
|
+
readonly mermaidModalOpen$: Observable<boolean>;
|
|
492
|
+
readonly presentation$: Observable<IBoardPresentationState>;
|
|
493
|
+
readonly timer$: Observable<IBoardWorkshopTimerState>;
|
|
494
|
+
getSelectedIds(): string[];
|
|
495
|
+
selectElements(ids: string[]): void;
|
|
496
|
+
toggleSelectElement(id: string): void;
|
|
497
|
+
clearSelection(): void;
|
|
498
|
+
getEditingElementId(): string | null;
|
|
499
|
+
setEditingElement(id: string | null): void;
|
|
500
|
+
getActiveTool(): BoardActiveTool;
|
|
501
|
+
setActiveTool(tool: BoardActiveTool): void;
|
|
502
|
+
getActiveShapeType(): BoardShapeType;
|
|
503
|
+
setActiveShapeType(shapeType: BoardShapeType): void;
|
|
504
|
+
getActiveStickyColor(): BoardStickyColor;
|
|
505
|
+
setActiveStickyColor(color: BoardStickyColor): void;
|
|
506
|
+
isMermaidModalOpen(): boolean;
|
|
507
|
+
setMermaidModalOpen(open: boolean): void;
|
|
508
|
+
getPresentationState(): IBoardPresentationState;
|
|
509
|
+
setPresentationState(patch: Partial<IBoardPresentationState>): void;
|
|
510
|
+
getTimerState(): IBoardWorkshopTimerState;
|
|
511
|
+
setTimerState(patch: Partial<IBoardWorkshopTimerState>): void;
|
|
512
|
+
}
|
|
513
|
+
declare const IBoardSelectionService: _univerjs_core.IdentifierDecorator<IBoardSelectionService>;
|
|
514
|
+
declare class BoardSelectionService extends Disposable implements IBoardSelectionService {
|
|
515
|
+
private readonly _selectedIds$;
|
|
516
|
+
readonly selectedIds$: Observable<string[]>;
|
|
517
|
+
private readonly _editingElementId$;
|
|
518
|
+
readonly editingElementId$: Observable<string | null>;
|
|
519
|
+
private readonly _activeTool$;
|
|
520
|
+
readonly activeTool$: Observable<BoardActiveTool>;
|
|
521
|
+
private readonly _activeShapeType$;
|
|
522
|
+
readonly activeShapeType$: Observable<BoardShapeType>;
|
|
523
|
+
private readonly _activeStickyColor$;
|
|
524
|
+
readonly activeStickyColor$: Observable<BoardStickyColor>;
|
|
525
|
+
private readonly _mermaidModalOpen$;
|
|
526
|
+
readonly mermaidModalOpen$: Observable<boolean>;
|
|
527
|
+
private readonly _presentation$;
|
|
528
|
+
readonly presentation$: Observable<IBoardPresentationState>;
|
|
529
|
+
private readonly _timer$;
|
|
530
|
+
readonly timer$: Observable<IBoardWorkshopTimerState>;
|
|
531
|
+
dispose(): void;
|
|
532
|
+
getSelectedIds(): string[];
|
|
533
|
+
selectElements(ids: string[]): void;
|
|
534
|
+
toggleSelectElement(id: string): void;
|
|
535
|
+
clearSelection(): void;
|
|
536
|
+
getEditingElementId(): string | null;
|
|
537
|
+
setEditingElement(id: string | null): void;
|
|
538
|
+
getActiveTool(): BoardActiveTool;
|
|
539
|
+
setActiveTool(tool: BoardActiveTool): void;
|
|
540
|
+
getActiveShapeType(): BoardShapeType;
|
|
541
|
+
setActiveShapeType(shapeType: BoardShapeType): void;
|
|
542
|
+
getActiveStickyColor(): BoardStickyColor;
|
|
543
|
+
setActiveStickyColor(color: BoardStickyColor): void;
|
|
544
|
+
isMermaidModalOpen(): boolean;
|
|
545
|
+
setMermaidModalOpen(open: boolean): void;
|
|
546
|
+
getPresentationState(): IBoardPresentationState;
|
|
547
|
+
setPresentationState(patch: Partial<IBoardPresentationState>): void;
|
|
548
|
+
getTimerState(): IBoardWorkshopTimerState;
|
|
549
|
+
setTimerState(patch: Partial<IBoardWorkshopTimerState>): void;
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
interface IAddBoardElementsCommandParams {
|
|
553
|
+
unitId?: string;
|
|
554
|
+
elements?: Array<Partial<IBoardElement> & {
|
|
555
|
+
type: BoardElementType;
|
|
556
|
+
}>;
|
|
557
|
+
element?: Partial<IBoardElement> & {
|
|
558
|
+
type: BoardElementType;
|
|
559
|
+
};
|
|
560
|
+
selectAdded?: boolean;
|
|
561
|
+
}
|
|
562
|
+
declare const AddBoardElementsCommand: ICommand<IAddBoardElementsCommandParams>;
|
|
563
|
+
interface IUpdateBoardElementsCommandParams {
|
|
564
|
+
unitId?: string;
|
|
565
|
+
updates: Array<{
|
|
566
|
+
id: string;
|
|
567
|
+
patch?: Partial<IBoardElement> & Record<string, unknown>;
|
|
568
|
+
element?: IBoardElement;
|
|
569
|
+
}>;
|
|
570
|
+
}
|
|
571
|
+
declare const UpdateBoardElementsCommand: ICommand<IUpdateBoardElementsCommandParams>;
|
|
572
|
+
interface IDeleteBoardElementsCommandParams {
|
|
573
|
+
unitId?: string;
|
|
574
|
+
elementIds?: string[];
|
|
575
|
+
}
|
|
576
|
+
declare const DeleteBoardElementsCommand: ICommand<IDeleteBoardElementsCommandParams>;
|
|
577
|
+
type BoardAlignmentMode = 'left' | 'center' | 'right' | 'top' | 'middle' | 'bottom' | 'distribute-h' | 'distribute-v';
|
|
578
|
+
interface IAlignBoardElementsCommandParams {
|
|
579
|
+
unitId?: string;
|
|
580
|
+
elementIds?: string[];
|
|
581
|
+
alignment?: BoardAlignmentMode;
|
|
582
|
+
mode?: BoardAlignmentMode;
|
|
583
|
+
}
|
|
584
|
+
declare const AlignBoardElementsCommand: ICommand<IAlignBoardElementsCommandParams>;
|
|
585
|
+
interface IGroupBoardElementsInFrameCommandParams {
|
|
586
|
+
unitId?: string;
|
|
587
|
+
elementIds?: string[];
|
|
588
|
+
title?: string;
|
|
589
|
+
padding?: number;
|
|
590
|
+
frameId?: string;
|
|
591
|
+
}
|
|
592
|
+
declare const GroupBoardElementsInFrameCommand: ICommand<IGroupBoardElementsInFrameCommandParams>;
|
|
593
|
+
interface IAddMindmapChildCommandParams {
|
|
594
|
+
unitId?: string;
|
|
595
|
+
parentId?: string;
|
|
596
|
+
text?: string;
|
|
597
|
+
id?: string;
|
|
598
|
+
}
|
|
599
|
+
declare const AddMindmapChildCommand: ICommand<IAddMindmapChildCommandParams>;
|
|
600
|
+
interface IAddMindmapSiblingCommandParams {
|
|
601
|
+
unitId?: string;
|
|
602
|
+
nodeId?: string;
|
|
603
|
+
text?: string;
|
|
604
|
+
id?: string;
|
|
605
|
+
}
|
|
606
|
+
declare const AddMindmapSiblingCommand: ICommand<IAddMindmapSiblingCommandParams>;
|
|
607
|
+
interface ILayoutBoardMindmapCommandParams {
|
|
608
|
+
unitId?: string;
|
|
609
|
+
rootId?: string;
|
|
610
|
+
horizontalGap?: number;
|
|
611
|
+
verticalGap?: number;
|
|
612
|
+
}
|
|
613
|
+
declare const LayoutBoardMindmapCommand: ICommand<ILayoutBoardMindmapCommandParams>;
|
|
614
|
+
interface IVoteBoardStickyCommandParams {
|
|
615
|
+
unitId?: string;
|
|
616
|
+
elementId: string;
|
|
617
|
+
voterId?: string;
|
|
618
|
+
/** When `true` (default `false` increments or toggles per voterId), toggles voter presence */
|
|
619
|
+
toggle?: boolean;
|
|
620
|
+
}
|
|
621
|
+
declare const VoteBoardStickyCommand: ICommand<IVoteBoardStickyCommandParams>;
|
|
622
|
+
interface IImportMermaidToBoardCommandParams {
|
|
623
|
+
unitId?: string;
|
|
624
|
+
mermaidCode: string;
|
|
625
|
+
originX?: number;
|
|
626
|
+
originY?: number;
|
|
627
|
+
direction?: FlowchartDirection;
|
|
628
|
+
replaceExisting?: boolean;
|
|
629
|
+
}
|
|
630
|
+
declare const ImportMermaidToBoardCommand: ICommand<IImportMermaidToBoardCommandParams>;
|
|
631
|
+
interface ISetBoardViewportCommandParams {
|
|
632
|
+
unitId?: string;
|
|
633
|
+
panX?: number;
|
|
634
|
+
panY?: number;
|
|
635
|
+
zoom?: number;
|
|
636
|
+
viewport?: Partial<IBoardViewport>;
|
|
637
|
+
}
|
|
638
|
+
declare const SetBoardViewportCommand: ICommand<ISetBoardViewportCommandParams>;
|
|
639
|
+
interface IAddBoardCommentCommandParams {
|
|
640
|
+
unitId?: string;
|
|
641
|
+
id?: string;
|
|
642
|
+
x: number;
|
|
643
|
+
y: number;
|
|
644
|
+
text: string;
|
|
645
|
+
author?: string;
|
|
646
|
+
elementId?: string;
|
|
647
|
+
}
|
|
648
|
+
declare const AddBoardCommentCommand: ICommand<IAddBoardCommentCommandParams>;
|
|
649
|
+
interface IReplaceBoardSnapshotCommandParams {
|
|
650
|
+
unitId?: string;
|
|
651
|
+
snapshot: IBoardUnitData;
|
|
652
|
+
}
|
|
653
|
+
declare const ReplaceBoardSnapshotCommand: ICommand<IReplaceBoardSnapshotCommandParams>;
|
|
654
|
+
interface IUpdateBoardPropsCommandParams {
|
|
655
|
+
unitId?: string;
|
|
656
|
+
patch: IBoardUnitPropsPatch;
|
|
657
|
+
}
|
|
658
|
+
declare const UpdateBoardPropsCommand: ICommand<IUpdateBoardPropsCommandParams>;
|
|
659
|
+
|
|
660
|
+
interface IApplyBoardSnapshotMutationParams {
|
|
661
|
+
unitId: string;
|
|
662
|
+
snapshot: IBoardUnitData;
|
|
663
|
+
}
|
|
664
|
+
declare const ApplyBoardSnapshotMutation: IMutation<IApplyBoardSnapshotMutationParams>;
|
|
665
|
+
interface ISetBoardViewportMutationParams {
|
|
666
|
+
unitId: string;
|
|
667
|
+
viewport: Partial<IBoardViewport>;
|
|
668
|
+
}
|
|
669
|
+
declare const SetBoardViewportMutation: IMutation<ISetBoardViewportMutationParams>;
|
|
670
|
+
|
|
671
|
+
declare const VERSION = "1.6.218";
|
|
672
|
+
|
|
673
|
+
export { AddBoardCommentCommand, AddBoardElementsCommand, AddMindmapChildCommand, AddMindmapSiblingCommand, AlignBoardElementsCommand, ApplyBoardSnapshotMutation, BOARD_STICKY_PALETTE, type BoardActiveTool, type BoardAlignmentMode, type BoardChartType, type BoardConnectorMarker, type BoardElementType, type BoardEntityCardKind, type BoardExportFormat, type BoardGridStyle, BoardIoService, type BoardMindmapDirection, type BoardPortSide, type BoardRouteType, BoardSelectionService, type BoardShapeType, type BoardStickyColor, BoardUnitModel, DeleteBoardElementsCommand, type FlowchartDirection, GroupBoardElementsInFrameCommand, type IAddBoardCommentCommandParams, type IAddBoardElementsCommandParams, type IAddMindmapChildCommandParams, type IAddMindmapSiblingCommandParams, type IAlignBoardElementsCommandParams, type IApplyBoardSnapshotMutationParams, type IBoardBounds, type IBoardChartElement, type IBoardChartSeries, type IBoardCommentPin, type IBoardCommentReply, type IBoardConnectorComputedPath, type IBoardConnectorElement, type IBoardConnectorEndpoint, type IBoardElement, type IBoardElementBase, type IBoardEntityCardElement, type IBoardEntityField, type IBoardExportEvent, type IBoardFrameElement, type IBoardImageElement, type IBoardInkElement, type IBoardInkPoint, type IBoardIoAdapter, IBoardIoService, type IBoardMindmapElement, type IBoardPoint, type IBoardPresentationState, type IBoardRect, IBoardSelectionService, type IBoardShapeElement, type IBoardStickyColorSpec, type IBoardStickyElement, type IBoardSwimlaneElement, type IBoardSwimlaneItem, type IBoardTableElement, type IBoardTextElement, type IBoardUnitData, type IBoardUnitPropsPatch, type IBoardViewport, type IBoardWorkshopTimerState, type IDeleteBoardElementsCommandParams, type IExportBoardMermaidOptions, type IExportBoardPdfOptions, type IExportBoardPptxOptions, type IExportBoardSvgOptions, type IGroupBoardElementsInFrameCommandParams, type IImportCsvStickiesOptions, type IImportMermaidToBoardCommandParams, type ILayoutBoardMindmapCommandParams, type IMermaidPresetTemplate, type IMindmapLayoutOptions, type IParseMermaidOptions, type IReplaceBoardSnapshotCommandParams, type ISetBoardViewportCommandParams, type ISetBoardViewportMutationParams, type IUniverBoardsConfig, type IUpdateBoardElementsCommandParams, type IUpdateBoardPropsCommandParams, type IVoteBoardStickyCommandParams, ImportMermaidToBoardCommand, LayoutBoardMindmapCommand, MERMAID_PRESET_TEMPLATES, MINDMAP_BRANCH_PALETTE, type MermaidDiagramKind, ReplaceBoardSnapshotCommand, SetBoardViewportCommand, SetBoardViewportMutation, UNIVER_BOARDS_PLUGIN_NAME, UniverBoardsPlugin, UpdateBoardElementsCommand, UpdateBoardPropsCommand, VERSION, VoteBoardStickyCommand, buildShapeSvgPath, computeBoardBounds, computeBoardConnectorPath, createDefaultBoardElement, createDefaultBoardUnitData, createSampleArchitectureBoardData, detectMermaidDiagramType, escapeXml, exportBoardToCsv, exportBoardToMermaid, exportBoardToPdfBytes, exportBoardToPptxBytes, exportBoardToRasterDataUrl, exportBoardToSvg, getElementPortPoint, getMindmapDescendantIds, importCsvToBoardStickies, isMindmapNodeCollapsedHidden, layoutBoardMindmap, parseMermaidToBoardElements, parseRfc4180Csv, resolveAutoPortPair, resolveStickyPalette };
|