@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,33 @@
|
|
|
1
|
+
import { Translate } from "../../i18n/index.js";
|
|
2
|
+
import { CSL_TYPES, CslDate, CslItem, CslName, CslType } from "../../core/backend-types.js";
|
|
3
|
+
import { BIB_KEY } from "./meta-keys.js";
|
|
4
|
+
import { Node } from "@tiptap/pm/model";
|
|
5
|
+
//#region src/features/composites/bibliography.d.ts
|
|
6
|
+
/** The select options of the CSL types, labelled through `t`. */
|
|
7
|
+
export declare function cslTypeOptions(t: Translate): {
|
|
8
|
+
value: CslType;
|
|
9
|
+
label: string;
|
|
10
|
+
}[];
|
|
11
|
+
/** The bibliographic data of the composite `node` (`meta.bib` when an object with a string `type`), else `null`. */
|
|
12
|
+
export declare function bibOf(node: Node): CslItem | null;
|
|
13
|
+
/** The full CSL-JSON item of the composite `node`: its `bib` plus the block id and the title (first child). */
|
|
14
|
+
export declare function cslOf(node: Node): (CslItem & {
|
|
15
|
+
id: string;
|
|
16
|
+
title: string;
|
|
17
|
+
}) | null;
|
|
18
|
+
/** The year of the first date part of `issued`, or `null`. */
|
|
19
|
+
export declare function yearOf(csl: Pick<CslItem, 'issued'>): number | null;
|
|
20
|
+
/** "Doe 2024", "Doe & Roe 2024", "Doe et al. 2024"; without authors the first 40 characters of `title`; without a year no year. */
|
|
21
|
+
export declare function citeShort(csl: Pick<CslItem, 'author' | 'issued'>, title: string): string;
|
|
22
|
+
/** An APA-like reference: "Doe, J., Roe, R. (2024). Title. Journal, 12(3), 45–67. https://doi.org/…"; empty parts are left out. */
|
|
23
|
+
export declare function citeFull(csl: CslItem & {
|
|
24
|
+
title: string;
|
|
25
|
+
}): string;
|
|
26
|
+
/** The item as one BibTeX entry (`@article{doe2024title, … }`), one field per line; empty fields are left out. */
|
|
27
|
+
export declare function bibtexOf(csl: CslItem & {
|
|
28
|
+
id: string;
|
|
29
|
+
title: string;
|
|
30
|
+
}): string;
|
|
31
|
+
//#endregion
|
|
32
|
+
export { BIB_KEY, CSL_TYPES, type CslDate, type CslItem, type CslName, type CslType };
|
|
33
|
+
//# sourceMappingURL=bibliography.d.ts.map
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { blockIdOf } from "../../core/schema/block-ids.js";
|
|
2
|
+
import { BIB_KEY } from "./meta-keys.js";
|
|
3
|
+
import { CSL_TYPES } from "../../core/backend-types.js";
|
|
4
|
+
//#region src/features/composites/bibliography.ts
|
|
5
|
+
/** The select options of the CSL types, labelled through `t`. */
|
|
6
|
+
function cslTypeOptions(t) {
|
|
7
|
+
return CSL_TYPES.map((value) => ({
|
|
8
|
+
value,
|
|
9
|
+
label: t(`composites.bib.type.${value}`)
|
|
10
|
+
}));
|
|
11
|
+
}
|
|
12
|
+
/** The bibliographic data of the composite `node` (`meta.bib` when an object with a string `type`), else `null`. */
|
|
13
|
+
function bibOf(node) {
|
|
14
|
+
const bib = node.attrs.meta?.["bib"];
|
|
15
|
+
if (!bib || typeof bib !== "object" || Array.isArray(bib)) return null;
|
|
16
|
+
return "type" in bib && typeof bib.type === "string" ? bib : null;
|
|
17
|
+
}
|
|
18
|
+
/** The full CSL-JSON item of the composite `node`: its `bib` plus the block id and the title (first child). */
|
|
19
|
+
function cslOf(node) {
|
|
20
|
+
const bib = bibOf(node);
|
|
21
|
+
if (!bib) return null;
|
|
22
|
+
return {
|
|
23
|
+
...bib,
|
|
24
|
+
id: blockIdOf(node) ?? "",
|
|
25
|
+
title: node.childCount > 0 ? node.child(0).textContent : ""
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
/** The year of the first date part of `issued`, or `null`. */
|
|
29
|
+
function yearOf(csl) {
|
|
30
|
+
const year = csl.issued?.["date-parts"]?.[0]?.[0];
|
|
31
|
+
return typeof year === "number" && Number.isFinite(year) ? year : null;
|
|
32
|
+
}
|
|
33
|
+
const familyOf = (name) => (name.family ?? name.literal ?? "").trim();
|
|
34
|
+
const SHORT_TITLE_LENGTH = 40;
|
|
35
|
+
/** "Doe 2024", "Doe & Roe 2024", "Doe et al. 2024"; without authors the first 40 characters of `title`; without a year no year. */
|
|
36
|
+
function citeShort(csl, title) {
|
|
37
|
+
const families = (csl.author ?? []).map(familyOf).filter(Boolean);
|
|
38
|
+
const who = families.length === 0 ? title.trim().slice(0, SHORT_TITLE_LENGTH) : families.length === 1 ? families[0] : families.length === 2 ? `${families[0]} & ${families[1]}` : `${families[0]} et al.`;
|
|
39
|
+
const year = yearOf(csl);
|
|
40
|
+
return year === null ? who : `${who} ${year}`.trim();
|
|
41
|
+
}
|
|
42
|
+
const initialsOf = (given) => given.split(/[\s-]+/).filter(Boolean).map((word) => `${[...word][0].toUpperCase()}.`).join(" ");
|
|
43
|
+
function apaName(name) {
|
|
44
|
+
const family = (name.family ?? "").trim();
|
|
45
|
+
if (!family) return (name.literal ?? "").trim();
|
|
46
|
+
const initials = initialsOf((name.given ?? "").trim());
|
|
47
|
+
return initials ? `${family}, ${initials}` : family;
|
|
48
|
+
}
|
|
49
|
+
const withStop = (text) => /[.!?]$/.test(text) ? text : `${text}.`;
|
|
50
|
+
/** An APA-like reference: "Doe, J., Roe, R. (2024). Title. Journal, 12(3), 45–67. https://doi.org/…"; empty parts are left out. */
|
|
51
|
+
function citeFull(csl) {
|
|
52
|
+
const authors = (csl.author ?? []).map(apaName).filter(Boolean).join(", ");
|
|
53
|
+
const year = yearOf(csl);
|
|
54
|
+
const head = [authors, year === null ? "" : `(${year})`].filter(Boolean).join(" ");
|
|
55
|
+
const volume = [csl.volume, csl.issue ? `(${csl.issue})` : ""].filter(Boolean).join("");
|
|
56
|
+
const container = [
|
|
57
|
+
csl["container-title"],
|
|
58
|
+
volume,
|
|
59
|
+
csl.page
|
|
60
|
+
].map((part) => part?.trim()).filter(Boolean).join(", ");
|
|
61
|
+
const doi = csl.DOI?.trim();
|
|
62
|
+
const link = doi ? /^https?:\/\//i.test(doi) ? doi : `https://doi.org/${doi}` : csl.URL?.trim();
|
|
63
|
+
const publisher = [csl["publisher-place"], csl.publisher].map((part) => part?.trim()).filter(Boolean).join(": ");
|
|
64
|
+
return [
|
|
65
|
+
head && withStop(head),
|
|
66
|
+
csl.title.trim() && withStop(csl.title.trim()),
|
|
67
|
+
container && withStop(container),
|
|
68
|
+
!container && publisher && withStop(publisher),
|
|
69
|
+
link
|
|
70
|
+
].filter(Boolean).join(" ");
|
|
71
|
+
}
|
|
72
|
+
const BIBTEX_ENTRY = {
|
|
73
|
+
"article-journal": "article",
|
|
74
|
+
book: "book",
|
|
75
|
+
chapter: "incollection",
|
|
76
|
+
"paper-conference": "inproceedings",
|
|
77
|
+
thesis: "phdthesis",
|
|
78
|
+
report: "techreport"
|
|
79
|
+
};
|
|
80
|
+
/** Lowercase ASCII letters and digits of `text`: diacritics folded, everything else dropped. */
|
|
81
|
+
const asciiKey = (text) => text.normalize("NFD").replace(/\p{M}/gu, "").toLowerCase().replace(/[^a-z0-9]/g, "");
|
|
82
|
+
const bibtexName = (name) => {
|
|
83
|
+
const family = (name.family ?? "").trim();
|
|
84
|
+
if (!family) return (name.literal ?? "").trim();
|
|
85
|
+
const given = (name.given ?? "").trim();
|
|
86
|
+
return given ? `${family}, ${given}` : family;
|
|
87
|
+
};
|
|
88
|
+
/** The citation key: first author's family name + year + first title word (all lowercase ASCII). */
|
|
89
|
+
function bibtexKey(csl) {
|
|
90
|
+
const first = csl.author?.[0];
|
|
91
|
+
const family = first ? asciiKey(familyOf(first)) : "";
|
|
92
|
+
const year = yearOf(csl);
|
|
93
|
+
const word = asciiKey(csl.title.trim().split(/\s+/)[0] ?? "");
|
|
94
|
+
return `${family}${year ?? ""}${word}` || asciiKey(csl.id) || "ref";
|
|
95
|
+
}
|
|
96
|
+
/** The item as one BibTeX entry (`@article{doe2024title, … }`), one field per line; empty fields are left out. */
|
|
97
|
+
function bibtexOf(csl) {
|
|
98
|
+
const entry = BIBTEX_ENTRY[csl.type] ?? "misc";
|
|
99
|
+
const container = csl["container-title"]?.trim();
|
|
100
|
+
const lines = [
|
|
101
|
+
["title", csl.title.trim()],
|
|
102
|
+
["author", (csl.author ?? []).map(bibtexName).filter(Boolean).join(" and ")],
|
|
103
|
+
["year", yearOf(csl)?.toString()],
|
|
104
|
+
["journal", entry === "article" ? container : void 0],
|
|
105
|
+
["booktitle", entry === "incollection" || entry === "inproceedings" ? container : void 0],
|
|
106
|
+
["volume", csl.volume?.trim()],
|
|
107
|
+
["number", csl.issue?.trim()],
|
|
108
|
+
["pages", csl.page?.trim().replace(/\s*[-–—]+\s*/g, "--")],
|
|
109
|
+
[entry === "phdthesis" ? "school" : entry === "techreport" ? "institution" : "publisher", csl.publisher?.trim()],
|
|
110
|
+
["address", csl["publisher-place"]?.trim()],
|
|
111
|
+
["doi", csl.DOI?.trim()],
|
|
112
|
+
["isbn", csl.ISBN?.trim()],
|
|
113
|
+
["url", csl.URL?.trim()]
|
|
114
|
+
].filter(([, value]) => value).map(([name, value]) => ` ${name} = {${value}},`);
|
|
115
|
+
return `@${entry}{${bibtexKey(csl)},\n${lines.join("\n")}\n}\n`;
|
|
116
|
+
}
|
|
117
|
+
//#endregion
|
|
118
|
+
export { BIB_KEY, CSL_TYPES, bibOf, bibtexOf, citeFull, citeShort, cslOf, cslTypeOptions, yearOf };
|
|
119
|
+
|
|
120
|
+
//# sourceMappingURL=bibliography.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bibliography.js","names":[],"sources":["../../../src/features/composites/bibliography.ts"],"sourcesContent":["// Vue-free and server-importable: bibliographic data of a composite („Baustein“) as CSL-JSON in `meta.bib`, and its citation and BibTeX renderings.\nimport type { Node as PMNode } from '@tiptap/pm/model'\nimport { blockIdOf } from '../../core/schema/block-ids'\nimport type { MessageKey, Translate } from '../../i18n'\nimport { CSL_TYPES, type CslItem, type CslName, type CslType } from '../../core/backend-types'\nimport { BIB_KEY } from './meta-keys'\n\n// The CSL types live in `core/backend-types.ts` (the `ai.extract` wire type names them); this module is their feature-side entry.\nexport { CSL_TYPES, type CslDate, type CslItem, type CslName, type CslType } from '../../core/backend-types'\n\nexport { BIB_KEY }\n\n/** The select options of the CSL types, labelled through `t`. */\nexport function cslTypeOptions(t: Translate): { value: CslType, label: string }[] {\n return CSL_TYPES.map(value => ({ value, label: t(`composites.bib.type.${value}` as MessageKey) }))\n}\n\n/** The bibliographic data of the composite `node` (`meta.bib` when an object with a string `type`), else `null`. */\nexport function bibOf(node: PMNode): CslItem | null {\n const bib: unknown = node.attrs.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 full CSL-JSON item of the composite `node`: its `bib` plus the block id and the title (first child). */\nexport function cslOf(node: PMNode): (CslItem & { id: string, title: string }) | null {\n const bib = bibOf(node)\n if (!bib) return null\n return { ...bib, id: blockIdOf(node) ?? '', title: node.childCount > 0 ? node.child(0).textContent : '' }\n}\n\n/** The year of the first date part of `issued`, or `null`. */\nexport function yearOf(csl: Pick<CslItem, 'issued'>): number | null {\n const year = csl.issued?.['date-parts']?.[0]?.[0]\n return typeof year === 'number' && Number.isFinite(year) ? year : null\n}\n\nconst familyOf = (name: CslName): string => (name.family ?? name.literal ?? '').trim()\n\nconst SHORT_TITLE_LENGTH = 40\n\n/** \"Doe 2024\", \"Doe & Roe 2024\", \"Doe et al. 2024\"; without authors the first 40 characters of `title`; without a year no year. */\nexport function citeShort(csl: Pick<CslItem, 'author' | 'issued'>, title: string): string {\n const families = (csl.author ?? []).map(familyOf).filter(Boolean)\n const who = families.length === 0\n ? title.trim().slice(0, SHORT_TITLE_LENGTH)\n : families.length === 1\n ? families[0]!\n : families.length === 2 ? `${families[0]} & ${families[1]}` : `${families[0]} et al.`\n const year = yearOf(csl)\n return year === null ? who : `${who} ${year}`.trim()\n}\n\nconst initialsOf = (given: string): string => given.split(/[\\s-]+/).filter(Boolean).map(word => `${[...word][0]!.toUpperCase()}.`).join(' ')\n\nfunction apaName(name: CslName): string {\n const family = (name.family ?? '').trim()\n if (!family) return (name.literal ?? '').trim()\n const initials = initialsOf((name.given ?? '').trim())\n return initials ? `${family}, ${initials}` : family\n}\n\nconst withStop = (text: string): string => /[.!?]$/.test(text) ? text : `${text}.`\n\n/** An APA-like reference: \"Doe, J., Roe, R. (2024). Title. Journal, 12(3), 45–67. https://doi.org/…\"; empty parts are left out. */\nexport function citeFull(csl: CslItem & { title: string }): string {\n const authors = (csl.author ?? []).map(apaName).filter(Boolean).join(', ')\n const year = yearOf(csl)\n const head = [authors, year === null ? '' : `(${year})`].filter(Boolean).join(' ')\n const volume = [csl.volume, csl.issue ? `(${csl.issue})` : ''].filter(Boolean).join('')\n const container = [csl['container-title'], volume, csl.page].map(part => part?.trim()).filter(Boolean).join(', ')\n const doi = csl.DOI?.trim()\n const link = doi ? (/^https?:\\/\\//i.test(doi) ? doi : `https://doi.org/${doi}`) : csl.URL?.trim()\n const publisher = [csl['publisher-place'], csl.publisher].map(part => part?.trim()).filter(Boolean).join(': ')\n return [\n head && withStop(head),\n csl.title.trim() && withStop(csl.title.trim()),\n container && withStop(container),\n // A book or report is located by its publisher; a journal article by its container.\n !container && publisher && withStop(publisher),\n link,\n ].filter(Boolean).join(' ')\n}\n\nconst BIBTEX_ENTRY: Partial<Record<CslType, string>> = {\n 'article-journal': 'article',\n book: 'book',\n chapter: 'incollection',\n 'paper-conference': 'inproceedings',\n thesis: 'phdthesis',\n report: 'techreport',\n}\n\n/** Lowercase ASCII letters and digits of `text`: diacritics folded, everything else dropped. */\nconst asciiKey = (text: string): string => text.normalize('NFD').replace(/\\p{M}/gu, '').toLowerCase().replace(/[^a-z0-9]/g, '')\n\nconst bibtexName = (name: CslName): string => {\n const family = (name.family ?? '').trim()\n if (!family) return (name.literal ?? '').trim()\n const given = (name.given ?? '').trim()\n return given ? `${family}, ${given}` : family\n}\n\n/** The citation key: first author's family name + year + first title word (all lowercase ASCII). */\nfunction bibtexKey(csl: CslItem & { id: string, title: string }): string {\n const first = csl.author?.[0]\n const family = first ? asciiKey(familyOf(first)) : ''\n const year = yearOf(csl)\n const word = asciiKey(csl.title.trim().split(/\\s+/)[0] ?? '')\n return `${family}${year ?? ''}${word}` || asciiKey(csl.id) || 'ref'\n}\n\n/** The item as one BibTeX entry (`@article{doe2024title, … }`), one field per line; empty fields are left out. */\nexport function bibtexOf(csl: CslItem & { id: string, title: string }): string {\n const entry = BIBTEX_ENTRY[csl.type] ?? 'misc'\n const container = csl['container-title']?.trim()\n const fields: [string, string | undefined][] = [\n ['title', csl.title.trim()],\n ['author', (csl.author ?? []).map(bibtexName).filter(Boolean).join(' and ')],\n ['year', yearOf(csl)?.toString()],\n ['journal', entry === 'article' ? container : undefined],\n ['booktitle', entry === 'incollection' || entry === 'inproceedings' ? container : undefined],\n ['volume', csl.volume?.trim()],\n ['number', csl.issue?.trim()],\n ['pages', csl.page?.trim().replace(/\\s*[-–—]+\\s*/g, '--')],\n [entry === 'phdthesis' ? 'school' : entry === 'techreport' ? 'institution' : 'publisher', csl.publisher?.trim()],\n ['address', csl['publisher-place']?.trim()],\n ['doi', csl.DOI?.trim()],\n ['isbn', csl.ISBN?.trim()],\n ['url', csl.URL?.trim()],\n ]\n const lines = fields.filter(([, value]) => value).map(([name, value]) => ` ${name} = {${value}},`)\n return `@${entry}{${bibtexKey(csl)},\\n${lines.join('\\n')}\\n}\\n`\n}\n"],"mappings":";;;;;AAaA,SAAgB,eAAe,GAAmD;CAChF,OAAO,UAAU,KAAI,WAAU;EAAE;EAAO,OAAO,EAAE,uBAAuB,OAAqB;CAAE,EAAE;AACnG;;AAGA,SAAgB,MAAM,MAA8B;CAClD,MAAM,MAAe,KAAK,MAAM,OAAA;CAChC,IAAI,CAAC,OAAO,OAAO,QAAQ,YAAY,MAAM,QAAQ,GAAG,GAAG,OAAO;CAClE,OAAO,UAAU,OAAO,OAAO,IAAI,SAAS,WAAW,MAAiB;AAC1E;;AAGA,SAAgB,MAAM,MAAgE;CACpF,MAAM,MAAM,MAAM,IAAI;CACtB,IAAI,CAAC,KAAK,OAAO;CACjB,OAAO;EAAE,GAAG;EAAK,IAAI,UAAU,IAAI,KAAK;EAAI,OAAO,KAAK,aAAa,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,cAAc;CAAG;AAC1G;;AAGA,SAAgB,OAAO,KAA6C;CAClE,MAAM,OAAO,IAAI,SAAS,aAAa,GAAG,EAAE,GAAG;CAC/C,OAAO,OAAO,SAAS,YAAY,OAAO,SAAS,IAAI,IAAI,OAAO;AACpE;AAEA,MAAM,YAAY,UAA2B,KAAK,UAAU,KAAK,WAAW,GAAA,CAAI,KAAK;AAErF,MAAM,qBAAqB;;AAG3B,SAAgB,UAAU,KAAyC,OAAuB;CACxF,MAA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AAI,MAAM,GAAG,UAAU,GAAG,EAAE,KAAK,MAAM,KAAK,IAAI,EAAE;AAC3D"}
|
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
import { bibtexOf, cslOf, cslTypeOptions } from "../bibliography.js";
|
|
2
|
+
import { useUiKit } from "../../../vue/kit/use-ui-kit.js";
|
|
3
|
+
import { useEditorI18n } from "../../../vue/use-editor-i18n.js";
|
|
4
|
+
import { compositeOfRow, setCompositeMetaField } from "../rows.js";
|
|
5
|
+
import { bibFormOf, bibItemOf } from "../bibliography-form.js";
|
|
6
|
+
import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createVNode, defineComponent, onBeforeUnmount, openBlock, reactive, ref, renderList, unref, watch, withKeys } from "vue";
|
|
7
|
+
//#region src/features/composites/components/BibliographyEditor.vue
|
|
8
|
+
const _hoisted_1 = { class: "flex flex-col gap-1.5" };
|
|
9
|
+
const _hoisted_2 = { class: "grid grid-cols-4 gap-1.5" };
|
|
10
|
+
const _hoisted_3 = { class: "flex justify-end gap-1.5" };
|
|
11
|
+
/**
|
|
12
|
+
* The structured editor of a `bibliography` field (CSL-JSON item, `meta.bib`): type, authors, year, container, volume,
|
|
13
|
+
* issue, pages, publisher, DOI, ISBN, URL and abstract. Inputs keep a local draft; every commit (blur, Enter, choosing
|
|
14
|
+
* a type, unmount) writes the whole item through `setCompositeMetaField`. The title is the Baustein's and never stored.
|
|
15
|
+
*/
|
|
16
|
+
const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
17
|
+
__name: "BibliographyEditor",
|
|
18
|
+
props: {
|
|
19
|
+
editor: {},
|
|
20
|
+
row: {},
|
|
21
|
+
field: {},
|
|
22
|
+
disabled: { type: Boolean }
|
|
23
|
+
},
|
|
24
|
+
setup(__props) {
|
|
25
|
+
const props = __props;
|
|
26
|
+
const { Button: UButton, Input: UInput, Select: USelect, Textarea: UTextarea } = useUiKit();
|
|
27
|
+
const { t } = useEditorI18n();
|
|
28
|
+
const stored = computed(() => {
|
|
29
|
+
const value = props.row.meta[props.field.key];
|
|
30
|
+
return value && typeof value === "object" && typeof value.type === "string" ? value : null;
|
|
31
|
+
});
|
|
32
|
+
const typeItems = computed(() => cslTypeOptions(t));
|
|
33
|
+
const form = reactive(bibFormOf(stored.value));
|
|
34
|
+
let dirty = false;
|
|
35
|
+
let target = null;
|
|
36
|
+
watch(() => props.row.key, () => {
|
|
37
|
+
commit();
|
|
38
|
+
Object.assign(form, bibFormOf(stored.value));
|
|
39
|
+
});
|
|
40
|
+
watch(stored, (value) => {
|
|
41
|
+
if (!dirty) Object.assign(form, bibFormOf(value));
|
|
42
|
+
});
|
|
43
|
+
function commit() {
|
|
44
|
+
if (!dirty || !target) return;
|
|
45
|
+
dirty = false;
|
|
46
|
+
const { row, field, stored: base } = target;
|
|
47
|
+
target = null;
|
|
48
|
+
const same = row.key === props.row.key;
|
|
49
|
+
if (!props.editor.isDestroyed) setCompositeMetaField(props.editor, same ? props.row : row, field.key, bibItemOf(form, same ? stored.value : base));
|
|
50
|
+
}
|
|
51
|
+
function markDirty() {
|
|
52
|
+
if (!dirty) target = {
|
|
53
|
+
row: props.row,
|
|
54
|
+
field: props.field,
|
|
55
|
+
stored: stored.value
|
|
56
|
+
};
|
|
57
|
+
dirty = true;
|
|
58
|
+
}
|
|
59
|
+
function onInput(key, value) {
|
|
60
|
+
form[key] = typeof value === "string" ? value : "";
|
|
61
|
+
markDirty();
|
|
62
|
+
}
|
|
63
|
+
function onType(value) {
|
|
64
|
+
if (typeof value !== "string") return;
|
|
65
|
+
form.type = value;
|
|
66
|
+
markDirty();
|
|
67
|
+
commit();
|
|
68
|
+
}
|
|
69
|
+
onBeforeUnmount(commit);
|
|
70
|
+
const copied = ref(false);
|
|
71
|
+
let copiedTimer;
|
|
72
|
+
onBeforeUnmount(() => clearTimeout(copiedTimer));
|
|
73
|
+
async function copyBibtex() {
|
|
74
|
+
commit();
|
|
75
|
+
const node = compositeOfRow(props.editor.state.doc, props.row)?.node;
|
|
76
|
+
const csl = node && cslOf(node);
|
|
77
|
+
if (!csl) return;
|
|
78
|
+
await navigator.clipboard.writeText(bibtexOf(csl));
|
|
79
|
+
copied.value = true;
|
|
80
|
+
clearTimeout(copiedTimer);
|
|
81
|
+
copiedTimer = setTimeout(() => {
|
|
82
|
+
copied.value = false;
|
|
83
|
+
}, 1500);
|
|
84
|
+
}
|
|
85
|
+
const canFetch = typeof props.editor.commands.fetchCompositeBibliography === "function";
|
|
86
|
+
const hasDoi = computed(() => form.doi.trim() !== "" || typeof props.row.meta.doi === "string" && props.row.meta.doi.trim() !== "");
|
|
87
|
+
function fetchByDoi() {
|
|
88
|
+
commit();
|
|
89
|
+
const found = compositeOfRow(props.editor.state.doc, props.row);
|
|
90
|
+
if (found) props.editor.commands.fetchCompositeBibliography(found.pos);
|
|
91
|
+
}
|
|
92
|
+
const inputs = [
|
|
93
|
+
{
|
|
94
|
+
key: "containerTitle",
|
|
95
|
+
labelKey: "composites.bib.field.containerTitle"
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
key: "publisher",
|
|
99
|
+
labelKey: "composites.bib.field.publisher"
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
key: "doi",
|
|
103
|
+
labelKey: "composites.bib.field.doi"
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
key: "isbn",
|
|
107
|
+
labelKey: "composites.bib.field.isbn"
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
key: "url",
|
|
111
|
+
labelKey: "composites.bib.field.url"
|
|
112
|
+
}
|
|
113
|
+
];
|
|
114
|
+
const numbers = [
|
|
115
|
+
{
|
|
116
|
+
key: "volume",
|
|
117
|
+
labelKey: "composites.bib.field.volume"
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
key: "issue",
|
|
121
|
+
labelKey: "composites.bib.field.issue"
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
key: "page",
|
|
125
|
+
labelKey: "composites.bib.field.page"
|
|
126
|
+
}
|
|
127
|
+
];
|
|
128
|
+
return (_ctx, _cache) => {
|
|
129
|
+
return openBlock(), createElementBlock("div", _hoisted_1, [
|
|
130
|
+
createVNode(unref(USelect), {
|
|
131
|
+
"model-value": form.type,
|
|
132
|
+
items: typeItems.value,
|
|
133
|
+
"aria-label": unref(t)("composites.bib.field.type"),
|
|
134
|
+
disabled: __props.disabled,
|
|
135
|
+
size: "xs",
|
|
136
|
+
class: "w-full",
|
|
137
|
+
"onUpdate:modelValue": onType
|
|
138
|
+
}, null, 8, [
|
|
139
|
+
"model-value",
|
|
140
|
+
"items",
|
|
141
|
+
"aria-label",
|
|
142
|
+
"disabled"
|
|
143
|
+
]),
|
|
144
|
+
createVNode(unref(UTextarea), {
|
|
145
|
+
"model-value": form.authors,
|
|
146
|
+
placeholder: unref(t)("composites.bib.field.authorsHelp"),
|
|
147
|
+
"aria-label": unref(t)("composites.bib.field.authors"),
|
|
148
|
+
disabled: __props.disabled,
|
|
149
|
+
size: "xs",
|
|
150
|
+
autoresize: "",
|
|
151
|
+
rows: 2,
|
|
152
|
+
maxrows: 6,
|
|
153
|
+
class: "w-full",
|
|
154
|
+
onBlur: commit,
|
|
155
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = (value) => onInput("authors", value))
|
|
156
|
+
}, null, 8, [
|
|
157
|
+
"model-value",
|
|
158
|
+
"placeholder",
|
|
159
|
+
"aria-label",
|
|
160
|
+
"disabled"
|
|
161
|
+
]),
|
|
162
|
+
createElementVNode("div", _hoisted_2, [createVNode(unref(UInput), {
|
|
163
|
+
"model-value": form.year,
|
|
164
|
+
type: "number",
|
|
165
|
+
placeholder: unref(t)("composites.bib.field.year"),
|
|
166
|
+
"aria-label": unref(t)("composites.bib.field.year"),
|
|
167
|
+
disabled: __props.disabled,
|
|
168
|
+
size: "xs",
|
|
169
|
+
class: "col-span-1 w-full",
|
|
170
|
+
onBlur: commit,
|
|
171
|
+
onKeydown: withKeys(commit, ["enter"]),
|
|
172
|
+
"onUpdate:modelValue": _cache[1] || (_cache[1] = (value) => onInput("year", value))
|
|
173
|
+
}, null, 8, [
|
|
174
|
+
"model-value",
|
|
175
|
+
"placeholder",
|
|
176
|
+
"aria-label",
|
|
177
|
+
"disabled"
|
|
178
|
+
]), (openBlock(), createElementBlock(Fragment, null, renderList(numbers, (input) => {
|
|
179
|
+
return createVNode(unref(UInput), {
|
|
180
|
+
key: input.key,
|
|
181
|
+
"model-value": form[input.key],
|
|
182
|
+
placeholder: unref(t)(input.labelKey),
|
|
183
|
+
"aria-label": unref(t)(input.labelKey),
|
|
184
|
+
disabled: __props.disabled,
|
|
185
|
+
size: "xs",
|
|
186
|
+
class: "col-span-1 w-full",
|
|
187
|
+
onBlur: commit,
|
|
188
|
+
onKeydown: withKeys(commit, ["enter"]),
|
|
189
|
+
"onUpdate:modelValue": (value) => onInput(input.key, value)
|
|
190
|
+
}, null, 8, [
|
|
191
|
+
"model-value",
|
|
192
|
+
"placeholder",
|
|
193
|
+
"aria-label",
|
|
194
|
+
"disabled",
|
|
195
|
+
"onUpdate:modelValue"
|
|
196
|
+
]);
|
|
197
|
+
}), 64))]),
|
|
198
|
+
(openBlock(), createElementBlock(Fragment, null, renderList(inputs, (input) => {
|
|
199
|
+
return createVNode(unref(UInput), {
|
|
200
|
+
key: input.key,
|
|
201
|
+
"model-value": form[input.key],
|
|
202
|
+
placeholder: unref(t)(input.labelKey),
|
|
203
|
+
"aria-label": unref(t)(input.labelKey),
|
|
204
|
+
disabled: __props.disabled,
|
|
205
|
+
size: "xs",
|
|
206
|
+
class: "w-full",
|
|
207
|
+
onBlur: commit,
|
|
208
|
+
onKeydown: withKeys(commit, ["enter"]),
|
|
209
|
+
"onUpdate:modelValue": (value) => onInput(input.key, value)
|
|
210
|
+
}, null, 8, [
|
|
211
|
+
"model-value",
|
|
212
|
+
"placeholder",
|
|
213
|
+
"aria-label",
|
|
214
|
+
"disabled",
|
|
215
|
+
"onUpdate:modelValue"
|
|
216
|
+
]);
|
|
217
|
+
}), 64)),
|
|
218
|
+
createVNode(unref(UTextarea), {
|
|
219
|
+
"model-value": form.abstract,
|
|
220
|
+
placeholder: unref(t)("composites.bib.field.abstract"),
|
|
221
|
+
"aria-label": unref(t)("composites.bib.field.abstract"),
|
|
222
|
+
disabled: __props.disabled,
|
|
223
|
+
size: "xs",
|
|
224
|
+
autoresize: "",
|
|
225
|
+
rows: 2,
|
|
226
|
+
maxrows: 6,
|
|
227
|
+
class: "w-full",
|
|
228
|
+
onBlur: commit,
|
|
229
|
+
"onUpdate:modelValue": _cache[2] || (_cache[2] = (value) => onInput("abstract", value))
|
|
230
|
+
}, null, 8, [
|
|
231
|
+
"model-value",
|
|
232
|
+
"placeholder",
|
|
233
|
+
"aria-label",
|
|
234
|
+
"disabled"
|
|
235
|
+
]),
|
|
236
|
+
createElementVNode("div", _hoisted_3, [canFetch ? (openBlock(), createBlock(unref(UButton), {
|
|
237
|
+
key: 0,
|
|
238
|
+
size: "xs",
|
|
239
|
+
color: "neutral",
|
|
240
|
+
variant: "ghost",
|
|
241
|
+
icon: "i-lucide-book-marked",
|
|
242
|
+
label: unref(t)("composites.bib.fetchDoi"),
|
|
243
|
+
disabled: __props.disabled || !hasDoi.value,
|
|
244
|
+
onClick: fetchByDoi
|
|
245
|
+
}, null, 8, ["label", "disabled"])) : createCommentVNode("v-if", true), createVNode(unref(UButton), {
|
|
246
|
+
size: "xs",
|
|
247
|
+
color: "neutral",
|
|
248
|
+
variant: "ghost",
|
|
249
|
+
icon: "i-lucide-copy",
|
|
250
|
+
label: copied.value ? unref(t)("composites.bib.copied") : unref(t)("composites.bib.copyBibtex"),
|
|
251
|
+
disabled: !stored.value,
|
|
252
|
+
onClick: copyBibtex
|
|
253
|
+
}, null, 8, ["label", "disabled"])])
|
|
254
|
+
]);
|
|
255
|
+
};
|
|
256
|
+
}
|
|
257
|
+
});
|
|
258
|
+
//#endregion
|
|
259
|
+
export { _sfc_main as default };
|
|
260
|
+
|
|
261
|
+
//# sourceMappingURL=BibliographyEditor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BibliographyEditor.js","names":["_openBlock","_createElementBlock","_createVNode","_unref","_createElementVNode","_withKeys","_Fragment","_renderList","_createBlock","_createCommentVNode"],"sources":["../../../../src/features/composites/components/BibliographyEditor.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { Editor } from '@tiptap/core'\nimport { computed, onBeforeUnmount, reactive, ref, watch } from 'vue'\nimport { useUiKit } from '../../../vue/kit/use-ui-kit'\nimport { useEditorI18n } from '../../../vue/use-editor-i18n'\nimport { type CslItem, bibtexOf, cslOf, cslTypeOptions, type CslType } from '../bibliography'\nimport { type BibForm, bibFormOf, bibItemOf } from '../bibliography-form'\nimport type { CompositeMetaField } from '../kinds'\nimport { compositeOfRow, type CompositeRow, setCompositeMetaField } from '../rows'\nimport '../bibliography-command'\n\n/**\n * The structured editor of a `bibliography` field (CSL-JSON item, `meta.bib`): type, authors, year, container, volume,\n * issue, pages, publisher, DOI, ISBN, URL and abstract. Inputs keep a local draft; every commit (blur, Enter, choosing\n * a type, unmount) writes the whole item through `setCompositeMetaField`. The title is the Baustein's and never stored.\n */\nconst props = defineProps<{\n editor: Editor\n row: CompositeRow\n field: CompositeMetaField\n disabled?: boolean\n}>()\n\nconst { Button: UButton, Input: UInput, Select: USelect, Textarea: UTextarea } = useUiKit()\nconst { t } = useEditorI18n()\n\nconst stored = computed<CslItem | null>(() => {\n const value = props.row.meta[props.field.key] as Partial<CslItem> | null | undefined\n return value && typeof value === 'object' && typeof value.type === 'string' ? value as CslItem : null\n})\nconst typeItems = computed(() => cslTypeOptions(t))\n\nconst form = reactive<BibForm>(bibFormOf(stored.value))\nlet dirty = false\n// The row/field the draft belongs to, taken at the first edit: when the component is re-bound to another row the pending\n// draft must still be written to the row it was typed for.\nlet target: { row: CompositeRow, field: CompositeMetaField, stored: CslItem | null } | null = null\n\nwatch(() => props.row.key, () => {\n commit()\n Object.assign(form, bibFormOf(stored.value))\n})\nwatch(stored, (value) => {\n if (!dirty) Object.assign(form, bibFormOf(value))\n})\n\nfunction commit() {\n if (!dirty || !target) return\n dirty = false\n const { row, field, stored: base } = target\n target = null\n // The same Baustein: the current props carry its up-to-date position and stored item.\n const same = row.key === props.row.key\n if (!props.editor.isDestroyed) setCompositeMetaField(props.editor, same ? props.row : row, field.key, bibItemOf(form, same ? stored.value : base))\n}\n\nfunction markDirty() {\n if (!dirty) target = { row: props.row, field: props.field, stored: stored.value }\n dirty = true\n}\n\nfunction onInput<K extends keyof BibForm>(key: K, value: unknown) {\n form[key] = (typeof value === 'string' ? value : '') as BibForm[K]\n markDirty()\n}\n\nfunction onType(value: unknown) {\n if (typeof value !== 'string') return\n form.type = value as CslType\n markDirty()\n commit()\n}\n\nonBeforeUnmount(commit)\n\nconst copied = ref(false)\nlet copiedTimer: ReturnType<typeof setTimeout> | undefined\nonBeforeUnmount(() => clearTimeout(copiedTimer))\n\nasync function copyBibtex() {\n commit()\n const node = compositeOfRow(props.editor.state.doc, props.row)?.node\n const csl = node && cslOf(node)\n if (!csl) return\n await navigator.clipboard.writeText(bibtexOf(csl))\n copied.value = true\n clearTimeout(copiedTimer)\n copiedTimer = setTimeout(() => {\n copied.value = false\n }, 1500)\n}\n\n// Registered by the AI integration (`composite-ai`); without it there is nothing to fetch with.\nconst canFetch = typeof props.editor.commands.fetchCompositeBibliography === 'function'\nconst hasDoi = computed(() => form.doi.trim() !== '' || (typeof props.row.meta.doi === 'string' && props.row.meta.doi.trim() !== ''))\n\nfunction fetchByDoi() {\n commit()\n const found = compositeOfRow(props.editor.state.doc, props.row)\n if (found) props.editor.commands.fetchCompositeBibliography(found.pos)\n}\n\nconst inputs = [\n { key: 'containerTitle', labelKey: 'composites.bib.field.containerTitle' },\n { key: 'publisher', labelKey: 'composites.bib.field.publisher' },\n { key: 'doi', labelKey: 'composites.bib.field.doi' },\n { key: 'isbn', labelKey: 'composites.bib.field.isbn' },\n { key: 'url', labelKey: 'composites.bib.field.url' },\n] as const\nconst numbers = [\n { key: 'volume', labelKey: 'composites.bib.field.volume' },\n { key: 'issue', labelKey: 'composites.bib.field.issue' },\n { key: 'page', labelKey: 'composites.bib.field.page' },\n] as const\n</script>\n\n<template>\n <div class=\"flex flex-col gap-1.5\">\n <USelect\n :model-value=\"form.type\"\n :items=\"typeItems\"\n :aria-label=\"t('composites.bib.field.type')\"\n :disabled=\"disabled\"\n size=\"xs\"\n class=\"w-full\"\n @update:model-value=\"onType\"\n />\n <UTextarea\n :model-value=\"form.authors\"\n :placeholder=\"t('composites.bib.field.authorsHelp')\"\n :aria-label=\"t('composites.bib.field.authors')\"\n :disabled=\"disabled\"\n size=\"xs\"\n autoresize\n :rows=\"2\"\n :maxrows=\"6\"\n class=\"w-full\"\n @blur=\"commit\"\n @update:model-value=\"(value: unknown) => onInput('authors', value)\"\n />\n <div class=\"grid grid-cols-4 gap-1.5\">\n <UInput\n :model-value=\"form.year\"\n type=\"number\"\n :placeholder=\"t('composites.bib.field.year')\"\n :aria-label=\"t('composites.bib.field.year')\"\n :disabled=\"disabled\"\n size=\"xs\"\n class=\"col-span-1 w-full\"\n @blur=\"commit\"\n @keydown.enter=\"commit\"\n @update:model-value=\"(value: unknown) => onInput('year', value)\"\n />\n <UInput\n v-for=\"input in numbers\"\n :key=\"input.key\"\n :model-value=\"form[input.key]\"\n :placeholder=\"t(input.labelKey)\"\n :aria-label=\"t(input.labelKey)\"\n :disabled=\"disabled\"\n size=\"xs\"\n class=\"col-span-1 w-full\"\n @blur=\"commit\"\n @keydown.enter=\"commit\"\n @update:model-value=\"(value: unknown) => onInput(input.key, value)\"\n />\n </div>\n <UInput\n v-for=\"input in inputs\"\n :key=\"input.key\"\n :model-value=\"form[input.key]\"\n :placeholder=\"t(input.labelKey)\"\n :aria-label=\"t(input.labelKey)\"\n :disabled=\"disabled\"\n size=\"xs\"\n class=\"w-full\"\n @blur=\"commit\"\n @keydown.enter=\"commit\"\n @update:model-value=\"(value: unknown) => onInput(input.key, value)\"\n />\n <UTextarea\n :model-value=\"form.abstract\"\n :placeholder=\"t('composites.bib.field.abstract')\"\n :aria-label=\"t('composites.bib.field.abstract')\"\n :disabled=\"disabled\"\n size=\"xs\"\n autoresize\n :rows=\"2\"\n :maxrows=\"6\"\n class=\"w-full\"\n @blur=\"commit\"\n @update:model-value=\"(value: unknown) => onInput('abstract', value)\"\n />\n <div class=\"flex justify-end gap-1.5\">\n <UButton\n v-if=\"canFetch\"\n size=\"xs\"\n color=\"neutral\"\n variant=\"ghost\"\n icon=\"i-lucide-book-marked\"\n :label=\"t('composites.bib.fetchDoi')\"\n :disabled=\"disabled || !hasDoi\"\n @click=\"fetchByDoi\"\n />\n <UButton\n size=\"xs\"\n color=\"neutral\"\n variant=\"ghost\"\n icon=\"i-lucide-copy\"\n :label=\"copied ? t('composites.bib.copied') : t('composites.bib.copyBibtex')\"\n :disabled=\"!stored\"\n @click=\"copyBibtex\"\n />\n </div>\n </div>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;EAgBA,MAAM,QAAQ;EAOd,MAAM,EAAE,QAAQ,SAAS,OAAO,QAAQ,QAAQ,SAAS,UAAU,cAAc,SAAS;EAC1F,MAAM,EAAE,MAAM,cAAc;EAE5B,MAAM,SAAS,eAA+B;GAC5C,MAAM,QAAQ,MAAM,IAAI,KAAK,MAAM,MAAM;GACzC,OAAO,SAAS,OAAO,UAAU,YAAY,OAAO,MAAM,SAAS,WAAW,QAAmB;EACnG,CAAC;EACD,MAAM,YAAY,eAAe,eAAe,CAAC,CAAC;EAElD,MAAM,OAAO,SAAkB,UAAU,OAAO,KAAK,CAAC;EACtD,IAAI,QAAQ;EAGZ,IAAI,SAA0F;EAE9F,YAAY,MAAM,IAAI,WAAW;GAC/B,OAAO;GACP,OAAO,OAAO,MAAM,UAAU,OAAO,KAAK,CAAC;EAC7C,CAAC;EACD,MAAM,SAAS,UAAU;GACvB,IAAI,CAAC,OAAO,OAAO,OAAO,MAAM,UAAU,KAAK,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;;;;;IAEpEC,mBAoBM,OApBN,YAoBM,CAlBI,YADRJ,UAAA,GAAAQ,YASEL,MAAA,OAAA,GAAA;;KAPA,MAAK;KACL,OAAM;KACN,SAAQ;KACR,MAAK;KACJ,OAAOA,MAAA,CAAA,CAAC,CAAA,yBAAA;KACR,UAAU,QAAA,YAAQ,CAAK,OAAA;KACvB,SAAO;IAEV,GAAA,MAAA,GAAA,CAAA,SAAA,UAAA,CAAA,KAAAM,mBAAA,QAAA,IAAA,GAAAP,YAQEC,MAAA,OAAA,GAAA;KAPA,MAAK;KACL,OAAM;KACN,SAAQ;KACR,MAAK;KACJ,OAAO,OAAA,QAASA,MAAA,CAAA,CAAC,CAAA,uBAAA,IAA4BA,MAAA,CAAA,CAAC,CAAA,2BAAA;KAC9C,UAAQ,CAAG,OAAA;KACX,SAAO"}
|
|
@@ -4,7 +4,9 @@ import { useEditorSettings } from "../../../vue/settings.js";
|
|
|
4
4
|
import { useEditorI18n } from "../../../vue/use-editor-i18n.js";
|
|
5
5
|
import { compositeOfRow, setCompositeTags } from "../rows.js";
|
|
6
6
|
import { compositeSectionOf } from "../anchors.js";
|
|
7
|
+
import { derivedChromeOf } from "../derived-chrome.js";
|
|
7
8
|
import { rowStatus } from "../meta-display.js";
|
|
9
|
+
import { useStoreRef } from "../../../vue/store-ref.js";
|
|
8
10
|
import { useCompositeAnchors } from "../use-composite-anchors.js";
|
|
9
11
|
import { useCompositeRows } from "../use-composite-rows.js";
|
|
10
12
|
import _sfc_main$1 from "./CompositeDetails.js";
|
|
@@ -20,17 +22,23 @@ const _hoisted_2 = [
|
|
|
20
22
|
"onDragstart"
|
|
21
23
|
];
|
|
22
24
|
const _hoisted_3 = ["onMouseenter"];
|
|
23
|
-
const _hoisted_4 = [
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
const _hoisted_4 = [
|
|
26
|
+
"aria-expanded",
|
|
27
|
+
"aria-label",
|
|
28
|
+
"title",
|
|
29
|
+
"onClick"
|
|
30
|
+
];
|
|
31
|
+
const _hoisted_5 = ["aria-label"];
|
|
32
|
+
const _hoisted_6 = { class: "truncate" };
|
|
33
|
+
const _hoisted_7 = ["aria-label", "onClick"];
|
|
34
|
+
const _hoisted_8 = ["aria-label", "title"];
|
|
35
|
+
const _hoisted_9 = { class: "w-64 p-3" };
|
|
28
36
|
/**
|
|
29
37
|
* Chrome of every composite, laid over the editor (mounted by the composites feature): on the title line the status
|
|
30
38
|
* chip and one chip per tag (with a `+` chip to add tags), and on the front the kind icon. The icon is a button that
|
|
31
39
|
* opens the details popover (kind with a confirmation before it changes, the kind's fields and the summary;
|
|
32
40
|
* `CompositeDetails`) and, in an editable editor, the composite's drag handle: dragging it moves the composite
|
|
33
|
-
* (`startBlockDrag`). With `blocks.kindIcon: 'hover'` it shows only while the composite is hovered, its popover is
|
|
41
|
+
* (`startBlockDrag`). A kind with `chrome.tags: false` shows no tag chips and no `+` chip. With `blocks.kindIcon: 'hover'` it shows only while the composite is hovered, its popover is
|
|
34
42
|
* open or the icon has keyboard focus. Chips and popover also render in read-only editors, without edit affordances.
|
|
35
43
|
* The node view's own description and tags rows are hidden by CSS; this overlay shows and edits them.
|
|
36
44
|
*/
|
|
@@ -93,19 +101,35 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
|
93
101
|
if (!found || !startBlockDrag(props.editor, event, found.pos)) event.preventDefault();
|
|
94
102
|
}
|
|
95
103
|
/** Chips start right after the title's last character and run on to the editor's right edge. */
|
|
96
|
-
const
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
row
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
104
|
+
const expanded = useStoreRef(() => props.editor.storage.composite.expanded);
|
|
105
|
+
const placed = computed(() => {
|
|
106
|
+
let hiddenUntil = -1;
|
|
107
|
+
return rows.value.flatMap((row) => {
|
|
108
|
+
if (row.pos < hiddenUntil) return [];
|
|
109
|
+
const derived = derivedChromeOf(props.editor, row);
|
|
110
|
+
const open = !derived || !row.id || expanded.value.has(row.id);
|
|
111
|
+
if (!open) hiddenUntil = row.end;
|
|
112
|
+
const anchor = anchors.value.get(row.key);
|
|
113
|
+
if (!anchor) return [];
|
|
114
|
+
const left = anchor.lineEnd + (anchor.titleEmpty ? 116 : 12);
|
|
115
|
+
return [{
|
|
116
|
+
row,
|
|
117
|
+
anchor,
|
|
118
|
+
left,
|
|
119
|
+
top: anchor.lastCenter - ROW_HEIGHT / 2,
|
|
120
|
+
width: Math.max((frame.value?.right ?? anchor.right) - left, 120),
|
|
121
|
+
status: rowStatus(row, t),
|
|
122
|
+
derived: derived && {
|
|
123
|
+
stale: derived.stale,
|
|
124
|
+
open,
|
|
125
|
+
toggleable: !!row.id
|
|
126
|
+
}
|
|
127
|
+
}];
|
|
128
|
+
});
|
|
129
|
+
});
|
|
130
|
+
function toggleExpanded(row) {
|
|
131
|
+
if (row.id) props.editor.commands.toggleCompositeExpanded(row.id);
|
|
132
|
+
}
|
|
109
133
|
function removeTag(row, tag) {
|
|
110
134
|
setCompositeTags(props.editor, row, row.tags.filter((candidate) => candidate !== tag));
|
|
111
135
|
}
|
|
@@ -160,7 +184,7 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
|
160
184
|
class: "size-3.5"
|
|
161
185
|
}, null, 8, ["name"]))], 46, _hoisted_2)]),
|
|
162
186
|
_: 2
|
|
163
|
-
}, 1024)) : createCommentVNode("v-if", true), item.status || item.row.tags.length || editable.value ? (openBlock(), createElementBlock("div", {
|
|
187
|
+
}, 1024)) : createCommentVNode("v-if", true), item.status || item.derived || item.row.tagsVisible && (item.row.tags.length || editable.value) ? (openBlock(), createElementBlock("div", {
|
|
164
188
|
key: 1,
|
|
165
189
|
class: "absolute z-10 flex items-center gap-px overflow-hidden rounded-md bg-[var(--sk-bg)]",
|
|
166
190
|
style: normalizeStyle({
|
|
@@ -172,7 +196,32 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
|
172
196
|
onMouseenter: ($event) => chipsHoveredKey.value = item.row.key,
|
|
173
197
|
onMouseleave: _cache[1] || (_cache[1] = ($event) => chipsHoveredKey.value = null)
|
|
174
198
|
}, [
|
|
175
|
-
item.
|
|
199
|
+
item.derived ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
200
|
+
item.derived.toggleable ? (openBlock(), createElementBlock("button", {
|
|
201
|
+
key: 0,
|
|
202
|
+
type: "button",
|
|
203
|
+
class: normalizeClass(chipButton),
|
|
204
|
+
"aria-expanded": item.derived.open,
|
|
205
|
+
"aria-label": unref(t)(item.derived.open ? "composites.derivation.collapse" : "composites.derivation.expand"),
|
|
206
|
+
title: unref(t)(item.derived.open ? "composites.derivation.collapse" : "composites.derivation.expand"),
|
|
207
|
+
onClick: ($event) => toggleExpanded(item.row)
|
|
208
|
+
}, [createVNode(unref(UIcon), {
|
|
209
|
+
name: item.derived.open ? "i-lucide-chevron-down" : "i-lucide-chevron-right",
|
|
210
|
+
class: "size-3.5"
|
|
211
|
+
}, null, 8, ["name"])], 8, _hoisted_4)) : createCommentVNode("v-if", true),
|
|
212
|
+
createElementVNode("span", { class: normalizeClass(chip) }, [createVNode(unref(UIcon), {
|
|
213
|
+
name: "i-lucide-git-branch",
|
|
214
|
+
class: "size-3.5"
|
|
215
|
+
}), createTextVNode(toDisplayString(unref(t)("composites.derivation.badge")), 1)]),
|
|
216
|
+
item.derived.stale ? (openBlock(), createElementBlock("span", {
|
|
217
|
+
key: 1,
|
|
218
|
+
class: normalizeClass([chip, "text-[var(--sk-warning)]"])
|
|
219
|
+
}, [createVNode(unref(UIcon), {
|
|
220
|
+
name: "i-lucide-triangle-alert",
|
|
221
|
+
class: "size-3.5"
|
|
222
|
+
}), createTextVNode(toDisplayString(unref(t)("composites.derivation.stale")), 1)], 2)) : createCommentVNode("v-if", true)
|
|
223
|
+
], 64)) : createCommentVNode("v-if", true),
|
|
224
|
+
item.status ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [editable.value ? (openBlock(), createBlock(_sfc_main$2, {
|
|
176
225
|
key: 0,
|
|
177
226
|
editor: __props.editor,
|
|
178
227
|
row: item.row
|
|
@@ -184,7 +233,7 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
|
184
233
|
}, [createVNode(unref(UIcon), {
|
|
185
234
|
name: item.status.icon,
|
|
186
235
|
class: normalizeClass(["size-3.5", item.status.color])
|
|
187
|
-
}, null, 8, ["name", "class"]), createTextVNode(toDisplayString(item.status.label), 1)], 8,
|
|
236
|
+
}, null, 8, ["name", "class"]), createTextVNode(toDisplayString(item.status.label), 1)], 8, _hoisted_5)]),
|
|
188
237
|
_: 2
|
|
189
238
|
}, 1032, ["editor", "row"])) : (openBlock(), createElementBlock("span", {
|
|
190
239
|
key: 1,
|
|
@@ -193,11 +242,11 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
|
193
242
|
name: item.status.icon,
|
|
194
243
|
class: normalizeClass(["size-3.5", item.status.color])
|
|
195
244
|
}, null, 8, ["name", "class"]), createTextVNode(toDisplayString(item.status.label), 1)]))], 64)) : createCommentVNode("v-if", true),
|
|
196
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(item.row.tags, (tag) => {
|
|
245
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(item.row.tagsVisible ? item.row.tags : [], (tag) => {
|
|
197
246
|
return openBlock(), createElementBlock("span", {
|
|
198
247
|
key: tag,
|
|
199
248
|
class: normalizeClass([chip, "group max-w-40 gap-0"])
|
|
200
|
-
}, [createElementVNode("span",
|
|
249
|
+
}, [createElementVNode("span", _hoisted_6, "#" + toDisplayString(tag), 1), editable.value ? (openBlock(), createElementBlock("button", {
|
|
201
250
|
key: 0,
|
|
202
251
|
type: "button",
|
|
203
252
|
class: "flex h-4 w-0 shrink-0 items-center justify-center overflow-hidden rounded-sm opacity-0 transition-all duration-150 group-hover:ml-1 group-hover:w-4 group-hover:opacity-100 hover:bg-[var(--sk-bg-elevated)] hover:text-[var(--sk-fg-highlighted)] focus-visible:ml-1 focus-visible:w-4 focus-visible:opacity-100 focus-visible:outline-2 focus-visible:outline-[var(--sk-primary)]",
|
|
@@ -206,10 +255,10 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
|
206
255
|
}, [createVNode(unref(UIcon), {
|
|
207
256
|
name: "i-lucide-x",
|
|
208
257
|
class: "size-3"
|
|
209
|
-
})], 8,
|
|
258
|
+
})], 8, _hoisted_7)) : createCommentVNode("v-if", true)], 2);
|
|
210
259
|
}), 128)),
|
|
211
|
-
editable.value ? (openBlock(), createBlock(unref(UPopover), {
|
|
212
|
-
key:
|
|
260
|
+
editable.value && item.row.tagsVisible ? (openBlock(), createBlock(unref(UPopover), {
|
|
261
|
+
key: 2,
|
|
213
262
|
content: {
|
|
214
263
|
side: "bottom",
|
|
215
264
|
align: "start",
|
|
@@ -217,7 +266,7 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
|
217
266
|
onCloseAutoFocus: (event) => event.preventDefault()
|
|
218
267
|
}
|
|
219
268
|
}, {
|
|
220
|
-
content: withCtx(() => [createElementVNode("div",
|
|
269
|
+
content: withCtx(() => [createElementVNode("div", _hoisted_9, [createVNode(_sfc_main$3, {
|
|
221
270
|
editor: __props.editor,
|
|
222
271
|
row: item.row
|
|
223
272
|
}, null, 8, ["editor", "row"])])]),
|
|
@@ -229,7 +278,7 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
|
229
278
|
}, [createVNode(unref(UIcon), {
|
|
230
279
|
name: "i-lucide-plus",
|
|
231
280
|
class: "size-3.5"
|
|
232
|
-
})], 8,
|
|
281
|
+
})], 8, _hoisted_8)]),
|
|
233
282
|
_: 2
|
|
234
283
|
}, 1032, ["content"])) : createCommentVNode("v-if", true)
|
|
235
284
|
], 44, _hoisted_3)) : createCommentVNode("v-if", true)], 64);
|