@univerjs/docs-toc-ui 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (116) hide show
  1. package/LICENSE +176 -0
  2. package/README.md +43 -0
  3. package/lib/cjs/index.js +735 -0
  4. package/lib/cjs/locale/ar-SA.js +32 -0
  5. package/lib/cjs/locale/ca-ES.js +32 -0
  6. package/lib/cjs/locale/de-DE.js +32 -0
  7. package/lib/cjs/locale/en-US.js +47 -0
  8. package/lib/cjs/locale/es-ES.js +32 -0
  9. package/lib/cjs/locale/fa-IR.js +32 -0
  10. package/lib/cjs/locale/fr-FR.js +32 -0
  11. package/lib/cjs/locale/id-ID.js +32 -0
  12. package/lib/cjs/locale/it-IT.js +32 -0
  13. package/lib/cjs/locale/ja-JP.js +32 -0
  14. package/lib/cjs/locale/ko-KR.js +32 -0
  15. package/lib/cjs/locale/pl-PL.js +32 -0
  16. package/lib/cjs/locale/pt-BR.js +32 -0
  17. package/lib/cjs/locale/ru-RU.js +32 -0
  18. package/lib/cjs/locale/sk-SK.js +32 -0
  19. package/lib/cjs/locale/vi-VN.js +32 -0
  20. package/lib/cjs/locale/zh-CN.js +32 -0
  21. package/lib/cjs/locale/zh-HK.js +32 -0
  22. package/lib/cjs/locale/zh-TW.js +32 -0
  23. package/lib/es/index.js +728 -0
  24. package/lib/es/locale/ar-SA.js +32 -0
  25. package/lib/es/locale/ca-ES.js +32 -0
  26. package/lib/es/locale/de-DE.js +32 -0
  27. package/lib/es/locale/en-US.js +47 -0
  28. package/lib/es/locale/es-ES.js +32 -0
  29. package/lib/es/locale/fa-IR.js +32 -0
  30. package/lib/es/locale/fr-FR.js +32 -0
  31. package/lib/es/locale/id-ID.js +32 -0
  32. package/lib/es/locale/it-IT.js +32 -0
  33. package/lib/es/locale/ja-JP.js +32 -0
  34. package/lib/es/locale/ko-KR.js +32 -0
  35. package/lib/es/locale/pl-PL.js +32 -0
  36. package/lib/es/locale/pt-BR.js +32 -0
  37. package/lib/es/locale/ru-RU.js +32 -0
  38. package/lib/es/locale/sk-SK.js +32 -0
  39. package/lib/es/locale/vi-VN.js +32 -0
  40. package/lib/es/locale/zh-CN.js +32 -0
  41. package/lib/es/locale/zh-HK.js +32 -0
  42. package/lib/es/locale/zh-TW.js +32 -0
  43. package/lib/index.css +156 -0
  44. package/lib/index.js +728 -0
  45. package/lib/locale/ar-SA.js +32 -0
  46. package/lib/locale/ca-ES.js +32 -0
  47. package/lib/locale/de-DE.js +32 -0
  48. package/lib/locale/en-US.js +47 -0
  49. package/lib/locale/es-ES.js +32 -0
  50. package/lib/locale/fa-IR.js +32 -0
  51. package/lib/locale/fr-FR.js +32 -0
  52. package/lib/locale/id-ID.js +32 -0
  53. package/lib/locale/it-IT.js +32 -0
  54. package/lib/locale/ja-JP.js +32 -0
  55. package/lib/locale/ko-KR.js +32 -0
  56. package/lib/locale/pl-PL.js +32 -0
  57. package/lib/locale/pt-BR.js +32 -0
  58. package/lib/locale/ru-RU.js +32 -0
  59. package/lib/locale/sk-SK.js +32 -0
  60. package/lib/locale/vi-VN.js +32 -0
  61. package/lib/locale/zh-CN.js +32 -0
  62. package/lib/locale/zh-HK.js +32 -0
  63. package/lib/locale/zh-TW.js +32 -0
  64. package/lib/types/commands/table-of-contents-dialog.operation.d.ts +21 -0
  65. package/lib/types/config/config.d.ts +22 -0
  66. package/lib/types/controllers/components.controller.d.ts +20 -0
  67. package/lib/types/controllers/table-of-contents-highlight.render-controller.d.ts +33 -0
  68. package/lib/types/controllers/table-of-contents-ribbon.controller.d.ts +27 -0
  69. package/lib/types/controllers/ui.controller.d.ts +20 -0
  70. package/lib/types/index.d.ts +18 -0
  71. package/lib/types/locale/ar-SA.d.ts +18 -0
  72. package/lib/types/locale/ca-ES.d.ts +18 -0
  73. package/lib/types/locale/de-DE.d.ts +18 -0
  74. package/lib/types/locale/en-US.d.ts +48 -0
  75. package/lib/types/locale/es-ES.d.ts +18 -0
  76. package/lib/types/locale/fa-IR.d.ts +18 -0
  77. package/lib/types/locale/fr-FR.d.ts +18 -0
  78. package/lib/types/locale/id-ID.d.ts +18 -0
  79. package/lib/types/locale/it-IT.d.ts +18 -0
  80. package/lib/types/locale/ja-JP.d.ts +18 -0
  81. package/lib/types/locale/ko-KR.d.ts +18 -0
  82. package/lib/types/locale/pl-PL.d.ts +18 -0
  83. package/lib/types/locale/pt-BR.d.ts +18 -0
  84. package/lib/types/locale/ru-RU.d.ts +18 -0
  85. package/lib/types/locale/sk-SK.d.ts +18 -0
  86. package/lib/types/locale/types.d.ts +18 -0
  87. package/lib/types/locale/vi-VN.d.ts +18 -0
  88. package/lib/types/locale/zh-CN.d.ts +18 -0
  89. package/lib/types/locale/zh-HK.d.ts +18 -0
  90. package/lib/types/locale/zh-TW.d.ts +18 -0
  91. package/lib/types/menu/menu.d.ts +22 -0
  92. package/lib/types/menu/schema.d.ts +19 -0
  93. package/lib/types/plugin.d.ts +32 -0
  94. package/lib/types/views/InsertTableOfContentsDialog.d.ts +29 -0
  95. package/lib/types/views/TableOfContentsDialog.d.ts +21 -0
  96. package/lib/umd/index.js +4 -0
  97. package/lib/umd/locale/ar-SA.js +1 -0
  98. package/lib/umd/locale/ca-ES.js +1 -0
  99. package/lib/umd/locale/de-DE.js +1 -0
  100. package/lib/umd/locale/en-US.js +1 -0
  101. package/lib/umd/locale/es-ES.js +1 -0
  102. package/lib/umd/locale/fa-IR.js +1 -0
  103. package/lib/umd/locale/fr-FR.js +1 -0
  104. package/lib/umd/locale/id-ID.js +1 -0
  105. package/lib/umd/locale/it-IT.js +1 -0
  106. package/lib/umd/locale/ja-JP.js +1 -0
  107. package/lib/umd/locale/ko-KR.js +1 -0
  108. package/lib/umd/locale/pl-PL.js +1 -0
  109. package/lib/umd/locale/pt-BR.js +1 -0
  110. package/lib/umd/locale/ru-RU.js +1 -0
  111. package/lib/umd/locale/sk-SK.js +1 -0
  112. package/lib/umd/locale/vi-VN.js +1 -0
  113. package/lib/umd/locale/zh-CN.js +1 -0
  114. package/lib/umd/locale/zh-HK.js +1 -0
  115. package/lib/umd/locale/zh-TW.js +1 -0
  116. package/package.json +90 -0
