wendang-react 0.0.0-stage → 0.5.6

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 (548) hide show
  1. package/LICENSE +21 -0
  2. package/NOTICE.md +381 -0
  3. package/README.md +478 -2
  4. package/dist/bindings/yjs.js +5 -0
  5. package/dist/chunks/AnchoredPanel-D3nte06T.js +68 -0
  6. package/dist/chunks/MindMapCanvas-D5XwjVH1.js +2072 -0
  7. package/dist/chunks/MindMapViewer-CQTQAgNq.js +180 -0
  8. package/dist/chunks/SpreadsheetViewer-DN_QQGud.js +157 -0
  9. package/dist/chunks/code-highlight-BmaqTe1m.js +30 -0
  10. package/dist/chunks/code-highlight-engine-BFDzDPzy.js +40 -0
  11. package/dist/chunks/comment-hint-DN7LKJAn.js +296 -0
  12. package/dist/chunks/composition-state-Bl-U1R_2.js +40 -0
  13. package/dist/chunks/extensions-B-CVVQhp.js +4210 -0
  14. package/dist/chunks/fuzzy-match-DYQR-4w2.js +89 -0
  15. package/dist/chunks/hooks-C53Dp0pr.js +35 -0
  16. package/dist/chunks/host-C-V688Rq.js +197 -0
  17. package/dist/chunks/index-Ii536CFG.js +720 -0
  18. package/dist/chunks/katex-WjrodtTU.js +71 -0
  19. package/dist/chunks/mind-map-controller-B6SxK3GZ.js +479 -0
  20. package/dist/chunks/mind-map-delete-CVsxdXfs.js +31 -0
  21. package/dist/chunks/mind-map-input-CEWRz_t6.js +43 -0
  22. package/dist/chunks/mind-topic-text-BBNTbFSe.js +446 -0
  23. package/dist/chunks/nodes-iKqTGr_N.js +291 -0
  24. package/dist/chunks/popover-placement-D3xVYdkt.js +47 -0
  25. package/dist/chunks/worksheet-engine-TJ54m0KC.js +125 -0
  26. package/dist/chunks/worksheet-preview-DsDVWxIM.js +129 -0
  27. package/dist/document/viewer.js +287 -0
  28. package/dist/document.js +3620 -0
  29. package/dist/index.js +8 -0
  30. package/dist/mindmap/viewer.js +6 -0
  31. package/dist/mindmap.js +123 -0
  32. package/dist/shared.js +52 -0
  33. package/dist/spreadsheet/viewer.js +5 -0
  34. package/dist/spreadsheet/xlsx.js +299 -0
  35. package/dist/spreadsheet.js +120 -0
  36. package/dist/styles/callout.css +34 -0
  37. package/dist/styles/code-block.css +58 -0
  38. package/dist/styles/content-style.css +619 -0
  39. package/dist/styles/editor-interaction.css +621 -0
  40. package/dist/styles/file-video.css +12 -0
  41. package/dist/styles/image-preview.css +103 -0
  42. package/dist/styles/mind-map-block.css +14 -0
  43. package/dist/styles/mind-map-canvas.css +80 -0
  44. package/dist/styles/mind-map-comments.css +93 -0
  45. package/dist/styles/mind-map-details.css +7 -0
  46. package/dist/styles/mind-map-preview.css +7 -0
  47. package/dist/styles/mind-map-topic.css +112 -0
  48. package/dist/styles/page-picker.css +47 -0
  49. package/dist/styles/renderer.css +45 -0
  50. package/dist/styles/spreadsheet-editor.css +3 -0
  51. package/dist/styles/tokens.css +154 -0
  52. package/dist/styles/video-dialog.css +41 -0
  53. package/dist/styles/video-embed.css +35 -0
  54. package/dist/styles.css +2615 -0
  55. package/dist/types/bindings/yjs.d.ts +3 -0
  56. package/dist/types/document/viewer.d.ts +3 -0
  57. package/dist/types/document.d.ts +7 -0
  58. package/dist/types/editor/BlockAffordance.d.ts +47 -0
  59. package/dist/types/editor/CalloutView.d.ts +2 -0
  60. package/dist/types/editor/CodeBlockView.d.ts +9 -0
  61. package/dist/types/editor/DocumentColorPanel.d.ts +8 -0
  62. package/dist/types/editor/DocumentEditor.d.ts +71 -0
  63. package/dist/types/editor/ImagePreview.d.ts +10 -0
  64. package/dist/types/editor/LinkPopover.d.ts +21 -0
  65. package/dist/types/editor/PagePicker.d.ts +7 -0
  66. package/dist/types/editor/SelectionToolbar.d.ts +11 -0
  67. package/dist/types/editor/SlashMenu.d.ts +30 -0
  68. package/dist/types/editor/TableControls.d.ts +9 -0
  69. package/dist/types/editor/VideoEmbedDialog.d.ts +6 -0
  70. package/dist/types/editor/document-gestures.d.ts +13 -0
  71. package/dist/types/editor/extensions.d.ts +29 -0
  72. package/dist/types/editor/nodes.d.ts +20 -0
  73. package/dist/types/editor/same-document.d.ts +2 -0
  74. package/dist/types/engine/collab/presence.d.ts +1 -0
  75. package/dist/types/engine/editor/block-commands.d.ts +35 -0
  76. package/dist/types/engine/editor/block-conversion.d.ts +12 -0
  77. package/dist/types/engine/editor/block-drag.d.ts +16 -0
  78. package/dist/types/engine/editor/block-menu-placement.d.ts +16 -0
  79. package/dist/types/engine/editor/callout-commands.d.ts +4 -0
  80. package/dist/types/engine/editor/collab-change-origin.d.ts +2 -0
  81. package/dist/types/engine/editor/delete-block.d.ts +2 -0
  82. package/dist/types/engine/editor/extensions/block-format.d.ts +19 -0
  83. package/dist/types/engine/editor/extensions/block-handle.d.ts +17 -0
  84. package/dist/types/engine/editor/extensions/block-menu-highlight.d.ts +4 -0
  85. package/dist/types/engine/editor/extensions/block-selection.d.ts +117 -0
  86. package/dist/types/engine/editor/extensions/code-highlight.d.ts +2 -0
  87. package/dist/types/engine/editor/extensions/collab-cursor.d.ts +13 -0
  88. package/dist/types/engine/editor/extensions/ime-guard.d.ts +8 -0
  89. package/dist/types/engine/editor/extensions/inline-comments.d.ts +15 -0
  90. package/dist/types/engine/editor/extensions/paste-sanitizer.d.ts +4 -0
  91. package/dist/types/engine/editor/extensions/slash.d.ts +16 -0
  92. package/dist/types/engine/editor/extensions/table-interaction.d.ts +9 -0
  93. package/dist/types/engine/editor/extensions/upload-placeholder.d.ts +48 -0
  94. package/dist/types/engine/editor/image-preview-gesture.d.ts +3 -0
  95. package/dist/types/engine/editor/ime/composition-state.d.ts +9 -0
  96. package/dist/types/engine/editor/insert-block.d.ts +6 -0
  97. package/dist/types/engine/editor/insert-picker-logic.d.ts +13 -0
  98. package/dist/types/engine/editor/link-edit.d.ts +10 -0
  99. package/dist/types/engine/editor/mind-map-controller.d.ts +63 -0
  100. package/dist/types/engine/editor/mind-map-delete.d.ts +7 -0
  101. package/dist/types/engine/editor/mind-map-drag.d.ts +16 -0
  102. package/dist/types/engine/editor/mind-map-input.d.ts +16 -0
  103. package/dist/types/engine/editor/mind-map-selection.d.ts +11 -0
  104. package/dist/types/engine/editor/nodes/columns.d.ts +6 -0
  105. package/dist/types/engine/editor/nodes/file-nodeview.d.ts +4 -0
  106. package/dist/types/engine/editor/nodes/file.d.ts +2 -0
  107. package/dist/types/engine/editor/nodes/image-gallery.d.ts +2 -0
  108. package/dist/types/engine/editor/nodes/image-nodeview.d.ts +4 -0
  109. package/dist/types/engine/editor/nodes/image.d.ts +1 -0
  110. package/dist/types/engine/editor/nodes/inline-style.d.ts +4 -0
  111. package/dist/types/engine/editor/nodes/math-nodeview.d.ts +2 -0
  112. package/dist/types/engine/editor/nodes/math.d.ts +3 -0
  113. package/dist/types/engine/editor/nodes/mention.d.ts +2 -0
  114. package/dist/types/engine/editor/nodes/mind-map-schema.d.ts +6 -0
  115. package/dist/types/engine/editor/nodes/page-link.d.ts +2 -0
  116. package/dist/types/engine/editor/nodes/table-cell.d.ts +4 -0
  117. package/dist/types/engine/editor/nodes/video-embed-schema.d.ts +2 -0
  118. package/dist/types/engine/editor/popover-placement.d.ts +35 -0
  119. package/dist/types/engine/editor/table-clipboard.d.ts +3 -0
  120. package/dist/types/engine/editor/table-commands.d.ts +20 -0
  121. package/dist/types/engine/editor/table-geometry.d.ts +34 -0
  122. package/dist/types/engine/editor/table-menu-placement.d.ts +30 -0
  123. package/dist/types/engine/editor/tracked-target.d.ts +8 -0
  124. package/dist/types/engine/editor/trailing-paragraph.d.ts +2 -0
  125. package/dist/types/engine/host.d.ts +2 -0
  126. package/dist/types/engine/renderer/attachments.d.ts +11 -0
  127. package/dist/types/engine/renderer/katex.d.ts +7 -0
  128. package/dist/types/engine/renderer/lazy-visible.d.ts +11 -0
  129. package/dist/types/engine/shared/callout.d.ts +1 -0
  130. package/dist/types/engine/shared/code-block.d.ts +1 -0
  131. package/dist/types/engine/shared/code-highlight-engine.d.ts +2 -0
  132. package/dist/types/engine/shared/code-highlight.d.ts +8 -0
  133. package/dist/types/engine/shared/comment-hint-position.d.ts +20 -0
  134. package/dist/types/engine/shared/comment-hint.d.ts +2 -0
  135. package/dist/types/engine/shared/document-colors.d.ts +1 -0
  136. package/dist/types/engine/shared/fuzzy-match.d.ts +13 -0
  137. package/dist/types/engine/shared/image-gallery.d.ts +1 -0
  138. package/dist/types/engine/shared/inline-comments.d.ts +1 -0
  139. package/dist/types/engine/shared/mind-map-phase2.d.ts +1 -0
  140. package/dist/types/engine/shared/mind-map.d.ts +1 -0
  141. package/dist/types/engine/shared/mind-topic-text.d.ts +1 -0
  142. package/dist/types/engine/shared/modal-stack.d.ts +6 -0
  143. package/dist/types/engine/shared/page-candidates.d.ts +6 -0
  144. package/dist/types/engine/shared/pinyin.d.ts +6 -0
  145. package/dist/types/engine/shared/preview-items.d.ts +10 -0
  146. package/dist/types/engine/shared/safe-href.d.ts +1 -0
  147. package/dist/types/engine/shared/table-cell-format.d.ts +1 -0
  148. package/dist/types/engine/shared/table-layout.d.ts +1 -0
  149. package/dist/types/engine/shared/video-embed.d.ts +1 -0
  150. package/dist/types/engine/shared/video-feedback.d.ts +1 -0
  151. package/dist/types/engine/shared/workbook.d.ts +1 -0
  152. package/dist/types/engine/worksheets/worksheet-engine.d.ts +16 -0
  153. package/dist/types/engine/worksheets/worksheet-format.d.ts +20 -0
  154. package/dist/types/engine/worksheets/worksheet-preview.d.ts +17 -0
  155. package/dist/types/engine/worksheets/worksheet-xlsx.d.ts +21 -0
  156. package/dist/types/engine/wui/core/dialog.d.ts +5 -0
  157. package/dist/types/engine/wui/core/listbox.d.ts +8 -0
  158. package/dist/types/engine/wui/core/placement.d.ts +40 -0
  159. package/dist/types/hooks.d.ts +7 -0
  160. package/dist/types/host-types.d.ts +58 -0
  161. package/dist/types/host.d.ts +24 -0
  162. package/dist/types/index.d.ts +5 -0
  163. package/dist/types/mindmap/Comments.d.ts +9 -0
  164. package/dist/types/mindmap/Details.d.ts +13 -0
  165. package/dist/types/mindmap/Field.d.ts +10 -0
  166. package/dist/types/mindmap/MindMapCanvas.d.ts +19 -0
  167. package/dist/types/mindmap/MindMapEditor.d.ts +30 -0
  168. package/dist/types/mindmap/MindMapViewer.d.ts +23 -0
  169. package/dist/types/mindmap/TopicLabel.d.ts +4 -0
  170. package/dist/types/mindmap/viewer.d.ts +2 -0
  171. package/dist/types/mindmap.d.ts +4 -0
  172. package/dist/types/renderer/CodeToolbar.d.ts +10 -0
  173. package/dist/types/renderer/DocumentViewer.d.ts +23 -0
  174. package/dist/types/renderer/media.d.ts +33 -0
  175. package/dist/types/shared.d.ts +12 -0
  176. package/dist/types/spreadsheet/SpreadsheetEditor.d.ts +23 -0
  177. package/dist/types/spreadsheet/SpreadsheetViewer.d.ts +13 -0
  178. package/dist/types/spreadsheet/viewer.d.ts +2 -0
  179. package/dist/types/spreadsheet/xlsx.d.ts +2 -0
  180. package/dist/types/spreadsheet.d.ts +3 -0
  181. package/dist/types/wui/AnchoredPanel.d.ts +14 -0
  182. package/dist/types/wui/Dropdown.d.ts +18 -0
  183. package/dist/types/wui/Icon.d.ts +7 -0
  184. package/dist/types/wui/Tooltip.d.ts +5 -0
  185. package/dist/types/wui/index.d.ts +69 -0
  186. package/package.json +122 -3
  187. package/third-party-notices/@fast-csv__format@4.3.5-LICENSE.txt +21 -0
  188. package/third-party-notices/@fast-csv__parse@4.3.6-LICENSE.txt +21 -0
  189. package/third-party-notices/@flatten-js__interval-tree@1.1.3-LICENSE.txt +21 -0
  190. package/third-party-notices/@floating-ui__core@1.8.0-LICENSE.txt +20 -0
  191. package/third-party-notices/@floating-ui__dom@1.8.0-LICENSE.txt +20 -0
  192. package/third-party-notices/@floating-ui__react-dom@2.1.9-LICENSE.txt +20 -0
  193. package/third-party-notices/@floating-ui__utils@0.2.12-LICENSE.txt +20 -0
  194. package/third-party-notices/@grpc__grpc-js@1.14.6-LICENSE.txt +201 -0
  195. package/third-party-notices/@grpc__proto-loader@0.8.1-LICENSE.txt +201 -0
  196. package/third-party-notices/@js-sdsl__ordered-map@4.4.2-LICENSE.txt +21 -0
  197. package/third-party-notices/@protobufjs__aspromise@1.1.2-LICENSE.txt +26 -0
  198. package/third-party-notices/@protobufjs__base64@1.1.2-LICENSE.txt +26 -0
  199. package/third-party-notices/@protobufjs__codegen@2.0.5-LICENSE.txt +26 -0
  200. package/third-party-notices/@protobufjs__eventemitter@1.1.1-LICENSE.txt +26 -0
  201. package/third-party-notices/@protobufjs__fetch@1.1.1-LICENSE.txt +26 -0
  202. package/third-party-notices/@protobufjs__float@1.0.2-LICENSE.txt +26 -0
  203. package/third-party-notices/@protobufjs__path@1.1.2-LICENSE.txt +26 -0
  204. package/third-party-notices/@protobufjs__pool@1.1.0-LICENSE.txt +26 -0
  205. package/third-party-notices/@protobufjs__utf8@1.1.2-LICENSE.txt +26 -0
  206. package/third-party-notices/@radix-ui__primitive@1.2.0-LICENSE.txt +21 -0
  207. package/third-party-notices/@radix-ui__react-arrow@1.1.17-LICENSE.txt +21 -0
  208. package/third-party-notices/@radix-ui__react-collection@1.2.0-LICENSE.txt +21 -0
  209. package/third-party-notices/@radix-ui__react-compose-refs@1.1.5-LICENSE.txt +21 -0
  210. package/third-party-notices/@radix-ui__react-context@1.3.0-LICENSE.txt +21 -0
  211. package/third-party-notices/@radix-ui__react-dialog@1.3.1-LICENSE.txt +21 -0
  212. package/third-party-notices/@radix-ui__react-direction@1.2.0-LICENSE.txt +21 -0
  213. package/third-party-notices/@radix-ui__react-dismissable-layer@1.2.1-LICENSE.txt +21 -0
  214. package/third-party-notices/@radix-ui__react-dropdown-menu@2.2.1-LICENSE.txt +21 -0
  215. package/third-party-notices/@radix-ui__react-focus-guards@1.2.0-LICENSE.txt +21 -0
  216. package/third-party-notices/@radix-ui__react-focus-scope@1.3.1-LICENSE.txt +21 -0
  217. package/third-party-notices/@radix-ui__react-hover-card@1.2.1-LICENSE.txt +21 -0
  218. package/third-party-notices/@radix-ui__react-id@1.1.4-LICENSE.txt +21 -0
  219. package/third-party-notices/@radix-ui__react-menu@2.2.1-LICENSE.txt +21 -0
  220. package/third-party-notices/@radix-ui__react-popover@1.3.1-LICENSE.txt +21 -0
  221. package/third-party-notices/@radix-ui__react-popper@1.4.0-LICENSE.txt +21 -0
  222. package/third-party-notices/@radix-ui__react-portal@1.2.0-LICENSE.txt +21 -0
  223. package/third-party-notices/@radix-ui__react-presence@1.1.11-LICENSE.txt +21 -0
  224. package/third-party-notices/@radix-ui__react-primitive@2.2.0-LICENSE.txt +21 -0
  225. package/third-party-notices/@radix-ui__react-roving-focus@1.2.1-LICENSE.txt +21 -0
  226. package/third-party-notices/@radix-ui__react-separator@1.2.0-LICENSE.txt +21 -0
  227. package/third-party-notices/@radix-ui__react-slot@1.5.0-LICENSE.txt +21 -0
  228. package/third-party-notices/@radix-ui__react-use-callback-ref@1.1.5-LICENSE.txt +21 -0
  229. package/third-party-notices/@radix-ui__react-use-controllable-state@1.3.0-LICENSE.txt +21 -0
  230. package/third-party-notices/@radix-ui__react-use-effect-event@0.0.5-LICENSE.txt +21 -0
  231. package/third-party-notices/@radix-ui__react-use-is-hydrated@0.1.3-LICENSE.txt +21 -0
  232. package/third-party-notices/@radix-ui__react-use-layout-effect@1.1.4-LICENSE.txt +21 -0
  233. package/third-party-notices/@radix-ui__react-use-rect@1.1.4-LICENSE.txt +21 -0
  234. package/third-party-notices/@radix-ui__react-use-size@1.1.5-LICENSE.txt +21 -0
  235. package/third-party-notices/@radix-ui__rect@1.1.3-LICENSE.txt +21 -0
  236. package/third-party-notices/@tiptap__core@3.31.4-LICENSE.md.txt +21 -0
  237. package/third-party-notices/@tiptap__extension-blockquote@3.31.4-LICENSE.md.txt +21 -0
  238. package/third-party-notices/@tiptap__extension-bold@3.31.4-LICENSE.md.txt +21 -0
  239. package/third-party-notices/@tiptap__extension-bullet-list@3.31.4-LICENSE.md.txt +21 -0
  240. package/third-party-notices/@tiptap__extension-code-block@3.31.4-LICENSE.md.txt +21 -0
  241. package/third-party-notices/@tiptap__extension-code@3.31.4-LICENSE.md.txt +21 -0
  242. package/third-party-notices/@tiptap__extension-collaboration@3.31.4-LICENSE.md.txt +21 -0
  243. package/third-party-notices/@tiptap__extension-document@3.31.4-LICENSE.md.txt +21 -0
  244. package/third-party-notices/@tiptap__extension-dropcursor@3.31.4-LICENSE.md.txt +21 -0
  245. package/third-party-notices/@tiptap__extension-gapcursor@3.31.4-LICENSE.md.txt +21 -0
  246. package/third-party-notices/@tiptap__extension-hard-break@3.31.4-LICENSE.md.txt +21 -0
  247. package/third-party-notices/@tiptap__extension-heading@3.31.4-LICENSE.md.txt +21 -0
  248. package/third-party-notices/@tiptap__extension-horizontal-rule@3.31.4-LICENSE.md.txt +21 -0
  249. package/third-party-notices/@tiptap__extension-image@3.31.4-LICENSE.md.txt +21 -0
  250. package/third-party-notices/@tiptap__extension-italic@3.31.4-LICENSE.md.txt +21 -0
  251. package/third-party-notices/@tiptap__extension-link@3.31.4-LICENSE.md.txt +21 -0
  252. package/third-party-notices/@tiptap__extension-list-item@3.31.4-LICENSE.md.txt +21 -0
  253. package/third-party-notices/@tiptap__extension-list-keymap@3.31.4-LICENSE.md.txt +21 -0
  254. package/third-party-notices/@tiptap__extension-list@3.31.4-LICENSE.md.txt +21 -0
  255. package/third-party-notices/@tiptap__extension-ordered-list@3.31.4-LICENSE.md.txt +21 -0
  256. package/third-party-notices/@tiptap__extension-paragraph@3.31.4-LICENSE.md.txt +21 -0
  257. package/third-party-notices/@tiptap__extension-placeholder@3.31.4-LICENSE.md.txt +21 -0
  258. package/third-party-notices/@tiptap__extension-strike@3.31.4-LICENSE.md.txt +21 -0
  259. package/third-party-notices/@tiptap__extension-table-cell@3.31.4-LICENSE.md.txt +21 -0
  260. package/third-party-notices/@tiptap__extension-table-header@3.31.4-LICENSE.md.txt +21 -0
  261. package/third-party-notices/@tiptap__extension-table-row@3.31.4-LICENSE.md.txt +21 -0
  262. package/third-party-notices/@tiptap__extension-table@3.31.4-LICENSE.md.txt +21 -0
  263. package/third-party-notices/@tiptap__extension-task-item@3.31.4-LICENSE.md.txt +21 -0
  264. package/third-party-notices/@tiptap__extension-task-list@3.31.4-LICENSE.md.txt +21 -0
  265. package/third-party-notices/@tiptap__extension-text@3.31.4-LICENSE.md.txt +21 -0
  266. package/third-party-notices/@tiptap__extension-underline@3.31.4-LICENSE.md.txt +21 -0
  267. package/third-party-notices/@tiptap__extensions@3.31.4-LICENSE.md.txt +21 -0
  268. package/third-party-notices/@tiptap__pm@3.31.4-LICENSE.txt +21 -0
  269. package/third-party-notices/@tiptap__starter-kit@3.31.4-LICENSE.md.txt +21 -0
  270. package/third-party-notices/@tiptap__y-tiptap@3.0.7-LICENSE.txt +22 -0
  271. package/third-party-notices/@types__hast@3.0.5-LICENSE.txt +21 -0
  272. package/third-party-notices/@types__node@14.18.63-LICENSE.txt +21 -0
  273. package/third-party-notices/@types__node@26.6.2-LICENSE.txt +21 -0
  274. package/third-party-notices/@types__react-dom@19.3.0-LICENSE.txt +21 -0
  275. package/third-party-notices/@types__react@19.3.0-LICENSE.txt +21 -0
  276. package/third-party-notices/@types__unist@3.0.3-LICENSE.txt +21 -0
  277. package/third-party-notices/@univerjs__core@1.1.0-LICENSE.txt +176 -0
  278. package/third-party-notices/@univerjs__design@1.1.0-LICENSE.txt +176 -0
  279. package/third-party-notices/@univerjs__docs-ui@1.1.0-LICENSE.txt +176 -0
  280. package/third-party-notices/@univerjs__docs@1.1.0-LICENSE.txt +176 -0
  281. package/third-party-notices/@univerjs__drawing@1.1.0-LICENSE.txt +176 -0
  282. package/third-party-notices/@univerjs__engine-formula@1.1.0-LICENSE.txt +176 -0
  283. package/third-party-notices/@univerjs__engine-render@1.1.0-LICENSE.txt +176 -0
  284. package/third-party-notices/@univerjs__icons@1.46.0-LICENSE.txt +21 -0
  285. package/third-party-notices/@univerjs__network@1.1.0-LICENSE.txt +176 -0
  286. package/third-party-notices/@univerjs__preset-sheets-core@1.1.0-LICENSE.txt +176 -0
  287. package/third-party-notices/@univerjs__preset-sheets-filter@1.1.0-LICENSE.txt +176 -0
  288. package/third-party-notices/@univerjs__preset-sheets-sort@1.1.0-LICENSE.txt +176 -0
  289. package/third-party-notices/@univerjs__presets@1.1.0-LICENSE.txt +176 -0
  290. package/third-party-notices/@univerjs__rpc@1.1.0-LICENSE.txt +176 -0
  291. package/third-party-notices/@univerjs__sheets-filter-ui@1.1.0-LICENSE.txt +176 -0
  292. package/third-party-notices/@univerjs__sheets-filter@1.1.0-LICENSE.txt +176 -0
  293. package/third-party-notices/@univerjs__sheets-formula-ui@1.1.0-LICENSE.txt +176 -0
  294. package/third-party-notices/@univerjs__sheets-formula@1.1.0-LICENSE.txt +176 -0
  295. package/third-party-notices/@univerjs__sheets-numfmt-ui@1.1.0-LICENSE.txt +176 -0
  296. package/third-party-notices/@univerjs__sheets-numfmt@1.1.0-LICENSE.txt +176 -0
  297. package/third-party-notices/@univerjs__sheets-sort-ui@1.1.0-LICENSE.txt +176 -0
  298. package/third-party-notices/@univerjs__sheets-sort@1.1.0-LICENSE.txt +176 -0
  299. package/third-party-notices/@univerjs__sheets-ui@1.1.0-LICENSE.txt +176 -0
  300. package/third-party-notices/@univerjs__sheets@1.1.0-LICENSE.txt +176 -0
  301. package/third-party-notices/@univerjs__telemetry@1.1.0-LICENSE.txt +176 -0
  302. package/third-party-notices/@univerjs__themes@1.1.0-LICENSE.txt +176 -0
  303. package/third-party-notices/@univerjs__ui@1.1.0-LICENSE.txt +176 -0
  304. package/third-party-notices/@wendellhu__redi@1.1.3-LICENSE.txt +7 -0
  305. package/third-party-notices/ansi-regex@5.0.1-license.txt +9 -0
  306. package/third-party-notices/ansi-styles@4.3.0-license.txt +9 -0
  307. package/third-party-notices/archiver-utils@2.1.0-LICENSE.txt +22 -0
  308. package/third-party-notices/archiver-utils@3.0.4-LICENSE.txt +22 -0
  309. package/third-party-notices/archiver@5.3.2-LICENSE.txt +22 -0
  310. package/third-party-notices/aria-hidden@1.2.6-LICENSE.txt +21 -0
  311. package/third-party-notices/array-buffer-byte-length@1.0.2-LICENSE.txt +21 -0
  312. package/third-party-notices/arraybuffer.prototype.slice@1.0.4-LICENSE.txt +21 -0
  313. package/third-party-notices/async-function@1.0.0-LICENSE.txt +21 -0
  314. package/third-party-notices/async-lock@1.4.1-LICENSE.txt +22 -0
  315. package/third-party-notices/async@3.2.6-LICENSE.txt +19 -0
  316. package/third-party-notices/available-typed-arrays@1.0.7-LICENSE.txt +21 -0
  317. package/third-party-notices/balanced-match@1.0.2-LICENSE.md.txt +21 -0
  318. package/third-party-notices/base64-js@1.5.1-LICENSE.txt +21 -0
  319. package/third-party-notices/big-integer@1.6.52-LICENSE.txt +24 -0
  320. package/third-party-notices/bl@4.1.0-LICENSE.md.txt +13 -0
  321. package/third-party-notices/bluebird@3.4.7-LICENSE.txt +21 -0
  322. package/third-party-notices/brace-expansion@1.1.21-LICENSE.txt +21 -0
  323. package/third-party-notices/brace-expansion@2.1.7-LICENSE.txt +21 -0
  324. package/third-party-notices/buffer-crc32@0.2.13-LICENSE.txt +19 -0
  325. package/third-party-notices/buffer-indexof-polyfill@1.0.2-LICENSE.txt +22 -0
  326. package/third-party-notices/buffer@5.7.1-LICENSE.txt +21 -0
  327. package/third-party-notices/call-bind-apply-helpers@1.0.2-LICENSE.txt +21 -0
  328. package/third-party-notices/call-bind@1.0.9-LICENSE.txt +21 -0
  329. package/third-party-notices/call-bound@1.0.4-LICENSE.txt +21 -0
  330. package/third-party-notices/class-variance-authority@0.7.1-LICENSE.txt +190 -0
  331. package/third-party-notices/cliui@8.0.1-LICENSE.txt.txt +14 -0
  332. package/third-party-notices/clsx@2.1.1-license.txt +9 -0
  333. package/third-party-notices/cmdk@1.1.1-LICENSE.md.txt +21 -0
  334. package/third-party-notices/collapse-white-space@2.1.0-license.txt +22 -0
  335. package/third-party-notices/color-convert@2.0.1-LICENSE.txt +21 -0
  336. package/third-party-notices/color-name@1.1.4-LICENSE.txt +8 -0
  337. package/third-party-notices/commander@15.0.0-LICENSE.txt +22 -0
  338. package/third-party-notices/compress-commons@4.1.2-LICENSE.txt +22 -0
  339. package/third-party-notices/concat-map@0.0.1-LICENSE.txt +18 -0
  340. package/third-party-notices/core-util-is@1.0.3-LICENSE.txt +19 -0
  341. package/third-party-notices/crc-32@1.2.2-LICENSE.txt +201 -0
  342. package/third-party-notices/crc32-stream@4.0.3-LICENSE.txt +22 -0
  343. package/third-party-notices/csstype@3.2.3-LICENSE.txt +19 -0
  344. package/third-party-notices/data-view-buffer@1.0.2-LICENSE.txt +21 -0
  345. package/third-party-notices/data-view-byte-length@1.0.2-LICENSE.txt +21 -0
  346. package/third-party-notices/data-view-byte-offset@1.0.1-LICENSE.txt +21 -0
  347. package/third-party-notices/dayjs@1.11.23-LICENSE.txt +21 -0
  348. package/third-party-notices/decimal.js@10.6.0-LICENCE.md.txt +23 -0
  349. package/third-party-notices/define-data-property@1.1.4-LICENSE.txt +21 -0
  350. package/third-party-notices/define-properties@1.2.1-LICENSE.txt +21 -0
  351. package/third-party-notices/dequal@2.0.3-license.txt +21 -0
  352. package/third-party-notices/detect-node-es@1.1.0-LICENSE.txt +21 -0
  353. package/third-party-notices/devlop@1.1.0-license.txt +22 -0
  354. package/third-party-notices/dunder-proto@1.0.1-LICENSE.txt +21 -0
  355. package/third-party-notices/duplexer2@0.1.4-LICENSE.md.txt +26 -0
  356. package/third-party-notices/end-of-stream@1.4.5-LICENSE.txt +21 -0
  357. package/third-party-notices/es-abstract-get@1.0.0-LICENSE.txt +21 -0
  358. package/third-party-notices/es-abstract@1.24.2-LICENSE.txt +21 -0
  359. package/third-party-notices/es-define-property@1.0.1-LICENSE.txt +21 -0
  360. package/third-party-notices/es-errors@1.3.0-LICENSE.txt +21 -0
  361. package/third-party-notices/es-object-atoms@1.1.2-LICENSE.txt +21 -0
  362. package/third-party-notices/es-set-tostringtag@2.1.0-LICENSE.txt +21 -0
  363. package/third-party-notices/es-to-primitive@1.3.4-LICENSE.txt +22 -0
  364. package/third-party-notices/escalade@3.2.0-license.txt +9 -0
  365. package/third-party-notices/exceljs@4.4.0-LICENSE.txt +22 -0
  366. package/third-party-notices/fast-csv@4.3.6-LICENSE.txt +21 -0
  367. package/third-party-notices/fast-diff@1.3.0-LICENSE.txt +201 -0
  368. package/third-party-notices/for-each@0.3.5-LICENSE.txt +22 -0
  369. package/third-party-notices/fs-constants@1.0.0-LICENSE.txt +21 -0
  370. package/third-party-notices/fs.realpath@1.0.0-LICENSE.txt +43 -0
  371. package/third-party-notices/fstream@1.0.12-LICENSE.txt +15 -0
  372. package/third-party-notices/function-bind@1.1.2-LICENSE.txt +20 -0
  373. package/third-party-notices/function.prototype.name@1.2.0-LICENSE.txt +21 -0
  374. package/third-party-notices/functions-have-names@1.2.3-LICENSE.txt +21 -0
  375. package/third-party-notices/generator-function@2.0.1-LICENSE.md.txt +7 -0
  376. package/third-party-notices/get-caller-file@2.0.5-LICENSE.md.txt +6 -0
  377. package/third-party-notices/get-intrinsic@1.3.0-LICENSE.txt +21 -0
  378. package/third-party-notices/get-nonce@1.0.1-LICENSE.txt +21 -0
  379. package/third-party-notices/get-proto@1.0.1-LICENSE.txt +21 -0
  380. package/third-party-notices/get-symbol-description@1.1.0-LICENSE.txt +21 -0
  381. package/third-party-notices/glob@7.2.3-LICENSE.txt +21 -0
  382. package/third-party-notices/globalthis@1.0.4-LICENSE.txt +21 -0
  383. package/third-party-notices/gopd@1.2.0-LICENSE.txt +21 -0
  384. package/third-party-notices/graceful-fs@4.2.11-LICENSE.txt +15 -0
  385. package/third-party-notices/has-bigints@1.1.0-LICENSE.txt +21 -0
  386. package/third-party-notices/has-property-descriptors@1.0.2-LICENSE.txt +21 -0
  387. package/third-party-notices/has-proto@1.2.0-LICENSE.txt +21 -0
  388. package/third-party-notices/has-symbols@1.1.0-LICENSE.txt +21 -0
  389. package/third-party-notices/has-tostringtag@1.0.2-LICENSE.txt +21 -0
  390. package/third-party-notices/hasown@2.0.4-LICENSE.txt +21 -0
  391. package/third-party-notices/highlight.js@11.11.2-LICENSE.txt +29 -0
  392. package/third-party-notices/ieee754@1.2.1-LICENSE.txt +11 -0
  393. package/third-party-notices/immediate@3.0.6-LICENSE.txt.txt +20 -0
  394. package/third-party-notices/inflight@1.0.6-LICENSE.txt +15 -0
  395. package/third-party-notices/inherits@2.0.4-LICENSE.txt +16 -0
  396. package/third-party-notices/internal-slot@1.1.0-LICENSE.txt +21 -0
  397. package/third-party-notices/is-array-buffer@3.0.5-LICENSE.txt +21 -0
  398. package/third-party-notices/is-async-function@2.1.1-LICENSE.txt +20 -0
  399. package/third-party-notices/is-bigint@1.1.0-LICENSE.txt +21 -0
  400. package/third-party-notices/is-boolean-object@1.2.2-LICENSE.txt +22 -0
  401. package/third-party-notices/is-callable@1.2.7-LICENSE.txt +22 -0
  402. package/third-party-notices/is-data-view@1.0.2-LICENSE.txt +21 -0
  403. package/third-party-notices/is-date-object@1.1.0-LICENSE.txt +22 -0
  404. package/third-party-notices/is-document.all@1.0.0-LICENSE.txt +21 -0
  405. package/third-party-notices/is-finalizationregistry@1.1.1-LICENSE.txt +21 -0
  406. package/third-party-notices/is-fullwidth-code-point@3.0.0-license.txt +9 -0
  407. package/third-party-notices/is-generator-function@1.1.2-LICENSE.txt +20 -0
  408. package/third-party-notices/is-map@2.0.3-LICENSE.txt +21 -0
  409. package/third-party-notices/is-negative-zero@2.0.3-LICENSE.txt +20 -0
  410. package/third-party-notices/is-number-object@1.1.1-LICENSE.txt +22 -0
  411. package/third-party-notices/is-regex@1.2.1-LICENSE.txt +20 -0
  412. package/third-party-notices/is-set@2.0.3-LICENSE.txt +21 -0
  413. package/third-party-notices/is-shared-array-buffer@1.0.4-LICENSE.txt +21 -0
  414. package/third-party-notices/is-string@1.1.1-LICENSE.txt +22 -0
  415. package/third-party-notices/is-symbol@1.1.1-LICENSE.txt +22 -0
  416. package/third-party-notices/is-typed-array@1.1.15-LICENSE.txt +22 -0
  417. package/third-party-notices/is-weakmap@2.0.2-LICENSE.txt +21 -0
  418. package/third-party-notices/is-weakref@1.1.1-LICENSE.txt +21 -0
  419. package/third-party-notices/is-weakset@2.0.4-LICENSE.txt +21 -0
  420. package/third-party-notices/isarray@2.0.5-LICENSE.txt +21 -0
  421. package/third-party-notices/isomorphic.js@0.2.5-LICENSE.txt +21 -0
  422. package/third-party-notices/jszip@3.10.2-LICENSE.markdown.txt +651 -0
  423. package/third-party-notices/katex@0.18.9-LICENSE.txt +21 -0
  424. package/third-party-notices/kdbush@4.1.0-LICENSE.txt +15 -0
  425. package/third-party-notices/lazystream@1.0.1-LICENSE.txt +23 -0
  426. package/third-party-notices/lib0@0.2.119-LICENSE.txt +21 -0
  427. package/third-party-notices/lie@3.3.0-license.md.txt +7 -0
  428. package/third-party-notices/linkifyjs@4.3.3-LICENSE.txt +19 -0
  429. package/third-party-notices/listenercount@1.0.1-LICENSE.md.txt +5 -0
  430. package/third-party-notices/lodash-es@4.18.1-LICENSE.txt +47 -0
  431. package/third-party-notices/lodash.camelcase@4.3.0-LICENSE.txt +47 -0
  432. package/third-party-notices/lodash.defaults@4.2.0-LICENSE.txt +47 -0
  433. package/third-party-notices/lodash.difference@4.5.0-LICENSE.txt +47 -0
  434. package/third-party-notices/lodash.escaperegexp@4.1.2-LICENSE.txt +47 -0
  435. package/third-party-notices/lodash.flatten@4.4.0-LICENSE.txt +47 -0
  436. package/third-party-notices/lodash.groupby@4.6.0-LICENSE.txt +47 -0
  437. package/third-party-notices/lodash.isboolean@3.0.3-LICENSE.txt +22 -0
  438. package/third-party-notices/lodash.isequal@4.5.0-LICENSE.txt +47 -0
  439. package/third-party-notices/lodash.isfunction@3.0.9-LICENSE.txt +47 -0
  440. package/third-party-notices/lodash.isnil@4.0.0-LICENSE.txt +22 -0
  441. package/third-party-notices/lodash.isplainobject@4.0.6-LICENSE.txt +47 -0
  442. package/third-party-notices/lodash.isundefined@3.0.1-LICENSE.txt.txt +22 -0
  443. package/third-party-notices/lodash.union@4.6.0-LICENSE.txt +47 -0
  444. package/third-party-notices/lodash.uniq@4.5.0-LICENSE.txt +47 -0
  445. package/third-party-notices/long@5.3.2-LICENSE.txt +202 -0
  446. package/third-party-notices/lowlight@3.3.0-license.txt +22 -0
  447. package/third-party-notices/math-intrinsics@1.1.0-LICENSE.txt +21 -0
  448. package/third-party-notices/minimatch@3.1.5-LICENSE.txt +15 -0
  449. package/third-party-notices/minimatch@5.1.9-LICENSE.txt +15 -0
  450. package/third-party-notices/minimist@1.2.8-LICENSE.txt +18 -0
  451. package/third-party-notices/mkdirp@0.5.6-LICENSE.txt +21 -0
  452. package/third-party-notices/n-gram@2.0.2-license.txt +22 -0
  453. package/third-party-notices/normalize-path@3.0.0-LICENSE.txt +21 -0
  454. package/third-party-notices/numfmt@4.0.1-LICENSE.txt +19 -0
  455. package/third-party-notices/object-inspect@1.13.4-LICENSE.txt +21 -0
  456. package/third-party-notices/object-keys@1.1.1-LICENSE.txt +21 -0
  457. package/third-party-notices/object.assign@4.1.7-LICENSE.txt +21 -0
  458. package/third-party-notices/once@1.4.0-LICENSE.txt +15 -0
  459. package/third-party-notices/orderedmap@2.1.1-LICENSE.txt +19 -0
  460. package/third-party-notices/own-keys@1.0.2-LICENSE.txt +21 -0
  461. package/third-party-notices/pako@1.0.11-LICENSE.txt +21 -0
  462. package/third-party-notices/path-is-absolute@1.0.1-license.txt +21 -0
  463. package/third-party-notices/possible-typed-array-names@1.1.0-LICENSE.txt +21 -0
  464. package/third-party-notices/process-nextick-args@2.0.1-license.md.txt +19 -0
  465. package/third-party-notices/prosemirror-changeset@2.4.4-LICENSE.txt +19 -0
  466. package/third-party-notices/prosemirror-commands@1.7.2-LICENSE.txt +19 -0
  467. package/third-party-notices/prosemirror-dropcursor@1.8.4-LICENSE.txt +19 -0
  468. package/third-party-notices/prosemirror-gapcursor@1.4.1-LICENSE.txt +19 -0
  469. package/third-party-notices/prosemirror-history@1.5.1-LICENSE.txt +19 -0
  470. package/third-party-notices/prosemirror-inputrules@1.5.1-LICENSE.txt +19 -0
  471. package/third-party-notices/prosemirror-keymap@1.2.3-LICENSE.txt +19 -0
  472. package/third-party-notices/prosemirror-model@1.25.12-LICENSE.txt +19 -0
  473. package/third-party-notices/prosemirror-schema-list@1.5.1-LICENSE.txt +19 -0
  474. package/third-party-notices/prosemirror-state@1.4.4-LICENSE.txt +19 -0
  475. package/third-party-notices/prosemirror-tables@1.8.5-LICENSE.txt +19 -0
  476. package/third-party-notices/prosemirror-transform@1.12.2-LICENSE.txt +19 -0
  477. package/third-party-notices/prosemirror-view@1.42.6-LICENSE.txt +19 -0
  478. package/third-party-notices/protobufjs@7.6.6-LICENSE.txt +39 -0
  479. package/third-party-notices/quickselect@3.0.0-LICENSE.txt +15 -0
  480. package/third-party-notices/rbush@4.0.1-LICENSE.txt +21 -0
  481. package/third-party-notices/react-dom@19.3.1-LICENSE.txt +21 -0
  482. package/third-party-notices/react-remove-scroll@2.7.2-LICENSE.txt +21 -0
  483. package/third-party-notices/react-style-singleton@2.2.3-LICENSE.txt +21 -0
  484. package/third-party-notices/react@19.3.1-LICENSE.txt +21 -0
  485. package/third-party-notices/readable-stream@2.3.8-LICENSE.txt +47 -0
  486. package/third-party-notices/readable-stream@3.6.2-LICENSE.txt +47 -0
  487. package/third-party-notices/readdir-glob@1.1.3-LICENSE.txt +201 -0
  488. package/third-party-notices/reflect.getprototypeof@1.0.10-LICENSE.txt +21 -0
  489. package/third-party-notices/regexp.prototype.flags@1.5.4-LICENSE.txt +22 -0
  490. package/third-party-notices/require-directory@2.1.1-LICENSE.txt +22 -0
  491. package/third-party-notices/rimraf@2.7.1-LICENSE.txt +15 -0
  492. package/third-party-notices/rope-sequence@1.3.4-LICENSE.txt +19 -0
  493. package/third-party-notices/rxjs@7.8.2-LICENSE.txt.txt +202 -0
  494. package/third-party-notices/safe-array-concat@1.1.4-LICENSE.txt +21 -0
  495. package/third-party-notices/safe-buffer@5.1.2-LICENSE.txt +21 -0
  496. package/third-party-notices/safe-buffer@5.2.1-LICENSE.txt +21 -0
  497. package/third-party-notices/safe-push-apply@1.0.0-LICENSE.txt +21 -0
  498. package/third-party-notices/safe-regex-test@1.1.0-LICENSE.txt +21 -0
  499. package/third-party-notices/scheduler@0.28.0-LICENSE.txt +21 -0
  500. package/third-party-notices/set-function-length@1.2.2-LICENSE.txt +21 -0
  501. package/third-party-notices/set-function-name@2.0.2-LICENSE.txt +21 -0
  502. package/third-party-notices/set-proto@1.0.0-LICENSE.txt +21 -0
  503. package/third-party-notices/setimmediate@1.0.5-LICENSE.txt.txt +20 -0
  504. package/third-party-notices/side-channel-list@1.0.1-LICENSE.txt +21 -0
  505. package/third-party-notices/side-channel-map@1.0.1-LICENSE.txt +21 -0
  506. package/third-party-notices/side-channel-weakmap@1.0.2-LICENSE.txt +21 -0
  507. package/third-party-notices/side-channel@1.1.1-LICENSE.txt +21 -0
  508. package/third-party-notices/sonner@2.0.8-LICENSE.md.txt +21 -0
  509. package/third-party-notices/stop-iteration-iterator@1.1.0-LICENSE.txt +21 -0
  510. package/third-party-notices/string-width@4.2.3-license.txt +9 -0
  511. package/third-party-notices/string.prototype.trim@1.2.11-LICENSE.txt +21 -0
  512. package/third-party-notices/string.prototype.trimend@1.0.10-LICENSE.txt +21 -0
  513. package/third-party-notices/string.prototype.trimstart@1.0.8-LICENSE.txt +21 -0
  514. package/third-party-notices/string_decoder@1.1.1-LICENSE.txt +48 -0
  515. package/third-party-notices/string_decoder@1.3.0-LICENSE.txt +48 -0
  516. package/third-party-notices/strip-ansi@6.0.1-license.txt +9 -0
  517. package/third-party-notices/tar-stream@2.2.0-LICENSE.txt +21 -0
  518. package/third-party-notices/tiny-pinyin@1.3.2-LICENSE.txt +21 -0
  519. package/third-party-notices/tmp@0.2.7-LICENSE.txt +21 -0
  520. package/third-party-notices/traverse@0.3.10-LICENSE.txt +21 -0
  521. package/third-party-notices/trigram-utils@2.0.1-license.txt +22 -0
  522. package/third-party-notices/tslib@2.8.1-LICENSE.txt.txt +12 -0
  523. package/third-party-notices/typed-array-buffer@1.0.3-LICENSE.txt +21 -0
  524. package/third-party-notices/typed-array-byte-length@1.0.3-LICENSE.txt +21 -0
  525. package/third-party-notices/typed-array-byte-offset@1.0.5-LICENSE.txt +21 -0
  526. package/third-party-notices/typed-array-length@1.0.8-LICENSE.txt +21 -0
  527. package/third-party-notices/typedarray.prototype.slice@1.0.6-LICENSE.txt +21 -0
  528. package/third-party-notices/unbox-primitive@1.1.0-LICENSE.txt +21 -0
  529. package/third-party-notices/undici-types@8.9.0-LICENSE.txt +21 -0
  530. package/third-party-notices/unzipper@0.10.14-LICENSE.txt +25 -0
  531. package/third-party-notices/use-callback-ref@1.3.3-LICENSE.txt +21 -0
  532. package/third-party-notices/use-sidecar@1.1.3-LICENSE.txt +21 -0
  533. package/third-party-notices/util-deprecate@1.0.2-LICENSE.txt +24 -0
  534. package/third-party-notices/uuid@8.3.2-LICENSE.md.txt +9 -0
  535. package/third-party-notices/w3c-keyname@2.2.8-LICENSE.txt +19 -0
  536. package/third-party-notices/which-boxed-primitive@1.1.1-LICENSE.txt +21 -0
  537. package/third-party-notices/which-builtin-type@1.2.1-LICENSE.txt +21 -0
  538. package/third-party-notices/which-collection@1.0.2-LICENSE.txt +21 -0
  539. package/third-party-notices/which-typed-array@1.1.24-LICENSE.txt +22 -0
  540. package/third-party-notices/wrap-ansi@7.0.0-license.txt +9 -0
  541. package/third-party-notices/wrappy@1.0.2-LICENSE.txt +15 -0
  542. package/third-party-notices/xmlchars@2.2.0-LICENSE.txt +18 -0
  543. package/third-party-notices/y-protocols@1.0.7-LICENSE.txt +21 -0
  544. package/third-party-notices/y18n@5.0.8-LICENSE.txt +13 -0
  545. package/third-party-notices/yargs-parser@21.1.1-LICENSE.txt.txt +14 -0
  546. package/third-party-notices/yargs@17.7.3-LICENSE.txt +21 -0
  547. package/third-party-notices/yjs@13.6.33-LICENSE.txt +23 -0
  548. package/third-party-notices/zip-stream@4.1.1-LICENSE.txt +22 -0
