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.
- package/LICENSE +21 -0
- package/NOTICE.md +381 -0
- package/README.md +478 -2
- package/dist/bindings/yjs.js +5 -0
- package/dist/chunks/AnchoredPanel-D3nte06T.js +68 -0
- package/dist/chunks/MindMapCanvas-D5XwjVH1.js +2072 -0
- package/dist/chunks/MindMapViewer-CQTQAgNq.js +180 -0
- package/dist/chunks/SpreadsheetViewer-DN_QQGud.js +157 -0
- package/dist/chunks/code-highlight-BmaqTe1m.js +30 -0
- package/dist/chunks/code-highlight-engine-BFDzDPzy.js +40 -0
- package/dist/chunks/comment-hint-DN7LKJAn.js +296 -0
- package/dist/chunks/composition-state-Bl-U1R_2.js +40 -0
- package/dist/chunks/extensions-B-CVVQhp.js +4210 -0
- package/dist/chunks/fuzzy-match-DYQR-4w2.js +89 -0
- package/dist/chunks/hooks-C53Dp0pr.js +35 -0
- package/dist/chunks/host-C-V688Rq.js +197 -0
- package/dist/chunks/index-Ii536CFG.js +720 -0
- package/dist/chunks/katex-WjrodtTU.js +71 -0
- package/dist/chunks/mind-map-controller-B6SxK3GZ.js +479 -0
- package/dist/chunks/mind-map-delete-CVsxdXfs.js +31 -0
- package/dist/chunks/mind-map-input-CEWRz_t6.js +43 -0
- package/dist/chunks/mind-topic-text-BBNTbFSe.js +446 -0
- package/dist/chunks/nodes-iKqTGr_N.js +291 -0
- package/dist/chunks/popover-placement-D3xVYdkt.js +47 -0
- package/dist/chunks/worksheet-engine-TJ54m0KC.js +125 -0
- package/dist/chunks/worksheet-preview-DsDVWxIM.js +129 -0
- package/dist/document/viewer.js +287 -0
- package/dist/document.js +3620 -0
- package/dist/index.js +8 -0
- package/dist/mindmap/viewer.js +6 -0
- package/dist/mindmap.js +123 -0
- package/dist/shared.js +52 -0
- package/dist/spreadsheet/viewer.js +5 -0
- package/dist/spreadsheet/xlsx.js +299 -0
- package/dist/spreadsheet.js +120 -0
- package/dist/styles/callout.css +34 -0
- package/dist/styles/code-block.css +58 -0
- package/dist/styles/content-style.css +619 -0
- package/dist/styles/editor-interaction.css +621 -0
- package/dist/styles/file-video.css +12 -0
- package/dist/styles/image-preview.css +103 -0
- package/dist/styles/mind-map-block.css +14 -0
- package/dist/styles/mind-map-canvas.css +80 -0
- package/dist/styles/mind-map-comments.css +93 -0
- package/dist/styles/mind-map-details.css +7 -0
- package/dist/styles/mind-map-preview.css +7 -0
- package/dist/styles/mind-map-topic.css +112 -0
- package/dist/styles/page-picker.css +47 -0
- package/dist/styles/renderer.css +45 -0
- package/dist/styles/spreadsheet-editor.css +3 -0
- package/dist/styles/tokens.css +154 -0
- package/dist/styles/video-dialog.css +41 -0
- package/dist/styles/video-embed.css +35 -0
- package/dist/styles.css +2615 -0
- package/dist/types/bindings/yjs.d.ts +3 -0
- package/dist/types/document/viewer.d.ts +3 -0
- package/dist/types/document.d.ts +7 -0
- package/dist/types/editor/BlockAffordance.d.ts +47 -0
- package/dist/types/editor/CalloutView.d.ts +2 -0
- package/dist/types/editor/CodeBlockView.d.ts +9 -0
- package/dist/types/editor/DocumentColorPanel.d.ts +8 -0
- package/dist/types/editor/DocumentEditor.d.ts +71 -0
- package/dist/types/editor/ImagePreview.d.ts +10 -0
- package/dist/types/editor/LinkPopover.d.ts +21 -0
- package/dist/types/editor/PagePicker.d.ts +7 -0
- package/dist/types/editor/SelectionToolbar.d.ts +11 -0
- package/dist/types/editor/SlashMenu.d.ts +30 -0
- package/dist/types/editor/TableControls.d.ts +9 -0
- package/dist/types/editor/VideoEmbedDialog.d.ts +6 -0
- package/dist/types/editor/document-gestures.d.ts +13 -0
- package/dist/types/editor/extensions.d.ts +29 -0
- package/dist/types/editor/nodes.d.ts +20 -0
- package/dist/types/editor/same-document.d.ts +2 -0
- package/dist/types/engine/collab/presence.d.ts +1 -0
- package/dist/types/engine/editor/block-commands.d.ts +35 -0
- package/dist/types/engine/editor/block-conversion.d.ts +12 -0
- package/dist/types/engine/editor/block-drag.d.ts +16 -0
- package/dist/types/engine/editor/block-menu-placement.d.ts +16 -0
- package/dist/types/engine/editor/callout-commands.d.ts +4 -0
- package/dist/types/engine/editor/collab-change-origin.d.ts +2 -0
- package/dist/types/engine/editor/delete-block.d.ts +2 -0
- package/dist/types/engine/editor/extensions/block-format.d.ts +19 -0
- package/dist/types/engine/editor/extensions/block-handle.d.ts +17 -0
- package/dist/types/engine/editor/extensions/block-menu-highlight.d.ts +4 -0
- package/dist/types/engine/editor/extensions/block-selection.d.ts +117 -0
- package/dist/types/engine/editor/extensions/code-highlight.d.ts +2 -0
- package/dist/types/engine/editor/extensions/collab-cursor.d.ts +13 -0
- package/dist/types/engine/editor/extensions/ime-guard.d.ts +8 -0
- package/dist/types/engine/editor/extensions/inline-comments.d.ts +15 -0
- package/dist/types/engine/editor/extensions/paste-sanitizer.d.ts +4 -0
- package/dist/types/engine/editor/extensions/slash.d.ts +16 -0
- package/dist/types/engine/editor/extensions/table-interaction.d.ts +9 -0
- package/dist/types/engine/editor/extensions/upload-placeholder.d.ts +48 -0
- package/dist/types/engine/editor/image-preview-gesture.d.ts +3 -0
- package/dist/types/engine/editor/ime/composition-state.d.ts +9 -0
- package/dist/types/engine/editor/insert-block.d.ts +6 -0
- package/dist/types/engine/editor/insert-picker-logic.d.ts +13 -0
- package/dist/types/engine/editor/link-edit.d.ts +10 -0
- package/dist/types/engine/editor/mind-map-controller.d.ts +63 -0
- package/dist/types/engine/editor/mind-map-delete.d.ts +7 -0
- package/dist/types/engine/editor/mind-map-drag.d.ts +16 -0
- package/dist/types/engine/editor/mind-map-input.d.ts +16 -0
- package/dist/types/engine/editor/mind-map-selection.d.ts +11 -0
- package/dist/types/engine/editor/nodes/columns.d.ts +6 -0
- package/dist/types/engine/editor/nodes/file-nodeview.d.ts +4 -0
- package/dist/types/engine/editor/nodes/file.d.ts +2 -0
- package/dist/types/engine/editor/nodes/image-gallery.d.ts +2 -0
- package/dist/types/engine/editor/nodes/image-nodeview.d.ts +4 -0
- package/dist/types/engine/editor/nodes/image.d.ts +1 -0
- package/dist/types/engine/editor/nodes/inline-style.d.ts +4 -0
- package/dist/types/engine/editor/nodes/math-nodeview.d.ts +2 -0
- package/dist/types/engine/editor/nodes/math.d.ts +3 -0
- package/dist/types/engine/editor/nodes/mention.d.ts +2 -0
- package/dist/types/engine/editor/nodes/mind-map-schema.d.ts +6 -0
- package/dist/types/engine/editor/nodes/page-link.d.ts +2 -0
- package/dist/types/engine/editor/nodes/table-cell.d.ts +4 -0
- package/dist/types/engine/editor/nodes/video-embed-schema.d.ts +2 -0
- package/dist/types/engine/editor/popover-placement.d.ts +35 -0
- package/dist/types/engine/editor/table-clipboard.d.ts +3 -0
- package/dist/types/engine/editor/table-commands.d.ts +20 -0
- package/dist/types/engine/editor/table-geometry.d.ts +34 -0
- package/dist/types/engine/editor/table-menu-placement.d.ts +30 -0
- package/dist/types/engine/editor/tracked-target.d.ts +8 -0
- package/dist/types/engine/editor/trailing-paragraph.d.ts +2 -0
- package/dist/types/engine/host.d.ts +2 -0
- package/dist/types/engine/renderer/attachments.d.ts +11 -0
- package/dist/types/engine/renderer/katex.d.ts +7 -0
- package/dist/types/engine/renderer/lazy-visible.d.ts +11 -0
- package/dist/types/engine/shared/callout.d.ts +1 -0
- package/dist/types/engine/shared/code-block.d.ts +1 -0
- package/dist/types/engine/shared/code-highlight-engine.d.ts +2 -0
- package/dist/types/engine/shared/code-highlight.d.ts +8 -0
- package/dist/types/engine/shared/comment-hint-position.d.ts +20 -0
- package/dist/types/engine/shared/comment-hint.d.ts +2 -0
- package/dist/types/engine/shared/document-colors.d.ts +1 -0
- package/dist/types/engine/shared/fuzzy-match.d.ts +13 -0
- package/dist/types/engine/shared/image-gallery.d.ts +1 -0
- package/dist/types/engine/shared/inline-comments.d.ts +1 -0
- package/dist/types/engine/shared/mind-map-phase2.d.ts +1 -0
- package/dist/types/engine/shared/mind-map.d.ts +1 -0
- package/dist/types/engine/shared/mind-topic-text.d.ts +1 -0
- package/dist/types/engine/shared/modal-stack.d.ts +6 -0
- package/dist/types/engine/shared/page-candidates.d.ts +6 -0
- package/dist/types/engine/shared/pinyin.d.ts +6 -0
- package/dist/types/engine/shared/preview-items.d.ts +10 -0
- package/dist/types/engine/shared/safe-href.d.ts +1 -0
- package/dist/types/engine/shared/table-cell-format.d.ts +1 -0
- package/dist/types/engine/shared/table-layout.d.ts +1 -0
- package/dist/types/engine/shared/video-embed.d.ts +1 -0
- package/dist/types/engine/shared/video-feedback.d.ts +1 -0
- package/dist/types/engine/shared/workbook.d.ts +1 -0
- package/dist/types/engine/worksheets/worksheet-engine.d.ts +16 -0
- package/dist/types/engine/worksheets/worksheet-format.d.ts +20 -0
- package/dist/types/engine/worksheets/worksheet-preview.d.ts +17 -0
- package/dist/types/engine/worksheets/worksheet-xlsx.d.ts +21 -0
- package/dist/types/engine/wui/core/dialog.d.ts +5 -0
- package/dist/types/engine/wui/core/listbox.d.ts +8 -0
- package/dist/types/engine/wui/core/placement.d.ts +40 -0
- package/dist/types/hooks.d.ts +7 -0
- package/dist/types/host-types.d.ts +58 -0
- package/dist/types/host.d.ts +24 -0
- package/dist/types/index.d.ts +5 -0
- package/dist/types/mindmap/Comments.d.ts +9 -0
- package/dist/types/mindmap/Details.d.ts +13 -0
- package/dist/types/mindmap/Field.d.ts +10 -0
- package/dist/types/mindmap/MindMapCanvas.d.ts +19 -0
- package/dist/types/mindmap/MindMapEditor.d.ts +30 -0
- package/dist/types/mindmap/MindMapViewer.d.ts +23 -0
- package/dist/types/mindmap/TopicLabel.d.ts +4 -0
- package/dist/types/mindmap/viewer.d.ts +2 -0
- package/dist/types/mindmap.d.ts +4 -0
- package/dist/types/renderer/CodeToolbar.d.ts +10 -0
- package/dist/types/renderer/DocumentViewer.d.ts +23 -0
- package/dist/types/renderer/media.d.ts +33 -0
- package/dist/types/shared.d.ts +12 -0
- package/dist/types/spreadsheet/SpreadsheetEditor.d.ts +23 -0
- package/dist/types/spreadsheet/SpreadsheetViewer.d.ts +13 -0
- package/dist/types/spreadsheet/viewer.d.ts +2 -0
- package/dist/types/spreadsheet/xlsx.d.ts +2 -0
- package/dist/types/spreadsheet.d.ts +3 -0
- package/dist/types/wui/AnchoredPanel.d.ts +14 -0
- package/dist/types/wui/Dropdown.d.ts +18 -0
- package/dist/types/wui/Icon.d.ts +7 -0
- package/dist/types/wui/Tooltip.d.ts +5 -0
- package/dist/types/wui/index.d.ts +69 -0
- package/package.json +122 -3
- package/third-party-notices/@fast-csv__format@4.3.5-LICENSE.txt +21 -0
- package/third-party-notices/@fast-csv__parse@4.3.6-LICENSE.txt +21 -0
- package/third-party-notices/@flatten-js__interval-tree@1.1.3-LICENSE.txt +21 -0
- package/third-party-notices/@floating-ui__core@1.8.0-LICENSE.txt +20 -0
- package/third-party-notices/@floating-ui__dom@1.8.0-LICENSE.txt +20 -0
- package/third-party-notices/@floating-ui__react-dom@2.1.9-LICENSE.txt +20 -0
- package/third-party-notices/@floating-ui__utils@0.2.12-LICENSE.txt +20 -0
- package/third-party-notices/@grpc__grpc-js@1.14.6-LICENSE.txt +201 -0
- package/third-party-notices/@grpc__proto-loader@0.8.1-LICENSE.txt +201 -0
- package/third-party-notices/@js-sdsl__ordered-map@4.4.2-LICENSE.txt +21 -0
- package/third-party-notices/@protobufjs__aspromise@1.1.2-LICENSE.txt +26 -0
- package/third-party-notices/@protobufjs__base64@1.1.2-LICENSE.txt +26 -0
- package/third-party-notices/@protobufjs__codegen@2.0.5-LICENSE.txt +26 -0
- package/third-party-notices/@protobufjs__eventemitter@1.1.1-LICENSE.txt +26 -0
- package/third-party-notices/@protobufjs__fetch@1.1.1-LICENSE.txt +26 -0
- package/third-party-notices/@protobufjs__float@1.0.2-LICENSE.txt +26 -0
- package/third-party-notices/@protobufjs__path@1.1.2-LICENSE.txt +26 -0
- package/third-party-notices/@protobufjs__pool@1.1.0-LICENSE.txt +26 -0
- package/third-party-notices/@protobufjs__utf8@1.1.2-LICENSE.txt +26 -0
- package/third-party-notices/@radix-ui__primitive@1.2.0-LICENSE.txt +21 -0
- package/third-party-notices/@radix-ui__react-arrow@1.1.17-LICENSE.txt +21 -0
- package/third-party-notices/@radix-ui__react-collection@1.2.0-LICENSE.txt +21 -0
- package/third-party-notices/@radix-ui__react-compose-refs@1.1.5-LICENSE.txt +21 -0
- package/third-party-notices/@radix-ui__react-context@1.3.0-LICENSE.txt +21 -0
- package/third-party-notices/@radix-ui__react-dialog@1.3.1-LICENSE.txt +21 -0
- package/third-party-notices/@radix-ui__react-direction@1.2.0-LICENSE.txt +21 -0
- package/third-party-notices/@radix-ui__react-dismissable-layer@1.2.1-LICENSE.txt +21 -0
- package/third-party-notices/@radix-ui__react-dropdown-menu@2.2.1-LICENSE.txt +21 -0
- package/third-party-notices/@radix-ui__react-focus-guards@1.2.0-LICENSE.txt +21 -0
- package/third-party-notices/@radix-ui__react-focus-scope@1.3.1-LICENSE.txt +21 -0
- package/third-party-notices/@radix-ui__react-hover-card@1.2.1-LICENSE.txt +21 -0
- package/third-party-notices/@radix-ui__react-id@1.1.4-LICENSE.txt +21 -0
- package/third-party-notices/@radix-ui__react-menu@2.2.1-LICENSE.txt +21 -0
- package/third-party-notices/@radix-ui__react-popover@1.3.1-LICENSE.txt +21 -0
- package/third-party-notices/@radix-ui__react-popper@1.4.0-LICENSE.txt +21 -0
- package/third-party-notices/@radix-ui__react-portal@1.2.0-LICENSE.txt +21 -0
- package/third-party-notices/@radix-ui__react-presence@1.1.11-LICENSE.txt +21 -0
- package/third-party-notices/@radix-ui__react-primitive@2.2.0-LICENSE.txt +21 -0
- package/third-party-notices/@radix-ui__react-roving-focus@1.2.1-LICENSE.txt +21 -0
- package/third-party-notices/@radix-ui__react-separator@1.2.0-LICENSE.txt +21 -0
- package/third-party-notices/@radix-ui__react-slot@1.5.0-LICENSE.txt +21 -0
- package/third-party-notices/@radix-ui__react-use-callback-ref@1.1.5-LICENSE.txt +21 -0
- package/third-party-notices/@radix-ui__react-use-controllable-state@1.3.0-LICENSE.txt +21 -0
- package/third-party-notices/@radix-ui__react-use-effect-event@0.0.5-LICENSE.txt +21 -0
- package/third-party-notices/@radix-ui__react-use-is-hydrated@0.1.3-LICENSE.txt +21 -0
- package/third-party-notices/@radix-ui__react-use-layout-effect@1.1.4-LICENSE.txt +21 -0
- package/third-party-notices/@radix-ui__react-use-rect@1.1.4-LICENSE.txt +21 -0
- package/third-party-notices/@radix-ui__react-use-size@1.1.5-LICENSE.txt +21 -0
- package/third-party-notices/@radix-ui__rect@1.1.3-LICENSE.txt +21 -0
- package/third-party-notices/@tiptap__core@3.31.4-LICENSE.md.txt +21 -0
- package/third-party-notices/@tiptap__extension-blockquote@3.31.4-LICENSE.md.txt +21 -0
- package/third-party-notices/@tiptap__extension-bold@3.31.4-LICENSE.md.txt +21 -0
- package/third-party-notices/@tiptap__extension-bullet-list@3.31.4-LICENSE.md.txt +21 -0
- package/third-party-notices/@tiptap__extension-code-block@3.31.4-LICENSE.md.txt +21 -0
- package/third-party-notices/@tiptap__extension-code@3.31.4-LICENSE.md.txt +21 -0
- package/third-party-notices/@tiptap__extension-collaboration@3.31.4-LICENSE.md.txt +21 -0
- package/third-party-notices/@tiptap__extension-document@3.31.4-LICENSE.md.txt +21 -0
- package/third-party-notices/@tiptap__extension-dropcursor@3.31.4-LICENSE.md.txt +21 -0
- package/third-party-notices/@tiptap__extension-gapcursor@3.31.4-LICENSE.md.txt +21 -0
- package/third-party-notices/@tiptap__extension-hard-break@3.31.4-LICENSE.md.txt +21 -0
- package/third-party-notices/@tiptap__extension-heading@3.31.4-LICENSE.md.txt +21 -0
- package/third-party-notices/@tiptap__extension-horizontal-rule@3.31.4-LICENSE.md.txt +21 -0
- package/third-party-notices/@tiptap__extension-image@3.31.4-LICENSE.md.txt +21 -0
- package/third-party-notices/@tiptap__extension-italic@3.31.4-LICENSE.md.txt +21 -0
- package/third-party-notices/@tiptap__extension-link@3.31.4-LICENSE.md.txt +21 -0
- package/third-party-notices/@tiptap__extension-list-item@3.31.4-LICENSE.md.txt +21 -0
- package/third-party-notices/@tiptap__extension-list-keymap@3.31.4-LICENSE.md.txt +21 -0
- package/third-party-notices/@tiptap__extension-list@3.31.4-LICENSE.md.txt +21 -0
- package/third-party-notices/@tiptap__extension-ordered-list@3.31.4-LICENSE.md.txt +21 -0
- package/third-party-notices/@tiptap__extension-paragraph@3.31.4-LICENSE.md.txt +21 -0
- package/third-party-notices/@tiptap__extension-placeholder@3.31.4-LICENSE.md.txt +21 -0
- package/third-party-notices/@tiptap__extension-strike@3.31.4-LICENSE.md.txt +21 -0
- package/third-party-notices/@tiptap__extension-table-cell@3.31.4-LICENSE.md.txt +21 -0
- package/third-party-notices/@tiptap__extension-table-header@3.31.4-LICENSE.md.txt +21 -0
- package/third-party-notices/@tiptap__extension-table-row@3.31.4-LICENSE.md.txt +21 -0
- package/third-party-notices/@tiptap__extension-table@3.31.4-LICENSE.md.txt +21 -0
- package/third-party-notices/@tiptap__extension-task-item@3.31.4-LICENSE.md.txt +21 -0
- package/third-party-notices/@tiptap__extension-task-list@3.31.4-LICENSE.md.txt +21 -0
- package/third-party-notices/@tiptap__extension-text@3.31.4-LICENSE.md.txt +21 -0
- package/third-party-notices/@tiptap__extension-underline@3.31.4-LICENSE.md.txt +21 -0
- package/third-party-notices/@tiptap__extensions@3.31.4-LICENSE.md.txt +21 -0
- package/third-party-notices/@tiptap__pm@3.31.4-LICENSE.txt +21 -0
- package/third-party-notices/@tiptap__starter-kit@3.31.4-LICENSE.md.txt +21 -0
- package/third-party-notices/@tiptap__y-tiptap@3.0.7-LICENSE.txt +22 -0
- package/third-party-notices/@types__hast@3.0.5-LICENSE.txt +21 -0
- package/third-party-notices/@types__node@14.18.63-LICENSE.txt +21 -0
- package/third-party-notices/@types__node@26.6.2-LICENSE.txt +21 -0
- package/third-party-notices/@types__react-dom@19.3.0-LICENSE.txt +21 -0
- package/third-party-notices/@types__react@19.3.0-LICENSE.txt +21 -0
- package/third-party-notices/@types__unist@3.0.3-LICENSE.txt +21 -0
- package/third-party-notices/@univerjs__core@1.1.0-LICENSE.txt +176 -0
- package/third-party-notices/@univerjs__design@1.1.0-LICENSE.txt +176 -0
- package/third-party-notices/@univerjs__docs-ui@1.1.0-LICENSE.txt +176 -0
- package/third-party-notices/@univerjs__docs@1.1.0-LICENSE.txt +176 -0
- package/third-party-notices/@univerjs__drawing@1.1.0-LICENSE.txt +176 -0
- package/third-party-notices/@univerjs__engine-formula@1.1.0-LICENSE.txt +176 -0
- package/third-party-notices/@univerjs__engine-render@1.1.0-LICENSE.txt +176 -0
- package/third-party-notices/@univerjs__icons@1.46.0-LICENSE.txt +21 -0
- package/third-party-notices/@univerjs__network@1.1.0-LICENSE.txt +176 -0
- package/third-party-notices/@univerjs__preset-sheets-core@1.1.0-LICENSE.txt +176 -0
- package/third-party-notices/@univerjs__preset-sheets-filter@1.1.0-LICENSE.txt +176 -0
- package/third-party-notices/@univerjs__preset-sheets-sort@1.1.0-LICENSE.txt +176 -0
- package/third-party-notices/@univerjs__presets@1.1.0-LICENSE.txt +176 -0
- package/third-party-notices/@univerjs__rpc@1.1.0-LICENSE.txt +176 -0
- package/third-party-notices/@univerjs__sheets-filter-ui@1.1.0-LICENSE.txt +176 -0
- package/third-party-notices/@univerjs__sheets-filter@1.1.0-LICENSE.txt +176 -0
- package/third-party-notices/@univerjs__sheets-formula-ui@1.1.0-LICENSE.txt +176 -0
- package/third-party-notices/@univerjs__sheets-formula@1.1.0-LICENSE.txt +176 -0
- package/third-party-notices/@univerjs__sheets-numfmt-ui@1.1.0-LICENSE.txt +176 -0
- package/third-party-notices/@univerjs__sheets-numfmt@1.1.0-LICENSE.txt +176 -0
- package/third-party-notices/@univerjs__sheets-sort-ui@1.1.0-LICENSE.txt +176 -0
- package/third-party-notices/@univerjs__sheets-sort@1.1.0-LICENSE.txt +176 -0
- package/third-party-notices/@univerjs__sheets-ui@1.1.0-LICENSE.txt +176 -0
- package/third-party-notices/@univerjs__sheets@1.1.0-LICENSE.txt +176 -0
- package/third-party-notices/@univerjs__telemetry@1.1.0-LICENSE.txt +176 -0
- package/third-party-notices/@univerjs__themes@1.1.0-LICENSE.txt +176 -0
- package/third-party-notices/@univerjs__ui@1.1.0-LICENSE.txt +176 -0
- package/third-party-notices/@wendellhu__redi@1.1.3-LICENSE.txt +7 -0
- package/third-party-notices/ansi-regex@5.0.1-license.txt +9 -0
- package/third-party-notices/ansi-styles@4.3.0-license.txt +9 -0
- package/third-party-notices/archiver-utils@2.1.0-LICENSE.txt +22 -0
- package/third-party-notices/archiver-utils@3.0.4-LICENSE.txt +22 -0
- package/third-party-notices/archiver@5.3.2-LICENSE.txt +22 -0
- package/third-party-notices/aria-hidden@1.2.6-LICENSE.txt +21 -0
- package/third-party-notices/array-buffer-byte-length@1.0.2-LICENSE.txt +21 -0
- package/third-party-notices/arraybuffer.prototype.slice@1.0.4-LICENSE.txt +21 -0
- package/third-party-notices/async-function@1.0.0-LICENSE.txt +21 -0
- package/third-party-notices/async-lock@1.4.1-LICENSE.txt +22 -0
- package/third-party-notices/async@3.2.6-LICENSE.txt +19 -0
- package/third-party-notices/available-typed-arrays@1.0.7-LICENSE.txt +21 -0
- package/third-party-notices/balanced-match@1.0.2-LICENSE.md.txt +21 -0
- package/third-party-notices/base64-js@1.5.1-LICENSE.txt +21 -0
- package/third-party-notices/big-integer@1.6.52-LICENSE.txt +24 -0
- package/third-party-notices/bl@4.1.0-LICENSE.md.txt +13 -0
- package/third-party-notices/bluebird@3.4.7-LICENSE.txt +21 -0
- package/third-party-notices/brace-expansion@1.1.21-LICENSE.txt +21 -0
- package/third-party-notices/brace-expansion@2.1.7-LICENSE.txt +21 -0
- package/third-party-notices/buffer-crc32@0.2.13-LICENSE.txt +19 -0
- package/third-party-notices/buffer-indexof-polyfill@1.0.2-LICENSE.txt +22 -0
- package/third-party-notices/buffer@5.7.1-LICENSE.txt +21 -0
- package/third-party-notices/call-bind-apply-helpers@1.0.2-LICENSE.txt +21 -0
- package/third-party-notices/call-bind@1.0.9-LICENSE.txt +21 -0
- package/third-party-notices/call-bound@1.0.4-LICENSE.txt +21 -0
- package/third-party-notices/class-variance-authority@0.7.1-LICENSE.txt +190 -0
- package/third-party-notices/cliui@8.0.1-LICENSE.txt.txt +14 -0
- package/third-party-notices/clsx@2.1.1-license.txt +9 -0
- package/third-party-notices/cmdk@1.1.1-LICENSE.md.txt +21 -0
- package/third-party-notices/collapse-white-space@2.1.0-license.txt +22 -0
- package/third-party-notices/color-convert@2.0.1-LICENSE.txt +21 -0
- package/third-party-notices/color-name@1.1.4-LICENSE.txt +8 -0
- package/third-party-notices/commander@15.0.0-LICENSE.txt +22 -0
- package/third-party-notices/compress-commons@4.1.2-LICENSE.txt +22 -0
- package/third-party-notices/concat-map@0.0.1-LICENSE.txt +18 -0
- package/third-party-notices/core-util-is@1.0.3-LICENSE.txt +19 -0
- package/third-party-notices/crc-32@1.2.2-LICENSE.txt +201 -0
- package/third-party-notices/crc32-stream@4.0.3-LICENSE.txt +22 -0
- package/third-party-notices/csstype@3.2.3-LICENSE.txt +19 -0
- package/third-party-notices/data-view-buffer@1.0.2-LICENSE.txt +21 -0
- package/third-party-notices/data-view-byte-length@1.0.2-LICENSE.txt +21 -0
- package/third-party-notices/data-view-byte-offset@1.0.1-LICENSE.txt +21 -0
- package/third-party-notices/dayjs@1.11.23-LICENSE.txt +21 -0
- package/third-party-notices/decimal.js@10.6.0-LICENCE.md.txt +23 -0
- package/third-party-notices/define-data-property@1.1.4-LICENSE.txt +21 -0
- package/third-party-notices/define-properties@1.2.1-LICENSE.txt +21 -0
- package/third-party-notices/dequal@2.0.3-license.txt +21 -0
- package/third-party-notices/detect-node-es@1.1.0-LICENSE.txt +21 -0
- package/third-party-notices/devlop@1.1.0-license.txt +22 -0
- package/third-party-notices/dunder-proto@1.0.1-LICENSE.txt +21 -0
- package/third-party-notices/duplexer2@0.1.4-LICENSE.md.txt +26 -0
- package/third-party-notices/end-of-stream@1.4.5-LICENSE.txt +21 -0
- package/third-party-notices/es-abstract-get@1.0.0-LICENSE.txt +21 -0
- package/third-party-notices/es-abstract@1.24.2-LICENSE.txt +21 -0
- package/third-party-notices/es-define-property@1.0.1-LICENSE.txt +21 -0
- package/third-party-notices/es-errors@1.3.0-LICENSE.txt +21 -0
- package/third-party-notices/es-object-atoms@1.1.2-LICENSE.txt +21 -0
- package/third-party-notices/es-set-tostringtag@2.1.0-LICENSE.txt +21 -0
- package/third-party-notices/es-to-primitive@1.3.4-LICENSE.txt +22 -0
- package/third-party-notices/escalade@3.2.0-license.txt +9 -0
- package/third-party-notices/exceljs@4.4.0-LICENSE.txt +22 -0
- package/third-party-notices/fast-csv@4.3.6-LICENSE.txt +21 -0
- package/third-party-notices/fast-diff@1.3.0-LICENSE.txt +201 -0
- package/third-party-notices/for-each@0.3.5-LICENSE.txt +22 -0
- package/third-party-notices/fs-constants@1.0.0-LICENSE.txt +21 -0
- package/third-party-notices/fs.realpath@1.0.0-LICENSE.txt +43 -0
- package/third-party-notices/fstream@1.0.12-LICENSE.txt +15 -0
- package/third-party-notices/function-bind@1.1.2-LICENSE.txt +20 -0
- package/third-party-notices/function.prototype.name@1.2.0-LICENSE.txt +21 -0
- package/third-party-notices/functions-have-names@1.2.3-LICENSE.txt +21 -0
- package/third-party-notices/generator-function@2.0.1-LICENSE.md.txt +7 -0
- package/third-party-notices/get-caller-file@2.0.5-LICENSE.md.txt +6 -0
- package/third-party-notices/get-intrinsic@1.3.0-LICENSE.txt +21 -0
- package/third-party-notices/get-nonce@1.0.1-LICENSE.txt +21 -0
- package/third-party-notices/get-proto@1.0.1-LICENSE.txt +21 -0
- package/third-party-notices/get-symbol-description@1.1.0-LICENSE.txt +21 -0
- package/third-party-notices/glob@7.2.3-LICENSE.txt +21 -0
- package/third-party-notices/globalthis@1.0.4-LICENSE.txt +21 -0
- package/third-party-notices/gopd@1.2.0-LICENSE.txt +21 -0
- package/third-party-notices/graceful-fs@4.2.11-LICENSE.txt +15 -0
- package/third-party-notices/has-bigints@1.1.0-LICENSE.txt +21 -0
- package/third-party-notices/has-property-descriptors@1.0.2-LICENSE.txt +21 -0
- package/third-party-notices/has-proto@1.2.0-LICENSE.txt +21 -0
- package/third-party-notices/has-symbols@1.1.0-LICENSE.txt +21 -0
- package/third-party-notices/has-tostringtag@1.0.2-LICENSE.txt +21 -0
- package/third-party-notices/hasown@2.0.4-LICENSE.txt +21 -0
- package/third-party-notices/highlight.js@11.11.2-LICENSE.txt +29 -0
- package/third-party-notices/ieee754@1.2.1-LICENSE.txt +11 -0
- package/third-party-notices/immediate@3.0.6-LICENSE.txt.txt +20 -0
- package/third-party-notices/inflight@1.0.6-LICENSE.txt +15 -0
- package/third-party-notices/inherits@2.0.4-LICENSE.txt +16 -0
- package/third-party-notices/internal-slot@1.1.0-LICENSE.txt +21 -0
- package/third-party-notices/is-array-buffer@3.0.5-LICENSE.txt +21 -0
- package/third-party-notices/is-async-function@2.1.1-LICENSE.txt +20 -0
- package/third-party-notices/is-bigint@1.1.0-LICENSE.txt +21 -0
- package/third-party-notices/is-boolean-object@1.2.2-LICENSE.txt +22 -0
- package/third-party-notices/is-callable@1.2.7-LICENSE.txt +22 -0
- package/third-party-notices/is-data-view@1.0.2-LICENSE.txt +21 -0
- package/third-party-notices/is-date-object@1.1.0-LICENSE.txt +22 -0
- package/third-party-notices/is-document.all@1.0.0-LICENSE.txt +21 -0
- package/third-party-notices/is-finalizationregistry@1.1.1-LICENSE.txt +21 -0
- package/third-party-notices/is-fullwidth-code-point@3.0.0-license.txt +9 -0
- package/third-party-notices/is-generator-function@1.1.2-LICENSE.txt +20 -0
- package/third-party-notices/is-map@2.0.3-LICENSE.txt +21 -0
- package/third-party-notices/is-negative-zero@2.0.3-LICENSE.txt +20 -0
- package/third-party-notices/is-number-object@1.1.1-LICENSE.txt +22 -0
- package/third-party-notices/is-regex@1.2.1-LICENSE.txt +20 -0
- package/third-party-notices/is-set@2.0.3-LICENSE.txt +21 -0
- package/third-party-notices/is-shared-array-buffer@1.0.4-LICENSE.txt +21 -0
- package/third-party-notices/is-string@1.1.1-LICENSE.txt +22 -0
- package/third-party-notices/is-symbol@1.1.1-LICENSE.txt +22 -0
- package/third-party-notices/is-typed-array@1.1.15-LICENSE.txt +22 -0
- package/third-party-notices/is-weakmap@2.0.2-LICENSE.txt +21 -0
- package/third-party-notices/is-weakref@1.1.1-LICENSE.txt +21 -0
- package/third-party-notices/is-weakset@2.0.4-LICENSE.txt +21 -0
- package/third-party-notices/isarray@2.0.5-LICENSE.txt +21 -0
- package/third-party-notices/isomorphic.js@0.2.5-LICENSE.txt +21 -0
- package/third-party-notices/jszip@3.10.2-LICENSE.markdown.txt +651 -0
- package/third-party-notices/katex@0.18.9-LICENSE.txt +21 -0
- package/third-party-notices/kdbush@4.1.0-LICENSE.txt +15 -0
- package/third-party-notices/lazystream@1.0.1-LICENSE.txt +23 -0
- package/third-party-notices/lib0@0.2.119-LICENSE.txt +21 -0
- package/third-party-notices/lie@3.3.0-license.md.txt +7 -0
- package/third-party-notices/linkifyjs@4.3.3-LICENSE.txt +19 -0
- package/third-party-notices/listenercount@1.0.1-LICENSE.md.txt +5 -0
- package/third-party-notices/lodash-es@4.18.1-LICENSE.txt +47 -0
- package/third-party-notices/lodash.camelcase@4.3.0-LICENSE.txt +47 -0
- package/third-party-notices/lodash.defaults@4.2.0-LICENSE.txt +47 -0
- package/third-party-notices/lodash.difference@4.5.0-LICENSE.txt +47 -0
- package/third-party-notices/lodash.escaperegexp@4.1.2-LICENSE.txt +47 -0
- package/third-party-notices/lodash.flatten@4.4.0-LICENSE.txt +47 -0
- package/third-party-notices/lodash.groupby@4.6.0-LICENSE.txt +47 -0
- package/third-party-notices/lodash.isboolean@3.0.3-LICENSE.txt +22 -0
- package/third-party-notices/lodash.isequal@4.5.0-LICENSE.txt +47 -0
- package/third-party-notices/lodash.isfunction@3.0.9-LICENSE.txt +47 -0
- package/third-party-notices/lodash.isnil@4.0.0-LICENSE.txt +22 -0
- package/third-party-notices/lodash.isplainobject@4.0.6-LICENSE.txt +47 -0
- package/third-party-notices/lodash.isundefined@3.0.1-LICENSE.txt.txt +22 -0
- package/third-party-notices/lodash.union@4.6.0-LICENSE.txt +47 -0
- package/third-party-notices/lodash.uniq@4.5.0-LICENSE.txt +47 -0
- package/third-party-notices/long@5.3.2-LICENSE.txt +202 -0
- package/third-party-notices/lowlight@3.3.0-license.txt +22 -0
- package/third-party-notices/math-intrinsics@1.1.0-LICENSE.txt +21 -0
- package/third-party-notices/minimatch@3.1.5-LICENSE.txt +15 -0
- package/third-party-notices/minimatch@5.1.9-LICENSE.txt +15 -0
- package/third-party-notices/minimist@1.2.8-LICENSE.txt +18 -0
- package/third-party-notices/mkdirp@0.5.6-LICENSE.txt +21 -0
- package/third-party-notices/n-gram@2.0.2-license.txt +22 -0
- package/third-party-notices/normalize-path@3.0.0-LICENSE.txt +21 -0
- package/third-party-notices/numfmt@4.0.1-LICENSE.txt +19 -0
- package/third-party-notices/object-inspect@1.13.4-LICENSE.txt +21 -0
- package/third-party-notices/object-keys@1.1.1-LICENSE.txt +21 -0
- package/third-party-notices/object.assign@4.1.7-LICENSE.txt +21 -0
- package/third-party-notices/once@1.4.0-LICENSE.txt +15 -0
- package/third-party-notices/orderedmap@2.1.1-LICENSE.txt +19 -0
- package/third-party-notices/own-keys@1.0.2-LICENSE.txt +21 -0
- package/third-party-notices/pako@1.0.11-LICENSE.txt +21 -0
- package/third-party-notices/path-is-absolute@1.0.1-license.txt +21 -0
- package/third-party-notices/possible-typed-array-names@1.1.0-LICENSE.txt +21 -0
- package/third-party-notices/process-nextick-args@2.0.1-license.md.txt +19 -0
- package/third-party-notices/prosemirror-changeset@2.4.4-LICENSE.txt +19 -0
- package/third-party-notices/prosemirror-commands@1.7.2-LICENSE.txt +19 -0
- package/third-party-notices/prosemirror-dropcursor@1.8.4-LICENSE.txt +19 -0
- package/third-party-notices/prosemirror-gapcursor@1.4.1-LICENSE.txt +19 -0
- package/third-party-notices/prosemirror-history@1.5.1-LICENSE.txt +19 -0
- package/third-party-notices/prosemirror-inputrules@1.5.1-LICENSE.txt +19 -0
- package/third-party-notices/prosemirror-keymap@1.2.3-LICENSE.txt +19 -0
- package/third-party-notices/prosemirror-model@1.25.12-LICENSE.txt +19 -0
- package/third-party-notices/prosemirror-schema-list@1.5.1-LICENSE.txt +19 -0
- package/third-party-notices/prosemirror-state@1.4.4-LICENSE.txt +19 -0
- package/third-party-notices/prosemirror-tables@1.8.5-LICENSE.txt +19 -0
- package/third-party-notices/prosemirror-transform@1.12.2-LICENSE.txt +19 -0
- package/third-party-notices/prosemirror-view@1.42.6-LICENSE.txt +19 -0
- package/third-party-notices/protobufjs@7.6.6-LICENSE.txt +39 -0
- package/third-party-notices/quickselect@3.0.0-LICENSE.txt +15 -0
- package/third-party-notices/rbush@4.0.1-LICENSE.txt +21 -0
- package/third-party-notices/react-dom@19.3.1-LICENSE.txt +21 -0
- package/third-party-notices/react-remove-scroll@2.7.2-LICENSE.txt +21 -0
- package/third-party-notices/react-style-singleton@2.2.3-LICENSE.txt +21 -0
- package/third-party-notices/react@19.3.1-LICENSE.txt +21 -0
- package/third-party-notices/readable-stream@2.3.8-LICENSE.txt +47 -0
- package/third-party-notices/readable-stream@3.6.2-LICENSE.txt +47 -0
- package/third-party-notices/readdir-glob@1.1.3-LICENSE.txt +201 -0
- package/third-party-notices/reflect.getprototypeof@1.0.10-LICENSE.txt +21 -0
- package/third-party-notices/regexp.prototype.flags@1.5.4-LICENSE.txt +22 -0
- package/third-party-notices/require-directory@2.1.1-LICENSE.txt +22 -0
- package/third-party-notices/rimraf@2.7.1-LICENSE.txt +15 -0
- package/third-party-notices/rope-sequence@1.3.4-LICENSE.txt +19 -0
- package/third-party-notices/rxjs@7.8.2-LICENSE.txt.txt +202 -0
- package/third-party-notices/safe-array-concat@1.1.4-LICENSE.txt +21 -0
- package/third-party-notices/safe-buffer@5.1.2-LICENSE.txt +21 -0
- package/third-party-notices/safe-buffer@5.2.1-LICENSE.txt +21 -0
- package/third-party-notices/safe-push-apply@1.0.0-LICENSE.txt +21 -0
- package/third-party-notices/safe-regex-test@1.1.0-LICENSE.txt +21 -0
- package/third-party-notices/scheduler@0.28.0-LICENSE.txt +21 -0
- package/third-party-notices/set-function-length@1.2.2-LICENSE.txt +21 -0
- package/third-party-notices/set-function-name@2.0.2-LICENSE.txt +21 -0
- package/third-party-notices/set-proto@1.0.0-LICENSE.txt +21 -0
- package/third-party-notices/setimmediate@1.0.5-LICENSE.txt.txt +20 -0
- package/third-party-notices/side-channel-list@1.0.1-LICENSE.txt +21 -0
- package/third-party-notices/side-channel-map@1.0.1-LICENSE.txt +21 -0
- package/third-party-notices/side-channel-weakmap@1.0.2-LICENSE.txt +21 -0
- package/third-party-notices/side-channel@1.1.1-LICENSE.txt +21 -0
- package/third-party-notices/sonner@2.0.8-LICENSE.md.txt +21 -0
- package/third-party-notices/stop-iteration-iterator@1.1.0-LICENSE.txt +21 -0
- package/third-party-notices/string-width@4.2.3-license.txt +9 -0
- package/third-party-notices/string.prototype.trim@1.2.11-LICENSE.txt +21 -0
- package/third-party-notices/string.prototype.trimend@1.0.10-LICENSE.txt +21 -0
- package/third-party-notices/string.prototype.trimstart@1.0.8-LICENSE.txt +21 -0
- package/third-party-notices/string_decoder@1.1.1-LICENSE.txt +48 -0
- package/third-party-notices/string_decoder@1.3.0-LICENSE.txt +48 -0
- package/third-party-notices/strip-ansi@6.0.1-license.txt +9 -0
- package/third-party-notices/tar-stream@2.2.0-LICENSE.txt +21 -0
- package/third-party-notices/tiny-pinyin@1.3.2-LICENSE.txt +21 -0
- package/third-party-notices/tmp@0.2.7-LICENSE.txt +21 -0
- package/third-party-notices/traverse@0.3.10-LICENSE.txt +21 -0
- package/third-party-notices/trigram-utils@2.0.1-license.txt +22 -0
- package/third-party-notices/tslib@2.8.1-LICENSE.txt.txt +12 -0
- package/third-party-notices/typed-array-buffer@1.0.3-LICENSE.txt +21 -0
- package/third-party-notices/typed-array-byte-length@1.0.3-LICENSE.txt +21 -0
- package/third-party-notices/typed-array-byte-offset@1.0.5-LICENSE.txt +21 -0
- package/third-party-notices/typed-array-length@1.0.8-LICENSE.txt +21 -0
- package/third-party-notices/typedarray.prototype.slice@1.0.6-LICENSE.txt +21 -0
- package/third-party-notices/unbox-primitive@1.1.0-LICENSE.txt +21 -0
- package/third-party-notices/undici-types@8.9.0-LICENSE.txt +21 -0
- package/third-party-notices/unzipper@0.10.14-LICENSE.txt +25 -0
- package/third-party-notices/use-callback-ref@1.3.3-LICENSE.txt +21 -0
- package/third-party-notices/use-sidecar@1.1.3-LICENSE.txt +21 -0
- package/third-party-notices/util-deprecate@1.0.2-LICENSE.txt +24 -0
- package/third-party-notices/uuid@8.3.2-LICENSE.md.txt +9 -0
- package/third-party-notices/w3c-keyname@2.2.8-LICENSE.txt +19 -0
- package/third-party-notices/which-boxed-primitive@1.1.1-LICENSE.txt +21 -0
- package/third-party-notices/which-builtin-type@1.2.1-LICENSE.txt +21 -0
- package/third-party-notices/which-collection@1.0.2-LICENSE.txt +21 -0
- package/third-party-notices/which-typed-array@1.1.24-LICENSE.txt +22 -0
- package/third-party-notices/wrap-ansi@7.0.0-license.txt +9 -0
- package/third-party-notices/wrappy@1.0.2-LICENSE.txt +15 -0
- package/third-party-notices/xmlchars@2.2.0-LICENSE.txt +18 -0
- package/third-party-notices/y-protocols@1.0.7-LICENSE.txt +21 -0
- package/third-party-notices/y18n@5.0.8-LICENSE.txt +13 -0
- package/third-party-notices/yargs-parser@21.1.1-LICENSE.txt.txt +14 -0
- package/third-party-notices/yargs@17.7.3-LICENSE.txt +21 -0
- package/third-party-notices/yjs@13.6.33-LICENSE.txt +23 -0
- package/third-party-notices/zip-stream@4.1.1-LICENSE.txt +22 -0
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Node, mergeAttributes, Mark } from "@tiptap/core";
|
|
3
|
+
import { documentColorAttributes, paletteColor, TEXT_COLORS, HIGHLIGHT_COLORS } from "wendang/internal/document-colors";
|
|
4
|
+
import { Slice, Fragment } from "@tiptap/pm/model";
|
|
5
|
+
import { Plugin } from "@tiptap/pm/state";
|
|
6
|
+
import { MIND_MAP_VERSION, mindMapId } from "wendang/internal/mind-map";
|
|
7
|
+
import { normalizeVideoEmbed, videoSourceUrl } from "wendang/internal/video-embed";
|
|
8
|
+
import { effectiveCallout, calloutDOMAttributes, validCalloutAttrs, CALLOUT_TONES } from "wendang/shared";
|
|
9
|
+
const MindMapTopic = Node.create({
|
|
10
|
+
name: "mindMapTopic",
|
|
11
|
+
content: "text* mindMapDescription? mindMapNote?",
|
|
12
|
+
marks: "bold italic strike textStyle highlight link",
|
|
13
|
+
defining: true,
|
|
14
|
+
addAttributes() {
|
|
15
|
+
return {
|
|
16
|
+
id: { default: "", parseHTML: (el) => el.getAttribute("data-topic-id") },
|
|
17
|
+
parentId: { default: "", parseHTML: (el) => el.getAttribute("data-parent-id") },
|
|
18
|
+
order: { default: 0, parseHTML: (el) => Number(el.getAttribute("data-order")) || 0 },
|
|
19
|
+
...Object.fromEntries(["shape", "color", "background", "fontSize", "align", "icon", "done", "attachmentId", "side"].map((key) => [key, { default: null, parseHTML: (el) => {
|
|
20
|
+
try {
|
|
21
|
+
return JSON.parse(el.getAttribute("data-topic-meta") || "{}")[key] ?? null;
|
|
22
|
+
} catch {
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
|
+
} }]))
|
|
26
|
+
};
|
|
27
|
+
},
|
|
28
|
+
parseHTML() {
|
|
29
|
+
return [{ tag: "div[data-mind-topic]" }];
|
|
30
|
+
},
|
|
31
|
+
renderHTML({ node }) {
|
|
32
|
+
return ["div", {
|
|
33
|
+
"data-mind-topic": "",
|
|
34
|
+
"data-topic-id": node.attrs.id,
|
|
35
|
+
"data-parent-id": node.attrs.parentId,
|
|
36
|
+
"data-order": node.attrs.order,
|
|
37
|
+
"data-topic-meta": JSON.stringify(node.attrs)
|
|
38
|
+
}, 0];
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
const MindMap$1 = Node.create({
|
|
42
|
+
name: "mindMap",
|
|
43
|
+
group: "block",
|
|
44
|
+
content: "mindMapTopic+ mindMapRelation*",
|
|
45
|
+
atom: true,
|
|
46
|
+
isolating: true,
|
|
47
|
+
defining: true,
|
|
48
|
+
addStorage() {
|
|
49
|
+
return { composing: 0 };
|
|
50
|
+
},
|
|
51
|
+
addAttributes() {
|
|
52
|
+
return {
|
|
53
|
+
id: { default: "", parseHTML: (el) => el.getAttribute("data-map-id") },
|
|
54
|
+
rootId: { default: "", parseHTML: (el) => el.getAttribute("data-root-id") },
|
|
55
|
+
formatVersion: { default: MIND_MAP_VERSION, parseHTML: (el) => Number(el.getAttribute("data-format-version")) || 1 },
|
|
56
|
+
branchStyle: { default: "curve", parseHTML: (el) => el.getAttribute("data-branch-style") || "curve" },
|
|
57
|
+
layout: { default: "right", parseHTML: (el) => el.getAttribute("data-layout") || "right" },
|
|
58
|
+
theme: { default: "blue", parseHTML: (el) => el.getAttribute("data-theme") || "blue" },
|
|
59
|
+
height: { default: 380, parseHTML: (el) => Number(el.getAttribute("data-height")) || 380 }
|
|
60
|
+
};
|
|
61
|
+
},
|
|
62
|
+
parseHTML() {
|
|
63
|
+
return [{ tag: "div[data-mind-map]" }];
|
|
64
|
+
},
|
|
65
|
+
renderHTML({ node, HTMLAttributes }) {
|
|
66
|
+
return ["div", mergeAttributes(HTMLAttributes, {
|
|
67
|
+
// 与 nodeView 保持同一份"自带视觉身份"声明(见 addNodeView 的说明)
|
|
68
|
+
"data-block-chrome": "",
|
|
69
|
+
"data-mind-map": "",
|
|
70
|
+
"data-map-id": node.attrs.id,
|
|
71
|
+
"data-root-id": node.attrs.rootId,
|
|
72
|
+
"data-format-version": node.attrs.formatVersion,
|
|
73
|
+
"data-layout": node.attrs.layout,
|
|
74
|
+
"data-theme": node.attrs.theme,
|
|
75
|
+
"data-height": node.attrs.height,
|
|
76
|
+
"data-branch-style": node.attrs.branchStyle
|
|
77
|
+
}), 0];
|
|
78
|
+
},
|
|
79
|
+
addProseMirrorPlugins() {
|
|
80
|
+
return [new Plugin({
|
|
81
|
+
props: {
|
|
82
|
+
transformPasted(slice) {
|
|
83
|
+
const clone = (fragment) => {
|
|
84
|
+
const nodes = [];
|
|
85
|
+
fragment.forEach((n) => {
|
|
86
|
+
if (n.type.name === "mindMap") {
|
|
87
|
+
const ids = /* @__PURE__ */ new Map();
|
|
88
|
+
n.forEach((t) => {
|
|
89
|
+
if (t.type.name === "mindMapTopic") ids.set(t.attrs.id, mindMapId());
|
|
90
|
+
});
|
|
91
|
+
const topics = [];
|
|
92
|
+
n.forEach((t) => topics.push(t.type.create({
|
|
93
|
+
...t.attrs,
|
|
94
|
+
id: ids.get(t.attrs.id) ?? mindMapId(),
|
|
95
|
+
...t.type.name === "mindMapRelation" ? { source: ids.get(t.attrs.source), target: ids.get(t.attrs.target) } : { parentId: ids.get(t.attrs.parentId) ?? "" }
|
|
96
|
+
}, t.content)));
|
|
97
|
+
nodes.push(n.type.create({ ...n.attrs, id: mindMapId(), rootId: ids.get(n.attrs.rootId) }, topics));
|
|
98
|
+
} else nodes.push(n.copy(clone(n.content)));
|
|
99
|
+
});
|
|
100
|
+
return Fragment.from(nodes);
|
|
101
|
+
};
|
|
102
|
+
return new Slice(clone(slice.content), slice.openStart, slice.openEnd);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
})];
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
const MindMapDescription = Node.create({
|
|
109
|
+
name: "mindMapDescription",
|
|
110
|
+
inline: true,
|
|
111
|
+
content: "text*",
|
|
112
|
+
marks: "",
|
|
113
|
+
selectable: false,
|
|
114
|
+
parseHTML() {
|
|
115
|
+
return [{ tag: "span[data-mind-description]" }];
|
|
116
|
+
},
|
|
117
|
+
renderHTML() {
|
|
118
|
+
return ["span", { "data-mind-description": "" }, 0];
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
const MindMapNote = MindMapDescription.extend({
|
|
122
|
+
name: "mindMapNote",
|
|
123
|
+
parseHTML() {
|
|
124
|
+
return [{ tag: "span[data-mind-note]" }];
|
|
125
|
+
},
|
|
126
|
+
renderHTML() {
|
|
127
|
+
return ["span", { "data-mind-note": "" }, 0];
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
const MindMapRelation = Node.create({
|
|
131
|
+
name: "mindMapRelation",
|
|
132
|
+
atom: true,
|
|
133
|
+
addAttributes() {
|
|
134
|
+
return Object.fromEntries(["id", "source", "target", "kind", "label"].map((key) => [key, { default: "", parseHTML: (el) => el.getAttribute(`data-${key}`) || "" }]));
|
|
135
|
+
},
|
|
136
|
+
parseHTML() {
|
|
137
|
+
return [{ tag: "span[data-mind-relation]" }];
|
|
138
|
+
},
|
|
139
|
+
renderHTML({ node }) {
|
|
140
|
+
return ["span", { "data-mind-relation": "", ...Object.fromEntries(Object.entries(node.attrs).map(([k, v]) => [`data-${k}`, v])) }];
|
|
141
|
+
}
|
|
142
|
+
});
|
|
143
|
+
const VideoEmbed$1 = Node.create({
|
|
144
|
+
name: "videoEmbed",
|
|
145
|
+
group: "block",
|
|
146
|
+
atom: true,
|
|
147
|
+
selectable: true,
|
|
148
|
+
draggable: false,
|
|
149
|
+
addAttributes() {
|
|
150
|
+
return {
|
|
151
|
+
provider: { default: null, parseHTML: (el) => el.getAttribute("data-provider") },
|
|
152
|
+
videoId: { default: "", parseHTML: (el) => el.getAttribute("data-video-id") },
|
|
153
|
+
page: { default: 1, parseHTML: (el) => Number(el.getAttribute("data-page") ?? 1) },
|
|
154
|
+
startSeconds: { default: 0, parseHTML: (el) => Number(el.getAttribute("data-start-seconds") ?? 0) }
|
|
155
|
+
};
|
|
156
|
+
},
|
|
157
|
+
parseHTML() {
|
|
158
|
+
return [{ tag: "div[data-video-embed]" }];
|
|
159
|
+
},
|
|
160
|
+
renderHTML({ node }) {
|
|
161
|
+
const data = normalizeVideoEmbed(node.attrs);
|
|
162
|
+
return [
|
|
163
|
+
"div",
|
|
164
|
+
mergeAttributes({
|
|
165
|
+
"data-video-embed": "true",
|
|
166
|
+
// 视频卡片自带边框与播放器外观:块选中只加外圈
|
|
167
|
+
"data-block-chrome": "",
|
|
168
|
+
"data-provider": data == null ? void 0 : data.provider,
|
|
169
|
+
"data-video-id": data == null ? void 0 : data.videoId,
|
|
170
|
+
"data-page": data == null ? void 0 : data.page,
|
|
171
|
+
"data-start-seconds": data == null ? void 0 : data.startSeconds
|
|
172
|
+
}),
|
|
173
|
+
data ? videoSourceUrl(data) : "视频地址无效"
|
|
174
|
+
];
|
|
175
|
+
},
|
|
176
|
+
renderText({ node }) {
|
|
177
|
+
const data = normalizeVideoEmbed(node.attrs);
|
|
178
|
+
return data ? videoSourceUrl(data) : "视频地址无效";
|
|
179
|
+
}
|
|
180
|
+
});
|
|
181
|
+
const TextStyle = Mark.create({
|
|
182
|
+
name: "textStyle",
|
|
183
|
+
// 颜色是"附加样式",不应与其它标记互斥
|
|
184
|
+
inclusive: true,
|
|
185
|
+
addAttributes() {
|
|
186
|
+
return {
|
|
187
|
+
color: {
|
|
188
|
+
default: null,
|
|
189
|
+
parseHTML: (el) => {
|
|
190
|
+
const v = el.getAttribute("data-color") ?? el.style.color;
|
|
191
|
+
return paletteColor(v, TEXT_COLORS);
|
|
192
|
+
},
|
|
193
|
+
renderHTML: (attrs) => documentColorAttributes("text", attrs.color)
|
|
194
|
+
}
|
|
195
|
+
};
|
|
196
|
+
},
|
|
197
|
+
parseHTML() {
|
|
198
|
+
return [{ tag: "span[data-text-color]" }];
|
|
199
|
+
},
|
|
200
|
+
renderHTML({ HTMLAttributes }) {
|
|
201
|
+
return [
|
|
202
|
+
"span",
|
|
203
|
+
mergeAttributes(HTMLAttributes, { "data-text-color": "true" }),
|
|
204
|
+
0
|
|
205
|
+
];
|
|
206
|
+
}
|
|
207
|
+
});
|
|
208
|
+
const Highlight = Mark.create({
|
|
209
|
+
name: "highlight",
|
|
210
|
+
inclusive: true,
|
|
211
|
+
addAttributes() {
|
|
212
|
+
return {
|
|
213
|
+
color: {
|
|
214
|
+
default: null,
|
|
215
|
+
parseHTML: (el) => {
|
|
216
|
+
const v = el.getAttribute("data-color") ?? el.style.backgroundColor;
|
|
217
|
+
return paletteColor(v, HIGHLIGHT_COLORS);
|
|
218
|
+
},
|
|
219
|
+
renderHTML: (attrs) => documentColorAttributes("highlight", attrs.color)
|
|
220
|
+
}
|
|
221
|
+
};
|
|
222
|
+
},
|
|
223
|
+
parseHTML() {
|
|
224
|
+
return [{ tag: "mark[data-highlight]" }];
|
|
225
|
+
},
|
|
226
|
+
renderHTML({ HTMLAttributes }) {
|
|
227
|
+
return [
|
|
228
|
+
"mark",
|
|
229
|
+
mergeAttributes(HTMLAttributes, { "data-highlight": "true" }),
|
|
230
|
+
0
|
|
231
|
+
];
|
|
232
|
+
}
|
|
233
|
+
});
|
|
234
|
+
const Callout = Node.create({
|
|
235
|
+
name: "callout",
|
|
236
|
+
group: "block",
|
|
237
|
+
content: "block+",
|
|
238
|
+
defining: true,
|
|
239
|
+
addOptions: () => ({ renderer: void 0 }),
|
|
240
|
+
addAttributes() {
|
|
241
|
+
return {
|
|
242
|
+
tone: { default: "info", parseHTML: (el) => {
|
|
243
|
+
const tone = el.getAttribute("data-tone");
|
|
244
|
+
return CALLOUT_TONES.includes(tone) ? tone : "info";
|
|
245
|
+
} },
|
|
246
|
+
...Object.fromEntries(["icon", "textColor", "borderColor", "backgroundColor"].map((key) => [key, {
|
|
247
|
+
default: null,
|
|
248
|
+
parseHTML: (el) => {
|
|
249
|
+
const value = el.getAttribute(`data-callout-${key.toLowerCase()}`);
|
|
250
|
+
return value !== null && validCalloutAttrs({ [key]: value }) ? value : null;
|
|
251
|
+
}
|
|
252
|
+
}]))
|
|
253
|
+
};
|
|
254
|
+
},
|
|
255
|
+
parseHTML: () => [{ tag: "div[data-callout]", contentElement: (el) => el.querySelector("[data-callout-content]") ?? el }],
|
|
256
|
+
renderHTML: ({ node }) => {
|
|
257
|
+
const { icon } = effectiveCallout(node.attrs);
|
|
258
|
+
return [
|
|
259
|
+
"div",
|
|
260
|
+
{ ...calloutDOMAttributes(node.attrs), class: "doc-callout" },
|
|
261
|
+
...icon ? [["span", { class: "callout-icon", contenteditable: "false", "data-callout-decoration": "true" }, icon]] : [],
|
|
262
|
+
["div", { class: "doc-callout-content", "data-callout-content": "true" }, 0]
|
|
263
|
+
];
|
|
264
|
+
},
|
|
265
|
+
addNodeView() {
|
|
266
|
+
return this.options.renderer ?? null;
|
|
267
|
+
}
|
|
268
|
+
});
|
|
269
|
+
const MindMap = MindMap$1.extend({
|
|
270
|
+
addOptions: () => ({ renderer: void 0 }),
|
|
271
|
+
addNodeView() {
|
|
272
|
+
return this.options.renderer ?? null;
|
|
273
|
+
}
|
|
274
|
+
});
|
|
275
|
+
const VideoEmbed = VideoEmbed$1.extend({
|
|
276
|
+
addOptions: () => ({ renderer: void 0 }),
|
|
277
|
+
addNodeView() {
|
|
278
|
+
return this.options.renderer ?? null;
|
|
279
|
+
}
|
|
280
|
+
});
|
|
281
|
+
export {
|
|
282
|
+
Callout as C,
|
|
283
|
+
Highlight as H,
|
|
284
|
+
MindMap as M,
|
|
285
|
+
TextStyle as T,
|
|
286
|
+
VideoEmbed as V,
|
|
287
|
+
MindMapTopic as a,
|
|
288
|
+
MindMapDescription as b,
|
|
289
|
+
MindMapNote as c,
|
|
290
|
+
MindMapRelation as d
|
|
291
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
const ANCHORED_POPOVER_GAP = 8;
|
|
3
|
+
const ANCHORED_POPOVER_VIEW_MARGIN = 8;
|
|
4
|
+
const ANCHORED_POPOVER_ARROW_INSET = 14;
|
|
5
|
+
function placeAnchoredPopover(input) {
|
|
6
|
+
const { align, prefer, anchor, host, card, bounds } = input;
|
|
7
|
+
const gap = input.gap ?? ANCHORED_POPOVER_GAP;
|
|
8
|
+
const margin = ANCHORED_POPOVER_VIEW_MARGIN;
|
|
9
|
+
const anchorLeft = host.left + anchor.left;
|
|
10
|
+
const anchorTop = host.top + anchor.top;
|
|
11
|
+
const anchorBottom = anchorTop + anchor.height;
|
|
12
|
+
const anchorCenter = anchorLeft + anchor.width / 2;
|
|
13
|
+
const preferredLeft = align === "center" ? anchorCenter - card.width / 2 : anchorLeft;
|
|
14
|
+
const minLeft = bounds.left + margin;
|
|
15
|
+
const maxLeft = Math.max(minLeft, bounds.left + bounds.width - margin - card.width);
|
|
16
|
+
const left = Math.min(Math.max(preferredLeft, minLeft), maxLeft);
|
|
17
|
+
const minTop = bounds.top + margin;
|
|
18
|
+
const maxTop = Math.max(minTop, bounds.top + bounds.height - margin - card.height);
|
|
19
|
+
const above = anchorTop - gap - card.height;
|
|
20
|
+
const below = anchorBottom + gap;
|
|
21
|
+
const fitsAbove = above >= minTop;
|
|
22
|
+
const fitsBelow = below + card.height <= bounds.top + bounds.height - margin;
|
|
23
|
+
let side = prefer === "above" ? fitsAbove ? "above" : "below" : fitsBelow ? "below" : "above";
|
|
24
|
+
if (side === "below" && !fitsBelow && fitsAbove) {
|
|
25
|
+
side = "above";
|
|
26
|
+
} else if (side === "above" && !fitsAbove && fitsBelow) {
|
|
27
|
+
side = "below";
|
|
28
|
+
}
|
|
29
|
+
const top = Math.min(Math.max(side === "above" ? above : below, minTop), maxTop);
|
|
30
|
+
const arrowLeft = Math.min(
|
|
31
|
+
Math.max(anchorCenter - left, ANCHORED_POPOVER_ARROW_INSET),
|
|
32
|
+
Math.max(ANCHORED_POPOVER_ARROW_INSET, card.width - ANCHORED_POPOVER_ARROW_INSET)
|
|
33
|
+
);
|
|
34
|
+
return {
|
|
35
|
+
left: left - host.left,
|
|
36
|
+
top: top - host.top,
|
|
37
|
+
side,
|
|
38
|
+
arrowLeft,
|
|
39
|
+
arrowShift: arrowLeft - card.width / 2
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
export {
|
|
43
|
+
ANCHORED_POPOVER_ARROW_INSET as A,
|
|
44
|
+
ANCHORED_POPOVER_GAP as a,
|
|
45
|
+
ANCHORED_POPOVER_VIEW_MARGIN as b,
|
|
46
|
+
placeAnchoredPopover as p
|
|
47
|
+
};
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { createUniver, LocaleType, mergeLocales, CommandType } from "@univerjs/presets";
|
|
3
|
+
import { UniverSheetsCorePreset } from "@univerjs/preset-sheets-core";
|
|
4
|
+
import coreZhCN from "@univerjs/preset-sheets-core/locales/zh-CN";
|
|
5
|
+
import { UniverSheetsFilterPreset } from "@univerjs/preset-sheets-filter";
|
|
6
|
+
import filterZhCN from "@univerjs/preset-sheets-filter/locales/zh-CN";
|
|
7
|
+
import { UniverSheetsSortPreset } from "@univerjs/preset-sheets-sort";
|
|
8
|
+
import sortZhCN from "@univerjs/preset-sheets-sort/locales/zh-CN";
|
|
9
|
+
import "@univerjs/preset-sheets-core/lib/index.css";
|
|
10
|
+
import "@univerjs/preset-sheets-filter/lib/index.css";
|
|
11
|
+
import "@univerjs/preset-sheets-sort/lib/index.css";
|
|
12
|
+
import { sanitizeNonFiniteNumbers } from "wendang/internal/workbook";
|
|
13
|
+
function snapshotWorkbook(saved) {
|
|
14
|
+
const { value, dropped } = sanitizeNonFiniteNumbers(saved);
|
|
15
|
+
if (dropped.length) {
|
|
16
|
+
const contentLoss = dropped.filter((path) => path.includes(".cellData."));
|
|
17
|
+
console.warn(
|
|
18
|
+
`[wendang] 工作表快照含 ${dropped.length} 处非有限数值,已清洗(内容字段 ${contentLoss.length} 处)`,
|
|
19
|
+
dropped.slice(0, 10)
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
return value;
|
|
23
|
+
}
|
|
24
|
+
function editKey(doc) {
|
|
25
|
+
return JSON.stringify(doc, (key, value) => {
|
|
26
|
+
if (key === "cellData") {
|
|
27
|
+
return Object.fromEntries(Object.entries(value ?? {}).map(([r, row]) => [
|
|
28
|
+
r,
|
|
29
|
+
Object.fromEntries(Object.entries(row).map(([c, raw]) => {
|
|
30
|
+
const cell = raw;
|
|
31
|
+
if (!(cell == null ? void 0 : cell.f)) return [c, cell];
|
|
32
|
+
const { v: _v, t: _t, ...input } = cell;
|
|
33
|
+
return [c, input];
|
|
34
|
+
}))
|
|
35
|
+
]));
|
|
36
|
+
}
|
|
37
|
+
return value;
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
function createWorksheetEngine(container, initial, onChange, options = {}) {
|
|
41
|
+
const { univer, univerAPI } = createUniver({
|
|
42
|
+
locale: LocaleType.ZH_CN,
|
|
43
|
+
darkMode: options.theme === "dark",
|
|
44
|
+
locales: { [LocaleType.ZH_CN]: mergeLocales(coreZhCN, filterZhCN, sortZhCN) },
|
|
45
|
+
presets: [UniverSheetsCorePreset({
|
|
46
|
+
container,
|
|
47
|
+
header: true,
|
|
48
|
+
ribbonType: "collapsed",
|
|
49
|
+
footer: { statisticBar: false, zoomSlider: false }
|
|
50
|
+
}), UniverSheetsFilterPreset(), UniverSheetsSortPreset()]
|
|
51
|
+
});
|
|
52
|
+
let book;
|
|
53
|
+
try {
|
|
54
|
+
book = univerAPI.createWorkbook(initial.workbook);
|
|
55
|
+
} catch (error) {
|
|
56
|
+
univer.dispose();
|
|
57
|
+
throw error;
|
|
58
|
+
}
|
|
59
|
+
let cached = null;
|
|
60
|
+
const snapshot = () => cached ?? (cached = {
|
|
61
|
+
type: "workbook",
|
|
62
|
+
formatVersion: 1,
|
|
63
|
+
workbook: snapshotWorkbook(book.save())
|
|
64
|
+
});
|
|
65
|
+
let lastKey = editKey(snapshot());
|
|
66
|
+
let replacing = false;
|
|
67
|
+
let editing = false;
|
|
68
|
+
const startEdit = univerAPI.addEvent(univerAPI.Event.SheetEditStarted, () => {
|
|
69
|
+
editing = true;
|
|
70
|
+
});
|
|
71
|
+
const endEdit = univerAPI.addEvent(univerAPI.Event.SheetEditEnded, () => {
|
|
72
|
+
editing = false;
|
|
73
|
+
});
|
|
74
|
+
const subscription = univerAPI.addEvent(univerAPI.Event.CommandExecuted, (event) => {
|
|
75
|
+
if (event.type !== CommandType.MUTATION) return;
|
|
76
|
+
cached = null;
|
|
77
|
+
if (replacing || event.id.startsWith("formula.")) return;
|
|
78
|
+
const nextKey = editKey(snapshot());
|
|
79
|
+
if (nextKey !== lastKey) {
|
|
80
|
+
lastKey = nextKey;
|
|
81
|
+
onChange();
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
return {
|
|
85
|
+
snapshot,
|
|
86
|
+
setEditable: (editable) => book.setEditable(editable),
|
|
87
|
+
setTheme: (theme) => univerAPI.toggleDarkMode(theme === "dark"),
|
|
88
|
+
isEditing: () => editing,
|
|
89
|
+
async finishEditing() {
|
|
90
|
+
await book.endEditingAsync(true);
|
|
91
|
+
await univerAPI.getFormula().onCalculationResultApplied(15e3);
|
|
92
|
+
cached = null;
|
|
93
|
+
},
|
|
94
|
+
async settleCalculation() {
|
|
95
|
+
await univerAPI.getFormula().onCalculationResultApplied(15e3);
|
|
96
|
+
cached = null;
|
|
97
|
+
},
|
|
98
|
+
replace(doc) {
|
|
99
|
+
replacing = true;
|
|
100
|
+
const previous = snapshot();
|
|
101
|
+
try {
|
|
102
|
+
univerAPI.disposeUnit(book.getId());
|
|
103
|
+
book = univerAPI.createWorkbook(doc.workbook);
|
|
104
|
+
cached = null;
|
|
105
|
+
lastKey = editKey(snapshot());
|
|
106
|
+
} catch (error) {
|
|
107
|
+
book = univerAPI.createWorkbook(previous.workbook);
|
|
108
|
+
cached = null;
|
|
109
|
+
lastKey = editKey(snapshot());
|
|
110
|
+
throw error;
|
|
111
|
+
} finally {
|
|
112
|
+
replacing = false;
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
dispose() {
|
|
116
|
+
subscription.dispose();
|
|
117
|
+
startEdit.dispose();
|
|
118
|
+
endEdit.dispose();
|
|
119
|
+
univer.dispose();
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
export {
|
|
124
|
+
createWorksheetEngine
|
|
125
|
+
};
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { format } from "numfmt";
|
|
3
|
+
function cellStyleData(doc, sheet, r, c) {
|
|
4
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
5
|
+
const resolve = (raw) => {
|
|
6
|
+
var _a2;
|
|
7
|
+
const value = typeof raw === "string" ? (_a2 = doc.workbook.styles) == null ? void 0 : _a2[raw] : raw;
|
|
8
|
+
return value && typeof value === "object" && !Array.isArray(value) ? value : {};
|
|
9
|
+
};
|
|
10
|
+
return {
|
|
11
|
+
...resolve(sheet.defaultStyle),
|
|
12
|
+
...resolve((_b = (_a = sheet.columnData) == null ? void 0 : _a[c]) == null ? void 0 : _b.s),
|
|
13
|
+
...resolve((_d = (_c = sheet.rowData) == null ? void 0 : _c[r]) == null ? void 0 : _d.s),
|
|
14
|
+
...resolve((_g = (_f = (_e = sheet.cellData) == null ? void 0 : _e[r]) == null ? void 0 : _f[c]) == null ? void 0 : _g.s)
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
function cellDisplay(cell, style = {}) {
|
|
18
|
+
var _a, _b, _c;
|
|
19
|
+
if (!cell) return { text: "" };
|
|
20
|
+
if (cell.f && (cell.v === void 0 || cell.v === null)) return { text: "待计算", note: `缺少已保存结果:${cell.f}` };
|
|
21
|
+
if ((_b = (_a = cell.p) == null ? void 0 : _a.body) == null ? void 0 : _b.dataStream) return { text: cell.p.body.dataStream.replace(/[\r\n]+$/, "") };
|
|
22
|
+
if (cell.v === void 0 || cell.v === null) return { text: "" };
|
|
23
|
+
if (cell.t === 4) return { text: String(cell.v), note: "公式或单元格错误" };
|
|
24
|
+
if (typeof cell.v === "boolean") return { text: cell.v ? "TRUE" : "FALSE" };
|
|
25
|
+
const pattern = (_c = style.n) == null ? void 0 : _c.pattern;
|
|
26
|
+
if (typeof pattern === "string" && pattern.length <= 1e3) {
|
|
27
|
+
try {
|
|
28
|
+
return { text: format(pattern, cell.v, { throws: true }) };
|
|
29
|
+
} catch {
|
|
30
|
+
return { text: String(cell.v), note: "此数字格式暂不支持,当前显示原始值" };
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return { text: String(cell.v) };
|
|
34
|
+
}
|
|
35
|
+
function safeColor(value) {
|
|
36
|
+
const rgb = value && typeof value === "object" ? value.rgb : void 0;
|
|
37
|
+
return typeof rgb === "string" && /^#[\da-f]{6}$/i.test(rgb) ? rgb : void 0;
|
|
38
|
+
}
|
|
39
|
+
const FILTER_RESOURCE = "SHEET_FILTER_PLUGIN";
|
|
40
|
+
function workbookFilters(doc) {
|
|
41
|
+
const resources = doc.workbook.resources;
|
|
42
|
+
if (!Array.isArray(resources)) return {};
|
|
43
|
+
const resource = resources.find((item) => (item == null ? void 0 : item.name) === FILTER_RESOURCE);
|
|
44
|
+
try {
|
|
45
|
+
const parsed = JSON.parse(typeof (resource == null ? void 0 : resource.data) === "string" ? resource.data : "{}");
|
|
46
|
+
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) return {};
|
|
47
|
+
const valid = {};
|
|
48
|
+
for (const id of doc.workbook.sheetOrder) {
|
|
49
|
+
const raw = parsed[id], sheet = doc.workbook.sheets[id], ref = raw == null ? void 0 : raw.ref;
|
|
50
|
+
if (!ref || ![ref.startRow, ref.endRow, ref.startColumn, ref.endColumn].every(Number.isInteger) || ref.startRow < 0 || ref.endRow < ref.startRow || ref.endRow >= sheet.rowCount || ref.startColumn < 0 || ref.endColumn < ref.startColumn || ref.endColumn >= sheet.columnCount) continue;
|
|
51
|
+
valid[id] = {
|
|
52
|
+
ref,
|
|
53
|
+
cachedFilteredOut: Array.isArray(raw.cachedFilteredOut) ? raw.cachedFilteredOut.filter((r) => typeof r === "number" && Number.isInteger(r) && r >= 0 && r < sheet.rowCount) : [],
|
|
54
|
+
filterColumns: Array.isArray(raw.filterColumns) ? raw.filterColumns : []
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
return valid;
|
|
58
|
+
} catch {
|
|
59
|
+
return {};
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
function dateSerial(value) {
|
|
63
|
+
const days = (value.getTime() - Date.UTC(1899, 11, 31)) / 864e5;
|
|
64
|
+
return days >= 60 ? days + 1 : days;
|
|
65
|
+
}
|
|
66
|
+
function columnName(index) {
|
|
67
|
+
let name = "", n = index + 1;
|
|
68
|
+
while (n > 0) {
|
|
69
|
+
name = String.fromCharCode(65 + (n - 1) % 26) + name;
|
|
70
|
+
n = Math.floor((n - 1) / 26);
|
|
71
|
+
}
|
|
72
|
+
return name;
|
|
73
|
+
}
|
|
74
|
+
function previewAxes(doc, sheet, showAll) {
|
|
75
|
+
const filter = workbookFilters(doc)[sheet.id];
|
|
76
|
+
const filtered = new Set(Array.isArray(filter == null ? void 0 : filter.cachedFilteredOut) ? filter.cachedFilteredOut : []);
|
|
77
|
+
const populated = Object.keys(sheet.cellData ?? {}).map(Number);
|
|
78
|
+
const used = Math.max(
|
|
79
|
+
20,
|
|
80
|
+
...populated.map((r) => r + 1),
|
|
81
|
+
...Object.keys(sheet.rowData ?? {}).map((r) => Number(r) + 1),
|
|
82
|
+
...(sheet.mergeData ?? []).map((m) => m.endRow + 1)
|
|
83
|
+
);
|
|
84
|
+
const rows = Array.from({ length: Math.min(sheet.rowCount, used) }, (_, r) => r).filter((r) => {
|
|
85
|
+
var _a, _b;
|
|
86
|
+
return showAll || ((_b = (_a = sheet.rowData) == null ? void 0 : _a[r]) == null ? void 0 : _b.hd) !== 1 && !filtered.has(r);
|
|
87
|
+
});
|
|
88
|
+
const columns = Array.from({ length: sheet.columnCount }, (_, c) => c).filter((c) => {
|
|
89
|
+
var _a, _b;
|
|
90
|
+
return showAll || ((_b = (_a = sheet.columnData) == null ? void 0 : _a[c]) == null ? void 0 : _b.hd) !== 1;
|
|
91
|
+
});
|
|
92
|
+
return {
|
|
93
|
+
rows,
|
|
94
|
+
columns,
|
|
95
|
+
filtered: filtered.size,
|
|
96
|
+
hasFilter: !!filter,
|
|
97
|
+
hasHidden: sheet.hidden === 1 || sheet.hidden === 2 || Object.values(sheet.rowData ?? {}).some((d) => d.hd === 1) || Object.values(sheet.columnData ?? {}).some((d) => d.hd === 1)
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
function previewMerges(sheet, rows, columns) {
|
|
101
|
+
const result = /* @__PURE__ */ new Map();
|
|
102
|
+
if (!rows.length || !columns.length) return result;
|
|
103
|
+
for (const merge of sheet.mergeData ?? []) {
|
|
104
|
+
if (merge.endRow < rows[0] || merge.startRow > rows[rows.length - 1] || merge.endColumn < columns[0] || merge.startColumn > columns[columns.length - 1]) continue;
|
|
105
|
+
const rr = rows.filter((r) => r >= merge.startRow && r <= merge.endRow);
|
|
106
|
+
const cc = columns.filter((c) => c >= merge.startColumn && c <= merge.endColumn);
|
|
107
|
+
for (const r of rr) for (const c of cc) {
|
|
108
|
+
result.set(`${r}:${c}`, {
|
|
109
|
+
sourceRow: merge.startRow,
|
|
110
|
+
sourceColumn: merge.startColumn,
|
|
111
|
+
rowspan: rr.length,
|
|
112
|
+
colspan: cc.length,
|
|
113
|
+
hidden: r !== rr[0] || c !== cc[0]
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
return result;
|
|
118
|
+
}
|
|
119
|
+
export {
|
|
120
|
+
FILTER_RESOURCE as F,
|
|
121
|
+
previewMerges as a,
|
|
122
|
+
cellStyleData as b,
|
|
123
|
+
columnName as c,
|
|
124
|
+
cellDisplay as d,
|
|
125
|
+
dateSerial as e,
|
|
126
|
+
previewAxes as p,
|
|
127
|
+
safeColor as s,
|
|
128
|
+
workbookFilters as w
|
|
129
|
+
};
|