@x15ventures/x15-ui-library 3.18.0 → 3.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/THIRD_PARTY_LICENSES.md +11182 -0
- package/dist/cjs/autoGenerated/libraryThemes.js +12 -12
- package/dist/cjs/autoGenerated/libraryThemes.js.map +1 -1
- package/dist/cjs/autoGenerated/libraryThemes.json +12 -12
- package/dist/cjs/components/design/banners/pageBanner/PageBanner.js +27 -12
- package/dist/cjs/components/design/banners/pageBanner/PageBanner.js.map +1 -1
- package/dist/cjs/components/design/card/cardHeader/CardHeaderItem.js +22 -15
- package/dist/cjs/components/design/card/cardHeader/CardHeaderItem.js.map +1 -1
- package/dist/cjs/components/design/dialog/dialog.css +4 -0
- package/dist/cjs/components/design/logos/LogoLink.js +2 -1
- package/dist/cjs/components/design/logos/LogoLink.js.map +1 -1
- package/dist/cjs/components/design/logos/VentureLogo.js +2 -1
- package/dist/cjs/components/design/logos/VentureLogo.js.map +1 -1
- package/dist/cjs/components/design/revealMore/RevealMoreBelow.js +2 -2
- package/dist/cjs/components/design/revealMore/RevealMoreBelow.js.map +1 -1
- package/dist/cjs/components/design/skeleton/Skeleton.js +15 -5
- package/dist/cjs/components/design/skeleton/Skeleton.js.map +1 -1
- package/dist/cjs/components/design/themeLoader/ThemeLoader.js +1 -1
- package/dist/cjs/components/design/themeLoader/ThemeLoader.js.map +1 -1
- package/dist/cjs/components/form/buttons/SimpleButton.js +3 -1
- package/dist/cjs/components/form/buttons/SimpleButton.js.map +1 -1
- package/dist/cjs/components/form/buttons/button.interface.js.map +1 -1
- package/dist/cjs/components/form/buttons/userPicButton/UserPicButton.js +5 -3
- package/dist/cjs/components/form/buttons/userPicButton/UserPicButton.js.map +1 -1
- package/dist/cjs/components/form/formFields/subComponents/inputs/file/dragAndDrop/DragAndDropFileUpload.js +64 -19
- package/dist/cjs/components/form/formFields/subComponents/inputs/file/dragAndDrop/DragAndDropFileUpload.js.map +1 -1
- package/dist/cjs/components/navigation/link/Link.js +2 -1
- package/dist/cjs/components/navigation/link/Link.js.map +1 -1
- package/dist/cjs/components/testing/devToolbar/DevToolbar.js +5 -3
- package/dist/cjs/components/testing/devToolbar/DevToolbar.js.map +1 -1
- package/dist/cjs/constants/fileUploadTypes.js +9 -4
- package/dist/cjs/constants/fileUploadTypes.js.map +1 -1
- package/dist/cjs/helpers/dateHelpers.js +34 -23
- package/dist/cjs/helpers/dateHelpers.js.map +1 -1
- package/dist/cjs/helpers/fileHelpers.js +58 -0
- package/dist/cjs/helpers/fileHelpers.js.map +1 -0
- package/dist/cjs/helpers/index.js +44 -0
- package/dist/cjs/helpers/index.js.map +1 -1
- package/dist/cjs/helpers/interactionsHelper.js +8 -1
- package/dist/cjs/helpers/interactionsHelper.js.map +1 -1
- package/dist/cjs/helpers/objectHelpers.js +23 -9
- package/dist/cjs/helpers/objectHelpers.js.map +1 -1
- package/dist/cjs/helpers/stringHelpers.js +61 -5
- package/dist/cjs/helpers/stringHelpers.js.map +1 -1
- package/dist/cjs/helpers/urlHelpers.js +48 -0
- package/dist/cjs/helpers/urlHelpers.js.map +1 -0
- package/dist/cjs/index.js +191 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/package.json +3 -305
- package/dist/cjs/styles/index.css +18 -0
- package/dist/cjs/styles/variables/cssVars/_designVariables.css +18 -0
- package/dist/cjs/widgets/documentComments/DocumentComments.js +305 -0
- package/dist/cjs/widgets/documentComments/DocumentComments.js.map +1 -0
- package/dist/cjs/widgets/documentComments/_documentCommentsVariables.css +0 -0
- package/dist/cjs/widgets/documentComments/documentComments.css +107 -0
- package/dist/cjs/widgets/documentComments/documentComments.interfaces.js +6 -0
- package/dist/cjs/widgets/documentComments/documentComments.interfaces.js.map +1 -0
- package/dist/cjs/widgets/documentComments/index.js +19 -0
- package/dist/cjs/widgets/documentComments/index.js.map +1 -0
- package/dist/cjs/widgets/documentComparer/DocumentComparer.js +309 -0
- package/dist/cjs/widgets/documentComparer/DocumentComparer.js.map +1 -0
- package/dist/cjs/widgets/documentComparer/_documentComparerVariables.css +0 -0
- package/dist/cjs/widgets/documentComparer/documentComparer.css +117 -0
- package/dist/cjs/widgets/documentComparer/documentComparer.interfaces.js +6 -0
- package/dist/cjs/widgets/documentComparer/documentComparer.interfaces.js.map +1 -0
- package/dist/cjs/widgets/documentComparer/index.js +19 -0
- package/dist/cjs/widgets/documentComparer/index.js.map +1 -0
- package/dist/cjs/widgets/documentEditor/DocumentEditor.js +142 -0
- package/dist/cjs/widgets/documentEditor/DocumentEditor.js.map +1 -0
- package/dist/cjs/widgets/documentEditor/_documentEditorVariables.css +0 -0
- package/dist/cjs/widgets/documentEditor/documentEditor.css +33 -0
- package/dist/cjs/widgets/documentEditor/documentEditor.interfaces.js +6 -0
- package/dist/cjs/widgets/documentEditor/documentEditor.interfaces.js.map +1 -0
- package/dist/cjs/widgets/documentEditor/index.js +19 -0
- package/dist/cjs/widgets/documentEditor/index.js.map +1 -0
- package/dist/cjs/widgets/documentViewer/DocumentViewer.js +206 -0
- package/dist/cjs/widgets/documentViewer/DocumentViewer.js.map +1 -0
- package/dist/cjs/widgets/documentViewer/_documentViewerVariables.css +0 -0
- package/dist/cjs/widgets/documentViewer/documentViewer.css +82 -0
- package/dist/cjs/widgets/documentViewer/documentViewer.interfaces.js +6 -0
- package/dist/cjs/widgets/documentViewer/documentViewer.interfaces.js.map +1 -0
- package/dist/cjs/widgets/documentViewer/index.js +19 -0
- package/dist/cjs/widgets/documentViewer/index.js.map +1 -0
- package/dist/cjs/widgets/index.js +126 -0
- package/dist/cjs/widgets/index.js.map +1 -1
- package/dist/cjs/widgets/shared/documents/ToggleGroup.js +32 -0
- package/dist/cjs/widgets/shared/documents/ToggleGroup.js.map +1 -0
- package/dist/cjs/widgets/shared/documents/_documentVariables.css +0 -0
- package/dist/cjs/widgets/shared/documents/annotations/AnnotationLayer.js +279 -0
- package/dist/cjs/widgets/shared/documents/annotations/AnnotationLayer.js.map +1 -0
- package/dist/cjs/widgets/shared/documents/annotations/_annotationLayerVariables.css +0 -0
- package/dist/cjs/widgets/shared/documents/annotations/annotationLayer.css +65 -0
- package/dist/cjs/widgets/shared/documents/annotations/annotations.interfaces.js +21 -0
- package/dist/cjs/widgets/shared/documents/annotations/annotations.interfaces.js.map +1 -0
- package/dist/cjs/widgets/shared/documents/annotations/highlightRegistry.js +67 -0
- package/dist/cjs/widgets/shared/documents/annotations/highlightRegistry.js.map +1 -0
- package/dist/cjs/widgets/shared/documents/annotations/index.js +39 -0
- package/dist/cjs/widgets/shared/documents/annotations/index.js.map +1 -0
- package/dist/cjs/widgets/shared/documents/annotations/textIndex.js +112 -0
- package/dist/cjs/widgets/shared/documents/annotations/textIndex.js.map +1 -0
- package/dist/cjs/widgets/shared/documents/annotations/textQuoteAnchor.js +160 -0
- package/dist/cjs/widgets/shared/documents/annotations/textQuoteAnchor.js.map +1 -0
- package/dist/cjs/widgets/shared/documents/documentHelpers.js +186 -0
- package/dist/cjs/widgets/shared/documents/documentHelpers.js.map +1 -0
- package/dist/cjs/widgets/shared/documents/documents.interfaces.js +6 -0
- package/dist/cjs/widgets/shared/documents/documents.interfaces.js.map +1 -0
- package/dist/cjs/widgets/shared/documents/engines/documentDiff/DocumentDiff.js +73 -0
- package/dist/cjs/widgets/shared/documents/engines/documentDiff/DocumentDiff.js.map +1 -0
- package/dist/cjs/widgets/shared/documents/engines/documentDiff/_documentDiffVariables.css +0 -0
- package/dist/cjs/widgets/shared/documents/engines/documentDiff/buildDocumentDiff.js +114 -0
- package/dist/cjs/widgets/shared/documents/engines/documentDiff/buildDocumentDiff.js.map +1 -0
- package/dist/cjs/widgets/shared/documents/engines/documentDiff/documentDiff.css +69 -0
- package/dist/cjs/widgets/shared/documents/engines/documentDiff/documentDiff.interfaces.js +6 -0
- package/dist/cjs/widgets/shared/documents/engines/documentDiff/documentDiff.interfaces.js.map +1 -0
- package/dist/cjs/widgets/shared/documents/engines/lazyEngines.js +19 -0
- package/dist/cjs/widgets/shared/documents/engines/lazyEngines.js.map +1 -0
- package/dist/cjs/widgets/shared/documents/engines/markdownEditor/MarkdownEditorEngine.js +200 -0
- package/dist/cjs/widgets/shared/documents/engines/markdownEditor/MarkdownEditorEngine.js.map +1 -0
- package/dist/cjs/widgets/shared/documents/engines/markdownEditor/_markdownEditorEngineVariables.css +0 -0
- package/dist/cjs/widgets/shared/documents/engines/markdownEditor/markdownEditorEngine.css +50 -0
- package/dist/cjs/widgets/shared/documents/engines/markdownEditor/markdownEditorEngine.interfaces.js +6 -0
- package/dist/cjs/widgets/shared/documents/engines/markdownEditor/markdownEditorEngine.interfaces.js.map +1 -0
- package/dist/cjs/widgets/shared/documents/engines/markdownEditor/markdownTextIndex.js +179 -0
- package/dist/cjs/widgets/shared/documents/engines/markdownEditor/markdownTextIndex.js.map +1 -0
- package/dist/cjs/widgets/shared/documents/engines/markdownEditor/sanitizeForMdx.js +278 -0
- package/dist/cjs/widgets/shared/documents/engines/markdownEditor/sanitizeForMdx.js.map +1 -0
- package/dist/cjs/widgets/shared/documents/engines/markdownEditor/sourceAnnotations.js +208 -0
- package/dist/cjs/widgets/shared/documents/engines/markdownEditor/sourceAnnotations.js.map +1 -0
- package/dist/cjs/widgets/shared/documents/engines/markdownRenderer/MarkdownRenderer.js +85 -0
- package/dist/cjs/widgets/shared/documents/engines/markdownRenderer/MarkdownRenderer.js.map +1 -0
- package/dist/cjs/widgets/shared/documents/engines/markdownRenderer/_markdownRendererVariables.css +0 -0
- package/dist/cjs/widgets/shared/documents/engines/markdownRenderer/markdownRenderer.css +78 -0
- package/dist/cjs/widgets/shared/documents/engines/markdownRenderer/plugins/index.js +64 -0
- package/dist/cjs/widgets/shared/documents/engines/markdownRenderer/plugins/index.js.map +1 -0
- package/dist/cjs/widgets/shared/documents/engines/markdownRenderer/plugins/markdownNode.interfaces.js +6 -0
- package/dist/cjs/widgets/shared/documents/engines/markdownRenderer/plugins/markdownNode.interfaces.js.map +1 -0
- package/dist/cjs/widgets/shared/documents/engines/markdownRenderer/plugins/rehypeTableCleanup.js +71 -0
- package/dist/cjs/widgets/shared/documents/engines/markdownRenderer/plugins/rehypeTableCleanup.js.map +1 -0
- package/dist/cjs/widgets/shared/documents/engines/markdownRenderer/plugins/remarkPlugins.js +192 -0
- package/dist/cjs/widgets/shared/documents/engines/markdownRenderer/plugins/remarkPlugins.js.map +1 -0
- package/dist/cjs/widgets/shared/documents/engines/markdownRenderer/plugins/remarkSafeTables.js +86 -0
- package/dist/cjs/widgets/shared/documents/engines/markdownRenderer/plugins/remarkSafeTables.js.map +1 -0
- package/dist/cjs/widgets/shared/documents/engines/markdownRenderer/plugins/tableHelpers.js +38 -0
- package/dist/cjs/widgets/shared/documents/engines/markdownRenderer/plugins/tableHelpers.js.map +1 -0
- package/dist/cjs/widgets/shared/documents/engines/wordRenderer/WordRenderer.js +49 -0
- package/dist/cjs/widgets/shared/documents/engines/wordRenderer/WordRenderer.js.map +1 -0
- package/dist/cjs/widgets/shared/documents/engines/wordRenderer/renderWordDocument.js +214 -0
- package/dist/cjs/widgets/shared/documents/engines/wordRenderer/renderWordDocument.js.map +1 -0
- package/dist/cjs/widgets/shared/documents/engines/wordRenderer/wordPreviewNumbering.js +112 -0
- package/dist/cjs/widgets/shared/documents/engines/wordRenderer/wordPreviewNumbering.js.map +1 -0
- package/dist/cjs/widgets/shared/documents/engines/wordRenderer/wordXml.js +68 -0
- package/dist/cjs/widgets/shared/documents/engines/wordRenderer/wordXml.js.map +1 -0
- package/dist/cjs/widgets/shared/documents/index.js +50 -0
- package/dist/cjs/widgets/shared/documents/index.js.map +1 -0
- package/dist/cjs/widgets/shared/documents/toggleGroup.css +8 -0
- package/dist/cjs/widgets/shared/documents/useDocumentContent.js +222 -0
- package/dist/cjs/widgets/shared/documents/useDocumentContent.js.map +1 -0
- package/dist/components/design/banners/pageBanner/PageBanner.d.ts.map +1 -1
- package/dist/components/design/card/cardHeader/CardHeaderItem.d.ts.map +1 -1
- package/dist/components/design/logos/LogoLink.d.ts.map +1 -1
- package/dist/components/design/logos/VentureLogo.d.ts.map +1 -1
- package/dist/components/design/skeleton/Skeleton.d.ts +1 -1
- package/dist/components/design/skeleton/Skeleton.d.ts.map +1 -1
- package/dist/components/design/themeLoader/ThemeLoader.d.ts.map +1 -1
- package/dist/components/form/buttons/SimpleButton.d.ts.map +1 -1
- package/dist/components/form/buttons/button.interface.d.ts +1 -0
- package/dist/components/form/buttons/button.interface.d.ts.map +1 -1
- package/dist/components/form/buttons/userPicButton/UserPicButton.d.ts.map +1 -1
- package/dist/components/form/formFields/subComponents/inputs/file/dragAndDrop/DragAndDropFileUpload.d.ts.map +1 -1
- package/dist/components/navigation/link/Link.d.ts.map +1 -1
- package/dist/components/testing/devToolbar/DevToolbar.d.ts.map +1 -1
- package/dist/constants/fileUploadTypes.d.ts.map +1 -1
- package/dist/esm/autoGenerated/libraryThemes.js +12 -12
- package/dist/esm/autoGenerated/libraryThemes.js.map +1 -1
- package/dist/esm/autoGenerated/libraryThemes.json +12 -12
- package/dist/esm/components/design/banners/pageBanner/PageBanner.js +27 -12
- package/dist/esm/components/design/banners/pageBanner/PageBanner.js.map +1 -1
- package/dist/esm/components/design/card/cardHeader/CardHeaderItem.js +22 -15
- package/dist/esm/components/design/card/cardHeader/CardHeaderItem.js.map +1 -1
- package/dist/esm/components/design/dialog/dialog.css +4 -0
- package/dist/esm/components/design/logos/LogoLink.js +2 -1
- package/dist/esm/components/design/logos/LogoLink.js.map +1 -1
- package/dist/esm/components/design/logos/VentureLogo.js +2 -1
- package/dist/esm/components/design/logos/VentureLogo.js.map +1 -1
- package/dist/esm/components/design/revealMore/RevealMoreBelow.js +1 -1
- package/dist/esm/components/design/revealMore/RevealMoreBelow.js.map +1 -1
- package/dist/esm/components/design/skeleton/Skeleton.js +15 -5
- package/dist/esm/components/design/skeleton/Skeleton.js.map +1 -1
- package/dist/esm/components/design/themeLoader/ThemeLoader.js +1 -1
- package/dist/esm/components/design/themeLoader/ThemeLoader.js.map +1 -1
- package/dist/esm/components/form/buttons/SimpleButton.js +3 -1
- package/dist/esm/components/form/buttons/SimpleButton.js.map +1 -1
- package/dist/esm/components/form/buttons/button.interface.js.map +1 -1
- package/dist/esm/components/form/buttons/userPicButton/UserPicButton.js +5 -3
- package/dist/esm/components/form/buttons/userPicButton/UserPicButton.js.map +1 -1
- package/dist/esm/components/form/formFields/subComponents/inputs/file/dragAndDrop/DragAndDropFileUpload.js +65 -19
- package/dist/esm/components/form/formFields/subComponents/inputs/file/dragAndDrop/DragAndDropFileUpload.js.map +1 -1
- package/dist/esm/components/navigation/link/Link.js +2 -1
- package/dist/esm/components/navigation/link/Link.js.map +1 -1
- package/dist/esm/components/testing/devToolbar/DevToolbar.js +5 -3
- package/dist/esm/components/testing/devToolbar/DevToolbar.js.map +1 -1
- package/dist/esm/constants/fileUploadTypes.js +9 -4
- package/dist/esm/constants/fileUploadTypes.js.map +1 -1
- package/dist/esm/helpers/dateHelpers.js +34 -23
- package/dist/esm/helpers/dateHelpers.js.map +1 -1
- package/dist/esm/helpers/fileHelpers.js +48 -0
- package/dist/esm/helpers/fileHelpers.js.map +1 -0
- package/dist/esm/helpers/index.js +2 -0
- package/dist/esm/helpers/index.js.map +1 -1
- package/dist/esm/helpers/interactionsHelper.js +5 -0
- package/dist/esm/helpers/interactionsHelper.js.map +1 -1
- package/dist/esm/helpers/objectHelpers.js +23 -9
- package/dist/esm/helpers/objectHelpers.js.map +1 -1
- package/dist/esm/helpers/stringHelpers.js +61 -5
- package/dist/esm/helpers/stringHelpers.js.map +1 -1
- package/dist/esm/helpers/urlHelpers.js +40 -0
- package/dist/esm/helpers/urlHelpers.js.map +1 -0
- package/dist/esm/index.js +3 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/package.json +2 -304
- package/dist/esm/styles/index.css +18 -0
- package/dist/esm/styles/variables/cssVars/_designVariables.css +18 -0
- package/dist/esm/widgets/documentComments/DocumentComments.js +298 -0
- package/dist/esm/widgets/documentComments/DocumentComments.js.map +1 -0
- package/dist/esm/widgets/documentComments/_documentCommentsVariables.css +0 -0
- package/dist/esm/widgets/documentComments/documentComments.css +107 -0
- package/dist/esm/widgets/documentComments/documentComments.interfaces.js +2 -0
- package/dist/esm/widgets/documentComments/documentComments.interfaces.js.map +1 -0
- package/dist/esm/widgets/documentComments/index.js +2 -0
- package/dist/esm/widgets/documentComments/index.js.map +1 -0
- package/dist/esm/widgets/documentComparer/DocumentComparer.js +301 -0
- package/dist/esm/widgets/documentComparer/DocumentComparer.js.map +1 -0
- package/dist/esm/widgets/documentComparer/_documentComparerVariables.css +0 -0
- package/dist/esm/widgets/documentComparer/documentComparer.css +117 -0
- package/dist/esm/widgets/documentComparer/documentComparer.interfaces.js +2 -0
- package/dist/esm/widgets/documentComparer/documentComparer.interfaces.js.map +1 -0
- package/dist/esm/widgets/documentComparer/index.js +2 -0
- package/dist/esm/widgets/documentComparer/index.js.map +1 -0
- package/dist/esm/widgets/documentEditor/DocumentEditor.js +135 -0
- package/dist/esm/widgets/documentEditor/DocumentEditor.js.map +1 -0
- package/dist/esm/widgets/documentEditor/_documentEditorVariables.css +0 -0
- package/dist/esm/widgets/documentEditor/documentEditor.css +33 -0
- package/dist/esm/widgets/documentEditor/documentEditor.interfaces.js +2 -0
- package/dist/esm/widgets/documentEditor/documentEditor.interfaces.js.map +1 -0
- package/dist/esm/widgets/documentEditor/index.js +2 -0
- package/dist/esm/widgets/documentEditor/index.js.map +1 -0
- package/dist/esm/widgets/documentViewer/DocumentViewer.js +198 -0
- package/dist/esm/widgets/documentViewer/DocumentViewer.js.map +1 -0
- package/dist/esm/widgets/documentViewer/_documentViewerVariables.css +0 -0
- package/dist/esm/widgets/documentViewer/documentViewer.css +82 -0
- package/dist/esm/widgets/documentViewer/documentViewer.interfaces.js +2 -0
- package/dist/esm/widgets/documentViewer/documentViewer.interfaces.js.map +1 -0
- package/dist/esm/widgets/documentViewer/index.js +2 -0
- package/dist/esm/widgets/documentViewer/index.js.map +1 -0
- package/dist/esm/widgets/index.js +6 -0
- package/dist/esm/widgets/index.js.map +1 -1
- package/dist/esm/widgets/shared/documents/ToggleGroup.js +24 -0
- package/dist/esm/widgets/shared/documents/ToggleGroup.js.map +1 -0
- package/dist/esm/widgets/shared/documents/_documentVariables.css +0 -0
- package/dist/esm/widgets/shared/documents/annotations/AnnotationLayer.js +273 -0
- package/dist/esm/widgets/shared/documents/annotations/AnnotationLayer.js.map +1 -0
- package/dist/esm/widgets/shared/documents/annotations/_annotationLayerVariables.css +0 -0
- package/dist/esm/widgets/shared/documents/annotations/annotationLayer.css +65 -0
- package/dist/esm/widgets/shared/documents/annotations/annotations.interfaces.js +14 -0
- package/dist/esm/widgets/shared/documents/annotations/annotations.interfaces.js.map +1 -0
- package/dist/esm/widgets/shared/documents/annotations/highlightRegistry.js +58 -0
- package/dist/esm/widgets/shared/documents/annotations/highlightRegistry.js.map +1 -0
- package/dist/esm/widgets/shared/documents/annotations/index.js +4 -0
- package/dist/esm/widgets/shared/documents/annotations/index.js.map +1 -0
- package/dist/esm/widgets/shared/documents/annotations/textIndex.js +103 -0
- package/dist/esm/widgets/shared/documents/annotations/textIndex.js.map +1 -0
- package/dist/esm/widgets/shared/documents/annotations/textQuoteAnchor.js +150 -0
- package/dist/esm/widgets/shared/documents/annotations/textQuoteAnchor.js.map +1 -0
- package/dist/esm/widgets/shared/documents/documentHelpers.js +168 -0
- package/dist/esm/widgets/shared/documents/documentHelpers.js.map +1 -0
- package/dist/esm/widgets/shared/documents/documents.interfaces.js +2 -0
- package/dist/esm/widgets/shared/documents/documents.interfaces.js.map +1 -0
- package/dist/esm/widgets/shared/documents/engines/documentDiff/DocumentDiff.js +65 -0
- package/dist/esm/widgets/shared/documents/engines/documentDiff/DocumentDiff.js.map +1 -0
- package/dist/esm/widgets/shared/documents/engines/documentDiff/_documentDiffVariables.css +0 -0
- package/dist/esm/widgets/shared/documents/engines/documentDiff/buildDocumentDiff.js +102 -0
- package/dist/esm/widgets/shared/documents/engines/documentDiff/buildDocumentDiff.js.map +1 -0
- package/dist/esm/widgets/shared/documents/engines/documentDiff/documentDiff.css +69 -0
- package/dist/esm/widgets/shared/documents/engines/documentDiff/documentDiff.interfaces.js +2 -0
- package/dist/esm/widgets/shared/documents/engines/documentDiff/documentDiff.interfaces.js.map +1 -0
- package/dist/esm/widgets/shared/documents/engines/lazyEngines.js +13 -0
- package/dist/esm/widgets/shared/documents/engines/lazyEngines.js.map +1 -0
- package/dist/esm/widgets/shared/documents/engines/markdownEditor/MarkdownEditorEngine.js +191 -0
- package/dist/esm/widgets/shared/documents/engines/markdownEditor/MarkdownEditorEngine.js.map +1 -0
- package/dist/esm/widgets/shared/documents/engines/markdownEditor/_markdownEditorEngineVariables.css +0 -0
- package/dist/esm/widgets/shared/documents/engines/markdownEditor/markdownEditorEngine.css +50 -0
- package/dist/esm/widgets/shared/documents/engines/markdownEditor/markdownEditorEngine.interfaces.js +2 -0
- package/dist/esm/widgets/shared/documents/engines/markdownEditor/markdownEditorEngine.interfaces.js.map +1 -0
- package/dist/esm/widgets/shared/documents/engines/markdownEditor/markdownTextIndex.js +170 -0
- package/dist/esm/widgets/shared/documents/engines/markdownEditor/markdownTextIndex.js.map +1 -0
- package/dist/esm/widgets/shared/documents/engines/markdownEditor/sanitizeForMdx.js +270 -0
- package/dist/esm/widgets/shared/documents/engines/markdownEditor/sanitizeForMdx.js.map +1 -0
- package/dist/esm/widgets/shared/documents/engines/markdownEditor/sourceAnnotations.js +198 -0
- package/dist/esm/widgets/shared/documents/engines/markdownEditor/sourceAnnotations.js.map +1 -0
- package/dist/esm/widgets/shared/documents/engines/markdownRenderer/MarkdownRenderer.js +76 -0
- package/dist/esm/widgets/shared/documents/engines/markdownRenderer/MarkdownRenderer.js.map +1 -0
- package/dist/esm/widgets/shared/documents/engines/markdownRenderer/_markdownRendererVariables.css +0 -0
- package/dist/esm/widgets/shared/documents/engines/markdownRenderer/markdownRenderer.css +78 -0
- package/dist/esm/widgets/shared/documents/engines/markdownRenderer/plugins/index.js +5 -0
- package/dist/esm/widgets/shared/documents/engines/markdownRenderer/plugins/index.js.map +1 -0
- package/dist/esm/widgets/shared/documents/engines/markdownRenderer/plugins/markdownNode.interfaces.js +2 -0
- package/dist/esm/widgets/shared/documents/engines/markdownRenderer/plugins/markdownNode.interfaces.js.map +1 -0
- package/dist/esm/widgets/shared/documents/engines/markdownRenderer/plugins/rehypeTableCleanup.js +64 -0
- package/dist/esm/widgets/shared/documents/engines/markdownRenderer/plugins/rehypeTableCleanup.js.map +1 -0
- package/dist/esm/widgets/shared/documents/engines/markdownRenderer/plugins/remarkPlugins.js +182 -0
- package/dist/esm/widgets/shared/documents/engines/markdownRenderer/plugins/remarkPlugins.js.map +1 -0
- package/dist/esm/widgets/shared/documents/engines/markdownRenderer/plugins/remarkSafeTables.js +78 -0
- package/dist/esm/widgets/shared/documents/engines/markdownRenderer/plugins/remarkSafeTables.js.map +1 -0
- package/dist/esm/widgets/shared/documents/engines/markdownRenderer/plugins/tableHelpers.js +30 -0
- package/dist/esm/widgets/shared/documents/engines/markdownRenderer/plugins/tableHelpers.js.map +1 -0
- package/dist/esm/widgets/shared/documents/engines/wordRenderer/WordRenderer.js +41 -0
- package/dist/esm/widgets/shared/documents/engines/wordRenderer/WordRenderer.js.map +1 -0
- package/dist/esm/widgets/shared/documents/engines/wordRenderer/renderWordDocument.js +207 -0
- package/dist/esm/widgets/shared/documents/engines/wordRenderer/renderWordDocument.js.map +1 -0
- package/dist/esm/widgets/shared/documents/engines/wordRenderer/wordPreviewNumbering.js +105 -0
- package/dist/esm/widgets/shared/documents/engines/wordRenderer/wordPreviewNumbering.js.map +1 -0
- package/dist/esm/widgets/shared/documents/engines/wordRenderer/wordXml.js +57 -0
- package/dist/esm/widgets/shared/documents/engines/wordRenderer/wordXml.js.map +1 -0
- package/dist/esm/widgets/shared/documents/index.js +3 -0
- package/dist/esm/widgets/shared/documents/index.js.map +1 -0
- package/dist/esm/widgets/shared/documents/toggleGroup.css +8 -0
- package/dist/esm/widgets/shared/documents/useDocumentContent.js +215 -0
- package/dist/esm/widgets/shared/documents/useDocumentContent.js.map +1 -0
- package/dist/helpers/dateHelpers.d.ts.map +1 -1
- package/dist/helpers/fileHelpers.d.ts +5 -0
- package/dist/helpers/fileHelpers.d.ts.map +1 -0
- package/dist/helpers/index.d.ts +3 -0
- package/dist/helpers/index.d.ts.map +1 -1
- package/dist/helpers/interactionsHelper.d.ts +2 -0
- package/dist/helpers/interactionsHelper.d.ts.map +1 -1
- package/dist/helpers/objectHelpers.d.ts.map +1 -1
- package/dist/helpers/stringHelpers.d.ts.map +1 -1
- package/dist/helpers/urlHelpers.d.ts +3 -0
- package/dist/helpers/urlHelpers.d.ts.map +1 -0
- package/dist/index.d.ts +5 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/package.json +42 -28
- package/dist/widgets/documentComments/DocumentComments.d.ts +7 -0
- package/dist/widgets/documentComments/DocumentComments.d.ts.map +1 -0
- package/dist/widgets/documentComments/documentComments.interfaces.d.ts +57 -0
- package/dist/widgets/documentComments/documentComments.interfaces.d.ts.map +1 -0
- package/dist/widgets/documentComments/index.d.ts +3 -0
- package/dist/widgets/documentComments/index.d.ts.map +1 -0
- package/dist/widgets/documentComparer/DocumentComparer.d.ts +7 -0
- package/dist/widgets/documentComparer/DocumentComparer.d.ts.map +1 -0
- package/dist/widgets/documentComparer/documentComparer.interfaces.d.ts +78 -0
- package/dist/widgets/documentComparer/documentComparer.interfaces.d.ts.map +1 -0
- package/dist/widgets/documentComparer/index.d.ts +3 -0
- package/dist/widgets/documentComparer/index.d.ts.map +1 -0
- package/dist/widgets/documentEditor/DocumentEditor.d.ts +7 -0
- package/dist/widgets/documentEditor/DocumentEditor.d.ts.map +1 -0
- package/dist/widgets/documentEditor/documentEditor.interfaces.d.ts +40 -0
- package/dist/widgets/documentEditor/documentEditor.interfaces.d.ts.map +1 -0
- package/dist/widgets/documentEditor/index.d.ts +3 -0
- package/dist/widgets/documentEditor/index.d.ts.map +1 -0
- package/dist/widgets/documentViewer/DocumentViewer.d.ts +7 -0
- package/dist/widgets/documentViewer/DocumentViewer.d.ts.map +1 -0
- package/dist/widgets/documentViewer/documentViewer.interfaces.d.ts +47 -0
- package/dist/widgets/documentViewer/documentViewer.interfaces.d.ts.map +1 -0
- package/dist/widgets/documentViewer/index.d.ts +3 -0
- package/dist/widgets/documentViewer/index.d.ts.map +1 -0
- package/dist/widgets/index.d.ts +12 -0
- package/dist/widgets/index.d.ts.map +1 -1
- package/dist/widgets/shared/documents/ToggleGroup.d.ts +15 -0
- package/dist/widgets/shared/documents/ToggleGroup.d.ts.map +1 -0
- package/dist/widgets/shared/documents/annotations/AnnotationLayer.d.ts +27 -0
- package/dist/widgets/shared/documents/annotations/AnnotationLayer.d.ts.map +1 -0
- package/dist/widgets/shared/documents/annotations/annotations.interfaces.d.ts +43 -0
- package/dist/widgets/shared/documents/annotations/annotations.interfaces.d.ts.map +1 -0
- package/dist/widgets/shared/documents/annotations/highlightRegistry.d.ts +12 -0
- package/dist/widgets/shared/documents/annotations/highlightRegistry.d.ts.map +1 -0
- package/dist/widgets/shared/documents/annotations/index.d.ts +6 -0
- package/dist/widgets/shared/documents/annotations/index.d.ts.map +1 -0
- package/dist/widgets/shared/documents/annotations/textIndex.d.ts +16 -0
- package/dist/widgets/shared/documents/annotations/textIndex.d.ts.map +1 -0
- package/dist/widgets/shared/documents/annotations/textQuoteAnchor.d.ts +15 -0
- package/dist/widgets/shared/documents/annotations/textQuoteAnchor.d.ts.map +1 -0
- package/dist/widgets/shared/documents/documentHelpers.d.ts +14 -0
- package/dist/widgets/shared/documents/documentHelpers.d.ts.map +1 -0
- package/dist/widgets/shared/documents/documents.interfaces.d.ts +20 -0
- package/dist/widgets/shared/documents/documents.interfaces.d.ts.map +1 -0
- package/dist/widgets/shared/documents/engines/documentDiff/DocumentDiff.d.ts +6 -0
- package/dist/widgets/shared/documents/engines/documentDiff/DocumentDiff.d.ts.map +1 -0
- package/dist/widgets/shared/documents/engines/documentDiff/buildDocumentDiff.d.ts +25 -0
- package/dist/widgets/shared/documents/engines/documentDiff/buildDocumentDiff.d.ts.map +1 -0
- package/dist/widgets/shared/documents/engines/documentDiff/documentDiff.interfaces.d.ts +17 -0
- package/dist/widgets/shared/documents/engines/documentDiff/documentDiff.interfaces.d.ts.map +1 -0
- package/dist/widgets/shared/documents/engines/lazyEngines.d.ts +5 -0
- package/dist/widgets/shared/documents/engines/lazyEngines.d.ts.map +1 -0
- package/dist/widgets/shared/documents/engines/markdownEditor/MarkdownEditorEngine.d.ts +8 -0
- package/dist/widgets/shared/documents/engines/markdownEditor/MarkdownEditorEngine.d.ts.map +1 -0
- package/dist/widgets/shared/documents/engines/markdownEditor/markdownEditorEngine.interfaces.d.ts +23 -0
- package/dist/widgets/shared/documents/engines/markdownEditor/markdownEditorEngine.interfaces.d.ts.map +1 -0
- package/dist/widgets/shared/documents/engines/markdownEditor/markdownTextIndex.d.ts +12 -0
- package/dist/widgets/shared/documents/engines/markdownEditor/markdownTextIndex.d.ts.map +1 -0
- package/dist/widgets/shared/documents/engines/markdownEditor/sanitizeForMdx.d.ts +8 -0
- package/dist/widgets/shared/documents/engines/markdownEditor/sanitizeForMdx.d.ts.map +1 -0
- package/dist/widgets/shared/documents/engines/markdownEditor/sourceAnnotations.d.ts +32 -0
- package/dist/widgets/shared/documents/engines/markdownEditor/sourceAnnotations.d.ts.map +1 -0
- package/dist/widgets/shared/documents/engines/markdownRenderer/MarkdownRenderer.d.ts +12 -0
- package/dist/widgets/shared/documents/engines/markdownRenderer/MarkdownRenderer.d.ts.map +1 -0
- package/dist/widgets/shared/documents/engines/markdownRenderer/plugins/index.d.ts +7 -0
- package/dist/widgets/shared/documents/engines/markdownRenderer/plugins/index.d.ts.map +1 -0
- package/dist/widgets/shared/documents/engines/markdownRenderer/plugins/markdownNode.interfaces.d.ts +16 -0
- package/dist/widgets/shared/documents/engines/markdownRenderer/plugins/markdownNode.interfaces.d.ts.map +1 -0
- package/dist/widgets/shared/documents/engines/markdownRenderer/plugins/rehypeTableCleanup.d.ts +3 -0
- package/dist/widgets/shared/documents/engines/markdownRenderer/plugins/rehypeTableCleanup.d.ts.map +1 -0
- package/dist/widgets/shared/documents/engines/markdownRenderer/plugins/remarkPlugins.d.ts +6 -0
- package/dist/widgets/shared/documents/engines/markdownRenderer/plugins/remarkPlugins.d.ts.map +1 -0
- package/dist/widgets/shared/documents/engines/markdownRenderer/plugins/remarkSafeTables.d.ts +3 -0
- package/dist/widgets/shared/documents/engines/markdownRenderer/plugins/remarkSafeTables.d.ts.map +1 -0
- package/dist/widgets/shared/documents/engines/markdownRenderer/plugins/tableHelpers.d.ts +8 -0
- package/dist/widgets/shared/documents/engines/markdownRenderer/plugins/tableHelpers.d.ts.map +1 -0
- package/dist/widgets/shared/documents/engines/wordRenderer/WordRenderer.d.ts +11 -0
- package/dist/widgets/shared/documents/engines/wordRenderer/WordRenderer.d.ts.map +1 -0
- package/dist/widgets/shared/documents/engines/wordRenderer/renderWordDocument.d.ts +7 -0
- package/dist/widgets/shared/documents/engines/wordRenderer/renderWordDocument.d.ts.map +1 -0
- package/dist/widgets/shared/documents/engines/wordRenderer/wordPreviewNumbering.d.ts +3 -0
- package/dist/widgets/shared/documents/engines/wordRenderer/wordPreviewNumbering.d.ts.map +1 -0
- package/dist/widgets/shared/documents/engines/wordRenderer/wordXml.d.ts +21 -0
- package/dist/widgets/shared/documents/engines/wordRenderer/wordXml.d.ts.map +1 -0
- package/dist/widgets/shared/documents/index.d.ts +5 -0
- package/dist/widgets/shared/documents/index.d.ts.map +1 -0
- package/dist/widgets/shared/documents/useDocumentContent.d.ts +11 -0
- package/dist/widgets/shared/documents/useDocumentContent.d.ts.map +1 -0
- package/package.json +42 -28
- package/readme.md +49 -2
- package/dist/components/design/dialog/Dialog.test.d.ts +0 -5
- package/dist/components/design/dialog/Dialog.test.d.ts.map +0 -1
- package/dist/components/design/progressIndicators/circularProgressIndicator/CircularProgressIndicator.test.d.ts +0 -5
- package/dist/components/design/progressIndicators/circularProgressIndicator/CircularProgressIndicator.test.d.ts.map +0 -1
- package/dist/components/design/tooltip/Tooltip.test.d.ts +0 -2
- package/dist/components/design/tooltip/Tooltip.test.d.ts.map +0 -1
- package/dist/components/form/buttons/SimpleButton.test.d.ts +0 -5
- package/dist/components/form/buttons/SimpleButton.test.d.ts.map +0 -1
- package/dist/components/form/formFields/formFieldWrapper/FormField.test.d.ts +0 -5
- package/dist/components/form/formFields/formFieldWrapper/FormField.test.d.ts.map +0 -1
- package/dist/components/form/formFields/subComponents/inputs/checkbox/InputCheckbox.test.d.ts +0 -5
- package/dist/components/form/formFields/subComponents/inputs/checkbox/InputCheckbox.test.d.ts.map +0 -1
- package/dist/components/form/formFields/subComponents/inputs/checkbox/checkboxSwitch/CheckboxSwitch.test.d.ts +0 -5
- package/dist/components/form/formFields/subComponents/inputs/checkbox/checkboxSwitch/CheckboxSwitch.test.d.ts.map +0 -1
- package/dist/components/form/formFields/subComponents/inputs/file/dragAndDrop/DragAndDropFileUpload.test.d.ts +0 -5
- package/dist/components/form/formFields/subComponents/inputs/file/dragAndDrop/DragAndDropFileUpload.test.d.ts.map +0 -1
- package/dist/components/form/formFields/subComponents/inputs/file/fileAttachmentList/FileAttachmentsList.test.d.ts +0 -5
- package/dist/components/form/formFields/subComponents/inputs/file/fileAttachmentList/FileAttachmentsList.test.d.ts.map +0 -1
- package/dist/components/form/formFields/subComponents/inputs/text/InputText.test.d.ts +0 -5
- package/dist/components/form/formFields/subComponents/inputs/text/InputText.test.d.ts.map +0 -1
- package/dist/components/form/formFields/subComponents/nestedFormContext.test.d.ts +0 -5
- package/dist/components/form/formFields/subComponents/nestedFormContext.test.d.ts.map +0 -1
- package/dist/components/form/formFields/subComponents/select/Select.test.d.ts +0 -5
- package/dist/components/form/formFields/subComponents/select/Select.test.d.ts.map +0 -1
- package/dist/components/form/formFields/subComponents/textarea/Textarea.test.d.ts +0 -5
- package/dist/components/form/formFields/subComponents/textarea/Textarea.test.d.ts.map +0 -1
- package/dist/components/form/hookFormWrapper/HookFormWrapper.test.d.ts +0 -5
- package/dist/components/form/hookFormWrapper/HookFormWrapper.test.d.ts.map +0 -1
- package/dist/components/form/validation/ValidationMessages.test.d.ts +0 -5
- package/dist/components/form/validation/ValidationMessages.test.d.ts.map +0 -1
- package/dist/components/navigation/bubbleNavigator/bubbleNavigatorUtilities.test.d.ts +0 -2
- package/dist/components/navigation/bubbleNavigator/bubbleNavigatorUtilities.test.d.ts.map +0 -1
- package/dist/components/navigation/menu/menuItemContent/MenuItemIcon.test.d.ts +0 -5
- package/dist/components/navigation/menu/menuItemContent/MenuItemIcon.test.d.ts.map +0 -1
- package/dist/helpers/ageHelpers.test.d.ts +0 -2
- package/dist/helpers/ageHelpers.test.d.ts.map +0 -1
- package/dist/helpers/dateHelpers.test.d.ts +0 -2
- package/dist/helpers/dateHelpers.test.d.ts.map +0 -1
- package/dist/helpers/formatters.test.d.ts +0 -5
- package/dist/helpers/formatters.test.d.ts.map +0 -1
- package/dist/helpers/iconHelpers.test.d.ts +0 -5
- package/dist/helpers/iconHelpers.test.d.ts.map +0 -1
- package/dist/helpers/numberHelpers.test.d.ts +0 -5
- package/dist/helpers/numberHelpers.test.d.ts.map +0 -1
- package/dist/helpers/objectHelpers.test.d.ts +0 -2
- package/dist/helpers/objectHelpers.test.d.ts.map +0 -1
- package/dist/helpers/stringHelpers.test.d.ts +0 -2
- package/dist/helpers/stringHelpers.test.d.ts.map +0 -1
- package/dist/hooks/InteractiveHostFocus.test.d.ts +0 -5
- package/dist/hooks/InteractiveHostFocus.test.d.ts.map +0 -1
- package/dist/widgets/processLauncher/ProcessLauncher.test.d.ts +0 -5
- package/dist/widgets/processLauncher/ProcessLauncher.test.d.ts.map +0 -1
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
.documentViewer {
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
gap: var(--documentViewerGap, var(--documentGap, 10px));
|
|
5
|
+
min-width: 0;
|
|
6
|
+
}
|
|
7
|
+
.documentViewer .headerBar {
|
|
8
|
+
margin-bottom: 0;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.documentViewer__metadata {
|
|
12
|
+
display: flex;
|
|
13
|
+
align-items: center;
|
|
14
|
+
gap: var(--documentViewerGap, var(--documentGap, 10px));
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.documentViewer__metadataIcon {
|
|
18
|
+
width: var(--documentViewerMetadataIconSize, 30px);
|
|
19
|
+
height: var(--documentViewerMetadataIconSize, 30px);
|
|
20
|
+
font-size: var(--documentViewerMetadataIconSize, 30px);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.documentViewer__fileName {
|
|
24
|
+
font-weight: var(--documentViewerMetadataFileNameWeight, 600);
|
|
25
|
+
overflow-wrap: anywhere;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.documentViewer__fileSize {
|
|
29
|
+
color: var(--documentViewerMetadataSizeColor, var(--documentMutedFgColor));
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.documentViewer__frame {
|
|
33
|
+
display: flex;
|
|
34
|
+
flex-direction: column;
|
|
35
|
+
min-height: var(--documentViewerFrameMinHeight, var(--documentFrameMinHeight, 65vh));
|
|
36
|
+
max-height: var(--documentViewerFrameMaxHeight, none);
|
|
37
|
+
border: var(--documentViewerFrameBorder, var(--documentBorder));
|
|
38
|
+
border-radius: var(--documentViewerFrameBorderRadius, var(--documentBorderRadius, 5px));
|
|
39
|
+
background: var(--documentViewerFrameBg, var(--documentBg, #fff));
|
|
40
|
+
overflow: auto;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.documentViewer__content {
|
|
44
|
+
display: flex;
|
|
45
|
+
flex: 1;
|
|
46
|
+
flex-direction: column;
|
|
47
|
+
}
|
|
48
|
+
.documentViewer__content > .loadingMessage,
|
|
49
|
+
.documentViewer__content > aside,
|
|
50
|
+
.documentViewer__content > .pageBanner {
|
|
51
|
+
margin: auto;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.documentViewer__pdf,
|
|
55
|
+
.documentViewer__word {
|
|
56
|
+
display: block;
|
|
57
|
+
flex: 1;
|
|
58
|
+
width: 100%;
|
|
59
|
+
min-height: var(--documentViewerFrameMinHeight, var(--documentFrameMinHeight, 65vh));
|
|
60
|
+
border: 0;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.documentViewer__text {
|
|
64
|
+
margin: 0;
|
|
65
|
+
padding: var(--documentViewerTextPadding, 20px);
|
|
66
|
+
font-size: var(--documentViewerTextFontSize, 0.8125rem);
|
|
67
|
+
white-space: pre-wrap;
|
|
68
|
+
overflow-wrap: anywhere;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.documentViewer__image {
|
|
72
|
+
display: block;
|
|
73
|
+
max-width: 100%;
|
|
74
|
+
height: auto;
|
|
75
|
+
margin: var(--documentViewerImageMargin, 20px auto);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.documentViewer__errorDetail {
|
|
79
|
+
display: block;
|
|
80
|
+
margin-top: 5px;
|
|
81
|
+
font-size: 0.875em;
|
|
82
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"documentViewer.interfaces.js","names":[],"sources":["../../../../src/widgets/documentViewer/documentViewer.interfaces.ts"],"sourcesContent":["import { ReactNode } from 'react';\n\nimport { IconSource } from '../../helpers/iconHelpers';\nimport { DocumentAnnotationsProps } from '../shared/documents/annotations/annotations.interfaces';\nimport {\n DocumentKind,\n DocumentLoadStatus,\n DocumentSource,\n LoadedDocument,\n ResolveResourceUrl\n} from '../shared/documents/documents.interfaces';\n\nexport type DocumentRendererProps = {\n document: DocumentSource;\n loaded: LoadedDocument;\n resolveResourceUrl: ResolveResourceUrl;\n headingOffset: number;\n /* eslint-disable-next-line no-unused-vars */\n onError: (error: unknown) => void;\n};\n\n/* eslint-disable-next-line no-unused-vars */\nexport type DocumentRenderer = (props: DocumentRendererProps) => ReactNode;\n\nexport type DocumentRenderers = Partial<Record<Exclude<DocumentKind, 'unsupported'>, DocumentRenderer>>;\n\nexport type DocumentViewerLabels = {\n loadingHeading: string;\n loadingMessage: string;\n loadError: string;\n unsupported: string;\n wordNotice: string;\n imageError: string;\n};\n\nexport type DocumentViewerCssClasses = {\n wrapper?: string;\n metadata?: string;\n frame?: string;\n content?: string;\n};\n\nexport type DocumentViewerProps = {\n id: string;\n document: DocumentSource;\n showHeader?: boolean;\n showMetadata?: boolean;\n headingLevel?: 1 | 2 | 3 | 4 | 5 | 6;\n // Rendered inside the header bar, e.g. download or export actions.\n headerActions?: ReactNode;\n metadataIcon?: IconSource;\n // Demote headings inside markdown documents so they nest beneath the viewer's own heading.\n contentHeadingOffset?: number;\n // Show the notice that Word previews are an approximation of the original layout.\n showWordNotice?: boolean;\n // Override renderers for supported kinds; unspecified kinds use the built-in renderers.\n renderers?: DocumentRenderers;\n // Refine or reject supported kinds; cannot enable files the built-in detector rejects.\n /* eslint-disable-next-line no-unused-vars */\n getDocumentKind?: (document: DocumentSource) => DocumentKind;\n // Rewrite links and images inside rendered content; defaults to resolving against the document URL.\n resolveResourceUrl?: ResolveResourceUrl;\n // PDFs are fetched and checked before display. Origins listed here (e.g. 'https://docs.example.com')\n // may instead be framed directly when their server does not allow cross-origin requests. Trusting an\n // origin trusts everything it serves and redirects to.\n trustedPdfOrigins?: string[];\n // Pinned comments on markdown and text documents. PDF and Word previews render in isolated frames\n // the page cannot reach into, so they cannot be annotated.\n annotations?: DocumentAnnotationsProps;\n labels?: Partial<DocumentViewerLabels>;\n customCssClasses?: DocumentViewerCssClasses;\n /* eslint-disable-next-line no-unused-vars */\n onStatusChange?: (status: DocumentLoadStatus, error?: unknown) => void;\n};\n"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["DocumentViewer","defaultDocumentViewerLabels"],"sources":["../../../../src/widgets/documentViewer/index.ts"],"sourcesContent":["export { DocumentViewer, defaultDocumentViewerLabels } from './DocumentViewer';\n\nexport type {\n DocumentRenderer,\n DocumentRendererProps,\n DocumentRenderers,\n DocumentViewerCssClasses,\n DocumentViewerLabels,\n DocumentViewerProps\n} from './documentViewer.interfaces';\n"],"mappings":"AAAA,SAASA,cAAc,EAAEC,2BAA2B,QAAQ,kBAAkB","ignoreList":[]}
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
export { ProcessLauncher } from './processLauncher';
|
|
4
|
+
export { DocumentViewer, defaultDocumentViewerLabels } from './documentViewer';
|
|
5
|
+
export { DocumentEditor, defaultDocumentEditorLabels } from './documentEditor';
|
|
6
|
+
export { DocumentComparer, defaultDocumentComparerLabels } from './documentComparer';
|
|
7
|
+
export { DocumentComments, defaultDocumentCommentsLabels } from './documentComments';
|
|
8
|
+
export { AnnotationLayer, createTextQuoteAnchor, createTextQuoteResolver, defaultDocumentAnnotationLabels, resolveTextQuoteAnchor } from './shared/documents/annotations';
|
|
9
|
+
export { fetchDocumentAsArrayBuffer, fetchDocumentAsText, getDocumentExtension, getDocumentFileName, getDocumentKind, resolveDocumentResource, useDocumentContent } from './shared/documents';
|
|
4
10
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["ProcessLauncher"],"sources":["../../../src/widgets/index.ts"],"sourcesContent":["'use client';\n\nexport { ProcessLauncher } from './processLauncher';\n\nexport type {\n ProcessLauncherProps,\n ProcessDefinition,\n ProcessLaunchButtonProps,\n ProcessProgressIndicatorProps,\n ProcessStatus,\n ProcessProgressUpdateMode,\n ProcessPushableStatus,\n ProcessProgressUpdate,\n ProcessProgressSubscriptionHandlers,\n ProcessProgressUnsubscribe,\n ProcessProgressSubscription,\n ProcessLauncherFetchProgressProps,\n ProcessLauncherSubscribeProgressProps,\n ProcessLauncherProgressProps\n} from './processLauncher';\n"],"mappings":"AAAA,YAAY;;AAEZ,SAASA,eAAe,QAAQ,mBAAmB","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"index.js","names":["ProcessLauncher","DocumentViewer","defaultDocumentViewerLabels","DocumentEditor","defaultDocumentEditorLabels","DocumentComparer","defaultDocumentComparerLabels","DocumentComments","defaultDocumentCommentsLabels","AnnotationLayer","createTextQuoteAnchor","createTextQuoteResolver","defaultDocumentAnnotationLabels","resolveTextQuoteAnchor","fetchDocumentAsArrayBuffer","fetchDocumentAsText","getDocumentExtension","getDocumentFileName","getDocumentKind","resolveDocumentResource","useDocumentContent"],"sources":["../../../src/widgets/index.ts"],"sourcesContent":["'use client';\n\nexport { ProcessLauncher } from './processLauncher';\n\nexport type {\n ProcessLauncherProps,\n ProcessDefinition,\n ProcessLaunchButtonProps,\n ProcessProgressIndicatorProps,\n ProcessStatus,\n ProcessProgressUpdateMode,\n ProcessPushableStatus,\n ProcessProgressUpdate,\n ProcessProgressSubscriptionHandlers,\n ProcessProgressUnsubscribe,\n ProcessProgressSubscription,\n ProcessLauncherFetchProgressProps,\n ProcessLauncherSubscribeProgressProps,\n ProcessLauncherProgressProps\n} from './processLauncher';\n\nexport { DocumentViewer, defaultDocumentViewerLabels } from './documentViewer';\nexport type {\n DocumentRenderer,\n DocumentRendererProps,\n DocumentRenderers,\n DocumentViewerCssClasses,\n DocumentViewerLabels,\n DocumentViewerProps\n} from './documentViewer';\n\nexport { DocumentEditor, defaultDocumentEditorLabels } from './documentEditor';\nexport type {\n DocumentEditorCssClasses,\n DocumentEditorLabels,\n DocumentEditorProps,\n MarkdownEditorImageUploadHandler,\n MarkdownEditorListType,\n MarkdownEditorToolbarItem,\n MarkdownEditorViewMode\n} from './documentEditor';\n\nexport { DocumentComparer, defaultDocumentComparerLabels } from './documentComparer';\nexport type {\n ComparisonDocument,\n DocumentComparerCssClasses,\n DocumentComparerLabels,\n DocumentComparerProps,\n DocumentComparerSaveUpdate,\n DocumentComparerView,\n DocumentDiffView\n} from './documentComparer';\n\nexport { DocumentComments, defaultDocumentCommentsLabels } from './documentComments';\nexport type {\n DocumentCommentsCssClasses,\n DocumentCommentsFilter,\n DocumentCommentsLabels,\n DocumentCommentsProps,\n NewDocumentComment\n} from './documentComments';\n\nexport {\n AnnotationLayer,\n createTextQuoteAnchor,\n createTextQuoteResolver,\n defaultDocumentAnnotationLabels,\n resolveTextQuoteAnchor\n} from './shared/documents/annotations';\nexport type {\n AnnotationLayerProps,\n DocumentAnchorStatus,\n DocumentAnnotationLabels,\n DocumentAnnotationsProps,\n DocumentComment,\n DocumentCommentAuthor,\n DocumentCommentReply,\n TextQuoteAnchor\n} from './shared/documents/annotations';\n\nexport {\n fetchDocumentAsArrayBuffer,\n fetchDocumentAsText,\n getDocumentExtension,\n getDocumentFileName,\n getDocumentKind,\n resolveDocumentResource,\n useDocumentContent\n} from './shared/documents';\nexport type {\n DocumentContentState,\n DocumentKind,\n DocumentLoadStatus,\n DocumentSource,\n LoadedDocument,\n ResolveResourceUrl\n} from './shared/documents';\n"],"mappings":"AAAA,YAAY;;AAEZ,SAASA,eAAe,QAAQ,mBAAmB;AAmBnD,SAASC,cAAc,EAAEC,2BAA2B,QAAQ,kBAAkB;AAU9E,SAASC,cAAc,EAAEC,2BAA2B,QAAQ,kBAAkB;AAW9E,SAASC,gBAAgB,EAAEC,6BAA6B,QAAQ,oBAAoB;AAWpF,SAASC,gBAAgB,EAAEC,6BAA6B,QAAQ,oBAAoB;AASpF,SACEC,eAAe,EACfC,qBAAqB,EACrBC,uBAAuB,EACvBC,+BAA+B,EAC/BC,sBAAsB,QACjB,gCAAgC;AAYvC,SACEC,0BAA0B,EAC1BC,mBAAmB,EACnBC,oBAAoB,EACpBC,mBAAmB,EACnBC,eAAe,EACfC,uBAAuB,EACvBC,kBAAkB,QACb,oBAAoB","ignoreList":[]}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { SimpleButton } from '../../../components';
|
|
3
|
+
import './toggleGroup.css';
|
|
4
|
+
// A set of mutually exclusive view toggles, e.g. side by side / differences, open / resolved.
|
|
5
|
+
export const ToggleGroup = ({
|
|
6
|
+
id,
|
|
7
|
+
legend,
|
|
8
|
+
options,
|
|
9
|
+
value,
|
|
10
|
+
onChange
|
|
11
|
+
}) => /*#__PURE__*/React.createElement("fieldset", {
|
|
12
|
+
className: "documentToggleGroup"
|
|
13
|
+
}, /*#__PURE__*/React.createElement("legend", {
|
|
14
|
+
className: "sr-only"
|
|
15
|
+
}, legend), options.map(option => /*#__PURE__*/React.createElement(SimpleButton, {
|
|
16
|
+
key: option.value,
|
|
17
|
+
id: `${id}_${option.value}`,
|
|
18
|
+
label: option.label,
|
|
19
|
+
ariaPressed: option.value === value,
|
|
20
|
+
cssClass: option.value === value ? 'button primary compact' : 'button secondary outline compact',
|
|
21
|
+
onClickHandler: () => onChange(option.value)
|
|
22
|
+
})));
|
|
23
|
+
export default ToggleGroup;
|
|
24
|
+
//# sourceMappingURL=ToggleGroup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ToggleGroup.js","names":["React","SimpleButton","ToggleGroup","id","legend","options","value","onChange","createElement","className","map","option","key","label","ariaPressed","cssClass","onClickHandler"],"sources":["../../../../../src/widgets/shared/documents/ToggleGroup.tsx"],"sourcesContent":["import React from 'react';\n\nimport { SimpleButton } from '../../../components';\n\nimport './toggleGroup.scss';\n\nexport type ToggleOption<T extends string> = { value: T; label: string };\n\nexport type ToggleGroupProps<T extends string> = {\n id: string;\n // Announced to assistive technology; the group has no visible title.\n legend: string;\n options: ToggleOption<T>[];\n value: T;\n /* eslint-disable-next-line no-unused-vars */\n onChange: (value: T) => void;\n};\n\n// A set of mutually exclusive view toggles, e.g. side by side / differences, open / resolved.\nexport const ToggleGroup = <T extends string>({ id, legend, options, value, onChange }: ToggleGroupProps<T>) => (\n <fieldset className=\"documentToggleGroup\">\n <legend className=\"sr-only\">{ legend }</legend>\n { options.map((option) => (\n <SimpleButton\n key={ option.value }\n id={ `${ id }_${ option.value }` }\n label={ option.label }\n ariaPressed={ option.value === value }\n cssClass={ option.value === value ? 'button primary compact' : 'button secondary outline compact' }\n onClickHandler={ () => onChange(option.value) }\n />\n )) }\n </fieldset>\n);\n\nexport default ToggleGroup;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AAEzB,SAASC,YAAY,QAAQ,qBAAqB;AAElD,OAAO,oBAAoB;AAc3B;AACA,OAAO,MAAMC,WAAW,GAAGA,CAAmB;EAAEC,EAAE;EAAEC,MAAM;EAAEC,OAAO;EAAEC,KAAK;EAAEC;AAA8B,CAAC,kBACzGP,KAAA,CAAAQ,aAAA;EAAUC,SAAS,EAAC;AAAqB,gBACvCT,KAAA,CAAAQ,aAAA;EAAQC,SAAS,EAAC;AAAS,GAAGL,MAAgB,CAAC,EAC7CC,OAAO,CAACK,GAAG,CAAEC,MAAM,iBACnBX,KAAA,CAAAQ,aAAA,CAACP,YAAY;EACXW,GAAG,EAAGD,MAAM,CAACL,KAAO;EACpBH,EAAE,EAAG,GAAIA,EAAE,IAAMQ,MAAM,CAACL,KAAK,EAAK;EAClCO,KAAK,EAAGF,MAAM,CAACE,KAAO;EACtBC,WAAW,EAAGH,MAAM,CAACL,KAAK,KAAKA,KAAO;EACtCS,QAAQ,EAAGJ,MAAM,CAACL,KAAK,KAAKA,KAAK,GAAG,wBAAwB,GAAG,kCAAoC;EACnGU,cAAc,EAAGA,CAAA,KAAMT,QAAQ,CAACI,MAAM,CAACL,KAAK;AAAG,CAChD,CACF,CACO,CACX;AAED,eAAeJ,WAAW","ignoreList":[]}
|
|
File without changes
|
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import React, { useCallback, useEffect, useId, useLayoutEffect, useMemo, useRef, useState } from 'react';
|
|
4
|
+
import { SimpleButton } from '../../../../components';
|
|
5
|
+
import { getPreferredScrollBehavior } from '../../../../helpers/interactionsHelper';
|
|
6
|
+
import { defaultDocumentAnnotationLabels, getVisibleComments } from './annotations.interfaces';
|
|
7
|
+
import { clearInstanceHighlights, setInstanceHighlights } from './highlightRegistry';
|
|
8
|
+
import { buildTextIndex, offsetsFromRange, rangeFromOffsets } from './textIndex';
|
|
9
|
+
import { createTextQuoteAnchor, createTextQuoteResolver, resolveTextQuoteAnchor } from './textQuoteAnchor';
|
|
10
|
+
import './annotationLayer.css';
|
|
11
|
+
|
|
12
|
+
// A selection made somewhere the layer cannot see through the DOM, e.g. the markdown source editor.
|
|
13
|
+
|
|
14
|
+
const sameStatus = (first, second) => first !== null && Object.keys(first).length === Object.keys(second).length && Object.entries(second).every(([commentId, attached]) => first[commentId] === attached);
|
|
15
|
+
|
|
16
|
+
// Geometry changes with every layout, so positions are passed to CSS as custom properties.
|
|
17
|
+
const positionStyle = ({
|
|
18
|
+
top,
|
|
19
|
+
left
|
|
20
|
+
}) => ({
|
|
21
|
+
'--documentAnnotationTop': `${top}px`,
|
|
22
|
+
'--documentAnnotationLeft': `${left}px`
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
/*
|
|
26
|
+
AnnotationLayer pins comments to the text of its children. It highlights each comment's quoted
|
|
27
|
+
text, places a bubble at the end of it, offers a "Comment" action for new selections, and reports
|
|
28
|
+
which comments could still be found. It never changes the annotated DOM, so it can wrap content
|
|
29
|
+
owned by another library such as the rich-text editor.
|
|
30
|
+
*/
|
|
31
|
+
export const AnnotationLayer = ({
|
|
32
|
+
id,
|
|
33
|
+
children,
|
|
34
|
+
comments,
|
|
35
|
+
selectedCommentId,
|
|
36
|
+
canComment = false,
|
|
37
|
+
showResolved = false,
|
|
38
|
+
onRequestComment,
|
|
39
|
+
onSelectComment,
|
|
40
|
+
onAnchorStatusChange,
|
|
41
|
+
labels: customLabels,
|
|
42
|
+
getTextRoot,
|
|
43
|
+
externalSelection = null,
|
|
44
|
+
onExternalSelectionConsumed
|
|
45
|
+
}) => {
|
|
46
|
+
const labels = useMemo(() => ({
|
|
47
|
+
...defaultDocumentAnnotationLabels,
|
|
48
|
+
...customLabels
|
|
49
|
+
}), [customLabels]);
|
|
50
|
+
const instanceId = useId();
|
|
51
|
+
const containerRef = useRef(null);
|
|
52
|
+
const contentRef = useRef(null);
|
|
53
|
+
const reportedStatusRef = useRef(null);
|
|
54
|
+
const frameRef = useRef(null);
|
|
55
|
+
const [markers, setMarkers] = useState([]);
|
|
56
|
+
const [domSelection, setDomSelection] = useState(null);
|
|
57
|
+
const visibleComments = useMemo(() => getVisibleComments(comments, showResolved), [comments, showResolved]);
|
|
58
|
+
const findTextRoot = useCallback(() => {
|
|
59
|
+
const content = contentRef.current;
|
|
60
|
+
if (!content) {
|
|
61
|
+
return null;
|
|
62
|
+
}
|
|
63
|
+
return getTextRoot ? getTextRoot(content) : content;
|
|
64
|
+
}, [getTextRoot]);
|
|
65
|
+
|
|
66
|
+
// Converts viewport coordinates to coordinates within the layer, where the overlay is positioned.
|
|
67
|
+
const toLayerPosition = useCallback((viewportTop, viewportLeft) => {
|
|
68
|
+
const container = containerRef.current;
|
|
69
|
+
if (!container) {
|
|
70
|
+
return null;
|
|
71
|
+
}
|
|
72
|
+
const containerRect = container.getBoundingClientRect();
|
|
73
|
+
return {
|
|
74
|
+
top: viewportTop - containerRect.top,
|
|
75
|
+
left: viewportLeft - containerRect.left
|
|
76
|
+
};
|
|
77
|
+
}, []);
|
|
78
|
+
const updateAnnotations = useCallback(() => {
|
|
79
|
+
const root = findTextRoot();
|
|
80
|
+
if (!root) {
|
|
81
|
+
setMarkers([]);
|
|
82
|
+
clearInstanceHighlights(instanceId);
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
const index = buildTextIndex(root);
|
|
86
|
+
const status = {};
|
|
87
|
+
const commentRanges = [];
|
|
88
|
+
const selectedRanges = [];
|
|
89
|
+
const nextMarkers = [];
|
|
90
|
+
const resolveAnchor = createTextQuoteResolver(index.text);
|
|
91
|
+
visibleComments.forEach(comment => {
|
|
92
|
+
const match = comment.anchor ? resolveAnchor(comment.anchor) : null;
|
|
93
|
+
const range = match ? rangeFromOffsets(index, match.start, match.end) : null;
|
|
94
|
+
status[comment.id] = range !== null;
|
|
95
|
+
if (!range) {
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
(comment.id === selectedCommentId ? selectedRanges : commentRanges).push(range);
|
|
99
|
+
// Hidden content (e.g. the rich-text view while source mode is shown) has no visible rects.
|
|
100
|
+
const lastRect = Array.from(range.getClientRects?.() ?? []).filter(rect => rect.width || rect.height).pop();
|
|
101
|
+
const position = lastRect ? toLayerPosition(lastRect.top, lastRect.right) : null;
|
|
102
|
+
if (position) {
|
|
103
|
+
nextMarkers.push({
|
|
104
|
+
...position,
|
|
105
|
+
commentId: comment.id,
|
|
106
|
+
authorName: comment.author.name
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
setInstanceHighlights(instanceId, {
|
|
111
|
+
comments: commentRanges,
|
|
112
|
+
selected: selectedRanges
|
|
113
|
+
});
|
|
114
|
+
setMarkers(nextMarkers);
|
|
115
|
+
if (!sameStatus(reportedStatusRef.current, status)) {
|
|
116
|
+
reportedStatusRef.current = status;
|
|
117
|
+
onAnchorStatusChange?.(status);
|
|
118
|
+
}
|
|
119
|
+
}, [findTextRoot, instanceId, visibleComments, selectedCommentId, toLayerPosition, onAnchorStatusChange]);
|
|
120
|
+
const scheduleUpdate = useCallback(() => {
|
|
121
|
+
if (frameRef.current !== null) {
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
frameRef.current = window.requestAnimationFrame(() => {
|
|
125
|
+
frameRef.current = null;
|
|
126
|
+
updateAnnotations();
|
|
127
|
+
});
|
|
128
|
+
}, [updateAnnotations]);
|
|
129
|
+
useLayoutEffect(() => {
|
|
130
|
+
updateAnnotations();
|
|
131
|
+
}, [updateAnnotations]);
|
|
132
|
+
|
|
133
|
+
// Content can change without React knowing: lazy engines finish loading, the editor applies edits.
|
|
134
|
+
useEffect(() => {
|
|
135
|
+
const container = containerRef.current;
|
|
136
|
+
const content = contentRef.current;
|
|
137
|
+
if (!container || !content) {
|
|
138
|
+
return undefined;
|
|
139
|
+
}
|
|
140
|
+
const mutationObserver = new MutationObserver(scheduleUpdate);
|
|
141
|
+
mutationObserver.observe(content, {
|
|
142
|
+
subtree: true,
|
|
143
|
+
childList: true,
|
|
144
|
+
characterData: true
|
|
145
|
+
});
|
|
146
|
+
const resizeObserver = typeof ResizeObserver === 'undefined' ? null : new ResizeObserver(scheduleUpdate);
|
|
147
|
+
resizeObserver?.observe(container);
|
|
148
|
+
window.addEventListener('resize', scheduleUpdate);
|
|
149
|
+
return () => {
|
|
150
|
+
mutationObserver.disconnect();
|
|
151
|
+
resizeObserver?.disconnect();
|
|
152
|
+
window.removeEventListener('resize', scheduleUpdate);
|
|
153
|
+
if (frameRef.current !== null) {
|
|
154
|
+
window.cancelAnimationFrame(frameRef.current);
|
|
155
|
+
frameRef.current = null;
|
|
156
|
+
}
|
|
157
|
+
};
|
|
158
|
+
}, [scheduleUpdate]);
|
|
159
|
+
useEffect(() => () => clearInstanceHighlights(instanceId), [instanceId]);
|
|
160
|
+
useEffect(() => {
|
|
161
|
+
if (!canComment) {
|
|
162
|
+
setDomSelection(null);
|
|
163
|
+
return undefined;
|
|
164
|
+
}
|
|
165
|
+
const handleSelectionChange = () => {
|
|
166
|
+
const root = findTextRoot();
|
|
167
|
+
const selection = document.getSelection();
|
|
168
|
+
if (!root || !selection || selection.rangeCount === 0 || selection.isCollapsed) {
|
|
169
|
+
setDomSelection(null);
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
172
|
+
const range = selection.getRangeAt(0);
|
|
173
|
+
if (!root.contains(range.commonAncestorContainer)) {
|
|
174
|
+
setDomSelection(null);
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
const index = buildTextIndex(root);
|
|
178
|
+
const {
|
|
179
|
+
start,
|
|
180
|
+
end
|
|
181
|
+
} = offsetsFromRange(index, range);
|
|
182
|
+
const anchor = createTextQuoteAnchor(index.text, start, end);
|
|
183
|
+
const lastRect = Array.from(range.getClientRects?.() ?? []).pop() ?? range.getBoundingClientRect?.();
|
|
184
|
+
const position = anchor && lastRect ? toLayerPosition(lastRect.bottom, lastRect.right) : null;
|
|
185
|
+
setDomSelection(anchor && position ? {
|
|
186
|
+
...position,
|
|
187
|
+
anchor
|
|
188
|
+
} : null);
|
|
189
|
+
};
|
|
190
|
+
document.addEventListener('selectionchange', handleSelectionChange);
|
|
191
|
+
return () => document.removeEventListener('selectionchange', handleSelectionChange);
|
|
192
|
+
}, [canComment, findTextRoot, toLayerPosition]);
|
|
193
|
+
|
|
194
|
+
// Read through a ref so only a change of selected comment scrolls; comment edits must not move the reader.
|
|
195
|
+
const latestRef = useRef({
|
|
196
|
+
visibleComments,
|
|
197
|
+
findTextRoot
|
|
198
|
+
});
|
|
199
|
+
latestRef.current = {
|
|
200
|
+
visibleComments,
|
|
201
|
+
findTextRoot
|
|
202
|
+
};
|
|
203
|
+
|
|
204
|
+
// Scroll a newly selected comment into view, e.g. after it is chosen in the comments panel.
|
|
205
|
+
useEffect(() => {
|
|
206
|
+
const comment = latestRef.current.visibleComments.find(candidate => candidate.id === selectedCommentId);
|
|
207
|
+
const root = latestRef.current.findTextRoot();
|
|
208
|
+
if (!comment?.anchor || !root) {
|
|
209
|
+
return;
|
|
210
|
+
}
|
|
211
|
+
const index = buildTextIndex(root);
|
|
212
|
+
const match = resolveTextQuoteAnchor(index.text, comment.anchor);
|
|
213
|
+
const range = match ? rangeFromOffsets(index, match.start, match.end) : null;
|
|
214
|
+
range?.startContainer.parentElement?.scrollIntoView?.({
|
|
215
|
+
block: 'center',
|
|
216
|
+
behavior: getPreferredScrollBehavior()
|
|
217
|
+
});
|
|
218
|
+
}, [selectedCommentId]);
|
|
219
|
+
const externalPosition = externalSelection ? toLayerPosition(externalSelection.rect.bottom, externalSelection.rect.right) : null;
|
|
220
|
+
const pending = externalSelection && externalPosition ? {
|
|
221
|
+
...externalPosition,
|
|
222
|
+
anchor: externalSelection.anchor
|
|
223
|
+
} : domSelection;
|
|
224
|
+
const handleRequestComment = () => {
|
|
225
|
+
if (!pending) {
|
|
226
|
+
return;
|
|
227
|
+
}
|
|
228
|
+
onRequestComment?.(pending.anchor);
|
|
229
|
+
if (externalSelection) {
|
|
230
|
+
onExternalSelectionConsumed?.();
|
|
231
|
+
} else {
|
|
232
|
+
document.getSelection()?.removeAllRanges();
|
|
233
|
+
}
|
|
234
|
+
setDomSelection(null);
|
|
235
|
+
};
|
|
236
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
237
|
+
id: id,
|
|
238
|
+
className: "documentAnnotations",
|
|
239
|
+
ref: containerRef
|
|
240
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
241
|
+
className: "documentAnnotations__content",
|
|
242
|
+
ref: contentRef
|
|
243
|
+
}, children), /*#__PURE__*/React.createElement("div", {
|
|
244
|
+
className: "documentAnnotations__overlay"
|
|
245
|
+
}, markers.map(marker => /*#__PURE__*/React.createElement("div", {
|
|
246
|
+
key: marker.commentId,
|
|
247
|
+
className: "documentAnnotations__bubble",
|
|
248
|
+
style: positionStyle(marker)
|
|
249
|
+
}, /*#__PURE__*/React.createElement(SimpleButton, {
|
|
250
|
+
id: `${id}_bubble_${marker.commentId}`,
|
|
251
|
+
label: labels.openComment(marker.authorName),
|
|
252
|
+
hideLabel: true,
|
|
253
|
+
leftIcon: "bubbles4",
|
|
254
|
+
ariaPressed: marker.commentId === selectedCommentId,
|
|
255
|
+
cssClass: `button icon-only compact documentAnnotations__bubbleButton ${marker.commentId === selectedCommentId ? 'documentAnnotations__bubbleButton--selected' : ''}`,
|
|
256
|
+
onClickHandler: () => onSelectComment?.(marker.commentId)
|
|
257
|
+
}))), canComment && pending &&
|
|
258
|
+
/*#__PURE__*/
|
|
259
|
+
// Pressing the button must not clear the text selection it acts on.
|
|
260
|
+
React.createElement("div", {
|
|
261
|
+
className: "documentAnnotations__trigger",
|
|
262
|
+
style: positionStyle(pending),
|
|
263
|
+
onMouseDown: event => event.preventDefault()
|
|
264
|
+
}, /*#__PURE__*/React.createElement(SimpleButton, {
|
|
265
|
+
id: `${id}_addComment`,
|
|
266
|
+
label: labels.addComment,
|
|
267
|
+
leftIcon: "bubble",
|
|
268
|
+
cssClass: "button primary compact documentAnnotations__triggerButton",
|
|
269
|
+
onClickHandler: handleRequestComment
|
|
270
|
+
}))));
|
|
271
|
+
};
|
|
272
|
+
export default AnnotationLayer;
|
|
273
|
+
//# sourceMappingURL=AnnotationLayer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AnnotationLayer.js","names":["React","useCallback","useEffect","useId","useLayoutEffect","useMemo","useRef","useState","SimpleButton","getPreferredScrollBehavior","defaultDocumentAnnotationLabels","getVisibleComments","clearInstanceHighlights","setInstanceHighlights","buildTextIndex","offsetsFromRange","rangeFromOffsets","createTextQuoteAnchor","createTextQuoteResolver","resolveTextQuoteAnchor","sameStatus","first","second","Object","keys","length","entries","every","commentId","attached","positionStyle","top","left","AnnotationLayer","id","children","comments","selectedCommentId","canComment","showResolved","onRequestComment","onSelectComment","onAnchorStatusChange","labels","customLabels","getTextRoot","externalSelection","onExternalSelectionConsumed","instanceId","containerRef","contentRef","reportedStatusRef","frameRef","markers","setMarkers","domSelection","setDomSelection","visibleComments","findTextRoot","content","current","toLayerPosition","viewportTop","viewportLeft","container","containerRect","getBoundingClientRect","updateAnnotations","root","index","status","commentRanges","selectedRanges","nextMarkers","resolveAnchor","text","forEach","comment","match","anchor","range","start","end","push","lastRect","Array","from","getClientRects","filter","rect","width","height","pop","position","right","authorName","author","name","selected","scheduleUpdate","window","requestAnimationFrame","undefined","mutationObserver","MutationObserver","observe","subtree","childList","characterData","resizeObserver","ResizeObserver","addEventListener","disconnect","removeEventListener","cancelAnimationFrame","handleSelectionChange","selection","document","getSelection","rangeCount","isCollapsed","getRangeAt","contains","commonAncestorContainer","bottom","latestRef","find","candidate","startContainer","parentElement","scrollIntoView","block","behavior","externalPosition","pending","handleRequestComment","removeAllRanges","createElement","className","ref","map","marker","key","style","label","openComment","hideLabel","leftIcon","ariaPressed","cssClass","onClickHandler","onMouseDown","event","preventDefault","addComment"],"sources":["../../../../../../src/widgets/shared/documents/annotations/AnnotationLayer.tsx"],"sourcesContent":["'use client';\n\nimport React, {\n CSSProperties,\n FC,\n ReactNode,\n useCallback,\n useEffect,\n useId,\n useLayoutEffect,\n useMemo,\n useRef,\n useState\n} from 'react';\n\nimport { SimpleButton } from '../../../../components';\nimport { getPreferredScrollBehavior } from '../../../../helpers/interactionsHelper';\nimport {\n defaultDocumentAnnotationLabels,\n DocumentAnchorStatus,\n DocumentAnnotationsProps,\n getVisibleComments,\n TextQuoteAnchor\n} from './annotations.interfaces';\nimport { clearInstanceHighlights, setInstanceHighlights } from './highlightRegistry';\nimport { buildTextIndex, offsetsFromRange, rangeFromOffsets } from './textIndex';\nimport { createTextQuoteAnchor, createTextQuoteResolver, resolveTextQuoteAnchor } from './textQuoteAnchor';\n\nimport './annotationLayer.scss';\n\ntype Position = { top: number; left: number };\n\ntype CommentMarker = Position & { commentId: string; authorName: string };\n\nexport type PendingSelection = Position & { anchor: TextQuoteAnchor };\n\n// A selection made somewhere the layer cannot see through the DOM, e.g. the markdown source editor.\nexport type ExternalSelection = { anchor: TextQuoteAnchor; rect: { bottom: number; right: number } } | null;\n\nexport type AnnotationLayerProps = DocumentAnnotationsProps & {\n id: string;\n children: ReactNode;\n // Locates the element holding the document text inside the layer's content; defaults to the content.\n /* eslint-disable-next-line no-unused-vars */\n getTextRoot?: (content: HTMLElement) => HTMLElement | null;\n externalSelection?: ExternalSelection;\n onExternalSelectionConsumed?: () => void;\n};\n\nconst sameStatus = (first: DocumentAnchorStatus | null, second: DocumentAnchorStatus): boolean =>\n first !== null && Object.keys(first).length === Object.keys(second).length\n && Object.entries(second).every(([commentId, attached]) => first[commentId] === attached);\n\n// Geometry changes with every layout, so positions are passed to CSS as custom properties.\nconst positionStyle = ({ top, left }: Position): CSSProperties =>\n ({ '--documentAnnotationTop': `${ top }px`, '--documentAnnotationLeft': `${ left }px` } as CSSProperties);\n\n/*\n AnnotationLayer pins comments to the text of its children. It highlights each comment's quoted\n text, places a bubble at the end of it, offers a \"Comment\" action for new selections, and reports\n which comments could still be found. It never changes the annotated DOM, so it can wrap content\n owned by another library such as the rich-text editor.\n */\nexport const AnnotationLayer: FC<AnnotationLayerProps> = (\n {\n id,\n children,\n comments,\n selectedCommentId,\n canComment = false,\n showResolved = false,\n onRequestComment,\n onSelectComment,\n onAnchorStatusChange,\n labels: customLabels,\n getTextRoot,\n externalSelection = null,\n onExternalSelectionConsumed\n }\n) => {\n const labels = useMemo(() => ({ ...defaultDocumentAnnotationLabels, ...customLabels }), [customLabels]);\n const instanceId = useId();\n const containerRef = useRef<HTMLDivElement>(null);\n const contentRef = useRef<HTMLDivElement>(null);\n const reportedStatusRef = useRef<DocumentAnchorStatus | null>(null);\n const frameRef = useRef<number | null>(null);\n const [markers, setMarkers] = useState<CommentMarker[]>([]);\n const [domSelection, setDomSelection] = useState<PendingSelection | null>(null);\n\n const visibleComments = useMemo(() => getVisibleComments(comments, showResolved), [comments, showResolved]);\n\n const findTextRoot = useCallback((): HTMLElement | null => {\n const content = contentRef.current;\n if (!content) {\n return null;\n }\n return getTextRoot ? getTextRoot(content) : content;\n }, [getTextRoot]);\n\n // Converts viewport coordinates to coordinates within the layer, where the overlay is positioned.\n const toLayerPosition = useCallback((viewportTop: number, viewportLeft: number): Position | null => {\n const container = containerRef.current;\n if (!container) {\n return null;\n }\n const containerRect = container.getBoundingClientRect();\n return { top: viewportTop - containerRect.top, left: viewportLeft - containerRect.left };\n }, []);\n\n const updateAnnotations = useCallback(() => {\n const root = findTextRoot();\n if (!root) {\n setMarkers([]);\n clearInstanceHighlights(instanceId);\n return;\n }\n const index = buildTextIndex(root);\n const status: DocumentAnchorStatus = {};\n const commentRanges: Range[] = [];\n const selectedRanges: Range[] = [];\n const nextMarkers: CommentMarker[] = [];\n\n const resolveAnchor = createTextQuoteResolver(index.text);\n visibleComments.forEach((comment) => {\n const match = comment.anchor ? resolveAnchor(comment.anchor) : null;\n const range = match ? rangeFromOffsets(index, match.start, match.end) : null;\n status[comment.id] = range !== null;\n if (!range) {\n return;\n }\n (comment.id === selectedCommentId ? selectedRanges : commentRanges).push(range);\n // Hidden content (e.g. the rich-text view while source mode is shown) has no visible rects.\n const lastRect = Array.from(range.getClientRects?.() ?? []).filter((rect) => rect.width || rect.height).pop();\n const position = lastRect ? toLayerPosition(lastRect.top, lastRect.right) : null;\n if (position) {\n nextMarkers.push({ ...position, commentId: comment.id, authorName: comment.author.name });\n }\n });\n\n setInstanceHighlights(instanceId, { comments: commentRanges, selected: selectedRanges });\n setMarkers(nextMarkers);\n if (!sameStatus(reportedStatusRef.current, status)) {\n reportedStatusRef.current = status;\n onAnchorStatusChange?.(status);\n }\n }, [findTextRoot, instanceId, visibleComments, selectedCommentId, toLayerPosition, onAnchorStatusChange]);\n\n const scheduleUpdate = useCallback(() => {\n if (frameRef.current !== null) {\n return;\n }\n frameRef.current = window.requestAnimationFrame(() => {\n frameRef.current = null;\n updateAnnotations();\n });\n }, [updateAnnotations]);\n\n useLayoutEffect(() => {\n updateAnnotations();\n }, [updateAnnotations]);\n\n // Content can change without React knowing: lazy engines finish loading, the editor applies edits.\n useEffect(() => {\n const container = containerRef.current;\n const content = contentRef.current;\n if (!container || !content) {\n return undefined;\n }\n const mutationObserver = new MutationObserver(scheduleUpdate);\n mutationObserver.observe(content, { subtree: true, childList: true, characterData: true });\n const resizeObserver = typeof ResizeObserver === 'undefined' ? null : new ResizeObserver(scheduleUpdate);\n resizeObserver?.observe(container);\n window.addEventListener('resize', scheduleUpdate);\n return () => {\n mutationObserver.disconnect();\n resizeObserver?.disconnect();\n window.removeEventListener('resize', scheduleUpdate);\n if (frameRef.current !== null) {\n window.cancelAnimationFrame(frameRef.current);\n frameRef.current = null;\n }\n };\n }, [scheduleUpdate]);\n\n useEffect(() => () => clearInstanceHighlights(instanceId), [instanceId]);\n\n useEffect(() => {\n if (!canComment) {\n setDomSelection(null);\n return undefined;\n }\n const handleSelectionChange = () => {\n const root = findTextRoot();\n const selection = document.getSelection();\n if (!root || !selection || selection.rangeCount === 0 || selection.isCollapsed) {\n setDomSelection(null);\n return;\n }\n const range = selection.getRangeAt(0);\n if (!root.contains(range.commonAncestorContainer)) {\n setDomSelection(null);\n return;\n }\n const index = buildTextIndex(root);\n const { start, end } = offsetsFromRange(index, range);\n const anchor = createTextQuoteAnchor(index.text, start, end);\n const lastRect = Array.from(range.getClientRects?.() ?? []).pop() ?? range.getBoundingClientRect?.();\n const position = anchor && lastRect ? toLayerPosition(lastRect.bottom, lastRect.right) : null;\n setDomSelection(anchor && position ? { ...position, anchor } : null);\n };\n document.addEventListener('selectionchange', handleSelectionChange);\n return () => document.removeEventListener('selectionchange', handleSelectionChange);\n }, [canComment, findTextRoot, toLayerPosition]);\n\n // Read through a ref so only a change of selected comment scrolls; comment edits must not move the reader.\n const latestRef = useRef({ visibleComments, findTextRoot });\n latestRef.current = { visibleComments, findTextRoot };\n\n // Scroll a newly selected comment into view, e.g. after it is chosen in the comments panel.\n useEffect(() => {\n const comment = latestRef.current.visibleComments.find((candidate) => candidate.id === selectedCommentId);\n const root = latestRef.current.findTextRoot();\n if (!comment?.anchor || !root) {\n return;\n }\n const index = buildTextIndex(root);\n const match = resolveTextQuoteAnchor(index.text, comment.anchor);\n const range = match ? rangeFromOffsets(index, match.start, match.end) : null;\n range?.startContainer.parentElement?.scrollIntoView?.({ block: 'center', behavior: getPreferredScrollBehavior() });\n }, [selectedCommentId]);\n\n const externalPosition = externalSelection ? toLayerPosition(externalSelection.rect.bottom, externalSelection.rect.right) : null;\n const pending: PendingSelection | null = externalSelection && externalPosition\n ? { ...externalPosition, anchor: externalSelection.anchor }\n : domSelection;\n\n const handleRequestComment = () => {\n if (!pending) {\n return;\n }\n onRequestComment?.(pending.anchor);\n if (externalSelection) {\n onExternalSelectionConsumed?.();\n } else {\n document.getSelection()?.removeAllRanges();\n }\n setDomSelection(null);\n };\n\n return (\n <div id={ id } className=\"documentAnnotations\" ref={ containerRef }>\n <div className=\"documentAnnotations__content\" ref={ contentRef }>\n { children }\n </div>\n <div className=\"documentAnnotations__overlay\">\n { markers.map((marker) => (\n <div key={ marker.commentId } className=\"documentAnnotations__bubble\" style={ positionStyle(marker) }>\n <SimpleButton\n id={ `${ id }_bubble_${ marker.commentId }` }\n label={ labels.openComment(marker.authorName) }\n hideLabel\n leftIcon=\"bubbles4\"\n ariaPressed={ marker.commentId === selectedCommentId }\n cssClass={ `button icon-only compact documentAnnotations__bubbleButton ${\n marker.commentId === selectedCommentId ? 'documentAnnotations__bubbleButton--selected' : '' }` }\n onClickHandler={ () => onSelectComment?.(marker.commentId) }\n />\n </div>\n )) }\n { canComment && pending && (\n // Pressing the button must not clear the text selection it acts on.\n <div\n className=\"documentAnnotations__trigger\"\n style={ positionStyle(pending) }\n onMouseDown={ (event) => event.preventDefault() }\n >\n <SimpleButton\n id={ `${ id }_addComment` }\n label={ labels.addComment }\n leftIcon=\"bubble\"\n cssClass=\"button primary compact documentAnnotations__triggerButton\"\n onClickHandler={ handleRequestComment }\n />\n </div>\n ) }\n </div>\n </div>\n );\n};\n\nexport default AnnotationLayer;\n"],"mappings":"AAAA,YAAY;;AAEZ,OAAOA,KAAK,IAIVC,WAAW,EACXC,SAAS,EACTC,KAAK,EACLC,eAAe,EACfC,OAAO,EACPC,MAAM,EACNC,QAAQ,QACH,OAAO;AAEd,SAASC,YAAY,QAAQ,wBAAwB;AACrD,SAASC,0BAA0B,QAAQ,wCAAwC;AACnF,SACEC,+BAA+B,EAG/BC,kBAAkB,QAEb,0BAA0B;AACjC,SAASC,uBAAuB,EAAEC,qBAAqB,QAAQ,qBAAqB;AACpF,SAASC,cAAc,EAAEC,gBAAgB,EAAEC,gBAAgB,QAAQ,aAAa;AAChF,SAASC,qBAAqB,EAAEC,uBAAuB,EAAEC,sBAAsB,QAAQ,mBAAmB;AAE1G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GAAIA,EAAE,aAAgB;IAC3B8G,KAAK,EAAGrG,MAAM,CAAC+G,UAAY;IAC3BP,QAAQ,EAAC,QAAQ;IACjBE,QAAQ,EAAC,2DAA2D;IACpEC,cAAc,EAAGf;EAAsB,CACxC,CACE,CAEJ,CACF,CAAC;AAEV,CAAC;AAED,eAAetG,eAAe","ignoreList":[]}
|
|
File without changes
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
.documentAnnotations {
|
|
2
|
+
position: relative;
|
|
3
|
+
display: flex;
|
|
4
|
+
flex: 1;
|
|
5
|
+
flex-direction: column;
|
|
6
|
+
min-width: 0;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.documentAnnotations__content {
|
|
10
|
+
display: flex;
|
|
11
|
+
flex: 1;
|
|
12
|
+
flex-direction: column;
|
|
13
|
+
min-width: 0;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.documentAnnotations__overlay {
|
|
17
|
+
position: absolute;
|
|
18
|
+
inset: 0;
|
|
19
|
+
pointer-events: none;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.documentAnnotations__bubble,
|
|
23
|
+
.documentAnnotations__trigger {
|
|
24
|
+
position: absolute;
|
|
25
|
+
top: var(--documentAnnotationTop);
|
|
26
|
+
left: var(--documentAnnotationLeft);
|
|
27
|
+
z-index: 2;
|
|
28
|
+
pointer-events: auto;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.documentAnnotations__bubble {
|
|
32
|
+
transform: translate(var(--documentAnnotationBubbleOffset, 5px), -50%);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.documentAnnotations__bubbleButton {
|
|
36
|
+
background: var(--documentAnnotationBubbleBg, var(--documentBg, #fff));
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.documentAnnotations__bubbleButton--selected {
|
|
40
|
+
background: var(--documentAnnotationBubbleSelectedBg, var(--primaryButtonBg, currentColor));
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.documentAnnotations__trigger {
|
|
44
|
+
transform: translate(-100%, var(--documentAnnotationTriggerOffset, 5px));
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
::highlight(documentComment) {
|
|
48
|
+
background-color: var(--documentCommentHighlightBg, color-mix(in srgb, var(--statusWarnColor, #fc0) 30%, transparent));
|
|
49
|
+
color: var(--documentCommentHighlightFgColor, inherit);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
::highlight(documentCommentSelected) {
|
|
53
|
+
background-color: var(--documentCommentSelectedHighlightBg, color-mix(in srgb, var(--statusWarnColor, #fc0) 60%, transparent));
|
|
54
|
+
color: var(--documentCommentSelectedHighlightFgColor, inherit);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.documentAnnotations__sourceHighlight {
|
|
58
|
+
background-color: var(--documentCommentHighlightBg, color-mix(in srgb, var(--statusWarnColor, #fc0) 30%, transparent));
|
|
59
|
+
border-bottom: var(--documentAnnotationSourceHighlightBorder, 2px solid var(--statusWarnColor, #fc0));
|
|
60
|
+
cursor: pointer;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.documentAnnotations__sourceHighlight--selected {
|
|
64
|
+
background-color: var(--documentCommentSelectedHighlightBg, color-mix(in srgb, var(--statusWarnColor, #fc0) 60%, transparent));
|
|
65
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/*
|
|
2
|
+
A comment is pinned to text by quoting it rather than by character positions, so it can be found
|
|
3
|
+
again after the document is edited, re-rendered or opened in a different view (rendered, rich-text
|
|
4
|
+
or markdown source). See textQuoteAnchor.ts.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
// Whether each pinned comment's quoted text was found in the document, keyed by comment id.
|
|
8
|
+
|
|
9
|
+
export const defaultDocumentAnnotationLabels = {
|
|
10
|
+
addComment: 'Comment',
|
|
11
|
+
openComment: authorName => `Open comment by ${authorName}`
|
|
12
|
+
};
|
|
13
|
+
export const getVisibleComments = (comments, showResolved = false) => comments.filter(comment => comment.anchor && (showResolved || !comment.resolved));
|
|
14
|
+
//# sourceMappingURL=annotations.interfaces.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"annotations.interfaces.js","names":["defaultDocumentAnnotationLabels","addComment","openComment","authorName","getVisibleComments","comments","showResolved","filter","comment","anchor","resolved"],"sources":["../../../../../../src/widgets/shared/documents/annotations/annotations.interfaces.ts"],"sourcesContent":["/*\n A comment is pinned to text by quoting it rather than by character positions, so it can be found\n again after the document is edited, re-rendered or opened in a different view (rendered, rich-text\n or markdown source). See textQuoteAnchor.ts.\n */\nexport type TextQuoteAnchor = {\n exact: string;\n // Text immediately before and after the quote, used to tell repeated phrases apart.\n prefix: string;\n suffix: string;\n // Where the quote started when it was created; a tiebreak only, since views count text differently.\n start?: number;\n};\n\nexport type DocumentCommentAuthor = {\n id: string;\n name: string;\n};\n\nexport type DocumentCommentReply = {\n id: string;\n author: DocumentCommentAuthor;\n content: string;\n createdAt: string;\n};\n\nexport type DocumentComment = {\n id: string;\n author: DocumentCommentAuthor;\n content: string;\n createdAt: string;\n resolved?: boolean;\n // Absent for general comments about the whole document.\n anchor?: TextQuoteAnchor;\n replies?: DocumentCommentReply[];\n};\n\n// Whether each pinned comment's quoted text was found in the document, keyed by comment id.\nexport type DocumentAnchorStatus = Record<string, boolean>;\n\nexport type DocumentAnnotationLabels = {\n addComment: string;\n /* eslint-disable-next-line no-unused-vars */\n openComment: (authorName: string) => string;\n};\n\nexport type DocumentAnnotationsProps = {\n comments: DocumentComment[];\n selectedCommentId?: string;\n // Offer the \"Comment\" action when text is selected.\n canComment?: boolean;\n // Highlight resolved comments as well as open ones.\n showResolved?: boolean;\n /* eslint-disable-next-line no-unused-vars */\n onRequestComment?: (anchor: TextQuoteAnchor) => void;\n /* eslint-disable-next-line no-unused-vars */\n onSelectComment?: (commentId: string) => void;\n /* eslint-disable-next-line no-unused-vars */\n onAnchorStatusChange?: (status: DocumentAnchorStatus) => void;\n labels?: Partial<DocumentAnnotationLabels>;\n};\n\nexport const defaultDocumentAnnotationLabels: DocumentAnnotationLabels = {\n addComment: 'Comment',\n openComment: (authorName) => `Open comment by ${ authorName }`\n};\n\nexport const getVisibleComments = (comments: DocumentComment[], showResolved = false): DocumentComment[] =>\n comments.filter((comment) => comment.anchor && (showResolved || !comment.resolved));\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;;AAiCA;;AAyBA,OAAO,MAAMA,+BAAyD,GAAG;EACvEC,UAAU,EAAE,SAAS;EACrBC,WAAW,EAAGC,UAAU,IAAK,mBAAoBA,UAAU;AAC7D,CAAC;AAED,OAAO,MAAMC,kBAAkB,GAAGA,CAACC,QAA2B,EAAEC,YAAY,GAAG,KAAK,KAClFD,QAAQ,CAACE,MAAM,CAAEC,OAAO,IAAKA,OAAO,CAACC,MAAM,KAAKH,YAAY,IAAI,CAACE,OAAO,CAACE,QAAQ,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Comment highlights use the CSS Custom Highlight API, which styles text ranges without changing the
|
|
3
|
+
DOM. That matters inside the rich-text editor, which owns its DOM and would discard or fight any
|
|
4
|
+
wrapper elements added around highlighted text.
|
|
5
|
+
|
|
6
|
+
The browser keeps one registry entry per highlight name, so the ranges from every annotated view
|
|
7
|
+
on the page are merged here into shared entries. Browsers without the API simply show no
|
|
8
|
+
highlight; comment bubbles still mark each comment.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
export const HIGHLIGHT_NAMES = {
|
|
12
|
+
comment: 'documentComment',
|
|
13
|
+
selected: 'documentCommentSelected'
|
|
14
|
+
};
|
|
15
|
+
const instances = new Map();
|
|
16
|
+
|
|
17
|
+
/* eslint-disable no-unused-vars */
|
|
18
|
+
|
|
19
|
+
/* eslint-enable no-unused-vars */
|
|
20
|
+
|
|
21
|
+
const getHighlightApi = () => {
|
|
22
|
+
const cssNamespace = globalThis.CSS;
|
|
23
|
+
const Highlight = globalThis.Highlight;
|
|
24
|
+
return cssNamespace?.highlights && Highlight ? {
|
|
25
|
+
registry: cssNamespace.highlights,
|
|
26
|
+
Highlight
|
|
27
|
+
} : null;
|
|
28
|
+
};
|
|
29
|
+
export const supportsTextHighlights = () => getHighlightApi() !== null;
|
|
30
|
+
const syncRegistry = () => {
|
|
31
|
+
const api = getHighlightApi();
|
|
32
|
+
if (!api) {
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
const all = [...instances.values()];
|
|
36
|
+
const comments = all.flatMap(instance => instance.comments);
|
|
37
|
+
const selected = all.flatMap(instance => instance.selected);
|
|
38
|
+
if (comments.length) {
|
|
39
|
+
api.registry.set(HIGHLIGHT_NAMES.comment, new api.Highlight(...comments));
|
|
40
|
+
} else {
|
|
41
|
+
api.registry.delete(HIGHLIGHT_NAMES.comment);
|
|
42
|
+
}
|
|
43
|
+
if (selected.length) {
|
|
44
|
+
api.registry.set(HIGHLIGHT_NAMES.selected, new api.Highlight(...selected));
|
|
45
|
+
} else {
|
|
46
|
+
api.registry.delete(HIGHLIGHT_NAMES.selected);
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
export const setInstanceHighlights = (instanceId, highlights) => {
|
|
50
|
+
instances.set(instanceId, highlights);
|
|
51
|
+
syncRegistry();
|
|
52
|
+
};
|
|
53
|
+
export const clearInstanceHighlights = instanceId => {
|
|
54
|
+
if (instances.delete(instanceId)) {
|
|
55
|
+
syncRegistry();
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
//# sourceMappingURL=highlightRegistry.js.map
|