@yudaocode/univer-boards-ui 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.
@@ -0,0 +1,3772 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var __decorateClass = (decorators, target, key, kind) => {
20
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
21
+ for (var i = decorators.length - 1, decorator; i >= 0; i--)
22
+ if (decorator = decorators[i])
23
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
24
+ if (kind && result) __defProp(target, key, result);
25
+ return result;
26
+ };
27
+ var __decorateParam = (index, decorator) => (target, key) => decorator(target, key, index);
28
+
29
+ // src/index.ts
30
+ var src_exports = {};
31
+ __export(src_exports, {
32
+ BOARDS_RIBBON_GROUP: () => BOARDS_RIBBON_GROUP,
33
+ BOARDS_RIBBON_TAB: () => BOARDS_RIBBON_TAB,
34
+ BOARD_ICON_MAP: () => BOARD_ICON_MAP,
35
+ BOARD_INSPECTOR_COMPONENT_KEY: () => BOARD_INSPECTOR_COMPONENT_KEY,
36
+ BOARD_INSPECTOR_SIDEBAR_ID: () => BOARD_INSPECTOR_SIDEBAR_ID,
37
+ BoardsInfiniteCanvas: () => BoardsInfiniteCanvas,
38
+ BoardsInspectorPanel: () => BoardsInspectorPanel,
39
+ BoardsLeftSidebar: () => BoardsLeftSidebar,
40
+ BoardsMermaidModal: () => BoardsMermaidModal,
41
+ BoardsModalsHost: () => BoardsModalsHost,
42
+ BoardsStatusBar: () => BoardsStatusBar,
43
+ BoardsUIController: () => BoardsUIController,
44
+ ExportBoardFileOperation: () => ExportBoardFileOperation,
45
+ FitBoardToScreenOperation: () => FitBoardToScreenOperation,
46
+ OpenBoardMermaidModalOperation: () => OpenBoardMermaidModalOperation,
47
+ SetBoardToolOperation: () => SetBoardToolOperation,
48
+ StartBoardPresentationOperation: () => StartBoardPresentationOperation,
49
+ ToggleBoardInspectorOperation: () => ToggleBoardInspectorOperation,
50
+ UNIVER_BOARDS_UI_PLUGIN_NAME: () => UNIVER_BOARDS_UI_PLUGIN_NAME,
51
+ UniverBoardsUIPlugin: () => UniverBoardsUIPlugin,
52
+ VERSION: () => VERSION,
53
+ boardsMenuSchema: () => boardsMenuSchema,
54
+ boardsRootMenuExtension: () => boardsRootMenuExtension,
55
+ enUS: () => en_US_default,
56
+ openBoardInspectorSidebar: () => openBoardInspectorSidebar,
57
+ zhCN: () => zh_CN_default
58
+ });
59
+ module.exports = __toCommonJS(src_exports);
60
+
61
+ // src/controllers/boards-ui.controller.ts
62
+ var import_core7 = require("@univerjs/core");
63
+ var import_ui8 = require("@univerjs/ui");
64
+
65
+ // src/icons/board-icons.tsx
66
+ var import_jsx_runtime = require("react/jsx-runtime");
67
+ function createSvgIcon(children) {
68
+ return ({ className, style, onClick }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
69
+ "svg",
70
+ {
71
+ viewBox: "0 0 16 16",
72
+ width: "16",
73
+ height: "16",
74
+ fill: "none",
75
+ stroke: "currentColor",
76
+ strokeWidth: "1.4",
77
+ strokeLinecap: "round",
78
+ strokeLinejoin: "round",
79
+ className,
80
+ style: { display: "inline-block", verticalAlign: "middle", flexShrink: 0, ...style },
81
+ onClick,
82
+ children
83
+ }
84
+ );
85
+ }
86
+ var BoardSelectIcon = createSvgIcon(
87
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M3.8 2.2L12.6 8.4L8.2 9.2L9.8 13.4L7.8 14.2L6.2 10L3.8 12.2V2.2Z" })
88
+ );
89
+ var BoardHandIcon = createSvgIcon(
90
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M6.2 7.5V3.5C6.2 2.9 6.6 2.5 7.1 2.5C7.6 2.5 8 2.9 8 3.5V7M8 3.2C8 2.7 8.4 2.2 8.9 2.2C9.4 2.2 9.8 2.7 9.8 3.2V7M9.8 3.8C9.8 3.3 10.2 2.9 10.7 2.9C11.2 2.9 11.6 3.3 11.6 3.8V8.2M11.6 5.2C12.1 5.2 12.5 5.6 12.5 6.1V10C12.5 12.2 10.8 13.8 8.6 13.8H7.4C5.6 13.8 4.4 12.7 3.7 11.2L2.8 9.2C2.5 8.6 2.8 8 3.4 7.8C4 7.6 4.6 7.9 5 8.5L5.8 9.6V4.5" })
91
+ );
92
+ var BoardFrameIcon = createSvgIcon(
93
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M2 5H14M2 11H14M5 2V14M11 2V14" }) })
94
+ );
95
+ var BoardSwimlaneIcon = createSvgIcon(
96
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
97
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("rect", { x: "2", y: "2.5", width: "12", height: "11", rx: "1.4" }),
98
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M2 6H14M6 6V13.5M10 6V13.5" })
99
+ ] })
100
+ );
101
+ var BoardStickyIcon = createSvgIcon(
102
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
103
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M3 2.5H13V10.5L10 13.5H3V2.5Z" }),
104
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M10 13.5V10.5H13" }),
105
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M5.2 6H10.8M5.2 8.6H8.6" })
106
+ ] })
107
+ );
108
+ var BoardShapeIcon = createSvgIcon(
109
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
110
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("rect", { x: "2.2", y: "2.8", width: "7.5", height: "6.8", rx: "1.2" }),
111
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("circle", { cx: "10.8", cy: "10.4", r: "3" })
112
+ ] })
113
+ );
114
+ var BoardConnectorIcon = createSvgIcon(
115
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
116
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("circle", { cx: "3.5", cy: "4", r: "1.5" }),
117
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("circle", { cx: "12.5", cy: "12", r: "1.5" }),
118
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M5 4H8.5V12H11" })
119
+ ] })
120
+ );
121
+ var BoardInkIcon = createSvgIcon(
122
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
123
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M11.2 2.4L13.6 4.8L6.2 12.2L2.8 13.2L3.8 9.8L11.2 2.4Z" }),
124
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M2.5 14.3C5.2 13.6 7.8 14.7 11.2 13.7" })
125
+ ] })
126
+ );
127
+ var BoardMindmapIcon = createSvgIcon(
128
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
129
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("rect", { x: "2", y: "6.2", width: "4.4", height: "3.6", rx: "1" }),
130
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("rect", { x: "9.8", y: "2.5", width: "4.2", height: "3", rx: "0.8" }),
131
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("rect", { x: "9.8", y: "10.5", width: "4.2", height: "3", rx: "0.8" }),
132
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M6.4 8C8 8 8 4 9.8 4M6.4 8C8 8 8 12 9.8 12" })
133
+ ] })
134
+ );
135
+ var BoardEntityCardIcon = createSvgIcon(
136
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
137
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("rect", { x: "2.2", y: "2.2", width: "11.6", height: "11.6", rx: "1.5" }),
138
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M2.2 5.6H13.8M4.8 8.2H11.2M4.8 10.8H9.5" })
139
+ ] })
140
+ );
141
+ var BoardChartTableIcon = createSvgIcon(
142
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
143
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("rect", { x: "2", y: "2.5", width: "12", height: "11", rx: "1.4" }),
144
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M5.2 11V7.5M8 11V5.2M10.8 11V8.5" })
145
+ ] })
146
+ );
147
+ var BoardCommentIcon = createSvgIcon(
148
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M3 3H13C13.6 3 14 3.4 14 4V10C14 10.6 13.6 11 13 11H6.5L3.2 13.6V11H3C2.4 11 2 10.6 2 10V4C2 3.4 2.4 3 3 3Z" })
149
+ );
150
+ var BoardMermaidIcon = createSvgIcon(
151
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
152
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M4.8 4.5L2.2 8L4.8 11.5M11.2 4.5L13.8 8L11.2 11.5" }),
153
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M8.8 3.2L7.2 12.8" })
154
+ ] })
155
+ );
156
+ var BoardPlayTourIcon = createSvgIcon(
157
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("polygon", { points: "4.5,3 13,8 4.5,13" })
158
+ );
159
+ var BoardLaserIcon = createSvgIcon(
160
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
161
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("circle", { cx: "5", cy: "5", r: "2" }),
162
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M6.6 6.6L13.5 13.5M5 1.8V2.6M1.8 5H2.6M8.2 5H7.4M5 8.2V7.4" })
163
+ ] })
164
+ );
165
+ var BoardTimerIcon = createSvgIcon(
166
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
167
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("circle", { cx: "8", cy: "8.8", r: "5" }),
168
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M6.2 2.2H9.8M8 6.2V8.8L9.8 10" })
169
+ ] })
170
+ );
171
+ var BoardDownloadIcon = createSvgIcon(
172
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M8 2.5V10.5M8 10.5L5.2 7.7M8 10.5L10.8 7.7M2.5 11.5V13C2.5 13.4 2.9 13.8 3.4 13.8H12.6C13.1 13.8 13.5 13.4 13.5 13V11.5" })
173
+ );
174
+ var BoardInspectorIcon = createSvgIcon(
175
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
176
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("rect", { x: "2", y: "2.5", width: "12", height: "11", rx: "1.4" }),
177
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M10 2.5V13.5M4.5 6H7.8M4.5 8.8H7.8" })
178
+ ] })
179
+ );
180
+ var BoardFitScreenIcon = createSvgIcon(
181
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M2.5 5.8V2.8H5.5M10.5 2.8H13.5V5.8M13.5 10.2V13.2H10.5M5.5 13.2H2.5V10.2" })
182
+ );
183
+ var BoardVoteThumbIcon = createSvgIcon(
184
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M5.5 7.5L7.8 2.8C8.4 2.8 9 3.3 9 4V6.2H12.2C12.8 6.2 13.2 6.7 13.1 7.3L12.2 12.2C12.1 12.7 11.6 13.2 11 13.2H5.5V7.5ZM5.5 7.5H3.2V13.2H5.5" })
185
+ );
186
+ var BoardPlusIcon = createSvgIcon(
187
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M8 3.2V12.8M3.2 8H12.8" })
188
+ );
189
+ var BoardTrashIcon = createSvgIcon(
190
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M3 4.5H13M6 4.5V3H10V4.5M4.5 4.5L5.2 13.2H10.8L11.5 4.5" })
191
+ );
192
+ var BoardAlignLeftIcon = createSvgIcon(
193
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M2.5 2.5V13.5M5 5.2H12.5M5 8.2H10M5 11.2H13.5" })
194
+ );
195
+ var BoardAlignCenterIcon = createSvgIcon(
196
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M8 2.2V13.8M3.5 5.2H12.5M5 8.2H11M3 11.2H13" })
197
+ );
198
+ var BoardAlignRightIcon = createSvgIcon(
199
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M13.5 2.5V13.5M3.5 5.2H11M6 8.2H11M2.5 11.2H11" })
200
+ );
201
+ var BoardGridIcon = createSvgIcon(
202
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M2.5 5.5H13.5M2.5 10.5H13.5M5.5 2.5V13.5M10.5 2.5V13.5" })
203
+ );
204
+ var BOARD_ICON_MAP = {
205
+ BoardSelectIcon,
206
+ BoardHandIcon,
207
+ BoardFrameIcon,
208
+ BoardSwimlaneIcon,
209
+ BoardStickyIcon,
210
+ BoardShapeIcon,
211
+ BoardConnectorIcon,
212
+ BoardInkIcon,
213
+ BoardMindmapIcon,
214
+ BoardEntityCardIcon,
215
+ BoardChartTableIcon,
216
+ BoardCommentIcon,
217
+ BoardMermaidIcon,
218
+ BoardPlayTourIcon,
219
+ BoardLaserIcon,
220
+ BoardTimerIcon,
221
+ BoardDownloadIcon,
222
+ BoardInspectorIcon,
223
+ BoardFitScreenIcon,
224
+ BoardVoteThumbIcon,
225
+ BoardPlusIcon,
226
+ BoardTrashIcon,
227
+ BoardAlignLeftIcon,
228
+ BoardAlignCenterIcon,
229
+ BoardAlignRightIcon,
230
+ BoardGridIcon
231
+ };
232
+
233
+ // src/operations/board-ui.operation.ts
234
+ var import_core = require("@univerjs/core");
235
+ var import_ui = require("@univerjs/ui");
236
+ var import_univer_boards = require("@yudaocode/univer-boards");
237
+ var BOARD_INSPECTOR_SIDEBAR_ID = "univer.boards.inspector.sidebar";
238
+ var BOARD_INSPECTOR_COMPONENT_KEY = "univer.boards.inspector.component";
239
+ function openBoardInspectorSidebar(sidebarService) {
240
+ sidebarService.open({
241
+ id: BOARD_INSPECTOR_SIDEBAR_ID,
242
+ header: { title: "boards.sidebar.inspectorTitle" },
243
+ children: { label: BOARD_INSPECTOR_COMPONENT_KEY },
244
+ width: 328
245
+ });
246
+ }
247
+ var ToggleBoardInspectorOperation = {
248
+ id: "boards-ui.operation.toggle-inspector",
249
+ type: import_core.CommandType.OPERATION,
250
+ handler: (accessor) => {
251
+ const sidebarService = accessor.get(import_ui.ISidebarService);
252
+ if (sidebarService.visible && sidebarService.options?.id === BOARD_INSPECTOR_SIDEBAR_ID) {
253
+ sidebarService.close(BOARD_INSPECTOR_SIDEBAR_ID);
254
+ } else {
255
+ openBoardInspectorSidebar(sidebarService);
256
+ }
257
+ return true;
258
+ }
259
+ };
260
+ var OpenBoardMermaidModalOperation = {
261
+ id: "boards-ui.operation.open-mermaid-modal",
262
+ type: import_core.CommandType.OPERATION,
263
+ handler: (accessor, params) => {
264
+ const selService = accessor.get(import_univer_boards.IBoardSelectionService);
265
+ selService.setMermaidModalOpen(params?.open ?? true);
266
+ return true;
267
+ }
268
+ };
269
+ var SetBoardToolOperation = {
270
+ id: "boards-ui.operation.set-tool",
271
+ type: import_core.CommandType.OPERATION,
272
+ handler: (accessor, params) => {
273
+ if (!params?.tool) return false;
274
+ accessor.get(import_univer_boards.IBoardSelectionService).setActiveTool(params.tool);
275
+ return true;
276
+ }
277
+ };
278
+ var StartBoardPresentationOperation = {
279
+ id: "boards-ui.operation.toggle-presentation",
280
+ type: import_core.CommandType.OPERATION,
281
+ handler: (accessor, params) => {
282
+ const sel = accessor.get(import_univer_boards.IBoardSelectionService);
283
+ const current = sel.getPresentationState();
284
+ const nextActive = params?.active ?? !current.active;
285
+ const nextIndex = params?.frameIndex ?? 0;
286
+ sel.setPresentationState({
287
+ active: nextActive,
288
+ frameIndex: nextIndex,
289
+ laserActive: nextActive ? current.laserActive : false
290
+ });
291
+ if (nextActive) {
292
+ const instanceService = accessor.get(import_core.IUniverInstanceService);
293
+ const unit = instanceService.getCurrentUnitOfType(
294
+ import_core.UniverInstanceType.UNIVER_BOARD
295
+ );
296
+ const frames = unit?.getFramesOrdered() ?? [];
297
+ const targetFrame = frames[nextIndex];
298
+ if (unit && targetFrame) {
299
+ const stageW = 1080;
300
+ const stageH = 680;
301
+ const zoom = Math.max(
302
+ 0.25,
303
+ Math.min(2, Math.min((stageW - 96) / targetFrame.width, (stageH - 96) / targetFrame.height))
304
+ );
305
+ const panX = Math.round((stageW - targetFrame.width * zoom) / 2 - targetFrame.x * zoom);
306
+ const panY = Math.round((stageH - targetFrame.height * zoom) / 2 - targetFrame.y * zoom);
307
+ accessor.get(import_core.ICommandService).syncExecuteCommand(import_univer_boards.SetBoardViewportCommand.id, {
308
+ unitId: unit.getUnitId(),
309
+ viewport: { panX, panY, zoom: Number(zoom.toFixed(2)) }
310
+ });
311
+ }
312
+ }
313
+ return true;
314
+ }
315
+ };
316
+ var FitBoardToScreenOperation = {
317
+ id: "boards-ui.operation.fit-screen",
318
+ type: import_core.CommandType.OPERATION,
319
+ handler: (accessor, params) => {
320
+ const instanceService = accessor.get(import_core.IUniverInstanceService);
321
+ const unit = instanceService.getCurrentUnitOfType(
322
+ import_core.UniverInstanceType.UNIVER_BOARD
323
+ );
324
+ if (!unit) return false;
325
+ const snap = unit.getSnapshot();
326
+ const bounds = (0, import_univer_boards.computeBoardBounds)(snap, void 0, 48);
327
+ const stageW = params?.stageWidth ?? 1120;
328
+ const stageH = params?.stageHeight ?? 700;
329
+ const zoom = Math.max(
330
+ 0.15,
331
+ Math.min(1.5, Math.min(stageW / bounds.width, stageH / bounds.height))
332
+ );
333
+ const panX = Math.round((stageW - bounds.width * zoom) / 2 - bounds.x * zoom);
334
+ const panY = Math.round((stageH - bounds.height * zoom) / 2 - bounds.y * zoom);
335
+ return accessor.get(import_core.ICommandService).syncExecuteCommand(import_univer_boards.SetBoardViewportCommand.id, {
336
+ unitId: unit.getUnitId(),
337
+ viewport: { panX, panY, zoom: Number(zoom.toFixed(2)) }
338
+ });
339
+ }
340
+ };
341
+ function triggerBrowserDownload(content, fileName, mimeType) {
342
+ if (typeof document === "undefined" || typeof URL === "undefined") return;
343
+ const blobPart = typeof content === "string" ? content : content.slice().buffer;
344
+ const blob = new Blob([blobPart], { type: mimeType });
345
+ const url = URL.createObjectURL(blob);
346
+ const anchor = document.createElement("a");
347
+ anchor.href = url;
348
+ anchor.download = fileName;
349
+ document.body.appendChild(anchor);
350
+ anchor.click();
351
+ document.body.removeChild(anchor);
352
+ setTimeout(() => URL.revokeObjectURL(url), 1500);
353
+ }
354
+ var ExportBoardFileOperation = {
355
+ id: "boards-ui.operation.export-file",
356
+ type: import_core.CommandType.OPERATION,
357
+ handler: async (accessor, params) => {
358
+ const format = params?.format ?? "svg";
359
+ const instanceService = accessor.get(import_core.IUniverInstanceService);
360
+ const unit = instanceService.getCurrentUnitOfType(
361
+ import_core.UniverInstanceType.UNIVER_BOARD
362
+ );
363
+ if (!unit) return false;
364
+ const ioService = accessor.get(import_univer_boards.IBoardIoService);
365
+ const snap = unit.save();
366
+ const safeBaseName = (snap.name || "univer-board").replace(/[\\/:*?"<>|]/g, "_");
367
+ if (format === "svg") {
368
+ const svg = ioService.exportSvg(snap);
369
+ triggerBrowserDownload(svg, `${safeBaseName}.svg`, "image/svg+xml;charset=utf-8");
370
+ return true;
371
+ }
372
+ if (format === "csv") {
373
+ const csv = ioService.exportCsv(snap);
374
+ triggerBrowserDownload(csv, `${safeBaseName}.csv`, "text/csv;charset=utf-8");
375
+ return true;
376
+ }
377
+ if (format === "pptx") {
378
+ const pptx = ioService.exportPptx(snap);
379
+ triggerBrowserDownload(
380
+ pptx,
381
+ `${safeBaseName}.pptx`,
382
+ "application/vnd.openxmlformats-officedocument.presentationml.presentation"
383
+ );
384
+ return true;
385
+ }
386
+ if (format === "pdf") {
387
+ const pdfBytes = await ioService.exportPdf(snap, {
388
+ mode: params?.pdfMode ?? (snap.frameOrder.length > 0 ? "frames" : "full")
389
+ });
390
+ triggerBrowserDownload(pdfBytes, `${safeBaseName}.pdf`, "application/pdf");
391
+ return true;
392
+ }
393
+ if (format === "png") {
394
+ const dataUrl = await ioService.exportRasterDataUrl(snap, "png", 2);
395
+ if (typeof document !== "undefined") {
396
+ const anchor = document.createElement("a");
397
+ anchor.href = dataUrl;
398
+ anchor.download = `${safeBaseName}.png`;
399
+ document.body.appendChild(anchor);
400
+ anchor.click();
401
+ document.body.removeChild(anchor);
402
+ }
403
+ return true;
404
+ }
405
+ return false;
406
+ }
407
+ };
408
+
409
+ // src/views/canvas/BoardsInfiniteCanvas.tsx
410
+ var import_core2 = require("@univerjs/core");
411
+ var import_ui2 = require("@univerjs/ui");
412
+ var import_univer_boards2 = require("@yudaocode/univer-boards");
413
+ var import_react = require("react");
414
+ var import_rxjs = require("rxjs");
415
+ var import_jsx_runtime2 = require("react/jsx-runtime");
416
+ var RESIZE_HANDLES = ["nw", "n", "ne", "e", "se", "s", "sw", "w"];
417
+ var PORT_SIDES = ["top", "right", "bottom", "left"];
418
+ var QUICK_SHAPES = [
419
+ { type: "roundRect", label: "\u5706\u89D2\u8282\u70B9" },
420
+ { type: "rect", label: "\u77E9\u5F62\u6A21\u5757" },
421
+ { type: "diamond", label: "\u6761\u4EF6\u83F1\u5F62" },
422
+ { type: "cylinder", label: "\u5B58\u50A8\u6570\u636E\u5E93" },
423
+ { type: "hexagon", label: "\u7F51\u5173\u516D\u8FB9\u5F62" },
424
+ { type: "ellipse", label: "\u8D77\u6B62\u692D\u5706" },
425
+ { type: "parallelogram", label: "\u8F93\u5165\u8F93\u51FA" },
426
+ { type: "cloud", label: "\u5916\u90E8\u4E91\u670D\u52A1" },
427
+ { type: "document", label: "\u5355\u636E\u6587\u6863" },
428
+ { type: "actor", label: "\u4E1A\u52A1\u89D2\u8272" },
429
+ { type: "callout", label: "\u8BF4\u660E\u6807\u6CE8" }
430
+ ];
431
+ function formatCountdown(sec) {
432
+ const safe = Math.max(0, Math.floor(sec));
433
+ const m = String(Math.floor(safe / 60)).padStart(2, "0");
434
+ const s = String(safe % 60).padStart(2, "0");
435
+ return `${m}:${s}`;
436
+ }
437
+ var BoardsInfiniteCanvas = () => {
438
+ const instanceService = (0, import_ui2.useDependency)(import_core2.IUniverInstanceService);
439
+ const commandService = (0, import_ui2.useDependency)(import_core2.ICommandService);
440
+ const selectionService = (0, import_ui2.useDependency)(import_univer_boards2.IBoardSelectionService);
441
+ const unit = (0, import_ui2.useObservable)(
442
+ () => instanceService.getCurrentTypeOfUnit$(import_core2.UniverInstanceType.UNIVER_BOARD),
443
+ instanceService.getCurrentUnitOfType(import_core2.UniverInstanceType.UNIVER_BOARD),
444
+ false,
445
+ [instanceService]
446
+ );
447
+ const snapshot = (0, import_ui2.useObservable)(
448
+ () => unit ? unit.snapshotChanged$ : (0, import_rxjs.of)(null),
449
+ unit ? unit.getSnapshot() : null,
450
+ false,
451
+ [unit]
452
+ );
453
+ const selectedIds = (0, import_ui2.useObservable)(
454
+ selectionService.selectedIds$,
455
+ selectionService.getSelectedIds()
456
+ );
457
+ const editingId = (0, import_ui2.useObservable)(
458
+ selectionService.editingElementId$,
459
+ selectionService.getEditingElementId()
460
+ );
461
+ const activeTool = (0, import_ui2.useObservable)(
462
+ selectionService.activeTool$,
463
+ selectionService.getActiveTool()
464
+ );
465
+ const activeShapeType = (0, import_ui2.useObservable)(
466
+ selectionService.activeShapeType$,
467
+ selectionService.getActiveShapeType()
468
+ );
469
+ const activeStickyColor = (0, import_ui2.useObservable)(
470
+ selectionService.activeStickyColor$,
471
+ selectionService.getActiveStickyColor()
472
+ );
473
+ const presentation = (0, import_ui2.useObservable)(
474
+ selectionService.presentation$,
475
+ selectionService.getPresentationState()
476
+ );
477
+ const timer = (0, import_ui2.useObservable)(selectionService.timer$, selectionService.getTimerState());
478
+ const stageRef = (0, import_react.useRef)(null);
479
+ const [spacePressed, setSpacePressed] = (0, import_react.useState)(false);
480
+ const [hoveredElementId, setHoveredElementId] = (0, import_react.useState)(null);
481
+ const [shapeMenuOpen, setShapeMenuOpen] = (0, import_react.useState)(false);
482
+ const [widgetMenuOpen, setWidgetMenuOpen] = (0, import_react.useState)(false);
483
+ const [editingDraft, setEditingDraft] = (0, import_react.useState)("");
484
+ const [dragDelta, setDragDelta] = (0, import_react.useState)(null);
485
+ const [resizeDraft, setResizeDraft] = (0, import_react.useState)(null);
486
+ const [marqueeBox, setMarqueeBox] = (0, import_react.useState)(null);
487
+ const [connectingDraft, setConnectingDraft] = (0, import_react.useState)(null);
488
+ const [inkDraft, setInkDraft] = (0, import_react.useState)(null);
489
+ const [laserTrail, setLaserTrail] = (0, import_react.useState)([]);
490
+ const gestureRef = (0, import_react.useRef)(null);
491
+ const currentSnap = snapshot ?? unit?.getSnapshot() ?? null;
492
+ (0, import_react.useEffect)(() => {
493
+ if (!timer.running) return void 0;
494
+ const handle = setInterval(() => {
495
+ const latest = selectionService.getTimerState();
496
+ if (!latest.running) return;
497
+ if (latest.remainingSec <= 1) {
498
+ selectionService.setTimerState({ remainingSec: 0, running: false });
499
+ } else {
500
+ selectionService.setTimerState({ remainingSec: latest.remainingSec - 1 });
501
+ }
502
+ }, 1e3);
503
+ return () => clearInterval(handle);
504
+ }, [timer.running, selectionService]);
505
+ (0, import_react.useEffect)(() => {
506
+ if (!presentation.laserActive || laserTrail.length === 0) return void 0;
507
+ const timerId = setInterval(() => {
508
+ const cutoff = Date.now() - 800;
509
+ setLaserTrail((prev) => prev.filter((pt) => pt.ts >= cutoff));
510
+ }, 80);
511
+ return () => clearInterval(timerId);
512
+ }, [presentation.laserActive, laserTrail.length]);
513
+ (0, import_react.useEffect)(() => {
514
+ if (typeof window === "undefined") return void 0;
515
+ const onKeyDown = (e) => {
516
+ const target = e.target;
517
+ if (target && (target.tagName === "INPUT" || target.tagName === "TEXTAREA" || target.isContentEditable)) {
518
+ return;
519
+ }
520
+ if (e.code === "Space") {
521
+ setSpacePressed(true);
522
+ return;
523
+ }
524
+ const key = e.key.toLowerCase();
525
+ if (key === "v") selectionService.setActiveTool("select");
526
+ else if (key === "h") selectionService.setActiveTool("hand");
527
+ else if (key === "f") selectionService.setActiveTool("frame");
528
+ else if (key === "s" && !e.metaKey && !e.ctrlKey) selectionService.setActiveTool("swimlane");
529
+ else if (key === "n") selectionService.setActiveTool("sticky");
530
+ else if (key === "l") selectionService.setActiveTool("connector");
531
+ else if (key === "p") selectionService.setActiveTool("ink");
532
+ else if (key === "m") selectionService.setActiveTool("mindmap");
533
+ else if (key === "e") selectionService.setActiveTool("entityCard");
534
+ else if ((e.key === "Delete" || e.key === "Backspace") && unit) {
535
+ const ids = selectionService.getSelectedIds();
536
+ if (ids.length > 0) {
537
+ commandService.syncExecuteCommand(import_univer_boards2.DeleteBoardElementsCommand.id, {
538
+ unitId: unit.getUnitId(),
539
+ elementIds: ids
540
+ });
541
+ }
542
+ }
543
+ };
544
+ const onKeyUp = (e) => {
545
+ if (e.code === "Space") setSpacePressed(false);
546
+ };
547
+ window.addEventListener("keydown", onKeyDown);
548
+ window.addEventListener("keyup", onKeyUp);
549
+ return () => {
550
+ window.removeEventListener("keydown", onKeyDown);
551
+ window.removeEventListener("keyup", onKeyUp);
552
+ };
553
+ }, [selectionService, commandService, unit]);
554
+ const screenToBoard = (0, import_react.useCallback)(
555
+ (clientX, clientY) => {
556
+ const rect = stageRef.current?.getBoundingClientRect() ?? { left: 0, top: 0 };
557
+ const vp = currentSnap?.viewport ?? { panX: 0, panY: 0, zoom: 1 };
558
+ return {
559
+ x: (clientX - rect.left - vp.panX) / vp.zoom,
560
+ y: (clientY - rect.top - vp.panY) / vp.zoom
561
+ };
562
+ },
563
+ [currentSnap?.viewport]
564
+ );
565
+ const effectiveElementsMap = (0, import_react.useMemo)(() => {
566
+ if (!currentSnap) return {};
567
+ if (!dragDelta && !resizeDraft) return currentSnap.elements;
568
+ const next = { ...currentSnap.elements };
569
+ if (dragDelta) {
570
+ for (const id of dragDelta.ids) {
571
+ const orig = next[id];
572
+ if (orig) {
573
+ next[id] = { ...orig, x: orig.x + dragDelta.dx, y: orig.y + dragDelta.dy };
574
+ }
575
+ }
576
+ }
577
+ if (resizeDraft && next[resizeDraft.id]) {
578
+ next[resizeDraft.id] = {
579
+ ...next[resizeDraft.id],
580
+ x: resizeDraft.x,
581
+ y: resizeDraft.y,
582
+ width: resizeDraft.width,
583
+ height: resizeDraft.height
584
+ };
585
+ }
586
+ return next;
587
+ }, [currentSnap, dragDelta, resizeDraft]);
588
+ if (!currentSnap || !unit) {
589
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "yudao-boards-canvas-empty", "data-testid": "boards-canvas-empty", children: "\u6B63\u5728\u51C6\u5907\u65E0\u9650\u534F\u4F5C\u767D\u677F\u753B\u5E03..." });
590
+ }
591
+ const unitId = unit.getUnitId();
592
+ const { panX, panY, zoom } = currentSnap.viewport;
593
+ const framesOrdered = unit.getFramesOrdered();
594
+ const orderedElements = (currentSnap.elementOrder.length ? currentSnap.elementOrder : Object.keys(currentSnap.elements)).map((id) => effectiveElementsMap[id]).filter((el) => Boolean(el && !el.hidden));
595
+ const visibleMindmaps = orderedElements.filter(
596
+ (el) => el.type === "mindmap" && !(0, import_univer_boards2.isMindmapNodeCollapsedHidden)(el, effectiveElementsMap)
597
+ );
598
+ const connectors = orderedElements.filter(
599
+ (el) => el.type === "connector"
600
+ );
601
+ const worldBounds = (0, import_univer_boards2.computeBoardBounds)(currentSnap, void 0, 80);
602
+ const minimapW = 196;
603
+ const minimapH = 128;
604
+ const mmScale = Math.min(
605
+ minimapW / Math.max(1, worldBounds.width),
606
+ minimapH / Math.max(1, worldBounds.height)
607
+ );
608
+ const stageW = stageRef.current?.clientWidth || 1120;
609
+ const stageH = stageRef.current?.clientHeight || 700;
610
+ const viewWorldX = -panX / zoom;
611
+ const viewWorldY = -panY / zoom;
612
+ const viewWorldW = stageW / zoom;
613
+ const viewWorldH = stageH / zoom;
614
+ const commitInlineEdit = () => {
615
+ if (!editingId) return;
616
+ const el = currentSnap.elements[editingId];
617
+ if (el) {
618
+ if (el.type === "frame" || el.type === "swimlane" || el.type === "entityCard" || el.type === "chart") {
619
+ commandService.syncExecuteCommand(import_univer_boards2.UpdateBoardElementsCommand.id, {
620
+ unitId,
621
+ updates: [{ id: el.id, patch: { title: editingDraft } }]
622
+ });
623
+ } else if (el.type === "sticky" || el.type === "shape" || el.type === "mindmap" || el.type === "text") {
624
+ commandService.syncExecuteCommand(import_univer_boards2.UpdateBoardElementsCommand.id, {
625
+ unitId,
626
+ updates: [{ id: el.id, patch: { text: editingDraft } }]
627
+ });
628
+ }
629
+ }
630
+ selectionService.setEditingElement(null);
631
+ };
632
+ const startInlineEdit = (el) => {
633
+ const initial = el.type === "frame" || el.type === "swimlane" || el.type === "entityCard" || el.type === "chart" ? el.title : el.type === "sticky" || el.type === "shape" || el.type === "mindmap" || el.type === "text" ? el.text : "";
634
+ setEditingDraft(initial);
635
+ selectionService.setEditingElement(el.id);
636
+ };
637
+ const handleWheel = (e) => {
638
+ e.preventDefault();
639
+ const rect = stageRef.current?.getBoundingClientRect() ?? { left: 0, top: 0 };
640
+ const cursorX = e.clientX - rect.left;
641
+ const cursorY = e.clientY - rect.top;
642
+ const factor = e.deltaY < 0 ? 1.1 : 0.9;
643
+ const nextZoom = Math.max(0.1, Math.min(4, Number((zoom * factor).toFixed(3))));
644
+ const nextPanX = Math.round(cursorX - (cursorX - panX) / zoom * nextZoom);
645
+ const nextPanY = Math.round(cursorY - (cursorY - panY) / zoom * nextZoom);
646
+ commandService.syncExecuteCommand(import_univer_boards2.SetBoardViewportCommand.id, {
647
+ unitId,
648
+ viewport: { panX: nextPanX, panY: nextPanY, zoom: nextZoom }
649
+ });
650
+ };
651
+ const handleStagePointerDown = (e) => {
652
+ if (editingId) {
653
+ commitInlineEdit();
654
+ }
655
+ setShapeMenuOpen(false);
656
+ setWidgetMenuOpen(false);
657
+ const boardPt = screenToBoard(e.clientX, e.clientY);
658
+ if (spacePressed || activeTool === "hand" || e.button === 1) {
659
+ gestureRef.current = {
660
+ kind: "pan",
661
+ startClientX: e.clientX,
662
+ startClientY: e.clientY,
663
+ origPanX: panX,
664
+ origPanY: panY
665
+ };
666
+ return;
667
+ }
668
+ if (activeTool === "ink") {
669
+ const startPt = { x: boardPt.x, y: boardPt.y, pressure: e.pressure || 0.5 };
670
+ gestureRef.current = { kind: "ink", points: [startPt] };
671
+ setInkDraft([startPt]);
672
+ return;
673
+ }
674
+ if (activeTool === "comment") {
675
+ commandService.syncExecuteCommand(import_univer_boards2.AddBoardCommentCommand.id, {
676
+ unitId,
677
+ x: boardPt.x,
678
+ y: boardPt.y,
679
+ text: "\u65B0\u589E\u56E2\u961F\u8BC4\u5BA1\u610F\u89C1"
680
+ });
681
+ selectionService.setActiveTool("select");
682
+ return;
683
+ }
684
+ if (activeTool === "frame" || activeTool === "swimlane" || activeTool === "sticky" || activeTool === "shape" || activeTool === "text" || activeTool === "mindmap" || activeTool === "entityCard" || activeTool === "table" || activeTool === "chart") {
685
+ const extra = {
686
+ x: Math.round(boardPt.x - 80),
687
+ y: Math.round(boardPt.y - 40)
688
+ };
689
+ if (activeTool === "shape") extra.shapeType = activeShapeType;
690
+ if (activeTool === "sticky") extra.color = activeStickyColor;
691
+ commandService.syncExecuteCommand(import_univer_boards2.AddBoardElementsCommand.id, {
692
+ unitId,
693
+ element: {
694
+ type: activeTool,
695
+ ...extra
696
+ }
697
+ });
698
+ selectionService.setActiveTool("select");
699
+ return;
700
+ }
701
+ if (activeTool === "connector") {
702
+ const fromId = `conn-free-${(0, import_core2.generateRandomId)(5)}`;
703
+ commandService.syncExecuteCommand(import_univer_boards2.AddBoardElementsCommand.id, {
704
+ unitId,
705
+ element: {
706
+ id: fromId,
707
+ type: "connector",
708
+ routeType: "orthogonal",
709
+ from: { x: Math.round(boardPt.x), y: Math.round(boardPt.y) },
710
+ to: { x: Math.round(boardPt.x + 180), y: Math.round(boardPt.y + 60) },
711
+ x: Math.round(boardPt.x),
712
+ y: Math.round(boardPt.y),
713
+ width: 180,
714
+ height: 60
715
+ }
716
+ });
717
+ selectionService.setActiveTool("select");
718
+ return;
719
+ }
720
+ if (!e.shiftKey) {
721
+ selectionService.clearSelection();
722
+ }
723
+ gestureRef.current = {
724
+ kind: "marquee",
725
+ startBoardX: boardPt.x,
726
+ startBoardY: boardPt.y
727
+ };
728
+ setMarqueeBox({
729
+ x1: boardPt.x,
730
+ y1: boardPt.y,
731
+ x2: boardPt.x,
732
+ y2: boardPt.y
733
+ });
734
+ };
735
+ const handleElementPointerDown = (e, el) => {
736
+ if (spacePressed || activeTool === "hand") return;
737
+ e.stopPropagation();
738
+ if (activeTool === "connector") {
739
+ const startPt = (0, import_univer_boards2.getElementPortPoint)(el, "right");
740
+ gestureRef.current = {
741
+ kind: "connect",
742
+ fromElementId: el.id,
743
+ fromPort: "right",
744
+ startX: startPt.x,
745
+ startY: startPt.y
746
+ };
747
+ setConnectingDraft({
748
+ fromElementId: el.id,
749
+ fromPort: "right",
750
+ startX: startPt.x,
751
+ startY: startPt.y,
752
+ currX: startPt.x,
753
+ currY: startPt.y
754
+ });
755
+ return;
756
+ }
757
+ let nextSel = selectedIds;
758
+ if (e.shiftKey) {
759
+ selectionService.toggleSelectElement(el.id);
760
+ nextSel = selectionService.getSelectedIds();
761
+ } else if (!selectedIds.includes(el.id)) {
762
+ selectionService.selectElements([el.id]);
763
+ nextSel = [el.id];
764
+ }
765
+ if (el.locked) return;
766
+ const boardPt = screenToBoard(e.clientX, e.clientY);
767
+ const movableSet = new Set(nextSel);
768
+ for (const id of nextSel) {
769
+ const item = currentSnap.elements[id];
770
+ if (item && item.type === "frame") {
771
+ for (const child of unit.getElementsInFrame(item.id)) {
772
+ if (!child.locked) {
773
+ movableSet.add(child.id);
774
+ }
775
+ }
776
+ }
777
+ }
778
+ const origPositions = /* @__PURE__ */ new Map();
779
+ for (const id of movableSet) {
780
+ const target = currentSnap.elements[id];
781
+ if (target && !target.locked) {
782
+ origPositions.set(id, { x: target.x, y: target.y });
783
+ }
784
+ }
785
+ gestureRef.current = {
786
+ kind: "move",
787
+ startBoardX: boardPt.x,
788
+ startBoardY: boardPt.y,
789
+ movableIds: Array.from(origPositions.keys()),
790
+ origPositions
791
+ };
792
+ };
793
+ const handlePortPointerDown = (e, el, port) => {
794
+ e.stopPropagation();
795
+ const pt = (0, import_univer_boards2.getElementPortPoint)(el, port);
796
+ gestureRef.current = {
797
+ kind: "connect",
798
+ fromElementId: el.id,
799
+ fromPort: port,
800
+ startX: pt.x,
801
+ startY: pt.y
802
+ };
803
+ setConnectingDraft({
804
+ fromElementId: el.id,
805
+ fromPort: port,
806
+ startX: pt.x,
807
+ startY: pt.y,
808
+ currX: pt.x,
809
+ currY: pt.y
810
+ });
811
+ };
812
+ const handleResizePointerDown = (e, el, dir) => {
813
+ e.stopPropagation();
814
+ if (el.locked) return;
815
+ const boardPt = screenToBoard(e.clientX, e.clientY);
816
+ gestureRef.current = {
817
+ kind: "resize",
818
+ id: el.id,
819
+ dir,
820
+ startBoardX: boardPt.x,
821
+ startBoardY: boardPt.y,
822
+ origRect: { x: el.x, y: el.y, width: el.width, height: el.height }
823
+ };
824
+ };
825
+ const handleStagePointerMove = (e) => {
826
+ const boardPt = screenToBoard(e.clientX, e.clientY);
827
+ if (presentation.laserActive || activeTool === "laser") {
828
+ setLaserTrail((prev) => [...prev.slice(-18), { x: boardPt.x, y: boardPt.y, ts: Date.now() }]);
829
+ }
830
+ const g = gestureRef.current;
831
+ if (!g) return;
832
+ if (g.kind === "pan") {
833
+ const dx = e.clientX - g.startClientX;
834
+ const dy = e.clientY - g.startClientY;
835
+ commandService.syncExecuteCommand(import_univer_boards2.SetBoardViewportCommand.id, {
836
+ unitId,
837
+ viewport: { panX: g.origPanX + dx, panY: g.origPanY + dy }
838
+ });
839
+ } else if (g.kind === "move") {
840
+ let dx = boardPt.x - g.startBoardX;
841
+ let dy = boardPt.y - g.startBoardY;
842
+ if (currentSnap.snapToGrid !== false) {
843
+ dx = Math.round(dx / 8) * 8;
844
+ dy = Math.round(dy / 8) * 8;
845
+ }
846
+ setDragDelta({ ids: new Set(g.movableIds), dx, dy });
847
+ } else if (g.kind === "resize") {
848
+ const dx = boardPt.x - g.startBoardX;
849
+ const dy = boardPt.y - g.startBoardY;
850
+ let { x, y, width, height } = g.origRect;
851
+ if (g.dir.includes("e")) width = Math.max(36, width + dx);
852
+ if (g.dir.includes("s")) height = Math.max(28, height + dy);
853
+ if (g.dir.includes("w")) {
854
+ const nextW = Math.max(36, width - dx);
855
+ x += width - nextW;
856
+ width = nextW;
857
+ }
858
+ if (g.dir.includes("n")) {
859
+ const nextH = Math.max(28, height - dy);
860
+ y += height - nextH;
861
+ height = nextH;
862
+ }
863
+ setResizeDraft({
864
+ id: g.id,
865
+ x: Math.round(x),
866
+ y: Math.round(y),
867
+ width: Math.round(width),
868
+ height: Math.round(height)
869
+ });
870
+ } else if (g.kind === "marquee") {
871
+ setMarqueeBox({
872
+ x1: g.startBoardX,
873
+ y1: g.startBoardY,
874
+ x2: boardPt.x,
875
+ y2: boardPt.y
876
+ });
877
+ } else if (g.kind === "connect") {
878
+ setConnectingDraft(
879
+ (prev) => prev ? { ...prev, currX: boardPt.x, currY: boardPt.y } : null
880
+ );
881
+ } else if (g.kind === "ink") {
882
+ const pt = { x: boardPt.x, y: boardPt.y, pressure: e.pressure || 0.5 };
883
+ g.points.push(pt);
884
+ setInkDraft([...g.points]);
885
+ }
886
+ };
887
+ const handleStagePointerUp = (e) => {
888
+ const g = gestureRef.current;
889
+ gestureRef.current = null;
890
+ if (!g) return;
891
+ const boardPt = screenToBoard(e.clientX, e.clientY);
892
+ if (g.kind === "move") {
893
+ if (dragDelta && (Math.abs(dragDelta.dx) >= 1 || Math.abs(dragDelta.dy) >= 1)) {
894
+ const updates = g.movableIds.map((id) => {
895
+ const orig = g.origPositions.get(id);
896
+ if (!orig) return null;
897
+ return {
898
+ id,
899
+ patch: {
900
+ x: Math.round(orig.x + dragDelta.dx),
901
+ y: Math.round(orig.y + dragDelta.dy)
902
+ }
903
+ };
904
+ }).filter((u) => u !== null);
905
+ if (updates.length > 0) {
906
+ commandService.syncExecuteCommand(import_univer_boards2.UpdateBoardElementsCommand.id, {
907
+ unitId,
908
+ updates
909
+ });
910
+ }
911
+ }
912
+ setDragDelta(null);
913
+ } else if (g.kind === "resize") {
914
+ if (resizeDraft) {
915
+ commandService.syncExecuteCommand(import_univer_boards2.UpdateBoardElementsCommand.id, {
916
+ unitId,
917
+ updates: [
918
+ {
919
+ id: resizeDraft.id,
920
+ patch: {
921
+ x: resizeDraft.x,
922
+ y: resizeDraft.y,
923
+ width: resizeDraft.width,
924
+ height: resizeDraft.height
925
+ }
926
+ }
927
+ ]
928
+ });
929
+ }
930
+ setResizeDraft(null);
931
+ } else if (g.kind === "marquee") {
932
+ if (marqueeBox) {
933
+ const minX = Math.min(marqueeBox.x1, marqueeBox.x2);
934
+ const maxX = Math.max(marqueeBox.x1, marqueeBox.x2);
935
+ const minY = Math.min(marqueeBox.y1, marqueeBox.y2);
936
+ const maxY = Math.max(marqueeBox.y1, marqueeBox.y2);
937
+ if (maxX - minX > 4 || maxY - minY > 4) {
938
+ const hit = orderedElements.filter(
939
+ (el) => el.type !== "frame" && el.x + el.width >= minX && el.x <= maxX && el.y + el.height >= minY && el.y <= maxY
940
+ ).map((el) => el.id);
941
+ selectionService.selectElements(hit);
942
+ }
943
+ }
944
+ setMarqueeBox(null);
945
+ } else if (g.kind === "connect") {
946
+ const targetEl = [...orderedElements].reverse().find(
947
+ (el) => el.id !== g.fromElementId && el.type !== "connector" && el.type !== "frame" && el.type !== "ink" && boardPt.x >= el.x - 14 && boardPt.x <= el.x + el.width + 14 && boardPt.y >= el.y - 14 && boardPt.y <= el.y + el.height + 14
948
+ );
949
+ let toEndpoint = {
950
+ x: Math.round(boardPt.x),
951
+ y: Math.round(boardPt.y)
952
+ };
953
+ if (targetEl) {
954
+ let bestPort = "left";
955
+ let bestDist = Infinity;
956
+ for (const pSide of PORT_SIDES) {
957
+ const pp = (0, import_univer_boards2.getElementPortPoint)(targetEl, pSide);
958
+ const d = Math.hypot(pp.x - boardPt.x, pp.y - boardPt.y);
959
+ if (d < bestDist) {
960
+ bestDist = d;
961
+ bestPort = pSide;
962
+ }
963
+ }
964
+ toEndpoint = { elementId: targetEl.id, port: bestPort };
965
+ }
966
+ if (Math.hypot(boardPt.x - g.startX, boardPt.y - g.startY) > 12) {
967
+ commandService.syncExecuteCommand(import_univer_boards2.AddBoardElementsCommand.id, {
968
+ unitId,
969
+ element: {
970
+ type: "connector",
971
+ routeType: "orthogonal",
972
+ from: { elementId: g.fromElementId, port: g.fromPort },
973
+ to: toEndpoint,
974
+ stroke: "#2563EB",
975
+ strokeWidth: 2,
976
+ endMarker: "arrow",
977
+ x: Math.min(g.startX, boardPt.x),
978
+ y: Math.min(g.startY, boardPt.y),
979
+ width: Math.max(20, Math.abs(boardPt.x - g.startX)),
980
+ height: Math.max(20, Math.abs(boardPt.y - g.startY))
981
+ }
982
+ });
983
+ }
984
+ setConnectingDraft(null);
985
+ } else if (g.kind === "ink") {
986
+ if (g.points.length >= 2) {
987
+ const xs = g.points.map((p) => p.x);
988
+ const ys = g.points.map((p) => p.y);
989
+ const minX = Math.min(...xs);
990
+ const minY = Math.min(...ys);
991
+ commandService.syncExecuteCommand(import_univer_boards2.AddBoardElementsCommand.id, {
992
+ unitId,
993
+ element: {
994
+ type: "ink",
995
+ points: g.points.map((p) => ({
996
+ x: Number(p.x.toFixed(1)),
997
+ y: Number(p.y.toFixed(1)),
998
+ pressure: p.pressure
999
+ })),
1000
+ stroke: "#2563EB",
1001
+ strokeWidth: 3,
1002
+ opacity: 0.95,
1003
+ x: Math.round(minX),
1004
+ y: Math.round(minY),
1005
+ width: Math.max(8, Math.round(Math.max(...xs) - minX)),
1006
+ height: Math.max(8, Math.round(Math.max(...ys) - minY))
1007
+ },
1008
+ selectAdded: false
1009
+ });
1010
+ }
1011
+ setInkDraft(null);
1012
+ }
1013
+ };
1014
+ const stepPresentationFrame = (delta) => {
1015
+ if (framesOrdered.length === 0) return;
1016
+ const nextIdx = (presentation.frameIndex + delta + framesOrdered.length) % framesOrdered.length;
1017
+ commandService.syncExecuteCommand(StartBoardPresentationOperation.id, {
1018
+ active: true,
1019
+ frameIndex: nextIdx
1020
+ });
1021
+ };
1022
+ const setTimerPreset = (minutes) => {
1023
+ const sec = minutes * 60;
1024
+ selectionService.setTimerState({
1025
+ durationSec: sec,
1026
+ remainingSec: sec,
1027
+ running: false
1028
+ });
1029
+ };
1030
+ const handleMinimapClick = (e) => {
1031
+ const rect = e.currentTarget.getBoundingClientRect();
1032
+ const mx = e.clientX - rect.left;
1033
+ const my = e.clientY - rect.top;
1034
+ const targetWorldX = worldBounds.x + mx / mmScale;
1035
+ const targetWorldY = worldBounds.y + my / mmScale;
1036
+ const nextPanX = Math.round(stageW / 2 - targetWorldX * zoom);
1037
+ const nextPanY = Math.round(stageH / 2 - targetWorldY * zoom);
1038
+ commandService.syncExecuteCommand(import_univer_boards2.SetBoardViewportCommand.id, {
1039
+ unitId,
1040
+ viewport: { panX: nextPanX, panY: nextPanY }
1041
+ });
1042
+ };
1043
+ const renderShapeNode = (el) => {
1044
+ const { width: w, height: h, fill, stroke, strokeWidth } = el;
1045
+ const dash = el.dashed ? "6 4" : void 0;
1046
+ if (el.shapeType === "rect") {
1047
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1048
+ "rect",
1049
+ {
1050
+ x: 1,
1051
+ y: 1,
1052
+ width: Math.max(2, w - 2),
1053
+ height: Math.max(2, h - 2),
1054
+ rx: 4,
1055
+ fill,
1056
+ stroke,
1057
+ strokeWidth,
1058
+ strokeDasharray: dash
1059
+ }
1060
+ );
1061
+ }
1062
+ if (el.shapeType === "roundRect") {
1063
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1064
+ "rect",
1065
+ {
1066
+ x: 1,
1067
+ y: 1,
1068
+ width: Math.max(2, w - 2),
1069
+ height: Math.max(2, h - 2),
1070
+ rx: Math.min(18, h / 2),
1071
+ fill,
1072
+ stroke,
1073
+ strokeWidth,
1074
+ strokeDasharray: dash
1075
+ }
1076
+ );
1077
+ }
1078
+ if (el.shapeType === "ellipse") {
1079
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1080
+ "ellipse",
1081
+ {
1082
+ cx: w / 2,
1083
+ cy: h / 2,
1084
+ rx: Math.max(2, w / 2 - 1),
1085
+ ry: Math.max(2, h / 2 - 1),
1086
+ fill,
1087
+ stroke,
1088
+ strokeWidth,
1089
+ strokeDasharray: dash
1090
+ }
1091
+ );
1092
+ }
1093
+ if (el.shapeType === "cylinder") {
1094
+ const ry = Math.min(11, h * 0.18);
1095
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
1096
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1097
+ "path",
1098
+ {
1099
+ d: `M 1 ${ry} L 1 ${h - ry} A ${w / 2 - 1} ${ry} 0 0 0 ${w - 1} ${h - ry} L ${w - 1} ${ry} Z`,
1100
+ fill,
1101
+ stroke,
1102
+ strokeWidth,
1103
+ strokeDasharray: dash
1104
+ }
1105
+ ),
1106
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1107
+ "ellipse",
1108
+ {
1109
+ cx: w / 2,
1110
+ cy: ry,
1111
+ rx: Math.max(2, w / 2 - 1),
1112
+ ry,
1113
+ fill,
1114
+ stroke,
1115
+ strokeWidth,
1116
+ strokeDasharray: dash
1117
+ }
1118
+ )
1119
+ ] });
1120
+ }
1121
+ if (el.shapeType === "actor") {
1122
+ const cx = w / 2;
1123
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
1124
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1125
+ "rect",
1126
+ {
1127
+ x: 1,
1128
+ y: 1,
1129
+ width: w - 2,
1130
+ height: h - 2,
1131
+ rx: 10,
1132
+ fill,
1133
+ stroke,
1134
+ strokeWidth
1135
+ }
1136
+ ),
1137
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("circle", { cx, cy: 14, r: 6.5, fill: "none", stroke, strokeWidth: 1.8 }),
1138
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1139
+ "path",
1140
+ {
1141
+ d: `M ${cx} 20.5 L ${cx} 33 M ${cx - 10} 25 L ${cx + 10} 25 M ${cx} 33 L ${cx - 8} 42 M ${cx} 33 L ${cx + 8} 42`,
1142
+ stroke,
1143
+ strokeWidth: 1.8,
1144
+ strokeLinecap: "round"
1145
+ }
1146
+ )
1147
+ ] });
1148
+ }
1149
+ const pathD = (0, import_univer_boards2.buildShapeSvgPath)(el.shapeType, 1, 1, w - 2, h - 2);
1150
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1151
+ "path",
1152
+ {
1153
+ d: pathD,
1154
+ fill,
1155
+ stroke,
1156
+ strokeWidth,
1157
+ strokeLinejoin: "round",
1158
+ strokeDasharray: dash
1159
+ }
1160
+ );
1161
+ };
1162
+ const renderInlineChart = (el) => {
1163
+ const plotW = Math.max(80, el.width - 40);
1164
+ const plotH = Math.max(60, el.height - 58);
1165
+ const allVals = el.series.flatMap((s) => s.values);
1166
+ const maxVal = Math.max(1, ...allVals);
1167
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "yudao-boards-chart-card", children: [
1168
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "yudao-boards-chart-title", children: el.title }),
1169
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("svg", { width: plotW + 20, height: plotH + 22, viewBox: `0 0 ${plotW + 20} ${plotH + 22}`, children: [
1170
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("line", { x1: 12, y1: plotH, x2: plotW + 12, y2: plotH, stroke: "#CBD5E1", strokeWidth: 1 }),
1171
+ el.categories.map((cat, cIdx) => {
1172
+ const groupW = plotW / Math.max(1, el.categories.length);
1173
+ const barW = Math.max(6, groupW * 0.66 / Math.max(1, el.series.length));
1174
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("g", { children: [
1175
+ el.series.map((s, sIdx) => {
1176
+ const val = s.values[cIdx] ?? 0;
1177
+ const bh = val / maxVal * (plotH - 8);
1178
+ const bx = 12 + cIdx * groupW + groupW * 0.16 + sIdx * barW;
1179
+ const by = plotH - bh;
1180
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1181
+ "rect",
1182
+ {
1183
+ x: bx,
1184
+ y: by,
1185
+ width: Math.max(4, barW - 2),
1186
+ height: Math.max(2, bh),
1187
+ rx: 2,
1188
+ fill: s.color ?? (sIdx === 0 ? "#93C5FD" : "#2563EB")
1189
+ },
1190
+ `${s.name}-${sIdx}`
1191
+ );
1192
+ }),
1193
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1194
+ "text",
1195
+ {
1196
+ x: 12 + cIdx * groupW + groupW / 2,
1197
+ y: plotH + 14,
1198
+ fontSize: 10,
1199
+ fill: "#64748B",
1200
+ textAnchor: "middle",
1201
+ children: cat
1202
+ }
1203
+ )
1204
+ ] }, `${cat}-${cIdx}`);
1205
+ })
1206
+ ] })
1207
+ ] });
1208
+ };
1209
+ const renderInlineTable = (el) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "yudao-boards-table-card", children: [
1210
+ el.title && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "yudao-boards-table-title", children: el.title }),
1211
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("table", { className: "yudao-boards-inline-table", children: [
1212
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("tr", { style: { backgroundColor: el.headerFill ?? "#EFF6FF" }, children: el.headers.map((h, idx) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("th", { children: h }, `${h}-${idx}`)) }) }),
1213
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("tbody", { children: el.rows.map((row, rIdx) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("tr", { children: el.headers.map((_, cIdx) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("td", { children: row[cIdx] ?? "" }, `c-${cIdx}`)) }, `r-${rIdx}`)) })
1214
+ ] })
1215
+ ] });
1216
+ const gridBgClass = currentSnap.gridStyle === "dots" ? "is-grid-dots" : currentSnap.gridStyle === "lines" ? "is-grid-lines" : "is-grid-none";
1217
+ const dockItems = [
1218
+ { tool: "select", label: "\u9009\u62E9 (V)", icon: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(BoardSelectIcon, {}) },
1219
+ { tool: "hand", label: "\u6293\u624B (H)", icon: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(BoardHandIcon, {}) },
1220
+ { tool: "frame", label: "\u753B\u6846 (F)", icon: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(BoardFrameIcon, {}) },
1221
+ { tool: "swimlane", label: "\u6CF3\u9053 (S)", icon: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(BoardSwimlaneIcon, {}) },
1222
+ { tool: "sticky", label: "\u4FBF\u7B7E (N)", icon: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(BoardStickyIcon, {}) },
1223
+ {
1224
+ tool: "shape",
1225
+ label: "\u5F62\u72B6",
1226
+ icon: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(BoardShapeIcon, {}),
1227
+ onClick: () => {
1228
+ selectionService.setActiveTool("shape");
1229
+ setShapeMenuOpen((v) => !v);
1230
+ setWidgetMenuOpen(false);
1231
+ }
1232
+ },
1233
+ { tool: "connector", label: "\u667A\u80FD\u8FDE\u7EBF (L)", icon: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(BoardConnectorIcon, {}) },
1234
+ { tool: "ink", label: "\u81EA\u7531\u753B\u7B14 (P)", icon: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(BoardInkIcon, {}) },
1235
+ { tool: "mindmap", label: "\u601D\u7EF4\u5BFC\u56FE (M)", icon: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(BoardMindmapIcon, {}) },
1236
+ { tool: "entityCard", label: "\u5B9E\u4F53\u6A21\u578B\u5361 (E)", icon: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(BoardEntityCardIcon, {}) },
1237
+ {
1238
+ tool: "chart",
1239
+ label: "\u5185\u5D4C\u56FE\u8868/\u8868\u683C",
1240
+ icon: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(BoardChartTableIcon, {}),
1241
+ onClick: () => {
1242
+ setWidgetMenuOpen((v) => !v);
1243
+ setShapeMenuOpen(false);
1244
+ }
1245
+ },
1246
+ { tool: "comment", label: "\u8BC4\u8BBA\u56FE\u9489", icon: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(BoardCommentIcon, {}) }
1247
+ ];
1248
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
1249
+ "div",
1250
+ {
1251
+ ref: stageRef,
1252
+ className: `yudao-boards-stage ${gridBgClass} ${spacePressed || activeTool === "hand" ? "is-panning" : ""} ${presentation.laserActive || activeTool === "laser" ? "is-laser" : ""}`,
1253
+ "data-testid": "boards-infinite-canvas",
1254
+ style: {
1255
+ backgroundColor: currentSnap.backgroundColor || "#F8FAFC",
1256
+ backgroundPosition: `${panX}px ${panY}px`,
1257
+ backgroundSize: `${Math.max(8, 24 * zoom)}px ${Math.max(8, 24 * zoom)}px`
1258
+ },
1259
+ onWheel: handleWheel,
1260
+ onPointerDown: handleStagePointerDown,
1261
+ onPointerMove: handleStagePointerMove,
1262
+ onPointerUp: handleStagePointerUp,
1263
+ children: [
1264
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
1265
+ "div",
1266
+ {
1267
+ className: "yudao-boards-top-bar",
1268
+ "data-testid": "boards-top-bar",
1269
+ onPointerDown: (e) => e.stopPropagation(),
1270
+ children: [
1271
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "yudao-boards-tour-group", children: [
1272
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
1273
+ "button",
1274
+ {
1275
+ type: "button",
1276
+ className: `yudao-boards-top-btn ${presentation.active ? "is-active" : ""}`,
1277
+ "data-testid": "boards-tour-toggle",
1278
+ onClick: () => commandService.syncExecuteCommand(StartBoardPresentationOperation.id, {
1279
+ active: !presentation.active,
1280
+ frameIndex: 0
1281
+ }),
1282
+ children: [
1283
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(BoardPlayTourIcon, {}),
1284
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: presentation.active ? `\u753B\u6846\u653E\u6620 (${presentation.frameIndex + 1}/${Math.max(1, framesOrdered.length)})` : "\u753B\u6846\u6F14\u793A\u653E\u6620" })
1285
+ ]
1286
+ }
1287
+ ),
1288
+ presentation.active && framesOrdered.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
1289
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1290
+ "button",
1291
+ {
1292
+ type: "button",
1293
+ className: "yudao-boards-top-btn",
1294
+ onClick: () => stepPresentationFrame(-1),
1295
+ children: "\u4E0A\u4E00\u5E27"
1296
+ }
1297
+ ),
1298
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1299
+ "button",
1300
+ {
1301
+ type: "button",
1302
+ className: "yudao-boards-top-btn",
1303
+ onClick: () => stepPresentationFrame(1),
1304
+ children: "\u4E0B\u4E00\u5E27"
1305
+ }
1306
+ )
1307
+ ] }),
1308
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
1309
+ "button",
1310
+ {
1311
+ type: "button",
1312
+ className: `yudao-boards-top-btn ${presentation.laserActive ? "is-laser-active" : ""}`,
1313
+ "data-testid": "boards-laser-toggle",
1314
+ onClick: () => selectionService.setPresentationState({
1315
+ laserActive: !presentation.laserActive
1316
+ }),
1317
+ children: [
1318
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(BoardLaserIcon, {}),
1319
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: "\u6FC0\u5149\u7B14" })
1320
+ ]
1321
+ }
1322
+ )
1323
+ ] }),
1324
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "yudao-boards-timer-group", "data-testid": "boards-workshop-timer", children: [
1325
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(BoardTimerIcon, {}),
1326
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "yudao-boards-timer-clock", children: formatCountdown(timer.remainingSec) }),
1327
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("button", { type: "button", onClick: () => setTimerPreset(3), children: "3m" }),
1328
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("button", { type: "button", onClick: () => setTimerPreset(5), children: "5m" }),
1329
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("button", { type: "button", onClick: () => setTimerPreset(10), children: "10m" }),
1330
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1331
+ "button",
1332
+ {
1333
+ type: "button",
1334
+ className: "is-accent",
1335
+ onClick: () => selectionService.setTimerState({ running: !timer.running }),
1336
+ children: timer.running ? "\u6682\u505C" : "\u5F00\u59CB"
1337
+ }
1338
+ ),
1339
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1340
+ "button",
1341
+ {
1342
+ type: "button",
1343
+ onClick: () => selectionService.setTimerState({
1344
+ remainingSec: timer.durationSec,
1345
+ running: false
1346
+ }),
1347
+ children: "\u91CD\u7F6E"
1348
+ }
1349
+ )
1350
+ ] }),
1351
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "yudao-boards-export-group", "data-testid": "boards-export-bar", children: [
1352
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(BoardDownloadIcon, {}),
1353
+ ["svg", "png", "pdf", "pptx", "csv"].map((fmt) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1354
+ "button",
1355
+ {
1356
+ type: "button",
1357
+ className: "yudao-boards-export-chip",
1358
+ "data-testid": `boards-export-${fmt}`,
1359
+ onClick: () => void commandService.executeCommand(ExportBoardFileOperation.id, { format: fmt }),
1360
+ children: fmt.toUpperCase()
1361
+ },
1362
+ fmt
1363
+ )),
1364
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1365
+ "button",
1366
+ {
1367
+ type: "button",
1368
+ className: "yudao-boards-top-btn",
1369
+ onClick: () => commandService.syncExecuteCommand(ToggleBoardInspectorOperation.id),
1370
+ title: "\u5207\u6362\u53F3\u4FA7\u5C5E\u6027\u68C0\u67E5\u5668",
1371
+ children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(BoardInspectorIcon, {})
1372
+ }
1373
+ )
1374
+ ] })
1375
+ ]
1376
+ }
1377
+ ),
1378
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
1379
+ "div",
1380
+ {
1381
+ className: "yudao-boards-creation-dock",
1382
+ "data-testid": "boards-creation-dock",
1383
+ onPointerDown: (e) => e.stopPropagation(),
1384
+ children: [
1385
+ dockItems.map((item) => {
1386
+ const isActive = activeTool === item.tool;
1387
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
1388
+ "button",
1389
+ {
1390
+ type: "button",
1391
+ className: `yudao-boards-dock-btn ${isActive ? "is-active" : ""}`,
1392
+ title: item.label,
1393
+ "data-testid": `boards-dock-${item.tool}`,
1394
+ onClick: () => {
1395
+ if (item.onClick) {
1396
+ item.onClick();
1397
+ } else {
1398
+ selectionService.setActiveTool(item.tool);
1399
+ setShapeMenuOpen(false);
1400
+ setWidgetMenuOpen(false);
1401
+ }
1402
+ },
1403
+ children: [
1404
+ item.icon,
1405
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "yudao-boards-dock-label", children: item.label })
1406
+ ]
1407
+ },
1408
+ item.tool
1409
+ );
1410
+ }),
1411
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "yudao-boards-dock-divider" }),
1412
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
1413
+ "button",
1414
+ {
1415
+ type: "button",
1416
+ className: "yudao-boards-dock-btn is-mermaid",
1417
+ "data-testid": "boards-dock-mermaid",
1418
+ title: "\u6D41\u7A0B\u56FE\u4EE3\u7801\u4E92\u8F6C (Mermaid)",
1419
+ onClick: () => commandService.syncExecuteCommand(OpenBoardMermaidModalOperation.id, { open: true }),
1420
+ children: [
1421
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(BoardMermaidIcon, {}),
1422
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "yudao-boards-dock-label", children: "\u6D41\u7A0B\u56FE\u4EE3\u7801\u4E92\u8F6C (Mermaid)" })
1423
+ ]
1424
+ }
1425
+ ),
1426
+ shapeMenuOpen && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "yudao-boards-dock-popover", "data-testid": "boards-shape-popover", children: QUICK_SHAPES.map((s) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1427
+ "button",
1428
+ {
1429
+ type: "button",
1430
+ className: activeShapeType === s.type ? "is-selected" : "",
1431
+ onClick: () => {
1432
+ selectionService.setActiveShapeType(s.type);
1433
+ selectionService.setActiveTool("shape");
1434
+ setShapeMenuOpen(false);
1435
+ },
1436
+ children: s.label
1437
+ },
1438
+ s.type
1439
+ )) }),
1440
+ widgetMenuOpen && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "yudao-boards-dock-popover", children: [
1441
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1442
+ "button",
1443
+ {
1444
+ type: "button",
1445
+ onClick: () => {
1446
+ selectionService.setActiveTool("chart");
1447
+ setWidgetMenuOpen(false);
1448
+ },
1449
+ children: "\u63D2\u5165\u77E2\u91CF\u56FE\u8868 (Chart)"
1450
+ }
1451
+ ),
1452
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1453
+ "button",
1454
+ {
1455
+ type: "button",
1456
+ onClick: () => {
1457
+ selectionService.setActiveTool("table");
1458
+ setWidgetMenuOpen(false);
1459
+ },
1460
+ children: "\u63D2\u5165\u6570\u636E\u7F51\u683C\u8868 (Table)"
1461
+ }
1462
+ )
1463
+ ] })
1464
+ ]
1465
+ }
1466
+ ),
1467
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
1468
+ "div",
1469
+ {
1470
+ className: "yudao-boards-world",
1471
+ style: {
1472
+ transform: `translate(${panX}px, ${panY}px) scale(${zoom})`,
1473
+ transformOrigin: "0 0"
1474
+ },
1475
+ children: [
1476
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("svg", { className: "yudao-boards-vector-overlay", overflow: "visible", children: [
1477
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("defs", { children: [
1478
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1479
+ "marker",
1480
+ {
1481
+ id: "canvas-marker-arrow",
1482
+ viewBox: "0 0 10 10",
1483
+ refX: "9",
1484
+ refY: "5",
1485
+ markerWidth: "7",
1486
+ markerHeight: "7",
1487
+ orient: "auto-start-reverse",
1488
+ children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M 0 1.5 L 9 5 L 0 8.5 z", fill: "context-stroke" })
1489
+ }
1490
+ ),
1491
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1492
+ "marker",
1493
+ {
1494
+ id: "canvas-marker-triangle",
1495
+ viewBox: "0 0 12 12",
1496
+ refX: "11",
1497
+ refY: "6",
1498
+ markerWidth: "9",
1499
+ markerHeight: "9",
1500
+ orient: "auto-start-reverse",
1501
+ children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1502
+ "path",
1503
+ {
1504
+ d: "M 1 1.5 L 11 6 L 1 10.5 z",
1505
+ fill: "#FFFFFF",
1506
+ stroke: "context-stroke",
1507
+ strokeWidth: "1.5"
1508
+ }
1509
+ )
1510
+ }
1511
+ ),
1512
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1513
+ "marker",
1514
+ {
1515
+ id: "canvas-marker-diamond",
1516
+ viewBox: "0 0 14 10",
1517
+ refX: "13",
1518
+ refY: "5",
1519
+ markerWidth: "10",
1520
+ markerHeight: "8",
1521
+ orient: "auto-start-reverse",
1522
+ children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1523
+ "path",
1524
+ {
1525
+ d: "M 1 5 L 7 1 L 13 5 L 7 9 z",
1526
+ fill: "#FFFFFF",
1527
+ stroke: "context-stroke",
1528
+ strokeWidth: "1.5"
1529
+ }
1530
+ )
1531
+ }
1532
+ ),
1533
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1534
+ "marker",
1535
+ {
1536
+ id: "canvas-marker-filledDiamond",
1537
+ viewBox: "0 0 14 10",
1538
+ refX: "13",
1539
+ refY: "5",
1540
+ markerWidth: "10",
1541
+ markerHeight: "8",
1542
+ orient: "auto-start-reverse",
1543
+ children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M 1 5 L 7 1 L 13 5 L 7 9 z", fill: "context-stroke" })
1544
+ }
1545
+ ),
1546
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1547
+ "marker",
1548
+ {
1549
+ id: "canvas-marker-crowsFootOne",
1550
+ viewBox: "0 0 12 12",
1551
+ refX: "10",
1552
+ refY: "6",
1553
+ markerWidth: "9",
1554
+ markerHeight: "9",
1555
+ orient: "auto-start-reverse",
1556
+ children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1557
+ "path",
1558
+ {
1559
+ d: "M 6 1 L 6 11 M 10 1 L 10 11",
1560
+ fill: "none",
1561
+ stroke: "context-stroke",
1562
+ strokeWidth: "1.6"
1563
+ }
1564
+ )
1565
+ }
1566
+ ),
1567
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1568
+ "marker",
1569
+ {
1570
+ id: "canvas-marker-crowsFootMany",
1571
+ viewBox: "0 0 14 12",
1572
+ refX: "12",
1573
+ refY: "6",
1574
+ markerWidth: "10",
1575
+ markerHeight: "9",
1576
+ orient: "auto-start-reverse",
1577
+ children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1578
+ "path",
1579
+ {
1580
+ d: "M 2 6 L 12 1 M 2 6 L 12 6 M 2 6 L 12 11 M 2 1 L 2 11",
1581
+ fill: "none",
1582
+ stroke: "context-stroke",
1583
+ strokeWidth: "1.5"
1584
+ }
1585
+ )
1586
+ }
1587
+ )
1588
+ ] }),
1589
+ visibleMindmaps.map((mm) => {
1590
+ if (!mm.parentId) return null;
1591
+ const parent = effectiveElementsMap[mm.parentId];
1592
+ if (!parent || parent.type !== "mindmap" || parent.collapsed) return null;
1593
+ const isLeft = mm.x + mm.width / 2 < parent.x + parent.width / 2;
1594
+ const sx = isLeft ? parent.x : parent.x + parent.width;
1595
+ const sy = parent.y + parent.height / 2;
1596
+ const ex = isLeft ? mm.x + mm.width : mm.x;
1597
+ const ey = mm.y + mm.height / 2;
1598
+ const mx = (sx + ex) / 2;
1599
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1600
+ "path",
1601
+ {
1602
+ d: `M ${sx} ${sy} C ${mx} ${sy}, ${mx} ${ey}, ${ex} ${ey}`,
1603
+ fill: "none",
1604
+ stroke: mm.branchColor || parent.branchColor || "#2563EB",
1605
+ strokeWidth: 2.4,
1606
+ strokeLinecap: "round"
1607
+ },
1608
+ `mm-branch-${mm.id}`
1609
+ );
1610
+ }),
1611
+ connectors.map((conn) => {
1612
+ const routed = (0, import_univer_boards2.computeBoardConnectorPath)(conn, effectiveElementsMap);
1613
+ const isSelected = selectedIds.includes(conn.id);
1614
+ const mStart = conn.startMarker && conn.startMarker !== "none" ? `url(#canvas-marker-${conn.startMarker})` : void 0;
1615
+ const mEnd = conn.endMarker && conn.endMarker !== "none" ? `url(#canvas-marker-${conn.endMarker})` : void 0;
1616
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
1617
+ "g",
1618
+ {
1619
+ "data-element-id": conn.id,
1620
+ "data-element-type": "connector",
1621
+ className: "yudao-boards-connector-group",
1622
+ onPointerDown: (e) => {
1623
+ e.stopPropagation();
1624
+ selectionService.selectElements([conn.id]);
1625
+ },
1626
+ children: [
1627
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1628
+ "path",
1629
+ {
1630
+ d: routed.svgPath,
1631
+ fill: "none",
1632
+ stroke: "transparent",
1633
+ strokeWidth: 14,
1634
+ style: { pointerEvents: "stroke", cursor: "pointer" }
1635
+ }
1636
+ ),
1637
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1638
+ "path",
1639
+ {
1640
+ d: routed.svgPath,
1641
+ fill: "none",
1642
+ stroke: isSelected ? "#2563EB" : conn.stroke,
1643
+ strokeWidth: isSelected ? conn.strokeWidth + 1 : conn.strokeWidth,
1644
+ strokeDasharray: conn.dashed ? "6 4" : void 0,
1645
+ strokeLinecap: "round",
1646
+ strokeLinejoin: "round",
1647
+ markerStart: mStart,
1648
+ markerEnd: mEnd
1649
+ }
1650
+ ),
1651
+ conn.label && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("g", { transform: `translate(${routed.labelPosition.x}, ${routed.labelPosition.y})`, children: [
1652
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1653
+ "rect",
1654
+ {
1655
+ x: -Math.max(24, conn.label.length * 6 + 8),
1656
+ y: -11,
1657
+ width: Math.max(48, conn.label.length * 12 + 16),
1658
+ height: 22,
1659
+ rx: 6,
1660
+ fill: "#FFFFFF",
1661
+ stroke: isSelected ? "#2563EB" : "#CBD5E1",
1662
+ strokeWidth: 1
1663
+ }
1664
+ ),
1665
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1666
+ "text",
1667
+ {
1668
+ x: 0,
1669
+ y: 4,
1670
+ textAnchor: "middle",
1671
+ fontSize: 11,
1672
+ fontWeight: 600,
1673
+ fill: "#334155",
1674
+ children: conn.label
1675
+ }
1676
+ )
1677
+ ] })
1678
+ ]
1679
+ },
1680
+ conn.id
1681
+ );
1682
+ }),
1683
+ orderedElements.filter((el) => el.type === "ink").map((ink) => {
1684
+ if (ink.type !== "ink" || ink.points.length === 0) return null;
1685
+ const d = ink.points.map((p, idx) => `${idx === 0 ? "M" : "L"} ${p.x} ${p.y}`).join(" ");
1686
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1687
+ "path",
1688
+ {
1689
+ "data-element-id": ink.id,
1690
+ d,
1691
+ fill: "none",
1692
+ stroke: ink.stroke,
1693
+ strokeWidth: ink.strokeWidth,
1694
+ opacity: ink.opacity,
1695
+ strokeLinecap: "round",
1696
+ strokeLinejoin: "round",
1697
+ style: { pointerEvents: "stroke", cursor: "pointer" },
1698
+ onPointerDown: (e) => handleElementPointerDown(e, ink)
1699
+ },
1700
+ ink.id
1701
+ );
1702
+ }),
1703
+ inkDraft && inkDraft.length >= 2 && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1704
+ "path",
1705
+ {
1706
+ d: inkDraft.map((p, idx) => `${idx === 0 ? "M" : "L"} ${p.x} ${p.y}`).join(" "),
1707
+ fill: "none",
1708
+ stroke: "#2563EB",
1709
+ strokeWidth: 3,
1710
+ strokeLinecap: "round",
1711
+ strokeLinejoin: "round"
1712
+ }
1713
+ ),
1714
+ connectingDraft && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1715
+ "line",
1716
+ {
1717
+ x1: connectingDraft.startX,
1718
+ y1: connectingDraft.startY,
1719
+ x2: connectingDraft.currX,
1720
+ y2: connectingDraft.currY,
1721
+ stroke: "#2563EB",
1722
+ strokeWidth: 2,
1723
+ strokeDasharray: "5 4",
1724
+ markerEnd: "url(#canvas-marker-arrow)"
1725
+ }
1726
+ ),
1727
+ laserTrail.length >= 2 && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1728
+ "polyline",
1729
+ {
1730
+ points: laserTrail.map((p) => `${p.x},${p.y}`).join(" "),
1731
+ fill: "none",
1732
+ stroke: "#EF4444",
1733
+ strokeWidth: 4,
1734
+ strokeLinecap: "round",
1735
+ strokeLinejoin: "round",
1736
+ opacity: 0.85
1737
+ }
1738
+ )
1739
+ ] }),
1740
+ orderedElements.map((el) => {
1741
+ if (el.type === "connector" || el.type === "ink") return null;
1742
+ if (el.type === "mindmap" && (0, import_univer_boards2.isMindmapNodeCollapsedHidden)(el, effectiveElementsMap)) {
1743
+ return null;
1744
+ }
1745
+ const isSelected = selectedIds.includes(el.id);
1746
+ const isEditing = editingId === el.id;
1747
+ const isHovered = hoveredElementId === el.id;
1748
+ const showPorts = el.type !== "frame" && el.type !== "swimlane" && (isHovered || isSelected || activeTool === "connector");
1749
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
1750
+ "div",
1751
+ {
1752
+ "data-element-id": el.id,
1753
+ "data-element-type": el.type,
1754
+ className: `yudao-boards-element is-${el.type} ${isSelected ? "is-selected" : ""}`,
1755
+ style: {
1756
+ left: el.x,
1757
+ top: el.y,
1758
+ width: el.width,
1759
+ height: el.height,
1760
+ transform: el.rotation ? `rotate(${el.rotation}deg)` : void 0
1761
+ },
1762
+ onPointerEnter: () => setHoveredElementId(el.id),
1763
+ onPointerLeave: () => setHoveredElementId((curr) => curr === el.id ? null : curr),
1764
+ onPointerDown: (e) => handleElementPointerDown(e, el),
1765
+ onDoubleClick: (e) => {
1766
+ e.stopPropagation();
1767
+ startInlineEdit(el);
1768
+ },
1769
+ children: [
1770
+ el.type === "frame" && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1771
+ "div",
1772
+ {
1773
+ className: "yudao-boards-frame-box",
1774
+ style: {
1775
+ backgroundColor: el.backgroundColor ?? "#FFFFFF",
1776
+ borderColor: el.borderColor ?? "#CBD5E1"
1777
+ },
1778
+ children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "yudao-boards-frame-header-pill", children: isEditing ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1779
+ "input",
1780
+ {
1781
+ autoFocus: true,
1782
+ value: editingDraft,
1783
+ onChange: (e) => setEditingDraft(e.target.value),
1784
+ onBlur: commitInlineEdit,
1785
+ onKeyDown: (e) => e.key === "Enter" && commitInlineEdit()
1786
+ }
1787
+ ) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: el.title }) })
1788
+ }
1789
+ ),
1790
+ el.type === "swimlane" && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
1791
+ "div",
1792
+ {
1793
+ className: "yudao-boards-swimlane-box",
1794
+ style: { borderColor: el.borderColor ?? "#94A3B8" },
1795
+ children: [
1796
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "yudao-boards-swimlane-header", children: el.title }),
1797
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1798
+ "div",
1799
+ {
1800
+ className: `yudao-boards-swimlane-lanes is-${el.orientation}`,
1801
+ children: el.lanes.map((lane) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1802
+ "div",
1803
+ {
1804
+ className: "yudao-boards-swimlane-lane",
1805
+ style: { backgroundColor: lane.color ?? "#F8FAFC" },
1806
+ children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "yudao-boards-swimlane-lane-title", children: lane.title })
1807
+ },
1808
+ lane.id
1809
+ ))
1810
+ }
1811
+ )
1812
+ ]
1813
+ }
1814
+ ),
1815
+ el.type === "sticky" && (() => {
1816
+ const sticky = el;
1817
+ const pal = (0, import_univer_boards2.resolveStickyPalette)(sticky.color);
1818
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
1819
+ "div",
1820
+ {
1821
+ className: "yudao-boards-sticky-card",
1822
+ style: {
1823
+ backgroundColor: pal.fill,
1824
+ borderColor: pal.border,
1825
+ color: pal.text
1826
+ },
1827
+ children: [
1828
+ isEditing ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1829
+ "textarea",
1830
+ {
1831
+ autoFocus: true,
1832
+ className: "yudao-boards-inline-editor",
1833
+ value: editingDraft,
1834
+ onChange: (e) => setEditingDraft(e.target.value),
1835
+ onBlur: commitInlineEdit
1836
+ }
1837
+ ) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "yudao-boards-sticky-text", children: sticky.text }),
1838
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "yudao-boards-sticky-footer", children: [
1839
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "yudao-boards-sticky-author", children: sticky.author ?? "" }),
1840
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
1841
+ "button",
1842
+ {
1843
+ type: "button",
1844
+ className: "yudao-boards-vote-btn",
1845
+ "data-testid": `sticky-vote-${sticky.id}`,
1846
+ style: { backgroundColor: pal.badgeFill, borderColor: pal.border },
1847
+ onPointerDown: (e) => e.stopPropagation(),
1848
+ onClick: (e) => {
1849
+ e.stopPropagation();
1850
+ commandService.syncExecuteCommand(import_univer_boards2.VoteBoardStickyCommand.id, {
1851
+ unitId,
1852
+ elementId: sticky.id
1853
+ });
1854
+ },
1855
+ children: [
1856
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(BoardVoteThumbIcon, {}),
1857
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { children: [
1858
+ "+",
1859
+ sticky.votes.length
1860
+ ] })
1861
+ ]
1862
+ }
1863
+ )
1864
+ ] })
1865
+ ]
1866
+ }
1867
+ );
1868
+ })(),
1869
+ el.type === "shape" && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "yudao-boards-shape-card", children: [
1870
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1871
+ "svg",
1872
+ {
1873
+ width: el.width,
1874
+ height: el.height,
1875
+ viewBox: `0 0 ${el.width} ${el.height}`,
1876
+ className: "yudao-boards-shape-svg",
1877
+ children: renderShapeNode(el)
1878
+ }
1879
+ ),
1880
+ isEditing ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1881
+ "textarea",
1882
+ {
1883
+ autoFocus: true,
1884
+ className: "yudao-boards-inline-editor is-centered",
1885
+ value: editingDraft,
1886
+ onChange: (e) => setEditingDraft(e.target.value),
1887
+ onBlur: commitInlineEdit
1888
+ }
1889
+ ) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1890
+ "div",
1891
+ {
1892
+ className: `yudao-boards-shape-label ${el.shapeType === "actor" ? "is-actor-label" : ""}`,
1893
+ style: { color: el.textColor, fontSize: el.fontSize ?? 13 },
1894
+ children: el.text
1895
+ }
1896
+ )
1897
+ ] }),
1898
+ el.type === "text" && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1899
+ "div",
1900
+ {
1901
+ className: "yudao-boards-text-block",
1902
+ style: {
1903
+ fontSize: el.fontSize,
1904
+ fontWeight: el.fontWeight,
1905
+ color: el.color,
1906
+ textAlign: el.align
1907
+ },
1908
+ children: isEditing ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1909
+ "textarea",
1910
+ {
1911
+ autoFocus: true,
1912
+ className: "yudao-boards-inline-editor",
1913
+ value: editingDraft,
1914
+ onChange: (e) => setEditingDraft(e.target.value),
1915
+ onBlur: commitInlineEdit
1916
+ }
1917
+ ) : el.text
1918
+ }
1919
+ ),
1920
+ el.type === "mindmap" && (() => {
1921
+ const mm = el;
1922
+ const isRoot = !mm.parentId;
1923
+ const hasChildren = Object.values(currentSnap.elements).some(
1924
+ (c) => c.type === "mindmap" && c.parentId === mm.id
1925
+ );
1926
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
1927
+ "div",
1928
+ {
1929
+ className: `yudao-boards-mindmap-pill ${isRoot ? "is-root" : ""}`,
1930
+ style: {
1931
+ backgroundColor: mm.fill ?? (isRoot ? "#2563EB" : "#FFFFFF"),
1932
+ borderColor: mm.branchColor ?? "#2563EB",
1933
+ color: mm.textColor ?? (isRoot ? "#FFFFFF" : "#0F172A")
1934
+ },
1935
+ children: [
1936
+ isEditing ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1937
+ "textarea",
1938
+ {
1939
+ autoFocus: true,
1940
+ className: "yudao-boards-inline-editor is-centered",
1941
+ value: editingDraft,
1942
+ onChange: (e) => setEditingDraft(e.target.value),
1943
+ onBlur: commitInlineEdit
1944
+ }
1945
+ ) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "yudao-boards-mindmap-text", children: mm.text }),
1946
+ hasChildren && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1947
+ "button",
1948
+ {
1949
+ type: "button",
1950
+ className: "yudao-boards-mm-collapse-btn",
1951
+ title: mm.collapsed ? "\u5C55\u5F00\u5B50\u5206\u652F" : "\u6298\u53E0\u5B50\u5206\u652F",
1952
+ onPointerDown: (e) => e.stopPropagation(),
1953
+ onClick: (e) => {
1954
+ e.stopPropagation();
1955
+ commandService.syncExecuteCommand(import_univer_boards2.UpdateBoardElementsCommand.id, {
1956
+ unitId,
1957
+ updates: [{ id: mm.id, patch: { collapsed: !mm.collapsed } }]
1958
+ });
1959
+ },
1960
+ children: mm.collapsed ? "+" : "-"
1961
+ }
1962
+ ),
1963
+ isSelected && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
1964
+ "div",
1965
+ {
1966
+ className: "yudao-boards-mm-quick-actions",
1967
+ onPointerDown: (e) => e.stopPropagation(),
1968
+ children: [
1969
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1970
+ "button",
1971
+ {
1972
+ type: "button",
1973
+ onClick: () => commandService.syncExecuteCommand(import_univer_boards2.AddMindmapChildCommand.id, {
1974
+ unitId,
1975
+ parentId: mm.id
1976
+ }),
1977
+ children: "+ \u5B50\u8282\u70B9"
1978
+ }
1979
+ ),
1980
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
1981
+ "button",
1982
+ {
1983
+ type: "button",
1984
+ onClick: () => commandService.syncExecuteCommand(import_univer_boards2.AddMindmapSiblingCommand.id, {
1985
+ unitId,
1986
+ nodeId: mm.id
1987
+ }),
1988
+ children: "+ \u540C\u7EA7"
1989
+ }
1990
+ )
1991
+ ]
1992
+ }
1993
+ )
1994
+ ]
1995
+ }
1996
+ );
1997
+ })(),
1998
+ el.type === "entityCard" && (() => {
1999
+ const card = el;
2000
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "yudao-boards-entity-card", children: [
2001
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
2002
+ "div",
2003
+ {
2004
+ className: "yudao-boards-entity-header",
2005
+ style: {
2006
+ backgroundColor: card.headerColor ?? (card.cardKind === "uml" ? "#7C3AED" : "#1D4ED8")
2007
+ },
2008
+ children: [
2009
+ card.stereotype && /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "yudao-boards-entity-stereo", children: [
2010
+ "<<",
2011
+ card.stereotype,
2012
+ ">>"
2013
+ ] }),
2014
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "yudao-boards-entity-title", children: card.title })
2015
+ ]
2016
+ }
2017
+ ),
2018
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "yudao-boards-entity-body", children: [
2019
+ card.fields.map((f, idx) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "yudao-boards-entity-row", children: [
2020
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { className: "yudao-boards-entity-col-name", children: [
2021
+ f.pk && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("b", { className: "is-pk", children: "PK" }),
2022
+ f.fk && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("b", { className: "is-fk", children: "FK" }),
2023
+ f.visibility && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("code", { children: f.visibility }),
2024
+ f.name
2025
+ ] }),
2026
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "yudao-boards-entity-col-type", children: f.type })
2027
+ ] }, `${f.name}-${idx}`)),
2028
+ card.methods && card.methods.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "yudao-boards-entity-methods", children: card.methods.map((m, mIdx) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "yudao-boards-entity-method", children: m }, `${m}-${mIdx}`)) })
2029
+ ] })
2030
+ ] });
2031
+ })(),
2032
+ el.type === "table" && renderInlineTable(el),
2033
+ el.type === "chart" && renderInlineChart(el),
2034
+ el.type === "image" && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
2035
+ "img",
2036
+ {
2037
+ src: el.src,
2038
+ alt: el.caption ?? "board-image",
2039
+ className: "yudao-boards-image-el",
2040
+ style: { objectFit: el.fit ?? "contain" },
2041
+ draggable: false
2042
+ }
2043
+ ),
2044
+ showPorts && PORT_SIDES.map((pSide) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
2045
+ "span",
2046
+ {
2047
+ className: `yudao-boards-port-dot is-${pSide}`,
2048
+ title: `\u62D6\u62FD\u4ECE ${pSide} \u7AEF\u53E3\u521B\u5EFA\u667A\u80FD\u8FDE\u7EBF`,
2049
+ onPointerDown: (e) => handlePortPointerDown(e, el, pSide)
2050
+ },
2051
+ pSide
2052
+ )),
2053
+ isSelected && !el.locked && RESIZE_HANDLES.map((dir) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
2054
+ "span",
2055
+ {
2056
+ className: `yudao-boards-resize-handle is-${dir}`,
2057
+ onPointerDown: (e) => handleResizePointerDown(e, el, dir)
2058
+ },
2059
+ dir
2060
+ ))
2061
+ ]
2062
+ },
2063
+ el.id
2064
+ );
2065
+ }),
2066
+ currentSnap.comments.map((pin, idx) => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
2067
+ "div",
2068
+ {
2069
+ className: "yudao-boards-comment-pin",
2070
+ style: { left: pin.x, top: pin.y },
2071
+ title: `${pin.author}: ${pin.text}`,
2072
+ children: [
2073
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "yudao-boards-pin-badge", children: idx + 1 }),
2074
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "yudao-boards-pin-popover", children: [
2075
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("strong", { children: pin.author }),
2076
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { children: pin.text })
2077
+ ] })
2078
+ ]
2079
+ },
2080
+ pin.id
2081
+ )),
2082
+ marqueeBox && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
2083
+ "div",
2084
+ {
2085
+ className: "yudao-boards-marquee",
2086
+ style: {
2087
+ left: Math.min(marqueeBox.x1, marqueeBox.x2),
2088
+ top: Math.min(marqueeBox.y1, marqueeBox.y2),
2089
+ width: Math.abs(marqueeBox.x2 - marqueeBox.x1),
2090
+ height: Math.abs(marqueeBox.y2 - marqueeBox.y1)
2091
+ }
2092
+ }
2093
+ )
2094
+ ]
2095
+ }
2096
+ ),
2097
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
2098
+ "div",
2099
+ {
2100
+ className: "yudao-boards-minimap",
2101
+ "data-testid": "boards-minimap",
2102
+ onPointerDown: (e) => e.stopPropagation(),
2103
+ children: [
2104
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "yudao-boards-minimap-header", children: [
2105
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: "\u9E70\u773C\u5C0F\u5730\u56FE" }),
2106
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
2107
+ "button",
2108
+ {
2109
+ type: "button",
2110
+ title: "\u9002\u5E94\u5C4F\u5E55",
2111
+ onClick: () => commandService.syncExecuteCommand(FitBoardToScreenOperation.id),
2112
+ children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(BoardFitScreenIcon, {})
2113
+ }
2114
+ )
2115
+ ] }),
2116
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
2117
+ "svg",
2118
+ {
2119
+ width: minimapW,
2120
+ height: minimapH,
2121
+ viewBox: `0 0 ${minimapW} ${minimapH}`,
2122
+ onClick: handleMinimapClick,
2123
+ children: [
2124
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("rect", { width: minimapW, height: minimapH, rx: 6, fill: "#F1F5F9" }),
2125
+ orderedElements.map((el) => {
2126
+ if (el.type === "connector" || el.type === "ink") return null;
2127
+ const rx = (el.x - worldBounds.x) * mmScale;
2128
+ const ry = (el.y - worldBounds.y) * mmScale;
2129
+ const rw = Math.max(3, el.width * mmScale);
2130
+ const rh = Math.max(2, el.height * mmScale);
2131
+ const fill = el.type === "frame" ? "#E2E8F0" : el.type === "sticky" ? "#FCD34D" : el.type === "entityCard" ? "#C4B5FD" : el.type === "mindmap" ? "#6EE7B7" : "#93C5FD";
2132
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
2133
+ "rect",
2134
+ {
2135
+ x: rx,
2136
+ y: ry,
2137
+ width: rw,
2138
+ height: rh,
2139
+ rx: 1.5,
2140
+ fill,
2141
+ stroke: "#64748B",
2142
+ strokeWidth: 0.4
2143
+ },
2144
+ `mm-${el.id}`
2145
+ );
2146
+ }),
2147
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
2148
+ "rect",
2149
+ {
2150
+ x: (viewWorldX - worldBounds.x) * mmScale,
2151
+ y: (viewWorldY - worldBounds.y) * mmScale,
2152
+ width: Math.max(12, viewWorldW * mmScale),
2153
+ height: Math.max(10, viewWorldH * mmScale),
2154
+ fill: "rgba(37, 99, 235, 0.12)",
2155
+ stroke: "#2563EB",
2156
+ strokeWidth: 1.4,
2157
+ rx: 2
2158
+ }
2159
+ )
2160
+ ]
2161
+ }
2162
+ )
2163
+ ]
2164
+ }
2165
+ )
2166
+ ]
2167
+ }
2168
+ );
2169
+ };
2170
+
2171
+ // src/views/footer/BoardsStatusBar.tsx
2172
+ var import_core3 = require("@univerjs/core");
2173
+ var import_ui3 = require("@univerjs/ui");
2174
+ var import_univer_boards3 = require("@yudaocode/univer-boards");
2175
+ var import_rxjs2 = require("rxjs");
2176
+ var import_jsx_runtime3 = require("react/jsx-runtime");
2177
+ var ZOOM_STEPS = [0.1, 0.25, 0.5, 0.75, 1, 1.25, 1.5, 2, 3, 4];
2178
+ var BoardsStatusBar = () => {
2179
+ const instanceService = (0, import_ui3.useDependency)(import_core3.IUniverInstanceService);
2180
+ const commandService = (0, import_ui3.useDependency)(import_core3.ICommandService);
2181
+ const selectionService = (0, import_ui3.useDependency)(import_univer_boards3.IBoardSelectionService);
2182
+ const unit = (0, import_ui3.useObservable)(
2183
+ () => instanceService.getCurrentTypeOfUnit$(import_core3.UniverInstanceType.UNIVER_BOARD),
2184
+ instanceService.getCurrentUnitOfType(import_core3.UniverInstanceType.UNIVER_BOARD),
2185
+ false,
2186
+ [instanceService]
2187
+ );
2188
+ const snapshot = (0, import_ui3.useObservable)(
2189
+ () => unit ? unit.snapshotChanged$ : (0, import_rxjs2.of)(null),
2190
+ unit ? unit.getSnapshot() : null,
2191
+ false,
2192
+ [unit]
2193
+ );
2194
+ const selectedIds = (0, import_ui3.useObservable)(
2195
+ selectionService.selectedIds$,
2196
+ selectionService.getSelectedIds()
2197
+ );
2198
+ const currentSnap = snapshot ?? unit?.getSnapshot() ?? null;
2199
+ if (!currentSnap || !unit) return null;
2200
+ const zoom = currentSnap.viewport.zoom;
2201
+ const totalCount = Object.keys(currentSnap.elements).length;
2202
+ const frameCount = currentSnap.frameOrder.length;
2203
+ const setZoom = (nextZoom) => {
2204
+ const clamped = Math.max(0.1, Math.min(4, Number(nextZoom.toFixed(2))));
2205
+ commandService.syncExecuteCommand(import_univer_boards3.SetBoardViewportCommand.id, {
2206
+ unitId: unit.getUnitId(),
2207
+ viewport: { zoom: clamped }
2208
+ });
2209
+ };
2210
+ const cycleGrid = () => {
2211
+ const order = ["dots", "lines", "none"];
2212
+ const next = order[(order.indexOf(currentSnap.gridStyle) + 1) % order.length];
2213
+ commandService.syncExecuteCommand(import_univer_boards3.UpdateBoardPropsCommand.id, {
2214
+ unitId: unit.getUnitId(),
2215
+ patch: { gridStyle: next }
2216
+ });
2217
+ };
2218
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("footer", { className: "yudao-boards-status-bar", "data-testid": "boards-status-bar", children: [
2219
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "yudao-boards-status-left", children: [
2220
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("span", { children: [
2221
+ "\u5143\u7D20\u603B\u6570\uFF1A",
2222
+ totalCount
2223
+ ] }),
2224
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("span", { children: [
2225
+ "\u6F14\u793A\u753B\u6846\uFF1A",
2226
+ frameCount
2227
+ ] }),
2228
+ selectedIds.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("span", { children: [
2229
+ "\u5DF2\u9009\u4E2D\uFF1A",
2230
+ selectedIds.length
2231
+ ] })
2232
+ ] }),
2233
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "yudao-boards-status-right", children: [
2234
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
2235
+ "button",
2236
+ {
2237
+ type: "button",
2238
+ className: "yudao-boards-status-btn",
2239
+ onClick: cycleGrid,
2240
+ title: "\u5207\u6362\u753B\u5E03\u7F51\u683C\u6837\u5F0F",
2241
+ children: [
2242
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(BoardGridIcon, {}),
2243
+ " \u7F51\u683C: ",
2244
+ currentSnap.gridStyle
2245
+ ]
2246
+ }
2247
+ ),
2248
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
2249
+ "button",
2250
+ {
2251
+ type: "button",
2252
+ className: "yudao-boards-status-btn",
2253
+ onClick: () => commandService.syncExecuteCommand(FitBoardToScreenOperation.id),
2254
+ title: "\u9002\u5E94\u5C4F\u5E55",
2255
+ children: [
2256
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(BoardFitScreenIcon, {}),
2257
+ " \u9002\u5E94\u5168\u5C4F"
2258
+ ]
2259
+ }
2260
+ ),
2261
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "yudao-boards-zoom-controls", children: [
2262
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { type: "button", onClick: () => setZoom(zoom - 0.15), children: "-" }),
2263
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
2264
+ "select",
2265
+ {
2266
+ value: String(Math.round(zoom * 100)),
2267
+ onChange: (e) => setZoom(Number(e.target.value) / 100),
2268
+ children: [
2269
+ !ZOOM_STEPS.some((z) => Math.round(z * 100) === Math.round(zoom * 100)) && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("option", { value: String(Math.round(zoom * 100)), children: [
2270
+ Math.round(zoom * 100),
2271
+ "%"
2272
+ ] }),
2273
+ ZOOM_STEPS.map((z) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("option", { value: String(Math.round(z * 100)), children: [
2274
+ Math.round(z * 100),
2275
+ "%"
2276
+ ] }, z))
2277
+ ]
2278
+ }
2279
+ ),
2280
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { type: "button", onClick: () => setZoom(zoom + 0.15), children: "+" })
2281
+ ] })
2282
+ ] })
2283
+ ] });
2284
+ };
2285
+
2286
+ // src/views/inspector/BoardsInspectorPanel.tsx
2287
+ var import_core4 = require("@univerjs/core");
2288
+ var import_ui4 = require("@univerjs/ui");
2289
+ var import_univer_boards4 = require("@yudaocode/univer-boards");
2290
+ var import_rxjs3 = require("rxjs");
2291
+ var import_jsx_runtime4 = require("react/jsx-runtime");
2292
+ var SHAPE_TYPES = [
2293
+ { value: "rect", label: "\u77E9\u5F62 (Rect)" },
2294
+ { value: "roundRect", label: "\u5706\u89D2\u77E9\u5F62 (Round)" },
2295
+ { value: "diamond", label: "\u5224\u5B9A\u83F1\u5F62 (Diamond)" },
2296
+ { value: "ellipse", label: "\u692D\u5706/\u5706 (Ellipse)" },
2297
+ { value: "parallelogram", label: "\u5E73\u884C\u56DB\u8FB9\u5F62 (I/O)" },
2298
+ { value: "cylinder", label: "\u6570\u636E\u5E93\u5706\u67F1 (DB)" },
2299
+ { value: "hexagon", label: "\u516D\u8FB9\u5F62\u7F51\u5173 (Hex)" },
2300
+ { value: "cloud", label: "\u4E91\u8282\u70B9 (Cloud)" },
2301
+ { value: "document", label: "\u6587\u6863\u8282\u70B9 (Doc)" },
2302
+ { value: "actor", label: "\u53C2\u4E0E\u8005 (Actor)" },
2303
+ { value: "callout", label: "\u6807\u6CE8\u6C14\u6CE1 (Callout)" }
2304
+ ];
2305
+ var MARKER_OPTIONS = [
2306
+ { value: "none", label: "\u65E0\u7AEF\u70B9 (None)" },
2307
+ { value: "arrow", label: "\u6807\u51C6\u7BAD\u5934 (Arrow)" },
2308
+ { value: "triangle", label: "UML \u7EE7\u627F\u7A7A\u5FC3\u4E09\u89D2" },
2309
+ { value: "diamond", label: "UML \u805A\u5408\u7A7A\u5FC3\u83F1\u5F62" },
2310
+ { value: "filledDiamond", label: "UML \u7EC4\u5408\u5B9E\u5FC3\u83F1\u5F62" },
2311
+ { value: "crowsFootOne", label: "ER \u4E00\u5BF9\u4E00 (||)" },
2312
+ { value: "crowsFootMany", label: "ER \u4E00\u5BF9\u591A (o{)" }
2313
+ ];
2314
+ var BoardsInspectorPanel = () => {
2315
+ const instanceService = (0, import_ui4.useDependency)(import_core4.IUniverInstanceService);
2316
+ const commandService = (0, import_ui4.useDependency)(import_core4.ICommandService);
2317
+ const selectionService = (0, import_ui4.useDependency)(import_univer_boards4.IBoardSelectionService);
2318
+ const unit = (0, import_ui4.useObservable)(
2319
+ () => instanceService.getCurrentTypeOfUnit$(import_core4.UniverInstanceType.UNIVER_BOARD),
2320
+ instanceService.getCurrentUnitOfType(import_core4.UniverInstanceType.UNIVER_BOARD),
2321
+ false,
2322
+ [instanceService]
2323
+ );
2324
+ const snapshot = (0, import_ui4.useObservable)(
2325
+ () => unit ? unit.snapshotChanged$ : (0, import_rxjs3.of)(null),
2326
+ unit ? unit.getSnapshot() : null,
2327
+ false,
2328
+ [unit]
2329
+ );
2330
+ const selectedIds = (0, import_ui4.useObservable)(
2331
+ selectionService.selectedIds$,
2332
+ selectionService.getSelectedIds()
2333
+ );
2334
+ const currentSnap = snapshot ?? unit?.getSnapshot() ?? null;
2335
+ if (!currentSnap || !unit) {
2336
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "yudao-boards-inspector", children: "\u6682\u65E0\u6D3B\u8DC3\u767D\u677F" });
2337
+ }
2338
+ const unitId = unit.getUnitId();
2339
+ const selectedElements = selectedIds.map((id) => currentSnap.elements[id]).filter((el) => Boolean(el));
2340
+ const primary = selectedElements[0] ?? null;
2341
+ const patchElement = (id, patch) => {
2342
+ commandService.syncExecuteCommand(import_univer_boards4.UpdateBoardElementsCommand.id, {
2343
+ unitId,
2344
+ updates: [{ id, patch }]
2345
+ });
2346
+ };
2347
+ const runAlign = (alignment) => {
2348
+ commandService.syncExecuteCommand(import_univer_boards4.AlignBoardElementsCommand.id, {
2349
+ unitId,
2350
+ elementIds: selectedIds,
2351
+ alignment
2352
+ });
2353
+ };
2354
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "yudao-boards-inspector", "data-testid": "boards-inspector-panel", children: [
2355
+ selectedElements.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "yudao-boards-inspector-group", children: [
2356
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "yudao-boards-inspector-heading", children: "\u753B\u5E03\u5168\u5C40\u8BBE\u7F6E" }),
2357
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "yudao-boards-field-row", children: [
2358
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "\u767D\u677F\u540D\u79F0" }),
2359
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
2360
+ "input",
2361
+ {
2362
+ type: "text",
2363
+ value: currentSnap.name,
2364
+ onChange: (e) => commandService.syncExecuteCommand(import_univer_boards4.UpdateBoardPropsCommand.id, {
2365
+ unitId,
2366
+ patch: { name: e.target.value }
2367
+ })
2368
+ }
2369
+ )
2370
+ ] }),
2371
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "yudao-boards-field-row", children: [
2372
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "\u7F51\u683C\u6837\u5F0F" }),
2373
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
2374
+ "select",
2375
+ {
2376
+ value: currentSnap.gridStyle,
2377
+ onChange: (e) => commandService.syncExecuteCommand(import_univer_boards4.UpdateBoardPropsCommand.id, {
2378
+ unitId,
2379
+ patch: { gridStyle: e.target.value }
2380
+ }),
2381
+ children: [
2382
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value: "dots", children: "\u70B9\u9635\u7F51\u683C (Dots)" }),
2383
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value: "lines", children: "\u65B9\u683C\u8F85\u52A9\u7EBF (Lines)" }),
2384
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value: "none", children: "\u7EAF\u8272\u65E0\u7F51\u683C (None)" })
2385
+ ]
2386
+ }
2387
+ )
2388
+ ] }),
2389
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "yudao-boards-field-row", children: [
2390
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "\u753B\u5E03\u5E95\u8272" }),
2391
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
2392
+ "input",
2393
+ {
2394
+ type: "color",
2395
+ value: currentSnap.backgroundColor || "#F8FAFC",
2396
+ onChange: (e) => commandService.syncExecuteCommand(import_univer_boards4.UpdateBoardPropsCommand.id, {
2397
+ unitId,
2398
+ patch: { backgroundColor: e.target.value }
2399
+ })
2400
+ }
2401
+ )
2402
+ ] }),
2403
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "yudao-boards-checkbox-label", children: [
2404
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
2405
+ "input",
2406
+ {
2407
+ type: "checkbox",
2408
+ checked: currentSnap.snapToGrid !== false,
2409
+ onChange: (e) => commandService.syncExecuteCommand(import_univer_boards4.UpdateBoardPropsCommand.id, {
2410
+ unitId,
2411
+ patch: { snapToGrid: e.target.checked }
2412
+ })
2413
+ }
2414
+ ),
2415
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "\u542F\u7528\u7F51\u683C\u667A\u80FD\u5438\u9644\u5BF9\u9F50" })
2416
+ ] })
2417
+ ] }),
2418
+ selectedElements.length >= 1 && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "yudao-boards-inspector-group", children: [
2419
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "yudao-boards-inspector-heading", children: [
2420
+ "\u5DF2\u9009\u4E2D ",
2421
+ selectedElements.length,
2422
+ " \u4E2A\u5143\u7D20 (",
2423
+ primary?.type,
2424
+ ")"
2425
+ ] }),
2426
+ selectedElements.length >= 2 && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "yudao-boards-align-bar", "data-testid": "boards-align-bar", children: [
2427
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { type: "button", title: "\u5DE6\u5BF9\u9F50", onClick: () => runAlign("left"), children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(BoardAlignLeftIcon, {}) }),
2428
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { type: "button", title: "\u6C34\u5E73\u5C45\u4E2D", onClick: () => runAlign("center"), children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(BoardAlignCenterIcon, {}) }),
2429
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { type: "button", title: "\u53F3\u5BF9\u9F50", onClick: () => runAlign("right"), children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(BoardAlignRightIcon, {}) }),
2430
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { type: "button", title: "\u9876\u5BF9\u9F50", onClick: () => runAlign("top"), children: "\u9876" }),
2431
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { type: "button", title: "\u5782\u76F4\u5C45\u4E2D", onClick: () => runAlign("middle"), children: "\u4E2D" }),
2432
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { type: "button", title: "\u5E95\u5BF9\u9F50", onClick: () => runAlign("bottom"), children: "\u5E95" }),
2433
+ selectedElements.length >= 3 && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
2434
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { type: "button", title: "\u6C34\u5E73\u7B49\u8DDD\u5206\u5E03", onClick: () => runAlign("distribute-h"), children: "\u7B49\u5BBD\u8DDD" }),
2435
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { type: "button", title: "\u5782\u76F4\u7B49\u8DDD\u5206\u5E03", onClick: () => runAlign("distribute-v"), children: "\u7B49\u9AD8\u8DDD" })
2436
+ ] })
2437
+ ] }),
2438
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "yudao-boards-inline-actions", children: [
2439
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
2440
+ "button",
2441
+ {
2442
+ type: "button",
2443
+ className: "yudao-boards-mini-btn",
2444
+ onClick: () => commandService.syncExecuteCommand(import_univer_boards4.GroupBoardElementsInFrameCommand.id, {
2445
+ unitId,
2446
+ elementIds: selectedIds
2447
+ }),
2448
+ children: "\u6253\u5305\u4E3A\u6F14\u793A\u753B\u6846"
2449
+ }
2450
+ ),
2451
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
2452
+ "button",
2453
+ {
2454
+ type: "button",
2455
+ className: "yudao-boards-mini-btn is-danger",
2456
+ onClick: () => commandService.syncExecuteCommand(import_univer_boards4.DeleteBoardElementsCommand.id, {
2457
+ unitId,
2458
+ elementIds: selectedIds
2459
+ }),
2460
+ children: [
2461
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(BoardTrashIcon, {}),
2462
+ " \u5220\u9664"
2463
+ ]
2464
+ }
2465
+ )
2466
+ ] })
2467
+ ] }),
2468
+ primary && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "yudao-boards-inspector-group", children: [
2469
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "yudao-boards-inspector-heading", children: "\u5750\u6807\u4E0E\u5C3A\u5BF8" }),
2470
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "yudao-boards-coord-grid", children: [
2471
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { children: [
2472
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "X" }),
2473
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
2474
+ "input",
2475
+ {
2476
+ type: "number",
2477
+ value: Math.round(primary.x),
2478
+ onChange: (e) => patchElement(primary.id, { x: Number(e.target.value) || 0 })
2479
+ }
2480
+ )
2481
+ ] }),
2482
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { children: [
2483
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "Y" }),
2484
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
2485
+ "input",
2486
+ {
2487
+ type: "number",
2488
+ value: Math.round(primary.y),
2489
+ onChange: (e) => patchElement(primary.id, { y: Number(e.target.value) || 0 })
2490
+ }
2491
+ )
2492
+ ] }),
2493
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { children: [
2494
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "W" }),
2495
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
2496
+ "input",
2497
+ {
2498
+ type: "number",
2499
+ value: Math.round(primary.width),
2500
+ onChange: (e) => patchElement(primary.id, { width: Math.max(24, Number(e.target.value) || 24) })
2501
+ }
2502
+ )
2503
+ ] }),
2504
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { children: [
2505
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "H" }),
2506
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
2507
+ "input",
2508
+ {
2509
+ type: "number",
2510
+ value: Math.round(primary.height),
2511
+ onChange: (e) => patchElement(primary.id, { height: Math.max(20, Number(e.target.value) || 20) })
2512
+ }
2513
+ )
2514
+ ] })
2515
+ ] })
2516
+ ] }),
2517
+ primary?.type === "shape" && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "yudao-boards-inspector-group", children: [
2518
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "yudao-boards-inspector-heading", children: "\u6D41\u7A0B\u56FE\u5F62\u72B6\u5916\u89C2" }),
2519
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "yudao-boards-field-row", children: [
2520
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "\u51E0\u4F55\u7C7B\u578B" }),
2521
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
2522
+ "select",
2523
+ {
2524
+ value: primary.shapeType,
2525
+ onChange: (e) => patchElement(primary.id, { shapeType: e.target.value }),
2526
+ children: SHAPE_TYPES.map((opt) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value: opt.value, children: opt.label }, opt.value))
2527
+ }
2528
+ )
2529
+ ] }),
2530
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "yudao-boards-field-row", children: [
2531
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "\u586B\u5145\u8272" }),
2532
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
2533
+ "input",
2534
+ {
2535
+ type: "color",
2536
+ value: primary.fill,
2537
+ onChange: (e) => patchElement(primary.id, { fill: e.target.value })
2538
+ }
2539
+ )
2540
+ ] }),
2541
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "yudao-boards-field-row", children: [
2542
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "\u63CF\u8FB9\u8272" }),
2543
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
2544
+ "input",
2545
+ {
2546
+ type: "color",
2547
+ value: primary.stroke,
2548
+ onChange: (e) => patchElement(primary.id, { stroke: e.target.value })
2549
+ }
2550
+ )
2551
+ ] }),
2552
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "yudao-boards-field-row", children: [
2553
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "\u6587\u5B57\u8272" }),
2554
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
2555
+ "input",
2556
+ {
2557
+ type: "color",
2558
+ value: primary.textColor,
2559
+ onChange: (e) => patchElement(primary.id, { textColor: e.target.value })
2560
+ }
2561
+ )
2562
+ ] })
2563
+ ] }),
2564
+ primary?.type === "sticky" && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "yudao-boards-inspector-group", children: [
2565
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "yudao-boards-inspector-heading", children: "\u534F\u4F5C\u4FBF\u7B7E\u6837\u5F0F" }),
2566
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "yudao-boards-swatch-row", children: Object.keys(import_univer_boards4.BOARD_STICKY_PALETTE).map((cKey) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
2567
+ "button",
2568
+ {
2569
+ type: "button",
2570
+ className: `yudao-boards-color-dot ${primary.color === cKey ? "is-selected" : ""}`,
2571
+ style: { backgroundColor: import_univer_boards4.BOARD_STICKY_PALETTE[cKey].fill, borderColor: import_univer_boards4.BOARD_STICKY_PALETTE[cKey].border },
2572
+ onClick: () => patchElement(primary.id, { color: cKey }),
2573
+ title: cKey
2574
+ },
2575
+ cKey
2576
+ )) }),
2577
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "yudao-boards-field-row", children: [
2578
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "\u7F72\u540D\u4F5C\u8005" }),
2579
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
2580
+ "input",
2581
+ {
2582
+ type: "text",
2583
+ value: primary.author ?? "",
2584
+ onChange: (e) => patchElement(primary.id, { author: e.target.value })
2585
+ }
2586
+ )
2587
+ ] }),
2588
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "yudao-boards-hint-box", children: [
2589
+ "\u5F53\u524D\u8D5E\u540C\u7968\u6570\uFF1A",
2590
+ primary.votes.length,
2591
+ " \u7968"
2592
+ ] })
2593
+ ] }),
2594
+ primary?.type === "connector" && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "yudao-boards-inspector-group", children: [
2595
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "yudao-boards-inspector-heading", children: "\u667A\u80FD\u8FDE\u7EBF\u4E0E\u7BAD\u5934\u6807\u8BB0" }),
2596
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "yudao-boards-field-row", children: [
2597
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "\u8DEF\u7531\u7B97\u6CD5" }),
2598
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
2599
+ "select",
2600
+ {
2601
+ value: primary.routeType,
2602
+ onChange: (e) => patchElement(primary.id, { routeType: e.target.value }),
2603
+ children: [
2604
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value: "orthogonal", children: "\u6B63\u4EA4\u66FC\u54C8\u987F\u8DEF\u7531 (Orthogonal)" }),
2605
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value: "curved", children: "\u5E73\u6ED1\u8D1D\u585E\u5C14\u66F2\u7EBF (Curved)" }),
2606
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value: "straight", children: "\u76F4\u7EBF\u8FDE\u63A5 (Straight)" })
2607
+ ]
2608
+ }
2609
+ )
2610
+ ] }),
2611
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "yudao-boards-field-row", children: [
2612
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "\u8D77\u70B9\u6807\u8BB0" }),
2613
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
2614
+ "select",
2615
+ {
2616
+ value: primary.startMarker ?? "none",
2617
+ onChange: (e) => patchElement(primary.id, { startMarker: e.target.value }),
2618
+ children: MARKER_OPTIONS.map((m) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value: m.value, children: m.label }, m.value))
2619
+ }
2620
+ )
2621
+ ] }),
2622
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "yudao-boards-field-row", children: [
2623
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "\u7EC8\u70B9\u6807\u8BB0" }),
2624
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
2625
+ "select",
2626
+ {
2627
+ value: primary.endMarker ?? "arrow",
2628
+ onChange: (e) => patchElement(primary.id, { endMarker: e.target.value }),
2629
+ children: MARKER_OPTIONS.map((m) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value: m.value, children: m.label }, m.value))
2630
+ }
2631
+ )
2632
+ ] }),
2633
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "yudao-boards-field-row", children: [
2634
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "\u8FDE\u7EBF\u6807\u7B7E" }),
2635
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
2636
+ "input",
2637
+ {
2638
+ type: "text",
2639
+ value: primary.label ?? "",
2640
+ onChange: (e) => patchElement(primary.id, { label: e.target.value })
2641
+ }
2642
+ )
2643
+ ] }),
2644
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "yudao-boards-checkbox-label", children: [
2645
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
2646
+ "input",
2647
+ {
2648
+ type: "checkbox",
2649
+ checked: Boolean(primary.dashed),
2650
+ onChange: (e) => patchElement(primary.id, { dashed: e.target.checked })
2651
+ }
2652
+ ),
2653
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "\u865A\u7EBF\u6837\u5F0F" })
2654
+ ] })
2655
+ ] }),
2656
+ primary?.type === "entityCard" && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "yudao-boards-inspector-group", "data-testid": "boards-entity-card-editor", children: [
2657
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "yudao-boards-inspector-heading", children: "ER / UML \u5B9E\u4F53\u6A21\u578B\u5B57\u6BB5\u7F16\u8F91" }),
2658
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "yudao-boards-field-row", children: [
2659
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "\u5361\u7247\u7C7B\u578B" }),
2660
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
2661
+ "select",
2662
+ {
2663
+ value: primary.cardKind,
2664
+ onChange: (e) => patchElement(primary.id, { cardKind: e.target.value }),
2665
+ children: [
2666
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value: "erd", children: "\u6570\u636E\u5E93\u5B9E\u4F53\u8868 (ERD)" }),
2667
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value: "uml", children: "\u9886\u57DF\u5BF9\u8C61\u7C7B\u56FE (UML)" }),
2668
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("option", { value: "kanbanCard", children: "\u654F\u6377\u9700\u6C42\u5361 (Kanban)" })
2669
+ ]
2670
+ }
2671
+ )
2672
+ ] }),
2673
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "yudao-boards-field-row", children: [
2674
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "\u5B9E\u4F53\u540D\u79F0" }),
2675
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
2676
+ "input",
2677
+ {
2678
+ type: "text",
2679
+ value: primary.title,
2680
+ onChange: (e) => patchElement(primary.id, { title: e.target.value })
2681
+ }
2682
+ )
2683
+ ] }),
2684
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "yudao-boards-entity-fields-list", children: primary.fields.map((field, fIdx) => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "yudao-boards-entity-field-edit", children: [
2685
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
2686
+ "input",
2687
+ {
2688
+ type: "text",
2689
+ value: field.name,
2690
+ placeholder: "\u5B57\u6BB5\u540D",
2691
+ onChange: (e) => {
2692
+ const next = primary.fields.map(
2693
+ (item, idx) => idx === fIdx ? { ...item, name: e.target.value } : item
2694
+ );
2695
+ patchElement(primary.id, { fields: next });
2696
+ }
2697
+ }
2698
+ ),
2699
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
2700
+ "input",
2701
+ {
2702
+ type: "text",
2703
+ value: field.type,
2704
+ placeholder: "\u7C7B\u578B",
2705
+ onChange: (e) => {
2706
+ const next = primary.fields.map(
2707
+ (item, idx) => idx === fIdx ? { ...item, type: e.target.value } : item
2708
+ );
2709
+ patchElement(primary.id, { fields: next });
2710
+ }
2711
+ }
2712
+ ),
2713
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
2714
+ "button",
2715
+ {
2716
+ type: "button",
2717
+ className: `yudao-boards-flag-chip ${field.pk ? "is-pk" : ""}`,
2718
+ onClick: () => {
2719
+ const next = primary.fields.map(
2720
+ (item, idx) => idx === fIdx ? { ...item, pk: !item.pk } : item
2721
+ );
2722
+ patchElement(primary.id, { fields: next });
2723
+ },
2724
+ children: "PK"
2725
+ }
2726
+ ),
2727
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
2728
+ "button",
2729
+ {
2730
+ type: "button",
2731
+ className: "yudao-boards-icon-ghost",
2732
+ onClick: () => {
2733
+ const next = primary.fields.filter((_, idx) => idx !== fIdx);
2734
+ patchElement(primary.id, { fields: next });
2735
+ },
2736
+ children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(BoardTrashIcon, {})
2737
+ }
2738
+ )
2739
+ ] }, `${field.name}-${fIdx}`)) }),
2740
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
2741
+ "button",
2742
+ {
2743
+ type: "button",
2744
+ className: "yudao-boards-secondary-block-btn",
2745
+ onClick: () => {
2746
+ const next = [
2747
+ ...primary.fields,
2748
+ { name: `col_${primary.fields.length + 1}`, type: "varchar(64)" }
2749
+ ];
2750
+ patchElement(primary.id, {
2751
+ fields: next,
2752
+ height: Math.max(primary.height, 64 + next.length * 26)
2753
+ });
2754
+ },
2755
+ children: [
2756
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(BoardPlusIcon, {}),
2757
+ " \u65B0\u589E\u5B9E\u4F53\u5B57\u6BB5"
2758
+ ]
2759
+ }
2760
+ )
2761
+ ] }),
2762
+ primary?.type === "mindmap" && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "yudao-boards-inspector-group", children: [
2763
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "yudao-boards-inspector-heading", children: "\u601D\u7EF4\u5BFC\u56FE\u8282\u70B9\u63A7\u5236" }),
2764
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "yudao-boards-field-row", children: [
2765
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "\u5206\u652F\u4E3B\u8272" }),
2766
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
2767
+ "input",
2768
+ {
2769
+ type: "color",
2770
+ value: primary.branchColor ?? "#2563EB",
2771
+ onChange: (e) => patchElement(primary.id, { branchColor: e.target.value })
2772
+ }
2773
+ )
2774
+ ] }),
2775
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "yudao-boards-inline-actions", children: [
2776
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
2777
+ "button",
2778
+ {
2779
+ type: "button",
2780
+ className: "yudao-boards-mini-btn",
2781
+ onClick: () => commandService.syncExecuteCommand(import_univer_boards4.AddMindmapChildCommand.id, {
2782
+ unitId,
2783
+ parentId: primary.id
2784
+ }),
2785
+ children: "+ \u5B50\u8282\u70B9"
2786
+ }
2787
+ ),
2788
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
2789
+ "button",
2790
+ {
2791
+ type: "button",
2792
+ className: "yudao-boards-mini-btn",
2793
+ onClick: () => commandService.syncExecuteCommand(import_univer_boards4.AddMindmapSiblingCommand.id, {
2794
+ unitId,
2795
+ nodeId: primary.id
2796
+ }),
2797
+ children: "+ \u540C\u7EA7"
2798
+ }
2799
+ ),
2800
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
2801
+ "button",
2802
+ {
2803
+ type: "button",
2804
+ className: "yudao-boards-mini-btn",
2805
+ onClick: () => commandService.syncExecuteCommand(import_univer_boards4.LayoutBoardMindmapCommand.id, {
2806
+ unitId
2807
+ }),
2808
+ children: "\u81EA\u52A8\u91CD\u6392"
2809
+ }
2810
+ )
2811
+ ] })
2812
+ ] }),
2813
+ (primary?.type === "frame" || primary?.type === "swimlane") && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "yudao-boards-inspector-group", children: [
2814
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "yudao-boards-inspector-heading", children: "\u5BB9\u5668\u6807\u9898\u4E0E\u914D\u8272" }),
2815
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "yudao-boards-field-row", children: [
2816
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "\u6807\u9898" }),
2817
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
2818
+ "input",
2819
+ {
2820
+ type: "text",
2821
+ value: primary.title,
2822
+ onChange: (e) => patchElement(primary.id, { title: e.target.value })
2823
+ }
2824
+ )
2825
+ ] }),
2826
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("label", { className: "yudao-boards-field-row", children: [
2827
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "\u8FB9\u6846\u8272" }),
2828
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
2829
+ "input",
2830
+ {
2831
+ type: "color",
2832
+ value: primary.borderColor ?? "#93C5FD",
2833
+ onChange: (e) => patchElement(primary.id, { borderColor: e.target.value })
2834
+ }
2835
+ )
2836
+ ] })
2837
+ ] })
2838
+ ] });
2839
+ };
2840
+
2841
+ // src/views/left-sidebar/BoardsLeftSidebar.tsx
2842
+ var import_core5 = require("@univerjs/core");
2843
+ var import_ui5 = require("@univerjs/ui");
2844
+ var import_univer_boards5 = require("@yudaocode/univer-boards");
2845
+ var import_react2 = require("react");
2846
+ var import_rxjs4 = require("rxjs");
2847
+ var import_jsx_runtime5 = require("react/jsx-runtime");
2848
+ var BoardsLeftSidebar = () => {
2849
+ const instanceService = (0, import_ui5.useDependency)(import_core5.IUniverInstanceService);
2850
+ const commandService = (0, import_ui5.useDependency)(import_core5.ICommandService);
2851
+ const selectionService = (0, import_ui5.useDependency)(import_univer_boards5.IBoardSelectionService);
2852
+ const unit = (0, import_ui5.useObservable)(
2853
+ () => instanceService.getCurrentTypeOfUnit$(import_core5.UniverInstanceType.UNIVER_BOARD),
2854
+ instanceService.getCurrentUnitOfType(import_core5.UniverInstanceType.UNIVER_BOARD),
2855
+ false,
2856
+ [instanceService]
2857
+ );
2858
+ const snapshot = (0, import_ui5.useObservable)(
2859
+ () => unit ? unit.snapshotChanged$ : (0, import_rxjs4.of)(null),
2860
+ unit ? unit.getSnapshot() : null,
2861
+ false,
2862
+ [unit]
2863
+ );
2864
+ const selectedIds = (0, import_ui5.useObservable)(
2865
+ selectionService.selectedIds$,
2866
+ selectionService.getSelectedIds()
2867
+ );
2868
+ const [activeTab, setActiveTab] = (0, import_react2.useState)("frames");
2869
+ const [csvInput, setCsvInput] = (0, import_react2.useState)("text,color,author,votes\n\u7070\u5EA6\u7F51\u5173\u65E0\u635F\u5207\u6362,green,\u6797\u5DE5,3\n\u8865\u5145\u6162\u67E5\u8BE2\u7D22\u5F15\u5DE1\u68C0,yellow,\u9648\u5DE5,2");
2870
+ const currentSnap = snapshot ?? unit?.getSnapshot() ?? null;
2871
+ if (!currentSnap || !unit) {
2872
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "yudao-boards-left-sidebar yudao-boards-empty", children: "\u672A\u6302\u8F7D\u767D\u677F\u5B9E\u4F8B" });
2873
+ }
2874
+ const frames = unit.getFramesOrdered();
2875
+ const orderedElements = unit.getElementsOrdered();
2876
+ const focusFrame = (frameId) => {
2877
+ const frame = currentSnap.elements[frameId];
2878
+ if (!frame) return;
2879
+ selectionService.selectElements([frameId]);
2880
+ const zoom = Math.max(0.35, Math.min(1.2, Math.min(920 / frame.width, 600 / frame.height)));
2881
+ const panX = Math.round(64 - frame.x * zoom);
2882
+ const panY = Math.round(64 - frame.y * zoom);
2883
+ commandService.syncExecuteCommand(import_univer_boards5.SetBoardViewportCommand.id, {
2884
+ unitId: unit.getUnitId(),
2885
+ viewport: { panX, panY, zoom: Number(zoom.toFixed(2)) }
2886
+ });
2887
+ };
2888
+ const handleAddFrame = () => {
2889
+ const idx = frames.length + 1;
2890
+ commandService.syncExecuteCommand(import_univer_boards5.AddBoardElementsCommand.id, {
2891
+ unitId: unit.getUnitId(),
2892
+ element: {
2893
+ type: "frame",
2894
+ title: `0${idx} \xB7 \u65B0\u5EFA\u7814\u8BA8\u753B\u6846`,
2895
+ x: 80 + frames.length * 60,
2896
+ y: 80 + frames.length * 40,
2897
+ width: 760,
2898
+ height: 460
2899
+ }
2900
+ });
2901
+ };
2902
+ const handleImportCsv = () => {
2903
+ const elements = (0, import_univer_boards5.importCsvToBoardStickies)(csvInput, {
2904
+ originX: 120,
2905
+ originY: 120,
2906
+ frameTitle: "CSV \u6279\u91CF\u5171\u521B\u4FBF\u7B7E"
2907
+ });
2908
+ if (elements.length > 0) {
2909
+ commandService.syncExecuteCommand(import_univer_boards5.AddBoardElementsCommand.id, {
2910
+ unitId: unit.getUnitId(),
2911
+ elements
2912
+ });
2913
+ }
2914
+ };
2915
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("aside", { className: "yudao-boards-left-sidebar", "data-testid": "boards-left-sidebar", children: [
2916
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "yudao-boards-sidebar-tabs", children: [
2917
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
2918
+ "button",
2919
+ {
2920
+ type: "button",
2921
+ className: activeTab === "frames" ? "is-active" : "",
2922
+ onClick: () => setActiveTab("frames"),
2923
+ children: [
2924
+ "\u753B\u6846 (",
2925
+ frames.length,
2926
+ ")"
2927
+ ]
2928
+ }
2929
+ ),
2930
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
2931
+ "button",
2932
+ {
2933
+ type: "button",
2934
+ className: activeTab === "elements" ? "is-active" : "",
2935
+ onClick: () => setActiveTab("elements"),
2936
+ children: [
2937
+ "\u5927\u7EB2 (",
2938
+ orderedElements.length,
2939
+ ")"
2940
+ ]
2941
+ }
2942
+ ),
2943
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
2944
+ "button",
2945
+ {
2946
+ type: "button",
2947
+ className: activeTab === "templates" ? "is-active" : "",
2948
+ onClick: () => setActiveTab("templates"),
2949
+ children: "\u6A21\u677F/CSV"
2950
+ }
2951
+ )
2952
+ ] }),
2953
+ activeTab === "frames" && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "yudao-boards-sidebar-section", children: [
2954
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "yudao-boards-sidebar-header-row", children: [
2955
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { children: "\u6F14\u793A\u753B\u6846\u5E8F\u5217" }),
2956
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
2957
+ "button",
2958
+ {
2959
+ type: "button",
2960
+ className: "yudao-boards-mini-btn",
2961
+ onClick: handleAddFrame,
2962
+ title: "\u65B0\u5EFA\u753B\u6846",
2963
+ children: [
2964
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(BoardPlusIcon, {}),
2965
+ " \u65B0\u5EFA"
2966
+ ]
2967
+ }
2968
+ )
2969
+ ] }),
2970
+ frames.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "yudao-boards-hint-box", children: "\u6682\u65E0\u753B\u6846\uFF0C\u70B9\u51FB\u300C\u65B0\u5EFA\u300D\u6216\u6846\u9009\u8282\u70B9\u521B\u5EFA\u6F14\u793A\u753B\u6846\u3002" }) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "yudao-boards-frame-list", children: frames.map((frame, idx) => {
2971
+ const selected = selectedIds.includes(frame.id);
2972
+ const memberCount = unit.getElementsInFrame(frame.id).length;
2973
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
2974
+ "div",
2975
+ {
2976
+ className: `yudao-boards-frame-card ${selected ? "is-selected" : ""}`,
2977
+ onClick: () => focusFrame(frame.id),
2978
+ children: [
2979
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "yudao-boards-frame-badge", children: idx + 1 }),
2980
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "yudao-boards-frame-meta", children: [
2981
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "yudao-boards-frame-title", children: frame.title }),
2982
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "yudao-boards-frame-sub", children: [
2983
+ Math.round(frame.width),
2984
+ " \xD7 ",
2985
+ Math.round(frame.height),
2986
+ " \xB7 ",
2987
+ memberCount,
2988
+ " \u9879"
2989
+ ] })
2990
+ ] })
2991
+ ]
2992
+ },
2993
+ frame.id
2994
+ );
2995
+ }) })
2996
+ ] }),
2997
+ activeTab === "elements" && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "yudao-boards-sidebar-section", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "yudao-boards-element-list", children: orderedElements.map((el) => {
2998
+ const selected = selectedIds.includes(el.id);
2999
+ const label = el.type === "frame" || el.type === "swimlane" || el.type === "entityCard" || el.type === "chart" ? el.title : el.type === "sticky" || el.type === "shape" || el.type === "text" || el.type === "mindmap" ? el.text : el.type === "connector" ? el.label || "\u667A\u80FD\u8FDE\u7EBF" : el.type;
3000
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
3001
+ "div",
3002
+ {
3003
+ className: `yudao-boards-layer-row ${selected ? "is-selected" : ""}`,
3004
+ onClick: () => selectionService.selectElements([el.id]),
3005
+ children: [
3006
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "yudao-boards-layer-icon", children: el.type === "frame" ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(BoardFrameIcon, {}) : el.type === "swimlane" ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(BoardSwimlaneIcon, {}) : el.type === "sticky" ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(BoardStickyIcon, {}) : el.type === "mindmap" ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(BoardMindmapIcon, {}) : el.type === "entityCard" ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(BoardEntityCardIcon, {}) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(BoardShapeIcon, {}) }),
3007
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "yudao-boards-layer-name", children: label || el.id }),
3008
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
3009
+ "button",
3010
+ {
3011
+ type: "button",
3012
+ className: "yudao-boards-icon-ghost",
3013
+ title: "\u5220\u9664\u5143\u7D20",
3014
+ onClick: (ev) => {
3015
+ ev.stopPropagation();
3016
+ commandService.syncExecuteCommand(import_univer_boards5.DeleteBoardElementsCommand.id, {
3017
+ unitId: unit.getUnitId(),
3018
+ elementIds: [el.id]
3019
+ });
3020
+ },
3021
+ children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(BoardTrashIcon, {})
3022
+ }
3023
+ )
3024
+ ]
3025
+ },
3026
+ el.id
3027
+ );
3028
+ }) }) }),
3029
+ activeTab === "templates" && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "yudao-boards-sidebar-section", children: [
3030
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
3031
+ "button",
3032
+ {
3033
+ type: "button",
3034
+ className: "yudao-boards-primary-block-btn",
3035
+ onClick: () => commandService.syncExecuteCommand(OpenBoardMermaidModalOperation.id, { open: true }),
3036
+ children: [
3037
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(BoardMermaidIcon, {}),
3038
+ " \u6253\u5F00 Mermaid \u4EE3\u7801\u4E92\u8F6C\u5DE5\u4F5C\u53F0"
3039
+ ]
3040
+ }
3041
+ ),
3042
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
3043
+ "button",
3044
+ {
3045
+ type: "button",
3046
+ className: "yudao-boards-secondary-block-btn",
3047
+ onClick: () => commandService.syncExecuteCommand(import_univer_boards5.ReplaceBoardSnapshotCommand.id, {
3048
+ unitId: unit.getUnitId(),
3049
+ snapshot: (0, import_univer_boards5.createSampleArchitectureBoardData)({ id: unit.getUnitId() })
3050
+ }),
3051
+ children: "\u52A0\u8F7D\u5168\u573A\u666F\u67B6\u6784\u5171\u521B\u793A\u4F8B\u767D\u677F"
3052
+ }
3053
+ ),
3054
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "yudao-boards-group-label", children: "\u5FEB\u901F\u63D2\u5165 Mermaid \u67B6\u6784\u9884\u8BBE" }),
3055
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "yudao-boards-preset-list", children: import_univer_boards5.MERMAID_PRESET_TEMPLATES.map((tpl) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
3056
+ "button",
3057
+ {
3058
+ type: "button",
3059
+ className: "yudao-boards-preset-item",
3060
+ onClick: () => commandService.syncExecuteCommand(import_univer_boards5.ImportMermaidToBoardCommand.id, {
3061
+ unitId: unit.getUnitId(),
3062
+ mermaidCode: tpl.code,
3063
+ originX: 120,
3064
+ originY: 120
3065
+ }),
3066
+ children: [
3067
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { children: tpl.title }),
3068
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "yudao-boards-tag", children: tpl.diagramType })
3069
+ ]
3070
+ },
3071
+ tpl.key
3072
+ )) }),
3073
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "yudao-boards-group-label", children: "CSV \u6279\u91CF\u751F\u6210\u4FBF\u7B7E\u753B\u6846" }),
3074
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
3075
+ "textarea",
3076
+ {
3077
+ className: "yudao-boards-csv-textarea",
3078
+ rows: 4,
3079
+ value: csvInput,
3080
+ onChange: (e) => setCsvInput(e.target.value)
3081
+ }
3082
+ ),
3083
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
3084
+ "button",
3085
+ {
3086
+ type: "button",
3087
+ className: "yudao-boards-secondary-block-btn",
3088
+ onClick: handleImportCsv,
3089
+ children: "\u5BFC\u5165 CSV \u751F\u6210\u5206\u7EC4\u4FBF\u7B7E"
3090
+ }
3091
+ )
3092
+ ] })
3093
+ ] });
3094
+ };
3095
+
3096
+ // src/views/modals/BoardsMermaidModal.tsx
3097
+ var import_core6 = require("@univerjs/core");
3098
+ var import_ui6 = require("@univerjs/ui");
3099
+ var import_univer_boards6 = require("@yudaocode/univer-boards");
3100
+ var import_react3 = require("react");
3101
+ var import_jsx_runtime6 = require("react/jsx-runtime");
3102
+ var BoardsMermaidModal = ({ forceOpen }) => {
3103
+ const instanceService = (0, import_ui6.useDependency)(import_core6.IUniverInstanceService);
3104
+ const commandService = (0, import_ui6.useDependency)(import_core6.ICommandService);
3105
+ const selectionService = (0, import_ui6.useDependency)(import_univer_boards6.IBoardSelectionService);
3106
+ const isOpen = (0, import_ui6.useObservable)(
3107
+ selectionService.mermaidModalOpen$,
3108
+ selectionService.isMermaidModalOpen()
3109
+ );
3110
+ const unit = (0, import_ui6.useObservable)(
3111
+ () => instanceService.getCurrentTypeOfUnit$(import_core6.UniverInstanceType.UNIVER_BOARD),
3112
+ instanceService.getCurrentUnitOfType(import_core6.UniverInstanceType.UNIVER_BOARD),
3113
+ false,
3114
+ [instanceService]
3115
+ );
3116
+ const [code, setCode] = (0, import_react3.useState)(import_univer_boards6.MERMAID_PRESET_TEMPLATES[0].code);
3117
+ const [replaceExisting, setReplaceExisting] = (0, import_react3.useState)(false);
3118
+ const [reverseKind, setReverseKind] = (0, import_react3.useState)("auto");
3119
+ const previewInfo = (0, import_react3.useMemo)(() => {
3120
+ try {
3121
+ const elements = (0, import_univer_boards6.parseMermaidToBoardElements)(code, { originX: 40, originY: 40 });
3122
+ const detectedType = (0, import_univer_boards6.detectMermaidDiagramType)(code);
3123
+ const tempSnap = (0, import_univer_boards6.createDefaultBoardUnitData)({
3124
+ id: "mermaid-preview",
3125
+ name: "Preview",
3126
+ gridStyle: "dots",
3127
+ backgroundColor: "#F8FAFC",
3128
+ elements: Object.fromEntries(elements.map((el) => [el.id, el])),
3129
+ elementOrder: elements.map((el) => el.id),
3130
+ frameOrder: elements.filter((el) => el.type === "frame").map((el) => el.id)
3131
+ });
3132
+ const svg = (0, import_univer_boards6.exportBoardToSvg)(tempSnap, { padding: 28 });
3133
+ const framesCount = elements.filter((e) => e.type === "frame").length;
3134
+ const connectorsCount = elements.filter((e) => e.type === "connector").length;
3135
+ const nodesCount = elements.length - framesCount - connectorsCount;
3136
+ return {
3137
+ elements,
3138
+ detectedType,
3139
+ svg,
3140
+ framesCount,
3141
+ nodesCount,
3142
+ connectorsCount,
3143
+ error: null
3144
+ };
3145
+ } catch (err) {
3146
+ return {
3147
+ elements: [],
3148
+ detectedType: "flowchart",
3149
+ svg: "",
3150
+ framesCount: 0,
3151
+ nodesCount: 0,
3152
+ connectorsCount: 0,
3153
+ error: err instanceof Error ? err.message : String(err)
3154
+ };
3155
+ }
3156
+ }, [code]);
3157
+ if (!isOpen && !forceOpen) return null;
3158
+ const handleClose = () => {
3159
+ selectionService.setMermaidModalOpen(false);
3160
+ };
3161
+ const handleParseAndInsert = () => {
3162
+ if (!unit || !code.trim()) return;
3163
+ const ok = commandService.syncExecuteCommand(import_univer_boards6.ImportMermaidToBoardCommand.id, {
3164
+ unitId: unit.getUnitId(),
3165
+ mermaidCode: code,
3166
+ originX: 120,
3167
+ originY: 120,
3168
+ replaceExisting
3169
+ });
3170
+ if (ok) {
3171
+ selectionService.setMermaidModalOpen(false);
3172
+ }
3173
+ };
3174
+ const handleReverseFromCanvas = () => {
3175
+ if (!unit) return;
3176
+ const generated = (0, import_univer_boards6.exportBoardToMermaid)(unit.save(), {
3177
+ diagramType: reverseKind
3178
+ });
3179
+ setCode(generated);
3180
+ };
3181
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
3182
+ "div",
3183
+ {
3184
+ className: "yudao-boards-modal-backdrop",
3185
+ "data-testid": "boards-mermaid-modal",
3186
+ onClick: handleClose,
3187
+ children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
3188
+ "div",
3189
+ {
3190
+ className: "yudao-boards-mermaid-dialog",
3191
+ onClick: (e) => e.stopPropagation(),
3192
+ children: [
3193
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("header", { className: "yudao-boards-mermaid-header", children: [
3194
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "yudao-boards-mermaid-title", children: [
3195
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(BoardMermaidIcon, {}),
3196
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: "Mermaid \u6D41\u7A0B\u56FE\u4E0E\u67B6\u6784\u4EE3\u7801\u53CC\u5411\u4E92\u8F6C\u5DE5\u4F5C\u53F0" })
3197
+ ] }),
3198
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
3199
+ "button",
3200
+ {
3201
+ type: "button",
3202
+ className: "yudao-boards-modal-close",
3203
+ onClick: handleClose,
3204
+ children: "\u5173\u95ED"
3205
+ }
3206
+ )
3207
+ ] }),
3208
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "yudao-boards-mermaid-presets", children: [
3209
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "yudao-boards-presets-label", children: "\u573A\u666F\u6A21\u677F\uFF1A" }),
3210
+ import_univer_boards6.MERMAID_PRESET_TEMPLATES.map((tpl) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
3211
+ "button",
3212
+ {
3213
+ type: "button",
3214
+ className: "yudao-boards-preset-pill",
3215
+ "data-testid": `mermaid-preset-${tpl.key}`,
3216
+ onClick: () => setCode(tpl.code),
3217
+ children: tpl.title
3218
+ },
3219
+ tpl.key
3220
+ ))
3221
+ ] }),
3222
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "yudao-boards-mermaid-split", children: [
3223
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "yudao-boards-mermaid-editor-pane", children: [
3224
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "yudao-boards-pane-toolbar", children: [
3225
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("span", { children: [
3226
+ "Mermaid DSL \u6E90\u7801 (",
3227
+ previewInfo.detectedType,
3228
+ ")"
3229
+ ] }),
3230
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "yudao-boards-reverse-bar", children: [
3231
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
3232
+ "select",
3233
+ {
3234
+ value: reverseKind,
3235
+ onChange: (e) => setReverseKind(e.target.value),
3236
+ className: "yudao-boards-select-sm",
3237
+ children: [
3238
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("option", { value: "auto", children: "\u81EA\u52A8\u8BC6\u522B\u56FE\u7C7B\u578B" }),
3239
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("option", { value: "flowchart", children: "flowchart TD" }),
3240
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("option", { value: "erDiagram", children: "erDiagram" }),
3241
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("option", { value: "classDiagram", children: "classDiagram" }),
3242
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("option", { value: "mindmap", children: "mindmap" }),
3243
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("option", { value: "sequenceDiagram", children: "sequenceDiagram" })
3244
+ ]
3245
+ }
3246
+ ),
3247
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
3248
+ "button",
3249
+ {
3250
+ type: "button",
3251
+ className: "yudao-boards-reverse-btn",
3252
+ "data-testid": "mermaid-reverse-generate",
3253
+ onClick: handleReverseFromCanvas,
3254
+ children: "\u4ECE\u5F53\u524D\u753B\u5E03\u53CD\u5411\u751F\u6210\u4EE3\u7801"
3255
+ }
3256
+ )
3257
+ ] })
3258
+ ] }),
3259
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
3260
+ "textarea",
3261
+ {
3262
+ className: "yudao-boards-mermaid-textarea",
3263
+ "data-testid": "mermaid-code-input",
3264
+ value: code,
3265
+ onChange: (e) => setCode(e.target.value),
3266
+ spellCheck: false
3267
+ }
3268
+ )
3269
+ ] }),
3270
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "yudao-boards-mermaid-preview-pane", children: [
3271
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "yudao-boards-pane-toolbar", children: [
3272
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: "\u5B9E\u65F6\u539F\u751F\u8282\u70B9\u5E03\u5C40\u9884\u89C8" }),
3273
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("span", { className: "yudao-boards-preview-stats", "data-testid": "mermaid-node-stats", children: [
3274
+ "\u5171 ",
3275
+ previewInfo.elements.length,
3276
+ " \u4E2A\u539F\u751F\u5143\u7D20\uFF08\u8282\u70B9 ",
3277
+ previewInfo.nodesCount,
3278
+ " \xB7 \u8FDE\u7EBF",
3279
+ " ",
3280
+ previewInfo.connectorsCount,
3281
+ " \xB7 \u753B\u6846 ",
3282
+ previewInfo.framesCount,
3283
+ "\uFF09"
3284
+ ] })
3285
+ ] }),
3286
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "yudao-boards-mermaid-svg-stage", children: previewInfo.error ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "yudao-boards-error-text", children: previewInfo.error }) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
3287
+ "div",
3288
+ {
3289
+ className: "yudao-boards-svg-preview-inner",
3290
+ dangerouslySetInnerHTML: { __html: previewInfo.svg }
3291
+ }
3292
+ ) })
3293
+ ] })
3294
+ ] }),
3295
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("footer", { className: "yudao-boards-mermaid-footer", children: [
3296
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("label", { className: "yudao-boards-checkbox-label", children: [
3297
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
3298
+ "input",
3299
+ {
3300
+ type: "checkbox",
3301
+ checked: replaceExisting,
3302
+ onChange: (e) => setReplaceExisting(e.target.checked)
3303
+ }
3304
+ ),
3305
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: "\u63D2\u5165\u524D\u6E05\u7A7A\u5F53\u524D\u753B\u5E03\u539F\u6709\u5143\u7D20" })
3306
+ ] }),
3307
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "yudao-boards-footer-actions", children: [
3308
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { type: "button", className: "yudao-boards-btn-ghost", onClick: handleClose, children: "\u53D6\u6D88" }),
3309
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
3310
+ "button",
3311
+ {
3312
+ type: "button",
3313
+ className: "yudao-boards-btn-primary",
3314
+ "data-testid": "mermaid-parse-insert",
3315
+ disabled: previewInfo.elements.length === 0,
3316
+ onClick: handleParseAndInsert,
3317
+ children: [
3318
+ "\u89E3\u6790\u5E76\u63D2\u5165\u753B\u5E03 (",
3319
+ previewInfo.elements.length,
3320
+ ")"
3321
+ ]
3322
+ }
3323
+ )
3324
+ ] })
3325
+ ] })
3326
+ ]
3327
+ }
3328
+ )
3329
+ }
3330
+ );
3331
+ };
3332
+
3333
+ // src/views/modals/BoardsModalsHost.tsx
3334
+ var import_jsx_runtime7 = require("react/jsx-runtime");
3335
+ var BoardsModalsHost = () => {
3336
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(BoardsMermaidModal, {});
3337
+ };
3338
+
3339
+ // src/controllers/menu.schema.ts
3340
+ var import_ui7 = require("@univerjs/ui");
3341
+ var import_univer_boards7 = require("@yudaocode/univer-boards");
3342
+ var import_rxjs5 = require("rxjs");
3343
+ var BOARDS_RIBBON_TAB = "ribbon.boards";
3344
+ var BOARDS_RIBBON_GROUP = "ribbon.boards.workshop";
3345
+ var boardsRootMenuExtension = {
3346
+ [import_ui7.MenuManagerPosition.RIBBON]: {
3347
+ [BOARDS_RIBBON_TAB]: {
3348
+ order: 2,
3349
+ title: "boards.ribbon.boardTab",
3350
+ [BOARDS_RIBBON_GROUP]: {
3351
+ order: 0,
3352
+ title: "boards.ribbon.boardTab"
3353
+ }
3354
+ }
3355
+ }
3356
+ };
3357
+ function makeSimpleMenuBtn(config) {
3358
+ return () => ({
3359
+ id: config.id,
3360
+ commandId: config.commandId ?? config.id,
3361
+ type: import_ui7.MenuItemType.BUTTON,
3362
+ title: config.title,
3363
+ label: config.label,
3364
+ tooltip: config.title,
3365
+ icon: config.icon,
3366
+ params: config.params
3367
+ });
3368
+ }
3369
+ var BoardSelectToolMenuFactory = (accessor) => {
3370
+ const sel = accessor.get(import_univer_boards7.IBoardSelectionService);
3371
+ return {
3372
+ id: "boards-ui.menu.tool-select",
3373
+ commandId: SetBoardToolOperation.id,
3374
+ type: import_ui7.MenuItemType.BUTTON,
3375
+ title: "boards.ribbon.selectTool",
3376
+ tooltip: "boards.ribbon.selectTool",
3377
+ icon: "BoardSelectIcon",
3378
+ params: { tool: "select" },
3379
+ activated$: sel.activeTool$.pipe((0, import_rxjs5.map)((t) => t === "select"))
3380
+ };
3381
+ };
3382
+ var BoardHandToolMenuFactory = (accessor) => {
3383
+ const sel = accessor.get(import_univer_boards7.IBoardSelectionService);
3384
+ return {
3385
+ id: "boards-ui.menu.tool-hand",
3386
+ commandId: SetBoardToolOperation.id,
3387
+ type: import_ui7.MenuItemType.BUTTON,
3388
+ title: "boards.ribbon.handTool",
3389
+ tooltip: "boards.ribbon.handTool",
3390
+ icon: "BoardHandIcon",
3391
+ params: { tool: "hand" },
3392
+ activated$: sel.activeTool$.pipe((0, import_rxjs5.map)((t) => t === "hand"))
3393
+ };
3394
+ };
3395
+ var boardsMenuSchema = {
3396
+ [import_ui7.RibbonStartGroup.FORMAT]: {
3397
+ ["boards-ui.menu.tool-select"]: { order: 0, menuItemFactory: BoardSelectToolMenuFactory },
3398
+ ["boards-ui.menu.tool-hand"]: { order: 1, menuItemFactory: BoardHandToolMenuFactory },
3399
+ ["boards-ui.menu.add-frame"]: {
3400
+ order: 2,
3401
+ menuItemFactory: makeSimpleMenuBtn({
3402
+ id: "boards-ui.menu.add-frame",
3403
+ commandId: import_univer_boards7.AddBoardElementsCommand.id,
3404
+ title: "boards.ribbon.insertFrame",
3405
+ icon: "BoardFrameIcon",
3406
+ params: { element: { type: "frame" } }
3407
+ })
3408
+ },
3409
+ ["boards-ui.menu.add-sticky"]: {
3410
+ order: 3,
3411
+ menuItemFactory: makeSimpleMenuBtn({
3412
+ id: "boards-ui.menu.add-sticky",
3413
+ commandId: import_univer_boards7.AddBoardElementsCommand.id,
3414
+ title: "boards.ribbon.insertSticky",
3415
+ icon: "BoardStickyIcon",
3416
+ params: { element: { type: "sticky" } }
3417
+ })
3418
+ },
3419
+ ["boards-ui.menu.add-shape"]: {
3420
+ order: 4,
3421
+ menuItemFactory: makeSimpleMenuBtn({
3422
+ id: "boards-ui.menu.add-shape",
3423
+ commandId: import_univer_boards7.AddBoardElementsCommand.id,
3424
+ title: "boards.ribbon.insertShape",
3425
+ icon: "BoardShapeIcon",
3426
+ params: { element: { type: "shape" } }
3427
+ })
3428
+ },
3429
+ ["boards-ui.menu.add-mindmap"]: {
3430
+ order: 5,
3431
+ menuItemFactory: makeSimpleMenuBtn({
3432
+ id: "boards-ui.menu.add-mindmap",
3433
+ commandId: import_univer_boards7.AddBoardElementsCommand.id,
3434
+ title: "boards.ribbon.insertMindmap",
3435
+ icon: "BoardMindmapIcon",
3436
+ params: { element: { type: "mindmap" } }
3437
+ })
3438
+ },
3439
+ ["boards-ui.menu.add-entity"]: {
3440
+ order: 6,
3441
+ menuItemFactory: makeSimpleMenuBtn({
3442
+ id: "boards-ui.menu.add-entity",
3443
+ commandId: import_univer_boards7.AddBoardElementsCommand.id,
3444
+ title: "boards.ribbon.insertEntityCard",
3445
+ icon: "BoardEntityCardIcon",
3446
+ params: { element: { type: "entityCard" } }
3447
+ })
3448
+ }
3449
+ },
3450
+ [import_ui7.RibbonInsertGroup.MEDIA]: {
3451
+ ["boards-ui.menu.mermaid-studio"]: {
3452
+ order: 1,
3453
+ menuItemFactory: makeSimpleMenuBtn({
3454
+ id: "boards-ui.menu.mermaid-studio",
3455
+ commandId: OpenBoardMermaidModalOperation.id,
3456
+ title: "boards.ribbon.mermaidStudio",
3457
+ label: "boards.ribbon.mermaidStudio",
3458
+ icon: "BoardMermaidIcon",
3459
+ params: { open: true }
3460
+ })
3461
+ },
3462
+ ["boards-ui.menu.insert-swimlane"]: {
3463
+ order: 2,
3464
+ menuItemFactory: makeSimpleMenuBtn({
3465
+ id: "boards-ui.menu.insert-swimlane",
3466
+ commandId: import_univer_boards7.AddBoardElementsCommand.id,
3467
+ title: "boards.ribbon.insertSwimlane",
3468
+ icon: "BoardSwimlaneIcon",
3469
+ params: { element: { type: "swimlane" } }
3470
+ })
3471
+ }
3472
+ },
3473
+ [BOARDS_RIBBON_GROUP]: {
3474
+ ["boards-ui.menu.mermaid-sync"]: {
3475
+ order: 1,
3476
+ menuItemFactory: makeSimpleMenuBtn({
3477
+ id: "boards-ui.menu.mermaid-sync",
3478
+ commandId: OpenBoardMermaidModalOperation.id,
3479
+ title: "boards.ribbon.mermaidStudio",
3480
+ label: "boards.ribbon.mermaidStudio",
3481
+ icon: "BoardMermaidIcon",
3482
+ params: { open: true }
3483
+ })
3484
+ },
3485
+ ["boards-ui.menu.tour"]: {
3486
+ order: 2,
3487
+ menuItemFactory: makeSimpleMenuBtn({
3488
+ id: "boards-ui.menu.tour",
3489
+ commandId: StartBoardPresentationOperation.id,
3490
+ title: "boards.ribbon.presentationTour",
3491
+ label: "boards.ribbon.presentationTour",
3492
+ icon: "BoardPlayTourIcon"
3493
+ })
3494
+ },
3495
+ ["boards-ui.menu.export-svg"]: {
3496
+ order: 3,
3497
+ menuItemFactory: makeSimpleMenuBtn({
3498
+ id: "boards-ui.menu.export-svg",
3499
+ commandId: ExportBoardFileOperation.id,
3500
+ title: "boards.ribbon.exportSvg",
3501
+ icon: "BoardDownloadIcon",
3502
+ params: { format: "svg" }
3503
+ })
3504
+ },
3505
+ ["boards-ui.menu.export-pdf"]: {
3506
+ order: 4,
3507
+ menuItemFactory: makeSimpleMenuBtn({
3508
+ id: "boards-ui.menu.export-pdf",
3509
+ commandId: ExportBoardFileOperation.id,
3510
+ title: "boards.ribbon.exportPdf",
3511
+ icon: "BoardDownloadIcon",
3512
+ params: { format: "pdf" }
3513
+ })
3514
+ },
3515
+ ["boards-ui.menu.export-pptx"]: {
3516
+ order: 5,
3517
+ menuItemFactory: makeSimpleMenuBtn({
3518
+ id: "boards-ui.menu.export-pptx",
3519
+ commandId: ExportBoardFileOperation.id,
3520
+ title: "boards.ribbon.exportPptx",
3521
+ icon: "BoardDownloadIcon",
3522
+ params: { format: "pptx" }
3523
+ })
3524
+ }
3525
+ },
3526
+ [import_ui7.RibbonViewGroup.DISPLAY]: {
3527
+ [FitBoardToScreenOperation.id]: {
3528
+ order: 1,
3529
+ menuItemFactory: makeSimpleMenuBtn({
3530
+ id: FitBoardToScreenOperation.id,
3531
+ title: "boards.ribbon.fitScreen",
3532
+ icon: "BoardFitScreenIcon"
3533
+ })
3534
+ },
3535
+ [ToggleBoardInspectorOperation.id]: {
3536
+ order: 2,
3537
+ menuItemFactory: makeSimpleMenuBtn({
3538
+ id: ToggleBoardInspectorOperation.id,
3539
+ title: "boards.ribbon.inspector",
3540
+ label: "boards.ribbon.inspector",
3541
+ icon: "BoardInspectorIcon"
3542
+ })
3543
+ }
3544
+ }
3545
+ };
3546
+
3547
+ // src/controllers/boards-ui.controller.ts
3548
+ var BoardsUIController = class extends import_core7.Disposable {
3549
+ constructor(_config, _commandService, _menuManagerService, _uiPartsService, _sidebarService, _componentManager, _iconManager) {
3550
+ super();
3551
+ this._config = _config;
3552
+ this._commandService = _commandService;
3553
+ this._menuManagerService = _menuManagerService;
3554
+ this._uiPartsService = _uiPartsService;
3555
+ this._sidebarService = _sidebarService;
3556
+ this._componentManager = _componentManager;
3557
+ this._iconManager = _iconManager;
3558
+ this._inspectorTimer = null;
3559
+ this._initIcons();
3560
+ this._initComponents();
3561
+ this._initOperations();
3562
+ this._initMenus();
3563
+ this._initWorkbenchParts();
3564
+ if (this._config.defaultOpenInspector) {
3565
+ this._inspectorTimer = setTimeout(() => {
3566
+ this._inspectorTimer = null;
3567
+ if (!this._disposed) {
3568
+ openBoardInspectorSidebar(this._sidebarService);
3569
+ }
3570
+ }, 100);
3571
+ this.disposeWithMe(
3572
+ (0, import_core7.toDisposable)(() => {
3573
+ if (this._inspectorTimer !== null) {
3574
+ clearTimeout(this._inspectorTimer);
3575
+ this._inspectorTimer = null;
3576
+ }
3577
+ })
3578
+ );
3579
+ }
3580
+ }
3581
+ _initIcons() {
3582
+ this.disposeWithMe(this._iconManager.register(BOARD_ICON_MAP));
3583
+ }
3584
+ _initComponents() {
3585
+ this.disposeWithMe(
3586
+ this._componentManager.register(BOARD_INSPECTOR_COMPONENT_KEY, BoardsInspectorPanel)
3587
+ );
3588
+ }
3589
+ _initOperations() {
3590
+ const ops = [
3591
+ ToggleBoardInspectorOperation,
3592
+ OpenBoardMermaidModalOperation,
3593
+ SetBoardToolOperation,
3594
+ StartBoardPresentationOperation,
3595
+ FitBoardToScreenOperation,
3596
+ ExportBoardFileOperation
3597
+ ];
3598
+ for (const op of ops) {
3599
+ this.disposeWithMe(this._commandService.registerCommand(op));
3600
+ }
3601
+ }
3602
+ _initMenus() {
3603
+ this._menuManagerService.appendRootMenu(boardsRootMenuExtension);
3604
+ this._menuManagerService.mergeMenu(boardsMenuSchema);
3605
+ }
3606
+ _initWorkbenchParts() {
3607
+ this.disposeWithMe(
3608
+ this._uiPartsService.registerComponent(import_ui8.BuiltInUIPart.LEFT_SIDEBAR, () => BoardsLeftSidebar)
3609
+ );
3610
+ this.disposeWithMe(
3611
+ this._uiPartsService.registerComponent(import_ui8.BuiltInUIPart.CONTENT, () => BoardsInfiniteCanvas)
3612
+ );
3613
+ this.disposeWithMe(
3614
+ this._uiPartsService.registerComponent(import_ui8.BuiltInUIPart.FOOTER, () => BoardsStatusBar)
3615
+ );
3616
+ this.disposeWithMe(
3617
+ this._uiPartsService.registerComponent(import_ui8.BuiltInUIPart.GLOBAL, () => BoardsModalsHost)
3618
+ );
3619
+ }
3620
+ };
3621
+ BoardsUIController = __decorateClass([
3622
+ __decorateParam(1, import_core7.ICommandService),
3623
+ __decorateParam(2, import_ui8.IMenuManagerService),
3624
+ __decorateParam(3, import_ui8.IUIPartsService),
3625
+ __decorateParam(4, import_ui8.ISidebarService),
3626
+ __decorateParam(5, (0, import_core7.Inject)(import_ui8.ComponentManager)),
3627
+ __decorateParam(6, (0, import_core7.Inject)(import_ui8.IconManager))
3628
+ ], BoardsUIController);
3629
+
3630
+ // src/locale/en-US.ts
3631
+ var enUS = {
3632
+ boards: {
3633
+ ribbon: {
3634
+ boardTab: "Whiteboard",
3635
+ selectTool: "Select (V)",
3636
+ handTool: "Hand Pan (H)",
3637
+ insertFrame: "Frame (F)",
3638
+ insertSwimlane: "Swimlane (S)",
3639
+ insertSticky: "Sticky Note (N)",
3640
+ insertShape: "Flowchart Shape",
3641
+ insertConnector: "Smart Connector (L)",
3642
+ insertInk: "Freehand Ink (P)",
3643
+ insertMindmap: "Mindmap (M)",
3644
+ insertEntityCard: "Entity Card (E)",
3645
+ mermaidStudio: "Mermaid Code Sync",
3646
+ presentationTour: "Frame Presentation",
3647
+ fitScreen: "Fit to Screen",
3648
+ inspector: "Inspector",
3649
+ exportSvg: "Export SVG",
3650
+ exportPdf: "Export PDF",
3651
+ exportPptx: "Export PPTX"
3652
+ },
3653
+ sidebar: {
3654
+ inspectorTitle: "Board & Element Inspector",
3655
+ framesTab: "Frames",
3656
+ layersTab: "Elements",
3657
+ templatesTab: "Templates"
3658
+ },
3659
+ mermaid: {
3660
+ modalTitle: "Bidirectional Mermaid Diagram Studio",
3661
+ parseAndInsert: "Parse & Insert to Canvas",
3662
+ reverseGenerate: "Reverse Generate from Canvas"
3663
+ }
3664
+ }
3665
+ };
3666
+ var en_US_default = enUS;
3667
+
3668
+ // src/locale/zh-CN.ts
3669
+ var zhCN = {
3670
+ boards: {
3671
+ ribbon: {
3672
+ boardTab: "\u767D\u677F\u5171\u521B",
3673
+ selectTool: "\u9009\u62E9 (V)",
3674
+ handTool: "\u6293\u624B\u5E73\u79FB (H)",
3675
+ insertFrame: "\u65B0\u5EFA\u753B\u6846 (F)",
3676
+ insertSwimlane: "\u6D41\u7A0B\u6CF3\u9053 (S)",
3677
+ insertSticky: "\u534F\u4F5C\u4FBF\u7B7E (N)",
3678
+ insertShape: "\u6D41\u7A0B\u56FE\u5F62\u72B6",
3679
+ insertConnector: "\u667A\u80FD\u8FDE\u7EBF (L)",
3680
+ insertInk: "\u81EA\u7531\u753B\u7B14 (P)",
3681
+ insertMindmap: "\u601D\u7EF4\u5BFC\u56FE (M)",
3682
+ insertEntityCard: "\u5B9E\u4F53\u6A21\u578B\u5361 (E)",
3683
+ mermaidStudio: "\u6D41\u7A0B\u56FE\u4EE3\u7801\u4E92\u8F6C (Mermaid)",
3684
+ presentationTour: "\u753B\u6846\u6F14\u793A\u653E\u6620",
3685
+ fitScreen: "\u9002\u5E94\u5C4F\u5E55",
3686
+ inspector: "\u5C5E\u6027\u9762\u677F",
3687
+ exportSvg: "\u5BFC\u51FA SVG",
3688
+ exportPdf: "\u5BFC\u51FA PDF",
3689
+ exportPptx: "\u5BFC\u51FA PPTX"
3690
+ },
3691
+ sidebar: {
3692
+ inspectorTitle: "\u767D\u677F\u4E0E\u56FE\u5F62\u5C5E\u6027",
3693
+ framesTab: "\u753B\u6846\u5BFC\u89C8",
3694
+ layersTab: "\u5143\u7D20\u5927\u7EB2",
3695
+ templatesTab: "\u573A\u666F\u6A21\u677F"
3696
+ },
3697
+ mermaid: {
3698
+ modalTitle: "Mermaid \u6D41\u7A0B\u56FE\u4E0E\u67B6\u6784\u4EE3\u7801\u53CC\u5411\u4E92\u8F6C\u5DE5\u4F5C\u53F0",
3699
+ parseAndInsert: "\u89E3\u6790\u5E76\u63D2\u5165\u753B\u5E03",
3700
+ reverseGenerate: "\u4ECE\u5F53\u524D\u753B\u5E03\u53CD\u5411\u751F\u6210\u4EE3\u7801"
3701
+ }
3702
+ }
3703
+ };
3704
+ var zh_CN_default = zhCN;
3705
+
3706
+ // src/plugin.ts
3707
+ var import_core8 = require("@univerjs/core");
3708
+ var import_engine_render = require("@univerjs/engine-render");
3709
+ var import_univer_boards8 = require("@yudaocode/univer-boards");
3710
+ var UNIVER_BOARDS_UI_PLUGIN_NAME = "UNIVER_BOARDS_UI_PLUGIN";
3711
+ var UniverBoardsUIPlugin = class extends import_core8.Plugin {
3712
+ constructor(_config = {}, _injector) {
3713
+ super();
3714
+ this._config = _config;
3715
+ this._injector = _injector;
3716
+ }
3717
+ onStarting() {
3718
+ if (this._injector.has(import_core8.LocaleService)) {
3719
+ this._injector.get(import_core8.LocaleService).load({
3720
+ [import_core8.LocaleType.ZH_CN]: zh_CN_default,
3721
+ [import_core8.LocaleType.EN_US]: en_US_default
3722
+ });
3723
+ }
3724
+ this._injector.add([
3725
+ BoardsUIController,
3726
+ {
3727
+ useFactory: () => this._injector.createInstance(BoardsUIController, this._config)
3728
+ }
3729
+ ]);
3730
+ this._injector.get(BoardsUIController);
3731
+ }
3732
+ };
3733
+ UniverBoardsUIPlugin.pluginName = UNIVER_BOARDS_UI_PLUGIN_NAME;
3734
+ UniverBoardsUIPlugin.packageName = "@yudaocode/univer-boards-ui";
3735
+ UniverBoardsUIPlugin.type = import_core8.UniverInstanceType.UNIVER_BOARD;
3736
+ UniverBoardsUIPlugin = __decorateClass([
3737
+ (0, import_core8.DependentOn)(import_engine_render.UniverRenderEnginePlugin, import_univer_boards8.UniverBoardsPlugin),
3738
+ __decorateParam(1, (0, import_core8.Inject)(import_core8.Injector))
3739
+ ], UniverBoardsUIPlugin);
3740
+
3741
+ // src/index.ts
3742
+ var VERSION = "1.6.218";
3743
+ // Annotate the CommonJS export names for ESM import in node:
3744
+ 0 && (module.exports = {
3745
+ BOARDS_RIBBON_GROUP,
3746
+ BOARDS_RIBBON_TAB,
3747
+ BOARD_ICON_MAP,
3748
+ BOARD_INSPECTOR_COMPONENT_KEY,
3749
+ BOARD_INSPECTOR_SIDEBAR_ID,
3750
+ BoardsInfiniteCanvas,
3751
+ BoardsInspectorPanel,
3752
+ BoardsLeftSidebar,
3753
+ BoardsMermaidModal,
3754
+ BoardsModalsHost,
3755
+ BoardsStatusBar,
3756
+ BoardsUIController,
3757
+ ExportBoardFileOperation,
3758
+ FitBoardToScreenOperation,
3759
+ OpenBoardMermaidModalOperation,
3760
+ SetBoardToolOperation,
3761
+ StartBoardPresentationOperation,
3762
+ ToggleBoardInspectorOperation,
3763
+ UNIVER_BOARDS_UI_PLUGIN_NAME,
3764
+ UniverBoardsUIPlugin,
3765
+ VERSION,
3766
+ boardsMenuSchema,
3767
+ boardsRootMenuExtension,
3768
+ enUS,
3769
+ openBoardInspectorSidebar,
3770
+ zhCN
3771
+ });
3772
+ //# sourceMappingURL=index.js.map