wendang-react 0.0.0-stage → 0.5.5
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 +469 -2
- package/dist/bindings/yjs.js +5 -0
- package/dist/chunks/AnchoredPanel-D3nte06T.js +68 -0
- package/dist/chunks/MindMapCanvas-VWrxTy5Q.js +2070 -0
- package/dist/chunks/MindMapViewer-DqKu_Kuz.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 +153 -0
- package/dist/styles/video-dialog.css +41 -0
- package/dist/styles/video-embed.css +35 -0
- package/dist/styles.css +2614 -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
package/dist/index.js
ADDED
package/dist/mindmap.js
ADDED
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
3
|
+
import { Editor } from "@tiptap/core";
|
|
4
|
+
import StarterKit from "@tiptap/starter-kit";
|
|
5
|
+
import { forwardRef, useRef, useState, useEffect, useImperativeHandle } from "react";
|
|
6
|
+
import { createMindMap, readMindMap } from "wendang/mindmap";
|
|
7
|
+
import { T as TextStyle, H as Highlight, M as MindMap, a as MindMapTopic, b as MindMapDescription, c as MindMapNote, d as MindMapRelation } from "./chunks/nodes-iKqTGr_N.js";
|
|
8
|
+
import { c as createMindMapController } from "./chunks/mind-map-controller-B6SxK3GZ.js";
|
|
9
|
+
import { b as useContentHost, u as unavailableAttachment } from "./chunks/host-C-V688Rq.js";
|
|
10
|
+
import { u as useLatest, a as useReady } from "./chunks/hooks-C53Dp0pr.js";
|
|
11
|
+
import { MindMapCanvas } from "./chunks/MindMapCanvas-VWrxTy5Q.js";
|
|
12
|
+
const MindMapEditor = forwardRef(function MindMapEditor2(props, ref) {
|
|
13
|
+
var _a, _b, _c;
|
|
14
|
+
const latest = useLatest(props), host = useContentHost(), hostRef = useLatest(host), mount = useRef(null);
|
|
15
|
+
const [controller, setController] = useState(null), editor = useRef(null), [error, setError] = useState("");
|
|
16
|
+
const emitted = useRef(null), initial = useRef(props.value ?? props.defaultValue ?? createMindMap()), ready = useReady();
|
|
17
|
+
useEffect(() => {
|
|
18
|
+
var _a2, _b2;
|
|
19
|
+
if (!readMindMap(initial.current)) {
|
|
20
|
+
setError("思维导图格式无效");
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
const ed = new Editor({
|
|
24
|
+
element: mount.current,
|
|
25
|
+
editable: !latest.current.disabled,
|
|
26
|
+
extensions: [StarterKit.configure({ trailingNode: false }), TextStyle, Highlight, MindMap, MindMapTopic, MindMapDescription, MindMapNote, MindMapRelation],
|
|
27
|
+
content: { type: "doc", content: [latest.current.value ?? initial.current] },
|
|
28
|
+
onUpdate: ({ editor: editor2 }) => {
|
|
29
|
+
var _a3, _b3, _c2;
|
|
30
|
+
emitted.current = (_a3 = editor2.getJSON().content) == null ? void 0 : _a3[0];
|
|
31
|
+
initial.current = emitted.current;
|
|
32
|
+
(_c2 = (_b3 = latest.current).onChange) == null ? void 0 : _c2.call(_b3, emitted.current);
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
editor.current = ed;
|
|
36
|
+
const control = createMindMapController(ed, () => 0, {
|
|
37
|
+
get pageId() {
|
|
38
|
+
return latest.current.resourceId;
|
|
39
|
+
},
|
|
40
|
+
canComment: () => !!latest.current.canComment && !!hostRef.current.comments,
|
|
41
|
+
canExport: () => !!latest.current.allowExport,
|
|
42
|
+
status: () => latest.current.saveStatus ?? "",
|
|
43
|
+
fetchAttachment: (id) => {
|
|
44
|
+
var _a3;
|
|
45
|
+
return (((_a3 = hostRef.current.attachments) == null ? void 0 : _a3.fetch) ?? unavailableAttachment)(id);
|
|
46
|
+
},
|
|
47
|
+
get uploadImage() {
|
|
48
|
+
var _a3;
|
|
49
|
+
return (_a3 = hostRef.current.attachments) == null ? void 0 : _a3.uploadImage;
|
|
50
|
+
},
|
|
51
|
+
awareness: latest.current.collabAwareness,
|
|
52
|
+
viewState: latest.current.viewState
|
|
53
|
+
});
|
|
54
|
+
setController(control);
|
|
55
|
+
ready.markReady();
|
|
56
|
+
(_b2 = (_a2 = latest.current).onReady) == null ? void 0 : _b2.call(_a2);
|
|
57
|
+
return () => {
|
|
58
|
+
control.dispose();
|
|
59
|
+
ed.destroy();
|
|
60
|
+
editor.current = null;
|
|
61
|
+
};
|
|
62
|
+
}, [(_b = (_a = props.value) == null ? void 0 : _a.attrs) == null ? void 0 : _b.id, props.collabAwareness, props.viewState]);
|
|
63
|
+
useEffect(() => {
|
|
64
|
+
const ed = editor.current;
|
|
65
|
+
if (ed) {
|
|
66
|
+
ed.setEditable(!props.disabled, false);
|
|
67
|
+
ed.view.dispatch(ed.state.tr.setMeta("content-capabilities", true));
|
|
68
|
+
}
|
|
69
|
+
}, [props.disabled]);
|
|
70
|
+
useEffect(() => {
|
|
71
|
+
var _a2, _b2;
|
|
72
|
+
if (!props.value || props.value === emitted.current || !editor.current) return;
|
|
73
|
+
if (!readMindMap(props.value)) {
|
|
74
|
+
(_b2 = (_a2 = latest.current).onError) == null ? void 0 : _b2.call(_a2, new Error("思维导图格式无效"));
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
editor.current.commands.setContent({ type: "doc", content: [props.value] }, { emitUpdate: false });
|
|
78
|
+
}, [props.value]);
|
|
79
|
+
const snapshot = () => {
|
|
80
|
+
var _a2, _b2;
|
|
81
|
+
return ((_b2 = (_a2 = editor.current) == null ? void 0 : _a2.getJSON().content) == null ? void 0 : _b2[0]) ?? latest.current.value ?? initial.current;
|
|
82
|
+
};
|
|
83
|
+
useImperativeHandle(ref, () => ({
|
|
84
|
+
isReady: ready.isReady,
|
|
85
|
+
whenReady: ready.whenReady,
|
|
86
|
+
getSnapshot: snapshot,
|
|
87
|
+
async prepareSnapshot() {
|
|
88
|
+
if (!editor.current || !controller || controller.hasActiveText()) throw new Error("请先完成主题输入");
|
|
89
|
+
return snapshot();
|
|
90
|
+
},
|
|
91
|
+
undo: () => (controller == null ? void 0 : controller.undo()) ?? false,
|
|
92
|
+
redo: () => (controller == null ? void 0 : controller.redo()) ?? false,
|
|
93
|
+
focus: () => {
|
|
94
|
+
var _a2, _b2, _c2;
|
|
95
|
+
return (_c2 = (_b2 = (_a2 = mount.current) == null ? void 0 : _a2.parentElement) == null ? void 0 : _b2.querySelector('[aria-label="思维导图画布"]')) == null ? void 0 : _c2.focus();
|
|
96
|
+
}
|
|
97
|
+
}));
|
|
98
|
+
const model = readMindMap(props.value ?? initial.current);
|
|
99
|
+
return /* @__PURE__ */ jsxs("section", { "aria-label": "思维导图编辑器", className: "wr-mind-editor", children: [
|
|
100
|
+
/* @__PURE__ */ jsx("div", { ref: mount, hidden: true, "aria-hidden": "true" }),
|
|
101
|
+
error && /* @__PURE__ */ jsx("p", { role: "alert", children: error }),
|
|
102
|
+
controller && model && ((_c = controller.snapshot()) == null ? void 0 : _c.id) === model.id && /* @__PURE__ */ jsx(
|
|
103
|
+
MindMapCanvas,
|
|
104
|
+
{
|
|
105
|
+
inline: true,
|
|
106
|
+
model,
|
|
107
|
+
controller,
|
|
108
|
+
allowExport: props.allowExport,
|
|
109
|
+
showSaveHint: props.showSaveHint,
|
|
110
|
+
saveStatus: props.saveStatus,
|
|
111
|
+
pageId: props.resourceId,
|
|
112
|
+
canComment: props.canComment,
|
|
113
|
+
openComments: props.openComments,
|
|
114
|
+
onCommentsChanged: props.onCommentsChanged
|
|
115
|
+
},
|
|
116
|
+
model.id
|
|
117
|
+
)
|
|
118
|
+
] });
|
|
119
|
+
});
|
|
120
|
+
export {
|
|
121
|
+
MindMapEditor,
|
|
122
|
+
createMindMapController
|
|
123
|
+
};
|
package/dist/shared.js
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
export * from "wendang/shared";
|
|
3
|
+
import { M, c, e } from "./chunks/code-highlight-BmaqTe1m.js";
|
|
4
|
+
import { highlightCode } from "./chunks/code-highlight-engine-BFDzDPzy.js";
|
|
5
|
+
import { c as c2, m, p, r } from "./chunks/fuzzy-match-DYQR-4w2.js";
|
|
6
|
+
import { I, b, e as e2, i, r as r2, s } from "./chunks/composition-state-Bl-U1R_2.js";
|
|
7
|
+
import { A, a, b as b2, p as p2 } from "./chunks/popover-placement-D3xVYdkt.js";
|
|
8
|
+
import { m as m2, r as r3, s as s2 } from "./chunks/mind-map-input-CEWRz_t6.js";
|
|
9
|
+
import { p as p3 } from "./chunks/mind-map-delete-CVsxdXfs.js";
|
|
10
|
+
export * from "wendang/internal/code-block";
|
|
11
|
+
export * from "wendang/internal/inline-comments";
|
|
12
|
+
function createModalStack() {
|
|
13
|
+
const entries = [];
|
|
14
|
+
return {
|
|
15
|
+
push(entry) {
|
|
16
|
+
entries.push(entry);
|
|
17
|
+
},
|
|
18
|
+
remove(entry) {
|
|
19
|
+
const index = entries.indexOf(entry);
|
|
20
|
+
if (index >= 0) entries.splice(index, 1);
|
|
21
|
+
},
|
|
22
|
+
top: () => entries.at(-1),
|
|
23
|
+
get size() {
|
|
24
|
+
return entries.length;
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
export {
|
|
29
|
+
A as ANCHORED_POPOVER_ARROW_INSET,
|
|
30
|
+
a as ANCHORED_POPOVER_GAP,
|
|
31
|
+
b2 as ANCHORED_POPOVER_VIEW_MARGIN,
|
|
32
|
+
I as IME_SETTLE_DELAY_MS,
|
|
33
|
+
M as MAX_HIGHLIGHT_LENGTH,
|
|
34
|
+
b as beginComposition,
|
|
35
|
+
c2 as clearPinyinCache,
|
|
36
|
+
c as codeTokens,
|
|
37
|
+
createModalStack,
|
|
38
|
+
e2 as endComposition,
|
|
39
|
+
e as ensureCodeHighlight,
|
|
40
|
+
highlightCode,
|
|
41
|
+
i as isComposingNow,
|
|
42
|
+
m as matchTitle,
|
|
43
|
+
m2 as mindCanvasShortcut,
|
|
44
|
+
p as pinyinIndex,
|
|
45
|
+
p2 as placeAnchoredPopover,
|
|
46
|
+
p3 as planMindTopicDeletion,
|
|
47
|
+
r as rankPages,
|
|
48
|
+
r2 as resetCompositionState,
|
|
49
|
+
r3 as resetMindZoom,
|
|
50
|
+
s2 as selectMindTopic,
|
|
51
|
+
s as shouldIgnoreForIme
|
|
52
|
+
};
|
|
@@ -0,0 +1,299 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import ExcelJS from "exceljs";
|
|
3
|
+
import JSZip from "jszip";
|
|
4
|
+
import { w as workbookFilters, b as cellStyleData, c as columnName, e as dateSerial, F as FILTER_RESOURCE } from "../chunks/worksheet-preview-DsDVWxIM.js";
|
|
5
|
+
import { validateWorkbook, workbookCellText, WORKBOOK_LIMITS, emptyWorkbook } from "wendang/internal/workbook";
|
|
6
|
+
const MAX_FILE_BYTES = 5 * 1024 * 1024;
|
|
7
|
+
function checkArchive(buffer) {
|
|
8
|
+
const view = new DataView(buffer);
|
|
9
|
+
let end = -1;
|
|
10
|
+
for (let i = view.byteLength - 22; i >= Math.max(0, view.byteLength - 65557); i--) {
|
|
11
|
+
if (view.getUint32(i, true) === 101010256) {
|
|
12
|
+
end = i;
|
|
13
|
+
break;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
if (end < 0) throw new Error("文件不是有效的 XLSX 工作簿");
|
|
17
|
+
const count = view.getUint16(end + 10, true);
|
|
18
|
+
let cursor = view.getUint32(end + 16, true), expanded = 0;
|
|
19
|
+
if (count > 2e3 || count === 65535 || cursor === 4294967295) throw new Error("XLSX 压缩包结构超出范围");
|
|
20
|
+
for (let i = 0; i < count; i++) {
|
|
21
|
+
if (cursor + 46 > end || view.getUint32(cursor, true) !== 33639248) throw new Error("XLSX 压缩包目录损坏");
|
|
22
|
+
const size = view.getUint32(cursor + 24, true);
|
|
23
|
+
expanded += size;
|
|
24
|
+
if (view.getUint16(cursor + 8, true) & 1 || size === 4294967295 || expanded > 20 * 1024 * 1024) {
|
|
25
|
+
throw new Error("XLSX 不支持加密或展开超过 20MB 的文件");
|
|
26
|
+
}
|
|
27
|
+
cursor += 46 + view.getUint16(cursor + 28, true) + view.getUint16(cursor + 30, true) + view.getUint16(cursor + 32, true);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
function color(value) {
|
|
31
|
+
if ((value == null ? void 0 : value.argb) && /^[\da-f]{8}$/i.test(value.argb)) return `#${value.argb.slice(2)}`;
|
|
32
|
+
return void 0;
|
|
33
|
+
}
|
|
34
|
+
const BORDER_STYLES = [
|
|
35
|
+
"",
|
|
36
|
+
"thin",
|
|
37
|
+
"hair",
|
|
38
|
+
"dotted",
|
|
39
|
+
"dashed",
|
|
40
|
+
"dashDot",
|
|
41
|
+
"dashDotDot",
|
|
42
|
+
"double",
|
|
43
|
+
"medium",
|
|
44
|
+
"mediumDashed",
|
|
45
|
+
"mediumDashDot",
|
|
46
|
+
"mediumDashDotDot",
|
|
47
|
+
"slantDashDot",
|
|
48
|
+
"thick"
|
|
49
|
+
];
|
|
50
|
+
function styleFromExcel(cell) {
|
|
51
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
|
|
52
|
+
const s = {};
|
|
53
|
+
if ((_a = cell.font) == null ? void 0 : _a.bold) s.bl = 1;
|
|
54
|
+
if ((_b = cell.font) == null ? void 0 : _b.italic) s.it = 1;
|
|
55
|
+
if ((_c = cell.font) == null ? void 0 : _c.size) s.fs = cell.font.size;
|
|
56
|
+
if ((_d = cell.font) == null ? void 0 : _d.name) s.ff = cell.font.name;
|
|
57
|
+
if ((_e = cell.font) == null ? void 0 : _e.underline) s.ul = { s: 1, t: String(cell.font.underline).startsWith("double") ? 1 : 0 };
|
|
58
|
+
if ((_f = cell.font) == null ? void 0 : _f.strike) s.st = { s: 1 };
|
|
59
|
+
const foreground = color((_g = cell.font) == null ? void 0 : _g.color);
|
|
60
|
+
if (foreground) s.cl = { rgb: foreground };
|
|
61
|
+
if (((_h = cell.fill) == null ? void 0 : _h.type) === "pattern") {
|
|
62
|
+
const background = color(cell.fill.fgColor);
|
|
63
|
+
if (background) s.bg = { rgb: background };
|
|
64
|
+
}
|
|
65
|
+
if (cell.numFmt && cell.numFmt !== "General") s.n = { pattern: cell.numFmt };
|
|
66
|
+
if ((_i = cell.alignment) == null ? void 0 : _i.horizontal) s.ht = { left: 1, center: 2, right: 3 }[cell.alignment.horizontal] ?? 1;
|
|
67
|
+
if ((_j = cell.alignment) == null ? void 0 : _j.wrapText) s.tb = 3;
|
|
68
|
+
if ((_k = cell.alignment) == null ? void 0 : _k.vertical) s.vt = { top: 1, middle: 2, bottom: 3 }[cell.alignment.vertical] ?? 1;
|
|
69
|
+
const borders = {};
|
|
70
|
+
for (const [excel, key] of [["top", "t"], ["bottom", "b"], ["left", "l"], ["right", "r"]]) {
|
|
71
|
+
const border = (_l = cell.border) == null ? void 0 : _l[excel];
|
|
72
|
+
const index = BORDER_STYLES.indexOf(border == null ? void 0 : border.style);
|
|
73
|
+
if (index > 0) borders[key] = { s: index, cl: { rgb: color(border == null ? void 0 : border.color) ?? "#000000" } };
|
|
74
|
+
}
|
|
75
|
+
if (Object.keys(borders).length) s.bd = borders;
|
|
76
|
+
return s;
|
|
77
|
+
}
|
|
78
|
+
function colNumber(letters) {
|
|
79
|
+
return Array.from(letters.toUpperCase()).reduce((n, c) => n * 26 + c.charCodeAt(0) - 64, 0) - 1;
|
|
80
|
+
}
|
|
81
|
+
async function importXlsx(file) {
|
|
82
|
+
var _a;
|
|
83
|
+
if (file.size > MAX_FILE_BYTES) throw new Error("XLSX 文件不能超过 5MB");
|
|
84
|
+
const buffer = await file.arrayBuffer();
|
|
85
|
+
checkArchive(buffer);
|
|
86
|
+
const archive = await JSZip.loadAsync(buffer);
|
|
87
|
+
const warnings = /* @__PURE__ */ new Set();
|
|
88
|
+
const paths = Object.keys(archive.files);
|
|
89
|
+
if (paths.some((name) => /vbaProject\.bin$/i.test(name))) throw new Error("不支持包含宏的文件,请先另存为不含宏的 XLSX");
|
|
90
|
+
if (paths.some((name) => /^xl\/(charts|media|drawings)\//.test(name))) warnings.add("图表、图片和绘图对象未转换。");
|
|
91
|
+
if (paths.some((name) => /^xl\/pivot/.test(name))) warnings.add("透视表与缓存未转换。");
|
|
92
|
+
if (paths.some((name) => /^xl\/externalLinks\//.test(name))) warnings.add("外部链接未转换,相关公式需在导入后核对。");
|
|
93
|
+
if (paths.some((name) => /^xl\/comments/.test(name))) warnings.add("Excel 批注未转换为工作表讨论。");
|
|
94
|
+
for (const name of paths.filter((name2) => /^xl\/(worksheets\/sheet\d+|workbook)\.xml$/.test(name2))) {
|
|
95
|
+
const xml = await archive.file(name).async("string");
|
|
96
|
+
if (/<(?:\w+:)?conditionalFormatting[\s>]/.test(xml)) warnings.add("条件格式规则未转换。");
|
|
97
|
+
if (/<(?:\w+:)?dataValidation[\s>]/.test(xml)) warnings.add("下拉选项和数据校验规则未转换。");
|
|
98
|
+
if (/<(?:\w+:)?filterColumn[\s>]/.test(xml)) warnings.add("筛选范围已保留;筛选条件未转换,隐藏行按文件当前状态保留。");
|
|
99
|
+
if (/<(?:\w+:)?definedName[\s>]/.test(xml)) warnings.add("命名区域未转换,使用名称引用的公式请核对。");
|
|
100
|
+
if (/<(?:\w+:)?hyperlink[\s>]/.test(xml)) warnings.add("超链接保留显示文字,链接目标未转换。");
|
|
101
|
+
if (/<(?:\w+:)?sheetProtection[\s>]/.test(xml)) warnings.add("Excel 工作表保护未转换;导入后以本系统页面权限为准。");
|
|
102
|
+
if (/<(?:\w+:)?pageSetup[\s>]/.test(xml)) warnings.add("打印设置未转换。");
|
|
103
|
+
}
|
|
104
|
+
const book = new ExcelJS.Workbook();
|
|
105
|
+
await book.xlsx.load(buffer);
|
|
106
|
+
if (!book.worksheets.length || book.worksheets.length > WORKBOOK_LIMITS.sheets) throw new Error("工作表页数应为 1–20");
|
|
107
|
+
const doc = emptyWorkbook(crypto.randomUUID());
|
|
108
|
+
doc.workbook.sheetOrder = [];
|
|
109
|
+
doc.workbook.sheets = {};
|
|
110
|
+
const filters = {};
|
|
111
|
+
const inspection = { sheets: [], warnings: [] };
|
|
112
|
+
let actualCells = 0;
|
|
113
|
+
if (book.properties.date1904) warnings.add("1904 日期系统已按实际日期转换为 1900 系统;公式中的日期序号常量请核对。");
|
|
114
|
+
for (const ws of book.worksheets) {
|
|
115
|
+
if (ws.rowCount > WORKBOOK_LIMITS.rows || ws.columnCount > WORKBOOK_LIMITS.columns) throw new Error("文件行列超出范围(10000 行、200 列)");
|
|
116
|
+
const id = `sheet-${ws.id}`;
|
|
117
|
+
const sheet = {
|
|
118
|
+
id,
|
|
119
|
+
name: ws.name,
|
|
120
|
+
rowCount: Math.max(100, ws.rowCount + 20),
|
|
121
|
+
columnCount: Math.max(26, ws.columnCount),
|
|
122
|
+
cellData: {},
|
|
123
|
+
rowData: {},
|
|
124
|
+
columnData: {},
|
|
125
|
+
mergeData: [],
|
|
126
|
+
hidden: ws.state === "veryHidden" ? 2 : ws.state === "hidden" ? 1 : 0,
|
|
127
|
+
freeze: { xSplit: 0, ySplit: 0, startRow: -1, startColumn: -1 }
|
|
128
|
+
};
|
|
129
|
+
sheet.rowCount = Math.min(WORKBOOK_LIMITS.rows, sheet.rowCount);
|
|
130
|
+
ws.columns.forEach((column, c) => {
|
|
131
|
+
const style = styleFromExcel(column.style ?? {});
|
|
132
|
+
if (column.width || column.hidden || Object.keys(style).length) sheet.columnData[c] = {
|
|
133
|
+
...column.width ? { w: Math.round(column.width * 7 + 5) } : {},
|
|
134
|
+
...column.hidden ? { hd: 1 } : {},
|
|
135
|
+
...Object.keys(style).length ? { s: style } : {}
|
|
136
|
+
};
|
|
137
|
+
});
|
|
138
|
+
const frozen = (_a = ws.views) == null ? void 0 : _a.find((view) => view.state === "frozen");
|
|
139
|
+
if ((frozen == null ? void 0 : frozen.state) === "frozen") sheet.freeze = {
|
|
140
|
+
xSplit: frozen.xSplit ?? 0,
|
|
141
|
+
ySplit: frozen.ySplit ?? 0,
|
|
142
|
+
startColumn: frozen.xSplit || -1,
|
|
143
|
+
startRow: frozen.ySplit || -1
|
|
144
|
+
};
|
|
145
|
+
let count = 0;
|
|
146
|
+
ws.eachRow({ includeEmpty: true }, (row, r) => {
|
|
147
|
+
const style = styleFromExcel(row);
|
|
148
|
+
if (row.height || row.hidden || Object.keys(style).length) sheet.rowData[r - 1] = {
|
|
149
|
+
...row.height ? { h: row.height * 96 / 72 } : {},
|
|
150
|
+
...row.hidden ? { hd: 1 } : {},
|
|
151
|
+
...Object.keys(style).length ? { s: style } : {}
|
|
152
|
+
};
|
|
153
|
+
row.eachCell({ includeEmpty: true }, (cell, c) => {
|
|
154
|
+
var _a2, _b, _c, _d;
|
|
155
|
+
if (cell.isMerged && cell.master.address !== cell.address) return;
|
|
156
|
+
const value = cell.value;
|
|
157
|
+
const data = {};
|
|
158
|
+
if (cell.formula) {
|
|
159
|
+
if (typeof value === "object" && value && "shareType" in value && value.shareType === "array") {
|
|
160
|
+
throw new Error("暂不支持数组公式文件,请先在 Excel 中转换后导入");
|
|
161
|
+
}
|
|
162
|
+
data.f = `=${cell.formula}`;
|
|
163
|
+
const result = cell.result;
|
|
164
|
+
if (result instanceof Date) {
|
|
165
|
+
data.v = dateSerial(result);
|
|
166
|
+
data.t = 2;
|
|
167
|
+
} else if (typeof result === "string" || typeof result === "number" || typeof result === "boolean") data.v = result;
|
|
168
|
+
else if (result && typeof result === "object" && "error" in result) {
|
|
169
|
+
data.v = String(result.error);
|
|
170
|
+
data.t = 4;
|
|
171
|
+
}
|
|
172
|
+
if (data.v === void 0) warnings.add("部分公式没有缓存结果,需在编辑器计算后保存;只读显示为待计算。");
|
|
173
|
+
if (/\[.+\]|_xlfn\.|_xlws\./i.test(cell.formula)) warnings.add("存在外部引用或扩展函数,公式兼容性需核对。");
|
|
174
|
+
} else if (value instanceof Date) {
|
|
175
|
+
data.v = dateSerial(value);
|
|
176
|
+
data.t = 2;
|
|
177
|
+
} else if (typeof value === "string" || typeof value === "number" || typeof value === "boolean") {
|
|
178
|
+
data.v = value;
|
|
179
|
+
data.t = typeof value === "number" ? 2 : typeof value === "boolean" ? 3 : 1;
|
|
180
|
+
} else if (value && typeof value === "object" && "richText" in value) {
|
|
181
|
+
data.v = value.richText.map((part) => part.text).join("");
|
|
182
|
+
data.t = 1;
|
|
183
|
+
warnings.add("单元格内富文本保留文字,分段字体样式未转换。");
|
|
184
|
+
} else if (value && typeof value === "object" && "text" in value) {
|
|
185
|
+
data.v = String(value.text);
|
|
186
|
+
data.t = 1;
|
|
187
|
+
} else if (value && typeof value === "object" && "error" in value) {
|
|
188
|
+
data.v = value.error;
|
|
189
|
+
data.t = 4;
|
|
190
|
+
}
|
|
191
|
+
if ([
|
|
192
|
+
(_a2 = cell.font) == null ? void 0 : _a2.color,
|
|
193
|
+
((_b = cell.fill) == null ? void 0 : _b.type) === "pattern" ? cell.fill.fgColor : void 0,
|
|
194
|
+
...Object.values(cell.border ?? {}).map((b) => b == null ? void 0 : b.color)
|
|
195
|
+
].some((c2) => c2 && (c2.theme !== void 0 || "indexed" in c2))) {
|
|
196
|
+
warnings.add("部分主题色或索引色未转换;基础 RGB 颜色可保留。");
|
|
197
|
+
}
|
|
198
|
+
const style2 = styleFromExcel(cell);
|
|
199
|
+
if (Object.keys(style2).length) data.s = style2;
|
|
200
|
+
if (Object.keys(data).length) {
|
|
201
|
+
if (++actualCells > WORKBOOK_LIMITS.cells) throw new Error("工作簿实际单元格超过 50000 个");
|
|
202
|
+
((_c = sheet.cellData)[_d = r - 1] ?? (_c[_d] = {}))[c - 1] = data;
|
|
203
|
+
count++;
|
|
204
|
+
}
|
|
205
|
+
});
|
|
206
|
+
});
|
|
207
|
+
for (const address of ws.model.merges ?? []) {
|
|
208
|
+
const match = /^([A-Z]+)(\d+):([A-Z]+)(\d+)$/i.exec(address);
|
|
209
|
+
if (match) sheet.mergeData.push({ startRow: +match[2] - 1, endRow: +match[4] - 1, startColumn: colNumber(match[1]), endColumn: colNumber(match[3]) });
|
|
210
|
+
}
|
|
211
|
+
const autoFilter = ws.autoFilter;
|
|
212
|
+
if (autoFilter) {
|
|
213
|
+
const ref = typeof autoFilter === "string" ? autoFilter : `${typeof autoFilter.from === "string" ? autoFilter.from : `${columnName(autoFilter.from.column - 1)}${autoFilter.from.row}`}:${typeof autoFilter.to === "string" ? autoFilter.to : `${columnName(autoFilter.to.column - 1)}${autoFilter.to.row}`}`;
|
|
214
|
+
const match = /^\$?([A-Z]+)\$?(\d+):\$?([A-Z]+)\$?(\d+)$/i.exec(ref);
|
|
215
|
+
if (match) filters[id] = { ref: { startRow: +match[2] - 1, endRow: +match[4] - 1, startColumn: colNumber(match[1]), endColumn: colNumber(match[3]) } };
|
|
216
|
+
}
|
|
217
|
+
doc.workbook.sheetOrder.push(id);
|
|
218
|
+
doc.workbook.sheets[id] = sheet;
|
|
219
|
+
inspection.sheets.push({ name: ws.name, rows: ws.rowCount, columns: ws.columnCount, cells: count, hidden: sheet.hidden !== 0 });
|
|
220
|
+
}
|
|
221
|
+
doc.workbook.resources = [{ name: FILTER_RESOURCE, data: JSON.stringify(filters) }];
|
|
222
|
+
warnings.add("请保留原文件;仅对本次检查列明的基础格式与数据范围进行转换。");
|
|
223
|
+
inspection.warnings = [...warnings];
|
|
224
|
+
return { doc: validateWorkbook(doc), warnings: inspection.warnings, inspection };
|
|
225
|
+
}
|
|
226
|
+
function rgb(value) {
|
|
227
|
+
const color2 = value && typeof value === "object" ? value.rgb : void 0;
|
|
228
|
+
return typeof color2 === "string" && /^#[\da-f]{6}$/i.test(color2) ? `FF${color2.slice(1)}` : void 0;
|
|
229
|
+
}
|
|
230
|
+
async function exportXlsx(raw) {
|
|
231
|
+
var _a, _b, _c;
|
|
232
|
+
const doc = validateWorkbook(raw), book = new ExcelJS.Workbook();
|
|
233
|
+
book.calcProperties.fullCalcOnLoad = true;
|
|
234
|
+
const filters = workbookFilters(doc);
|
|
235
|
+
for (const id of doc.workbook.sheetOrder) {
|
|
236
|
+
const sheet = doc.workbook.sheets[id], ws = book.addWorksheet(sheet.name, {
|
|
237
|
+
state: sheet.hidden === 2 ? "veryHidden" : sheet.hidden === 1 ? "hidden" : "visible"
|
|
238
|
+
});
|
|
239
|
+
for (const [r, row] of Object.entries(sheet.cellData ?? {})) {
|
|
240
|
+
for (const [c, data] of Object.entries(row)) {
|
|
241
|
+
if (!data) continue;
|
|
242
|
+
const cell = ws.getCell(+r + 1, +c + 1);
|
|
243
|
+
const value = data.t === 4 ? { error: data.v } : data.v;
|
|
244
|
+
cell.value = data.f ? { formula: data.f.replace(/^=/, ""), result: value ?? void 0 } : value ?? workbookCellText(data);
|
|
245
|
+
const style = cellStyleData(doc, sheet, +r, +c);
|
|
246
|
+
if (style && typeof style === "object") {
|
|
247
|
+
cell.font = {
|
|
248
|
+
bold: style.bl === 1,
|
|
249
|
+
italic: style.it === 1,
|
|
250
|
+
...typeof style.fs === "number" ? { size: style.fs } : {},
|
|
251
|
+
...typeof style.ff === "string" ? { name: style.ff } : {},
|
|
252
|
+
...rgb(style.cl) ? { color: { argb: rgb(style.cl) } } : {},
|
|
253
|
+
...((_a = style.ul) == null ? void 0 : _a.s) === 1 ? { underline: true } : {},
|
|
254
|
+
...((_b = style.st) == null ? void 0 : _b.s) === 1 ? { strike: true } : {}
|
|
255
|
+
};
|
|
256
|
+
if (rgb(style.bg)) cell.fill = { type: "pattern", pattern: "solid", fgColor: { argb: rgb(style.bg) } };
|
|
257
|
+
const numFmt = style.n;
|
|
258
|
+
if (typeof (numFmt == null ? void 0 : numFmt.pattern) === "string") cell.numFmt = numFmt.pattern;
|
|
259
|
+
cell.alignment = {
|
|
260
|
+
horizontal: style.ht === 2 ? "center" : style.ht === 3 ? "right" : "left",
|
|
261
|
+
vertical: style.vt === 2 ? "middle" : style.vt === 3 ? "bottom" : "top",
|
|
262
|
+
wrapText: style.tb === 3
|
|
263
|
+
};
|
|
264
|
+
const borders = style.bd;
|
|
265
|
+
for (const [excel, key] of [["top", "t"], ["bottom", "b"], ["left", "l"], ["right", "r"]]) {
|
|
266
|
+
const border = borders == null ? void 0 : borders[key], borderStyle = (border == null ? void 0 : border.s) && BORDER_STYLES[border.s];
|
|
267
|
+
if (borderStyle) cell.border = { ...cell.border, [excel]: {
|
|
268
|
+
style: borderStyle,
|
|
269
|
+
color: { argb: rgb(border.cl) ?? "FF000000" }
|
|
270
|
+
} };
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
for (const [r, data] of Object.entries(sheet.rowData ?? {})) {
|
|
276
|
+
if (typeof data.h === "number") ws.getRow(+r + 1).height = data.h * 72 / 96;
|
|
277
|
+
if (data.hd === 1) {
|
|
278
|
+
const row = ws.getRow(+r + 1);
|
|
279
|
+
row.hidden = true;
|
|
280
|
+
row.height ?? (row.height = 18);
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
for (const r of ((_c = filters[id]) == null ? void 0 : _c.cachedFilteredOut) ?? []) if (Number.isInteger(r) && r >= 0 && r < sheet.rowCount) ws.getRow(r + 1).hidden = true;
|
|
284
|
+
for (const [c, data] of Object.entries(sheet.columnData ?? {})) {
|
|
285
|
+
if (typeof data.w === "number") ws.getColumn(+c + 1).width = Math.max(1, (data.w - 5) / 7);
|
|
286
|
+
if (data.hd === 1) ws.getColumn(+c + 1).hidden = true;
|
|
287
|
+
}
|
|
288
|
+
const freeze = sheet.freeze;
|
|
289
|
+
if (freeze && (freeze.xSplit || freeze.ySplit)) ws.views = [{ state: "frozen", xSplit: freeze.xSplit ?? 0, ySplit: freeze.ySplit ?? 0 }];
|
|
290
|
+
const filter = filters[id];
|
|
291
|
+
if (filter == null ? void 0 : filter.ref) ws.autoFilter = `${columnName(filter.ref.startColumn)}${filter.ref.startRow + 1}:${columnName(filter.ref.endColumn)}${filter.ref.endRow + 1}`;
|
|
292
|
+
for (const range of sheet.mergeData ?? []) ws.mergeCells(range.startRow + 1, range.startColumn + 1, range.endRow + 1, range.endColumn + 1);
|
|
293
|
+
}
|
|
294
|
+
return new Uint8Array(await book.xlsx.writeBuffer());
|
|
295
|
+
}
|
|
296
|
+
export {
|
|
297
|
+
exportXlsx,
|
|
298
|
+
importXlsx
|
|
299
|
+
};
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
3
|
+
import { forwardRef, useRef, useState, useEffect, useImperativeHandle } from "react";
|
|
4
|
+
import { emptyWorkbook, validateWorkbook } from "wendang/spreadsheet";
|
|
5
|
+
import { a as useContentContext } from "./chunks/host-C-V688Rq.js";
|
|
6
|
+
import { u as useLatest, a as useReady, b as asError } from "./chunks/hooks-C53Dp0pr.js";
|
|
7
|
+
const SpreadsheetEditor = forwardRef(function SpreadsheetEditor2(props, ref) {
|
|
8
|
+
const root = useRef(null), engine = useRef(null);
|
|
9
|
+
const latest = useLatest(props), initial = useRef(props.value ?? props.defaultValue ?? emptyWorkbook("react-workbook"));
|
|
10
|
+
const emitted = useRef(null), [error, setError] = useState(""), [loading, setLoading] = useState(true);
|
|
11
|
+
const ready = useReady(), theme = useContentContext().theme;
|
|
12
|
+
const currentTheme = useLatest(props.theme ?? theme);
|
|
13
|
+
const fail = (error2) => {
|
|
14
|
+
var _a, _b;
|
|
15
|
+
setError(asError(error2).message);
|
|
16
|
+
(_b = (_a = latest.current).onError) == null ? void 0 : _b.call(_a, asError(error2));
|
|
17
|
+
};
|
|
18
|
+
useEffect(() => {
|
|
19
|
+
const host = root.current;
|
|
20
|
+
if (!host) return;
|
|
21
|
+
let disposed = false, instance = null;
|
|
22
|
+
const container = document.createElement("div");
|
|
23
|
+
container.style.cssText = "height:100%;min-height:0";
|
|
24
|
+
host.append(container);
|
|
25
|
+
void import("./chunks/worksheet-engine-TJ54m0KC.js").then((module) => {
|
|
26
|
+
var _a, _b;
|
|
27
|
+
if (disposed) return;
|
|
28
|
+
instance = module.createWorksheetEngine(container, validateWorkbook(latest.current.value ?? initial.current), () => {
|
|
29
|
+
var _a2, _b2;
|
|
30
|
+
if (!disposed && instance && !latest.current.disabled) {
|
|
31
|
+
try {
|
|
32
|
+
emitted.current = instance.snapshot();
|
|
33
|
+
(_b2 = (_a2 = latest.current).onChange) == null ? void 0 : _b2.call(_a2, emitted.current);
|
|
34
|
+
} catch (error2) {
|
|
35
|
+
fail(error2);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}, { theme: currentTheme.current });
|
|
39
|
+
engine.current = instance;
|
|
40
|
+
instance.setEditable(!latest.current.disabled);
|
|
41
|
+
ready.markReady();
|
|
42
|
+
setLoading(false);
|
|
43
|
+
(_b = (_a = latest.current).onReady) == null ? void 0 : _b.call(_a);
|
|
44
|
+
}).catch((error2) => {
|
|
45
|
+
if (!disposed) {
|
|
46
|
+
fail(error2);
|
|
47
|
+
setLoading(false);
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
return () => {
|
|
51
|
+
disposed = true;
|
|
52
|
+
engine.current = null;
|
|
53
|
+
queueMicrotask(() => {
|
|
54
|
+
instance == null ? void 0 : instance.dispose();
|
|
55
|
+
container.remove();
|
|
56
|
+
});
|
|
57
|
+
};
|
|
58
|
+
}, []);
|
|
59
|
+
useEffect(() => {
|
|
60
|
+
if (props.value && engine.current && props.value !== emitted.current) try {
|
|
61
|
+
engine.current.replace(validateWorkbook(props.value));
|
|
62
|
+
engine.current.setEditable(!latest.current.disabled);
|
|
63
|
+
} catch (error2) {
|
|
64
|
+
fail(error2);
|
|
65
|
+
}
|
|
66
|
+
}, [props.value]);
|
|
67
|
+
useEffect(() => {
|
|
68
|
+
var _a;
|
|
69
|
+
(_a = engine.current) == null ? void 0 : _a.setEditable(!props.disabled);
|
|
70
|
+
}, [props.disabled]);
|
|
71
|
+
useEffect(() => {
|
|
72
|
+
var _a;
|
|
73
|
+
(_a = engine.current) == null ? void 0 : _a.setTheme(props.theme ?? theme);
|
|
74
|
+
}, [props.theme, theme]);
|
|
75
|
+
const snapshot = () => {
|
|
76
|
+
var _a;
|
|
77
|
+
return ((_a = engine.current) == null ? void 0 : _a.snapshot()) ?? latest.current.value ?? initial.current;
|
|
78
|
+
};
|
|
79
|
+
useImperativeHandle(ref, () => ({
|
|
80
|
+
isReady: ready.isReady,
|
|
81
|
+
whenReady: ready.whenReady,
|
|
82
|
+
getSnapshot: snapshot,
|
|
83
|
+
snapshot,
|
|
84
|
+
async prepareSnapshot() {
|
|
85
|
+
if (!engine.current) throw new Error("工作表尚未就绪");
|
|
86
|
+
await engine.current.finishEditing();
|
|
87
|
+
return validateWorkbook(engine.current.snapshot());
|
|
88
|
+
},
|
|
89
|
+
isEditing: () => {
|
|
90
|
+
var _a;
|
|
91
|
+
return ((_a = engine.current) == null ? void 0 : _a.isEditing()) ?? false;
|
|
92
|
+
},
|
|
93
|
+
finishEditing: async () => {
|
|
94
|
+
var _a;
|
|
95
|
+
await ((_a = engine.current) == null ? void 0 : _a.finishEditing());
|
|
96
|
+
},
|
|
97
|
+
settleCalculation: async () => {
|
|
98
|
+
var _a;
|
|
99
|
+
await ((_a = engine.current) == null ? void 0 : _a.settleCalculation());
|
|
100
|
+
},
|
|
101
|
+
replace(value) {
|
|
102
|
+
if (!engine.current) throw new Error("工作表尚未就绪");
|
|
103
|
+
engine.current.replace(validateWorkbook(value));
|
|
104
|
+
engine.current.setEditable(!latest.current.disabled);
|
|
105
|
+
},
|
|
106
|
+
dispose() {
|
|
107
|
+
var _a;
|
|
108
|
+
(_a = engine.current) == null ? void 0 : _a.dispose();
|
|
109
|
+
engine.current = null;
|
|
110
|
+
}
|
|
111
|
+
}));
|
|
112
|
+
return /* @__PURE__ */ jsxs("section", { className: "wendang-spreadsheet", "aria-label": "工作表编辑器", children: [
|
|
113
|
+
loading && /* @__PURE__ */ jsx("p", { role: "status", children: "正在加载工作表…" }),
|
|
114
|
+
error && /* @__PURE__ */ jsx("p", { role: "alert", children: error }),
|
|
115
|
+
/* @__PURE__ */ jsx("div", { ref: root, className: "worksheet-grid" })
|
|
116
|
+
] });
|
|
117
|
+
});
|
|
118
|
+
export {
|
|
119
|
+
SpreadsheetEditor
|
|
120
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/* Tokens are document presentation; saved attributes never contain free CSS values. */
|
|
2
|
+
[data-wendang-theme] {
|
|
3
|
+
--callout-border-gray:#c7cbd1;--callout-border-red:#f0a2a2;--callout-border-orange:#ffc078;--callout-border-yellow:#e3ca71;
|
|
4
|
+
--callout-border-green:#91d4a0;--callout-border-blue:#9ac5ef;--callout-border-purple:#c0a4ed;
|
|
5
|
+
}
|
|
6
|
+
[data-wendang-theme='dark'] {
|
|
7
|
+
--callout-border-gray:#697181;--callout-border-red:#a7606b;--callout-border-orange:#a97843;--callout-border-yellow:#97844a;
|
|
8
|
+
--callout-border-green:#5c8b6c;--callout-border-blue:#587fa9;--callout-border-purple:#8667af;
|
|
9
|
+
}
|
|
10
|
+
.ywiki-content .doc-callout {
|
|
11
|
+
--callout-first-line-height:calc(var(--content-font-size) * var(--content-line-height));
|
|
12
|
+
position:relative;display:grid;grid-template-columns:30px minmax(0,1fr);column-gap:12px;align-items:start;
|
|
13
|
+
border:1px solid var(--callout-border,var(--callout-border-blue));border-radius:9px;
|
|
14
|
+
background:var(--callout-fill,var(--doc-highlight-blue));color:var(--callout-text,var(--content-text-color));
|
|
15
|
+
padding:16px 18px;
|
|
16
|
+
}
|
|
17
|
+
.ywiki-content .doc-callout[data-icon-hidden='true'] {grid-template-columns:minmax(0,1fr);}
|
|
18
|
+
.callout-controls-host {display:contents;}
|
|
19
|
+
.ywiki-content .doc-callout-content {grid-column:2;grid-row:1;min-width:0;color:inherit;}
|
|
20
|
+
.ywiki-content .doc-callout[data-icon-hidden='true']>.doc-callout-content {grid-column:1;}
|
|
21
|
+
.ywiki-content .doc-callout .callout-icon {
|
|
22
|
+
grid-column:1;grid-row:1;align-self:start;display:inline-flex;align-items:center;justify-content:center;
|
|
23
|
+
width:30px;min-width:30px;height:var(--callout-first-line-height);min-height:0;padding:0;
|
|
24
|
+
font-size:22px;line-height:1;user-select:none;color:inherit;
|
|
25
|
+
}
|
|
26
|
+
/* A heading on the first line has its own size and leading; later paragraphs do not move the icon. */
|
|
27
|
+
.ywiki-content .doc-callout:has(>.doc-callout-content>h1:first-child){--callout-first-line-height:calc(var(--content-font-size) * 1.625 * 1.3);}
|
|
28
|
+
.ywiki-content .doc-callout:has(>.doc-callout-content>h2:first-child){--callout-first-line-height:calc(var(--content-font-size) * 1.375 * 1.3);}
|
|
29
|
+
.ywiki-content .doc-callout:has(>.doc-callout-content>h3:first-child){--callout-first-line-height:calc(var(--content-font-size) * 1.125 * 1.3);}
|
|
30
|
+
.ywiki-content .doc-callout:has(>.doc-callout-content>:is(h4,h5,h6):first-child){--callout-first-line-height:calc(var(--content-font-size) * 1.3);}
|
|
31
|
+
.ywiki-content .doc-callout>.doc-callout-content>:first-child {margin-top:0;}
|
|
32
|
+
.ywiki-content .doc-callout>.doc-callout-content>:last-child {margin-bottom:0;}
|
|
33
|
+
.ywiki-content .doc-callout-content :where(h1,h2,h3,h4,h5,h6) {color:inherit;}
|
|
34
|
+
@media(max-width:600px){.ywiki-content .doc-callout{padding:12px;column-gap:9px;}}
|