@open-mercato/documents 0.6.8-develop.7016.1.4ed7b1e49d
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/README.md +88 -0
- package/build.mjs +23 -0
- package/dist/index.js +5 -0
- package/dist/index.js.map +7 -0
- package/dist/modules/documents/acl.js +15 -0
- package/dist/modules/documents/acl.js.map +7 -0
- package/dist/modules/documents/api/[id]/archive/route.js +116 -0
- package/dist/modules/documents/api/[id]/archive/route.js.map +7 -0
- package/dist/modules/documents/api/[id]/attachments/[attachmentId]/route.js +155 -0
- package/dist/modules/documents/api/[id]/attachments/[attachmentId]/route.js.map +7 -0
- package/dist/modules/documents/api/[id]/attachments/route.js +153 -0
- package/dist/modules/documents/api/[id]/attachments/route.js.map +7 -0
- package/dist/modules/documents/api/[id]/collab-token/route.js +180 -0
- package/dist/modules/documents/api/[id]/collab-token/route.js.map +7 -0
- package/dist/modules/documents/api/[id]/comments/access-check/route.js +86 -0
- package/dist/modules/documents/api/[id]/comments/access-check/route.js.map +7 -0
- package/dist/modules/documents/api/[id]/comments/route.js +387 -0
- package/dist/modules/documents/api/[id]/comments/route.js.map +7 -0
- package/dist/modules/documents/api/[id]/content/route.js +143 -0
- package/dist/modules/documents/api/[id]/content/route.js.map +7 -0
- package/dist/modules/documents/api/[id]/duplicate/route.js +200 -0
- package/dist/modules/documents/api/[id]/duplicate/route.js.map +7 -0
- package/dist/modules/documents/api/[id]/export/route.js +421 -0
- package/dist/modules/documents/api/[id]/export/route.js.map +7 -0
- package/dist/modules/documents/api/[id]/favorite/route.js +96 -0
- package/dist/modules/documents/api/[id]/favorite/route.js.map +7 -0
- package/dist/modules/documents/api/[id]/links/[linkId]/route.js +85 -0
- package/dist/modules/documents/api/[id]/links/[linkId]/route.js.map +7 -0
- package/dist/modules/documents/api/[id]/links/route.js +257 -0
- package/dist/modules/documents/api/[id]/links/route.js.map +7 -0
- package/dist/modules/documents/api/[id]/principals/route.js +299 -0
- package/dist/modules/documents/api/[id]/principals/route.js.map +7 -0
- package/dist/modules/documents/api/[id]/route.js +246 -0
- package/dist/modules/documents/api/[id]/route.js.map +7 -0
- package/dist/modules/documents/api/[id]/shares/route.js +335 -0
- package/dist/modules/documents/api/[id]/shares/route.js.map +7 -0
- package/dist/modules/documents/api/[id]/unarchive/route.js +39 -0
- package/dist/modules/documents/api/[id]/unarchive/route.js.map +7 -0
- package/dist/modules/documents/api/[id]/versions/[versionId]/restore/route.js +133 -0
- package/dist/modules/documents/api/[id]/versions/[versionId]/restore/route.js.map +7 -0
- package/dist/modules/documents/api/[id]/versions/[versionId]/route.js +93 -0
- package/dist/modules/documents/api/[id]/versions/[versionId]/route.js.map +7 -0
- package/dist/modules/documents/api/[id]/versions/route.js +193 -0
- package/dist/modules/documents/api/[id]/versions/route.js.map +7 -0
- package/dist/modules/documents/api/[id]/watch/route.js +97 -0
- package/dist/modules/documents/api/[id]/watch/route.js.map +7 -0
- package/dist/modules/documents/api/_commands.js +34 -0
- package/dist/modules/documents/api/_commands.js.map +7 -0
- package/dist/modules/documents/api/_shared.js +490 -0
- package/dist/modules/documents/api/_shared.js.map +7 -0
- package/dist/modules/documents/api/folders/route.js +256 -0
- package/dist/modules/documents/api/folders/route.js.map +7 -0
- package/dist/modules/documents/api/instantiate/route.js +108 -0
- package/dist/modules/documents/api/instantiate/route.js.map +7 -0
- package/dist/modules/documents/api/route.js +322 -0
- package/dist/modules/documents/api/route.js.map +7 -0
- package/dist/modules/documents/api/templates/[templateId]/preview/route.js +94 -0
- package/dist/modules/documents/api/templates/[templateId]/preview/route.js.map +7 -0
- package/dist/modules/documents/api/templates/[templateId]/route.js +82 -0
- package/dist/modules/documents/api/templates/[templateId]/route.js.map +7 -0
- package/dist/modules/documents/api/templates/route.js +344 -0
- package/dist/modules/documents/api/templates/route.js.map +7 -0
- package/dist/modules/documents/backend/documents/DocumentsPageClient.js +160 -0
- package/dist/modules/documents/backend/documents/DocumentsPageClient.js.map +7 -0
- package/dist/modules/documents/backend/documents/DocumentsTable.js +143 -0
- package/dist/modules/documents/backend/documents/DocumentsTable.js.map +7 -0
- package/dist/modules/documents/backend/documents/FolderDialog.js +55 -0
- package/dist/modules/documents/backend/documents/FolderDialog.js.map +7 -0
- package/dist/modules/documents/backend/documents/FolderTree.js +40 -0
- package/dist/modules/documents/backend/documents/FolderTree.js.map +7 -0
- package/dist/modules/documents/backend/documents/MoveDocumentDialog.js +64 -0
- package/dist/modules/documents/backend/documents/MoveDocumentDialog.js.map +7 -0
- package/dist/modules/documents/backend/documents/[id]/CommentAnchorNavigation.js +77 -0
- package/dist/modules/documents/backend/documents/[id]/CommentAnchorNavigation.js.map +7 -0
- package/dist/modules/documents/backend/documents/[id]/CommentComposer.js +126 -0
- package/dist/modules/documents/backend/documents/[id]/CommentComposer.js.map +7 -0
- package/dist/modules/documents/backend/documents/[id]/CommentThreadList.js +88 -0
- package/dist/modules/documents/backend/documents/[id]/CommentThreadList.js.map +7 -0
- package/dist/modules/documents/backend/documents/[id]/CommentsRail.js +123 -0
- package/dist/modules/documents/backend/documents/[id]/CommentsRail.js.map +7 -0
- package/dist/modules/documents/backend/documents/[id]/DocumentCanvas.js +91 -0
- package/dist/modules/documents/backend/documents/[id]/DocumentCanvas.js.map +7 -0
- package/dist/modules/documents/backend/documents/[id]/DocumentEditorErrorBoundary.js +27 -0
- package/dist/modules/documents/backend/documents/[id]/DocumentEditorErrorBoundary.js.map +7 -0
- package/dist/modules/documents/backend/documents/[id]/DocumentEditorIsland.js +50 -0
- package/dist/modules/documents/backend/documents/[id]/DocumentEditorIsland.js.map +7 -0
- package/dist/modules/documents/backend/documents/[id]/DocumentEditorSurface.js +168 -0
- package/dist/modules/documents/backend/documents/[id]/DocumentEditorSurface.js.map +7 -0
- package/dist/modules/documents/backend/documents/[id]/DocumentNavigator.js +129 -0
- package/dist/modules/documents/backend/documents/[id]/DocumentNavigator.js.map +7 -0
- package/dist/modules/documents/backend/documents/[id]/DocumentPageClient.js +429 -0
- package/dist/modules/documents/backend/documents/[id]/DocumentPageClient.js.map +7 -0
- package/dist/modules/documents/backend/documents/[id]/EditorColorTools.js +68 -0
- package/dist/modules/documents/backend/documents/[id]/EditorColorTools.js.map +7 -0
- package/dist/modules/documents/backend/documents/[id]/EditorStatusPresence.js +69 -0
- package/dist/modules/documents/backend/documents/[id]/EditorStatusPresence.js.map +7 -0
- package/dist/modules/documents/backend/documents/[id]/EditorToolbar.js +151 -0
- package/dist/modules/documents/backend/documents/[id]/EditorToolbar.js.map +7 -0
- package/dist/modules/documents/backend/documents/[id]/ExportMenu.js +121 -0
- package/dist/modules/documents/backend/documents/[id]/ExportMenu.js.map +7 -0
- package/dist/modules/documents/backend/documents/[id]/MentionPicker.js +114 -0
- package/dist/modules/documents/backend/documents/[id]/MentionPicker.js.map +7 -0
- package/dist/modules/documents/backend/documents/[id]/OutlinePane.js +70 -0
- package/dist/modules/documents/backend/documents/[id]/OutlinePane.js.map +7 -0
- package/dist/modules/documents/backend/documents/[id]/RecordFieldsDialog.js +157 -0
- package/dist/modules/documents/backend/documents/[id]/RecordFieldsDialog.js.map +7 -0
- package/dist/modules/documents/backend/documents/[id]/RelatedRecordsPanel.js +266 -0
- package/dist/modules/documents/backend/documents/[id]/RelatedRecordsPanel.js.map +7 -0
- package/dist/modules/documents/backend/documents/[id]/VersionHistoryPanel.js +227 -0
- package/dist/modules/documents/backend/documents/[id]/VersionHistoryPanel.js.map +7 -0
- package/dist/modules/documents/backend/documents/[id]/VersionPreviewDialog.js +157 -0
- package/dist/modules/documents/backend/documents/[id]/VersionPreviewDialog.js.map +7 -0
- package/dist/modules/documents/backend/documents/[id]/commentTypes.js +150 -0
- package/dist/modules/documents/backend/documents/[id]/commentTypes.js.map +7 -0
- package/dist/modules/documents/backend/documents/[id]/componentCapabilities.js +13 -0
- package/dist/modules/documents/backend/documents/[id]/componentCapabilities.js.map +7 -0
- package/dist/modules/documents/backend/documents/[id]/documentPagination.js +295 -0
- package/dist/modules/documents/backend/documents/[id]/documentPagination.js.map +7 -0
- package/dist/modules/documents/backend/documents/[id]/editorPresenceStyles.js +81 -0
- package/dist/modules/documents/backend/documents/[id]/editorPresenceStyles.js.map +7 -0
- package/dist/modules/documents/backend/documents/[id]/editorTypes.js +52 -0
- package/dist/modules/documents/backend/documents/[id]/editorTypes.js.map +7 -0
- package/dist/modules/documents/backend/documents/[id]/page.js +10 -0
- package/dist/modules/documents/backend/documents/[id]/page.js.map +7 -0
- package/dist/modules/documents/backend/documents/[id]/page.meta.js +16 -0
- package/dist/modules/documents/backend/documents/[id]/page.meta.js.map +7 -0
- package/dist/modules/documents/backend/documents/[id]/relatedRecordModel.js +38 -0
- package/dist/modules/documents/backend/documents/[id]/relatedRecordModel.js.map +7 -0
- package/dist/modules/documents/backend/documents/[id]/restoreVersion.js +33 -0
- package/dist/modules/documents/backend/documents/[id]/restoreVersion.js.map +7 -0
- package/dist/modules/documents/backend/documents/[id]/useDocumentCollaboration.js +392 -0
- package/dist/modules/documents/backend/documents/[id]/useDocumentCollaboration.js.map +7 -0
- package/dist/modules/documents/backend/documents/[id]/useDocumentComments.js +253 -0
- package/dist/modules/documents/backend/documents/[id]/useDocumentComments.js.map +7 -0
- package/dist/modules/documents/backend/documents/[id]/useDocumentEditor.js +149 -0
- package/dist/modules/documents/backend/documents/[id]/useDocumentEditor.js.map +7 -0
- package/dist/modules/documents/backend/documents/[id]/useDocumentTitle.js +82 -0
- package/dist/modules/documents/backend/documents/[id]/useDocumentTitle.js.map +7 -0
- package/dist/modules/documents/backend/documents/[id]/useEditorInsertions.js +144 -0
- package/dist/modules/documents/backend/documents/[id]/useEditorInsertions.js.map +7 -0
- package/dist/modules/documents/backend/documents/[id]/useFallbackContentPersistence.js +237 -0
- package/dist/modules/documents/backend/documents/[id]/useFallbackContentPersistence.js.map +7 -0
- package/dist/modules/documents/backend/documents/[id]/useMentionPicker.js +216 -0
- package/dist/modules/documents/backend/documents/[id]/useMentionPicker.js.map +7 -0
- package/dist/modules/documents/backend/documents/[id]/versionHistoryModel.js +25 -0
- package/dist/modules/documents/backend/documents/[id]/versionHistoryModel.js.map +7 -0
- package/dist/modules/documents/backend/documents/components/EntityPicker.js +156 -0
- package/dist/modules/documents/backend/documents/components/EntityPicker.js.map +7 -0
- package/dist/modules/documents/backend/documents/components/EntityPickerResults.js +46 -0
- package/dist/modules/documents/backend/documents/components/EntityPickerResults.js.map +7 -0
- package/dist/modules/documents/backend/documents/components/NewFromTemplateDialog.js +127 -0
- package/dist/modules/documents/backend/documents/components/NewFromTemplateDialog.js.map +7 -0
- package/dist/modules/documents/backend/documents/components/PrincipalPicker.js +84 -0
- package/dist/modules/documents/backend/documents/components/PrincipalPicker.js.map +7 -0
- package/dist/modules/documents/backend/documents/components/ShareDialog.js +77 -0
- package/dist/modules/documents/backend/documents/components/ShareDialog.js.map +7 -0
- package/dist/modules/documents/backend/documents/components/ShareDialogAddForm.js +93 -0
- package/dist/modules/documents/backend/documents/components/ShareDialogAddForm.js.map +7 -0
- package/dist/modules/documents/backend/documents/components/ShareDialogList.js +82 -0
- package/dist/modules/documents/backend/documents/components/ShareDialogList.js.map +7 -0
- package/dist/modules/documents/backend/documents/components/TemplateBodyEditor.js +96 -0
- package/dist/modules/documents/backend/documents/components/TemplateBodyEditor.js.map +7 -0
- package/dist/modules/documents/backend/documents/components/TemplateEditorDialog.js +169 -0
- package/dist/modules/documents/backend/documents/components/TemplateEditorDialog.js.map +7 -0
- package/dist/modules/documents/backend/documents/components/TemplatePreview.js +38 -0
- package/dist/modules/documents/backend/documents/components/TemplatePreview.js.map +7 -0
- package/dist/modules/documents/backend/documents/components/TemplateSlotFields.js +69 -0
- package/dist/modules/documents/backend/documents/components/TemplateSlotFields.js.map +7 -0
- package/dist/modules/documents/backend/documents/components/TemplateSlotsEditor.js +71 -0
- package/dist/modules/documents/backend/documents/components/TemplateSlotsEditor.js.map +7 -0
- package/dist/modules/documents/backend/documents/components/principalPickerModel.js +63 -0
- package/dist/modules/documents/backend/documents/components/principalPickerModel.js.map +7 -0
- package/dist/modules/documents/backend/documents/components/shareDialogModel.js +68 -0
- package/dist/modules/documents/backend/documents/components/shareDialogModel.js.map +7 -0
- package/dist/modules/documents/backend/documents/components/templateUi.js +89 -0
- package/dist/modules/documents/backend/documents/components/templateUi.js.map +7 -0
- package/dist/modules/documents/backend/documents/components/useAvailableEntityRegistry.js +30 -0
- package/dist/modules/documents/backend/documents/components/useAvailableEntityRegistry.js.map +7 -0
- package/dist/modules/documents/backend/documents/components/useEntitySearch.js +191 -0
- package/dist/modules/documents/backend/documents/components/useEntitySearch.js.map +7 -0
- package/dist/modules/documents/backend/documents/components/usePrincipalPicker.js +221 -0
- package/dist/modules/documents/backend/documents/components/usePrincipalPicker.js.map +7 -0
- package/dist/modules/documents/backend/documents/components/useShareDialog.js +236 -0
- package/dist/modules/documents/backend/documents/components/useShareDialog.js.map +7 -0
- package/dist/modules/documents/backend/documents/components/useTemplateDetail.js +49 -0
- package/dist/modules/documents/backend/documents/components/useTemplateDetail.js.map +7 -0
- package/dist/modules/documents/backend/documents/components/useTemplateInstantiation.js +234 -0
- package/dist/modules/documents/backend/documents/components/useTemplateInstantiation.js.map +7 -0
- package/dist/modules/documents/backend/documents/documentUi.js +106 -0
- package/dist/modules/documents/backend/documents/documentUi.js.map +7 -0
- package/dist/modules/documents/backend/documents/documentsListTypes.js +132 -0
- package/dist/modules/documents/backend/documents/documentsListTypes.js.map +7 -0
- package/dist/modules/documents/backend/documents/page.js +9 -0
- package/dist/modules/documents/backend/documents/page.js.map +7 -0
- package/dist/modules/documents/backend/documents/page.meta.js +26 -0
- package/dist/modules/documents/backend/documents/page.meta.js.map +7 -0
- package/dist/modules/documents/backend/documents/templates/TemplatesPageClient.js +91 -0
- package/dist/modules/documents/backend/documents/templates/TemplatesPageClient.js.map +7 -0
- package/dist/modules/documents/backend/documents/templates/TemplatesTable.js +58 -0
- package/dist/modules/documents/backend/documents/templates/TemplatesTable.js.map +7 -0
- package/dist/modules/documents/backend/documents/templates/page.js +9 -0
- package/dist/modules/documents/backend/documents/templates/page.js.map +7 -0
- package/dist/modules/documents/backend/documents/templates/page.meta.js +34 -0
- package/dist/modules/documents/backend/documents/templates/page.meta.js.map +7 -0
- package/dist/modules/documents/backend/documents/templates/useTemplatesPage.js +139 -0
- package/dist/modules/documents/backend/documents/templates/useTemplatesPage.js.map +7 -0
- package/dist/modules/documents/backend/documents/useDocumentsList.js +314 -0
- package/dist/modules/documents/backend/documents/useDocumentsList.js.map +7 -0
- package/dist/modules/documents/ce.js +8 -0
- package/dist/modules/documents/ce.js.map +7 -0
- package/dist/modules/documents/commands/aggregate.js +99 -0
- package/dist/modules/documents/commands/aggregate.js.map +7 -0
- package/dist/modules/documents/commands/attachments.js +252 -0
- package/dist/modules/documents/commands/attachments.js.map +7 -0
- package/dist/modules/documents/commands/comments.js +782 -0
- package/dist/modules/documents/commands/comments.js.map +7 -0
- package/dist/modules/documents/commands/content.js +238 -0
- package/dist/modules/documents/commands/content.js.map +7 -0
- package/dist/modules/documents/commands/document-crud.js +505 -0
- package/dist/modules/documents/commands/document-crud.js.map +7 -0
- package/dist/modules/documents/commands/documents.js +473 -0
- package/dist/modules/documents/commands/documents.js.map +7 -0
- package/dist/modules/documents/commands/duplicate.js +640 -0
- package/dist/modules/documents/commands/duplicate.js.map +7 -0
- package/dist/modules/documents/commands/favorites.js +150 -0
- package/dist/modules/documents/commands/favorites.js.map +7 -0
- package/dist/modules/documents/commands/folders.js +420 -0
- package/dist/modules/documents/commands/folders.js.map +7 -0
- package/dist/modules/documents/commands/index.js +64 -0
- package/dist/modules/documents/commands/index.js.map +7 -0
- package/dist/modules/documents/commands/interceptors.js +300 -0
- package/dist/modules/documents/commands/interceptors.js.map +7 -0
- package/dist/modules/documents/commands/lifecycle.js +249 -0
- package/dist/modules/documents/commands/lifecycle.js.map +7 -0
- package/dist/modules/documents/commands/links.js +410 -0
- package/dist/modules/documents/commands/links.js.map +7 -0
- package/dist/modules/documents/commands/mutation-helpers.js +42 -0
- package/dist/modules/documents/commands/mutation-helpers.js.map +7 -0
- package/dist/modules/documents/commands/projection-types.js +1 -0
- package/dist/modules/documents/commands/projection-types.js.map +7 -0
- package/dist/modules/documents/commands/shared.js +143 -0
- package/dist/modules/documents/commands/shared.js.map +7 -0
- package/dist/modules/documents/commands/shares.js +527 -0
- package/dist/modules/documents/commands/shares.js.map +7 -0
- package/dist/modules/documents/commands/side-effects.js +103 -0
- package/dist/modules/documents/commands/side-effects.js.map +7 -0
- package/dist/modules/documents/commands/templates.js +461 -0
- package/dist/modules/documents/commands/templates.js.map +7 -0
- package/dist/modules/documents/commands/versions.js +432 -0
- package/dist/modules/documents/commands/versions.js.map +7 -0
- package/dist/modules/documents/commands/watchers.js +164 -0
- package/dist/modules/documents/commands/watchers.js.map +7 -0
- package/dist/modules/documents/data/entities.js +653 -0
- package/dist/modules/documents/data/entities.js.map +7 -0
- package/dist/modules/documents/data/extensions.js +44 -0
- package/dist/modules/documents/data/extensions.js.map +7 -0
- package/dist/modules/documents/data/validators.js +219 -0
- package/dist/modules/documents/data/validators.js.map +7 -0
- package/dist/modules/documents/di.js +35 -0
- package/dist/modules/documents/di.js.map +7 -0
- package/dist/modules/documents/encryption.js +12 -0
- package/dist/modules/documents/encryption.js.map +7 -0
- package/dist/modules/documents/events.js +27 -0
- package/dist/modules/documents/events.js.map +7 -0
- package/dist/modules/documents/index.js +19 -0
- package/dist/modules/documents/index.js.map +7 -0
- package/dist/modules/documents/lib/attachmentServicePort.js +30 -0
- package/dist/modules/documents/lib/attachmentServicePort.js.map +7 -0
- package/dist/modules/documents/lib/capabilities.js +32 -0
- package/dist/modules/documents/lib/capabilities.js.map +7 -0
- package/dist/modules/documents/lib/collabCloseEvents.js +17 -0
- package/dist/modules/documents/lib/collabCloseEvents.js.map +7 -0
- package/dist/modules/documents/lib/collabEndpoint.js +22 -0
- package/dist/modules/documents/lib/collabEndpoint.js.map +7 -0
- package/dist/modules/documents/lib/collabMaterializer.js +107 -0
- package/dist/modules/documents/lib/collabMaterializer.js.map +7 -0
- package/dist/modules/documents/lib/collabToken.js +120 -0
- package/dist/modules/documents/lib/collabToken.js.map +7 -0
- package/dist/modules/documents/lib/collaborationAwareness.js +68 -0
- package/dist/modules/documents/lib/collaborationAwareness.js.map +7 -0
- package/dist/modules/documents/lib/commentAnchors.js +15 -0
- package/dist/modules/documents/lib/commentAnchors.js.map +7 -0
- package/dist/modules/documents/lib/constants.js +25 -0
- package/dist/modules/documents/lib/constants.js.map +7 -0
- package/dist/modules/documents/lib/contentService.js +248 -0
- package/dist/modules/documents/lib/contentService.js.map +7 -0
- package/dist/modules/documents/lib/displayLabels.js +23 -0
- package/dist/modules/documents/lib/displayLabels.js.map +7 -0
- package/dist/modules/documents/lib/docxRenderer.js +601 -0
- package/dist/modules/documents/lib/docxRenderer.js.map +7 -0
- package/dist/modules/documents/lib/duplicateContent.js +22 -0
- package/dist/modules/documents/lib/duplicateContent.js.map +7 -0
- package/dist/modules/documents/lib/editorConfig.js +287 -0
- package/dist/modules/documents/lib/editorConfig.js.map +7 -0
- package/dist/modules/documents/lib/entityLinks.js +148 -0
- package/dist/modules/documents/lib/entityLinks.js.map +7 -0
- package/dist/modules/documents/lib/entityRegistry.js +258 -0
- package/dist/modules/documents/lib/entityRegistry.js.map +7 -0
- package/dist/modules/documents/lib/entityRegistry.server.js +189 -0
- package/dist/modules/documents/lib/entityRegistry.server.js.map +7 -0
- package/dist/modules/documents/lib/entityRegistryAvailability.server.js +9 -0
- package/dist/modules/documents/lib/entityRegistryAvailability.server.js.map +7 -0
- package/dist/modules/documents/lib/entitySuggestion.js +50 -0
- package/dist/modules/documents/lib/entitySuggestion.js.map +7 -0
- package/dist/modules/documents/lib/favorites.js +22 -0
- package/dist/modules/documents/lib/favorites.js.map +7 -0
- package/dist/modules/documents/lib/folderHierarchySerialization.js +19 -0
- package/dist/modules/documents/lib/folderHierarchySerialization.js.map +7 -0
- package/dist/modules/documents/lib/historyLimits.js +100 -0
- package/dist/modules/documents/lib/historyLimits.js.map +7 -0
- package/dist/modules/documents/lib/historyPolicy.js +14 -0
- package/dist/modules/documents/lib/historyPolicy.js.map +7 -0
- package/dist/modules/documents/lib/organizationAccess.js +17 -0
- package/dist/modules/documents/lib/organizationAccess.js.map +7 -0
- package/dist/modules/documents/lib/pdfHtml.js +62 -0
- package/dist/modules/documents/lib/pdfHtml.js.map +7 -0
- package/dist/modules/documents/lib/pdfRenderer.js +284 -0
- package/dist/modules/documents/lib/pdfRenderer.js.map +7 -0
- package/dist/modules/documents/lib/permissions.js +222 -0
- package/dist/modules/documents/lib/permissions.js.map +7 -0
- package/dist/modules/documents/lib/platformServices.js +35 -0
- package/dist/modules/documents/lib/platformServices.js.map +7 -0
- package/dist/modules/documents/lib/recordFieldInsertion.js +58 -0
- package/dist/modules/documents/lib/recordFieldInsertion.js.map +7 -0
- package/dist/modules/documents/lib/requestBody.js +80 -0
- package/dist/modules/documents/lib/requestBody.js.map +7 -0
- package/dist/modules/documents/lib/resourceLimits.js +62 -0
- package/dist/modules/documents/lib/resourceLimits.js.map +7 -0
- package/dist/modules/documents/lib/shareCounts.js +25 -0
- package/dist/modules/documents/lib/shareCounts.js.map +7 -0
- package/dist/modules/documents/lib/templateFill.js +84 -0
- package/dist/modules/documents/lib/templateFill.js.map +7 -0
- package/dist/modules/documents/lib/templateInstantiation.js +147 -0
- package/dist/modules/documents/lib/templateInstantiation.js.map +7 -0
- package/dist/modules/documents/lib/templatePreviewDigest.js +82 -0
- package/dist/modules/documents/lib/templatePreviewDigest.js.map +7 -0
- package/dist/modules/documents/lib/templateSeeds.js +201 -0
- package/dist/modules/documents/lib/templateSeeds.js.map +7 -0
- package/dist/modules/documents/lib/userLabels.js +37 -0
- package/dist/modules/documents/lib/userLabels.js.map +7 -0
- package/dist/modules/documents/lib/versionContent.js +131 -0
- package/dist/modules/documents/lib/versionContent.js.map +7 -0
- package/dist/modules/documents/lib/versionLabels.js +12 -0
- package/dist/modules/documents/lib/versionLabels.js.map +7 -0
- package/dist/modules/documents/lib/versioning.js +14 -0
- package/dist/modules/documents/lib/versioning.js.map +7 -0
- package/dist/modules/documents/lib/visibility.js +422 -0
- package/dist/modules/documents/lib/visibility.js.map +7 -0
- package/dist/modules/documents/lib/watchers.js +106 -0
- package/dist/modules/documents/lib/watchers.js.map +7 -0
- package/dist/modules/documents/migrations/Migration20260708163836_documents.js +44 -0
- package/dist/modules/documents/migrations/Migration20260708163836_documents.js.map +7 -0
- package/dist/modules/documents/migrations/Migration20260709164720_documents.js +17 -0
- package/dist/modules/documents/migrations/Migration20260709164720_documents.js.map +7 -0
- package/dist/modules/documents/migrations/Migration20260710002318_documents.js +32 -0
- package/dist/modules/documents/migrations/Migration20260710002318_documents.js.map +7 -0
- package/dist/modules/documents/migrations/Migration20260710071003_documents.js +13 -0
- package/dist/modules/documents/migrations/Migration20260710071003_documents.js.map +7 -0
- package/dist/modules/documents/migrations/Migration20260712120000_documents.js +13 -0
- package/dist/modules/documents/migrations/Migration20260712120000_documents.js.map +7 -0
- package/dist/modules/documents/migrations/Migration20260712183000_documents.js +14 -0
- package/dist/modules/documents/migrations/Migration20260712183000_documents.js.map +7 -0
- package/dist/modules/documents/migrations/Migration20260713092156_documents.js +29 -0
- package/dist/modules/documents/migrations/Migration20260713092156_documents.js.map +7 -0
- package/dist/modules/documents/migrations/Migration20260717000000_documents.js +37 -0
- package/dist/modules/documents/migrations/Migration20260717000000_documents.js.map +7 -0
- package/dist/modules/documents/notifications.js +47 -0
- package/dist/modules/documents/notifications.js.map +7 -0
- package/dist/modules/documents/search.js +101 -0
- package/dist/modules/documents/search.js.map +7 -0
- package/dist/modules/documents/setup.js +19 -0
- package/dist/modules/documents/setup.js.map +7 -0
- package/dist/modules/documents/widgets/injection/related-documents/LinkDocumentDialog.js +214 -0
- package/dist/modules/documents/widgets/injection/related-documents/LinkDocumentDialog.js.map +7 -0
- package/dist/modules/documents/widgets/injection/related-documents/context.js +84 -0
- package/dist/modules/documents/widgets/injection/related-documents/context.js.map +7 -0
- package/dist/modules/documents/widgets/injection/related-documents/useRelatedDocuments.js +98 -0
- package/dist/modules/documents/widgets/injection/related-documents/useRelatedDocuments.js.map +7 -0
- package/dist/modules/documents/widgets/injection/related-documents/widget.client.js +83 -0
- package/dist/modules/documents/widgets/injection/related-documents/widget.client.js.map +7 -0
- package/dist/modules/documents/widgets/injection/related-documents/widget.js +19 -0
- package/dist/modules/documents/widgets/injection/related-documents/widget.js.map +7 -0
- package/dist/modules/documents/widgets/injection-table.js +21 -0
- package/dist/modules/documents/widgets/injection-table.js.map +7 -0
- package/dist/server/documents-collab-server.js +2260 -0
- package/dist/server/documents-collab-server.js.map +7 -0
- package/generated/entities/document/index.ts +12 -0
- package/generated/entities/document_attachment/index.ts +9 -0
- package/generated/entities/document_comment/index.ts +14 -0
- package/generated/entities/document_content/index.ts +11 -0
- package/generated/entities/document_entity_link/index.ts +19 -0
- package/generated/entities/document_favorite/index.ts +7 -0
- package/generated/entities/document_folder/index.ts +9 -0
- package/generated/entities/document_share/index.ts +11 -0
- package/generated/entities/document_template/index.ts +13 -0
- package/generated/entities/document_version/index.ts +9 -0
- package/generated/entities/document_watcher/index.ts +7 -0
- package/generated/entities.ids.generated.ts +21 -0
- package/generated/entity-fields-registry.ts +151 -0
- package/jest.config.cjs +34 -0
- package/package.json +149 -0
- package/server/documents-collab-server.ts +3416 -0
- package/src/index.ts +1 -0
- package/src/modules/documents/acl.ts +11 -0
- package/src/modules/documents/api/[id]/archive/route.ts +132 -0
- package/src/modules/documents/api/[id]/attachments/[attachmentId]/route.ts +166 -0
- package/src/modules/documents/api/[id]/attachments/route.ts +173 -0
- package/src/modules/documents/api/[id]/collab-token/route.ts +203 -0
- package/src/modules/documents/api/[id]/comments/access-check/route.ts +96 -0
- package/src/modules/documents/api/[id]/comments/route.ts +442 -0
- package/src/modules/documents/api/[id]/content/route.ts +156 -0
- package/src/modules/documents/api/[id]/duplicate/route.ts +231 -0
- package/src/modules/documents/api/[id]/export/route.ts +535 -0
- package/src/modules/documents/api/[id]/favorite/route.ts +110 -0
- package/src/modules/documents/api/[id]/links/[linkId]/route.ts +92 -0
- package/src/modules/documents/api/[id]/links/route.ts +301 -0
- package/src/modules/documents/api/[id]/principals/route.ts +375 -0
- package/src/modules/documents/api/[id]/route.ts +267 -0
- package/src/modules/documents/api/[id]/shares/route.ts +372 -0
- package/src/modules/documents/api/[id]/unarchive/route.ts +42 -0
- package/src/modules/documents/api/[id]/versions/[versionId]/restore/route.ts +152 -0
- package/src/modules/documents/api/[id]/versions/[versionId]/route.ts +100 -0
- package/src/modules/documents/api/[id]/versions/route.ts +207 -0
- package/src/modules/documents/api/[id]/watch/route.ts +111 -0
- package/src/modules/documents/api/_commands.ts +53 -0
- package/src/modules/documents/api/_shared.ts +676 -0
- package/src/modules/documents/api/folders/route.ts +287 -0
- package/src/modules/documents/api/instantiate/route.ts +114 -0
- package/src/modules/documents/api/route.ts +362 -0
- package/src/modules/documents/api/templates/[templateId]/preview/route.ts +97 -0
- package/src/modules/documents/api/templates/[templateId]/route.ts +92 -0
- package/src/modules/documents/api/templates/route.ts +370 -0
- package/src/modules/documents/backend/documents/DocumentsPageClient.tsx +150 -0
- package/src/modules/documents/backend/documents/DocumentsTable.tsx +168 -0
- package/src/modules/documents/backend/documents/FolderDialog.tsx +62 -0
- package/src/modules/documents/backend/documents/FolderTree.tsx +72 -0
- package/src/modules/documents/backend/documents/MoveDocumentDialog.tsx +70 -0
- package/src/modules/documents/backend/documents/[id]/CommentAnchorNavigation.ts +88 -0
- package/src/modules/documents/backend/documents/[id]/CommentComposer.tsx +136 -0
- package/src/modules/documents/backend/documents/[id]/CommentThreadList.tsx +131 -0
- package/src/modules/documents/backend/documents/[id]/CommentsRail.tsx +138 -0
- package/src/modules/documents/backend/documents/[id]/DocumentCanvas.tsx +111 -0
- package/src/modules/documents/backend/documents/[id]/DocumentEditorErrorBoundary.tsx +39 -0
- package/src/modules/documents/backend/documents/[id]/DocumentEditorIsland.tsx +50 -0
- package/src/modules/documents/backend/documents/[id]/DocumentEditorSurface.tsx +162 -0
- package/src/modules/documents/backend/documents/[id]/DocumentNavigator.tsx +129 -0
- package/src/modules/documents/backend/documents/[id]/DocumentPageClient.tsx +463 -0
- package/src/modules/documents/backend/documents/[id]/EditorColorTools.tsx +71 -0
- package/src/modules/documents/backend/documents/[id]/EditorStatusPresence.tsx +78 -0
- package/src/modules/documents/backend/documents/[id]/EditorToolbar.tsx +108 -0
- package/src/modules/documents/backend/documents/[id]/ExportMenu.tsx +144 -0
- package/src/modules/documents/backend/documents/[id]/MentionPicker.tsx +137 -0
- package/src/modules/documents/backend/documents/[id]/OutlinePane.tsx +98 -0
- package/src/modules/documents/backend/documents/[id]/RecordFieldsDialog.tsx +185 -0
- package/src/modules/documents/backend/documents/[id]/RelatedRecordsPanel.tsx +320 -0
- package/src/modules/documents/backend/documents/[id]/VersionHistoryPanel.tsx +244 -0
- package/src/modules/documents/backend/documents/[id]/VersionPreviewDialog.tsx +197 -0
- package/src/modules/documents/backend/documents/[id]/commentTypes.ts +192 -0
- package/src/modules/documents/backend/documents/[id]/componentCapabilities.ts +17 -0
- package/src/modules/documents/backend/documents/[id]/documentPagination.ts +352 -0
- package/src/modules/documents/backend/documents/[id]/editorPresenceStyles.ts +77 -0
- package/src/modules/documents/backend/documents/[id]/editorTypes.ts +84 -0
- package/src/modules/documents/backend/documents/[id]/page.meta.ts +12 -0
- package/src/modules/documents/backend/documents/[id]/page.tsx +6 -0
- package/src/modules/documents/backend/documents/[id]/relatedRecordModel.ts +49 -0
- package/src/modules/documents/backend/documents/[id]/restoreVersion.ts +49 -0
- package/src/modules/documents/backend/documents/[id]/useDocumentCollaboration.ts +458 -0
- package/src/modules/documents/backend/documents/[id]/useDocumentComments.ts +286 -0
- package/src/modules/documents/backend/documents/[id]/useDocumentEditor.ts +157 -0
- package/src/modules/documents/backend/documents/[id]/useDocumentTitle.ts +77 -0
- package/src/modules/documents/backend/documents/[id]/useEditorInsertions.ts +147 -0
- package/src/modules/documents/backend/documents/[id]/useFallbackContentPersistence.ts +277 -0
- package/src/modules/documents/backend/documents/[id]/useMentionPicker.ts +259 -0
- package/src/modules/documents/backend/documents/[id]/versionHistoryModel.ts +29 -0
- package/src/modules/documents/backend/documents/components/EntityPicker.tsx +171 -0
- package/src/modules/documents/backend/documents/components/EntityPickerResults.tsx +64 -0
- package/src/modules/documents/backend/documents/components/NewFromTemplateDialog.tsx +136 -0
- package/src/modules/documents/backend/documents/components/PrincipalPicker.tsx +90 -0
- package/src/modules/documents/backend/documents/components/ShareDialog.tsx +88 -0
- package/src/modules/documents/backend/documents/components/ShareDialogAddForm.tsx +113 -0
- package/src/modules/documents/backend/documents/components/ShareDialogList.tsx +117 -0
- package/src/modules/documents/backend/documents/components/TemplateBodyEditor.tsx +96 -0
- package/src/modules/documents/backend/documents/components/TemplateEditorDialog.tsx +171 -0
- package/src/modules/documents/backend/documents/components/TemplatePreview.tsx +43 -0
- package/src/modules/documents/backend/documents/components/TemplateSlotFields.tsx +72 -0
- package/src/modules/documents/backend/documents/components/TemplateSlotsEditor.tsx +72 -0
- package/src/modules/documents/backend/documents/components/principalPickerModel.ts +86 -0
- package/src/modules/documents/backend/documents/components/shareDialogModel.ts +94 -0
- package/src/modules/documents/backend/documents/components/templateUi.ts +128 -0
- package/src/modules/documents/backend/documents/components/useAvailableEntityRegistry.ts +43 -0
- package/src/modules/documents/backend/documents/components/useEntitySearch.ts +197 -0
- package/src/modules/documents/backend/documents/components/usePrincipalPicker.ts +165 -0
- package/src/modules/documents/backend/documents/components/useShareDialog.ts +267 -0
- package/src/modules/documents/backend/documents/components/useTemplateDetail.ts +54 -0
- package/src/modules/documents/backend/documents/components/useTemplateInstantiation.ts +252 -0
- package/src/modules/documents/backend/documents/documentUi.ts +134 -0
- package/src/modules/documents/backend/documents/documentsListTypes.ts +163 -0
- package/src/modules/documents/backend/documents/page.meta.ts +24 -0
- package/src/modules/documents/backend/documents/page.tsx +5 -0
- package/src/modules/documents/backend/documents/templates/TemplatesPageClient.tsx +93 -0
- package/src/modules/documents/backend/documents/templates/TemplatesTable.tsx +71 -0
- package/src/modules/documents/backend/documents/templates/page.meta.ts +32 -0
- package/src/modules/documents/backend/documents/templates/page.tsx +5 -0
- package/src/modules/documents/backend/documents/templates/useTemplatesPage.tsx +148 -0
- package/src/modules/documents/backend/documents/useDocumentsList.tsx +305 -0
- package/src/modules/documents/ce.ts +6 -0
- package/src/modules/documents/commands/aggregate.ts +128 -0
- package/src/modules/documents/commands/attachments.ts +309 -0
- package/src/modules/documents/commands/comments.ts +966 -0
- package/src/modules/documents/commands/content.ts +294 -0
- package/src/modules/documents/commands/document-crud.ts +609 -0
- package/src/modules/documents/commands/documents.ts +581 -0
- package/src/modules/documents/commands/duplicate.ts +772 -0
- package/src/modules/documents/commands/favorites.ts +171 -0
- package/src/modules/documents/commands/folders.ts +506 -0
- package/src/modules/documents/commands/index.ts +33 -0
- package/src/modules/documents/commands/interceptors.ts +402 -0
- package/src/modules/documents/commands/lifecycle.ts +333 -0
- package/src/modules/documents/commands/links.ts +486 -0
- package/src/modules/documents/commands/mutation-helpers.ts +48 -0
- package/src/modules/documents/commands/projection-types.ts +77 -0
- package/src/modules/documents/commands/shared.ts +219 -0
- package/src/modules/documents/commands/shares.ts +612 -0
- package/src/modules/documents/commands/side-effects.ts +130 -0
- package/src/modules/documents/commands/templates.ts +522 -0
- package/src/modules/documents/commands/versions.ts +537 -0
- package/src/modules/documents/commands/watchers.ts +181 -0
- package/src/modules/documents/data/entities.ts +631 -0
- package/src/modules/documents/data/extensions.ts +42 -0
- package/src/modules/documents/data/validators.ts +248 -0
- package/src/modules/documents/di.ts +33 -0
- package/src/modules/documents/encryption.ts +14 -0
- package/src/modules/documents/events.ts +23 -0
- package/src/modules/documents/i18n/.hardcoded-allowlist.json +9 -0
- package/src/modules/documents/i18n/de.json +522 -0
- package/src/modules/documents/i18n/en.json +522 -0
- package/src/modules/documents/i18n/es.json +522 -0
- package/src/modules/documents/i18n/ko.json +522 -0
- package/src/modules/documents/i18n/pl.json +522 -0
- package/src/modules/documents/index.ts +17 -0
- package/src/modules/documents/lib/attachmentServicePort.ts +94 -0
- package/src/modules/documents/lib/capabilities.ts +57 -0
- package/src/modules/documents/lib/collabCloseEvents.ts +26 -0
- package/src/modules/documents/lib/collabEndpoint.ts +43 -0
- package/src/modules/documents/lib/collabMaterializer.ts +140 -0
- package/src/modules/documents/lib/collabToken.ts +170 -0
- package/src/modules/documents/lib/collaborationAwareness.ts +102 -0
- package/src/modules/documents/lib/commentAnchors.ts +19 -0
- package/src/modules/documents/lib/constants.ts +39 -0
- package/src/modules/documents/lib/contentService.ts +340 -0
- package/src/modules/documents/lib/displayLabels.ts +31 -0
- package/src/modules/documents/lib/docxRenderer.ts +685 -0
- package/src/modules/documents/lib/duplicateContent.ts +32 -0
- package/src/modules/documents/lib/editorConfig.ts +371 -0
- package/src/modules/documents/lib/entityLinks.ts +250 -0
- package/src/modules/documents/lib/entityRegistry.server.ts +267 -0
- package/src/modules/documents/lib/entityRegistry.ts +345 -0
- package/src/modules/documents/lib/entityRegistryAvailability.server.ts +19 -0
- package/src/modules/documents/lib/entitySuggestion.ts +61 -0
- package/src/modules/documents/lib/favorites.ts +35 -0
- package/src/modules/documents/lib/folderHierarchySerialization.ts +34 -0
- package/src/modules/documents/lib/historyLimits.ts +154 -0
- package/src/modules/documents/lib/historyPolicy.ts +7 -0
- package/src/modules/documents/lib/organizationAccess.ts +44 -0
- package/src/modules/documents/lib/pdfHtml.ts +65 -0
- package/src/modules/documents/lib/pdfRenderer.ts +367 -0
- package/src/modules/documents/lib/permissions.ts +299 -0
- package/src/modules/documents/lib/platformServices.ts +70 -0
- package/src/modules/documents/lib/recordFieldInsertion.ts +72 -0
- package/src/modules/documents/lib/requestBody.ts +97 -0
- package/src/modules/documents/lib/resourceLimits.ts +94 -0
- package/src/modules/documents/lib/shareCounts.ts +44 -0
- package/src/modules/documents/lib/templateFill.ts +138 -0
- package/src/modules/documents/lib/templateInstantiation.ts +206 -0
- package/src/modules/documents/lib/templatePreviewDigest.ts +122 -0
- package/src/modules/documents/lib/templateSeeds.ts +248 -0
- package/src/modules/documents/lib/userLabels.ts +58 -0
- package/src/modules/documents/lib/versionContent.ts +163 -0
- package/src/modules/documents/lib/versionLabels.ts +9 -0
- package/src/modules/documents/lib/versioning.ts +29 -0
- package/src/modules/documents/lib/visibility.ts +610 -0
- package/src/modules/documents/lib/watchers.ts +129 -0
- package/src/modules/documents/migrations/.snapshot-open-mercato.json +2892 -0
- package/src/modules/documents/migrations/Migration20260708163836_documents.ts +50 -0
- package/src/modules/documents/migrations/Migration20260709164720_documents.ts +19 -0
- package/src/modules/documents/migrations/Migration20260710002318_documents.ts +35 -0
- package/src/modules/documents/migrations/Migration20260710071003_documents.ts +13 -0
- package/src/modules/documents/migrations/Migration20260712120000_documents.ts +13 -0
- package/src/modules/documents/migrations/Migration20260712183000_documents.ts +12 -0
- package/src/modules/documents/migrations/Migration20260713092156_documents.ts +43 -0
- package/src/modules/documents/migrations/Migration20260717000000_documents.ts +40 -0
- package/src/modules/documents/notifications.ts +45 -0
- package/src/modules/documents/search.ts +118 -0
- package/src/modules/documents/setup.ts +19 -0
- package/src/modules/documents/widgets/injection/related-documents/LinkDocumentDialog.tsx +224 -0
- package/src/modules/documents/widgets/injection/related-documents/context.ts +101 -0
- package/src/modules/documents/widgets/injection/related-documents/useRelatedDocuments.ts +112 -0
- package/src/modules/documents/widgets/injection/related-documents/widget.client.tsx +76 -0
- package/src/modules/documents/widgets/injection/related-documents/widget.ts +19 -0
- package/src/modules/documents/widgets/injection-table.ts +20 -0
- package/tsconfig.json +9 -0
- package/watch.mjs +6 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../src/modules/documents/backend/documents/%5Bid%5D/commentTypes.ts"],
|
|
4
|
+
"sourcesContent": ["import type { DocumentCommentAnchor } from '../../../data/validators'\nimport { isChangedDocumentCommentAnchor, normalizeDocumentCommentAnchor } from '../../../lib/commentAnchors'\nimport {\n firstSafeDocumentsDisplayLabel,\n sanitizeDocumentsDisplayLabel,\n} from '../../../lib/displayLabels'\nimport { readArrayPayload, readBoolean, readRecord, readString } from '../documentUi'\n\nexport type CommentMention = { userId: string }\nexport type UserLabel = { label: string; secondary?: string | null }\nexport type UserLabels = Record<string, UserLabel>\nexport type PendingMention = { userId: string; name: string }\nexport type AccessCheckUser = { userId: string; label: string | null; secondary: string | null }\nexport type NormalizedCommentAnchor = DocumentCommentAnchor | 'changed' | null\n\nconst MENTION_WORD_CHARACTER = /[\\p{L}\\p{N}_]/u\n\nfunction isMentionTokenBoundary(body: string, index: number, tokenLength: number): boolean {\n const before = index > 0 ? body[index - 1] ?? '' : ''\n const after = body[index + tokenLength] ?? ''\n return !MENTION_WORD_CHARACTER.test(before) && !MENTION_WORD_CHARACTER.test(after)\n}\n\nexport function bodyContainsPendingMention(body: string, mention: PendingMention): boolean {\n const token = `@${mention.name}`\n let index = body.indexOf(token)\n while (index >= 0) {\n if (isMentionTokenBoundary(body, index, token.length)) return true\n index = body.indexOf(token, index + token.length)\n }\n return false\n}\n\nexport function removePendingMentionOccurrences(\n body: string,\n mention: PendingMention,\n pendingMentions: PendingMention[],\n): string {\n const token = `@${mention.name}`\n const extendingTokens = pendingMentions\n .map((candidate) => `@${candidate.name}`)\n .filter((candidate) => candidate.length > token.length && candidate.startsWith(token))\n .sort((left, right) => right.length - left.length)\n let result = ''\n let cursor = 0\n while (cursor < body.length) {\n const extending = extendingTokens.find((candidate) => (\n body.startsWith(candidate, cursor) && isMentionTokenBoundary(body, cursor, candidate.length)\n ))\n if (extending) {\n result += extending\n cursor += extending.length\n continue\n }\n if (body.startsWith(token, cursor) && isMentionTokenBoundary(body, cursor, token.length)) {\n cursor += token.length\n continue\n }\n result += body[cursor]\n cursor += 1\n }\n return result\n}\n\nexport type DocumentComment = {\n id: string\n documentId: string\n parentCommentId: string | null\n authorUserId: string\n body: string\n mentions: CommentMention[]\n anchor: NormalizedCommentAnchor\n resolvedAt: string | null\n resolvedByUserId: string | null\n createdAt: string\n updatedAt: string\n canResolve: boolean\n replies: DocumentComment[]\n}\n\nfunction readNullableString(record: Record<string, unknown>, ...keys: string[]): string | null {\n for (const key of keys) {\n const value = record[key]\n if (value === null) return null\n if (typeof value === 'string' && value.trim().length > 0) return value\n }\n return null\n}\n\nfunction readAnchor(value: unknown): NormalizedCommentAnchor {\n if (value === null || value === undefined) return null\n const normalized = normalizeDocumentCommentAnchor(value)\n return isChangedDocumentCommentAnchor(normalized) ? 'changed' : normalized\n}\n\nfunction readMentions(value: unknown): CommentMention[] {\n if (!Array.isArray(value)) return []\n return value.flatMap((entry) => {\n const record = readRecord(entry)\n const userId = record ? readString(record, 'userId', 'user_id') : null\n return userId ? [{ userId: userId.toLowerCase() }] : []\n })\n}\n\nfunction normalizeComment(value: unknown): DocumentComment | null {\n const record = readRecord(value)\n if (!record) return null\n const id = readString(record, 'id')\n const documentId = readString(record, 'documentId', 'document_id')\n const authorUserId = readString(record, 'authorUserId', 'author_user_id')\n const createdAt = readString(record, 'createdAt', 'created_at')\n const updatedAt = readString(record, 'updatedAt', 'updated_at')\n if (!id || !documentId || !authorUserId || !createdAt || !updatedAt) return null\n const replies = Array.isArray(record.replies)\n ? record.replies.map(normalizeComment).filter((reply): reply is DocumentComment => reply !== null)\n : []\n return {\n id,\n documentId,\n parentCommentId: readNullableString(record, 'parentCommentId', 'parent_comment_id'),\n authorUserId,\n body: readString(record, 'body') ?? '',\n mentions: readMentions(record.mentions),\n anchor: readAnchor(record.anchor),\n resolvedAt: readNullableString(record, 'resolvedAt', 'resolved_at'),\n resolvedByUserId: readNullableString(record, 'resolvedByUserId', 'resolved_by_user_id'),\n createdAt,\n updatedAt,\n canResolve: readBoolean(record, 'canResolve', 'can_resolve') ?? false,\n replies,\n }\n}\n\nexport function readCommentItems(payload: unknown): DocumentComment[] {\n return readArrayPayload(payload, 'items', 'data')\n .map(normalizeComment)\n .filter((comment): comment is DocumentComment => comment !== null)\n}\n\nexport function readUserLabels(payload: unknown, fallbackLabel?: string): UserLabels {\n const record = readRecord(payload)\n const rawLabels = readRecord(record?.userLabels)\n if (!rawLabels) return {}\n const safeFallback = sanitizeDocumentsDisplayLabel(fallbackLabel)\n const labels: UserLabels = {}\n for (const [userId, value] of Object.entries(rawLabels)) {\n const labelRecord = readRecord(value)\n const label = labelRecord\n ? firstSafeDocumentsDisplayLabel(readString(labelRecord, 'label'), safeFallback)\n : safeFallback\n const secondary = labelRecord\n ? sanitizeDocumentsDisplayLabel(readNullableString(labelRecord, 'secondary'))\n : null\n if (label) labels[userId.toLowerCase()] = {\n label,\n secondary: secondary && secondary !== label ? secondary : null,\n }\n }\n return labels\n}\n\nexport function readWithoutAccess(payload: unknown): AccessCheckUser[] {\n const record = readRecord(payload)\n if (!record) return []\n if (Array.isArray(record.withoutAccessUsers)) {\n return record.withoutAccessUsers.flatMap((value) => {\n const user = readRecord(value)\n const userId = user ? readString(user, 'userId', 'user_id', 'id') : null\n if (!userId || !user) return []\n const label = sanitizeDocumentsDisplayLabel(readNullableString(user, 'label'))\n const secondary = sanitizeDocumentsDisplayLabel(readNullableString(user, 'secondary'))\n return [{\n userId: userId.toLowerCase(),\n label,\n secondary: secondary && secondary !== label ? secondary : null,\n }]\n })\n }\n if (!Array.isArray(record.withoutAccess)) return []\n return record.withoutAccess.flatMap((value) => typeof value === 'string' ? [{\n userId: value.toLowerCase(), label: null, secondary: null,\n }] : [])\n}\n\nexport function findCommentById(comments: DocumentComment[], commentId: string): DocumentComment | null {\n for (const comment of comments) {\n if (comment.id === commentId) return comment\n const reply = findCommentById(comment.replies, commentId)\n if (reply) return reply\n }\n return null\n}\n"],
|
|
5
|
+
"mappings": "AACA,SAAS,gCAAgC,sCAAsC;AAC/E;AAAA,EACE;AAAA,EACA;AAAA,OACK;AACP,SAAS,kBAAkB,aAAa,YAAY,kBAAkB;AAStE,MAAM,yBAAyB;AAE/B,SA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C7B,YAAM,SAAS,OAAO,WAAW,MAAM,UAAU,WAAW,IAAI,IAAI;AACpE,UAAI,CAAC,UAAU,CAAC,KAAM,QAAO,CAAC;AAC9B,YAAM,QAAQ,8BAA8B,mBAAmB,MAAM,OAAO,CAAC;AAC7E,YAAM,YAAY,8BAA8B,mBAAmB,MAAM,WAAW,CAAC;AACrF,aAAO,CAAC;AAAA,QACN,QAAQ,OAAO,YAAY;AAAA,QAC3B;AAAA,QACA,WAAW,aAAa,cAAc,QAAQ,YAAY;AAAA,MAC5D,CAAC;AAAA,IACH,CAAC;AAAA,EACH;AACA,MAAI,CAAC,MAAM,QAAQ,OAAO,aAAa,EAAG,QAAO,CAAC;AAClD,SAAO,OAAO,cAAc,QAAQ,CAAC,UAAU,OAAO,UAAU,WAAW,CAAC;AAAA,IAC1E,QAAQ,MAAM,YAAY;AAAA,IAAG,OAAO;AAAA,IAAM,WAAW;AAAA,EACvD,CAAC,IAAI,CAAC,CAAC;AACT;AAEO,SAAS,gBAAgB,UAA6B,WAA2C;AACtG,aAAW,WAAW,UAAU;AAC9B,QAAI,QAAQ,OAAO,UAAW,QAAO;AACrC,UAAM,QAAQ,gBAAgB,QAAQ,SAAS,SAAS;AACxD,QAAI,MAAO,QAAO;AAAA,EACpB;AACA,SAAO;AACT;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
function resolveCommentsCapability(canComment, tier) {
|
|
2
|
+
if (canComment !== void 0) return canComment;
|
|
3
|
+
return tier === "commenter" || tier === "editor" || tier === "owner";
|
|
4
|
+
}
|
|
5
|
+
function resolveVersionRestoreCapability(canRestore, tier) {
|
|
6
|
+
if (canRestore !== void 0) return canRestore;
|
|
7
|
+
return tier === "editor" || tier === "owner";
|
|
8
|
+
}
|
|
9
|
+
export {
|
|
10
|
+
resolveCommentsCapability,
|
|
11
|
+
resolveVersionRestoreCapability
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=componentCapabilities.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../src/modules/documents/backend/documents/%5Bid%5D/componentCapabilities.ts"],
|
|
4
|
+
"sourcesContent": ["export type DocumentTier = 'owner' | 'editor' | 'commenter' | 'viewer'\n\nexport function resolveCommentsCapability(\n canComment: boolean | undefined,\n tier: DocumentTier | undefined,\n): boolean {\n if (canComment !== undefined) return canComment\n return tier === 'commenter' || tier === 'editor' || tier === 'owner'\n}\n\nexport function resolveVersionRestoreCapability(\n canRestore: boolean | undefined,\n tier: DocumentTier | undefined,\n): boolean {\n if (canRestore !== undefined) return canRestore\n return tier === 'editor' || tier === 'owner'\n}\n"],
|
|
5
|
+
"mappings": "AAEO,SAAS,0BACd,YACA,MACS;AACT,MAAI,eAAe,OAAW,QAAO;AACrC,SAAO,SAAS,eAAe,SAAS,YAAY,SAAS;AAC/D;AAEO,SAAS,gCACd,YACA,MACS;AACT,MAAI,eAAe,OAAW,QAAO;AACrC,SAAO,SAAS,YAAY,SAAS;AACvC;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,295 @@
|
|
|
1
|
+
import { Extension } from "@tiptap/core";
|
|
2
|
+
import { Plugin, PluginKey } from "@tiptap/pm/state";
|
|
3
|
+
import { Decoration, DecorationSet } from "@tiptap/pm/view";
|
|
4
|
+
const A4_PAGE_WIDTH_MM = 210;
|
|
5
|
+
const A4_PAGE_HEIGHT_MM = 297;
|
|
6
|
+
const DOCUMENT_PAGE_HORIZONTAL_MARGIN_MM = 20;
|
|
7
|
+
const DOCUMENT_PAGE_VERTICAL_MARGIN_MM = 22;
|
|
8
|
+
const DOCUMENT_PAGE_GUTTER_PX = 24;
|
|
9
|
+
const CSS_PIXELS_PER_MM = 96 / 25.4;
|
|
10
|
+
const PAGE_CONTENT_HEIGHT_PX = (A4_PAGE_HEIGHT_MM - DOCUMENT_PAGE_VERTICAL_MARGIN_MM * 2) * CSS_PIXELS_PER_MM;
|
|
11
|
+
const PAGE_VERTICAL_MARGIN_PX = DOCUMENT_PAGE_VERTICAL_MARGIN_MM * CSS_PIXELS_PER_MM;
|
|
12
|
+
const PAGE_BREAK_EPSILON_PX = 0.5;
|
|
13
|
+
const DOCUMENT_PAGINATION_UPDATE_DELAY_MS = 120;
|
|
14
|
+
const DOCUMENT_PAGINATION_PLUGIN_KEY = new PluginKey("documentsPagination");
|
|
15
|
+
function nextPageBreak(position, remainingContentHeight, pageMarginHeight, pageGutterHeight) {
|
|
16
|
+
const safeRemaining = Math.max(0, remainingContentHeight);
|
|
17
|
+
return {
|
|
18
|
+
position,
|
|
19
|
+
remainingContentHeight: safeRemaining,
|
|
20
|
+
totalHeight: safeRemaining + pageMarginHeight * 2 + pageGutterHeight
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
function calculateDocumentPageBreaks(blocks, options = {}) {
|
|
24
|
+
const pageContentHeight = Math.max(1, options.pageContentHeight ?? PAGE_CONTENT_HEIGHT_PX);
|
|
25
|
+
const firstPageUsedHeight2 = Math.max(0, options.firstPageUsedHeight ?? 0);
|
|
26
|
+
const pageMarginHeight = Math.max(0, options.pageMarginHeight ?? PAGE_VERTICAL_MARGIN_PX);
|
|
27
|
+
const pageGutterHeight = Math.max(0, options.pageGutterHeight ?? DOCUMENT_PAGE_GUTTER_PX);
|
|
28
|
+
const breaks = [];
|
|
29
|
+
let pageStart = -Math.min(firstPageUsedHeight2, pageContentHeight);
|
|
30
|
+
let pageBottom = pageStart + pageContentHeight;
|
|
31
|
+
for (const block of blocks) {
|
|
32
|
+
const top = Math.max(0, block.top);
|
|
33
|
+
const bottom = Math.max(top, block.bottom);
|
|
34
|
+
const height = bottom - top;
|
|
35
|
+
if (bottom <= pageBottom + PAGE_BREAK_EPSILON_PX) continue;
|
|
36
|
+
const hasEarlierContentOnPage = top > pageStart + PAGE_BREAK_EPSILON_PX;
|
|
37
|
+
if (height > pageContentHeight) {
|
|
38
|
+
if (hasEarlierContentOnPage) {
|
|
39
|
+
breaks.push(nextPageBreak(
|
|
40
|
+
block.position,
|
|
41
|
+
pageBottom - top,
|
|
42
|
+
pageMarginHeight,
|
|
43
|
+
pageGutterHeight
|
|
44
|
+
));
|
|
45
|
+
pageStart = top;
|
|
46
|
+
pageBottom = pageStart + pageContentHeight;
|
|
47
|
+
}
|
|
48
|
+
while (bottom > pageBottom + PAGE_BREAK_EPSILON_PX) {
|
|
49
|
+
pageStart = pageBottom;
|
|
50
|
+
pageBottom = pageStart + pageContentHeight;
|
|
51
|
+
}
|
|
52
|
+
continue;
|
|
53
|
+
}
|
|
54
|
+
breaks.push(nextPageBreak(
|
|
55
|
+
block.position,
|
|
56
|
+
pageBottom - top,
|
|
57
|
+
pageMarginHeight,
|
|
58
|
+
pageGutterHeight
|
|
59
|
+
));
|
|
60
|
+
pageStart = top;
|
|
61
|
+
pageBottom = pageStart + pageContentHeight;
|
|
62
|
+
}
|
|
63
|
+
return breaks;
|
|
64
|
+
}
|
|
65
|
+
function createPageBreakDom(pageBreak, pageNumber) {
|
|
66
|
+
const root = document.createElement("div");
|
|
67
|
+
root.className = "om-doc-page-break";
|
|
68
|
+
root.contentEditable = "false";
|
|
69
|
+
root.setAttribute("aria-hidden", "true");
|
|
70
|
+
root.setAttribute("data-document-page-break", "");
|
|
71
|
+
const pageEnd = document.createElement("div");
|
|
72
|
+
pageEnd.className = "om-doc-page-end";
|
|
73
|
+
pageEnd.style.height = `${pageBreak.remainingContentHeight + PAGE_VERTICAL_MARGIN_PX}px`;
|
|
74
|
+
const pageNumberLabel = document.createElement("span");
|
|
75
|
+
pageNumberLabel.className = "om-doc-page-number";
|
|
76
|
+
pageNumberLabel.textContent = String(pageNumber);
|
|
77
|
+
pageEnd.append(pageNumberLabel);
|
|
78
|
+
const gutter = document.createElement("div");
|
|
79
|
+
gutter.className = "om-doc-page-gutter";
|
|
80
|
+
gutter.style.height = `${DOCUMENT_PAGE_GUTTER_PX}px`;
|
|
81
|
+
const pageStart = document.createElement("div");
|
|
82
|
+
pageStart.className = "om-doc-page-start";
|
|
83
|
+
pageStart.setAttribute("data-document-page-start", "");
|
|
84
|
+
pageStart.style.height = `${PAGE_VERTICAL_MARGIN_PX}px`;
|
|
85
|
+
root.append(pageEnd, gutter, pageStart);
|
|
86
|
+
return root;
|
|
87
|
+
}
|
|
88
|
+
function createDecorations(doc, breaks) {
|
|
89
|
+
return DecorationSet.create(doc, breaks.map((pageBreak, index) => Decoration.widget(
|
|
90
|
+
pageBreak.position,
|
|
91
|
+
() => createPageBreakDom(pageBreak, index + 1),
|
|
92
|
+
{
|
|
93
|
+
key: [
|
|
94
|
+
"document-page-break",
|
|
95
|
+
pageBreak.position,
|
|
96
|
+
index + 1,
|
|
97
|
+
pageBreak.remainingContentHeight
|
|
98
|
+
].join(":"),
|
|
99
|
+
side: -1,
|
|
100
|
+
ignoreSelection: true
|
|
101
|
+
}
|
|
102
|
+
)));
|
|
103
|
+
}
|
|
104
|
+
function readPaginationMeta(transaction) {
|
|
105
|
+
const meta = transaction.getMeta(DOCUMENT_PAGINATION_PLUGIN_KEY);
|
|
106
|
+
return meta && Array.isArray(meta.breaks) ? meta : null;
|
|
107
|
+
}
|
|
108
|
+
function paginationStateApply(transaction, current, _oldState, newState) {
|
|
109
|
+
const meta = readPaginationMeta(transaction);
|
|
110
|
+
if (meta) {
|
|
111
|
+
return {
|
|
112
|
+
breaks: meta.breaks,
|
|
113
|
+
decorations: createDecorations(newState.doc, meta.breaks)
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
if (!transaction.docChanged) return current;
|
|
117
|
+
const mappedBreaks = current.breaks.map((pageBreak) => ({
|
|
118
|
+
...pageBreak,
|
|
119
|
+
position: transaction.mapping.map(pageBreak.position, -1)
|
|
120
|
+
}));
|
|
121
|
+
return {
|
|
122
|
+
breaks: mappedBreaks,
|
|
123
|
+
decorations: current.decorations.map(transaction.mapping, transaction.doc)
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
function breaksEqual(left, right) {
|
|
127
|
+
return left.length === right.length && left.every((value, index) => {
|
|
128
|
+
const candidate = right[index];
|
|
129
|
+
return candidate !== void 0 && value.position === candidate.position && Math.abs(value.remainingContentHeight - candidate.remainingContentHeight) < PAGE_BREAK_EPSILON_PX && Math.abs(value.totalHeight - candidate.totalHeight) < PAGE_BREAK_EPSILON_PX;
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
function measureTopLevelBlocks(view, currentBreaks) {
|
|
133
|
+
const rootRect = view.dom.getBoundingClientRect();
|
|
134
|
+
const paper = view.dom.closest(".om-doc-paper");
|
|
135
|
+
const paperWidthCssPx = A4_PAGE_WIDTH_MM * CSS_PIXELS_PER_MM;
|
|
136
|
+
const scale = paper ? Math.max(0.01, paper.getBoundingClientRect().width / paperWidthCssPx) : 1;
|
|
137
|
+
const blocks = [];
|
|
138
|
+
let breakIndex = 0;
|
|
139
|
+
let insertedHeight = 0;
|
|
140
|
+
view.state.doc.forEach((_node, position) => {
|
|
141
|
+
const nodeDom = view.nodeDOM(position);
|
|
142
|
+
if (!(nodeDom instanceof HTMLElement)) return;
|
|
143
|
+
const rect = nodeDom.getBoundingClientRect();
|
|
144
|
+
while (breakIndex < currentBreaks.length) {
|
|
145
|
+
const pageBreak = currentBreaks[breakIndex];
|
|
146
|
+
if (!pageBreak || pageBreak.position > position) break;
|
|
147
|
+
insertedHeight += pageBreak.totalHeight;
|
|
148
|
+
breakIndex += 1;
|
|
149
|
+
}
|
|
150
|
+
blocks.push({
|
|
151
|
+
position,
|
|
152
|
+
top: (rect.top - rootRect.top) / scale - insertedHeight,
|
|
153
|
+
bottom: (rect.bottom - rootRect.top) / scale - insertedHeight
|
|
154
|
+
});
|
|
155
|
+
});
|
|
156
|
+
return blocks;
|
|
157
|
+
}
|
|
158
|
+
function firstPageUsedHeight(view) {
|
|
159
|
+
const paper = view.dom.closest(".om-doc-paper");
|
|
160
|
+
if (!paper) return 0;
|
|
161
|
+
const paperRect = paper.getBoundingClientRect();
|
|
162
|
+
const paperWidthCssPx = A4_PAGE_WIDTH_MM * CSS_PIXELS_PER_MM;
|
|
163
|
+
const scale = Math.max(0.01, paperRect.width / paperWidthCssPx);
|
|
164
|
+
const paddingTop = Number.parseFloat(getComputedStyle(paper).paddingTop) || PAGE_VERTICAL_MARGIN_PX;
|
|
165
|
+
return Math.max(0, (view.dom.getBoundingClientRect().top - paperRect.top) / scale - paddingTop);
|
|
166
|
+
}
|
|
167
|
+
function createDocumentPaginationPlugin() {
|
|
168
|
+
return new Plugin({
|
|
169
|
+
key: DOCUMENT_PAGINATION_PLUGIN_KEY,
|
|
170
|
+
state: {
|
|
171
|
+
init: () => ({ breaks: [], decorations: DecorationSet.empty }),
|
|
172
|
+
apply: paginationStateApply
|
|
173
|
+
},
|
|
174
|
+
props: {
|
|
175
|
+
decorations: (state) => DOCUMENT_PAGINATION_PLUGIN_KEY.getState(state)?.decorations ?? null
|
|
176
|
+
},
|
|
177
|
+
view: (view) => {
|
|
178
|
+
let frame = null;
|
|
179
|
+
let updateTimer = null;
|
|
180
|
+
let destroyed = false;
|
|
181
|
+
const recompute = () => {
|
|
182
|
+
frame = null;
|
|
183
|
+
if (destroyed) return;
|
|
184
|
+
const current = DOCUMENT_PAGINATION_PLUGIN_KEY.getState(view.state)?.breaks ?? [];
|
|
185
|
+
const next = calculateDocumentPageBreaks(measureTopLevelBlocks(view, current), {
|
|
186
|
+
firstPageUsedHeight: firstPageUsedHeight(view)
|
|
187
|
+
});
|
|
188
|
+
if (breaksEqual(current, next)) return;
|
|
189
|
+
view.dispatch(
|
|
190
|
+
view.state.tr.setMeta(DOCUMENT_PAGINATION_PLUGIN_KEY, { breaks: next }).setMeta("addToHistory", false)
|
|
191
|
+
);
|
|
192
|
+
};
|
|
193
|
+
const schedule = () => {
|
|
194
|
+
if (destroyed || frame !== null) return;
|
|
195
|
+
if (updateTimer !== null) {
|
|
196
|
+
window.clearTimeout(updateTimer);
|
|
197
|
+
updateTimer = null;
|
|
198
|
+
}
|
|
199
|
+
frame = requestAnimationFrame(recompute);
|
|
200
|
+
};
|
|
201
|
+
const scheduleDocumentUpdate = () => {
|
|
202
|
+
if (destroyed) return;
|
|
203
|
+
if (updateTimer !== null) window.clearTimeout(updateTimer);
|
|
204
|
+
updateTimer = window.setTimeout(() => {
|
|
205
|
+
updateTimer = null;
|
|
206
|
+
schedule();
|
|
207
|
+
}, DOCUMENT_PAGINATION_UPDATE_DELAY_MS);
|
|
208
|
+
};
|
|
209
|
+
const resizeObserver = typeof ResizeObserver === "undefined" ? null : new ResizeObserver(schedule);
|
|
210
|
+
resizeObserver?.observe(view.dom);
|
|
211
|
+
const paper = view.dom.closest(".om-doc-paper");
|
|
212
|
+
if (paper) resizeObserver?.observe(paper);
|
|
213
|
+
view.dom.addEventListener("load", schedule, true);
|
|
214
|
+
window.addEventListener("resize", schedule);
|
|
215
|
+
schedule();
|
|
216
|
+
return {
|
|
217
|
+
update: (_nextView, previousState) => {
|
|
218
|
+
if (previousState.doc === view.state.doc) return;
|
|
219
|
+
scheduleDocumentUpdate();
|
|
220
|
+
},
|
|
221
|
+
destroy: () => {
|
|
222
|
+
destroyed = true;
|
|
223
|
+
if (frame !== null) cancelAnimationFrame(frame);
|
|
224
|
+
if (updateTimer !== null) window.clearTimeout(updateTimer);
|
|
225
|
+
resizeObserver?.disconnect();
|
|
226
|
+
view.dom.removeEventListener("load", schedule, true);
|
|
227
|
+
window.removeEventListener("resize", schedule);
|
|
228
|
+
}
|
|
229
|
+
};
|
|
230
|
+
}
|
|
231
|
+
});
|
|
232
|
+
}
|
|
233
|
+
const DocumentPagination = Extension.create({
|
|
234
|
+
name: "documentPagination",
|
|
235
|
+
addProseMirrorPlugins() {
|
|
236
|
+
return [createDocumentPaginationPlugin()];
|
|
237
|
+
}
|
|
238
|
+
});
|
|
239
|
+
const DOCUMENT_PAGINATION_STYLES = `
|
|
240
|
+
.om-doc-paper {
|
|
241
|
+
box-sizing: border-box;
|
|
242
|
+
width: ${A4_PAGE_WIDTH_MM}mm;
|
|
243
|
+
min-width: ${A4_PAGE_WIDTH_MM}mm;
|
|
244
|
+
max-width: ${A4_PAGE_WIDTH_MM}mm;
|
|
245
|
+
min-height: ${A4_PAGE_HEIGHT_MM}mm;
|
|
246
|
+
padding: ${DOCUMENT_PAGE_VERTICAL_MARGIN_MM}mm ${DOCUMENT_PAGE_HORIZONTAL_MARGIN_MM}mm;
|
|
247
|
+
}
|
|
248
|
+
.om-doc-canvas {
|
|
249
|
+
overflow-x: auto;
|
|
250
|
+
scrollbar-gutter: stable;
|
|
251
|
+
overscroll-behavior-inline: contain;
|
|
252
|
+
}
|
|
253
|
+
.om-doc-paper .om-doc-page-break {
|
|
254
|
+
display: block;
|
|
255
|
+
width: ${A4_PAGE_WIDTH_MM}mm;
|
|
256
|
+
margin-left: -${DOCUMENT_PAGE_HORIZONTAL_MARGIN_MM}mm;
|
|
257
|
+
pointer-events: none;
|
|
258
|
+
user-select: none;
|
|
259
|
+
}
|
|
260
|
+
.om-doc-paper .om-doc-page-end,
|
|
261
|
+
.om-doc-paper .om-doc-page-start {
|
|
262
|
+
background: var(--card);
|
|
263
|
+
}
|
|
264
|
+
.om-doc-paper .om-doc-page-end {
|
|
265
|
+
position: relative;
|
|
266
|
+
}
|
|
267
|
+
.om-doc-paper .om-doc-page-number {
|
|
268
|
+
position: absolute;
|
|
269
|
+
right: ${DOCUMENT_PAGE_HORIZONTAL_MARGIN_MM}mm;
|
|
270
|
+
bottom: 6mm;
|
|
271
|
+
color: var(--muted-foreground);
|
|
272
|
+
font-size: 0.75rem;
|
|
273
|
+
line-height: 1rem;
|
|
274
|
+
}
|
|
275
|
+
.om-doc-paper .om-doc-page-gutter {
|
|
276
|
+
border-top: 1px solid var(--border);
|
|
277
|
+
border-bottom: 1px solid var(--border);
|
|
278
|
+
background: var(--muted);
|
|
279
|
+
box-shadow: inset 0 1px 2px color-mix(in oklab, var(--foreground) 8%, transparent);
|
|
280
|
+
}
|
|
281
|
+
`;
|
|
282
|
+
export {
|
|
283
|
+
A4_PAGE_HEIGHT_MM,
|
|
284
|
+
A4_PAGE_WIDTH_MM,
|
|
285
|
+
DOCUMENT_PAGE_GUTTER_PX,
|
|
286
|
+
DOCUMENT_PAGE_HORIZONTAL_MARGIN_MM,
|
|
287
|
+
DOCUMENT_PAGE_VERTICAL_MARGIN_MM,
|
|
288
|
+
DOCUMENT_PAGINATION_PLUGIN_KEY,
|
|
289
|
+
DOCUMENT_PAGINATION_STYLES,
|
|
290
|
+
DOCUMENT_PAGINATION_UPDATE_DELAY_MS,
|
|
291
|
+
DocumentPagination,
|
|
292
|
+
calculateDocumentPageBreaks,
|
|
293
|
+
createDocumentPaginationPlugin
|
|
294
|
+
};
|
|
295
|
+
//# sourceMappingURL=documentPagination.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../src/modules/documents/backend/documents/%5Bid%5D/documentPagination.ts"],
|
|
4
|
+
"sourcesContent": ["import { Extension } from '@tiptap/core'\nimport type { Node as ProseMirrorNode } from '@tiptap/pm/model'\nimport { Plugin, PluginKey, type EditorState, type Transaction } from '@tiptap/pm/state'\nimport { Decoration, DecorationSet, type EditorView } from '@tiptap/pm/view'\n\nexport const A4_PAGE_WIDTH_MM = 210\nexport const A4_PAGE_HEIGHT_MM = 297\nexport const DOCUMENT_PAGE_HORIZONTAL_MARGIN_MM = 20\nexport const DOCUMENT_PAGE_VERTICAL_MARGIN_MM = 22\nexport const DOCUMENT_PAGE_GUTTER_PX = 24\n\nconst CSS_PIXELS_PER_MM = 96 / 25.4\nconst PAGE_CONTENT_HEIGHT_PX = (\n A4_PAGE_HEIGHT_MM - (DOCUMENT_PAGE_VERTICAL_MARGIN_MM * 2)\n) * CSS_PIXELS_PER_MM\nconst PAGE_VERTICAL_MARGIN_PX = DOCUMENT_PAGE_VERTICAL_MARGIN_MM * CSS_PIXELS_PER_MM\nconst PAGE_BREAK_EPSILON_PX = 0.5\nexport const DOCUMENT_PAGINATION_UPDATE_DELAY_MS = 120\n\nexport type PaginationBlockMeasurement = {\n position: number\n top: number\n bottom: number\n}\n\nexport type DocumentPageBreak = {\n position: number\n remainingContentHeight: number\n totalHeight: number\n}\n\ntype PaginationPluginState = {\n breaks: DocumentPageBreak[]\n decorations: DecorationSet\n}\n\ntype PaginationMeta = {\n breaks: DocumentPageBreak[]\n}\n\nexport const DOCUMENT_PAGINATION_PLUGIN_KEY = new PluginKey<PaginationPluginState>('documentsPagination')\n\nfunction nextPageBreak(\n position: number,\n remainingContentHeight: number,\n pageMarginHeight: number,\n pageGutterHeight: number,\n): DocumentPageBreak {\n const safeRemaining = Math.max(0, remainingContentHeight)\n return {\n position,\n remainingContentHeight: safeRemaining,\n totalHeight: safeRemaining + (pageMarginHeight * 2) + pageGutterHeight,\n }\n}\n\nexport function calculateDocumentPageBreaks(\n blocks: PaginationBlockMeasurement[],\n options: {\n pageContentHeight?: number\n firstPageUsedHeight?: number\n pageMarginHeight?: number\n pageGutterHeight?: number\n } = {},\n): DocumentPageBreak[] {\n const pageContentHeight = Math.max(1, options.pageContentHeight ?? PAGE_CONTENT_HEIGHT_PX)\n const firstPageUsedHeight = Math.max(0, options.firstPageUsedHeight ?? 0)\n const pageMarginHeight = Math.max(0, options.pageMarginHeight ?? PAGE_VERTICAL_MARGIN_PX)\n const pageGutterHeight = Math.max(0, options.pageGutterHeight ?? DOCUMENT_PAGE_GUTTER_PX)\n const breaks: DocumentPageBreak[] = []\n let pageStart = -Math.min(firstPageUsedHeight, pageContentHeight)\n let pageBottom = pageStart + pageContentHeight\n\n for (const block of blocks) {\n const top = Math.max(0, block.top)\n const bottom = Math.max(top, block.bottom)\n const height = bottom - top\n if (bottom <= pageBottom + PAGE_BREAK_EPSILON_PX) continue\n\n const hasEarlierContentOnPage = top > pageStart + PAGE_BREAK_EPSILON_PX\n if (height > pageContentHeight) {\n if (hasEarlierContentOnPage) {\n breaks.push(nextPageBreak(\n block.position,\n pageBottom - top,\n pageMarginHeight,\n pageGutterHeight,\n ))\n pageStart = top\n pageBottom = pageStart + pageContentHeight\n }\n while (bottom > pageBottom + PAGE_BREAK_EPSILON_PX) {\n pageStart = pageBottom\n pageBottom = pageStart + pageContentHeight\n }\n continue\n }\n\n breaks.push(nextPageBreak(\n block.position,\n pageBottom - top,\n pageMarginHeight,\n pageGutterHeight,\n ))\n pageStart = top\n pageBottom = pageStart + pageContentHeight\n }\n\n return breaks\n}\n\nfunction createPageBreakDom(pageBreak: DocumentPageBreak, pageNumber: number): HTMLElement {\n const root = document.createElement('div')\n root.className = 'om-doc-page-break'\n root.contentEditable = 'false'\n root.setAttribute('aria-hidden', 'true')\n root.setAttribute('data-document-page-break', '')\n\n const pageEnd = document.createElement('div')\n pageEnd.className = 'om-doc-page-end'\n pageEnd.style.height = `${pageBreak.remainingContentHeight + PAGE_VERTICAL_MARGIN_PX}px`\n const pageNumberLabel = document.createElement('span')\n pageNumberLabel.className = 'om-doc-page-number'\n pageNumberLabel.textContent = String(pageNumber)\n pageEnd.append(pageNumberLabel)\n const gutter = document.createElement('div')\n gutter.className = 'om-doc-page-gutter'\n gutter.style.height = `${DOCUMENT_PAGE_GUTTER_PX}px`\n const pageStart = document.createElement('div')\n pageStart.className = 'om-doc-page-start'\n pageStart.setAttribute('data-document-page-start', '')\n pageStart.style.height = `${PAGE_VERTICAL_MARGIN_PX}px`\n root.append(pageEnd, gutter, pageStart)\n return root\n}\n\nfunction createDecorations(doc: ProseMirrorNode, breaks: DocumentPageBreak[]): DecorationSet {\n return DecorationSet.create(doc, breaks.map((pageBreak, index) => Decoration.widget(\n pageBreak.position,\n () => createPageBreakDom(pageBreak, index + 1),\n {\n key: [\n 'document-page-break',\n pageBreak.position,\n index + 1,\n pageBreak.remainingContentHeight,\n ].join(':'),\n side: -1,\n ignoreSelection: true,\n },\n )))\n}\n\nfunction readPaginationMeta(transaction: Transaction): PaginationMeta | null {\n const meta = transaction.getMeta(DOCUMENT_PAGINATION_PLUGIN_KEY) as PaginationMeta | undefined\n return meta && Array.isArray(meta.breaks) ? meta : null\n}\n\nfunction paginationStateApply(\n transaction: Transaction,\n current: PaginationPluginState,\n _oldState: EditorState,\n newState: EditorState,\n): PaginationPluginState {\n const meta = readPaginationMeta(transaction)\n if (meta) {\n return {\n breaks: meta.breaks,\n decorations: createDecorations(newState.doc, meta.breaks),\n }\n }\n if (!transaction.docChanged) return current\n const mappedBreaks = current.breaks.map((pageBreak) => ({\n ...pageBreak,\n position: transaction.mapping.map(pageBreak.position, -1),\n }))\n return {\n breaks: mappedBreaks,\n decorations: current.decorations.map(transaction.mapping, transaction.doc),\n }\n}\n\nfunction breaksEqual(left: DocumentPageBreak[], right: DocumentPageBreak[]): boolean {\n return left.length === right.length && left.every((value, index) => {\n const candidate = right[index]\n return candidate !== undefined\n && value.position === candidate.position\n && Math.abs(value.remainingContentHeight - candidate.remainingContentHeight) < PAGE_BREAK_EPSILON_PX\n && Math.abs(value.totalHeight - candidate.totalHeight) < PAGE_BREAK_EPSILON_PX\n })\n}\n\nfunction measureTopLevelBlocks(view: EditorView, currentBreaks: DocumentPageBreak[]): PaginationBlockMeasurement[] {\n const rootRect = view.dom.getBoundingClientRect()\n const paper = view.dom.closest<HTMLElement>('.om-doc-paper')\n const paperWidthCssPx = A4_PAGE_WIDTH_MM * CSS_PIXELS_PER_MM\n const scale = paper ? Math.max(0.01, paper.getBoundingClientRect().width / paperWidthCssPx) : 1\n const blocks: PaginationBlockMeasurement[] = []\n let breakIndex = 0\n let insertedHeight = 0\n\n view.state.doc.forEach((_node, position) => {\n const nodeDom = view.nodeDOM(position)\n if (!(nodeDom instanceof HTMLElement)) return\n const rect = nodeDom.getBoundingClientRect()\n while (breakIndex < currentBreaks.length) {\n const pageBreak = currentBreaks[breakIndex]\n if (!pageBreak || pageBreak.position > position) break\n insertedHeight += pageBreak.totalHeight\n breakIndex += 1\n }\n blocks.push({\n position,\n top: ((rect.top - rootRect.top) / scale) - insertedHeight,\n bottom: ((rect.bottom - rootRect.top) / scale) - insertedHeight,\n })\n })\n return blocks\n}\n\nfunction firstPageUsedHeight(view: EditorView): number {\n const paper = view.dom.closest<HTMLElement>('.om-doc-paper')\n if (!paper) return 0\n const paperRect = paper.getBoundingClientRect()\n const paperWidthCssPx = A4_PAGE_WIDTH_MM * CSS_PIXELS_PER_MM\n const scale = Math.max(0.01, paperRect.width / paperWidthCssPx)\n const paddingTop = Number.parseFloat(getComputedStyle(paper).paddingTop) || PAGE_VERTICAL_MARGIN_PX\n return Math.max(0, ((view.dom.getBoundingClientRect().top - paperRect.top) / scale) - paddingTop)\n}\n\nexport function createDocumentPaginationPlugin(): Plugin<PaginationPluginState> {\n return new Plugin<PaginationPluginState>({\n key: DOCUMENT_PAGINATION_PLUGIN_KEY,\n state: {\n init: () => ({ breaks: [], decorations: DecorationSet.empty }),\n apply: paginationStateApply,\n },\n props: {\n decorations: (state) => DOCUMENT_PAGINATION_PLUGIN_KEY.getState(state)?.decorations ?? null,\n },\n view: (view) => {\n let frame: number | null = null\n let updateTimer: number | null = null\n let destroyed = false\n const recompute = () => {\n frame = null\n if (destroyed) return\n const current = DOCUMENT_PAGINATION_PLUGIN_KEY.getState(view.state)?.breaks ?? []\n const next = calculateDocumentPageBreaks(measureTopLevelBlocks(view, current), {\n firstPageUsedHeight: firstPageUsedHeight(view),\n })\n if (breaksEqual(current, next)) return\n view.dispatch(\n view.state.tr\n .setMeta(DOCUMENT_PAGINATION_PLUGIN_KEY, { breaks: next } satisfies PaginationMeta)\n .setMeta('addToHistory', false),\n )\n }\n const schedule = () => {\n if (destroyed || frame !== null) return\n if (updateTimer !== null) {\n window.clearTimeout(updateTimer)\n updateTimer = null\n }\n frame = requestAnimationFrame(recompute)\n }\n const scheduleDocumentUpdate = () => {\n if (destroyed) return\n if (updateTimer !== null) window.clearTimeout(updateTimer)\n updateTimer = window.setTimeout(() => {\n updateTimer = null\n schedule()\n }, DOCUMENT_PAGINATION_UPDATE_DELAY_MS)\n }\n const resizeObserver = typeof ResizeObserver === 'undefined'\n ? null\n : new ResizeObserver(schedule)\n resizeObserver?.observe(view.dom)\n const paper = view.dom.closest<HTMLElement>('.om-doc-paper')\n if (paper) resizeObserver?.observe(paper)\n view.dom.addEventListener('load', schedule, true)\n window.addEventListener('resize', schedule)\n schedule()\n\n return {\n update: (_nextView, previousState) => {\n if (previousState.doc === view.state.doc) return\n scheduleDocumentUpdate()\n },\n destroy: () => {\n destroyed = true\n if (frame !== null) cancelAnimationFrame(frame)\n if (updateTimer !== null) window.clearTimeout(updateTimer)\n resizeObserver?.disconnect()\n view.dom.removeEventListener('load', schedule, true)\n window.removeEventListener('resize', schedule)\n },\n }\n },\n })\n}\n\nexport const DocumentPagination = Extension.create({\n name: 'documentPagination',\n addProseMirrorPlugins() {\n return [createDocumentPaginationPlugin()]\n },\n})\n\nexport const DOCUMENT_PAGINATION_STYLES = `\n.om-doc-paper {\n box-sizing: border-box;\n width: ${A4_PAGE_WIDTH_MM}mm;\n min-width: ${A4_PAGE_WIDTH_MM}mm;\n max-width: ${A4_PAGE_WIDTH_MM}mm;\n min-height: ${A4_PAGE_HEIGHT_MM}mm;\n padding: ${DOCUMENT_PAGE_VERTICAL_MARGIN_MM}mm ${DOCUMENT_PAGE_HORIZONTAL_MARGIN_MM}mm;\n}\n.om-doc-canvas {\n overflow-x: auto;\n scrollbar-gutter: stable;\n overscroll-behavior-inline: contain;\n}\n.om-doc-paper .om-doc-page-break {\n display: block;\n width: ${A4_PAGE_WIDTH_MM}mm;\n margin-left: -${DOCUMENT_PAGE_HORIZONTAL_MARGIN_MM}mm;\n pointer-events: none;\n user-select: none;\n}\n.om-doc-paper .om-doc-page-end,\n.om-doc-paper .om-doc-page-start {\n background: var(--card);\n}\n.om-doc-paper .om-doc-page-end {\n position: relative;\n}\n.om-doc-paper .om-doc-page-number {\n position: absolute;\n right: ${DOCUMENT_PAGE_HORIZONTAL_MARGIN_MM}mm;\n bottom: 6mm;\n color: var(--muted-foreground);\n font-size: 0.75rem;\n line-height: 1rem;\n}\n.om-doc-paper .om-doc-page-gutter {\n border-top: 1px solid var(--border);\n border-bottom: 1px solid var(--border);\n background: var(--muted);\n box-shadow: inset 0 1px 2px color-mix(in oklab, var(--foreground) 8%, transparent);\n}\n`\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,iBAAiB;AAE1B,SAAS,QAAQ,iBAAqD;AACtE,SAAS,YAAY,qBAAsC;AAEpD,MAAM,mBAAmB;AACzB,MAAM,oBAAoB;AAC1B,MAAM,qCAAqC;AAC3C,MAAM,mCAAmC;AACzC,MAAM,0BAA0B;AAEvC,MAAM,oBAAoB,KAAK;AAC/B,MAAM,0BACJ,oBAAqB,mCAAmC,KACtD;AACJ,MAAM,0BAA0B,mCAAmC;AACnE,MAAM,wBAAwB;AACvB,MAAM,sCAAsC;AAuB5C,MAAM,iCAAiC,IAAI,UAAiC,qBAAqB;AAExG,SAAS,cACP,UACA,wBACA,kBACA,kBACmB;AACnB,QAAM,gBAAgB,KAAK,IAAI,GAAG,sBAAsB;AACxD,SAAO;AAAA,IACL;AAAA,IACA,wBAAwB;AAAA,IACxB,aAAa,gBAAiB,mBAAmB,IAAK;AAAA,EACxD;AACF;AAEO,SAAS,4BACd,QACA,UAKI,CAAC,GACgB;AACrB,QAAM,oBAAoB,KAAK,IAAI,GAAG,QAAQ,qBAAqB,sBAAsB;AACzF,QAAMA,uBAAsB,KAAK,IAAI,GAAG,QAAQ,uBAAuB,CAAC;AACxE,QAAM,mBAAmB,KAAK,IAAI,GAAG,QAAQ,oBAAoB,uBAAuB;AACxF,QAAM,mBAAmB,KAAK,IAAI,GAAG,QAAQ,oBAAoB,uBAAuB;AACxF,QAAM,SAA8B,CAAC;AACrC,MAAI,YAAY,CAAC,KAAK,IAAIA,sBAAqB,iBAAiB;AAChE,MAAI,aAAa,YAAY;AAE7B,aAAW,SAAS,QAAQ;AAC1B,UAAM,MAAM,KAAK,IAAI,GAAG,MAAM,GAAG;AACj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|
|
4
|
+
margin-left: -1px;
|
|
5
|
+
margin-right: -1px;
|
|
6
|
+
border-left-width: 2px;
|
|
7
|
+
border-left-style: solid;
|
|
8
|
+
border-right-width: 0;
|
|
9
|
+
box-sizing: border-box;
|
|
10
|
+
cursor: help;
|
|
11
|
+
pointer-events: auto;
|
|
12
|
+
}
|
|
13
|
+
.om-doc-collab .collaboration-carets__caret::before {
|
|
14
|
+
position: absolute;
|
|
15
|
+
top: -0.4em;
|
|
16
|
+
bottom: -0.4em;
|
|
17
|
+
left: -7px;
|
|
18
|
+
width: 14px;
|
|
19
|
+
content: '';
|
|
20
|
+
}
|
|
21
|
+
.om-doc-collab .collaboration-carets__label {
|
|
22
|
+
position: absolute;
|
|
23
|
+
top: -1.55em;
|
|
24
|
+
left: -2px;
|
|
25
|
+
max-width: 180px;
|
|
26
|
+
overflow: hidden;
|
|
27
|
+
border-radius: var(--radius-sm, 0.25rem);
|
|
28
|
+
padding: 1px 6px;
|
|
29
|
+
color: var(--primary-foreground);
|
|
30
|
+
font-size: var(--font-size-overline);
|
|
31
|
+
font-weight: 600;
|
|
32
|
+
line-height: var(--font-size-overline--line-height);
|
|
33
|
+
opacity: 0;
|
|
34
|
+
pointer-events: none;
|
|
35
|
+
text-overflow: ellipsis;
|
|
36
|
+
user-select: none;
|
|
37
|
+
white-space: nowrap;
|
|
38
|
+
animation: om-doc-caret-flag 2.6s ease forwards;
|
|
39
|
+
}
|
|
40
|
+
.om-doc-collab .collaboration-carets__caret:hover .collaboration-carets__label,
|
|
41
|
+
.om-doc-collab .collaboration-carets__caret:focus .collaboration-carets__label,
|
|
42
|
+
.om-doc-collab .collaboration-carets__caret:focus-visible .collaboration-carets__label {
|
|
43
|
+
animation: none;
|
|
44
|
+
opacity: 1;
|
|
45
|
+
}
|
|
46
|
+
.om-doc-collab .collaboration-carets__caret:focus-visible {
|
|
47
|
+
outline: 2px solid var(--ring);
|
|
48
|
+
outline-offset: 2px;
|
|
49
|
+
}
|
|
50
|
+
.om-doc-preview .collaboration-carets__caret,
|
|
51
|
+
.om-doc-preview .ProseMirror-yjs-selection {
|
|
52
|
+
display: none;
|
|
53
|
+
}
|
|
54
|
+
.ProseMirror .om-entity-ref {
|
|
55
|
+
display: inline-flex;
|
|
56
|
+
align-items: center;
|
|
57
|
+
max-width: 100%;
|
|
58
|
+
border: 1px solid color-mix(in oklab, var(--primary) 24%, transparent);
|
|
59
|
+
border-radius: var(--radius-sm, 0.25rem);
|
|
60
|
+
background: color-mix(in oklab, var(--primary) 12%, transparent);
|
|
61
|
+
color: var(--primary);
|
|
62
|
+
cursor: default;
|
|
63
|
+
font-weight: 500;
|
|
64
|
+
line-height: 1.6;
|
|
65
|
+
padding: 0 0.375em;
|
|
66
|
+
vertical-align: baseline;
|
|
67
|
+
white-space: nowrap;
|
|
68
|
+
}
|
|
69
|
+
@keyframes om-doc-caret-flag {
|
|
70
|
+
0% { opacity: 0; transform: translateY(3px); }
|
|
71
|
+
8%, 52% { opacity: 1; transform: translateY(0); }
|
|
72
|
+
100% { opacity: 0; transform: translateY(0); }
|
|
73
|
+
}
|
|
74
|
+
@media (prefers-reduced-motion: reduce) {
|
|
75
|
+
.om-doc-collab .collaboration-carets__label { animation: none; opacity: 1; }
|
|
76
|
+
}
|
|
77
|
+
`;
|
|
78
|
+
export {
|
|
79
|
+
EDITOR_PRESENCE_STYLES
|
|
80
|
+
};
|
|
81
|
+
//# sourceMappingURL=editorPresenceStyles.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../src/modules/documents/backend/documents/%5Bid%5D/editorPresenceStyles.ts"],
|
|
4
|
+
"sourcesContent": ["export const EDITOR_PRESENCE_STYLES = `\n.om-doc-collab .collaboration-carets__caret {\n position: relative;\n margin-left: -1px;\n margin-right: -1px;\n border-left-width: 2px;\n border-left-style: solid;\n border-right-width: 0;\n box-sizing: border-box;\n cursor: help;\n pointer-events: auto;\n}\n.om-doc-collab .collaboration-carets__caret::before {\n position: absolute;\n top: -0.4em;\n bottom: -0.4em;\n left: -7px;\n width: 14px;\n content: '';\n}\n.om-doc-collab .collaboration-carets__label {\n position: absolute;\n top: -1.55em;\n left: -2px;\n max-width: 180px;\n overflow: hidden;\n border-radius: var(--radius-sm, 0.25rem);\n padding: 1px 6px;\n color: var(--primary-foreground);\n font-size: var(--font-size-overline);\n font-weight: 600;\n line-height: var(--font-size-overline--line-height);\n opacity: 0;\n pointer-events: none;\n text-overflow: ellipsis;\n user-select: none;\n white-space: nowrap;\n animation: om-doc-caret-flag 2.6s ease forwards;\n}\n.om-doc-collab .collaboration-carets__caret:hover .collaboration-carets__label,\n.om-doc-collab .collaboration-carets__caret:focus .collaboration-carets__label,\n.om-doc-collab .collaboration-carets__caret:focus-visible .collaboration-carets__label {\n animation: none;\n opacity: 1;\n}\n.om-doc-collab .collaboration-carets__caret:focus-visible {\n outline: 2px solid var(--ring);\n outline-offset: 2px;\n}\n.om-doc-preview .collaboration-carets__caret,\n.om-doc-preview .ProseMirror-yjs-selection {\n display: none;\n}\n.ProseMirror .om-entity-ref {\n display: inline-flex;\n align-items: center;\n max-width: 100%;\n border: 1px solid color-mix(in oklab, var(--primary) 24%, transparent);\n border-radius: var(--radius-sm, 0.25rem);\n background: color-mix(in oklab, var(--primary) 12%, transparent);\n color: var(--primary);\n cursor: default;\n font-weight: 500;\n line-height: 1.6;\n padding: 0 0.375em;\n vertical-align: baseline;\n white-space: nowrap;\n}\n@keyframes om-doc-caret-flag {\n 0% { opacity: 0; transform: translateY(3px); }\n 8%, 52% { opacity: 1; transform: translateY(0); }\n 100% { opacity: 0; transform: translateY(0); }\n}\n@media (prefers-reduced-motion: reduce) {\n .om-doc-collab .collaboration-carets__label { animation: none; opacity: 1; }\n}\n`\n"],
|
|
5
|
+
"mappings": "AAAO,MAAM,yBAAyB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { cn } from "@open-mercato/shared/lib/utils";
|
|
2
|
+
function resolveEditorMode(readOnly, serverReadOnly, requested) {
|
|
3
|
+
return readOnly || serverReadOnly ? "preview" : requested;
|
|
4
|
+
}
|
|
5
|
+
function canCreateSelectionComment(input) {
|
|
6
|
+
if (!input.hasCommentHandler || input.transport !== "collab") return false;
|
|
7
|
+
const effectiveReadOnly = input.permissionReadOnly || input.mode === "preview";
|
|
8
|
+
return !effectiveReadOnly || input.permissionReadOnly;
|
|
9
|
+
}
|
|
10
|
+
function readRecord(value) {
|
|
11
|
+
return value && typeof value === "object" && !Array.isArray(value) ? value : null;
|
|
12
|
+
}
|
|
13
|
+
function readString(record, ...keys) {
|
|
14
|
+
for (const key of keys) {
|
|
15
|
+
const value = record[key];
|
|
16
|
+
if (typeof value === "string" && value.trim()) return value;
|
|
17
|
+
}
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
function readNumber(record, ...keys) {
|
|
21
|
+
for (const key of keys) {
|
|
22
|
+
const value = record[key];
|
|
23
|
+
if (typeof value === "number" && Number.isFinite(value)) return value;
|
|
24
|
+
}
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
const DOCUMENT_EDITOR_CONTENT_CLASS = cn(
|
|
28
|
+
"max-w-none text-foreground",
|
|
29
|
+
"[&_.ProseMirror]:min-h-96 [&_.ProseMirror]:focus-visible:outline-none",
|
|
30
|
+
"[&_.ProseMirror>*:first-child]:mt-0 [&_.ProseMirror>*:last-child]:mb-0",
|
|
31
|
+
"[&_h1]:mb-4 [&_h1]:mt-8 [&_h1]:text-3xl [&_h1]:font-bold [&_h1]:leading-tight",
|
|
32
|
+
"[&_h2]:mb-3 [&_h2]:mt-7 [&_h2]:text-2xl [&_h2]:font-semibold [&_h2]:leading-tight",
|
|
33
|
+
"[&_h3]:mb-2 [&_h3]:mt-6 [&_h3]:text-xl [&_h3]:font-semibold",
|
|
34
|
+
"[&_p]:my-4 [&_p]:leading-7 [&_ul]:my-4 [&_ul]:list-disc [&_ul]:pl-6",
|
|
35
|
+
"[&_ol]:my-4 [&_ol]:list-decimal [&_ol]:pl-6 [&_li]:my-1",
|
|
36
|
+
"[&_blockquote]:my-6 [&_blockquote]:border-l-4 [&_blockquote]:border-border [&_blockquote]:pl-4 [&_blockquote]:italic",
|
|
37
|
+
"[&_pre]:my-6 [&_pre]:overflow-x-auto [&_pre]:rounded-md [&_pre]:bg-muted [&_pre]:p-4 [&_pre]:font-mono [&_pre]:text-sm",
|
|
38
|
+
"[&_a]:text-primary [&_a]:underline [&_a]:underline-offset-4",
|
|
39
|
+
"[&_img]:my-6 [&_img]:h-auto [&_img]:max-w-full [&_img]:rounded-md",
|
|
40
|
+
"[&_table]:my-6 [&_table]:w-full [&_table]:border-collapse",
|
|
41
|
+
"[&_td]:border [&_td]:border-border [&_td]:px-3 [&_td]:py-2",
|
|
42
|
+
"[&_th]:border [&_th]:border-border [&_th]:bg-muted [&_th]:px-3 [&_th]:py-2 [&_th]:text-left"
|
|
43
|
+
);
|
|
44
|
+
export {
|
|
45
|
+
DOCUMENT_EDITOR_CONTENT_CLASS,
|
|
46
|
+
canCreateSelectionComment,
|
|
47
|
+
readNumber,
|
|
48
|
+
readRecord,
|
|
49
|
+
readString,
|
|
50
|
+
resolveEditorMode
|
|
51
|
+
};
|
|
52
|
+
//# sourceMappingURL=editorTypes.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../src/modules/documents/backend/documents/%5Bid%5D/editorTypes.ts"],
|
|
4
|
+
"sourcesContent": ["import type { Editor } from '@tiptap/core'\nimport type { HocuspocusProvider } from '@hocuspocus/provider'\nimport type * as Y from 'yjs'\nimport { cn } from '@open-mercato/shared/lib/utils'\nimport type { CommentAnchor } from './CommentAnchorNavigation'\n\nexport type CollabTokenUser = { id: string; name: string; color: string }\nexport type CollabResources = { ydoc: Y.Doc; provider: HocuspocusProvider; user: CollabTokenUser }\nexport type PresenceUser = { key: string; name: string; color: string }\nexport type ConnectionStatus = 'connecting' | 'connected' | 'reconnecting' | 'offline'\nexport type EditorSelectionRange = { from: number; to: number }\nexport type EditorWordCount = { words: number; characters: number }\nexport type EditorMode = 'edit' | 'preview'\n\nexport type DocumentEditorIslandProps = {\n documentId: string\n title: string\n initialContentHtml: string\n contentUpdatedAt?: string | null\n documentUpdatedAt?: string | null\n readOnly: boolean\n onEditorReady?: (editor: Editor | null) => void\n onComment?: (anchor: CommentAnchor) => void\n onContentConflict?: () => void\n onTitleChange?: (title: string, updatedAt: string | null) => void\n}\n\nexport type CollabState =\n | { mode: 'connecting' }\n | { mode: 'fallback'; readOnly: boolean }\n | { mode: 'collab'; resources: CollabResources; connectionStatus: ConnectionStatus; presenceUsers: PresenceUser[]; serverReadOnly: boolean }\n\nexport function resolveEditorMode(readOnly: boolean, serverReadOnly: boolean, requested: EditorMode): EditorMode {\n return readOnly || serverReadOnly ? 'preview' : requested\n}\n\nexport function canCreateSelectionComment(input: {\n permissionReadOnly: boolean\n mode: EditorMode\n transport: 'collab' | 'fallback'\n hasCommentHandler: boolean\n}): boolean {\n if (!input.hasCommentHandler || input.transport !== 'collab') return false\n const effectiveReadOnly = input.permissionReadOnly || input.mode === 'preview'\n return !effectiveReadOnly || input.permissionReadOnly\n}\n\nexport function readRecord(value: unknown): Record<string, unknown> | null {\n return value && typeof value === 'object' && !Array.isArray(value) ? value as Record<string, unknown> : null\n}\n\nexport function readString(record: Record<string, unknown>, ...keys: string[]): string | null {\n for (const key of keys) {\n const value = record[key]\n if (typeof value === 'string' && value.trim()) return value\n }\n return null\n}\n\nexport function readNumber(record: Record<string, unknown>, ...keys: string[]): number | null {\n for (const key of keys) {\n const value = record[key]\n if (typeof value === 'number' && Number.isFinite(value)) return value\n }\n return null\n}\n\nexport const DOCUMENT_EDITOR_CONTENT_CLASS = cn(\n 'max-w-none text-foreground',\n '[&_.ProseMirror]:min-h-96 [&_.ProseMirror]:focus-visible:outline-none',\n '[&_.ProseMirror>*:first-child]:mt-0 [&_.ProseMirror>*:last-child]:mb-0',\n '[&_h1]:mb-4 [&_h1]:mt-8 [&_h1]:text-3xl [&_h1]:font-bold [&_h1]:leading-tight',\n '[&_h2]:mb-3 [&_h2]:mt-7 [&_h2]:text-2xl [&_h2]:font-semibold [&_h2]:leading-tight',\n '[&_h3]:mb-2 [&_h3]:mt-6 [&_h3]:text-xl [&_h3]:font-semibold',\n '[&_p]:my-4 [&_p]:leading-7 [&_ul]:my-4 [&_ul]:list-disc [&_ul]:pl-6',\n '[&_ol]:my-4 [&_ol]:list-decimal [&_ol]:pl-6 [&_li]:my-1',\n '[&_blockquote]:my-6 [&_blockquote]:border-l-4 [&_blockquote]:border-border [&_blockquote]:pl-4 [&_blockquote]:italic',\n '[&_pre]:my-6 [&_pre]:overflow-x-auto [&_pre]:rounded-md [&_pre]:bg-muted [&_pre]:p-4 [&_pre]:font-mono [&_pre]:text-sm',\n '[&_a]:text-primary [&_a]:underline [&_a]:underline-offset-4',\n '[&_img]:my-6 [&_img]:h-auto [&_img]:max-w-full [&_img]:rounded-md',\n '[&_table]:my-6 [&_table]:w-full [&_table]:border-collapse',\n '[&_td]:border [&_td]:border-border [&_td]:px-3 [&_td]:py-2',\n '[&_th]:border [&_th]:border-border [&_th]:bg-muted [&_th]:px-3 [&_th]:py-2 [&_th]:text-left',\n)\n"],
|
|
5
|
+
"mappings": "AAGA,SAAS,UAAU;AA6BZ,SAAS,kBAAkB,UAAmB,gBAAyB,WAAmC;AAC/G,SAAO,YAAY,iBAAiB,YAAY;AAClD;AAEO,SAAS,0BAA0B,OAK9B;AACV,MAAI,CAAC,MAAM,qBAAqB,MAAM,cAAc,SAAU,QAAO;AACrE,QAAM,oBAAoB,MAAM,sBAAsB,MAAM,SAAS;AACrE,SAAO,CAAC,qBAAqB,MAAM;AACrC;AAEO,SAAS,WAAW,OAAgD;AACzE,SAAO,SAAS,OAAO,UAAU,YAAY,CAAC,MAAM,QAAQ,KAAK,IAAI,QAAmC;AAC1G;AAEO,SAAS,WAAW,WAAoC,MAA+B;AAC5F,aAAW,OAAO,MAAM;AACtB,UAAM,QAAQ,OAAO,GAAG;AACxB,QAAI,OAAO,UAAU,YAAY,MAAM,KAAK,EAAG,QAAO;AAAA,EACxD;AACA,SAAO;AACT;AAEO,SAAS,WAAW,WAAoC,MAA+B;AAC5F,aAAW,OAAO,MAAM;AACtB,UAAM,QAAQ,OAAO,GAAG;AACxB,QAAI,OAAO,UAAU,YAAY,OAAO,SAAS,KAAK,EAAG,QAAO;AAAA,EAClE;AACA,SAAO;AACT;AAEO,MAAM,gCAAgC;AAAA,EAC3C;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { DocumentPageClient } from "./DocumentPageClient.js";
|
|
3
|
+
async function DocumentEditorPage({ params }) {
|
|
4
|
+
const { id } = await params;
|
|
5
|
+
return /* @__PURE__ */ jsx(DocumentPageClient, { documentId: id });
|
|
6
|
+
}
|
|
7
|
+
export {
|
|
8
|
+
DocumentEditorPage as default
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=page.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../src/modules/documents/backend/documents/%5Bid%5D/page.tsx"],
|
|
4
|
+
"sourcesContent": ["import { DocumentPageClient } from './DocumentPageClient'\n\nexport default async function DocumentEditorPage({ params }: { params: Promise<{ id: string }> }) {\n const { id } = await params\n return <DocumentPageClient documentId={id} />\n}\n"],
|
|
5
|
+
"mappings": "AAIS;AAJT,SAAS,0BAA0B;AAEnC,eAAO,mBAA0C,EAAE,OAAO,GAAwC;AAChG,QAAM,EAAE,GAAG,IAAI,MAAM;AACrB,SAAO,oBAAC,sBAAmB,YAAY,IAAI;AAC7C;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
const metadata = {
|
|
2
|
+
requireAuth: true,
|
|
3
|
+
requireFeatures: ["documents.view"],
|
|
4
|
+
pageTitle: "Document",
|
|
5
|
+
pageTitleKey: "documents.nav.document",
|
|
6
|
+
pageGroup: "Documents",
|
|
7
|
+
pageGroupKey: "documents.nav.group",
|
|
8
|
+
breadcrumb: [
|
|
9
|
+
{ label: "Documents", labelKey: "documents.nav.documents", href: "/backend/documents" },
|
|
10
|
+
{ label: "Document", labelKey: "documents.nav.document" }
|
|
11
|
+
]
|
|
12
|
+
};
|
|
13
|
+
export {
|
|
14
|
+
metadata
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=page.meta.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../src/modules/documents/backend/documents/%5Bid%5D/page.meta.ts"],
|
|
4
|
+
"sourcesContent": ["export const metadata = {\n requireAuth: true,\n requireFeatures: ['documents.view'],\n pageTitle: 'Document',\n pageTitleKey: 'documents.nav.document',\n pageGroup: 'Documents',\n pageGroupKey: 'documents.nav.group',\n breadcrumb: [\n { label: 'Documents', labelKey: 'documents.nav.documents', href: '/backend/documents' },\n { label: 'Document', labelKey: 'documents.nav.document' },\n ],\n}\n"],
|
|
5
|
+
"mappings": "AAAO,MAAM,WAAW;AAAA,EACtB,aAAa;AAAA,EACb,iBAAiB,CAAC,gBAAgB;AAAA,EAClC,WAAW;AAAA,EACX,cAAc;AAAA,EACd,WAAW;AAAA,EACX,cAAc;AAAA,EACd,YAAY;AAAA,IACV,EAAE,OAAO,aAAa,UAAU,2BAA2B,MAAM,qBAAqB;AAAA,IACtF,EAAE,OAAO,YAAY,UAAU,yBAAyB;AAAA,EAC1D;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import {
|
|
2
|
+
firstSafeDocumentsDisplayLabel,
|
|
3
|
+
sanitizeDocumentsDisplayLabel
|
|
4
|
+
} from "../../../lib/displayLabels.js";
|
|
5
|
+
import {
|
|
6
|
+
getEntityTokenFieldNames
|
|
7
|
+
} from "../../../lib/entityRegistry.js";
|
|
8
|
+
import { readBoolean, readRecord, readString } from "../documentUi.js";
|
|
9
|
+
function normalizeRelatedRecord(value, fallbackLabel) {
|
|
10
|
+
const record = readRecord(value);
|
|
11
|
+
if (!record) return null;
|
|
12
|
+
const id = readString(record, "id");
|
|
13
|
+
const entityType = readString(record, "entityType", "entity_type");
|
|
14
|
+
const label = firstSafeDocumentsDisplayLabel(readString(record, "label"), fallbackLabel);
|
|
15
|
+
const updatedAt = readString(record, "updatedAt", "updated_at");
|
|
16
|
+
const source = readString(record, "source");
|
|
17
|
+
if (!id || !entityType || !label || !updatedAt || !source) return null;
|
|
18
|
+
const canOpen = readBoolean(record, "canOpen", "can_open") ?? false;
|
|
19
|
+
const rawValues = canOpen ? readRecord(record.values) : null;
|
|
20
|
+
const values = rawValues ? Object.fromEntries(Array.from(getEntityTokenFieldNames(entityType), (field) => [
|
|
21
|
+
field,
|
|
22
|
+
sanitizeDocumentsDisplayLabel(rawValues[field])
|
|
23
|
+
])) : {};
|
|
24
|
+
return {
|
|
25
|
+
id,
|
|
26
|
+
entityType,
|
|
27
|
+
label,
|
|
28
|
+
updatedAt,
|
|
29
|
+
source,
|
|
30
|
+
href: readString(record, "href"),
|
|
31
|
+
canOpen,
|
|
32
|
+
values
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
export {
|
|
36
|
+
normalizeRelatedRecord
|
|
37
|
+
};
|
|
38
|
+
//# sourceMappingURL=relatedRecordModel.js.map
|