@@ -0,0 +1,71 @@
1
+ "use client";
2
+ function whenNearViewport(target, onVisible, options = {}) {
3
+ const factory = options.io ?? (typeof IntersectionObserver !== "undefined" ? (cb, opts) => new IntersectionObserver(cb, opts) : void 0);
4
+ if (!factory) {
5
+ onVisible();
6
+ return () => void 0;
7
+ }
8
+ let done = false;
9
+ const observer = factory(
10
+ (entries) => {
11
+ const hit = entries.some((e) => e.isIntersecting);
12
+ if (!hit || done) return;
13
+ done = true;
14
+ observer.disconnect();
15
+ onVisible();
16
+ },
17
+ { rootMargin: options.rootMargin ?? "200px" }
18
+ );
19
+ observer.observe(target);
20
+ return () => {
21
+ if (done) return;
22
+ done = true;
23
+ observer.disconnect();
24
+ };
25
+ }
26
+ let katexPromise = null;
27
+ async function loadKatex() {
28
+ if (!katexPromise) {
29
+ katexPromise = import("katex").then((m) => m.default ?? m);
30
+ }
31
+ return katexPromise;
32
+ }
33
+ const cache = /* @__PURE__ */ new Map();
34
+ const CACHE_LIMIT = 500;
35
+ async function renderMathAsync(latex, displayMode) {
36
+ const key = `${displayMode ? "b" : "i"}:${latex}`;
37
+ const hit = cache.get(key);
38
+ if (hit) return { html: hit, error: null };
39
+ try {
40
+ const katex = await loadKatex();
41
+ const html = katex.renderToString(latex, {
42
+ displayMode,
43
+ // 关键安全选项:不允许 \href / \url / \htmlClass 等产生链接或属性
44
+ trust: false,
45
+ // 捕获解析错误并交给两端的统一错误态,避免红色 KaTeX 输出被缓存为成功。
46
+ throwOnError: true,
47
+ // 严格模式降级为忽略:不因排版细节让整个公式渲染失败
48
+ strict: "ignore",
49
+ output: "html"
50
+ });
51
+ if (cache.size >= CACHE_LIMIT) cache.clear();
52
+ cache.set(key, html);
53
+ return { html, error: null };
54
+ } catch (err) {
55
+ return {
56
+ html: "",
57
+ error: err instanceof Error ? err.message : "公式渲染失败"
58
+ };
59
+ }
60
+ }
61
+ let cssInjected = false;
62
+ async function ensureKatexCss() {
63
+ if (cssInjected || typeof document === "undefined") return;
64
+ cssInjected = true;
65
+ await import("katex/dist/katex.min.css");
66
+ }
67
+ export {
68
+ ensureKatexCss as e,
69
+ renderMathAsync as r,
70
+ whenNearViewport as w
71
+ };
@@ -0,0 +1,479 @@
1
+ "use client";
2
+ import { closeHistory } from "@tiptap/pm/history";
3
+ import { yUndoPluginKey } from "@tiptap/y-tiptap";
4
+ import { p as planMindTopicDeletion } from "./mind-map-delete-CVsxdXfs.js";
5
+ import { textDifference, MIND_MAP_MAX_TOPICS, mindMapId, mindMapTree, mindMapDescendants, mindMapOutline, projectMindSideMove, canMoveMindTopic, mindMapBranchSides, MIND_MAP_MAX_TEXT, readMindMap, MIND_MAP_VERSION } from "wendang/internal/mind-map";
6
+ import { searchMindMap, topicTitle, topicField } from "wendang/internal/mind-map-phase2";
7
+ function createMindMapController(editor, getPos, context = {}) {
8
+ var _a;
9
+ const listeners = /* @__PURE__ */ new Set(), sessions = /* @__PURE__ */ new Map();
10
+ let disposed = false;
11
+ const initialPosition = getPos();
12
+ const identity = typeof initialPosition === "number" ? (_a = editor.state.doc.nodeAt(initialPosition)) == null ? void 0 : _a.attrs.id : void 0;
13
+ let composing = false;
14
+ function composition(active) {
15
+ var _a2;
16
+ if (active === composing) return;
17
+ composing = active;
18
+ const storage = (_a2 = editor.storage) == null ? void 0 : _a2.mindMap;
19
+ if (storage) storage.composing = Math.max(0, storage.composing + (active ? 1 : -1));
20
+ }
21
+ function current() {
22
+ if (disposed || editor.isDestroyed) return null;
23
+ const pos = getPos();
24
+ if (typeof pos !== "number") return null;
25
+ const node = editor.state.doc.nodeAt(pos);
26
+ if ((node == null ? void 0 : node.type.name) !== "mindMap" || node.attrs.id !== identity) return null;
27
+ const model = readMindMap(node.toJSON());
28
+ return model ? { node, pos, model } : null;
29
+ }
30
+ function topicAt(id) {
31
+ const map = current();
32
+ if (!map) return null;
33
+ let found = null;
34
+ map.node.forEach((node, offset) => {
35
+ if (node.attrs.id === id) found = { node, pos: map.pos + offset + 1 };
36
+ });
37
+ return found;
38
+ }
39
+ function topicInsertPos(map) {
40
+ let pos = map.pos + 1;
41
+ map.node.forEach((n) => {
42
+ if (n.type.name === "mindMapTopic") pos += n.nodeSize;
43
+ });
44
+ return pos;
45
+ }
46
+ function fieldAt(id, field) {
47
+ const t = topicAt(id);
48
+ if (!t) return null;
49
+ if (field === "title") return { ...t, text: topicTitle(t.node.toJSON()) };
50
+ let found = null;
51
+ t.node.forEach((n, offset) => {
52
+ if (n.type.name === (field === "description" ? "mindMapDescription" : "mindMapNote")) found = { node: n, pos: t.pos + 1 + offset, text: n.textContent };
53
+ });
54
+ return found;
55
+ }
56
+ const editable = () => !!current() && editor.isEditable;
57
+ function structuralChange(tr) {
58
+ var _a2;
59
+ const map = current();
60
+ if (map && map.node.attrs.formatVersion < MIND_MAP_VERSION) {
61
+ const mapped = tr.doc.nodeAt(tr.mapping.map(map.pos));
62
+ if ((mapped == null ? void 0 : mapped.type.name) === "mindMap") tr.setNodeMarkup(tr.mapping.map(map.pos), void 0, { ...mapped.attrs, formatVersion: MIND_MAP_VERSION });
63
+ }
64
+ const undoManager = (_a2 = yUndoPluginKey.getState(editor.state)) == null ? void 0 : _a2.undoManager;
65
+ undoManager == null ? void 0 : undoManager.stopCapturing();
66
+ editor.view.dispatch(closeHistory(tr));
67
+ undoManager == null ? void 0 : undoManager.stopCapturing();
68
+ }
69
+ function notify() {
70
+ for (const fn of listeners) fn();
71
+ }
72
+ function onTransaction({ transaction }) {
73
+ for (const [id, s] of sessions) {
74
+ const locate = (doc) => {
75
+ let result = null;
76
+ doc.descendants((node, pos) => {
77
+ if (node.type.name === "mindMapTopic" && node.attrs.id === id.split("::")[0]) {
78
+ result = { node, pos };
79
+ return false;
80
+ }
81
+ return !result;
82
+ });
83
+ return result;
84
+ };
85
+ const field = id.split("::")[1] || "title";
86
+ const before = locate(transaction.before), after = locate(transaction.doc);
87
+ if (!before || !after) {
88
+ sessions.delete(id);
89
+ continue;
90
+ }
91
+ const getText = (n) => field === "title" ? topicTitle(n.toJSON()) : topicField(n.toJSON(), field);
92
+ const diff = textDifference(getText(before.node), getText(after.node));
93
+ const shift = diff.text.length - (diff.to - diff.from);
94
+ s.boundaries = s.boundaries.map((p) => {
95
+ const offset = Math.max(0, Math.min(getText(before.node).length, p));
96
+ const mapped = offset < diff.from ? offset : offset >= diff.to ? offset + shift : diff.from + diff.text.length;
97
+ return Math.max(0, Math.min(getText(after.node).length, mapped));
98
+ });
99
+ }
100
+ notify();
101
+ }
102
+ editor.on("transaction", onTransaction);
103
+ editor.on("update", notify);
104
+ function beginText(id, field = "title") {
105
+ var _a2, _b, _c;
106
+ const t = fieldAt(id, field);
107
+ if (!t) return;
108
+ const text2 = t.text;
109
+ sessions.set(`${id}::${field}`, { text: text2, boundaries: Array.from({ length: text2.length + 1 }, (_, i) => i) });
110
+ const local = (_b = (_a2 = context.awareness) == null ? void 0 : _a2.getLocalState()) == null ? void 0 : _b.mindMap;
111
+ if ((local == null ? void 0 : local.blockId) === identity) (_c = context.awareness) == null ? void 0 : _c.setLocalStateField("mindMap", { ...local, topicId: id, editing: true });
112
+ }
113
+ function text(id, next, field = "title") {
114
+ if (!editable() || next.length > (field === "title" ? MIND_MAP_MAX_TEXT : 4e3)) return false;
115
+ let t = fieldAt(id, field);
116
+ if (!t && field !== "title") {
117
+ const topic = topicAt(id);
118
+ if (!topic) return false;
119
+ let pos = topic.pos + topic.node.nodeSize - 1;
120
+ if (field === "description") topic.node.forEach((n, offset) => {
121
+ if (n.type.name === "mindMapNote") pos = topic.pos + 1 + offset;
122
+ });
123
+ structuralChange(editor.state.tr.insert(pos, editor.schema.nodes[field === "description" ? "mindMapDescription" : "mindMapNote"].create()));
124
+ t = fieldAt(id, field);
125
+ }
126
+ if (!t) return false;
127
+ const key = `${id}::${field}`;
128
+ if (!sessions.has(key)) beginText(id, field);
129
+ const s = sessions.get(key);
130
+ const diff = textDifference(s.text, next);
131
+ if (diff.from === diff.to && !diff.text) return true;
132
+ const from = t.pos + 1 + s.boundaries[diff.from], to = t.pos + 1 + s.boundaries[diff.to];
133
+ if (from < t.pos + 1 || to > t.pos + 1 + t.text.length || from > to) return false;
134
+ const tr = editor.state.tr.insertText(diff.text, from, to);
135
+ editor.view.dispatch(tr);
136
+ const mapped = sessions.get(key);
137
+ if (!mapped) return false;
138
+ mapped.boundaries = [
139
+ ...mapped.boundaries.slice(0, diff.from),
140
+ ...Array.from({ length: diff.text.length + 1 }, (_, i) => from - t.pos - 1 + i),
141
+ ...mapped.boundaries.slice(diff.to + 1)
142
+ ];
143
+ mapped.text = next;
144
+ return true;
145
+ }
146
+ function patch(id, attrs) {
147
+ const t = topicAt(id);
148
+ if (!editable() || !t) return false;
149
+ structuralChange(editor.state.tr.setNodeMarkup(t.pos, void 0, { ...t.node.attrs, ...attrs }));
150
+ return true;
151
+ }
152
+ function orderAt(tr, siblings, index) {
153
+ var _a2, _b, _c;
154
+ const previous = ((_a2 = siblings[index - 1]) == null ? void 0 : _a2.order) ?? (((_b = siblings[index]) == null ? void 0 : _b.order) ?? 0) - 2048;
155
+ const next = ((_c = siblings[index]) == null ? void 0 : _c.order) ?? previous + 2048;
156
+ const value = (previous + next) / 2;
157
+ if (value > previous && value < next && Math.abs(value) < 1e12 && next - previous > Number.EPSILON * Math.max(1, Math.abs(previous), Math.abs(next)) * 8) return value;
158
+ siblings.forEach((t, i) => {
159
+ const existing = topicAt(t.id);
160
+ if (existing) tr.setNodeMarkup(existing.pos, void 0, { ...existing.node.attrs, order: i * 1024 });
161
+ });
162
+ return index * 1024 - 512;
163
+ }
164
+ function freezeBranchSides(tr, map) {
165
+ const sides = mindMapBranchSides(map.model);
166
+ for (const [id, side] of sides) {
167
+ const entry = topicAt(id);
168
+ tr.setNodeMarkup(entry.pos, void 0, { ...tr.doc.nodeAt(entry.pos).attrs, side });
169
+ }
170
+ return sides;
171
+ }
172
+ function insertTopic(parentId, referenceId, label = "新主题", placement = "after", requestedSide) {
173
+ const map = current();
174
+ if (!editable() || !map || map.model.topics.length >= MIND_MAP_MAX_TOPICS || !topicAt(parentId)) return null;
175
+ if (requestedSide !== void 0 && (parentId !== map.model.rootId || map.model.layout === "down" || requestedSide !== -1 && requestedSide !== 1)) return null;
176
+ const siblings = mindMapTree(map.model).filter((t) => t.parentId === parentId);
177
+ const at = siblings.findIndex((t) => t.id === referenceId);
178
+ if (referenceId && at < 0) return null;
179
+ const tr = editor.state.tr;
180
+ const order = orderAt(tr, siblings, at >= 0 ? at + (placement === "after" ? 1 : 0) : siblings.length);
181
+ const id = mindMapId();
182
+ const changeLayout = requestedSide !== void 0 && map.model.layout !== "both" && requestedSide !== (map.model.layout === "left" ? -1 : 1);
183
+ const sides = map.model.layout === "both" || changeLayout ? freezeBranchSides(tr, map) : mindMapBranchSides(map.model);
184
+ const side = requestedSide ?? (parentId === map.model.rootId ? referenceId ? sides.get(referenceId) : map.model.layout === "left" ? -1 : 1 : null);
185
+ const node = editor.schema.nodes.mindMapTopic.create(
186
+ { id, parentId, order, side },
187
+ label ? editor.schema.text(label.slice(0, MIND_MAP_MAX_TEXT)) : void 0
188
+ );
189
+ if (changeLayout) tr.setNodeMarkup(map.pos, void 0, { ...map.node.attrs, layout: "both" });
190
+ structuralChange(tr.insert(topicInsertPos(map), node));
191
+ return id;
192
+ }
193
+ function add(parentId, afterId, label = "新主题") {
194
+ return insertTopic(parentId, afterId, label);
195
+ }
196
+ function addRootChild(side, label = "新主题") {
197
+ const map = current();
198
+ return map ? insertTopic(map.model.rootId, void 0, label, "after", side) : null;
199
+ }
200
+ function addSibling(id, placement, label = "新主题") {
201
+ const map = current();
202
+ if (!map || id === map.model.rootId) return null;
203
+ const topic = mindMapTree(map.model).find((t) => t.id === id);
204
+ return (topic == null ? void 0 : topic.parentId) ? insertTopic(topic.parentId, id, label, placement) : null;
205
+ }
206
+ function move(id, targetId, mode = "child") {
207
+ const map = current();
208
+ if (!map || !editable()) return false;
209
+ const tree = mindMapTree(map.model), target = tree.find((t) => t.id === targetId);
210
+ if (!target) return false;
211
+ const parentId = mode === "child" ? targetId : target.parentId;
212
+ if (!canMoveMindTopic(map.model, id, parentId) || id === targetId) return false;
213
+ const siblings = tree.filter((t) => t.parentId === parentId && t.id !== id);
214
+ const tr = editor.state.tr;
215
+ let index;
216
+ if (mode === "child") index = siblings.length;
217
+ else {
218
+ const at = siblings.findIndex((t) => t.id === targetId);
219
+ if (at < 0) return false;
220
+ index = mode === "before" ? at : at + 1;
221
+ }
222
+ const order = orderAt(tr, siblings, index), node = topicAt(id);
223
+ const sides = mindMapBranchSides(map.model);
224
+ if (parentId === map.model.rootId) {
225
+ for (const sibling of tree.filter((t) => t.parentId === parentId && t.id !== id)) {
226
+ const entry = topicAt(sibling.id);
227
+ tr.setNodeMarkup(entry.pos, void 0, { ...tr.doc.nodeAt(entry.pos).attrs, side: sides.get(sibling.id) });
228
+ }
229
+ }
230
+ const side = parentId === map.model.rootId ? sides.get(mode === "child" ? id : targetId) ?? (map.model.layout === "left" ? -1 : 1) : null;
231
+ tr.setNodeMarkup(node.pos, void 0, { ...tr.doc.nodeAt(node.pos).attrs, parentId, order, side });
232
+ structuralChange(tr);
233
+ return true;
234
+ }
235
+ function moveToSide(id, side, beforeId) {
236
+ const map = current();
237
+ if (!map || !editable()) return false;
238
+ const projected = projectMindSideMove(map.model, id, side, beforeId);
239
+ if (!projected) return false;
240
+ const tr = editor.state.tr;
241
+ for (const topic of projected.topics) {
242
+ const before = map.model.topics.find((t) => t.id === topic.id);
243
+ if (before.parentId === topic.parentId && before.order === topic.order && before.side === topic.side) continue;
244
+ const entry = topicAt(topic.id);
245
+ tr.setNodeMarkup(entry.pos, void 0, { ...entry.node.attrs, parentId: topic.parentId, order: topic.order, side: topic.side ?? null });
246
+ }
247
+ if (map.model.layout !== projected.layout) tr.setNodeMarkup(map.pos, void 0, { ...map.node.attrs, layout: projected.layout });
248
+ if (tr.docChanged) structuralChange(tr);
249
+ return true;
250
+ }
251
+ function remove(id) {
252
+ return removeMany([id]);
253
+ }
254
+ function removeMany(selection) {
255
+ const map = current();
256
+ if (!editable() || !map) return false;
257
+ const plan = planMindTopicDeletion(map.model, selection);
258
+ if (!plan) return false;
259
+ const { ids } = plan;
260
+ const ranges = [];
261
+ map.node.forEach((t, offset) => {
262
+ if (ids.has(t.attrs.id) || t.type.name === "mindMapRelation" && (ids.has(t.attrs.source) || ids.has(t.attrs.target))) ranges.push({ from: map.pos + 1 + offset, to: map.pos + 1 + offset + t.nodeSize });
263
+ });
264
+ const tr = editor.state.tr;
265
+ if (map.model.layout === "both") freezeBranchSides(tr, map);
266
+ for (const range of ranges.reverse()) tr.delete(range.from, range.to);
267
+ structuralChange(tr);
268
+ return true;
269
+ }
270
+ function settings(attrs) {
271
+ const map = current();
272
+ if (!editable() || !map) return false;
273
+ const tr = editor.state.tr;
274
+ if (attrs.layout && attrs.layout !== map.model.layout) for (const topic of map.model.topics.filter((t) => t.parentId === map.model.rootId)) {
275
+ const entry = topicAt(topic.id);
276
+ if (entry.node.attrs.side !== null) tr.setNodeMarkup(entry.pos, void 0, { ...entry.node.attrs, side: null });
277
+ }
278
+ structuralChange(tr.setNodeMarkup(map.pos, void 0, { ...map.node.attrs, ...attrs }));
279
+ return true;
280
+ }
281
+ function addParent(id) {
282
+ const map = current(), t = topicAt(id);
283
+ if (!map || !t || !editable() || id === map.model.rootId || map.model.topics.length >= 500) return null;
284
+ const projected = mindMapTree(map.model).find((n) => n.id === id);
285
+ const newId = mindMapId(), tr = editor.state.tr;
286
+ if (map.model.layout === "both") freezeBranchSides(tr, map);
287
+ tr.setNodeMarkup(t.pos, void 0, { ...t.node.attrs, parentId: newId, order: 0 });
288
+ tr.insert(topicInsertPos(map), editor.schema.nodes.mindMapTopic.create({ id: newId, parentId: projected.parentId, order: projected.order, side: mindMapBranchSides(map.model).get(id) ?? null }, editor.schema.text("父主题")));
289
+ structuralChange(tr);
290
+ return newId;
291
+ }
292
+ function indent(id, out = false) {
293
+ const map = current();
294
+ if (!map) return false;
295
+ const tree = mindMapTree(map.model), topic = tree.find((t) => t.id === id);
296
+ if (!topic || !topic.parentId) return false;
297
+ if (out) {
298
+ const parent = tree.find((t) => t.id === topic.parentId);
299
+ return !!(parent == null ? void 0 : parent.parentId) && move(id, parent.id, "after");
300
+ }
301
+ const siblings = tree.filter((t) => t.parentId === topic.parentId), at = siblings.findIndex((t) => t.id === id);
302
+ return at > 0 && move(id, siblings[at - 1].id);
303
+ }
304
+ function format(id, from, to, mark, attrs) {
305
+ const t = fieldAt(id, "title"), type = editor.schema.marks[mark];
306
+ if (!editable() || !t || !type || from < 0 || to > t.text.length || to <= from) return false;
307
+ const start = t.pos + 1 + from, end = t.pos + 1 + to, tr = editor.state.tr;
308
+ if (!attrs && editor.state.doc.rangeHasMark(start, end, type)) tr.removeMark(start, end, type);
309
+ else tr.addMark(start, end, type.create(attrs));
310
+ structuralChange(tr);
311
+ return true;
312
+ }
313
+ function clearFormat(id, from, to, marks) {
314
+ const t = fieldAt(id, "title");
315
+ if (!editable() || !t || from < 0 || to > t.text.length || to <= from) return false;
316
+ const tr = editor.state.tr;
317
+ if (marks) for (const name of marks) {
318
+ const mark = editor.schema.marks[name];
319
+ if (mark) tr.removeMark(t.pos + 1 + from, t.pos + 1 + to, mark);
320
+ }
321
+ else tr.removeMark(t.pos + 1 + from, t.pos + 1 + to);
322
+ structuralChange(tr);
323
+ return true;
324
+ }
325
+ function replace(query, replacement, target) {
326
+ const map = current();
327
+ if (!map || !editable() || !query) return 0;
328
+ const hits = target ? [target] : searchMindMap(map.model, query), tr = editor.state.tr;
329
+ if (hits.length > 5e3) return -1;
330
+ const counts = /* @__PURE__ */ new Map();
331
+ for (const hit of hits) counts.set(`${hit.id}::${hit.field}`, (counts.get(`${hit.id}::${hit.field}`) ?? 0) + 1);
332
+ for (const [key, count] of counts) {
333
+ const [id, field] = key.split("::"), t = fieldAt(id, field);
334
+ if (t && t.text.length + count * (replacement.length - query.length) > (field === "title" ? 2e3 : 4e3)) return -2;
335
+ }
336
+ const ranges = hits.flatMap((hit) => {
337
+ const t = fieldAt(hit.id, hit.field);
338
+ if (!t || t.text.slice(hit.from, hit.to).toLocaleLowerCase() !== query.toLocaleLowerCase()) return [];
339
+ if (t.text.length + replacement.length - query.length > (hit.field === "title" ? 2e3 : 4e3)) return [];
340
+ return [{ from: t.pos + 1 + hit.from, to: t.pos + 1 + hit.to }];
341
+ }).sort((a, b) => b.from - a.from);
342
+ for (const r of ranges) tr.insertText(replacement, r.from, r.to);
343
+ if (ranges.length) structuralChange(tr);
344
+ return ranges.length;
345
+ }
346
+ function relation(value) {
347
+ const map = current();
348
+ if (!map || !editable() || value.source === value.target || !topicAt(value.source) || !topicAt(value.target)) return false;
349
+ let found = null;
350
+ map.node.forEach((node, offset) => {
351
+ if (node.type.name === "mindMapRelation" && node.attrs.id === value.id) found = { node, pos: map.pos + 1 + offset };
352
+ });
353
+ const prior = found, attrs = { ...value, id: value.id ?? mindMapId(), label: value.label.slice(0, 200) };
354
+ structuralChange(prior ? editor.state.tr.setNodeMarkup(prior.pos, void 0, attrs) : editor.state.tr.insert(map.pos + map.node.nodeSize - 1, editor.schema.nodes.mindMapRelation.create(attrs)));
355
+ return true;
356
+ }
357
+ function deleteRelation(id) {
358
+ const map = current();
359
+ if (!map || !editable()) return false;
360
+ const tr = editor.state.tr;
361
+ let found = false;
362
+ map.node.forEach((node, offset) => {
363
+ if (node.type.name === "mindMapRelation" && node.attrs.id === id) {
364
+ tr.delete(map.pos + 1 + offset, map.pos + 1 + offset + node.nodeSize);
365
+ found = true;
366
+ }
367
+ });
368
+ if (found) structuralChange(tr);
369
+ return found;
370
+ }
371
+ function copyBranch(id) {
372
+ const map = current();
373
+ if (!map) return [];
374
+ const ids = mindMapDescendants(map.model, id);
375
+ const topics = new Map((map.node.toJSON().content ?? []).map((t) => {
376
+ var _a2;
377
+ return [String((_a2 = t.attrs) == null ? void 0 : _a2.id), t];
378
+ }));
379
+ return [
380
+ ...mindMapOutline(map.model).filter((t) => ids.has(t.id)).map((t) => topics.get(t.id)),
381
+ ...(map.node.toJSON().content ?? []).filter((t) => {
382
+ var _a2, _b;
383
+ return t.type === "mindMapRelation" && ids.has(String((_a2 = t.attrs) == null ? void 0 : _a2.source)) && ids.has(String((_b = t.attrs) == null ? void 0 : _b.target));
384
+ })
385
+ ];
386
+ }
387
+ function pasteBranch(parentId, branch) {
388
+ var _a2, _b, _c, _d;
389
+ const map = current();
390
+ if (!editable() || !map || !topicAt(parentId) || !branch.length || branch.filter((t) => t.type === "mindMapTopic").length + map.model.topics.length > MIND_MAP_MAX_TOPICS) return null;
391
+ const topics = branch.filter((t) => t.type === "mindMapTopic");
392
+ if (!topics.length) return null;
393
+ const ids = new Map(topics.map((t) => {
394
+ var _a3;
395
+ return [String((_a3 = t.attrs) == null ? void 0 : _a3.id), mindMapId()];
396
+ }));
397
+ const siblings = mindMapTree(map.model).filter((t) => t.parentId === parentId);
398
+ const nodes = topics.map((t, i) => {
399
+ var _a3, _b2, _c2, _d2, _e;
400
+ return editor.schema.nodeFromJSON({ ...t, attrs: {
401
+ ...t.attrs,
402
+ id: ids.get(String((_a3 = t.attrs) == null ? void 0 : _a3.id)),
403
+ parentId: ids.get(String((_b2 = t.attrs) == null ? void 0 : _b2.parentId)) ?? parentId,
404
+ order: ids.has(String((_c2 = t.attrs) == null ? void 0 : _c2.parentId)) ? Number((_d2 = t.attrs) == null ? void 0 : _d2.order) || 0 : (((_e = siblings.at(-1)) == null ? void 0 : _e.order) ?? -1) + 1 + i
405
+ } });
406
+ });
407
+ const tr = editor.state.tr.insert(topicInsertPos(map), nodes);
408
+ for (const r of branch.filter((t) => t.type === "mindMapRelation")) {
409
+ if (ids.has(String((_a2 = r.attrs) == null ? void 0 : _a2.source)) && ids.has(String((_b = r.attrs) == null ? void 0 : _b.target)))
410
+ tr.insert(tr.mapping.map(map.pos + map.node.nodeSize - 1), editor.schema.nodes.mindMapRelation.create({ ...r.attrs, id: mindMapId(), source: ids.get(String((_c = r.attrs) == null ? void 0 : _c.source)), target: ids.get(String((_d = r.attrs) == null ? void 0 : _d.target)) }));
411
+ }
412
+ structuralChange(tr);
413
+ return nodes[0].attrs.id;
414
+ }
415
+ return {
416
+ context,
417
+ snapshot: () => {
418
+ var _a2;
419
+ return ((_a2 = current()) == null ? void 0 : _a2.model) ?? null;
420
+ },
421
+ editable,
422
+ beginText,
423
+ text,
424
+ composition,
425
+ patch,
426
+ addParent,
427
+ indent,
428
+ format,
429
+ clearFormat,
430
+ replace,
431
+ relation,
432
+ deleteRelation,
433
+ hasActiveText: () => sessions.size > 0,
434
+ endText: (id, field = "title") => {
435
+ var _a2, _b, _c;
436
+ sessions.delete(`${id}::${field}`);
437
+ const local = (_b = (_a2 = context.awareness) == null ? void 0 : _a2.getLocalState()) == null ? void 0 : _b.mindMap;
438
+ if ((local == null ? void 0 : local.blockId) === identity) (_c = context.awareness) == null ? void 0 : _c.setLocalStateField("mindMap", { ...local, editing: sessions.size > 0 });
439
+ },
440
+ add,
441
+ addRootChild,
442
+ addSibling,
443
+ move,
444
+ moveToSide,
445
+ remove,
446
+ removeMany,
447
+ settings,
448
+ copyBranch,
449
+ pasteBranch,
450
+ undo: () => editable() && editor.commands.undo(),
451
+ redo: () => editable() && editor.commands.redo(),
452
+ canUndo: () => editable() && editor.can().undo(),
453
+ canRedo: () => editable() && editor.can().redo(),
454
+ canExport: () => {
455
+ var _a2;
456
+ return ((_a2 = context.canExport) == null ? void 0 : _a2.call(context)) ?? false;
457
+ },
458
+ status: () => {
459
+ var _a2;
460
+ return ((_a2 = context.status) == null ? void 0 : _a2.call(context)) ?? "";
461
+ },
462
+ subscribe(fn) {
463
+ listeners.add(fn);
464
+ return () => listeners.delete(fn);
465
+ },
466
+ dispose() {
467
+ composition(false);
468
+ disposed = true;
469
+ editor.off("transaction", onTransaction);
470
+ editor.off("update", notify);
471
+ notify();
472
+ listeners.clear();
473
+ sessions.clear();
474
+ }
475
+ };
476
+ }
477
+ export {
478
+ createMindMapController as c
479
+ };
@@ -0,0 +1,31 @@
1
+ "use client";
2
+ import { mindMapTree } from "wendang/internal/mind-map";
3
+ function planMindTopicDeletion(model, selection, activeId) {
4
+ var _a, _b;
5
+ const tree = mindMapTree(model), byId = new Map(tree.map((topic) => [topic.id, topic]));
6
+ const selected = [...new Set(selection)];
7
+ if (!selected.length || selected.some((id) => !byId.has(id))) return null;
8
+ const targets = selected.filter((id) => id !== model.rootId);
9
+ if (!targets.length) return null;
10
+ const children = /* @__PURE__ */ new Map();
11
+ for (const topic of tree) {
12
+ const siblings = children.get(topic.parentId) ?? [];
13
+ siblings.push(topic.id);
14
+ children.set(topic.parentId, siblings);
15
+ }
16
+ const ids = /* @__PURE__ */ new Set();
17
+ const pending = [...targets];
18
+ while (pending.length) {
19
+ const id = pending.pop();
20
+ if (ids.has(id)) continue;
21
+ ids.add(id);
22
+ pending.push(...children.get(id) ?? []);
23
+ }
24
+ const roots = targets.filter((id) => !ids.has(byId.get(id).parentId));
25
+ let nextId = ((_a = byId.get(activeId ?? targets.at(-1))) == null ? void 0 : _a.parentId) || model.rootId;
26
+ while (ids.has(nextId)) nextId = ((_b = byId.get(nextId)) == null ? void 0 : _b.parentId) || model.rootId;
27
+ return { ids, roots, nextId, keepsCenter: selected.includes(model.rootId) };
28
+ }
29
+ export {
30
+ planMindTopicDeletion as p
31
+ };
@@ -0,0 +1,43 @@
1
+ "use client";
2
+ function selectMindTopic(current, id, additive = false) {
3
+ if (!additive) return /* @__PURE__ */ new Set([id]);
4
+ const next = new Set(current);
5
+ if (next.has(id)) next.delete(id);
6
+ else next.add(id);
7
+ return next;
8
+ }
9
+ function resetMindZoom(viewport, width, height) {
10
+ return {
11
+ x: width / 2 - (width / 2 - viewport.x) / viewport.zoom,
12
+ y: height / 2 - (height / 2 - viewport.y) / viewport.zoom,
13
+ zoom: 1
14
+ };
15
+ }
16
+ function mindCanvasShortcut(event) {
17
+ if (event.isComposing || event.keyCode === 229 || event.altKey) return null;
18
+ if (event.metaKey || event.ctrlKey) {
19
+ if (event.key === "+" || event.key === "=") return "zoom-in";
20
+ if (event.key === "-") return "zoom-out";
21
+ if (!event.shiftKey && event.key === "0") return "reset-zoom";
22
+ return null;
23
+ }
24
+ if (event.metaKey || event.ctrlKey || !event.shiftKey) return null;
25
+ switch (event.key.toLowerCase()) {
26
+ case "c":
27
+ return "comments";
28
+ case "q":
29
+ return "quick";
30
+ case "g":
31
+ return "grid";
32
+ case "1":
33
+ case "!":
34
+ return "fit";
35
+ default:
36
+ return null;
37
+ }
38
+ }
39
+ export {
40
+ mindCanvasShortcut as m,
41
+ resetMindZoom as r,
42
+ selectMindTopic as s
43
+ };