@@ -0,0 +1,735 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ let _univerjs_docs_toc = require("@univerjs/docs-toc");
3
+ let _univerjs_ui = require("@univerjs/ui");
4
+ let _univerjs_core = require("@univerjs/core");
5
+ let _univerjs_design = require("@univerjs/design");
6
+ let _univerjs_docs = require("@univerjs/docs");
7
+ let react = require("react");
8
+ let react_jsx_runtime = require("react/jsx-runtime");
9
+ let _univerjs_docs_ui = require("@univerjs/docs-ui");
10
+ let _univerjs_protocol = require("@univerjs/protocol");
11
+ let rxjs = require("rxjs");
12
+ let _univerjs_engine_render = require("@univerjs/engine-render");
13
+
14
+ //#region src/views/InsertTableOfContentsDialog.tsx
15
+ const INSERT_TABLE_OF_CONTENTS_DIALOG_COMPONENT = "doc.insert-table-of-contents-dialog";
16
+ const FORMAT_OPTIONS = [
17
+ ["fromTemplate", "docs-toc-ui.tableOfContents.formatFromTemplate"],
18
+ ["classic", "docs-toc-ui.tableOfContents.formatClassic"],
19
+ ["modern", "docs-toc-ui.tableOfContents.formatModern"],
20
+ ["simple", "docs-toc-ui.tableOfContents.formatSimple"]
21
+ ];
22
+ const LEADER_OPTIONS = [
23
+ ["none", "docs-toc-ui.tableOfContents.leaderNone"],
24
+ ["dots", "docs-toc-ui.tableOfContents.leaderDots"],
25
+ ["dashes", "docs-toc-ui.tableOfContents.leaderDashes"],
26
+ ["underline", "docs-toc-ui.tableOfContents.leaderUnderline"]
27
+ ];
28
+ function InsertTableOfContentsDialog(props) {
29
+ const localeService = (0, _univerjs_ui.useDependency)(_univerjs_core.LocaleService);
30
+ const [value, setValue] = (0, react.useState)(props.options);
31
+ const update = (patch) => {
32
+ const next = {
33
+ ...value,
34
+ ...patch
35
+ };
36
+ setValue(next);
37
+ props.onChange(next);
38
+ };
39
+ const leader = value.tabLeader === "dots" ? "··········" : value.tabLeader === "dashes" ? "----------" : value.tabLeader === "underline" ? "__________" : "";
40
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
41
+ className: "univer-grid univer-gap-4 univer-py-2",
42
+ "data-testid": "table-of-contents-insert-dialog",
43
+ children: [
44
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
45
+ className: "univer-grid univer-grid-cols-2 univer-gap-3",
46
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
47
+ className: "univer-grid univer-gap-1 univer-text-sm",
48
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: localeService.t("docs-toc-ui.tableOfContents.levels") }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("select", {
49
+ className: "univer-h-8 univer-rounded-md univer-border univer-bg-transparent univer-px-2",
50
+ value: value.levels,
51
+ onChange: (event) => update({ levels: Number(event.target.value) }),
52
+ children: Array.from({ length: 9 }, (_, index) => index + 1).map((level) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
53
+ value: level,
54
+ children: level
55
+ }, level))
56
+ })]
57
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
58
+ className: "univer-grid univer-gap-1 univer-text-sm",
59
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: localeService.t("docs-toc-ui.tableOfContents.format") }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("select", {
60
+ className: "univer-h-8 univer-rounded-md univer-border univer-bg-transparent univer-px-2",
61
+ value: value.format,
62
+ onChange: (event) => update({ format: event.target.value }),
63
+ children: FORMAT_OPTIONS.map(([format, label]) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
64
+ value: format,
65
+ children: localeService.t(label)
66
+ }, format))
67
+ })]
68
+ })]
69
+ }),
70
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
71
+ className: "univer-grid univer-gap-2 univer-text-sm",
72
+ children: [
73
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
74
+ className: "univer-flex univer-items-center univer-gap-2",
75
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
76
+ type: "checkbox",
77
+ checked: value.showPageNumbers,
78
+ onChange: (event) => update({
79
+ showPageNumbers: event.target.checked,
80
+ rightAlignPageNumbers: event.target.checked && value.rightAlignPageNumbers
81
+ })
82
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: localeService.t("docs-toc-ui.tableOfContents.showPageNumbers") })]
83
+ }),
84
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
85
+ className: "univer-flex univer-items-center univer-gap-2",
86
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
87
+ type: "checkbox",
88
+ checked: value.rightAlignPageNumbers,
89
+ disabled: !value.showPageNumbers,
90
+ onChange: (event) => update({ rightAlignPageNumbers: event.target.checked })
91
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: localeService.t("docs-toc-ui.tableOfContents.rightAlignPageNumbers") })]
92
+ }),
93
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
94
+ className: "univer-flex univer-items-center univer-justify-between univer-gap-3",
95
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: localeService.t("docs-toc-ui.tableOfContents.tabLeader") }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("select", {
96
+ className: "univer-h-8 univer-min-w-40 univer-rounded-md univer-border univer-bg-transparent univer-px-2",
97
+ value: value.tabLeader,
98
+ disabled: !value.showPageNumbers || !value.rightAlignPageNumbers,
99
+ onChange: (event) => update({ tabLeader: event.target.value }),
100
+ children: LEADER_OPTIONS.map(([tabLeader, label]) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("option", {
101
+ value: tabLeader,
102
+ children: localeService.t(label)
103
+ }, tabLeader))
104
+ })]
105
+ })
106
+ ]
107
+ }),
108
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
109
+ className: "univer-rounded-lg univer-border univer-bg-gray-50 univer-p-4 dark:univer-bg-gray-900",
110
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
111
+ className: "univer-mb-3 univer-text-xs univer-font-medium univer-text-gray-500",
112
+ children: localeService.t("docs-toc-ui.tableOfContents.preview")
113
+ }), Array.from({ length: Math.min(value.levels, 3) }, (_, index) => index).map((level) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
114
+ className: `
115
+ univer-flex univer-items-baseline univer-text-sm
116
+ ${value.format === "modern" ? "univer-mb-2" : "univer-mb-1"}
117
+ `,
118
+ style: { marginInlineStart: `${level * (value.format === "simple" ? 12 : value.format === "classic" ? 14 : value.format === "modern" ? 20 : 18)}px` },
119
+ children: [
120
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", { children: [
121
+ localeService.t("docs-toc-ui.tableOfContents.previewHeading"),
122
+ " ",
123
+ level + 1
124
+ ] }),
125
+ value.showPageNumbers && value.rightAlignPageNumbers && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
126
+ className: "univer-mx-2 univer-flex-1 univer-overflow-hidden univer-whitespace-nowrap univer-text-gray-400",
127
+ children: leader
128
+ }),
129
+ value.showPageNumbers && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
130
+ className: value.rightAlignPageNumbers ? "" : "univer-ml-2",
131
+ children: level + 1
132
+ })
133
+ ]
134
+ }, level))]
135
+ })
136
+ ]
137
+ });
138
+ }
139
+
140
+ //#endregion
141
+ //#region src/views/TableOfContentsDialog.tsx
142
+ const TABLE_OF_CONTENTS_DIALOG_COMPONENT = "doc.table-of-contents-dialog";
143
+ function TableOfContentsDialog(props) {
144
+ const localeService = (0, _univerjs_ui.useDependency)(_univerjs_core.LocaleService);
145
+ const [mode, setMode] = (0, react.useState)(props.mode);
146
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
147
+ className: "univer-grid univer-gap-4 univer-py-2",
148
+ "data-testid": "table-of-contents-update-dialog",
149
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
150
+ className: "univer-m-0 univer-text-sm",
151
+ children: localeService.t("docs-toc-ui.tableOfContents.updateHint")
152
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("fieldset", {
153
+ className: "univer-grid univer-gap-3 univer-border-0 univer-p-0",
154
+ children: [["pageNumbersOnly", "docs-toc-ui.tableOfContents.updatePageNumbersOnly"], ["entireTable", "docs-toc-ui.tableOfContents.updateEntireTable"]].map(([value, label]) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
155
+ className: "univer-flex univer-gap-3 univer-rounded-lg univer-border univer-p-3",
156
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
157
+ type: "radio",
158
+ name: "toc-update-mode",
159
+ value,
160
+ checked: mode === value,
161
+ onChange: () => {
162
+ setMode(value);
163
+ props.onModeChange(value);
164
+ }
165
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
166
+ className: "univer-text-sm",
167
+ children: localeService.t(label)
168
+ })]
169
+ }, value))
170
+ })]
171
+ });
172
+ }
173
+
174
+ //#endregion
175
+ //#region src/commands/table-of-contents-dialog.operation.ts
176
+ const TABLE_OF_CONTENTS_DIALOG_ID = "doc.dialog.update-table-of-contents";
177
+ const INSERT_TABLE_OF_CONTENTS_DIALOG_ID = "doc.dialog.insert-table-of-contents";
178
+ const DEFAULT_INSERT_VALUE = {
179
+ levels: 3,
180
+ showPageNumbers: true,
181
+ rightAlignPageNumbers: true,
182
+ tabLeader: "dots",
183
+ format: "fromTemplate"
184
+ };
185
+ function showNoHeadingsMessage(accessor) {
186
+ accessor.get(_univerjs_ui.IMessageService).show({
187
+ type: _univerjs_design.MessageType.Warning,
188
+ content: accessor.get(_univerjs_core.LocaleService).t("docs-toc-ui.tableOfContents.noHeadings")
189
+ });
190
+ }
191
+ async function insertTableOfContents(accessor, value, title) {
192
+ const doc = accessor.get(_univerjs_core.IUniverInstanceService).getCurrentUnitOfType(_univerjs_core.UniverInstanceType.UNIVER_DOC);
193
+ if (!doc || (0, _univerjs_docs_toc.countTableOfContentsHeadings)(doc.getBody(), value.levels) === 0) {
194
+ showNoHeadingsMessage(accessor);
195
+ return false;
196
+ }
197
+ return Boolean(await accessor.get(_univerjs_core.ICommandService).executeCommand(_univerjs_docs_toc.InsertTableOfContentsCommand.id, {
198
+ unitId: doc.getUnitId(),
199
+ ...value,
200
+ title
201
+ }));
202
+ }
203
+ const InsertTableOfContentsOperation = {
204
+ id: "doc.operation.insert-table-of-contents",
205
+ type: _univerjs_core.CommandType.OPERATION,
206
+ async handler(accessor, params) {
207
+ if ((params === null || params === void 0 ? void 0 : params.mode) === "automatic") {
208
+ const title = accessor.get(_univerjs_core.LocaleService).t("docs-toc-ui.tableOfContents.contentsTitle");
209
+ return insertTableOfContents(accessor, DEFAULT_INSERT_VALUE, title);
210
+ }
211
+ if ((params === null || params === void 0 ? void 0 : params.mode) !== "custom") return false;
212
+ if (!accessor.get(_univerjs_core.IUniverInstanceService).getCurrentUnitOfType(_univerjs_core.UniverInstanceType.UNIVER_DOC)) return false;
213
+ const confirmService = accessor.get(_univerjs_core.IConfirmService);
214
+ const localeService = accessor.get(_univerjs_core.LocaleService);
215
+ const state = { options: { ...DEFAULT_INSERT_VALUE } };
216
+ await confirmService.open({
217
+ id: INSERT_TABLE_OF_CONTENTS_DIALOG_ID,
218
+ width: 520,
219
+ title: { title: localeService.t("docs-toc-ui.tableOfContents.customTitle") },
220
+ children: { label: {
221
+ name: INSERT_TABLE_OF_CONTENTS_DIALOG_COMPONENT,
222
+ props: {
223
+ options: state.options,
224
+ onChange: (value) => {
225
+ state.options = value;
226
+ }
227
+ }
228
+ } },
229
+ onConfirm: async () => {
230
+ if (await insertTableOfContents(accessor, state.options)) confirmService.close(INSERT_TABLE_OF_CONTENTS_DIALOG_ID);
231
+ },
232
+ onClose: () => confirmService.close(INSERT_TABLE_OF_CONTENTS_DIALOG_ID)
233
+ });
234
+ return true;
235
+ }
236
+ };
237
+ const OpenTableOfContentsDialogOperation = {
238
+ id: "doc.operation.open-table-of-contents-dialog",
239
+ type: _univerjs_core.CommandType.OPERATION,
240
+ async handler(accessor) {
241
+ var _toc$properties;
242
+ const doc = accessor.get(_univerjs_core.IUniverInstanceService).getCurrentUnitOfType(_univerjs_core.UniverInstanceType.UNIVER_DOC);
243
+ const selection = accessor.get(_univerjs_docs.DocSelectionManagerService).getActiveTextRange();
244
+ const toc = (0, _univerjs_docs_toc.findTableOfContentsAtOffset)(doc === null || doc === void 0 ? void 0 : doc.getBody(), selection === null || selection === void 0 ? void 0 : selection.startOffset);
245
+ if (!doc || !toc || ((_toc$properties = toc.properties) === null || _toc$properties === void 0 ? void 0 : _toc$properties.locked) === _univerjs_core.BooleanNumber.TRUE) return false;
246
+ const confirmService = accessor.get(_univerjs_core.IConfirmService);
247
+ const commandService = accessor.get(_univerjs_core.ICommandService);
248
+ const localeService = accessor.get(_univerjs_core.LocaleService);
249
+ const state = { mode: "pageNumbersOnly" };
250
+ await confirmService.open({
251
+ id: TABLE_OF_CONTENTS_DIALOG_ID,
252
+ width: 420,
253
+ title: { title: localeService.t("docs-toc-ui.tableOfContents.updateTitle") },
254
+ children: { label: {
255
+ name: TABLE_OF_CONTENTS_DIALOG_COMPONENT,
256
+ props: {
257
+ mode: state.mode,
258
+ onModeChange: (mode) => {
259
+ state.mode = mode;
260
+ }
261
+ }
262
+ } },
263
+ onConfirm: async () => {
264
+ try {
265
+ await commandService.executeCommand(_univerjs_docs_toc.UpdateTableOfContentsCommand.id, {
266
+ unitId: doc.getUnitId(),
267
+ rangeId: toc.rangeId,
268
+ mode: state.mode
269
+ });
270
+ } finally {
271
+ confirmService.close(TABLE_OF_CONTENTS_DIALOG_ID);
272
+ }
273
+ },
274
+ onClose: () => confirmService.close(TABLE_OF_CONTENTS_DIALOG_ID)
275
+ });
276
+ return true;
277
+ }
278
+ };
279
+
280
+ //#endregion
281
+ //#region src/menu/menu.ts
282
+ const INSERT_TABLE_OF_CONTENTS_MENU_ID = "doc.menu.insert-table-of-contents";
283
+ function getActiveTableOfContentsObservable(accessor) {
284
+ const selectionManager = accessor.get(_univerjs_docs.DocSelectionManagerService);
285
+ const instanceService = accessor.get(_univerjs_core.IUniverInstanceService);
286
+ return new rxjs.Observable((subscriber) => {
287
+ const emit = () => {
288
+ const doc = instanceService.getCurrentUnitOfType(_univerjs_core.UniverInstanceType.UNIVER_DOC);
289
+ const selection = selectionManager.getActiveTextRange();
290
+ subscriber.next((selection === null || selection === void 0 ? void 0 : selection.segmentId) ? void 0 : (0, _univerjs_docs_toc.findTableOfContentsAtOffset)(doc === null || doc === void 0 ? void 0 : doc.getBody(), selection === null || selection === void 0 ? void 0 : selection.startOffset));
291
+ };
292
+ emit();
293
+ const selectionSubscription = selectionManager.textSelection$.subscribe(emit);
294
+ const unitSubscription = instanceService.getCurrentTypeOfUnit$(_univerjs_core.UniverInstanceType.UNIVER_DOC).subscribe(emit);
295
+ const documentSubscription = accessor.get(_univerjs_docs.DocStateChangeManagerService).docStateChange$.subscribe(emit);
296
+ return () => {
297
+ selectionSubscription.unsubscribe();
298
+ unitSubscription.unsubscribe();
299
+ documentSubscription.unsubscribe();
300
+ };
301
+ });
302
+ }
303
+ function getInsertTableOfContentsDisabledObservable(accessor) {
304
+ const selectionManager = accessor.get(_univerjs_docs.DocSelectionManagerService);
305
+ const instanceService = accessor.get(_univerjs_core.IUniverInstanceService);
306
+ return new rxjs.Observable((subscriber) => {
307
+ const emit = () => {
308
+ const doc = instanceService.getCurrentUnitOfType(_univerjs_core.UniverInstanceType.UNIVER_DOC);
309
+ const selection = selectionManager.getActiveTextRange();
310
+ subscriber.next(!selection || selection.startOffset !== selection.endOffset || Boolean(selection.segmentId) || Boolean((0, _univerjs_docs_toc.findTableOfContentsAtOffset)(doc === null || doc === void 0 ? void 0 : doc.getBody(), selection.startOffset)));
311
+ };
312
+ emit();
313
+ const selectionSubscription = selectionManager.textSelection$.subscribe(emit);
314
+ const unitSubscription = instanceService.getCurrentTypeOfUnit$(_univerjs_core.UniverInstanceType.UNIVER_DOC).subscribe(emit);
315
+ return () => {
316
+ selectionSubscription.unsubscribe();
317
+ unitSubscription.unsubscribe();
318
+ };
319
+ });
320
+ }
321
+ function InsertTableOfContentsMenuFactory(accessor) {
322
+ const permissionDisabled$ = (0, _univerjs_docs_ui.disableMenuWithoutDocumentUnitPermission)(accessor, _univerjs_protocol.UnitAction.Edit);
323
+ return {
324
+ id: INSERT_TABLE_OF_CONTENTS_MENU_ID,
325
+ type: _univerjs_ui.MenuItemType.SUBITEMS,
326
+ icon: "UnorderIcon",
327
+ title: "docs-toc-ui.tableOfContents.insertTitle",
328
+ selectionsCommandId: InsertTableOfContentsOperation.id,
329
+ selections: [{
330
+ value: "automatic",
331
+ label: "docs-toc-ui.tableOfContents.automaticTitle",
332
+ icon: "UnorderIcon",
333
+ params: { mode: "automatic" }
334
+ }, {
335
+ value: "custom",
336
+ label: "docs-toc-ui.tableOfContents.customTitle",
337
+ icon: "DocSettingIcon",
338
+ params: { mode: "custom" }
339
+ }],
340
+ disabled$: (0, rxjs.combineLatest)([permissionDisabled$, getInsertTableOfContentsDisabledObservable(accessor)]).pipe((0, rxjs.map)(([permissionDisabled, unavailable]) => permissionDisabled || unavailable)),
341
+ hidden$: (0, _univerjs_ui.getMenuHiddenObservable)(accessor, _univerjs_core.UniverInstanceType.UNIVER_DOC)
342
+ };
343
+ }
344
+ function UpdateTableOfContentsMenuFactory(accessor) {
345
+ return {
346
+ id: OpenTableOfContentsDialogOperation.id,
347
+ commandId: OpenTableOfContentsDialogOperation.id,
348
+ type: _univerjs_ui.MenuItemType.BUTTON,
349
+ icon: "UnorderIcon",
350
+ title: "docs-toc-ui.tableOfContents.updateTitle",
351
+ disabled$: (0, rxjs.combineLatest)([(0, _univerjs_docs_ui.disableMenuWithoutDocumentUnitPermission)(accessor, _univerjs_protocol.UnitAction.Edit), getActiveTableOfContentsObservable(accessor)]).pipe((0, rxjs.map)(([permissionDisabled, toc]) => {
352
+ var _toc$properties;
353
+ return permissionDisabled || !toc || ((_toc$properties = toc.properties) === null || _toc$properties === void 0 ? void 0 : _toc$properties.locked) === _univerjs_core.BooleanNumber.TRUE;
354
+ })),
355
+ hidden$: (0, rxjs.combineLatest)([(0, _univerjs_ui.getMenuHiddenObservable)(accessor, _univerjs_core.UniverInstanceType.UNIVER_DOC), getActiveTableOfContentsObservable(accessor)]).pipe((0, rxjs.map)(([hidden, toc]) => hidden || !toc))
356
+ };
357
+ }
358
+ function DeleteTableOfContentsMenuFactory(accessor) {
359
+ return {
360
+ id: _univerjs_docs_toc.DeleteTableOfContentsCommand.id,
361
+ commandId: _univerjs_docs_toc.DeleteTableOfContentsCommand.id,
362
+ type: _univerjs_ui.MenuItemType.BUTTON,
363
+ icon: "DeleteIcon",
364
+ title: "docs-toc-ui.tableOfContents.removeTitle",
365
+ disabled$: (0, _univerjs_docs_ui.disableMenuWithoutDocumentUnitPermission)(accessor, _univerjs_protocol.UnitAction.Edit),
366
+ hidden$: (0, rxjs.combineLatest)([(0, _univerjs_ui.getMenuHiddenObservable)(accessor, _univerjs_core.UniverInstanceType.UNIVER_DOC), getActiveTableOfContentsObservable(accessor)]).pipe((0, rxjs.map)(([hidden, toc]) => hidden || !toc))
367
+ };
368
+ }
369
+
370
+ //#endregion
371
+ //#region src/menu/schema.ts
372
+ const DOC_TABLE_OF_CONTENTS_RIBBON_TAB = "ribbon.table-of-contents";
373
+ const DOC_TABLE_OF_CONTENTS_RIBBON_GROUP = "ribbon.table-of-contents.manage";
374
+ const tableOfContentsRibbonMenuSchema = { [_univerjs_ui.MenuManagerPosition.RIBBON]: { [DOC_TABLE_OF_CONTENTS_RIBBON_TAB]: {
375
+ order: 100,
376
+ title: "docs-toc-ui.tableOfContents.title",
377
+ contextual: true,
378
+ [DOC_TABLE_OF_CONTENTS_RIBBON_GROUP]: {
379
+ order: 0,
380
+ [OpenTableOfContentsDialogOperation.id]: {
381
+ order: 0,
382
+ gridLayout: {
383
+ row: 1,
384
+ column: 1,
385
+ rowSpan: 2,
386
+ showLabel: true
387
+ },
388
+ menuItemFactory: UpdateTableOfContentsMenuFactory
389
+ },
390
+ [_univerjs_docs_toc.DeleteTableOfContentsCommand.id]: {
391
+ order: 1,
392
+ gridLayout: {
393
+ row: 1,
394
+ column: 2,
395
+ rowSpan: 2,
396
+ showLabel: true
397
+ },
398
+ menuItemFactory: DeleteTableOfContentsMenuFactory
399
+ }
400
+ }
401
+ } } };
402
+ const DocsTocUIMenuSchema = {
403
+ [_univerjs_ui.RibbonInsertGroup.CELL]: { [INSERT_TABLE_OF_CONTENTS_MENU_ID]: {
404
+ order: 7,
405
+ gridLayout: {
406
+ row: 1,
407
+ column: 1,
408
+ showLabel: true
409
+ },
410
+ menuItemFactory: InsertTableOfContentsMenuFactory
411
+ } },
412
+ [_univerjs_ui.ContextMenuPosition.MAIN_AREA]: { [_univerjs_ui.ContextMenuGroup.LAYOUT]: {
413
+ [OpenTableOfContentsDialogOperation.id]: {
414
+ order: -1,
415
+ menuItemFactory: UpdateTableOfContentsMenuFactory
416
+ },
417
+ [_univerjs_docs_toc.DeleteTableOfContentsCommand.id]: {
418
+ order: -.5,
419
+ menuItemFactory: DeleteTableOfContentsMenuFactory
420
+ }
421
+ } }
422
+ };
423
+
424
+ //#endregion
425
+ //#region package.json
426
+ var name = "@univerjs/docs-toc-ui";
427
+ var version = "1.0.0";
428
+
429
+ //#endregion
430
+ //#region src/config/config.ts
431
+ const DOCS_TOC_UI_PLUGIN_CONFIG_KEY = "docs-toc-ui.config";
432
+ const configSymbol = Symbol(DOCS_TOC_UI_PLUGIN_CONFIG_KEY);
433
+ const defaultPluginConfig = {};
434
+
435
+ //#endregion
436
+ //#region \0@oxc-project+runtime@0.149.0/helpers/esm/decorateParam.js
437
+ function __decorateParam(paramIndex, decorator) {
438
+ return function(target, key) {
439
+ decorator(target, key, paramIndex);
440
+ };
441
+ }
442
+
443
+ //#endregion
444
+ //#region \0@oxc-project+runtime@0.149.0/helpers/esm/decorate.js
445
+ function __decorate(decorators, target, key, desc) {
446
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
447
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
448
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
449
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
450
+ }
451
+
452
+ //#endregion
453
+ //#region src/controllers/components.controller.ts
454
+ /**
455
+ * Copyright 2023-present DreamNum Co., Ltd.
456
+ *
457
+ * Licensed under the Apache License, Version 2.0 (the "License");
458
+ * you may not use this file except in compliance with the License.
459
+ * You may obtain a copy of the License at
460
+ *
461
+ * http://www.apache.org/licenses/LICENSE-2.0
462
+ *
463
+ * Unless required by applicable law or agreed to in writing, software
464
+ * distributed under the License is distributed on an "AS IS" BASIS,
465
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
466
+ * See the License for the specific language governing permissions and
467
+ * limitations under the License.
468
+ */
469
+ let ComponentsController = class ComponentsController extends _univerjs_core.Disposable {
470
+ constructor(componentManager) {
471
+ super();
472
+ this.disposeWithMe(componentManager.register(TABLE_OF_CONTENTS_DIALOG_COMPONENT, TableOfContentsDialog));
473
+ this.disposeWithMe(componentManager.register(INSERT_TABLE_OF_CONTENTS_DIALOG_COMPONENT, InsertTableOfContentsDialog));
474
+ }
475
+ };
476
+ ComponentsController = __decorate([__decorateParam(0, (0, _univerjs_core.Inject)(_univerjs_ui.ComponentManager))], ComponentsController);
477
+
478
+ //#endregion
479
+ //#region \0@oxc-project+runtime@0.149.0/helpers/esm/typeof.js
480
+ function _typeof(o) {
481
+ "@babel/helpers - typeof";
482
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
483
+ return typeof o;
484
+ } : function(o) {
485
+ return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
486
+ }, _typeof(o);
487
+ }
488
+
489
+ //#endregion
490
+ //#region \0@oxc-project+runtime@0.149.0/helpers/esm/toPrimitive.js
491
+ function toPrimitive(t, r) {
492
+ if ("object" != _typeof(t) || !t) return t;
493
+ var e = t[Symbol.toPrimitive];
494
+ if (void 0 !== e) {
495
+ var i = e.call(t, r || "default");
496
+ if ("object" != _typeof(i)) return i;
497
+ throw new TypeError("@@toPrimitive must return a primitive value.");
498
+ }
499
+ return ("string" === r ? String : Number)(t);
500
+ }
501
+
502
+ //#endregion
503
+ //#region \0@oxc-project+runtime@0.149.0/helpers/esm/toPropertyKey.js
504
+ function toPropertyKey(t) {
505
+ var i = toPrimitive(t, "string");
506
+ return "symbol" == _typeof(i) ? i : i + "";
507
+ }
508
+
509
+ //#endregion
510
+ //#region \0@oxc-project+runtime@0.149.0/helpers/esm/defineProperty.js
511
+ function _defineProperty(e, r, t) {
512
+ return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
513
+ value: t,
514
+ enumerable: !0,
515
+ configurable: !0,
516
+ writable: !0
517
+ }) : e[r] = t, e;
518
+ }
519
+
520
+ //#endregion
521
+ //#region src/controllers/table-of-contents-highlight.render-controller.ts
522
+ const RANGE_PADDING = 4;
523
+ let TableOfContentsHighlightRenderController = class TableOfContentsHighlightRenderController extends _univerjs_core.RxDisposable {
524
+ constructor(_context, _instanceService, _selectionManager, _skeletonManager, _themeService) {
525
+ super();
526
+ this._context = _context;
527
+ this._instanceService = _instanceService;
528
+ this._selectionManager = _selectionManager;
529
+ this._skeletonManager = _skeletonManager;
530
+ this._themeService = _themeService;
531
+ _defineProperty(this, "_range", null);
532
+ _defineProperty(this, "_outline", null);
533
+ _defineProperty(this, "_rangeId", null);
534
+ this._selectionManager.textSelection$.pipe((0, rxjs.takeUntil)(this.dispose$)).subscribe(() => this._update());
535
+ this._skeletonManager.currentSkeleton$.pipe((0, rxjs.takeUntil)(this.dispose$)).subscribe(() => this._update(true));
536
+ this._instanceService.getCurrentTypeOfUnit$(_univerjs_core.UniverInstanceType.UNIVER_DOC).pipe((0, rxjs.takeUntil)(this.dispose$)).subscribe(() => this._update());
537
+ this._update();
538
+ }
539
+ _update(force = false) {
540
+ const currentDoc = this._instanceService.getCurrentUnitOfType(_univerjs_core.UniverInstanceType.UNIVER_DOC);
541
+ const selection = this._selectionManager.getActiveTextRange();
542
+ const toc = (currentDoc === null || currentDoc === void 0 ? void 0 : currentDoc.getUnitId()) === this._context.unitId && !(selection === null || selection === void 0 ? void 0 : selection.segmentId) ? (0, _univerjs_docs_toc.findTableOfContentsAtOffset)(this._context.unit.getBody(), selection === null || selection === void 0 ? void 0 : selection.startOffset) : void 0;
543
+ if (!toc) {
544
+ this._clear();
545
+ return;
546
+ }
547
+ if (!force && toc.rangeId === this._rangeId) return;
548
+ this._clear();
549
+ const document = this._context.mainComponent;
550
+ const endOffset = Math.max(toc.startIndex + 1, toc.endIndex - 1);
551
+ if (!document) return;
552
+ const primary = this._themeService.getColorFromTheme("primary.600");
553
+ const skeleton = this._skeletonManager.getSkeleton();
554
+ const startPosition = skeleton.findNodePositionByCharIndex(toc.startIndex + 1, true, "", -1);
555
+ const endPosition = skeleton.findNodePositionByCharIndex(endOffset, true, "", -1);
556
+ if (!startPosition || !endPosition) return;
557
+ const offsetConfig = document.getOffsetConfig();
558
+ const { borderBoxPointGroup } = new _univerjs_docs_ui.NodePositionConvertToCursor(offsetConfig, skeleton).getRangePointData(startPosition, endPosition);
559
+ const bounds = getPointGroupBounds(borderBoxPointGroup);
560
+ if (!bounds) return;
561
+ const range = new _univerjs_engine_render.RegularPolygon(`__DocTocFill__${(0, _univerjs_core.generateRandomId)()}`, {
562
+ pointsGroup: borderBoxPointGroup,
563
+ left: offsetConfig.docsLeft,
564
+ top: offsetConfig.docsTop,
565
+ fill: new _univerjs_core.ColorKit(primary).setAlpha(.08).toRgbString(),
566
+ evented: false,
567
+ debounceParentDirty: false
568
+ });
569
+ const outline = new _univerjs_engine_render.Rect(`__DocTocRange__${toc.rangeId}`, {
570
+ left: bounds.left + offsetConfig.docsLeft - RANGE_PADDING,
571
+ top: bounds.top + offsetConfig.docsTop - RANGE_PADDING,
572
+ width: bounds.width + 8,
573
+ height: bounds.height + 8,
574
+ radius: 2,
575
+ fill: "rgba(0, 0, 0, 0)",
576
+ stroke: new _univerjs_core.ColorKit(primary).setAlpha(.8).toRgbString(),
577
+ strokeWidth: 1,
578
+ evented: false,
579
+ debounceParentDirty: false
580
+ });
581
+ this._context.scene.addObject(range, _univerjs_docs_ui.TEXT_RANGE_LAYER_INDEX);
582
+ this._context.scene.addObject(outline, _univerjs_docs_ui.TEXT_RANGE_LAYER_INDEX);
583
+ this._range = range;
584
+ this._outline = outline;
585
+ this._rangeId = toc.rangeId;
586
+ this._context.scene.makeDirty();
587
+ }
588
+ _clear() {
589
+ var _this$_range, _this$_outline;
590
+ if (!this._range && !this._outline) {
591
+ this._rangeId = null;
592
+ return;
593
+ }
594
+ (_this$_range = this._range) === null || _this$_range === void 0 || _this$_range.dispose();
595
+ (_this$_outline = this._outline) === null || _this$_outline === void 0 || _this$_outline.dispose();
596
+ this._range = null;
597
+ this._outline = null;
598
+ this._rangeId = null;
599
+ this._context.scene.makeDirty();
600
+ }
601
+ dispose() {
602
+ this._clear();
603
+ super.dispose();
604
+ }
605
+ };
606
+ TableOfContentsHighlightRenderController = __decorate([
607
+ __decorateParam(1, _univerjs_core.IUniverInstanceService),
608
+ __decorateParam(2, (0, _univerjs_core.Inject)(_univerjs_docs.DocSelectionManagerService)),
609
+ __decorateParam(3, (0, _univerjs_core.Inject)(_univerjs_docs.DocSkeletonManagerService)),
610
+ __decorateParam(4, (0, _univerjs_core.Inject)(_univerjs_core.ThemeService))
611
+ ], TableOfContentsHighlightRenderController);
612
+ function getPointGroupBounds(pointsGroup) {
613
+ const points = pointsGroup.flat();
614
+ if (!points.length) return null;
615
+ const left = Math.min(...points.map((point) => point.x));
616
+ const top = Math.min(...points.map((point) => point.y));
617
+ const right = Math.max(...points.map((point) => point.x));
618
+ const bottom = Math.max(...points.map((point) => point.y));
619
+ return {
620
+ left,
621
+ top,
622
+ width: right - left,
623
+ height: bottom - top
624
+ };
625
+ }
626
+
627
+ //#endregion
628
+ //#region src/controllers/table-of-contents-ribbon.controller.ts
629
+ let TableOfContentsRibbonController = class TableOfContentsRibbonController extends _univerjs_core.Disposable {
630
+ constructor(_instanceService, _selectionManager, _ribbonService) {
631
+ super();
632
+ this._instanceService = _instanceService;
633
+ this._selectionManager = _selectionManager;
634
+ this._ribbonService = _ribbonService;
635
+ _defineProperty(this, "_visible", false);
636
+ this.disposeWithMe(this._selectionManager.textSelection$.subscribe(() => this._update()));
637
+ this.disposeWithMe(this._instanceService.getCurrentTypeOfUnit$(_univerjs_core.UniverInstanceType.UNIVER_DOC).subscribe(() => this._update()));
638
+ this._update();
639
+ }
640
+ _update() {
641
+ const doc = this._instanceService.getCurrentUnitOfType(_univerjs_core.UniverInstanceType.UNIVER_DOC);
642
+ const selection = this._selectionManager.getActiveTextRange();
643
+ const visible = Boolean(doc && selection && !selection.segmentId && (0, _univerjs_docs_toc.findTableOfContentsAtOffset)(doc.getBody(), selection.startOffset));
644
+ if (visible === this._visible) return;
645
+ this._visible = visible;
646
+ if (visible) this._ribbonService.showContextualTab(DOC_TABLE_OF_CONTENTS_RIBBON_TAB, { activate: true });
647
+ else this._ribbonService.hideContextualTab(DOC_TABLE_OF_CONTENTS_RIBBON_TAB);
648
+ }
649
+ dispose() {
650
+ if (this._visible) this._ribbonService.hideContextualTab(DOC_TABLE_OF_CONTENTS_RIBBON_TAB);
651
+ super.dispose();
652
+ }
653
+ };
654
+ TableOfContentsRibbonController = __decorate([
655
+ __decorateParam(0, _univerjs_core.IUniverInstanceService),
656
+ __decorateParam(1, (0, _univerjs_core.Inject)(_univerjs_docs.DocSelectionManagerService)),
657
+ __decorateParam(2, _univerjs_ui.IRibbonService)
658
+ ], TableOfContentsRibbonController);
659
+
660
+ //#endregion
661
+ //#region src/controllers/ui.controller.ts
662
+ /**
663
+ * Copyright 2023-present DreamNum Co., Ltd.
664
+ *
665
+ * Licensed under the Apache License, Version 2.0 (the "License");
666
+ * you may not use this file except in compliance with the License.
667
+ * You may obtain a copy of the License at
668
+ *
669
+ * http://www.apache.org/licenses/LICENSE-2.0
670
+ *
671
+ * Unless required by applicable law or agreed to in writing, software
672
+ * distributed under the License is distributed on an "AS IS" BASIS,
673
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
674
+ * See the License for the specific language governing permissions and
675
+ * limitations under the License.
676
+ */
677
+ let DocsTocUIController = class DocsTocUIController extends _univerjs_core.Disposable {
678
+ constructor(commandService, menuManagerService) {
679
+ super();
680
+ this.disposeWithMe(commandService.registerCommand(OpenTableOfContentsDialogOperation));
681
+ this.disposeWithMe(commandService.registerCommand(InsertTableOfContentsOperation));
682
+ menuManagerService.appendRootMenu(tableOfContentsRibbonMenuSchema);
683
+ menuManagerService.mergeMenu(DocsTocUIMenuSchema);
684
+ }
685
+ };
686
+ DocsTocUIController = __decorate([__decorateParam(0, _univerjs_core.ICommandService), __decorateParam(1, _univerjs_ui.IMenuManagerService)], DocsTocUIController);
687
+
688
+ //#endregion
689
+ //#region src/plugin.ts
690
+ let UniverDocsTocUIPlugin = class UniverDocsTocUIPlugin extends _univerjs_core.Plugin {
691
+ constructor(_config = defaultPluginConfig, _injector, _configService, _renderManagerService) {
692
+ super();
693
+ this._config = _config;
694
+ this._injector = _injector;
695
+ this._configService = _configService;
696
+ this._renderManagerService = _renderManagerService;
697
+ const { menu, ...rest } = (0, _univerjs_core.merge)({}, defaultPluginConfig, this._config);
698
+ if (menu) this._configService.setConfig("menu", menu, { merge: true });
699
+ this._configService.setConfig(DOCS_TOC_UI_PLUGIN_CONFIG_KEY, rest);
700
+ }
701
+ onStarting() {
702
+ [
703
+ [ComponentsController],
704
+ [DocsTocUIController],
705
+ [TableOfContentsRibbonController]
706
+ ].forEach((dependency) => this._injector.add(dependency));
707
+ this._injector.get(ComponentsController);
708
+ this._injector.get(DocsTocUIController);
709
+ }
710
+ onReady() {
711
+ this._injector.get(TableOfContentsRibbonController);
712
+ }
713
+ onRendered() {
714
+ this.disposeWithMe(this._renderManagerService.registerRenderModule(_univerjs_core.UniverInstanceType.UNIVER_DOC, [TableOfContentsHighlightRenderController]));
715
+ }
716
+ };
717
+ _defineProperty(UniverDocsTocUIPlugin, "pluginName", "DOCS_TOC_UI_PLUGIN");
718
+ _defineProperty(UniverDocsTocUIPlugin, "packageName", name);
719
+ _defineProperty(UniverDocsTocUIPlugin, "version", version);
720
+ _defineProperty(UniverDocsTocUIPlugin, "type", _univerjs_core.UniverInstanceType.UNIVER_DOC);
721
+ UniverDocsTocUIPlugin = __decorate([
722
+ (0, _univerjs_core.DependentOn)(_univerjs_docs.UniverDocsPlugin, _univerjs_engine_render.UniverRenderEnginePlugin, _univerjs_docs_toc.UniverDocsTocPlugin, _univerjs_docs_ui.UniverDocsUIPlugin),
723
+ __decorateParam(1, (0, _univerjs_core.Inject)(_univerjs_core.Injector)),
724
+ __decorateParam(2, _univerjs_core.IConfigService),
725
+ __decorateParam(3, _univerjs_engine_render.IRenderManagerService)
726
+ ], UniverDocsTocUIPlugin);
727
+
728
+ //#endregion
729
+ exports.DocsTocUIMenuSchema = DocsTocUIMenuSchema;
730
+ Object.defineProperty(exports, 'UniverDocsTocUIPlugin', {
731
+ enumerable: true,
732
+ get: function () {
733
+ return UniverDocsTocUIPlugin;
734
+ }
735
+ });