@ecsplico/editor 2.1.2 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +78 -1
- package/README.md +39 -156
- package/dist/adapters/comments/drizzle.d.ts +1 -1
- package/dist/adapters/comments/record.d.ts +15 -0
- package/dist/adapters/comments/{client.js → rest-model.js} +3 -3
- package/dist/adapters/comments/rest-model.js.map +1 -0
- package/dist/adapters/comments/server.d.ts +2 -1
- package/dist/adapters/comments/server.js +2 -1
- package/dist/adapters/comments/server.js.map +1 -1
- package/dist/adapters/comments/types.d.ts +2 -2
- package/dist/adapters/document-state.d.ts +23 -0
- package/dist/adapters/document-state.js +66 -0
- package/dist/adapters/document-state.js.map +1 -0
- package/dist/adapters/documents.js +14 -11
- package/dist/adapters/documents.js.map +1 -1
- package/dist/adapters/drizzle.d.ts +2 -2
- package/dist/adapters/drizzle.js +97 -88
- package/dist/adapters/drizzle.js.map +1 -1
- package/dist/adapters/forge.d.ts +12 -7
- package/dist/adapters/forge.js +38 -45
- package/dist/adapters/forge.js.map +1 -1
- package/dist/adapters/http.d.ts +20 -0
- package/dist/adapters/http.js +68 -0
- package/dist/adapters/http.js.map +1 -0
- package/dist/adapters/index.d.ts +5 -5
- package/dist/adapters/json.d.ts +3 -3
- package/dist/adapters/json.js +58 -49
- package/dist/adapters/json.js.map +1 -1
- package/dist/adapters/memory.d.ts +21 -0
- package/dist/adapters/memory.js +53 -0
- package/dist/adapters/memory.js.map +1 -0
- package/dist/adapters/nitro.d.ts +27 -20
- package/dist/adapters/nitro.js +59 -163
- package/dist/adapters/nitro.js.map +1 -1
- package/dist/adapters/react.d.ts +55 -0
- package/dist/adapters/react.js +209 -0
- package/dist/adapters/react.js.map +1 -0
- package/dist/adapters/shared.d.ts +15 -21
- package/dist/adapters/shared.js +10 -8
- package/dist/adapters/shared.js.map +1 -1
- package/dist/adapters/vue.d.ts +15 -30
- package/dist/adapters/vue.js +36 -87
- package/dist/adapters/vue.js.map +1 -1
- package/dist/code/CodeSurface.vue.d.ts +2 -2
- package/dist/config/index.d.ts +105 -0
- package/dist/config/index.js +95 -0
- package/dist/config/index.js.map +1 -0
- package/dist/core/abilities.js +1 -0
- package/dist/core/abilities.js.map +1 -1
- package/dist/{adapters/routes.js → core/api-routes.js} +5 -3
- package/dist/core/api-routes.js.map +1 -0
- package/dist/core/backend-capability.d.ts +7 -0
- package/dist/core/backend-capability.js +17 -0
- package/dist/core/backend-capability.js.map +1 -0
- package/dist/core/backend-types.d.ts +245 -0
- package/dist/core/backend-types.js +17 -0
- package/dist/core/backend-types.js.map +1 -0
- package/dist/core/backend.d.ts +108 -0
- package/dist/core/backend.js +14 -0
- package/dist/core/backend.js.map +1 -0
- package/dist/core/block-convert.d.ts +7 -5
- package/dist/core/block-convert.js +28 -5
- package/dist/core/block-convert.js.map +1 -1
- package/dist/core/command-types.d.ts +96 -0
- package/dist/core/commands.d.ts +40 -0
- package/dist/core/commands.js +151 -0
- package/dist/core/commands.js.map +1 -0
- package/dist/core/context.d.ts +17 -20
- package/dist/core/context.js +24 -21
- package/dist/core/context.js.map +1 -1
- package/dist/core/core-feature.d.ts +22 -7
- package/dist/core/core-feature.js +51 -18
- package/dist/core/core-feature.js.map +1 -1
- package/dist/core/define-editor.d.ts +4 -3
- package/dist/core/define-editor.js +14 -7
- package/dist/core/define-editor.js.map +1 -1
- package/dist/core/document-markdown.js +12 -3
- package/dist/core/document-markdown.js.map +1 -1
- package/dist/core/editor-ui.d.ts +8 -1
- package/dist/core/editor-ui.js +9 -8
- package/dist/core/editor-ui.js.map +1 -1
- package/dist/core/extension-points.d.ts +3 -15
- package/dist/core/feature-context.d.ts +8 -7
- package/dist/core/feature-context.js +12 -11
- package/dist/core/feature-context.js.map +1 -1
- package/dist/core/feature.d.ts +41 -19
- package/dist/core/feature.js.map +1 -1
- package/dist/core/fences.d.ts +2 -1
- package/dist/core/fences.js +3 -2
- package/dist/core/fences.js.map +1 -1
- package/dist/core/fetch-error.d.ts +1 -1
- package/dist/core/fetch-error.js +3 -1
- package/dist/core/fetch-error.js.map +1 -1
- package/dist/core/hash.d.ts +5 -0
- package/dist/core/hash.js +11 -0
- package/dist/core/hash.js.map +1 -0
- package/dist/core/http-backend.d.ts +11 -0
- package/dist/core/http-backend.js +195 -0
- package/dist/core/http-backend.js.map +1 -0
- package/dist/core/index.d.ts +15 -9
- package/dist/core/index.js +13 -9
- package/dist/core/palette.d.ts +48 -0
- package/dist/core/palette.js +95 -0
- package/dist/core/palette.js.map +1 -0
- package/dist/core/schema/abilities.d.ts +2 -1
- package/dist/core/schema/abilities.js +5 -1
- package/dist/core/schema/abilities.js.map +1 -1
- package/dist/core/schema/index.d.ts +11 -5
- package/dist/core/schema/index.js +13 -8
- package/dist/core/schema/index.js.map +1 -1
- package/dist/core/schema/mark-flags.d.ts +8 -1
- package/dist/core/schema/of-features.d.ts +13 -0
- package/dist/core/schema/of-features.js +14 -0
- package/dist/core/schema/of-features.js.map +1 -0
- package/dist/core/slash.d.ts +8 -6
- package/dist/core/slash.js +24 -16
- package/dist/core/slash.js.map +1 -1
- package/dist/core/surface-session.js +15 -5
- package/dist/core/surface-session.js.map +1 -1
- package/dist/core/toolbar-items.d.ts +10 -4
- package/dist/core/toolbar-items.js +269 -195
- package/dist/core/toolbar-items.js.map +1 -1
- package/dist/core/transaction-guards.d.ts +21 -0
- package/dist/core/transaction-guards.js +49 -0
- package/dist/core/transaction-guards.js.map +1 -0
- package/dist/core/util.js +11 -0
- package/dist/core/util.js.map +1 -0
- package/dist/document/DocumentSurface.d.ts +1 -1
- package/dist/document/DocumentSurface.vue.d.ts +2 -2
- package/dist/features/ai/agent-op-review.d.ts +1 -1
- package/dist/features/ai/agent-op-review.js +1 -1
- package/dist/features/ai/agent-ops.js +1 -1
- package/dist/features/ai/ai-apply.d.ts +2 -2
- package/dist/features/ai/ai-apply.js +1 -1
- package/dist/features/ai/ai-review.js +1 -1
- package/dist/features/ai/ai-sse.d.ts +6 -6
- package/dist/features/ai/ai-sse.js +20 -63
- package/dist/features/ai/ai-sse.js.map +1 -1
- package/dist/features/ai/assistant.d.ts +8 -7
- package/dist/features/ai/assistant.js +3 -3
- package/dist/features/ai/assistant.js.map +1 -1
- package/dist/features/ai/block-actions.d.ts +3 -2
- package/dist/features/ai/block-actions.js +3 -2
- package/dist/features/ai/block-actions.js.map +1 -1
- package/dist/features/ai/components/AiSelectionMenu.js +1 -1
- package/dist/features/ai/components/DocumentChatAnswer.js +1 -1
- package/dist/features/ai/components/DocumentChatOps.vue.d.ts +1 -1
- package/dist/features/ai/components/SettingsModelProfiles.js +8 -8
- package/dist/features/ai/components/SettingsModelProfiles.js.map +1 -1
- package/dist/features/ai/document-chat-model.d.ts +8 -7
- package/dist/features/ai/document-chat-model.js +5 -5
- package/dist/features/ai/document-chat-model.js.map +1 -1
- package/dist/features/ai/document-chat.js +1 -1
- package/dist/features/ai/feature.js +27 -14
- package/dist/features/ai/feature.js.map +1 -1
- package/dist/features/ai/ghost-autocomplete.d.ts +7 -6
- package/dist/features/ai/ghost-autocomplete.js +6 -9
- package/dist/features/ai/ghost-autocomplete.js.map +1 -1
- package/dist/features/ai/index.d.ts +4 -3
- package/dist/features/ai/index.js +10 -10
- package/dist/features/ai/model-profiles.d.ts +5 -4
- package/dist/features/ai/model-profiles.js +2 -2
- package/dist/features/ai/model-profiles.js.map +1 -1
- package/dist/features/ai/protocol/block-lines.js +1 -1
- package/dist/features/ai/protocol/block-lines.js.map +1 -1
- package/dist/features/ai/protocol/chat.js +6 -2
- package/dist/features/ai/protocol/chat.js.map +1 -1
- package/dist/features/ai/protocol/index.d.ts +3 -2
- package/dist/features/ai/protocol/models.d.ts +2 -16
- package/dist/features/ai/protocol/models.js.map +1 -1
- package/dist/features/ai/rate-limit.d.ts +1 -1
- package/dist/features/ai/rate-limit.js +3 -1
- package/dist/features/ai/rate-limit.js.map +1 -1
- package/dist/features/ai/react/AiSelectionMenu.js +2 -2
- package/dist/features/ai/react/AiSidebar.js +4 -4
- package/dist/features/ai/react/DocumentChatAnswer.js +1 -1
- package/dist/features/ai/react/DocumentChatOps.d.ts +1 -1
- package/dist/features/ai/react/DocumentChatOps.js +1 -1
- package/dist/features/ai/react/SettingsModelProfiles.js +8 -10
- package/dist/features/ai/react/SettingsModelProfiles.js.map +1 -1
- package/dist/features/ai/react/use-ai-assistant.d.ts +1 -1
- package/dist/features/ai/react/use-ai-assistant.js +3 -3
- package/dist/features/ai/react/use-ai-assistant.js.map +1 -1
- package/dist/features/ai/react/use-document-chat.js +2 -2
- package/dist/features/ai/react/use-document-chat.js.map +1 -1
- package/dist/features/ai/react/use-model-profiles.d.ts +2 -1
- package/dist/features/ai/selection-flow.d.ts +1 -1
- package/dist/features/ai/selection-flow.js +1 -1
- package/dist/features/ai/sidebar-flow.d.ts +1 -1
- package/dist/features/ai/sidebar-flow.js +1 -1
- package/dist/features/ai/use-ai-assistant.d.ts +1 -1
- package/dist/features/ai/use-ai-assistant.js +3 -3
- package/dist/features/ai/use-ai-assistant.js.map +1 -1
- package/dist/features/ai/use-document-chat.js +2 -2
- package/dist/features/ai/use-document-chat.js.map +1 -1
- package/dist/features/ai/use-model-profiles.d.ts +2 -1
- package/dist/features/authors/attribution.d.ts +1 -1
- package/dist/features/authors/feature.js +12 -11
- package/dist/features/authors/feature.js.map +1 -1
- package/dist/features/block-ui/block-actions.d.ts +1 -1
- package/dist/features/block-ui/block-actions.js +1 -1
- package/dist/features/block-ui/block-actions.js.map +1 -1
- package/dist/features/block-ui/components/BlockUi.js +1 -1
- package/dist/features/block-ui/feature.js +1 -0
- package/dist/features/block-ui/feature.js.map +1 -1
- package/dist/features/block-ui/react/BlockUi.js +1 -1
- package/dist/features/collab/anchor-resolver.js +1 -1
- package/dist/features/collab/feature.js +2 -0
- package/dist/features/collab/feature.js.map +1 -1
- package/dist/features/comments/components/CommentThreadView.vue.d.ts +2 -1
- package/dist/features/comments/feature.js +12 -11
- package/dist/features/comments/feature.js.map +1 -1
- package/dist/features/comments/index.d.ts +3 -2
- package/dist/features/comments/index.js +1 -1
- package/dist/features/comments/margin-layout.d.ts +3 -2
- package/dist/features/comments/model.d.ts +3 -67
- package/dist/features/comments/model.js +2 -2
- package/dist/features/comments/model.js.map +1 -1
- package/dist/features/comments/react/CommentThreadView.d.ts +3 -2
- package/dist/features/comments/react/use-comments.d.ts +2 -1
- package/dist/features/comments/react.d.ts +1 -1
- package/dist/features/comments/schema.d.ts +2 -52
- package/dist/features/comments/schema.js.map +1 -1
- package/dist/features/comments/snapshot-equality.js.map +1 -1
- package/dist/features/comments/use-comments.d.ts +3 -2
- package/dist/features/comments/vue.d.ts +1 -1
- package/dist/features/composites/accepted-children.d.ts +1 -0
- package/dist/features/composites/accepted-children.js +16 -1
- package/dist/features/composites/accepted-children.js.map +1 -1
- package/dist/features/composites/ai-brief.js +39 -0
- package/dist/features/composites/ai-brief.js.map +1 -1
- package/dist/features/composites/bibliography-command.d.ts +11 -0
- package/dist/features/composites/bibliography-form.js +90 -0
- package/dist/features/composites/bibliography-form.js.map +1 -0
- package/dist/features/composites/bibliography.d.ts +33 -0
- package/dist/features/composites/bibliography.js +120 -0
- package/dist/features/composites/bibliography.js.map +1 -0
- package/dist/features/composites/components/BibliographyEditor.js +261 -0
- package/dist/features/composites/components/BibliographyEditor.js.map +1 -0
- package/dist/features/composites/components/CompositeChrome.js +78 -29
- package/dist/features/composites/components/CompositeChrome.js.map +1 -1
- package/dist/features/composites/components/CompositeChrome.vue.d.ts +1 -1
- package/dist/features/composites/components/CompositeDetails.js +46 -11
- package/dist/features/composites/components/CompositeDetails.js.map +1 -1
- package/dist/features/composites/components/CompositeDetails.vue.d.ts +2 -1
- package/dist/features/composites/components/CompositeFieldEditor.js +64 -5
- package/dist/features/composites/components/CompositeFieldEditor.js.map +1 -1
- package/dist/features/composites/components/CompositeInspector.js +20 -7
- package/dist/features/composites/components/CompositeInspector.js.map +1 -1
- package/dist/features/composites/components/CompositeTable.js +13 -4
- package/dist/features/composites/components/CompositeTable.js.map +1 -1
- package/dist/features/composites/components/CompositeTagsEditor.js +1 -1
- package/dist/features/composites/components/CompositeView.js +11 -1
- package/dist/features/composites/components/CompositeView.js.map +1 -1
- package/dist/features/composites/components/DerivationBadge.js +103 -0
- package/dist/features/composites/components/DerivationBadge.js.map +1 -0
- package/dist/features/composites/components/ReferenceFieldSelect.js +60 -0
- package/dist/features/composites/components/ReferenceFieldSelect.js.map +1 -0
- package/dist/features/composites/components/ReferenceView.js +122 -0
- package/dist/features/composites/components/ReferenceView.js.map +1 -0
- package/dist/features/composites/components/ReferenceView.vue.d.ts +96 -0
- package/dist/features/composites/components/SettingsEditingTab.js +1 -1
- package/dist/features/composites/convert.js +2 -2
- package/dist/features/composites/convert.js.map +1 -1
- package/dist/features/composites/derivation.d.ts +61 -0
- package/dist/features/composites/derivation.js +98 -0
- package/dist/features/composites/derivation.js.map +1 -0
- package/dist/features/composites/derived-chrome.js +69 -0
- package/dist/features/composites/derived-chrome.js.map +1 -0
- package/dist/features/composites/feature.js +159 -109
- package/dist/features/composites/feature.js.map +1 -1
- package/dist/features/composites/fences.d.ts +4 -3
- package/dist/features/composites/fences.js +51 -7
- package/dist/features/composites/fences.js.map +1 -1
- package/dist/features/composites/index.d.ts +12 -3
- package/dist/features/composites/index.js +15 -6
- package/dist/features/composites/inspector-model.d.ts +4 -1
- package/dist/features/composites/inspector-model.js +8 -4
- package/dist/features/composites/inspector-model.js.map +1 -1
- package/dist/features/composites/kinds.d.ts +16 -2
- package/dist/features/composites/kinds.js +145 -6
- package/dist/features/composites/kinds.js.map +1 -1
- package/dist/features/composites/legacy.d.ts +4 -1
- package/dist/features/composites/legacy.js +56 -1
- package/dist/features/composites/legacy.js.map +1 -1
- package/dist/features/composites/meta-display.js +45 -2
- package/dist/features/composites/meta-display.js.map +1 -1
- package/dist/features/composites/meta-keys.d.ts +7 -0
- package/dist/features/composites/meta-keys.js +21 -0
- package/dist/features/composites/meta-keys.js.map +1 -0
- package/dist/features/composites/node-views.d.ts +6 -3
- package/dist/features/composites/node-views.js +7 -3
- package/dist/features/composites/node-views.js.map +1 -1
- package/dist/features/composites/nodes.d.ts +6 -1
- package/dist/features/composites/nodes.js +33 -7
- package/dist/features/composites/nodes.js.map +1 -1
- package/dist/features/composites/react/BibliographyEditor.js +229 -0
- package/dist/features/composites/react/BibliographyEditor.js.map +1 -0
- package/dist/features/composites/react/CompositeChrome.js +67 -19
- package/dist/features/composites/react/CompositeChrome.js.map +1 -1
- package/dist/features/composites/react/CompositeDetails.d.ts +2 -1
- package/dist/features/composites/react/CompositeDetails.js +45 -6
- package/dist/features/composites/react/CompositeDetails.js.map +1 -1
- package/dist/features/composites/react/CompositeFieldEditor.d.ts +1 -1
- package/dist/features/composites/react/CompositeFieldEditor.js +43 -1
- package/dist/features/composites/react/CompositeFieldEditor.js.map +1 -1
- package/dist/features/composites/react/CompositeInspector.js +12 -6
- package/dist/features/composites/react/CompositeInspector.js.map +1 -1
- package/dist/features/composites/react/CompositeStatusMenu.js +1 -1
- package/dist/features/composites/react/CompositeSummaryEditor.js +1 -1
- package/dist/features/composites/react/CompositeTable.js +16 -2
- package/dist/features/composites/react/CompositeTable.js.map +1 -1
- package/dist/features/composites/react/CompositeTagsEditor.js +2 -2
- package/dist/features/composites/react/CompositeView.js +6 -1
- package/dist/features/composites/react/CompositeView.js.map +1 -1
- package/dist/features/composites/react/DerivationBadge.js +116 -0
- package/dist/features/composites/react/DerivationBadge.js.map +1 -0
- package/dist/features/composites/react/ReferenceFieldSelect.js +52 -0
- package/dist/features/composites/react/ReferenceFieldSelect.js.map +1 -0
- package/dist/features/composites/react/ReferenceView.d.ts +11 -0
- package/dist/features/composites/react/ReferenceView.js +115 -0
- package/dist/features/composites/react/ReferenceView.js.map +1 -0
- package/dist/features/composites/react/SettingsEditingTab.js +2 -2
- package/dist/features/composites/react.d.ts +2 -1
- package/dist/features/composites/react.js +7 -3
- package/dist/features/composites/react.js.map +1 -1
- package/dist/features/composites/reference-ai.js +16 -0
- package/dist/features/composites/reference-ai.js.map +1 -0
- package/dist/features/composites/reference-label.d.ts +19 -0
- package/dist/features/composites/reference-label.js +58 -0
- package/dist/features/composites/reference-label.js.map +1 -0
- package/dist/features/composites/reference-suggestion.d.ts +10 -0
- package/dist/features/composites/reference-suggestion.js +41 -0
- package/dist/features/composites/reference-suggestion.js.map +1 -0
- package/dist/features/composites/reference-text.d.ts +18 -0
- package/dist/features/composites/reference-text.js +89 -0
- package/dist/features/composites/reference-text.js.map +1 -0
- package/dist/features/composites/reference.d.ts +44 -0
- package/dist/features/composites/reference.js +148 -0
- package/dist/features/composites/reference.js.map +1 -0
- package/dist/features/composites/reveal-source.d.ts +32 -0
- package/dist/features/composites/reveal-source.js +89 -0
- package/dist/features/composites/reveal-source.js.map +1 -0
- package/dist/features/composites/rows.d.ts +25 -3
- package/dist/features/composites/rows.js +72 -10
- package/dist/features/composites/rows.js.map +1 -1
- package/dist/features/composites/schema.d.ts +9 -3
- package/dist/features/composites/schema.js +11 -4
- package/dist/features/composites/schema.js.map +1 -1
- package/dist/features/composites/table-model.js +12 -21
- package/dist/features/composites/table-model.js.map +1 -1
- package/dist/features/composites/vue.d.ts +3 -2
- package/dist/features/composites/vue.js +8 -4
- package/dist/features/composites/vue.js.map +1 -1
- package/dist/features/media/assets.d.ts +2 -0
- package/dist/features/media/assets.js +3 -2
- package/dist/features/media/assets.js.map +1 -1
- package/dist/features/media/components/FileView.js +13 -4
- package/dist/features/media/components/FileView.js.map +1 -1
- package/dist/features/media/feature.d.ts +3 -3
- package/dist/features/media/feature.js +21 -28
- package/dist/features/media/feature.js.map +1 -1
- package/dist/features/media/file-import.js +2 -2
- package/dist/features/media/file-import.js.map +1 -1
- package/dist/features/media/index.d.ts +2 -2
- package/dist/features/media/index.js +3 -3
- package/dist/features/media/react/AudioRecorderModal.js +1 -1
- package/dist/features/media/react/FileView.js +19 -2
- package/dist/features/media/react/FileView.js.map +1 -1
- package/dist/features/media/react.js +1 -1
- package/dist/features/media/schema.d.ts +8 -0
- package/dist/features/media/schema.js +126 -11
- package/dist/features/media/schema.js.map +1 -1
- package/dist/features/media/upload.d.ts +16 -14
- package/dist/features/media/upload.js +13 -19
- package/dist/features/media/upload.js.map +1 -1
- package/dist/features/mentions/index.d.ts +4 -3
- package/dist/features/mentions/index.js +4 -1
- package/dist/features/mentions/index.js.map +1 -1
- package/dist/features/mentions/mention-text.d.ts +1 -1
- package/dist/features/mentions/mention-text.js.map +1 -1
- package/dist/features/mentions/mention.d.ts +0 -6
- package/dist/features/mentions/mention.js.map +1 -1
- package/dist/features/mentions/metadata-defaults.d.ts +2 -2
- package/dist/features/mentions/metadata-defaults.js +3 -9
- package/dist/features/mentions/metadata-defaults.js.map +1 -1
- package/dist/features/mentions/schema.d.ts +2 -1
- package/dist/features/mentions/schema.js.map +1 -1
- package/dist/features/tables/feature.d.ts +2 -1
- package/dist/features/tables/feature.js +90 -70
- package/dist/features/tables/feature.js.map +1 -1
- package/dist/features/themes/components/SettingsAppearanceTab.js +6 -9
- package/dist/features/themes/components/SettingsAppearanceTab.js.map +1 -1
- package/dist/features/themes/feature.js +2 -0
- package/dist/features/themes/feature.js.map +1 -1
- package/dist/features/themes/index.d.ts +2 -1
- package/dist/features/themes/react/SettingsAppearanceTab.js +7 -10
- package/dist/features/themes/react/SettingsAppearanceTab.js.map +1 -1
- package/dist/features/themes/schema.d.ts +2 -6
- package/dist/features/themes/schema.js.map +1 -1
- package/dist/features/themes/theme-runtime.d.ts +1 -1
- package/dist/features/themes/theme-runtime.js +4 -2
- package/dist/features/themes/theme-runtime.js.map +1 -1
- package/dist/features/transcript/TranscriptSegmentView.js +48 -28
- package/dist/features/transcript/TranscriptSegmentView.js.map +1 -1
- package/dist/features/transcript/feature.js +21 -19
- package/dist/features/transcript/feature.js.map +1 -1
- package/dist/features/transcript/react/TranscriptSegmentView.js +55 -36
- package/dist/features/transcript/react/TranscriptSegmentView.js.map +1 -1
- package/dist/features/transcript/segment-node.d.ts +2 -0
- package/dist/features/transcript/segment-node.js +35 -7
- package/dist/features/transcript/segment-node.js.map +1 -1
- package/dist/i18n/de/composites.js +91 -1
- package/dist/i18n/de/composites.js.map +1 -1
- package/dist/i18n/de/integrations.js +49 -8
- package/dist/i18n/de/integrations.js.map +1 -1
- package/dist/i18n/de/media.js +0 -1
- package/dist/i18n/de/media.js.map +1 -1
- package/dist/i18n/de/palette.js +22 -0
- package/dist/i18n/de/palette.js.map +1 -0
- package/dist/i18n/de/tables.js +0 -1
- package/dist/i18n/de/tables.js.map +1 -1
- package/dist/i18n/de/transcript.js +2 -1
- package/dist/i18n/de/transcript.js.map +1 -1
- package/dist/i18n/de/tree.js +3 -0
- package/dist/i18n/de/tree.js.map +1 -1
- package/dist/i18n/de.d.ts +157 -11
- package/dist/i18n/de.js +3 -1
- package/dist/i18n/de.js.map +1 -1
- package/dist/i18n/en/composites.js +89 -1
- package/dist/i18n/en/composites.js.map +1 -1
- package/dist/i18n/en/integrations.js +49 -8
- package/dist/i18n/en/integrations.js.map +1 -1
- package/dist/i18n/en/media.js +0 -1
- package/dist/i18n/en/media.js.map +1 -1
- package/dist/i18n/en/palette.js +22 -0
- package/dist/i18n/en/palette.js.map +1 -0
- package/dist/i18n/en/tables.js +0 -1
- package/dist/i18n/en/tables.js.map +1 -1
- package/dist/i18n/en/transcript.js +2 -1
- package/dist/i18n/en/transcript.js.map +1 -1
- package/dist/i18n/en/tree.js +3 -0
- package/dist/i18n/en/tree.js.map +1 -1
- package/dist/i18n/en.js +3 -1
- package/dist/i18n/en.js.map +1 -1
- package/dist/index.d.ts +4 -3
- package/dist/integrations/composite-ai/bibliography-fetch.d.ts +31 -0
- package/dist/integrations/composite-ai/bibliography-fetch.js +159 -0
- package/dist/integrations/composite-ai/bibliography-fetch.js.map +1 -0
- package/dist/integrations/composite-ai/composite-fill.d.ts +30 -8
- package/dist/integrations/composite-ai/composite-fill.js +97 -56
- package/dist/integrations/composite-ai/composite-fill.js.map +1 -1
- package/dist/integrations/composite-ai/composite-summary.d.ts +4 -12
- package/dist/integrations/composite-ai/composite-summary.js +7 -26
- package/dist/integrations/composite-ai/composite-summary.js.map +1 -1
- package/dist/integrations/composite-ai/derive.d.ts +29 -0
- package/dist/integrations/composite-ai/derive.js +173 -0
- package/dist/integrations/composite-ai/derive.js.map +1 -0
- package/dist/integrations/composite-ai/index.d.ts +11 -7
- package/dist/integrations/composite-ai/index.js +72 -14
- package/dist/integrations/composite-ai/index.js.map +1 -1
- package/dist/integrations/composite-ai/rendition.d.ts +45 -0
- package/dist/integrations/composite-ai/rendition.js +314 -0
- package/dist/integrations/composite-ai/rendition.js.map +1 -0
- package/dist/integrations/composite-media/index.d.ts +7 -5
- package/dist/integrations/composite-media/index.js +86 -13
- package/dist/integrations/composite-media/index.js.map +1 -1
- package/dist/integrations/transcript-ai/index.d.ts +1 -1
- package/dist/integrations/transcript-ai/index.js +5 -2
- package/dist/integrations/transcript-ai/index.js.map +1 -1
- package/dist/integrations/transcript-ai/protocol.d.ts +2 -12
- package/dist/integrations/transcript-ai/protocol.js +0 -2
- package/dist/integrations/transcript-ai/protocol.js.map +1 -1
- package/dist/integrations/transcript-ai/transcript-cleanup.d.ts +5 -5
- package/dist/integrations/transcript-ai/transcript-cleanup.js +7 -10
- package/dist/integrations/transcript-ai/transcript-cleanup.js.map +1 -1
- package/dist/markdown/MarkdownSurface.vue.d.ts +12 -11
- package/dist/markdown/MarkdownSurface2.js +3 -6
- package/dist/markdown/MarkdownSurface2.js.map +1 -1
- package/dist/markdown/document.js +1 -1
- package/dist/markdown/source-mode.d.ts +1 -1
- package/dist/nuxt/module.d.ts +1402 -54
- package/dist/nuxt/module.js +6 -49
- package/dist/nuxt/module.js.map +1 -1
- package/dist/nuxt/runtime/install-context.d.ts +7 -3
- package/dist/nuxt/runtime/install-context.js +14 -8
- package/dist/nuxt/runtime/install-context.js.map +1 -1
- package/dist/nuxt/runtime/plugins/editor-context-nuxt-ui.client.ts +2 -2
- package/dist/nuxt/runtime/server/plugins/editor-server.js +20 -12
- package/dist/nuxt/runtime/server/plugins/editor-server.js.map +1 -1
- package/dist/presets/compose.d.ts +94 -0
- package/dist/presets/compose.js +164 -0
- package/dist/presets/compose.js.map +1 -0
- package/dist/react/AdvancedEditor.d.ts +15 -15
- package/dist/react/AdvancedEditor.js +15 -13
- package/dist/react/AdvancedEditor.js.map +1 -1
- package/dist/react/EditorCommandPalette.d.ts +13 -0
- package/dist/react/EditorCommandPalette.js +118 -0
- package/dist/react/EditorCommandPalette.js.map +1 -0
- package/dist/react/EditorSettingsModal.d.ts +5 -5
- package/dist/react/EditorSettingsModal.js +7 -4
- package/dist/react/EditorSettingsModal.js.map +1 -1
- package/dist/react/EditorSettingsPanel.d.ts +7 -7
- package/dist/react/EditorSettingsPanel.js +8 -5
- package/dist/react/EditorSettingsPanel.js.map +1 -1
- package/dist/react/EditorSurface.d.ts +7 -7
- package/dist/react/EditorSurface.js +10 -6
- package/dist/react/EditorSurface.js.map +1 -1
- package/dist/react/EditorToolbar.d.ts +4 -6
- package/dist/react/EditorToolbar.js +29 -37
- package/dist/react/EditorToolbar.js.map +1 -1
- package/dist/react/SimpleEditor.d.ts +22 -23
- package/dist/react/SimpleEditor.js +21 -7
- package/dist/react/SimpleEditor.js.map +1 -1
- package/dist/react/advanced.d.ts +4 -3
- package/dist/react/advanced.js +2 -2
- package/dist/react/compose.d.ts +20 -0
- package/dist/react/compose.js +49 -0
- package/dist/react/compose.js.map +1 -0
- package/dist/react/composed-surface.d.ts +39 -0
- package/dist/react/composed-surface.js +71 -0
- package/dist/react/composed-surface.js.map +1 -0
- package/dist/react/context.js +6 -2
- package/dist/react/context.js.map +1 -1
- package/dist/react/index.d.ts +2 -1
- package/dist/react/index.js +2 -1
- package/dist/react/key-labels.js +15 -0
- package/dist/react/key-labels.js.map +1 -0
- package/dist/react/settings.d.ts +1 -1
- package/dist/react/simple.d.ts +2 -2
- package/dist/react/ui/command.js +36 -1
- package/dist/react/ui/command.js.map +1 -1
- package/dist/schema/advanced.d.ts +6 -6
- package/dist/schema/advanced.js +26 -29
- package/dist/schema/advanced.js.map +1 -1
- package/dist/server/ai.d.ts +5 -16
- package/dist/server/ai.js.map +1 -1
- package/dist/server/auth.d.ts +9 -0
- package/dist/server/collab-state.d.ts +1 -1
- package/dist/server/collab-state.js.map +1 -1
- package/dist/server/collab.d.ts +13 -13
- package/dist/server/collab.js +34 -18
- package/dist/server/collab.js.map +1 -1
- package/dist/server/crossref.js +78 -0
- package/dist/server/crossref.js.map +1 -0
- package/dist/server/errors.d.ts +1 -1
- package/dist/server/errors.js +1 -1
- package/dist/server/errors.js.map +1 -1
- package/dist/server/extract.js +308 -0
- package/dist/server/extract.js.map +1 -0
- package/dist/server/h3.d.ts +8 -0
- package/dist/{nuxt/runtime/server/utils/editor-route.js → server/h3.js} +8 -16
- package/dist/server/h3.js.map +1 -0
- package/dist/server/handlers/ai.d.ts +32 -10
- package/dist/server/handlers/ai.js +172 -37
- package/dist/server/handlers/ai.js.map +1 -1
- package/dist/server/handlers/context.d.ts +12 -5
- package/dist/server/handlers/context.js +10 -4
- package/dist/server/handlers/context.js.map +1 -1
- package/dist/server/handlers/editor.d.ts +19 -13
- package/dist/server/handlers/editor.js +49 -38
- package/dist/server/handlers/editor.js.map +1 -1
- package/dist/server/handlers/index.d.ts +4 -4
- package/dist/server/handlers/index.js +4 -4
- package/dist/server/host.d.ts +16 -25
- package/dist/server/host.js +58 -41
- package/dist/server/host.js.map +1 -1
- package/dist/server/index.d.ts +6 -4
- package/dist/server/index.js +3 -2
- package/dist/server/pdf.js +97 -0
- package/dist/server/pdf.js.map +1 -0
- package/dist/server/{adapter.d.ts → ports.d.ts} +81 -30
- package/dist/server/ports.js +29 -0
- package/dist/server/ports.js.map +1 -0
- package/dist/server/routes.d.ts +22 -0
- package/dist/server/routes.js +144 -0
- package/dist/server/routes.js.map +1 -0
- package/dist/settings/index.d.ts +1 -1
- package/dist/settings/index.js.map +1 -1
- package/dist/styles/composites.css +25 -0
- package/dist/tree/DocumentTree.js +56 -29
- package/dist/tree/DocumentTree.js.map +1 -1
- package/dist/tree/react/DocumentTree.js +23 -0
- package/dist/tree/react/DocumentTree.js.map +1 -1
- package/dist/tree/tree-host.js +2 -2
- package/dist/tree/tree-items.js +1 -1
- package/dist/vue/AdvancedEditor.js +30 -9
- package/dist/vue/AdvancedEditor.js.map +1 -1
- package/dist/vue/AdvancedEditor.vue.d.ts +32 -12
- package/dist/vue/SimpleEditor.js +62 -16
- package/dist/vue/SimpleEditor.js.map +1 -1
- package/dist/vue/SimpleEditor.vue.d.ts +39 -9
- package/dist/vue/advanced.d.ts +3 -2
- package/dist/vue/advanced.js +2 -2
- package/dist/vue/components/EditorCommandPalette.js +91 -0
- package/dist/vue/components/EditorCommandPalette.js.map +1 -0
- package/dist/vue/components/EditorCommandPalette.vue.d.ts +15 -0
- package/dist/vue/components/EditorSettingsModal.js +10 -6
- package/dist/vue/components/EditorSettingsModal.js.map +1 -1
- package/dist/vue/components/EditorSettingsModal.vue.d.ts +4 -4
- package/dist/vue/components/EditorSettingsPanel.js +10 -6
- package/dist/vue/components/EditorSettingsPanel.js.map +1 -1
- package/dist/vue/components/EditorSettingsPanel.vue.d.ts +6 -6
- package/dist/vue/components/EditorSurface.js +11 -6
- package/dist/vue/components/EditorSurface.js.map +1 -1
- package/dist/vue/components/EditorSurface.vue.d.ts +11 -11
- package/dist/vue/components/EditorToolbar.js +41 -49
- package/dist/vue/components/EditorToolbar.js.map +1 -1
- package/dist/vue/components/EditorToolbar.vue.d.ts +2 -4
- package/dist/vue/compose.d.ts +17 -0
- package/dist/vue/compose.js +51 -0
- package/dist/vue/compose.js.map +1 -0
- package/dist/vue/context-key.d.ts +6 -0
- package/dist/vue/context-key.js +6 -0
- package/dist/vue/context-key.js.map +1 -0
- package/dist/vue/context.d.ts +8 -6
- package/dist/vue/context.js +6 -5
- package/dist/vue/context.js.map +1 -1
- package/dist/vue/index.d.ts +10 -8
- package/dist/vue/index.js +10 -8
- package/dist/vue/kit/index.d.ts +2 -2
- package/dist/vue/kit/nuxt-ui.js +23 -0
- package/dist/vue/kit/nuxt-ui.js.map +1 -1
- package/dist/vue/kit/types.d.ts +40 -1
- package/package.json +30 -16
- package/dist/adapters/comments/client.d.ts +0 -64
- package/dist/adapters/comments/client.js.map +0 -1
- package/dist/adapters/routes.js.map +0 -1
- package/dist/core/toolbar.d.ts +0 -74
- package/dist/core/toolbar.js +0 -45
- package/dist/core/toolbar.js.map +0 -1
- package/dist/integrations/composite-ai/document-transcribe.d.ts +0 -14
- package/dist/integrations/composite-ai/document-transcribe.js +0 -89
- package/dist/integrations/composite-ai/document-transcribe.js.map +0 -1
- package/dist/nuxt/runtime/server/api/ai/chat.post.d.ts +0 -5
- package/dist/nuxt/runtime/server/api/ai/chat.post.js +0 -8
- package/dist/nuxt/runtime/server/api/ai/chat.post.js.map +0 -1
- package/dist/nuxt/runtime/server/api/ai/complete.post.d.ts +0 -5
- package/dist/nuxt/runtime/server/api/ai/complete.post.js +0 -8
- package/dist/nuxt/runtime/server/api/ai/complete.post.js.map +0 -1
- package/dist/nuxt/runtime/server/api/ai/generate.post.d.ts +0 -5
- package/dist/nuxt/runtime/server/api/ai/generate.post.js +0 -8
- package/dist/nuxt/runtime/server/api/ai/generate.post.js.map +0 -1
- package/dist/nuxt/runtime/server/api/ai/models.get.d.ts +0 -5
- package/dist/nuxt/runtime/server/api/ai/models.get.js +0 -8
- package/dist/nuxt/runtime/server/api/ai/models.get.js.map +0 -1
- package/dist/nuxt/runtime/server/api/ai/transcribe.post.d.ts +0 -5
- package/dist/nuxt/runtime/server/api/ai/transcribe.post.js +0 -8
- package/dist/nuxt/runtime/server/api/ai/transcribe.post.js.map +0 -1
- package/dist/nuxt/runtime/server/api/ai/transcript-cleanup.post.d.ts +0 -5
- package/dist/nuxt/runtime/server/api/ai/transcript-cleanup.post.js +0 -8
- package/dist/nuxt/runtime/server/api/ai/transcript-cleanup.post.js.map +0 -1
- package/dist/nuxt/runtime/server/api/editor/assets/[id]/[name].get.d.ts +0 -5
- package/dist/nuxt/runtime/server/api/editor/assets/[id]/[name].get.js +0 -8
- package/dist/nuxt/runtime/server/api/editor/assets/[id]/[name].get.js.map +0 -1
- package/dist/nuxt/runtime/server/api/editor/assets/[id].post.d.ts +0 -5
- package/dist/nuxt/runtime/server/api/editor/assets/[id].post.js +0 -8
- package/dist/nuxt/runtime/server/api/editor/assets/[id].post.js.map +0 -1
- package/dist/nuxt/runtime/server/api/editor/settings.get.d.ts +0 -5
- package/dist/nuxt/runtime/server/api/editor/settings.get.js +0 -8
- package/dist/nuxt/runtime/server/api/editor/settings.get.js.map +0 -1
- package/dist/nuxt/runtime/server/api/editor/settings.put.d.ts +0 -5
- package/dist/nuxt/runtime/server/api/editor/settings.put.js +0 -8
- package/dist/nuxt/runtime/server/api/editor/settings.put.js.map +0 -1
- package/dist/nuxt/runtime/server/api/editor/tags.get.d.ts +0 -5
- package/dist/nuxt/runtime/server/api/editor/tags.get.js +0 -8
- package/dist/nuxt/runtime/server/api/editor/tags.get.js.map +0 -1
- package/dist/nuxt/runtime/server/api/editor/themes/[id].delete.d.ts +0 -5
- package/dist/nuxt/runtime/server/api/editor/themes/[id].delete.js +0 -8
- package/dist/nuxt/runtime/server/api/editor/themes/[id].delete.js.map +0 -1
- package/dist/nuxt/runtime/server/api/editor/themes/[id].get.d.ts +0 -5
- package/dist/nuxt/runtime/server/api/editor/themes/[id].get.js +0 -8
- package/dist/nuxt/runtime/server/api/editor/themes/[id].get.js.map +0 -1
- package/dist/nuxt/runtime/server/api/editor/themes/index.get.d.ts +0 -5
- package/dist/nuxt/runtime/server/api/editor/themes/index.get.js +0 -8
- package/dist/nuxt/runtime/server/api/editor/themes/index.get.js.map +0 -1
- package/dist/nuxt/runtime/server/api/editor/themes/index.post.d.ts +0 -5
- package/dist/nuxt/runtime/server/api/editor/themes/index.post.js +0 -8
- package/dist/nuxt/runtime/server/api/editor/themes/index.post.js.map +0 -1
- package/dist/nuxt/runtime/server/api/editor/users.get.d.ts +0 -5
- package/dist/nuxt/runtime/server/api/editor/users.get.js +0 -8
- package/dist/nuxt/runtime/server/api/editor/users.get.js.map +0 -1
- package/dist/nuxt/runtime/server/plugins/collab.d.ts +0 -5
- package/dist/nuxt/runtime/server/plugins/collab.js +0 -10
- package/dist/nuxt/runtime/server/plugins/collab.js.map +0 -1
- package/dist/nuxt/runtime/server/routes/collab/[id].d.ts +0 -5
- package/dist/nuxt/runtime/server/routes/collab/[id].js +0 -35
- package/dist/nuxt/runtime/server/routes/collab/[id].js.map +0 -1
- package/dist/nuxt/runtime/server/utils/editor-route.d.ts +0 -11
- package/dist/nuxt/runtime/server/utils/editor-route.js.map +0 -1
- package/dist/presets/advanced.d.ts +0 -33
- package/dist/presets/advanced.js +0 -50
- package/dist/presets/advanced.js.map +0 -1
- package/dist/presets/simple.d.ts +0 -9
- package/dist/presets/simple.js +0 -12
- package/dist/presets/simple.js.map +0 -1
- package/dist/react/advanced-preset.d.ts +0 -11
- package/dist/react/advanced-preset.js +0 -31
- package/dist/react/advanced-preset.js.map +0 -1
- package/dist/vue/advanced-preset.d.ts +0 -13
- package/dist/vue/advanced-preset.js +0 -33
- package/dist/vue/advanced-preset.js.map +0 -1
- package/docs/extending.md +0 -538
- package/docs/integration.md +0 -632
- package/docs/llms.md +0 -383
- package/docs/usage.md +0 -1076
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { derivationOf } from "../derivation.js";
|
|
2
|
+
import { useEditorI18n } from "../../../react/use-editor-i18n.js";
|
|
3
|
+
import { cn } from "../../../react/ui/utils.js";
|
|
4
|
+
import { Icon } from "../../../react/Icon.js";
|
|
5
|
+
import { derivationDetailsOf, derivationMethodLabel } from "../derived-chrome.js";
|
|
6
|
+
import { formatDate } from "../meta-display.js";
|
|
7
|
+
import { useMemo } from "react";
|
|
8
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
+
//#region src/features/composites/react/DerivationBadge.tsx
|
|
10
|
+
const CHIP = "inline-flex h-5 shrink-0 items-center gap-1 rounded-sm px-1.5 text-xs leading-none whitespace-nowrap";
|
|
11
|
+
/**
|
|
12
|
+
* Where a derived Baustein comes from. Compact (the `derivation` field type): the „abgeleitet“ badge with method and
|
|
13
|
+
* date. `detailed` (the details card): also the model, whether the source changed („Quelle geändert“), whether the body
|
|
14
|
+
* was edited since it was generated („bearbeitet“) and a link to the stored raw output. The detailed variant hashes
|
|
15
|
+
* the body, so it belongs only where one Baustein is shown.
|
|
16
|
+
*/
|
|
17
|
+
function DerivationBadge({ editor, node, detailed }) {
|
|
18
|
+
const { t } = useEditorI18n();
|
|
19
|
+
const derivation = derivationOf(node);
|
|
20
|
+
const details = useMemo(() => detailed ? derivationDetailsOf(editor, node) : null, [
|
|
21
|
+
detailed,
|
|
22
|
+
editor,
|
|
23
|
+
node
|
|
24
|
+
]);
|
|
25
|
+
if (!derivation) return null;
|
|
26
|
+
const method = derivationMethodLabel(t, derivation.method);
|
|
27
|
+
const created = derivation.createdAt ? formatDate(derivation.createdAt) : "";
|
|
28
|
+
if (!detailed) return /* @__PURE__ */ jsxs("div", {
|
|
29
|
+
className: "flex min-w-0 items-center gap-1.5 text-xs text-muted-foreground",
|
|
30
|
+
children: [/* @__PURE__ */ jsx(Icon, {
|
|
31
|
+
name: "i-lucide-git-branch",
|
|
32
|
+
className: "size-3.5 shrink-0"
|
|
33
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
34
|
+
className: "truncate",
|
|
35
|
+
children: [
|
|
36
|
+
t("composites.derivation.badge"),
|
|
37
|
+
method,
|
|
38
|
+
created
|
|
39
|
+
].filter(Boolean).join(" · ")
|
|
40
|
+
})]
|
|
41
|
+
});
|
|
42
|
+
if (!details) return null;
|
|
43
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
44
|
+
className: "flex flex-col gap-1.5 rounded-md p-2 text-xs ring-1 ring-border",
|
|
45
|
+
children: [
|
|
46
|
+
/* @__PURE__ */ jsxs("div", {
|
|
47
|
+
className: "flex flex-wrap items-center gap-1",
|
|
48
|
+
children: [
|
|
49
|
+
/* @__PURE__ */ jsxs("span", {
|
|
50
|
+
className: cn(CHIP, "text-muted-foreground"),
|
|
51
|
+
children: [/* @__PURE__ */ jsx(Icon, {
|
|
52
|
+
name: "i-lucide-git-branch",
|
|
53
|
+
className: "size-3.5"
|
|
54
|
+
}), t("composites.derivation.badge")]
|
|
55
|
+
}),
|
|
56
|
+
details.stale && /* @__PURE__ */ jsxs("span", {
|
|
57
|
+
className: cn(CHIP, "text-(--sk-warning)"),
|
|
58
|
+
children: [/* @__PURE__ */ jsx(Icon, {
|
|
59
|
+
name: "i-lucide-triangle-alert",
|
|
60
|
+
className: "size-3.5"
|
|
61
|
+
}), t("composites.derivation.stale")]
|
|
62
|
+
}),
|
|
63
|
+
details.edited && /* @__PURE__ */ jsxs("span", {
|
|
64
|
+
className: cn(CHIP, "text-muted-foreground"),
|
|
65
|
+
children: [/* @__PURE__ */ jsx(Icon, {
|
|
66
|
+
name: "i-lucide-pencil",
|
|
67
|
+
className: "size-3.5"
|
|
68
|
+
}), t("composites.derivation.edited")]
|
|
69
|
+
})
|
|
70
|
+
]
|
|
71
|
+
}),
|
|
72
|
+
/* @__PURE__ */ jsxs("dl", {
|
|
73
|
+
className: "grid grid-cols-[auto_1fr] gap-x-2 gap-y-0.5",
|
|
74
|
+
children: [
|
|
75
|
+
/* @__PURE__ */ jsx("dt", {
|
|
76
|
+
className: "text-muted-foreground",
|
|
77
|
+
children: t("composites.derivation.method")
|
|
78
|
+
}),
|
|
79
|
+
/* @__PURE__ */ jsx("dd", {
|
|
80
|
+
className: "truncate text-foreground",
|
|
81
|
+
children: method
|
|
82
|
+
}),
|
|
83
|
+
derivation.model && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("dt", {
|
|
84
|
+
className: "text-muted-foreground",
|
|
85
|
+
children: t("composites.derivation.model")
|
|
86
|
+
}), /* @__PURE__ */ jsx("dd", {
|
|
87
|
+
className: "truncate text-foreground",
|
|
88
|
+
title: derivation.model,
|
|
89
|
+
children: derivation.model
|
|
90
|
+
})] }),
|
|
91
|
+
created && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("dt", {
|
|
92
|
+
className: "text-muted-foreground",
|
|
93
|
+
children: t("composites.derivation.createdAt")
|
|
94
|
+
}), /* @__PURE__ */ jsx("dd", {
|
|
95
|
+
className: "text-foreground",
|
|
96
|
+
children: created
|
|
97
|
+
})] })
|
|
98
|
+
]
|
|
99
|
+
}),
|
|
100
|
+
details.outputUrl && /* @__PURE__ */ jsxs("a", {
|
|
101
|
+
href: details.outputUrl,
|
|
102
|
+
target: "_blank",
|
|
103
|
+
rel: "noopener",
|
|
104
|
+
className: "inline-flex w-fit items-center gap-1 text-primary hover:underline",
|
|
105
|
+
children: [/* @__PURE__ */ jsx(Icon, {
|
|
106
|
+
name: "i-lucide-external-link",
|
|
107
|
+
className: "size-3.5"
|
|
108
|
+
}), t("composites.derivation.openOutput")]
|
|
109
|
+
})
|
|
110
|
+
]
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
//#endregion
|
|
114
|
+
export { DerivationBadge };
|
|
115
|
+
|
|
116
|
+
//# sourceMappingURL=DerivationBadge.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DerivationBadge.js","names":[],"sources":["../../../../src/features/composites/react/DerivationBadge.tsx"],"sourcesContent":["import type { Editor } from '@tiptap/core'\nimport type { Node as ProseMirrorNode } from '@tiptap/pm/model'\nimport { useMemo } from 'react'\nimport { Icon } from '../../../react/Icon'\nimport { cn } from '../../../react/ui/utils'\nimport { useEditorI18n } from '../../../react/use-editor-i18n'\nimport { derivationOf } from '../derivation'\nimport { derivationDetailsOf, derivationMethodLabel } from '../derived-chrome'\nimport { formatDate } from '../meta-display'\n\nconst CHIP = 'inline-flex h-5 shrink-0 items-center gap-1 rounded-sm px-1.5 text-xs leading-none whitespace-nowrap'\n\n/**\n * Where a derived Baustein comes from. Compact (the `derivation` field type): the „abgeleitet“ badge with method and\n * date. `detailed` (the details card): also the model, whether the source changed („Quelle geändert“), whether the body\n * was edited since it was generated („bearbeitet“) and a link to the stored raw output. The detailed variant hashes\n * the body, so it belongs only where one Baustein is shown.\n */\nexport function DerivationBadge({ editor, node, detailed }: { editor: Editor, node: ProseMirrorNode, detailed?: boolean }) {\n const { t } = useEditorI18n()\n const derivation = derivationOf(node)\n const details = useMemo(() => detailed ? derivationDetailsOf(editor, node) : null, [detailed, editor, node])\n if (!derivation) return null\n const method = derivationMethodLabel(t, derivation.method)\n const created = derivation.createdAt ? formatDate(derivation.createdAt) : ''\n\n if (!detailed) {\n return (\n <div className=\"flex min-w-0 items-center gap-1.5 text-xs text-muted-foreground\">\n <Icon name=\"i-lucide-git-branch\" className=\"size-3.5 shrink-0\" />\n <span className=\"truncate\">{[t('composites.derivation.badge'), method, created].filter(Boolean).join(' · ')}</span>\n </div>\n )\n }\n if (!details) return null\n\n return (\n <div className=\"flex flex-col gap-1.5 rounded-md p-2 text-xs ring-1 ring-border\">\n <div className=\"flex flex-wrap items-center gap-1\">\n <span className={cn(CHIP, 'text-muted-foreground')}>\n <Icon name=\"i-lucide-git-branch\" className=\"size-3.5\" />{t('composites.derivation.badge')}\n </span>\n {details.stale && (\n <span className={cn(CHIP, 'text-(--sk-warning)')}>\n <Icon name=\"i-lucide-triangle-alert\" className=\"size-3.5\" />{t('composites.derivation.stale')}\n </span>\n )}\n {details.edited && (\n <span className={cn(CHIP, 'text-muted-foreground')}>\n <Icon name=\"i-lucide-pencil\" className=\"size-3.5\" />{t('composites.derivation.edited')}\n </span>\n )}\n </div>\n <dl className=\"grid grid-cols-[auto_1fr] gap-x-2 gap-y-0.5\">\n <dt className=\"text-muted-foreground\">{t('composites.derivation.method')}</dt>\n <dd className=\"truncate text-foreground\">{method}</dd>\n {derivation.model && (\n <>\n <dt className=\"text-muted-foreground\">{t('composites.derivation.model')}</dt>\n <dd className=\"truncate text-foreground\" title={derivation.model}>{derivation.model}</dd>\n </>\n )}\n {created && (\n <>\n <dt className=\"text-muted-foreground\">{t('composites.derivation.createdAt')}</dt>\n <dd className=\"text-foreground\">{created}</dd>\n </>\n )}\n </dl>\n {details.outputUrl && (\n <a href={details.outputUrl} target=\"_blank\" rel=\"noopener\" className=\"inline-flex w-fit items-center gap-1 text-primary hover:underline\">\n <Icon name=\"i-lucide-external-link\" className=\"size-3.5\" />{t('composites.derivation.openOutput')}\n </a>\n )}\n </div>\n )\n}\n"],"mappings":";;;;;;;;;AAUA,MAAM,OAAO;;;;;;;AAQb,SAAgB,gBAAgB,EAAE,QAAQ,MAAM,YAA2E;CACzH,MAAM,EAAE,MAAM,cAAc;CAC5B,MAAM,aAAa,aAAa,IAAI;CACpC,MAAM,UAAU,cAAc,WAAW,oBAAoB,QAAQ,IAAI,IAAI,MAAM;EAAC;EAAU;EAAQ;CAAI,CAAC;CAC3G,IAAI,CAAC,YAAY,OAAO;CACxB,MAAM,SAAS,sBAAsB,GAAG,WAAW,MAAM;CACzD,MAAM,UAAU,WAAW,YAAY,WAAW,WAAW,SAAS,IAAI;CAE1E,IAAI,CAAC,UACH,OACE,qBAAC,OAAD;EAAK,WAAU;EAAf,UAAA,CACE,oBAAC,MAAD;GAAM,MAAK;GAAsB,WAAU;EAAqB,CAAA,GAChE,oBAAC,QAAD;GAAM,WAAU;GAAY,UAAA;IAAC,EAAE,6BAA6B;IAAG;IAAQ;GAAO,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,KAAK,KAAK;EAAQ,CAAA,CAC/G;;CAGT,IAAI,CAAC,SAAS,OAAO;CAErB,OACE,qBAAC,OAAD;EAAK,WAAU;EAAf,UAAA;GACE,qBAAC,OAAD;IAAK,WAAU;IAAf,UAAA;KACE,qBAAC,QAAD;MAAM,WAAW,GAAG,MAAM,uBAAuB;MAAjD,UAAA,CACE,oBAAC,MAAD;OAAM,MAAK;OAAsB,WAAU;MAAY,CAAA,GAAE,EAAE,6BAA6B,CACpF;;KACL,QAAQ,SACP,qBAAC,QAAD;MAAM,WAAW,GAAG,MAAM,qBAAqB;MAA/C,UAAA,CACE,oBAAC,MAAD;OAAM,MAAK;OAA0B,WAAU;MAAY,CAAA,GAAE,EAAE,6BAA6B,CACxF;;KAEP,QAAQ,UACP,qBAAC,QAAD;MAAM,WAAW,GAAG,MAAM,uBAAuB;MAAjD,UAAA,CACE,oBAAC,MAAD;OAAM,MAAK;OAAkB,WAAU;MAAY,CAAA,GAAE,EAAE,8BAA8B,CACjF;;IAEL;;GACL,qBAAC,MAAD;IAAI,WAAU;IAAd,UAAA;KACE,oBAAC,MAAD;MAAI,WAAU;MAAyB,UAAA,EAAE,8BAA8B;KAAM,CAAA;KAC7E,oBAAC,MAAD;MAAI,WAAU;MAA4B,UAAA;KAAW,CAAA;KACpD,WAAW,SACV,qBAAA,YAAA,EAAA,UAAA,CACE,oBAAC,MAAD;MAAI,WAAU;MAAyB,UAAA,EAAE,6BAA6B;KAAM,CAAA,GAC5E,oBAAC,MAAD;MAAI,WAAU;MAA2B,OAAO,WAAW;MAAQ,UAAA,WAAW;KAAU,CAAA,CACxF,EAAA,CAAA;KAEH,WACC,qBAAA,YAAA,EAAA,UAAA,CACE,oBAAC,MAAD;MAAI,WAAU;MAAyB,UAAA,EAAE,iCAAiC;KAAM,CAAA,GAChF,oBAAC,MAAD;MAAI,WAAU;MAAmB,UAAA;KAAY,CAAA,CAC7C,EAAA,CAAA;IAEF;;GACH,QAAQ,aACP,qBAAC,KAAD;IAAG,MAAM,QAAQ;IAAW,QAAO;IAAS,KAAI;IAAW,WAAU;IAArE,UAAA,CACE,oBAAC,MAAD;KAAM,MAAK;KAAyB,WAAU;IAAY,CAAA,GAAE,EAAE,kCAAkC,CAC/F;;EAEF;;AAET"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { useEditorI18n } from "../../../react/use-editor-i18n.js";
|
|
2
|
+
import { cn } from "../../../react/ui/utils.js";
|
|
3
|
+
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "../../../react/ui/select.js";
|
|
4
|
+
import { setCompositeMetaField } from "../rows.js";
|
|
5
|
+
import { metaText } from "../meta-display.js";
|
|
6
|
+
import { useCompositeRows } from "./use-composite-rows.js";
|
|
7
|
+
import { useMemo } from "react";
|
|
8
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
+
//#region src/features/composites/react/ReferenceFieldSelect.tsx
|
|
10
|
+
/** Radix Select has no empty-string value: the "no reference" item travels as this sentinel. */
|
|
11
|
+
const NONE = "__none__";
|
|
12
|
+
const SELECT_SIZE = {
|
|
13
|
+
xs: "data-[size=sm]:h-6 text-xs",
|
|
14
|
+
sm: "data-[size=sm]:h-7",
|
|
15
|
+
md: ""
|
|
16
|
+
};
|
|
17
|
+
/** The select of a `reference` field: the other Bausteine of the document (with a block ID, of the field's target kinds) by title. */
|
|
18
|
+
function ReferenceFieldSelect({ editor, row, field, disabled, size = "sm" }) {
|
|
19
|
+
const { t } = useEditorI18n();
|
|
20
|
+
const { rows } = useCompositeRows(editor);
|
|
21
|
+
const stored = metaText(row, field);
|
|
22
|
+
const options = useMemo(() => rows.filter((candidate) => candidate.id !== null && candidate.id !== row.id && (!field.targets || field.targets.includes(candidate.kind))).map((candidate) => ({
|
|
23
|
+
label: `${candidate.title.trim() || t("composites.inspector.untitled")} · ${candidate.kindLabel}`,
|
|
24
|
+
value: candidate.id
|
|
25
|
+
})), [
|
|
26
|
+
rows,
|
|
27
|
+
row.id,
|
|
28
|
+
field.targets,
|
|
29
|
+
t
|
|
30
|
+
]);
|
|
31
|
+
return /* @__PURE__ */ jsxs(Select, {
|
|
32
|
+
value: stored,
|
|
33
|
+
onValueChange: (value) => setCompositeMetaField(editor, row, field.key, value === NONE ? "" : value),
|
|
34
|
+
disabled,
|
|
35
|
+
children: [/* @__PURE__ */ jsx(SelectTrigger, {
|
|
36
|
+
size: "sm",
|
|
37
|
+
className: cn("w-full", SELECT_SIZE[size]),
|
|
38
|
+
"aria-label": field.label,
|
|
39
|
+
children: /* @__PURE__ */ jsx(SelectValue, { placeholder: t("composites.field.choose", { field: field.label }) })
|
|
40
|
+
}), /* @__PURE__ */ jsxs(SelectContent, { children: [/* @__PURE__ */ jsx(SelectItem, {
|
|
41
|
+
value: NONE,
|
|
42
|
+
children: t("composites.field.none")
|
|
43
|
+
}), options.map((option) => /* @__PURE__ */ jsx(SelectItem, {
|
|
44
|
+
value: option.value,
|
|
45
|
+
children: option.label
|
|
46
|
+
}, option.value))] })]
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
//#endregion
|
|
50
|
+
export { ReferenceFieldSelect };
|
|
51
|
+
|
|
52
|
+
//# sourceMappingURL=ReferenceFieldSelect.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ReferenceFieldSelect.js","names":[],"sources":["../../../../src/features/composites/react/ReferenceFieldSelect.tsx"],"sourcesContent":["import type { Editor } from '@tiptap/core'\nimport { useMemo } from 'react'\nimport { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '../../../react/ui/select'\nimport { cn } from '../../../react/ui/utils'\nimport { useEditorI18n } from '../../../react/use-editor-i18n'\nimport type { CompositeMetaField } from '../kinds'\nimport { metaText } from '../meta-display'\nimport { type CompositeRow, setCompositeMetaField } from '../rows'\nimport { useCompositeRows } from './use-composite-rows'\n\n/** Radix Select has no empty-string value: the \"no reference\" item travels as this sentinel. */\nconst NONE = '__none__'\n\nconst SELECT_SIZE = {\n xs: 'data-[size=sm]:h-6 text-xs',\n sm: 'data-[size=sm]:h-7',\n md: '',\n}\n\n/** The select of a `reference` field: the other Bausteine of the document (with a block ID, of the field's target kinds) by title. */\nexport function ReferenceFieldSelect({ editor, row, field, disabled, size = 'sm' }: {\n editor: Editor\n row: CompositeRow\n field: CompositeMetaField\n disabled?: boolean\n size?: 'xs' | 'sm' | 'md'\n}) {\n const { t } = useEditorI18n()\n const { rows } = useCompositeRows(editor)\n const stored = metaText(row, field)\n const options = useMemo(() => rows\n .filter(candidate => candidate.id !== null && candidate.id !== row.id && (!field.targets || field.targets.includes(candidate.kind)))\n .map(candidate => ({ label: `${candidate.title.trim() || t('composites.inspector.untitled')} · ${candidate.kindLabel}`, value: candidate.id as string })), [rows, row.id, field.targets, t])\n\n return (\n <Select value={stored} onValueChange={value => setCompositeMetaField(editor, row, field.key, value === NONE ? '' : value)} disabled={disabled}>\n <SelectTrigger size=\"sm\" className={cn('w-full', SELECT_SIZE[size])} aria-label={field.label}>\n <SelectValue placeholder={t('composites.field.choose', { field: field.label })} />\n </SelectTrigger>\n <SelectContent>\n <SelectItem value={NONE}>{t('composites.field.none')}</SelectItem>\n {options.map(option => (\n <SelectItem key={option.value} value={option.value}>{option.label}</SelectItem>\n ))}\n </SelectContent>\n </Select>\n )\n}\n"],"mappings":";;;;;;;;;;AAWA,MAAM,OAAO;AAEb,MAAM,cAAc;CAClB,IAAI;CACJ,IAAI;CACJ,IAAI;AACN;;AAGA,SAAgB,qBAAqB,EAAE,QAAQ,KAAK,OAAO,UAAU,OAAO,QAMzE;CACD,MAAM,EAAE,MAAM,cAAc;CAC5B,MAAM,EAAE,SAAS,iBAAiB,MAAM;CACxC,MAAM,SAAS,SAAS,KAAK,KAAK;CAClC,MAAM,UAAU,cAAc,KAC3B,QAAO,cAAa,UAAU,OAAO,QAAQ,UAAU,OAAO,IAAI,OAAO,CAAC,MAAM,WAAW,MAAM,QAAQ,SAAS,UAAU,IAAI,EAAE,CAAC,CACnI,KAAI,eAAc;EAAE,OAAO,GAAG,UAAU,MAAM,KAAK,KAAK,EAAE,+BAA+B,EAAE,KAAK,UAAU;EAAa,OAAO,UAAU;CAAa,EAAE,GAAG;EAAC;EAAM,IAAI;EAAI,MAAM;EAAS;CAAC,CAAC;CAE7L,OACE,qBAAC,QAAD;EAAQ,OAAO;EAAQ,gBAAe,UAAS,sBAAsB,QAAQ,KAAK,MAAM,KAAK,UAAU,OAAO,KAAK,KAAK;EAAa;EAArI,UAAA,CACE,oBAAC,eAAD;GAAe,MAAK;GAAK,WAAW,GAAG,UAAU,YAAY,KAAK;GAAG,cAAY,MAAM;GACrF,UAAA,oBAAC,aAAD,EAAa,aAAa,EAAE,2BAA2B,EAAE,OAAO,MAAM,MAAM,CAAC,EAAI,CAAA;EACpE,CAAA,GACf,qBAAC,eAAD,EAAA,UAAA,CACE,oBAAC,YAAD;GAAY,OAAO;GAAO,UAAA,EAAE,uBAAuB;EAAc,CAAA,GAChE,QAAQ,KAAI,WACX,oBAAC,YAAD;GAA+B,OAAO,OAAO;GAAQ,UAAA,OAAO;EAAkB,GAA7D,OAAO,KAAsD,CAC/E,CACY,EAAA,CAAA,CACT;;AAEZ"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { NodeViewProps } from "@tiptap/react";
|
|
2
|
+
//#region src/features/composites/react/ReferenceView.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* The `reference` chip: the live short citation (or title) of the Baustein it points at, followed by its locator.
|
|
5
|
+
* A click reveals the target and, with a locator, opens its source there (page of a PDF, time of a recording); a
|
|
6
|
+
* target that no longer exists shows a greyed „gone“ label. Double click or right click opens a popover to set the
|
|
7
|
+
* locator („Stelle“) in an editable editor.
|
|
8
|
+
*/
|
|
9
|
+
export declare function ReferenceView({ editor, node, selected, getPos }: NodeViewProps): import("react").JSX.Element;
|
|
10
|
+
//#endregion
|
|
11
|
+
//# sourceMappingURL=ReferenceView.d.ts.map
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { useEditorI18n } from "../../../react/use-editor-i18n.js";
|
|
2
|
+
import { cn } from "../../../react/ui/utils.js";
|
|
3
|
+
import { Input } from "../../../react/ui/input.js";
|
|
4
|
+
import { Popover, PopoverAnchor, PopoverContent } from "../../../react/ui/popover.js";
|
|
5
|
+
import { referenceAttrsOf, resolveReference } from "../reference-label.js";
|
|
6
|
+
import { revealSource } from "../reveal-source.js";
|
|
7
|
+
import { useEffect, useState } from "react";
|
|
8
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
+
import { NodeViewWrapper } from "@tiptap/react";
|
|
10
|
+
//#region src/features/composites/react/ReferenceView.tsx
|
|
11
|
+
/**
|
|
12
|
+
* The `reference` chip: the live short citation (or title) of the Baustein it points at, followed by its locator.
|
|
13
|
+
* A click reveals the target and, with a locator, opens its source there (page of a PDF, time of a recording); a
|
|
14
|
+
* target that no longer exists shows a greyed „gone“ label. Double click or right click opens a popover to set the
|
|
15
|
+
* locator („Stelle“) in an editable editor.
|
|
16
|
+
*/
|
|
17
|
+
function ReferenceView({ editor, node, selected, getPos }) {
|
|
18
|
+
const { t } = useEditorI18n();
|
|
19
|
+
const [resolved, setResolved] = useState(() => resolveReference(editor, referenceAttrsOf(node)));
|
|
20
|
+
const [open, setOpen] = useState(false);
|
|
21
|
+
const [draft, setDraft] = useState("");
|
|
22
|
+
const target = String(node.attrs.target);
|
|
23
|
+
const locator = typeof node.attrs.locator === "string" ? node.attrs.locator : "";
|
|
24
|
+
useEffect(() => {
|
|
25
|
+
let frame = 0;
|
|
26
|
+
const resolve = () => {
|
|
27
|
+
if (editor.isDestroyed) return;
|
|
28
|
+
const next = resolveReference(editor, {
|
|
29
|
+
target,
|
|
30
|
+
label: String(node.attrs.label ?? "")
|
|
31
|
+
});
|
|
32
|
+
setResolved((current) => next.label === current.label && next.title === current.title && next.gone === current.gone ? current : next);
|
|
33
|
+
};
|
|
34
|
+
const schedule = () => {
|
|
35
|
+
cancelAnimationFrame(frame);
|
|
36
|
+
frame = requestAnimationFrame(resolve);
|
|
37
|
+
};
|
|
38
|
+
resolve();
|
|
39
|
+
editor.on("update", schedule);
|
|
40
|
+
return () => {
|
|
41
|
+
cancelAnimationFrame(frame);
|
|
42
|
+
editor.off("update", schedule);
|
|
43
|
+
};
|
|
44
|
+
}, [
|
|
45
|
+
editor,
|
|
46
|
+
target,
|
|
47
|
+
node.attrs.label
|
|
48
|
+
]);
|
|
49
|
+
const label = resolved.gone ? t("composites.reference.gone") : resolved.label;
|
|
50
|
+
const text = locator && !resolved.gone ? `${label}, ${locator}` : label;
|
|
51
|
+
function onClick() {
|
|
52
|
+
if (!editor.commands.revealBlock(target)) return;
|
|
53
|
+
if (locator) revealSource(editor, target, locator);
|
|
54
|
+
}
|
|
55
|
+
function openLocator() {
|
|
56
|
+
if (!editor.isEditable) return;
|
|
57
|
+
setDraft(locator);
|
|
58
|
+
setOpen(true);
|
|
59
|
+
}
|
|
60
|
+
function commit() {
|
|
61
|
+
setOpen(false);
|
|
62
|
+
const pos = getPos();
|
|
63
|
+
if (typeof pos !== "number" || draft.trim() === locator) return;
|
|
64
|
+
editor.commands.setReferenceLocator(pos, draft);
|
|
65
|
+
}
|
|
66
|
+
return /* @__PURE__ */ jsx(NodeViewWrapper, {
|
|
67
|
+
as: "span",
|
|
68
|
+
className: cn("reference", resolved.gone && "is-gone", selected && "is-selected"),
|
|
69
|
+
"data-type": "reference",
|
|
70
|
+
"data-target": target,
|
|
71
|
+
title: resolved.gone ? void 0 : resolved.title,
|
|
72
|
+
role: "link",
|
|
73
|
+
onClick,
|
|
74
|
+
onDoubleClick: (event) => {
|
|
75
|
+
event.preventDefault();
|
|
76
|
+
openLocator();
|
|
77
|
+
},
|
|
78
|
+
onContextMenu: (event) => {
|
|
79
|
+
event.preventDefault();
|
|
80
|
+
openLocator();
|
|
81
|
+
},
|
|
82
|
+
children: /* @__PURE__ */ jsxs(Popover, {
|
|
83
|
+
open,
|
|
84
|
+
onOpenChange: (value) => {
|
|
85
|
+
if (!value) commit();
|
|
86
|
+
},
|
|
87
|
+
children: [/* @__PURE__ */ jsx(PopoverAnchor, {
|
|
88
|
+
asChild: true,
|
|
89
|
+
children: /* @__PURE__ */ jsx("span", { children: text })
|
|
90
|
+
}), /* @__PURE__ */ jsx(PopoverContent, {
|
|
91
|
+
align: "start",
|
|
92
|
+
side: "bottom",
|
|
93
|
+
className: "w-56 p-2",
|
|
94
|
+
onCloseAutoFocus: (event) => event.preventDefault(),
|
|
95
|
+
children: /* @__PURE__ */ jsx(Input, {
|
|
96
|
+
value: draft,
|
|
97
|
+
className: "h-7 w-full text-xs",
|
|
98
|
+
placeholder: t("composites.reference.locatorPlaceholder"),
|
|
99
|
+
"aria-label": t("composites.reference.locator"),
|
|
100
|
+
onChange: (event) => setDraft(event.target.value),
|
|
101
|
+
onKeyDown: (event) => {
|
|
102
|
+
if (event.key === "Enter") {
|
|
103
|
+
event.preventDefault();
|
|
104
|
+
commit();
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
})
|
|
108
|
+
})]
|
|
109
|
+
})
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
//#endregion
|
|
113
|
+
export { ReferenceView };
|
|
114
|
+
|
|
115
|
+
//# sourceMappingURL=ReferenceView.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ReferenceView.js","names":[],"sources":["../../../../src/features/composites/react/ReferenceView.tsx"],"sourcesContent":["import { NodeViewWrapper, type NodeViewProps } from '@tiptap/react'\nimport { type MouseEvent, useEffect, useState } from 'react'\nimport { Input } from '../../../react/ui/input'\nimport { Popover, PopoverAnchor, PopoverContent } from '../../../react/ui/popover'\nimport { cn } from '../../../react/ui/utils'\nimport { useEditorI18n } from '../../../react/use-editor-i18n'\nimport { referenceAttrsOf, resolveReference } from '../reference-label'\nimport { revealSource } from '../reveal-source'\n\n/**\n * The `reference` chip: the live short citation (or title) of the Baustein it points at, followed by its locator.\n * A click reveals the target and, with a locator, opens its source there (page of a PDF, time of a recording); a\n * target that no longer exists shows a greyed „gone“ label. Double click or right click opens a popover to set the\n * locator („Stelle“) in an editable editor.\n */\nexport function ReferenceView({ editor, node, selected, getPos }: NodeViewProps) {\n const { t } = useEditorI18n()\n const [resolved, setResolved] = useState(() => resolveReference(editor, referenceAttrsOf(node)))\n const [open, setOpen] = useState(false)\n const [draft, setDraft] = useState('')\n const target = String(node.attrs.target)\n const locator = typeof node.attrs.locator === 'string' ? node.attrs.locator : ''\n\n // The target's title and bibliography edits change the label: re-resolve after document changes, once per frame.\n useEffect(() => {\n let frame = 0\n const resolve = () => {\n if (editor.isDestroyed) return\n const next = resolveReference(editor, { target, label: String(node.attrs.label ?? '') })\n setResolved(current => (next.label === current.label && next.title === current.title && next.gone === current.gone ? current : next))\n }\n const schedule = () => {\n cancelAnimationFrame(frame)\n frame = requestAnimationFrame(resolve)\n }\n resolve()\n editor.on('update', schedule)\n return () => {\n cancelAnimationFrame(frame)\n editor.off('update', schedule)\n }\n }, [editor, target, node.attrs.label])\n\n const label = resolved.gone ? t('composites.reference.gone') : resolved.label\n const text = locator && !resolved.gone ? `${label}, ${locator}` : label\n\n function onClick() {\n if (!editor.commands.revealBlock(target)) return\n if (locator) revealSource(editor, target, locator)\n }\n\n function openLocator() {\n if (!editor.isEditable) return\n setDraft(locator)\n setOpen(true)\n }\n\n function commit() {\n setOpen(false)\n const pos = getPos()\n if (typeof pos !== 'number' || draft.trim() === locator) return\n editor.commands.setReferenceLocator(pos, draft)\n }\n\n return (\n <NodeViewWrapper\n as=\"span\"\n className={cn('reference', resolved.gone && 'is-gone', selected && 'is-selected')}\n data-type=\"reference\"\n data-target={target}\n title={resolved.gone ? undefined : resolved.title}\n role=\"link\"\n onClick={onClick}\n onDoubleClick={(event: MouseEvent) => {\n event.preventDefault()\n openLocator()\n }}\n onContextMenu={(event: MouseEvent) => {\n event.preventDefault()\n openLocator()\n }}\n >\n <Popover open={open} onOpenChange={(value) => { if (!value) commit() }}>\n <PopoverAnchor asChild>\n <span>{text}</span>\n </PopoverAnchor>\n <PopoverContent\n align=\"start\"\n side=\"bottom\"\n className=\"w-56 p-2\"\n onCloseAutoFocus={event => event.preventDefault()}\n >\n <Input\n value={draft}\n className=\"h-7 w-full text-xs\"\n placeholder={t('composites.reference.locatorPlaceholder')}\n aria-label={t('composites.reference.locator')}\n onChange={event => setDraft(event.target.value)}\n onKeyDown={(event) => {\n if (event.key === 'Enter') {\n event.preventDefault()\n commit()\n }\n }}\n />\n </PopoverContent>\n </Popover>\n </NodeViewWrapper>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAeA,SAAgB,cAAc,EAAE,QAAQ,MAAM,UAAU,UAAyB;CAC/E,MAAM,EAAE,MAAM,cAAc;CAC5B,MAAM,CAAC,UAAU,eAAe,eAAe,iBAAiB,QAAQ,iBAAiB,IAAI,CAAC,CAAC;CAC/F,MAAM,CAAC,MAAM,WAAW,SAAS,KAAK;CACtC,MAAM,CAAC,OAAO,YAAY,SAAS,EAAE;CACrC,MAAM,SAAS,OAAO,KAAK,MAAM,MAAM;CACvC,MAAM,UAAU,OAAO,KAAK,MAAM,YAAY,WAAW,KAAK,MAAM,UAAU;CAG9E,gBAAgB;EACd,IAAI,QAAQ;EACZ,MAAM,gBAAgB;GACpB,IAAI,OAAO,aAAa;GACxB,MAAM,OAAO,iBAAiB,QAAQ;IAAE;IAAQ,OAAO,OAAO,KAAK,MAAM,SAAS,EAAE;GAAE,CAAC;GACvF,aAAY,YAAY,KAAK,UAAU,QAAQ,SAAS,KAAK,UAAU,QAAQ,SAAS,KAAK,SAAS,QAAQ,OAAO,UAAU,IAAK;EACtI;EACA,MAAM,iBAAiB;GACrB,qBAAqB,KAAK;GAC1B,QAAQ,sBAAsB,OAAO;EACvC;EACA,QAAQ;EACR,OAAO,GAAG,UAAU,QAAQ;EAC5B,aAAa;GACX,qBAAqB,KAAK;GAC1B,OAAO,IAAI,UAAU,QAAQ;EAC/B;CACF,GAAG;EAAC;EAAQ;EAAQ,KAAK,MAAM;CAAK,CAAC;CAErC,MAAM,QAAQ,SAAS,OAAO,EAAE,2BAA2B,IAAI,SAAS;CACxE,MAAM,OAAO,WAAW,CAAC,SAAS,OAAO,GAAG,MAAM,IAAI,YAAY;CAElE,SAAS,UAAU;EACjB,IAAI,CAAC,OAAO,SAAS,YAAY,MAAM,GAAG;EAC1C,IAAI,SAAS,aAAa,QAAQ,QAAQ,OAAO;CACnD;CAEA,SAAS,cAAc;EACrB,IAAI,CAAC,OAAO,YAAY;EACxB,SAAS,OAAO;EAChB,QAAQ,IAAI;CACd;CAEA,SAAS,SAAS;EAChB,QAAQ,KAAK;EACb,MAAM,MAAM,OAAO;EACnB,IAAI,OAAO,QAAQ,YAAY,MAAM,KAAK,MAAM,SAAS;EACzD,OAAO,SAAS,oBAAoB,KAAK,KAAK;CAChD;CAEA,OACE,oBAAC,iBAAD;EACE,IAAG;EACH,WAAW,GAAG,aAAa,SAAS,QAAQ,WAAW,YAAY,aAAa;EAChF,aAAU;EACV,eAAa;EACb,OAAO,SAAS,OAAO,KAAA,IAAY,SAAS;EAC5C,MAAK;EACI;EACT,gBAAgB,UAAsB;GACpC,MAAM,eAAe;GACrB,YAAY;EACd;EACA,gBAAgB,UAAsB;GACpC,MAAM,eAAe;GACrB,YAAY;EACd;EAEA,UAAA,qBAAC,SAAD;GAAe;GAAM,eAAe,UAAU;IAAE,IAAI,CAAC,OAAO,OAAO;GAAE;GAArE,UAAA,CACE,oBAAC,eAAD;IAAe,SAAA;IACb,UAAA,oBAAC,QAAD,EAAA,UAAO,KAAW,CAAA;GACL,CAAA,GACf,oBAAC,gBAAD;IACE,OAAM;IACN,MAAK;IACL,WAAU;IACV,mBAAkB,UAAS,MAAM,eAAe;IAEhD,UAAA,oBAAC,OAAD;KACE,OAAO;KACP,WAAU;KACV,aAAa,EAAE,yCAAyC;KACxD,cAAY,EAAE,8BAA8B;KAC5C,WAAU,UAAS,SAAS,MAAM,OAAO,KAAK;KAC9C,YAAY,UAAU;MACpB,IAAI,MAAM,QAAQ,SAAS;OACzB,MAAM,eAAe;OACrB,OAAO;MACT;KACF;IACD,CAAA;GACa,CAAA,CACT;;CACM,CAAA;AAErB"}
|
|
@@ -2,13 +2,13 @@ import { DRAG_HANDLE_VISIBILITIES, HEADING_CONVERSION_SCOPES, KIND_ICON_VISIBILI
|
|
|
2
2
|
import { useEditorI18n } from "../../../react/use-editor-i18n.js";
|
|
3
3
|
import { Icon } from "../../../react/Icon.js";
|
|
4
4
|
import { useEditorSettings } from "../../../react/settings.js";
|
|
5
|
-
import { STRUCTURE_MODE_KEYS } from "../structure-mode.js";
|
|
6
|
-
import { TREE_ROOT_KEYS } from "../tree-root.js";
|
|
7
5
|
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "../../../react/ui/select.js";
|
|
8
6
|
import { SettingsSection } from "../../../react/SettingsSection.js";
|
|
9
7
|
import { Label } from "../../../react/ui/label.js";
|
|
10
8
|
import { RadioGroup, RadioGroupItem } from "../../../react/ui/radio-group.js";
|
|
9
|
+
import { STRUCTURE_MODE_KEYS } from "../structure-mode.js";
|
|
11
10
|
import { DRAG_HANDLE_KEYS, HEADING_SCOPE_KEYS, KIND_ICON_KEYS, optionItems } from "../editing-settings-keys.js";
|
|
11
|
+
import { TREE_ROOT_KEYS } from "../tree-root.js";
|
|
12
12
|
import { useId } from "react";
|
|
13
13
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
14
14
|
//#region src/features/composites/react/SettingsEditingTab.tsx
|
|
@@ -10,6 +10,7 @@ import { CompositeSummaryEditor } from "./react/CompositeSummaryEditor.js";
|
|
|
10
10
|
import { CompositeTable } from "./react/CompositeTable.js";
|
|
11
11
|
import { CompositeTagsEditor } from "./react/CompositeTagsEditor.js";
|
|
12
12
|
import { CompositeView } from "./react/CompositeView.js";
|
|
13
|
+
import { ReferenceView } from "./react/ReferenceView.js";
|
|
13
14
|
import { SettingsEditingTab } from "./react/SettingsEditingTab.js";
|
|
14
15
|
import { useCompositeAnchors } from "./react/use-composite-anchors.js";
|
|
15
16
|
import { useCompositeRows } from "./react/use-composite-rows.js";
|
|
@@ -20,5 +21,5 @@ import { useCompositeRows } from "./react/use-composite-rows.js";
|
|
|
20
21
|
*/
|
|
21
22
|
export declare function compositeFeature(options?: CompositeFeatureOptions): ReactFeature;
|
|
22
23
|
//#endregion
|
|
23
|
-
export { CompositeChrome, CompositeDetails, CompositeFieldEditor, CompositeInspector, CompositeStatusMenu, CompositeSummaryEditor, CompositeTable, CompositeTagsEditor, CompositeView, SettingsEditingTab, useCompositeAnchors, useCompositeRows };
|
|
24
|
+
export { CompositeChrome, CompositeDetails, CompositeFieldEditor, CompositeInspector, CompositeStatusMenu, CompositeSummaryEditor, CompositeTable, CompositeTagsEditor, CompositeView, ReferenceView, SettingsEditingTab, useCompositeAnchors, useCompositeRows };
|
|
24
25
|
//# sourceMappingURL=react.d.ts.map
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { compositeFeatureCore } from "./feature.js";
|
|
2
|
+
import { useCompositeRows } from "./react/use-composite-rows.js";
|
|
2
3
|
import { CompositeFieldEditor } from "./react/CompositeFieldEditor.js";
|
|
3
4
|
import { CompositeSummaryEditor } from "./react/CompositeSummaryEditor.js";
|
|
4
5
|
import { CompositeDetails } from "./react/CompositeDetails.js";
|
|
5
6
|
import { CompositeStatusMenu } from "./react/CompositeStatusMenu.js";
|
|
6
7
|
import { CompositeTagsEditor } from "./react/CompositeTagsEditor.js";
|
|
7
8
|
import { useCompositeAnchors } from "./react/use-composite-anchors.js";
|
|
8
|
-
import { useCompositeRows } from "./react/use-composite-rows.js";
|
|
9
9
|
import { CompositeChrome } from "./react/CompositeChrome.js";
|
|
10
|
+
import { ReferenceView } from "./react/ReferenceView.js";
|
|
10
11
|
import { CompositeView } from "./react/CompositeView.js";
|
|
11
12
|
import { SettingsEditingTab } from "./react/SettingsEditingTab.js";
|
|
12
13
|
import { CompositeInspector } from "./react/CompositeInspector.js";
|
|
@@ -21,10 +22,13 @@ function compositeFeature(options = {}) {
|
|
|
21
22
|
return compositeFeatureCore({
|
|
22
23
|
chrome: CompositeChrome,
|
|
23
24
|
settingsTab: SettingsEditingTab,
|
|
24
|
-
nodeViews: {
|
|
25
|
+
nodeViews: {
|
|
26
|
+
composite: ReactNodeViewRenderer(CompositeView),
|
|
27
|
+
reference: ReactNodeViewRenderer(ReferenceView)
|
|
28
|
+
}
|
|
25
29
|
}, options);
|
|
26
30
|
}
|
|
27
31
|
//#endregion
|
|
28
|
-
export { CompositeChrome, CompositeDetails, CompositeFieldEditor, CompositeInspector, CompositeStatusMenu, CompositeSummaryEditor, CompositeTable, CompositeTagsEditor, CompositeView, SettingsEditingTab, compositeFeature, useCompositeAnchors, useCompositeRows };
|
|
32
|
+
export { CompositeChrome, CompositeDetails, CompositeFieldEditor, CompositeInspector, CompositeStatusMenu, CompositeSummaryEditor, CompositeTable, CompositeTagsEditor, CompositeView, ReferenceView, SettingsEditingTab, compositeFeature, useCompositeAnchors, useCompositeRows };
|
|
29
33
|
|
|
30
34
|
//# sourceMappingURL=react.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react.js","names":[],"sources":["../../../src/features/composites/react.ts"],"sourcesContent":["import type { Editor } from '@tiptap/core'\nimport { ReactNodeViewRenderer } from '@tiptap/react'\nimport type { ComponentType } from 'react'\nimport type { ReactFeature } from '../../react'\nimport { type CompositeFeatureOptions, compositeFeatureCore } from './feature'\nimport { CompositeChrome } from './react/CompositeChrome'\nimport { CompositeView } from './react/CompositeView'\nimport { SettingsEditingTab } from './react/SettingsEditingTab'\n\nexport { CompositeChrome } from './react/CompositeChrome'\nexport { CompositeDetails } from './react/CompositeDetails'\nexport { CompositeFieldEditor } from './react/CompositeFieldEditor'\nexport { CompositeInspector } from './react/CompositeInspector'\nexport { CompositeStatusMenu } from './react/CompositeStatusMenu'\nexport { CompositeSummaryEditor } from './react/CompositeSummaryEditor'\nexport { CompositeTable } from './react/CompositeTable'\nexport { CompositeTagsEditor } from './react/CompositeTagsEditor'\nexport { CompositeView } from './react/CompositeView'\nexport { SettingsEditingTab } from './react/SettingsEditingTab'\nexport { useCompositeAnchors } from './react/use-composite-anchors'\nexport { useCompositeRows } from './react/use-composite-rows'\n\n/**\n * The React composites feature (shadcn): see `compositeFeatureCore`. The host places `CompositeTable` and\n * `CompositeInspector` beside the editor.\n */\nexport function compositeFeature(options: CompositeFeatureOptions = {}): ReactFeature {\n return compositeFeatureCore<ComponentType<{ editor: Editor }>>({\n chrome: CompositeChrome,\n // A settings tab receives only its descriptor's `props` (`{ kinds }`), not the toolbar's `{ editor }` (see `EditorSettingsPanel`).\n settingsTab: SettingsEditingTab as unknown as ComponentType<{ editor: Editor }>,\n nodeViews: { composite: ReactNodeViewRenderer(CompositeView) },\n }, options)\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"react.js","names":[],"sources":["../../../src/features/composites/react.ts"],"sourcesContent":["import type { Editor } from '@tiptap/core'\nimport { ReactNodeViewRenderer } from '@tiptap/react'\nimport type { ComponentType } from 'react'\nimport type { ReactFeature } from '../../react'\nimport { type CompositeFeatureOptions, compositeFeatureCore } from './feature'\nimport { CompositeChrome } from './react/CompositeChrome'\nimport { ReferenceView } from './react/ReferenceView'\nimport { CompositeView } from './react/CompositeView'\nimport { SettingsEditingTab } from './react/SettingsEditingTab'\n\nexport { CompositeChrome } from './react/CompositeChrome'\nexport { CompositeDetails } from './react/CompositeDetails'\nexport { CompositeFieldEditor } from './react/CompositeFieldEditor'\nexport { CompositeInspector } from './react/CompositeInspector'\nexport { CompositeStatusMenu } from './react/CompositeStatusMenu'\nexport { CompositeSummaryEditor } from './react/CompositeSummaryEditor'\nexport { CompositeTable } from './react/CompositeTable'\nexport { CompositeTagsEditor } from './react/CompositeTagsEditor'\nexport { CompositeView } from './react/CompositeView'\nexport { ReferenceView } from './react/ReferenceView'\nexport { SettingsEditingTab } from './react/SettingsEditingTab'\nexport { useCompositeAnchors } from './react/use-composite-anchors'\nexport { useCompositeRows } from './react/use-composite-rows'\n\n/**\n * The React composites feature (shadcn): see `compositeFeatureCore`. The host places `CompositeTable` and\n * `CompositeInspector` beside the editor.\n */\nexport function compositeFeature(options: CompositeFeatureOptions = {}): ReactFeature {\n return compositeFeatureCore<ComponentType<{ editor: Editor }>>({\n chrome: CompositeChrome,\n // A settings tab receives only its descriptor's `props` (`{ kinds }`), not the toolbar's `{ editor }` (see `EditorSettingsPanel`).\n settingsTab: SettingsEditingTab as unknown as ComponentType<{ editor: Editor }>,\n nodeViews: { composite: ReactNodeViewRenderer(CompositeView), reference: ReactNodeViewRenderer(ReferenceView) },\n }, options)\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AA4BA,SAAgB,iBAAiB,UAAmC,CAAC,GAAiB;CACpF,OAAO,qBAAwD;EAC7D,QAAQ;EAER,aAAa;EACb,WAAW;GAAE,WAAW,sBAAsB,aAAa;GAAG,WAAW,sBAAsB,aAAa;EAAE;CAChH,GAAG,OAAO;AACZ"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
//#region src/features/composites/reference-ai.ts
|
|
2
|
+
/**
|
|
3
|
+
* How the chat and rewrite models learn the `reference` chip: written as Markdown text `[@<Block-ID>]`, which the
|
|
4
|
+
* composites feature's `normalize` stage turns back into a chip. Not a convert target (no conversion provider owns it).
|
|
5
|
+
*/
|
|
6
|
+
const REFERENCE_AI_BLOCK = {
|
|
7
|
+
id: "reference",
|
|
8
|
+
label: "Verweis",
|
|
9
|
+
description: "Inline-Verweis auf einen Baustein dieses Dokuments (Zitat, Quelle), optional mit Fundstelle (Seite oder Zeit).",
|
|
10
|
+
syntax: "[@<Block-ID>] oder [@<Block-ID>, S. 12]",
|
|
11
|
+
example: "Das zeigt die Studie [@0f3c9a52-7d1e-4b8a-9c2f-5e6d7a8b9c0d, S. 12]."
|
|
12
|
+
};
|
|
13
|
+
//#endregion
|
|
14
|
+
export { REFERENCE_AI_BLOCK };
|
|
15
|
+
|
|
16
|
+
//# sourceMappingURL=reference-ai.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reference-ai.js","names":[],"sources":["../../../src/features/composites/reference-ai.ts"],"sourcesContent":["// i18n-ignore-file: model-facing block description (German prompt text, not UI)\nimport type { AiBlock } from '../../core/feature'\n\n/**\n * How the chat and rewrite models learn the `reference` chip: written as Markdown text `[@<Block-ID>]`, which the\n * composites feature's `normalize` stage turns back into a chip. Not a convert target (no conversion provider owns it).\n */\nexport const REFERENCE_AI_BLOCK: AiBlock = {\n id: 'reference',\n label: 'Verweis',\n description: 'Inline-Verweis auf einen Baustein dieses Dokuments (Zitat, Quelle), optional mit Fundstelle (Seite oder Zeit).',\n syntax: '[@<Block-ID>] oder [@<Block-ID>, S. 12]',\n example: 'Das zeigt die Studie [@0f3c9a52-7d1e-4b8a-9c2f-5e6d7a8b9c0d, S. 12].',\n}\n"],"mappings":";;;;;AAOA,MAAa,qBAA8B;CACzC,IAAI;CACJ,OAAO;CACP,aAAa;CACb,QAAQ;CACR,SAAS;AACX"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { CompositeKind } from "./kinds.js";
|
|
2
|
+
import "./reference.js";
|
|
3
|
+
import { Editor } from "@tiptap/core";
|
|
4
|
+
import { Node as Node$1 } from "@tiptap/pm/model";
|
|
5
|
+
//#region src/features/composites/reference-label.d.ts
|
|
6
|
+
/** What a reference chip shows of its target: the parts of a `CompositeRow`, or of a composite node (`referenceTarget`). */
|
|
7
|
+
export interface ReferenceTarget {
|
|
8
|
+
meta: Record<string, unknown>;
|
|
9
|
+
title: string;
|
|
10
|
+
kindLabel: string;
|
|
11
|
+
}
|
|
12
|
+
/** The Baustein `node` as a reference target. */
|
|
13
|
+
export declare function referenceTarget(node: Node$1, kinds: readonly CompositeKind[]): ReferenceTarget;
|
|
14
|
+
/** The chip text: the short citation ("Doe et al. 2024") when the target has bibliographic data, else its title, else its kind's label. */
|
|
15
|
+
export declare function referenceLabel(target: ReferenceTarget): string;
|
|
16
|
+
/** The chip's tooltip: the full citation, else the title. */
|
|
17
|
+
export declare function referenceTitle(target: ReferenceTarget): string;
|
|
18
|
+
//#endregion
|
|
19
|
+
//# sourceMappingURL=reference-label.d.ts.map
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { findBlockById } from "../../core/schema/block-ids.js";
|
|
2
|
+
import { compositeKind } from "./kinds.js";
|
|
3
|
+
import "./meta-keys.js";
|
|
4
|
+
import { compositeKindsOf } from "./nodes.js";
|
|
5
|
+
import { citeFull, citeShort } from "./bibliography.js";
|
|
6
|
+
//#region src/features/composites/reference-label.ts
|
|
7
|
+
/** The Baustein `node` as a reference target. */
|
|
8
|
+
function referenceTarget(node, kinds) {
|
|
9
|
+
return {
|
|
10
|
+
meta: node.attrs.meta ?? {},
|
|
11
|
+
title: node.childCount > 0 ? node.child(0).textContent.trim() : "",
|
|
12
|
+
kindLabel: compositeKind(kinds, String(node.attrs.kind)).label
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
const bibOfTarget = (target) => {
|
|
16
|
+
const bib = target.meta["bib"];
|
|
17
|
+
if (!bib || typeof bib !== "object" || Array.isArray(bib)) return null;
|
|
18
|
+
return "type" in bib && typeof bib.type === "string" ? bib : null;
|
|
19
|
+
};
|
|
20
|
+
/** The chip text: the short citation ("Doe et al. 2024") when the target has bibliographic data, else its title, else its kind's label. */
|
|
21
|
+
function referenceLabel(target) {
|
|
22
|
+
const bib = bibOfTarget(target);
|
|
23
|
+
return bib ? citeShort(bib, target.title) : target.title || target.kindLabel;
|
|
24
|
+
}
|
|
25
|
+
/** The chip's tooltip: the full citation, else the title. */
|
|
26
|
+
function referenceTitle(target) {
|
|
27
|
+
const bib = bibOfTarget(target);
|
|
28
|
+
return bib ? citeFull({
|
|
29
|
+
...bib,
|
|
30
|
+
title: target.title
|
|
31
|
+
}) : target.title || target.kindLabel;
|
|
32
|
+
}
|
|
33
|
+
/** The attrs of a `reference` node that the label needs, typed (a node's `attrs` is a loose record). */
|
|
34
|
+
function referenceAttrsOf(node) {
|
|
35
|
+
return {
|
|
36
|
+
target: String(node.attrs.target ?? ""),
|
|
37
|
+
label: String(node.attrs.label ?? "")
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
/** What a chip shows now: the live label and tooltip of its target, or (`gone`) the attrs' cached label when the target no longer exists. */
|
|
41
|
+
function resolveReference(editor, attrs) {
|
|
42
|
+
const found = findBlockById(editor.state.doc, attrs.target);
|
|
43
|
+
if (found?.node.type.name !== "composite") return {
|
|
44
|
+
label: attrs.label,
|
|
45
|
+
title: attrs.label,
|
|
46
|
+
gone: true
|
|
47
|
+
};
|
|
48
|
+
const target = referenceTarget(found.node, compositeKindsOf(editor));
|
|
49
|
+
return {
|
|
50
|
+
label: referenceLabel(target),
|
|
51
|
+
title: referenceTitle(target),
|
|
52
|
+
gone: false
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
//#endregion
|
|
56
|
+
export { referenceAttrsOf, referenceLabel, referenceTarget, referenceTitle, resolveReference };
|
|
57
|
+
|
|
58
|
+
//# sourceMappingURL=reference-label.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reference-label.js","names":[],"sources":["../../../src/features/composites/reference-label.ts"],"sourcesContent":["import type { Editor } from '@tiptap/core'\nimport type { Node as PMNode } from '@tiptap/pm/model'\nimport { findBlockById } from '../../core/schema'\nimport { type CslItem, BIB_KEY, citeFull, citeShort } from './bibliography'\nimport { compositeKind, type CompositeKind } from './kinds'\nimport { compositeKindsOf } from './nodes'\nimport type { ReferenceAttrs } from './reference'\n\n/** What a reference chip shows of its target: the parts of a `CompositeRow`, or of a composite node (`referenceTarget`). */\nexport interface ReferenceTarget {\n meta: Record<string, unknown>\n title: string\n kindLabel: string\n}\n\n/** The Baustein `node` as a reference target. */\nexport function referenceTarget(node: PMNode, kinds: readonly CompositeKind[]): ReferenceTarget {\n return {\n meta: (node.attrs.meta ?? {}) as Record<string, unknown>,\n title: node.childCount > 0 ? node.child(0).textContent.trim() : '',\n kindLabel: compositeKind(kinds, String(node.attrs.kind)).label,\n }\n}\n\nconst bibOfTarget = (target: ReferenceTarget): CslItem | null => {\n const bib = target.meta[BIB_KEY]\n if (!bib || typeof bib !== 'object' || Array.isArray(bib)) return null\n return 'type' in bib && typeof bib.type === 'string' ? bib as CslItem : null\n}\n\n/** The chip text: the short citation (\"Doe et al. 2024\") when the target has bibliographic data, else its title, else its kind's label. */\nexport function referenceLabel(target: ReferenceTarget): string {\n const bib = bibOfTarget(target)\n return bib ? citeShort(bib, target.title) : target.title || target.kindLabel\n}\n\n/** The chip's tooltip: the full citation, else the title. */\nexport function referenceTitle(target: ReferenceTarget): string {\n const bib = bibOfTarget(target)\n return bib ? citeFull({ ...bib, title: target.title }) : target.title || target.kindLabel\n}\n\n/** The attrs of a `reference` node that the label needs, typed (a node's `attrs` is a loose record). */\nexport function referenceAttrsOf(node: PMNode): Pick<ReferenceAttrs, 'target' | 'label'> {\n return { target: String(node.attrs.target ?? ''), label: String(node.attrs.label ?? '') }\n}\n\n/** What a chip shows now: the live label and tooltip of its target, or (`gone`) the attrs' cached label when the target no longer exists. */\nexport function resolveReference(editor: Editor, attrs: Pick<ReferenceAttrs, 'target' | 'label'>): { label: string, title: string, gone: boolean } {\n const found = findBlockById(editor.state.doc, attrs.target)\n if (found?.node.type.name !== 'composite') return { label: attrs.label, title: attrs.label, gone: true }\n const target = referenceTarget(found.node, compositeKindsOf(editor))\n return { label: referenceLabel(target), title: referenceTitle(target), gone: false }\n}\n"],"mappings":";;;;;;;AAgBA,SAAgB,gBAAgB,MAAc,OAAkD;CAC9F,OAAO;EACL,MAAO,KAAK,MAAM,QAAQ,CAAC;EAC3B,OAAO,KAAK,aAAa,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,YAAY,KAAK,IAAI;EAChE,WAAW,cAAc,OAAO,OAAO,KAAK,MAAM,IAAI,CAAC,CAAC,CAAC;CAC3D;AACF;AAEA,MAAM,eAAe,WAA4C;CAC/D,MAAM,MAAM,OAAO,KAAA;CACnB,IAAI,CAAC,OAAO,OAAO,QAAQ,YAAY,MAAM,QAAQ,GAAG,GAAG,OAAO;CAClE,OAAO,UAAU,OAAO,OAAO,IAAI,SAAS,WAAW,MAAiB;AAC1E;;AAGA,SAAgB,eAAe,QAAiC;CAC9D,MAAM,MAAM,YAAY,MAAM;CAC9B,OAAO,MAAM,UAAU,KAAK,OAAO,KAAK,IAAI,OAAO,SAAS,OAAO;AACrE;;AAGA,SAAgB,eAAe,QAAiC;CAC9D,MAAM,MAAM,YAAY,MAAM;CAC9B,OAAO,MAAM,SAAS;EAAE,GAAG;EAAK,OAAO,OAAO;CAAM,CAAC,IAAI,OAAO,SAAS,OAAO;AAClF;;AAGA,SAAgB,iBAAiB,MAAwD;CACvF,OAAO;EAAE,QAAQ,OAAO,KAAK,MAAM,UAAU,EAAE;EAAG,OAAO,OAAO,KAAK,MAAM,SAAS,EAAE;CAAE;AAC1F;;AAGA,SAAgB,iBAAiB,QAAgB,OAAkG;CACjJ,MAAM,QAAQ,cAAc,OAAO,MAAM,KAAK,MAAM,MAAM;CAC1D,IAAI,OAAO,KAAK,KAAK,SAAS,aAAa,OAAO;EAAE,OAAO,MAAM;EAAO,OAAO,MAAM;EAAO,MAAM;CAAK;CACvG,MAAM,SAAS,gBAAgB,MAAM,MAAM,iBAAiB,MAAM,CAAC;CACnE,OAAO;EAAE,OAAO,eAAe,MAAM;EAAG,OAAO,eAAe,MAAM;EAAG,MAAM;CAAM;AACrF"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Translate } from "../../i18n/index.js";
|
|
2
|
+
import { ReferenceOptions } from "./reference.js";
|
|
3
|
+
//#region src/features/composites/reference-suggestion.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* `[@` trigger for ReferenceNode: the Bausteine of the document (with a block ID) whose title, kind or chip label (the
|
|
6
|
+
* short citation) contains the typed query, inserted as a chip that shows the short citation or the title. `t` renders the popup texts in the app's language.
|
|
7
|
+
*/
|
|
8
|
+
export declare const referenceSuggestion: (t: Translate) => NonNullable<ReferenceOptions["suggestion"]>;
|
|
9
|
+
//#endregion
|
|
10
|
+
//# sourceMappingURL=reference-suggestion.d.ts.map
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { ABILITY } from "../../core/schema/abilities.js";
|
|
2
|
+
import { hasAbility } from "../../core/abilities.js";
|
|
3
|
+
import { createSuggestionRender } from "../../core/suggestion-popup.js";
|
|
4
|
+
import { compositeKindsOf } from "./nodes.js";
|
|
5
|
+
import { referenceLabel } from "./reference-label.js";
|
|
6
|
+
import { compositeRows } from "./rows.js";
|
|
7
|
+
//#region src/features/composites/reference-suggestion.ts
|
|
8
|
+
/** Rows of the popup; more would need scrolling past what a citation picker is for, and the query narrows them anyway. */
|
|
9
|
+
const MAX_ITEMS = 20;
|
|
10
|
+
/**
|
|
11
|
+
* `[@` trigger for ReferenceNode: the Bausteine of the document (with a block ID) whose title, kind or chip label (the
|
|
12
|
+
* short citation) contains the typed query, inserted as a chip that shows the short citation or the title. `t` renders the popup texts in the app's language.
|
|
13
|
+
*/
|
|
14
|
+
const referenceSuggestion = (t) => ({
|
|
15
|
+
allow: ({ editor }) => hasAbility(editor, ABILITY.reference),
|
|
16
|
+
items: ({ query, editor }) => {
|
|
17
|
+
const needle = query.trim().toLowerCase();
|
|
18
|
+
return compositeRows(editor.state.doc, compositeKindsOf(editor)).rows.filter((row) => row.id !== null).map((row) => ({
|
|
19
|
+
row,
|
|
20
|
+
label: referenceLabel(row)
|
|
21
|
+
})).filter(({ row, label }) => !needle || [
|
|
22
|
+
label,
|
|
23
|
+
row.title,
|
|
24
|
+
row.kindLabel
|
|
25
|
+
].some((part) => part.toLowerCase().includes(needle))).slice(0, MAX_ITEMS).map(({ row, label }) => ({
|
|
26
|
+
target: row.id,
|
|
27
|
+
documentId: null,
|
|
28
|
+
locator: null,
|
|
29
|
+
label
|
|
30
|
+
}));
|
|
31
|
+
},
|
|
32
|
+
render: createSuggestionRender({
|
|
33
|
+
display: (item) => ({ label: item.label }),
|
|
34
|
+
emptyText: t("composites.reference.empty"),
|
|
35
|
+
loadingText: t("common.loading")
|
|
36
|
+
})
|
|
37
|
+
});
|
|
38
|
+
//#endregion
|
|
39
|
+
export { referenceSuggestion };
|
|
40
|
+
|
|
41
|
+
//# sourceMappingURL=reference-suggestion.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reference-suggestion.js","names":[],"sources":["../../../src/features/composites/reference-suggestion.ts"],"sourcesContent":["import { createSuggestionRender, hasAbility } from '../../core'\nimport { ABILITY } from '../../core/schema'\nimport type { Translate } from '../../i18n'\nimport { compositeKindsOf } from './nodes'\nimport type { ReferenceAttrs, ReferenceOptions } from './reference'\nimport { referenceLabel } from './reference-label'\nimport { compositeRows } from './rows'\n\n/** Rows of the popup; more would need scrolling past what a citation picker is for, and the query narrows them anyway. */\nconst MAX_ITEMS = 20\n\n/**\n * `[@` trigger for ReferenceNode: the Bausteine of the document (with a block ID) whose title, kind or chip label (the\n * short citation) contains the typed query, inserted as a chip that shows the short citation or the title. `t` renders the popup texts in the app's language.\n */\nexport const referenceSuggestion = (t: Translate): NonNullable<ReferenceOptions['suggestion']> => ({\n allow: ({ editor }) => hasAbility(editor, ABILITY.reference),\n items: ({ query, editor }): ReferenceAttrs[] => {\n const needle = query.trim().toLowerCase()\n return compositeRows(editor.state.doc, compositeKindsOf(editor)).rows\n .filter(row => row.id !== null)\n .map(row => ({ row, label: referenceLabel(row) }))\n .filter(({ row, label }) => !needle || [label, row.title, row.kindLabel].some(part => part.toLowerCase().includes(needle)))\n .slice(0, MAX_ITEMS)\n .map(({ row, label }): ReferenceAttrs => ({ target: row.id!, documentId: null, locator: null, label }))\n },\n render: createSuggestionRender<ReferenceAttrs>({\n display: item => ({ label: item.label }),\n emptyText: t('composites.reference.empty'),\n loadingText: t('common.loading'),\n }),\n})\n"],"mappings":";;;;;;;;AASA,MAAM,YAAY;;;;;AAMlB,MAAa,uBAAuB,OAA+D;CACjG,QAAQ,EAAE,aAAa,WAAW,QAAQ,QAAQ,SAAS;CAC3D,QAAQ,EAAE,OAAO,aAA+B;EAC9C,MAAM,SAAS,MAAM,KAAK,CAAC,CAAC,YAAY;EACxC,OAAO,cAAc,OAAO,MAAM,KAAK,iBAAiB,MAAM,CAAC,CAAC,CAAC,KAC9D,QAAO,QAAO,IAAI,OAAO,IAAI,CAAC,CAC9B,KAAI,SAAQ;GAAE;GAAK,OAAO,eAAe,GAAG;EAAE,EAAE,CAAC,CACjD,QAAQ,EAAE,KAAK,YAAY,CAAC,UAAU;GAAC;GAAO,IAAI;GAAO,IAAI;EAAS,CAAC,CAAC,MAAK,SAAQ,KAAK,YAAY,CAAC,CAAC,SAAS,MAAM,CAAC,CAAC,CAAC,CAC1H,MAAM,GAAG,SAAS,CAAC,CACnB,KAAK,EAAE,KAAK,aAA6B;GAAE,QAAQ,IAAI;GAAK,YAAY;GAAM,SAAS;GAAM;EAAM,EAAE;CAC1G;CACA,QAAQ,uBAAuC;EAC7C,UAAS,UAAS,EAAE,OAAO,KAAK,MAAM;EACtC,WAAW,EAAE,4BAA4B;EACzC,aAAa,EAAE,gBAAgB;CACjC,CAAC;AACH"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { JSONContent } from "@tiptap/core";
|
|
2
|
+
import { Node as Node$1 } from "@tiptap/pm/model";
|
|
3
|
+
//#region src/features/composites/reference-text.d.ts
|
|
4
|
+
/** Block IDs of every composite in a TipTap JSON tree, added to `into`. */
|
|
5
|
+
export declare function collectCompositeIds(content: JSONContent | null | undefined, into: Set<string>): Set<string>;
|
|
6
|
+
/**
|
|
7
|
+
* Turns `[@<id>]` / `[@<id>, <locator>]` tokens in text nodes into `reference` nodes (attrs target, locator, empty
|
|
8
|
+
* `label`: the node view resolves the live label) — for imported and AI-generated Markdown, whose parser keeps the
|
|
9
|
+
* token as text. Only ids in `ids` (the Bausteine of the document) match; unknown ids and text in code blocks, inline
|
|
10
|
+
* code or links stay plain. Returns the input unchanged when nothing matched.
|
|
11
|
+
*/
|
|
12
|
+
export declare function referencesFromText(json: JSONContent, ids: ReadonlySet<string>): JSONContent;
|
|
13
|
+
/** Block IDs of the composites of `doc`: the Bausteine a `[@id]` text may point at. */
|
|
14
|
+
export declare function compositeIdsOf(doc: Node$1): Set<string>;
|
|
15
|
+
/** The `normalize` stage: the composites of the document (`current`) and of `blocks` themselves may be referenced by text. */
|
|
16
|
+
export declare function normalizeReferences(blocks: JSONContent[], current: ReadonlySet<string>): JSONContent[];
|
|
17
|
+
//#endregion
|
|
18
|
+
//# sourceMappingURL=reference-text.d.ts.map
|