@ecsplico/editor 2.1.1 → 3.0.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 +74 -1
- package/README.md +39 -156
- package/dist/adapters/comments/drizzle.d.ts +1 -1
- 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/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 +23 -20
- package/dist/adapters/nitro.js +58 -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 +3 -3
- 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 +89 -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 +35 -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 +14 -9
- package/dist/core/index.js +12 -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 +13 -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/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 +3 -3
- 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 +4 -1
- 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 +22 -1
- package/dist/features/block-ui/block-actions.js +26 -2
- package/dist/features/block-ui/block-actions.js.map +1 -1
- package/dist/features/block-ui/components/BlockActionsOverlay.js +33 -4
- package/dist/features/block-ui/components/BlockActionsOverlay.js.map +1 -1
- package/dist/features/block-ui/components/BlockActionsOverlay.vue.d.ts +4 -0
- 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/index.d.ts +2 -2
- package/dist/features/block-ui/index.js +2 -2
- package/dist/features/block-ui/react/BlockActionsOverlay.d.ts +4 -0
- package/dist/features/block-ui/react/BlockActionsOverlay.js +38 -12
- package/dist/features/block-ui/react/BlockActionsOverlay.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 +31 -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 +75 -26
- package/dist/features/composites/components/CompositeChrome.js.map +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 +37 -4
- package/dist/features/composites/components/CompositeFieldEditor.js.map +1 -1
- package/dist/features/composites/components/CompositeInspector.js +17 -5
- 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 +8 -1
- 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 +40 -1
- 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 +65 -17
- 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 +24 -1
- package/dist/features/composites/react/CompositeFieldEditor.js.map +1 -1
- package/dist/features/composites/react/CompositeInspector.js +11 -5
- 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 +21 -2
- package/dist/features/composites/rows.js +63 -9
- 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 +2 -2
- package/dist/features/media/react/FileView.js +19 -2
- package/dist/features/media/react/FileView.js.map +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 +10 -9
- 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/{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 +30 -9
- package/dist/server/handlers/ai.js +170 -36
- 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.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 +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 +37 -7
- 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 -630
- package/docs/llms.md +0 -383
- package/docs/usage.md +0 -1076
package/dist/nuxt/module.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import { defineEditorConfig, publicConfig, serverConfig } from "../config/index.js";
|
|
1
2
|
import { addPlugin, addServerScanDir, createResolver, defineNuxtModule } from "nuxt/kit";
|
|
2
3
|
//#region src/nuxt/module.ts
|
|
3
4
|
/**
|
|
4
5
|
* Nuxt/Nitro integration of the editor package: the client context plugin (settings persistence, AI configuration),
|
|
5
|
-
* the
|
|
6
|
-
* plugs in through `
|
|
6
|
+
* a server plugin that mounts the editor's routes and the collaboration websocket (`installEditorServer`) and the AI configuration with its server-only secrets. The host
|
|
7
|
+
* plugs in through `setEditorPorts()` (`@ecsplico/editor/server`) in a Nitro plugin (auth, loading and storing
|
|
7
8
|
* document content). Components are imported explicitly from the package entries; nothing is auto-registered.
|
|
8
9
|
*/
|
|
9
10
|
var module_default = defineNuxtModule({
|
|
@@ -11,33 +12,6 @@ var module_default = defineNuxtModule({
|
|
|
11
12
|
name: "tiptap-editor",
|
|
12
13
|
configKey: "tiptapEditor"
|
|
13
14
|
},
|
|
14
|
-
defaults: {
|
|
15
|
-
locale: "de",
|
|
16
|
-
collab: { authenticateUpgrade: false },
|
|
17
|
-
ai: {
|
|
18
|
-
presets: {
|
|
19
|
-
sonnet: {
|
|
20
|
-
label: "Claude Sonnet 4.5 (OpenRouter)",
|
|
21
|
-
endpoint: "https://openrouter.ai/api/v1",
|
|
22
|
-
model: "anthropic/claude-sonnet-4.5"
|
|
23
|
-
},
|
|
24
|
-
flashLite: {
|
|
25
|
-
label: "Gemini 2.5 Flash Lite (OpenRouter)",
|
|
26
|
-
endpoint: "https://openrouter.ai/api/v1",
|
|
27
|
-
model: "google/gemini-2.5-flash-lite"
|
|
28
|
-
}
|
|
29
|
-
},
|
|
30
|
-
slots: {
|
|
31
|
-
complete: "flashLite",
|
|
32
|
-
rewrite: "sonnet",
|
|
33
|
-
generate: "sonnet"
|
|
34
|
-
},
|
|
35
|
-
rateLimit: {
|
|
36
|
-
max: 30,
|
|
37
|
-
windowMs: 6e4
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
},
|
|
41
15
|
setup(options, nuxt) {
|
|
42
16
|
const { resolve } = createResolver(import.meta.url);
|
|
43
17
|
const packageSrc = resolve("..");
|
|
@@ -67,30 +41,13 @@ var module_default = defineNuxtModule({
|
|
|
67
41
|
packageSrc
|
|
68
42
|
]
|
|
69
43
|
};
|
|
44
|
+
const config = defineEditorConfig(options);
|
|
70
45
|
nuxt.options.runtimeConfig.tiptapEditor = {
|
|
71
|
-
|
|
72
|
-
ai: {
|
|
73
|
-
apiKey: "",
|
|
74
|
-
presets: Object.fromEntries(Object.entries(options.ai.presets).map(([id, preset]) => [id, {
|
|
75
|
-
...preset,
|
|
76
|
-
apiKey: preset.apiKey ?? ""
|
|
77
|
-
}])),
|
|
78
|
-
slots: options.ai.slots,
|
|
79
|
-
rateLimit: options.ai.rateLimit,
|
|
80
|
-
...options.ai.transcription && { transcription: {
|
|
81
|
-
...options.ai.transcription,
|
|
82
|
-
apiKey: options.ai.transcription.apiKey ?? ""
|
|
83
|
-
} }
|
|
84
|
-
},
|
|
46
|
+
...serverConfig(config),
|
|
85
47
|
...nuxt.options.runtimeConfig.tiptapEditor
|
|
86
48
|
};
|
|
87
49
|
nuxt.options.runtimeConfig.public.tiptapEditor = {
|
|
88
|
-
|
|
89
|
-
...options.messages && { messages: options.messages },
|
|
90
|
-
ai: {
|
|
91
|
-
slots: options.ai.slots,
|
|
92
|
-
transcription: Boolean(options.ai.transcription)
|
|
93
|
-
},
|
|
50
|
+
...publicConfig(config),
|
|
94
51
|
...nuxt.options.runtimeConfig.public.tiptapEditor
|
|
95
52
|
};
|
|
96
53
|
}
|
package/dist/nuxt/module.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.js","names":[],"sources":["../../src/nuxt/module.ts"],"sourcesContent":["import { addPlugin, addServerScanDir, createResolver, defineNuxtModule } from 'nuxt/kit'\nimport
|
|
1
|
+
{"version":3,"file":"module.js","names":[],"sources":["../../src/nuxt/module.ts"],"sourcesContent":["import { addPlugin, addServerScanDir, createResolver, defineNuxtModule } from 'nuxt/kit'\nimport { defineEditorConfig, type EditorConfigInput, publicConfig, serverConfig } from '../config'\n\n/** Module options (`tiptapEditor` in `nuxt.config`): the editor's configuration with every key optional, see `EditorConfig`. */\nexport type ModuleOptions = EditorConfigInput\n\n/**\n * Nuxt/Nitro integration of the editor package: the client context plugin (settings persistence, AI configuration),\n * a server plugin that mounts the editor's routes and the collaboration websocket (`installEditorServer`) and the AI configuration with its server-only secrets. The host\n * plugs in through `setEditorPorts()` (`@ecsplico/editor/server`) in a Nitro plugin (auth, loading and storing\n * document content). Components are imported explicitly from the package entries; nothing is auto-registered.\n */\nexport default defineNuxtModule<ModuleOptions>({\n meta: { name: 'tiptap-editor', configKey: 'tiptapEditor' },\n setup(options, nuxt) {\n const { resolve } = createResolver(import.meta.url)\n // `resolve('..')` is the package root of the built output (`dist`) or of `src` in this repository's app: both\n // hold the stylesheets and the unbundled `nuxt/runtime` files, which Nuxt compiles for the client and Nitro for the server.\n const packageSrc = resolve('..')\n nuxt.options.build.transpile.push(packageSrc)\n // The Nuxt UI token map comes first: the feature sheets (and an Obsidian theme, `themes.css`, last) read and may override `--sk-*`.\n nuxt.options.css.push(resolve('../vue/kit/nuxt-ui.css'))\n nuxt.options.css.push(\n resolve('../styles/core.css'),\n resolve('../styles/media.css'),\n resolve('../styles/mentions.css'),\n resolve('../styles/authors.css'),\n resolve('../styles/comments.css'),\n resolve('../styles/transcript.css'),\n resolve('../styles/composites.css'),\n resolve('../styles/ai.css'),\n resolve('../styles/collab.css'),\n resolve('../styles/block-ui.css'),\n resolve('../styles/themes.css'),\n )\n addPlugin({ src: resolve('./runtime/plugins/editor-context-nuxt-ui.client.ts'), mode: 'client' })\n addServerScanDir(resolve('./runtime/server'))\n // Tailwind only scans the app layers listed in Nuxt UI's generated `ui.css` (`@source \"<layer>/app/**/*\"`), so the\n // utility classes used by the package's components would never be generated. Append its source. `@nuxt/ui` must be\n // registered before this module.\n nuxt.hook('modules:done', () => {\n const uiCss = nuxt.options.build.templates.find(t => t.filename === 'ui.css')\n if (!uiCss?.getContents) throw new Error('tiptap-editor: @nuxt/ui muss vor diesem Modul registriert sein (ui.css-Template fehlt)')\n const getContents = uiCss.getContents\n uiCss.getContents = async data => `@source \"${packageSrc}/**/*\";\\n${await getContents(data)}`\n })\n nuxt.options.nitro.experimental = { ...nuxt.options.nitro.experimental, websocket: true }\n // Nitro bundles the package (the runtime files import `h3` and `nitropack/runtime`, which the host's Nitro resolves): never leave it external.\n nuxt.options.nitro.externals = { ...nuxt.options.nitro.externals, inline: [...(nuxt.options.nitro.externals?.inline ?? []), '@ecsplico/editor', packageSrc] }\n const config = defineEditorConfig(options)\n // The server view keeps an empty `apiKey` on the shared key, every preset and the transcription, so their `NUXT_TIPTAP_EDITOR_AI_*` env variables have a key to override.\n nuxt.options.runtimeConfig.tiptapEditor = {\n ...serverConfig(config),\n ...(nuxt.options.runtimeConfig.tiptapEditor as object | undefined),\n }\n // Default slot presets for the client before `GET /api/ai/models` has answered; read by the client context plugin.\n nuxt.options.runtimeConfig.public.tiptapEditor = {\n ...publicConfig(config),\n ...(nuxt.options.runtimeConfig.public.tiptapEditor as object | undefined),\n }\n },\n})\n"],"mappings":";;;;;;;;;AAYA,IAAA,iBAAe,iBAAgC;CAC7C,MAAM;EAAE,MAAM;EAAiB,WAAW;CAAe;CACzD,MAAM,SAAS,MAAM;EACnB,MAAM,EAAE,YAAY,eAAe,YAAY,GAAG;EAGlD,MAAM,aAAa,QAAQ,IAAI;EAC/B,KAAK,QAAQ,MAAM,UAAU,KAAK,UAAU;EAE5C,KAAK,QAAQ,IAAI,KAAK,QAAQ,wBAAwB,CAAC;EACvD,KAAK,QAAQ,IAAI,KACf,QAAQ,oBAAoB,GAC5B,QAAQ,qBAAqB,GAC7B,QAAQ,wBAAwB,GAChC,QAAQ,uBAAuB,GAC/B,QAAQ,wBAAwB,GAChC,QAAQ,0BAA0B,GAClC,QAAQ,0BAA0B,GAClC,QAAQ,kBAAkB,GAC1B,QAAQ,sBAAsB,GAC9B,QAAQ,wBAAwB,GAChC,QAAQ,sBAAsB,CAChC;EACA,UAAU;GAAE,KAAK,QAAQ,oDAAoD;GAAG,MAAM;EAAS,CAAC;EAChG,iBAAiB,QAAQ,kBAAkB,CAAC;EAI5C,KAAK,KAAK,sBAAsB;GAC9B,MAAM,QAAQ,KAAK,QAAQ,MAAM,UAAU,MAAK,MAAK,EAAE,aAAa,QAAQ;GAC5E,IAAI,CAAC,OAAO,aAAa,MAAM,IAAI,MAAM,wFAAwF;GACjI,MAAM,cAAc,MAAM;GAC1B,MAAM,cAAc,OAAM,SAAQ,YAAY,WAAW,WAAW,MAAM,YAAY,IAAI;EAC5F,CAAC;EACD,KAAK,QAAQ,MAAM,eAAe;GAAE,GAAG,KAAK,QAAQ,MAAM;GAAc,WAAW;EAAK;EAExF,KAAK,QAAQ,MAAM,YAAY;GAAE,GAAG,KAAK,QAAQ,MAAM;GAAW,QAAQ;IAAC,GAAI,KAAK,QAAQ,MAAM,WAAW,UAAU,CAAC;IAAI;IAAoB;GAAU;EAAE;EAC5J,MAAM,SAAS,mBAAmB,OAAO;EAEzC,KAAK,QAAQ,cAAc,eAAe;GACxC,GAAG,aAAa,MAAM;GACtB,GAAI,KAAK,QAAQ,cAAc;EACjC;EAEA,KAAK,QAAQ,cAAc,OAAO,eAAe;GAC/C,GAAG,aAAa,MAAM;GACtB,GAAI,KAAK,QAAQ,cAAc,OAAO;EACxC;CACF;AACF,CAAC"}
|
|
@@ -1,16 +1,20 @@
|
|
|
1
1
|
import { VueUiKit } from "../../vue/kit/types.js";
|
|
2
2
|
import { App } from "vue";
|
|
3
|
+
import { $Fetch } from "ofetch";
|
|
3
4
|
//#region src/nuxt/runtime/install-context.d.ts
|
|
4
5
|
/**
|
|
5
6
|
* Installs the editor context on a Nuxt app (client only: TipTap does not render on the server). Settings are kept per
|
|
6
7
|
* account through the host's `/api/editor/settings`; the AI configuration is the module's public runtime config,
|
|
7
|
-
* passed on as inert data.
|
|
8
|
+
* passed on as inert data. The backend is the HTTP adapter over Nuxt's `$fetch` with `probe: true`: it asks the server
|
|
9
|
+
* which capabilities it serves and drops the others (no comments port, no themes, …), so compositions pruned by `backend`
|
|
10
|
+
* match the server. The returned promise settles once that is known; await it in the plugin so no editor mounts before. `locale`
|
|
8
11
|
* and `messages` are the module's options of the same name. The kit is passed in by the plugin file the module registers
|
|
9
|
-
* (`nuxtUiKit()`). Only the Vue app
|
|
12
|
+
* (`nuxtUiKit()`). Only the Vue app and `$fetch` are read, so the parameter is structural: a host's
|
|
10
13
|
* augmented `NuxtApp` (plugins adding `$router`, `$auth`, ...) and the `_NuxtApp` a plugin receives both fit.
|
|
11
14
|
*/
|
|
12
15
|
export declare function installEditorContext(nuxtApp: {
|
|
13
16
|
vueApp: App;
|
|
14
|
-
|
|
17
|
+
$fetch?: $Fetch;
|
|
18
|
+
}, kit: VueUiKit): Promise<void>;
|
|
15
19
|
//#endregion
|
|
16
20
|
//# sourceMappingURL=install-context.d.ts.map
|
|
@@ -1,23 +1,29 @@
|
|
|
1
|
+
import { createHttpBackend } from "../../adapters/http.js";
|
|
1
2
|
import { createEditor } from "../../vue/context.js";
|
|
2
3
|
import { useRuntimeConfig } from "#app";
|
|
3
4
|
//#region src/nuxt/runtime/install-context.ts
|
|
4
5
|
/**
|
|
5
6
|
* Installs the editor context on a Nuxt app (client only: TipTap does not render on the server). Settings are kept per
|
|
6
7
|
* account through the host's `/api/editor/settings`; the AI configuration is the module's public runtime config,
|
|
7
|
-
* passed on as inert data.
|
|
8
|
+
* passed on as inert data. The backend is the HTTP adapter over Nuxt's `$fetch` with `probe: true`: it asks the server
|
|
9
|
+
* which capabilities it serves and drops the others (no comments port, no themes, …), so compositions pruned by `backend`
|
|
10
|
+
* match the server. The returned promise settles once that is known; await it in the plugin so no editor mounts before. `locale`
|
|
8
11
|
* and `messages` are the module's options of the same name. The kit is passed in by the plugin file the module registers
|
|
9
|
-
* (`nuxtUiKit()`). Only the Vue app
|
|
12
|
+
* (`nuxtUiKit()`). Only the Vue app and `$fetch` are read, so the parameter is structural: a host's
|
|
10
13
|
* augmented `NuxtApp` (plugins adding `$router`, `$auth`, ...) and the `_NuxtApp` a plugin receives both fit.
|
|
11
14
|
*/
|
|
12
|
-
function installEditorContext(nuxtApp, kit) {
|
|
13
|
-
const
|
|
15
|
+
async function installEditorContext(nuxtApp, kit) {
|
|
16
|
+
const config = useRuntimeConfig().public.tiptapEditor;
|
|
17
|
+
const backend = createHttpBackend({
|
|
18
|
+
probe: true,
|
|
19
|
+
...nuxtApp.$fetch && { fetch: nuxtApp.$fetch }
|
|
20
|
+
});
|
|
14
21
|
nuxtApp.vueApp.use(createEditor({
|
|
15
22
|
kit,
|
|
16
|
-
|
|
17
|
-
...
|
|
18
|
-
...locale && { locale },
|
|
19
|
-
...messages && { messages }
|
|
23
|
+
backend,
|
|
24
|
+
...config
|
|
20
25
|
}));
|
|
26
|
+
await backend.ready;
|
|
21
27
|
}
|
|
22
28
|
//#endregion
|
|
23
29
|
export { installEditorContext };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"install-context.js","names":[],"sources":["../../../src/nuxt/runtime/install-context.ts"],"sourcesContent":["import type { App } from 'vue'\nimport { useRuntimeConfig } from '#app'\nimport
|
|
1
|
+
{"version":3,"file":"install-context.js","names":[],"sources":["../../../src/nuxt/runtime/install-context.ts"],"sourcesContent":["import type { $Fetch } from 'ofetch'\nimport type { App } from 'vue'\nimport { useRuntimeConfig } from '#app'\nimport { createHttpBackend } from '../../adapters/http'\nimport type { EditorPublicConfig } from '../../config'\nimport { createEditor } from '../../vue/context'\nimport type { VueUiKit } from '../../vue/kit/types'\n\n/**\n * Installs the editor context on a Nuxt app (client only: TipTap does not render on the server). Settings are kept per\n * account through the host's `/api/editor/settings`; the AI configuration is the module's public runtime config,\n * passed on as inert data. The backend is the HTTP adapter over Nuxt's `$fetch` with `probe: true`: it asks the server\n * which capabilities it serves and drops the others (no comments port, no themes, …), so compositions pruned by `backend`\n * match the server. The returned promise settles once that is known; await it in the plugin so no editor mounts before. `locale`\n * and `messages` are the module's options of the same name. The kit is passed in by the plugin file the module registers\n * (`nuxtUiKit()`). Only the Vue app and `$fetch` are read, so the parameter is structural: a host's\n * augmented `NuxtApp` (plugins adding `$router`, `$auth`, ...) and the `_NuxtApp` a plugin receives both fit.\n */\nexport async function installEditorContext(nuxtApp: { vueApp: App, $fetch?: $Fetch }, kit: VueUiKit): Promise<void> {\n const config = useRuntimeConfig().public.tiptapEditor as EditorPublicConfig\n const backend = createHttpBackend({ probe: true, ...(nuxtApp.$fetch && { fetch: nuxtApp.$fetch }) })\n nuxtApp.vueApp.use(createEditor({ kit, backend, ...config }))\n await backend.ready\n}\n"],"mappings":";;;;;;;;;;;;;;AAkBA,eAAsB,qBAAqB,SAA2C,KAA8B;CAClH,MAAM,SAAS,iBAAiB,CAAC,CAAC,OAAO;CACzC,MAAM,UAAU,kBAAkB;EAAE,OAAO;EAAM,GAAI,QAAQ,UAAU,EAAE,OAAO,QAAQ,OAAO;CAAG,CAAC;CACnG,QAAQ,OAAO,IAAI,aAAa;EAAE;EAAK;EAAS,GAAG;CAAO,CAAC,CAAC;CAC5D,MAAM,QAAQ;AAChB"}
|
|
@@ -3,6 +3,6 @@ import { installEditorContext } from '../install-context'
|
|
|
3
3
|
import { defineNuxtPlugin } from '#app'
|
|
4
4
|
|
|
5
5
|
// Registered by the module; see `install-context.ts`.
|
|
6
|
-
export default defineNuxtPlugin((nuxtApp) => {
|
|
7
|
-
installEditorContext(nuxtApp, nuxtUiKit())
|
|
6
|
+
export default defineNuxtPlugin(async (nuxtApp) => {
|
|
7
|
+
await installEditorContext(nuxtApp, nuxtUiKit())
|
|
8
8
|
})
|
|
@@ -1,18 +1,26 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useEditorPorts, useEditorSchema } from "../../../../server/host.js";
|
|
2
|
+
import { installEditorServer } from "../../../../adapters/nitro.js";
|
|
2
3
|
import { defineNitroPlugin, useRuntimeConfig } from "nitropack/runtime";
|
|
3
4
|
//#region src/nuxt/runtime/server/plugins/editor-server.ts
|
|
4
|
-
var editor_server_default = defineNitroPlugin(() => {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
presets: ai.presets,
|
|
9
|
-
apiKey: ai.apiKey,
|
|
10
|
-
slots: ai.slots,
|
|
11
|
-
transcription: ai.transcription,
|
|
12
|
-
missingKeyHint: (id) => ` (NUXT_TIPTAP_EDITOR_AI_PRESETS_${id.replace(/([a-z0-9])([A-Z])/g, "$1_$2").toUpperCase()}_API_KEY oder NUXT_TIPTAP_EDITOR_AI_API_KEY)`
|
|
13
|
-
},
|
|
14
|
-
rateLimit: ai.rateLimit
|
|
5
|
+
var editor_server_default = defineNitroPlugin((nitroApp) => {
|
|
6
|
+
let server;
|
|
7
|
+
nitroApp.hooks.hook("request", () => {
|
|
8
|
+
server ??= install();
|
|
15
9
|
});
|
|
10
|
+
function install() {
|
|
11
|
+
const { ai, rateLimit, collab } = useRuntimeConfig().tiptapEditor;
|
|
12
|
+
const ports = useEditorPorts();
|
|
13
|
+
return installEditorServer(nitroApp, {
|
|
14
|
+
ports,
|
|
15
|
+
collab: ports.collabState ? collab : false,
|
|
16
|
+
ai: {
|
|
17
|
+
...ai,
|
|
18
|
+
missingKeyHint: (id) => ` (NUXT_TIPTAP_EDITOR_AI_PRESETS_${id.replace(/([a-z0-9])([A-Z])/g, "$1_$2").toUpperCase()}_API_KEY oder NUXT_TIPTAP_EDITOR_AI_API_KEY)`
|
|
19
|
+
},
|
|
20
|
+
rateLimit,
|
|
21
|
+
schema: useEditorSchema()
|
|
22
|
+
});
|
|
23
|
+
}
|
|
16
24
|
});
|
|
17
25
|
//#endregion
|
|
18
26
|
export { editor_server_default as default };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"editor-server.js","names":[],"sources":["../../../../../src/nuxt/runtime/server/plugins/editor-server.ts"],"sourcesContent":["// Nitro's auto-imports are not applied to files under node_modules (the built package), so every Nitro/h3 helper is imported explicitly.\nimport { defineNitroPlugin, useRuntimeConfig } from 'nitropack/runtime'\nimport {
|
|
1
|
+
{"version":3,"file":"editor-server.js","names":[],"sources":["../../../../../src/nuxt/runtime/server/plugins/editor-server.ts"],"sourcesContent":["// Nitro's auto-imports are not applied to files under node_modules (the built package), so every Nitro/h3 helper is imported explicitly.\nimport { defineNitroPlugin, useRuntimeConfig } from 'nitropack/runtime'\nimport { type EditorServer, installEditorServer } from '../../../../adapters/nitro'\nimport type { EditorServerConfig } from '../../../../config'\nimport { useEditorPorts, useEditorSchema } from '../../../../server/host'\n\n// Mounts the editor's routes and the collaboration websocket (`installEditorServer`) over the ports the host registered\n// with `setEditorPorts()`, and takes the AI configuration (presets, keys, slots, transcription), the rate limit and\n// `collab.authenticateUpgrade` from the module's runtime config.\n//\n// The host registers its ports in a Nitro plugin of its own, and Nitro does not order plugins of different layers and\n// modules reliably; the first request is the first moment every plugin has run (the routes it served before this\n// were file-based and read the ports per request, too). A failed install is retried by the next request.\nexport default defineNitroPlugin((nitroApp) => {\n let server: EditorServer | undefined\n nitroApp.hooks.hook('request', () => {\n server ??= install()\n })\n\n function install(): EditorServer {\n // The module's `serverConfig(defineEditorConfig(options))`, with the host's runtime-config and env overrides applied.\n const { ai, rateLimit, collab } = useRuntimeConfig().tiptapEditor as EditorServerConfig\n const ports = useEditorPorts()\n return installEditorServer(nitroApp, {\n ports,\n // Without persisted collaboration state the editor runs without the websocket (documents still load and save over HTTP).\n collab: ports.collabState ? collab : false,\n // Env names use the preset id in upper snake case (`flashLite` → `FLASH_LITE`), like Nuxt's runtime config mapping.\n ai: { ...ai, missingKeyHint: id => ` (NUXT_TIPTAP_EDITOR_AI_PRESETS_${id.replace(/([a-z0-9])([A-Z])/g, '$1_$2').toUpperCase()}_API_KEY oder NUXT_TIPTAP_EDITOR_AI_API_KEY)` },\n rateLimit,\n schema: useEditorSchema(),\n })\n }\n})\n"],"mappings":";;;;AAaA,IAAA,wBAAe,mBAAmB,aAAa;CAC7C,IAAI;CACJ,SAAS,MAAM,KAAK,iBAAiB;EACnC,WAAW,QAAQ;CACrB,CAAC;CAED,SAAS,UAAwB;EAE/B,MAAM,EAAE,IAAI,WAAW,WAAW,iBAAiB,CAAC,CAAC;EACrD,MAAM,QAAQ,eAAe;EAC7B,OAAO,oBAAoB,UAAU;GACnC;GAEA,QAAQ,MAAM,cAAc,SAAS;GAErC,IAAI;IAAE,GAAG;IAAI,iBAAgB,OAAM,mCAAmC,GAAG,QAAQ,sBAAsB,OAAO,CAAC,CAAC,YAAY,EAAE;GAA8C;GAC5K;GACA,QAAQ,gBAAgB;EAC1B,CAAC;CACH;AACF,CAAC"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { EditorBackend } from "../core/backend.js";
|
|
2
|
+
import { EditorFeature, EditorPreset } from "../core/feature.js";
|
|
3
|
+
import { CommentsFeatureOptions } from "../features/comments/feature.js";
|
|
4
|
+
import { CompositeKind } from "../features/composites/kinds.js";
|
|
5
|
+
import { CompositeFeatureOptions } from "../features/composites/feature.js";
|
|
6
|
+
//#region src/presets/compose.d.ts
|
|
7
|
+
/** The id of a catalog feature (`CONTENT`, `INTERACTION`, `AI`) or of a host feature passed to `remove`. */
|
|
8
|
+
export type FeatureId = string;
|
|
9
|
+
/** How much document model the editor has: `basic` = `core-content`, `rich` = the full content catalog. */
|
|
10
|
+
export type ContentLevel = 'basic' | 'rich';
|
|
11
|
+
/** How much editing UX the editor has: `minimal` = `core-ui`, `full` = every interaction feature. */
|
|
12
|
+
export type InteractionLevel = 'minimal' | 'full';
|
|
13
|
+
/** The content features of each level, in canonical (schema) order. */
|
|
14
|
+
export declare const CONTENT: Record<ContentLevel, readonly FeatureId[]>;
|
|
15
|
+
/** The interaction features of each level, in canonical order. */
|
|
16
|
+
export declare const INTERACTION: Record<InteractionLevel, readonly FeatureId[]>;
|
|
17
|
+
/** The AI features (`ai: true`): the AI feature and the integrations that need it; each is installed when its `requires` are met. */
|
|
18
|
+
export declare const AI: readonly FeatureId[];
|
|
19
|
+
/**
|
|
20
|
+
* The features a UI layer binds, keyed by id; the other catalog features are framework-free and built here. The AI
|
|
21
|
+
* features are bound too, although `composite-ai` and `transcript-ai` have no components: the layer owns every import of
|
|
22
|
+
* `features/ai`, so a composition without `ai` binds none of them and its bundle holds no AI code. Each binding is a
|
|
23
|
+
* factory, called only for a feature the composition selects (`themes` reads the current Vue app when built, so
|
|
24
|
+
* unselected features are never built). `composites` receives the composition's `compositeKinds`, `comments` its
|
|
25
|
+
* `comments` options. `core-ui` takes no parameter here: the framework-free `simpleEditor()` has no command palette;
|
|
26
|
+
* a layer that has one (the `SimpleEditor` surfaces) builds `coreUiFeature({ palette })` itself.
|
|
27
|
+
*/
|
|
28
|
+
export interface UiBindings<C> {
|
|
29
|
+
'core-ui': () => EditorFeature<C>;
|
|
30
|
+
'media': () => EditorFeature<C>;
|
|
31
|
+
'transcript': () => EditorFeature<C>;
|
|
32
|
+
'composites': (options: CompositeFeatureOptions) => EditorFeature<C>;
|
|
33
|
+
'authors': () => EditorFeature<C>;
|
|
34
|
+
'comments': (options: CommentsFeatureOptions) => EditorFeature<C>;
|
|
35
|
+
'ai': () => EditorFeature<C>;
|
|
36
|
+
'composite-ai': () => EditorFeature<C>;
|
|
37
|
+
'transcript-ai': () => EditorFeature<C>;
|
|
38
|
+
'collab': () => EditorFeature<C>;
|
|
39
|
+
'block-ui': () => EditorFeature<C>;
|
|
40
|
+
'themes': () => EditorFeature<C>;
|
|
41
|
+
}
|
|
42
|
+
/** What `composeEditor` builds the editor from. */
|
|
43
|
+
export interface ComposeOptions<C> {
|
|
44
|
+
/** The document model: a level or the content feature ids to install (`core-content` is always installed). */
|
|
45
|
+
content: ContentLevel | readonly FeatureId[];
|
|
46
|
+
/** The editing UX: a level or the interaction feature ids (`core-ui` is installed with any non-empty list); `[]` = a viewer without any interaction feature. */
|
|
47
|
+
interaction: InteractionLevel | readonly FeatureId[];
|
|
48
|
+
/** Installs `ai` and every integration whose `requires` are met (composite-AI iff composites, transcript-AI iff transcript). */
|
|
49
|
+
ai: boolean;
|
|
50
|
+
/** The backend the editor runs on: features needing a capability it lacks are omitted. Absent = nothing is pruned by capability. */
|
|
51
|
+
backend?: EditorBackend;
|
|
52
|
+
/**
|
|
53
|
+
* The host supplies the collaboration session itself (the surface's `collaboration` prop, e.g. from its own Hocuspocus
|
|
54
|
+
* provider), so `collab` and `comments` need no `collaboration` capability from the backend. Only a backend that must
|
|
55
|
+
* open the collaboration (`useEditorDocument(id, { collaboration: true })`) has to offer it. Default `false`.
|
|
56
|
+
*/
|
|
57
|
+
collaboration?: boolean;
|
|
58
|
+
/** Host features, appended after the catalog in the given order. */
|
|
59
|
+
add?: readonly EditorFeature<C>[];
|
|
60
|
+
/** Features left out (catalog or host); features that require them are omitted as well. */
|
|
61
|
+
remove?: readonly FeatureId[];
|
|
62
|
+
/** The composite kinds („Bausteine“) offered in the editor (default: the built-in kinds); read once. */
|
|
63
|
+
compositeKinds?: readonly CompositeKind[];
|
|
64
|
+
/** Options of the comments feature, e.g. a host `model` (then comments need no `collab`). */
|
|
65
|
+
comments?: CommentsFeatureOptions;
|
|
66
|
+
}
|
|
67
|
+
/** The composed preset and the features that were selected but dropped, in composition order, with the reason. */
|
|
68
|
+
export interface ComposedEditor<C> extends EditorPreset<C> {
|
|
69
|
+
readonly omitted: readonly {
|
|
70
|
+
id: FeatureId;
|
|
71
|
+
reason: string;
|
|
72
|
+
}[];
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Composes an editor from three dimensions plus the backend's capabilities, over the UI bindings of a layer.
|
|
76
|
+
*
|
|
77
|
+
* The feature list is `content` + `interaction` (+ the AI features when `ai`) + `add`, minus `remove`. `core-content` is
|
|
78
|
+
* always part of it and `core-ui` of every non-empty interaction list. Features that require a missing feature, or a
|
|
79
|
+
* backend capability `options.backend` lacks, are dropped until the list is stable and reported in `omitted` (so
|
|
80
|
+
* `ai: true` over a backend without `ai` installs no AI and says why). The catalog features keep their canonical order
|
|
81
|
+
* (content, interaction, AI), host features follow in the order given; the result is validated by `defineEditor`.
|
|
82
|
+
* Throws when an id of `content` is not a content feature, an id of `interaction` not an interaction feature, an id
|
|
83
|
+
* names no catalog feature, `remove` names `core-content`, or a selected feature has no binding in `ui`.
|
|
84
|
+
*/
|
|
85
|
+
export declare function composeEditor<C>(ui: Partial<UiBindings<C>>, options: ComposeOptions<C>): ComposedEditor<C>;
|
|
86
|
+
/**
|
|
87
|
+
* The simple editor: `core-content` and `core-ui` (formatting, headings, lists, quotes, code, undo/redo). No backend, no AI,
|
|
88
|
+
* no collaboration, and no ⌘K command palette (`coreUiFeature()` gets no `palette` component here, the framework-free
|
|
89
|
+
* layer has none; the `SimpleEditor` components and the `composeEditor` of `/vue/advanced` and `/react/advanced` bind it).
|
|
90
|
+
* Component-free (`ComposedEditor<never>`), so both the Vue and the React surface accept it.
|
|
91
|
+
*/
|
|
92
|
+
export declare const simpleEditor: () => ComposedEditor<never>;
|
|
93
|
+
//#endregion
|
|
94
|
+
//# sourceMappingURL=compose.d.ts.map
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
import { defineEditor } from "../core/define-editor.js";
|
|
2
|
+
import { coreContentFeature, coreUiFeature } from "../core/core-feature.js";
|
|
3
|
+
import { CommentMark } from "../features/comments/schema.js";
|
|
4
|
+
import { mentionsFeature } from "../features/mentions/index.js";
|
|
5
|
+
import { tablesFeature } from "../features/tables/feature.js";
|
|
6
|
+
import { compositeMediaFeature } from "../integrations/composite-media/index.js";
|
|
7
|
+
//#region src/presets/compose.ts
|
|
8
|
+
/** The content features of each level, in canonical (schema) order. */
|
|
9
|
+
const CONTENT = {
|
|
10
|
+
basic: ["core-content"],
|
|
11
|
+
rich: [
|
|
12
|
+
"core-content",
|
|
13
|
+
"media",
|
|
14
|
+
"transcript",
|
|
15
|
+
"composites",
|
|
16
|
+
"mentions",
|
|
17
|
+
"authors",
|
|
18
|
+
"tables",
|
|
19
|
+
"composite-media"
|
|
20
|
+
]
|
|
21
|
+
};
|
|
22
|
+
/** The interaction features of each level, in canonical order. */
|
|
23
|
+
const INTERACTION = {
|
|
24
|
+
minimal: ["core-ui"],
|
|
25
|
+
full: [
|
|
26
|
+
"core-ui",
|
|
27
|
+
"collab",
|
|
28
|
+
"comments",
|
|
29
|
+
"block-ui",
|
|
30
|
+
"themes"
|
|
31
|
+
]
|
|
32
|
+
};
|
|
33
|
+
/** The AI features (`ai: true`): the AI feature and the integrations that need it; each is installed when its `requires` are met. */
|
|
34
|
+
const AI = [
|
|
35
|
+
"ai",
|
|
36
|
+
"composite-ai",
|
|
37
|
+
"transcript-ai"
|
|
38
|
+
];
|
|
39
|
+
/** Canonical feature order: content, interaction, AI. The composed feature list, its schema order and its toolbar order follow it. */
|
|
40
|
+
const CANONICAL = [
|
|
41
|
+
...CONTENT.rich,
|
|
42
|
+
...INTERACTION.full,
|
|
43
|
+
...AI
|
|
44
|
+
];
|
|
45
|
+
function fail(message) {
|
|
46
|
+
throw new Error(`@ecsplico/editor: composeEditor: ${message}`);
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Builds the catalog feature `id`. A framework binding the composition needs but `ui` lacks fails here, naming it.
|
|
50
|
+
* `ui` is partial on purpose: a host that never selects a feature (a viewer has no `block-ui`) binds only the rest, so
|
|
51
|
+
* the bundle holds no code of the others.
|
|
52
|
+
*/
|
|
53
|
+
function build(id, ui, options) {
|
|
54
|
+
const bound = (key) => ui[key] ?? fail(`no UI binding for feature "${key}"`);
|
|
55
|
+
switch (id) {
|
|
56
|
+
case "core-content": return coreContentFeature();
|
|
57
|
+
case "mentions": return mentionsFeature();
|
|
58
|
+
case "tables": return tablesFeature();
|
|
59
|
+
case "composite-media": return compositeMediaFeature();
|
|
60
|
+
case "core-ui": return bound("core-ui")();
|
|
61
|
+
case "composite-ai": return bound("composite-ai")();
|
|
62
|
+
case "transcript-ai": return bound("transcript-ai")();
|
|
63
|
+
case "media": return bound("media")();
|
|
64
|
+
case "transcript": return bound("transcript")();
|
|
65
|
+
case "composites": return bound("composites")(options.compositeKinds ? { kinds: options.compositeKinds } : {});
|
|
66
|
+
case "authors": return bound("authors")();
|
|
67
|
+
case "comments": return bound("comments")(options.comments ?? {});
|
|
68
|
+
case "ai": return bound("ai")();
|
|
69
|
+
case "collab": return bound("collab")();
|
|
70
|
+
case "block-ui": return bound("block-ui")();
|
|
71
|
+
case "themes": return bound("themes")();
|
|
72
|
+
default: return fail(`unknown catalog feature "${id}" (host features go in \`add\`)`);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
/** Why `feature` cannot stay in a composition holding `ids` over `backend`, or `undefined`. A host session satisfies `collaboration`. */
|
|
76
|
+
function unmet(feature, ids, options) {
|
|
77
|
+
const { backend } = options;
|
|
78
|
+
for (const capability of feature.backend ?? []) {
|
|
79
|
+
if (capability === "collaboration" && options.collaboration) continue;
|
|
80
|
+
if (backend && backend[capability] === void 0) return `backend "${backend.name}" lacks "${capability}"`;
|
|
81
|
+
}
|
|
82
|
+
for (const required of feature.requires ?? []) if (!ids.has(required)) return `requires "${required}"`;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* The comment mark is part of the document model (stored documents carry it), but only the `comments` feature brings it.
|
|
86
|
+
* A composition that keeps `authors` (every rich one) yet has no `comments` (a viewer, a backend without collaboration,
|
|
87
|
+
* `remove`) gets the mark through `authors`, inert there, so such documents still load. The catalog is the one place
|
|
88
|
+
* that may couple the two features; each stays importable on its own.
|
|
89
|
+
*/
|
|
90
|
+
function withCommentMark(features) {
|
|
91
|
+
if (features.some((feature) => feature.id === "comments")) return [...features];
|
|
92
|
+
return features.map((feature) => feature.id !== "authors" ? feature : {
|
|
93
|
+
...feature,
|
|
94
|
+
schemaExtensions: () => [...feature.schemaExtensions?.() ?? [], CommentMark],
|
|
95
|
+
extensions: (ctx) => [...feature.extensions?.(ctx) ?? [], CommentMark]
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Composes an editor from three dimensions plus the backend's capabilities, over the UI bindings of a layer.
|
|
100
|
+
*
|
|
101
|
+
* The feature list is `content` + `interaction` (+ the AI features when `ai`) + `add`, minus `remove`. `core-content` is
|
|
102
|
+
* always part of it and `core-ui` of every non-empty interaction list. Features that require a missing feature, or a
|
|
103
|
+
* backend capability `options.backend` lacks, are dropped until the list is stable and reported in `omitted` (so
|
|
104
|
+
* `ai: true` over a backend without `ai` installs no AI and says why). The catalog features keep their canonical order
|
|
105
|
+
* (content, interaction, AI), host features follow in the order given; the result is validated by `defineEditor`.
|
|
106
|
+
* Throws when an id of `content` is not a content feature, an id of `interaction` not an interaction feature, an id
|
|
107
|
+
* names no catalog feature, `remove` names `core-content`, or a selected feature has no binding in `ui`.
|
|
108
|
+
*/
|
|
109
|
+
function composeEditor(ui, options) {
|
|
110
|
+
if (options.remove?.includes("core-content")) fail("\"core-content\" cannot be removed");
|
|
111
|
+
const removed = new Set(options.remove ?? []);
|
|
112
|
+
const catalog = /* @__PURE__ */ new Map();
|
|
113
|
+
const select = (ids, dimension) => {
|
|
114
|
+
for (const id of ids) {
|
|
115
|
+
if (removed.has(id) || catalog.has(id)) continue;
|
|
116
|
+
const feature = build(id, ui, options);
|
|
117
|
+
if (feature.dimension !== dimension) fail(`"${id}" is not ${dimension === "ai" ? "an AI" : `a${dimension === "interaction" ? "n" : ""} ${dimension}`} feature`);
|
|
118
|
+
catalog.set(id, feature);
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
const content = typeof options.content === "string" ? CONTENT[options.content] : options.content;
|
|
122
|
+
const interaction = typeof options.interaction === "string" ? INTERACTION[options.interaction] : options.interaction;
|
|
123
|
+
select(["core-content", ...content], "content");
|
|
124
|
+
select(interaction.length ? ["core-ui", ...interaction] : [], "interaction");
|
|
125
|
+
select(options.ai ? AI : [], "ai");
|
|
126
|
+
const all = [...[...catalog.values()].sort((a, b) => CANONICAL.indexOf(a.id) - CANONICAL.indexOf(b.id)), ...(options.add ?? []).filter((feature) => !removed.has(feature.id))];
|
|
127
|
+
const reasons = /* @__PURE__ */ new Map();
|
|
128
|
+
let alive = all;
|
|
129
|
+
for (;;) {
|
|
130
|
+
const ids = new Set(alive.map((feature) => feature.id));
|
|
131
|
+
const dropped = /* @__PURE__ */ new Map();
|
|
132
|
+
for (const feature of alive) {
|
|
133
|
+
const reason = unmet(feature, ids, options);
|
|
134
|
+
if (reason) dropped.set(feature.id, reason);
|
|
135
|
+
}
|
|
136
|
+
if (!dropped.size) break;
|
|
137
|
+
for (const [id, reason] of dropped) reasons.set(id, reason);
|
|
138
|
+
alive = alive.filter((feature) => !dropped.has(feature.id));
|
|
139
|
+
}
|
|
140
|
+
const preset = defineEditor({ features: withCommentMark(alive) });
|
|
141
|
+
const omitted = all.flatMap((feature) => reasons.has(feature.id) ? [{
|
|
142
|
+
id: feature.id,
|
|
143
|
+
reason: reasons.get(feature.id)
|
|
144
|
+
}] : []);
|
|
145
|
+
return Object.freeze({
|
|
146
|
+
...preset,
|
|
147
|
+
omitted: Object.freeze(omitted)
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* The simple editor: `core-content` and `core-ui` (formatting, headings, lists, quotes, code, undo/redo). No backend, no AI,
|
|
152
|
+
* no collaboration, and no ⌘K command palette (`coreUiFeature()` gets no `palette` component here, the framework-free
|
|
153
|
+
* layer has none; the `SimpleEditor` components and the `composeEditor` of `/vue/advanced` and `/react/advanced` bind it).
|
|
154
|
+
* Component-free (`ComposedEditor<never>`), so both the Vue and the React surface accept it.
|
|
155
|
+
*/
|
|
156
|
+
const simpleEditor = () => composeEditor({ "core-ui": coreUiFeature }, {
|
|
157
|
+
content: "basic",
|
|
158
|
+
interaction: "minimal",
|
|
159
|
+
ai: false
|
|
160
|
+
});
|
|
161
|
+
//#endregion
|
|
162
|
+
export { AI, CONTENT, INTERACTION, composeEditor, simpleEditor };
|
|
163
|
+
|
|
164
|
+
//# sourceMappingURL=compose.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compose.js","names":[],"sources":["../../src/presets/compose.ts"],"sourcesContent":["import type { EditorBackend } from '../core/backend'\nimport { coreContentFeature, coreUiFeature } from '../core/core-feature'\nimport { defineEditor } from '../core/define-editor'\nimport type { EditorFeature, EditorPreset } from '../core/feature'\nimport type { CommentsFeatureOptions } from '../features/comments/feature'\nimport { CommentMark } from '../features/comments/schema'\nimport type { CompositeFeatureOptions } from '../features/composites/feature'\nimport type { CompositeKind } from '../features/composites/kinds'\nimport { mentionsFeature } from '../features/mentions'\nimport { tablesFeature } from '../features/tables'\nimport { compositeMediaFeature } from '../integrations/composite-media'\n\n/** The id of a catalog feature (`CONTENT`, `INTERACTION`, `AI`) or of a host feature passed to `remove`. */\nexport type FeatureId = string\n\n/** How much document model the editor has: `basic` = `core-content`, `rich` = the full content catalog. */\nexport type ContentLevel = 'basic' | 'rich'\n\n/** How much editing UX the editor has: `minimal` = `core-ui`, `full` = every interaction feature. */\nexport type InteractionLevel = 'minimal' | 'full'\n\n/** The content features of each level, in canonical (schema) order. */\nexport const CONTENT: Record<ContentLevel, readonly FeatureId[]> = {\n basic: ['core-content'],\n rich: ['core-content', 'media', 'transcript', 'composites', 'mentions', 'authors', 'tables', 'composite-media'],\n}\n\n/** The interaction features of each level, in canonical order. */\nexport const INTERACTION: Record<InteractionLevel, readonly FeatureId[]> = {\n minimal: ['core-ui'],\n full: ['core-ui', 'collab', 'comments', 'block-ui', 'themes'],\n}\n\n/** The AI features (`ai: true`): the AI feature and the integrations that need it; each is installed when its `requires` are met. */\nexport const AI: readonly FeatureId[] = ['ai', 'composite-ai', 'transcript-ai']\n\n/** Canonical feature order: content, interaction, AI. The composed feature list, its schema order and its toolbar order follow it. */\nconst CANONICAL: readonly FeatureId[] = [...CONTENT.rich, ...INTERACTION.full, ...AI]\n\n/**\n * The features a UI layer binds, keyed by id; the other catalog features are framework-free and built here. The AI\n * features are bound too, although `composite-ai` and `transcript-ai` have no components: the layer owns every import of\n * `features/ai`, so a composition without `ai` binds none of them and its bundle holds no AI code. Each binding is a\n * factory, called only for a feature the composition selects (`themes` reads the current Vue app when built, so\n * unselected features are never built). `composites` receives the composition's `compositeKinds`, `comments` its\n * `comments` options. `core-ui` takes no parameter here: the framework-free `simpleEditor()` has no command palette;\n * a layer that has one (the `SimpleEditor` surfaces) builds `coreUiFeature({ palette })` itself.\n */\nexport interface UiBindings<C> {\n 'core-ui': () => EditorFeature<C>\n 'media': () => EditorFeature<C>\n 'transcript': () => EditorFeature<C>\n 'composites': (options: CompositeFeatureOptions) => EditorFeature<C>\n 'authors': () => EditorFeature<C>\n 'comments': (options: CommentsFeatureOptions) => EditorFeature<C>\n 'ai': () => EditorFeature<C>\n 'composite-ai': () => EditorFeature<C>\n 'transcript-ai': () => EditorFeature<C>\n 'collab': () => EditorFeature<C>\n 'block-ui': () => EditorFeature<C>\n 'themes': () => EditorFeature<C>\n}\n\n/** What `composeEditor` builds the editor from. */\nexport interface ComposeOptions<C> {\n /** The document model: a level or the content feature ids to install (`core-content` is always installed). */\n content: ContentLevel | readonly FeatureId[]\n /** The editing UX: a level or the interaction feature ids (`core-ui` is installed with any non-empty list); `[]` = a viewer without any interaction feature. */\n interaction: InteractionLevel | readonly FeatureId[]\n /** Installs `ai` and every integration whose `requires` are met (composite-AI iff composites, transcript-AI iff transcript). */\n ai: boolean\n /** The backend the editor runs on: features needing a capability it lacks are omitted. Absent = nothing is pruned by capability. */\n backend?: EditorBackend\n /**\n * The host supplies the collaboration session itself (the surface's `collaboration` prop, e.g. from its own Hocuspocus\n * provider), so `collab` and `comments` need no `collaboration` capability from the backend. Only a backend that must\n * open the collaboration (`useEditorDocument(id, { collaboration: true })`) has to offer it. Default `false`.\n */\n collaboration?: boolean\n /** Host features, appended after the catalog in the given order. */\n add?: readonly EditorFeature<C>[]\n /** Features left out (catalog or host); features that require them are omitted as well. */\n remove?: readonly FeatureId[]\n /** The composite kinds („Bausteine“) offered in the editor (default: the built-in kinds); read once. */\n compositeKinds?: readonly CompositeKind[]\n /** Options of the comments feature, e.g. a host `model` (then comments need no `collab`). */\n comments?: CommentsFeatureOptions\n}\n\n/** The composed preset and the features that were selected but dropped, in composition order, with the reason. */\nexport interface ComposedEditor<C> extends EditorPreset<C> {\n readonly omitted: readonly { id: FeatureId, reason: string }[]\n}\n\nfunction fail(message: string): never {\n throw new Error(`@ecsplico/editor: composeEditor: ${message}`)\n}\n\n/**\n * Builds the catalog feature `id`. A framework binding the composition needs but `ui` lacks fails here, naming it.\n * `ui` is partial on purpose: a host that never selects a feature (a viewer has no `block-ui`) binds only the rest, so\n * the bundle holds no code of the others.\n */\nfunction build<C>(id: FeatureId, ui: Partial<UiBindings<C>>, options: ComposeOptions<C>): EditorFeature<C> {\n const bound = <K extends keyof UiBindings<C>>(key: K): UiBindings<C>[K] => ui[key] ?? fail(`no UI binding for feature \"${key}\"`)\n switch (id) {\n case 'core-content': return coreContentFeature()\n case 'mentions': return mentionsFeature()\n case 'tables': return tablesFeature()\n case 'composite-media': return compositeMediaFeature()\n case 'core-ui': return bound('core-ui')()\n case 'composite-ai': return bound('composite-ai')()\n case 'transcript-ai': return bound('transcript-ai')()\n case 'media': return bound('media')()\n case 'transcript': return bound('transcript')()\n case 'composites': return bound('composites')(options.compositeKinds ? { kinds: options.compositeKinds } : {})\n case 'authors': return bound('authors')()\n case 'comments': return bound('comments')(options.comments ?? {})\n case 'ai': return bound('ai')()\n case 'collab': return bound('collab')()\n case 'block-ui': return bound('block-ui')()\n case 'themes': return bound('themes')()\n default: return fail(`unknown catalog feature \"${id}\" (host features go in \\`add\\`)`)\n }\n}\n\n/** Why `feature` cannot stay in a composition holding `ids` over `backend`, or `undefined`. A host session satisfies `collaboration`. */\nfunction unmet(feature: Pick<EditorFeature, 'backend' | 'requires'>, ids: ReadonlySet<FeatureId>, options: Pick<ComposeOptions<unknown>, 'backend' | 'collaboration'>): string | undefined {\n const { backend } = options\n for (const capability of feature.backend ?? []) {\n if (capability === 'collaboration' && options.collaboration) continue\n if (backend && backend[capability] === undefined) return `backend \"${backend.name}\" lacks \"${capability}\"`\n }\n for (const required of feature.requires ?? []) {\n if (!ids.has(required)) return `requires \"${required}\"`\n }\n return undefined\n}\n\n/**\n * The comment mark is part of the document model (stored documents carry it), but only the `comments` feature brings it.\n * A composition that keeps `authors` (every rich one) yet has no `comments` (a viewer, a backend without collaboration,\n * `remove`) gets the mark through `authors`, inert there, so such documents still load. The catalog is the one place\n * that may couple the two features; each stays importable on its own.\n */\nfunction withCommentMark<C>(features: readonly EditorFeature<C>[]): EditorFeature<C>[] {\n if (features.some(feature => feature.id === 'comments')) return [...features]\n return features.map(feature => feature.id !== 'authors'\n ? feature\n : {\n ...feature,\n schemaExtensions: () => [...(feature.schemaExtensions?.() ?? []), CommentMark],\n extensions: ctx => [...(feature.extensions?.(ctx) ?? []), CommentMark],\n })\n}\n\n/**\n * Composes an editor from three dimensions plus the backend's capabilities, over the UI bindings of a layer.\n *\n * The feature list is `content` + `interaction` (+ the AI features when `ai`) + `add`, minus `remove`. `core-content` is\n * always part of it and `core-ui` of every non-empty interaction list. Features that require a missing feature, or a\n * backend capability `options.backend` lacks, are dropped until the list is stable and reported in `omitted` (so\n * `ai: true` over a backend without `ai` installs no AI and says why). The catalog features keep their canonical order\n * (content, interaction, AI), host features follow in the order given; the result is validated by `defineEditor`.\n * Throws when an id of `content` is not a content feature, an id of `interaction` not an interaction feature, an id\n * names no catalog feature, `remove` names `core-content`, or a selected feature has no binding in `ui`.\n */\nexport function composeEditor<C>(ui: Partial<UiBindings<C>>, options: ComposeOptions<C>): ComposedEditor<C> {\n if (options.remove?.includes('core-content')) fail('\"core-content\" cannot be removed')\n const removed = new Set(options.remove ?? [])\n const catalog = new Map<FeatureId, EditorFeature<C>>()\n const select = (ids: readonly FeatureId[], dimension: 'content' | 'interaction' | 'ai') => {\n for (const id of ids) {\n if (removed.has(id) || catalog.has(id)) continue\n const feature = build(id, ui, options)\n if (feature.dimension !== dimension) fail(`\"${id}\" is not ${dimension === 'ai' ? 'an AI' : `a${dimension === 'interaction' ? 'n' : ''} ${dimension}`} feature`)\n catalog.set(id, feature)\n }\n }\n const content = typeof options.content === 'string' ? CONTENT[options.content] : options.content\n const interaction = typeof options.interaction === 'string' ? INTERACTION[options.interaction] : options.interaction\n select(['core-content', ...content], 'content')\n select(interaction.length ? ['core-ui', ...interaction] : [], 'interaction')\n select(options.ai ? AI : [], 'ai')\n\n const ordered = [...catalog.values()].sort((a, b) => CANONICAL.indexOf(a.id) - CANONICAL.indexOf(b.id))\n const all: EditorFeature<C>[] = [...ordered, ...(options.add ?? []).filter(feature => !removed.has(feature.id))]\n\n const reasons = new Map<FeatureId, string>()\n let alive = all\n for (;;) {\n const ids = new Set(alive.map(feature => feature.id))\n const dropped = new Map<FeatureId, string>()\n for (const feature of alive) {\n const reason = unmet(feature, ids, options)\n if (reason) dropped.set(feature.id, reason)\n }\n if (!dropped.size) break\n for (const [id, reason] of dropped) reasons.set(id, reason)\n alive = alive.filter(feature => !dropped.has(feature.id))\n }\n\n const preset = defineEditor({ features: withCommentMark(alive) })\n const omitted = all.flatMap(feature => reasons.has(feature.id) ? [{ id: feature.id, reason: reasons.get(feature.id)! }] : [])\n return Object.freeze({ ...preset, omitted: Object.freeze(omitted) })\n}\n\n/**\n * The simple editor: `core-content` and `core-ui` (formatting, headings, lists, quotes, code, undo/redo). No backend, no AI,\n * no collaboration, and no ⌘K command palette (`coreUiFeature()` gets no `palette` component here, the framework-free\n * layer has none; the `SimpleEditor` components and the `composeEditor` of `/vue/advanced` and `/react/advanced` bind it).\n * Component-free (`ComposedEditor<never>`), so both the Vue and the React surface accept it.\n */\nexport const simpleEditor = (): ComposedEditor<never> => composeEditor<never>({ 'core-ui': coreUiFeature }, { content: 'basic', interaction: 'minimal', ai: false })\n"],"mappings":";;;;;;;;AAsBA,MAAa,UAAsD;CACjE,OAAO,CAAC,cAAc;CACtB,MAAM;EAAC;EAAgB;EAAS;EAAc;EAAc;EAAY;EAAW;EAAU;CAAiB;AAChH;;AAGA,MAAa,cAA8D;CACzE,SAAS,CAAC,SAAS;CACnB,MAAM;EAAC;EAAW;EAAU;EAAY;EAAY;CAAQ;AAC9D;;AAGA,MAAa,KAA2B;CAAC;CAAM;CAAgB;AAAe;;AAG9E,MAAM,YAAkC;CAAC,GAAG,QAAQ;CAAM,GAAG,YAAY;CAAM,GAAG;AAAE;AAyDpF,SAAS,KAAK,SAAwB;CACpC,MAAM,IAAI,MAAM,oCAAoC,SAAS;AAC/D;;;;;;AAOA,SAAS,MAAS,IAAe,IAA4B,SAA8C;CACzG,MAAM,SAAwC,QAA6B,GAAG,QAAQ,KAAK,8BAA8B,IAAI,EAAE;CAC/H,QAAQ,IAAR;EACE,KAAK,gBAAgB,OAAO,mBAAmB;EAC/C,KAAK,YAAY,OAAO,gBAAgB;EACxC,KAAK,UAAU,OAAO,cAAc;EACpC,KAAK,mBAAmB,OAAO,sBAAsB;EACrD,KAAK,WAAW,OAAO,MAAM,SAAS,CAAC,CAAC;EACxC,KAAK,gBAAgB,OAAO,MAAM,cAAc,CAAC,CAAC;EAClD,KAAK,iBAAiB,OAAO,MAAM,eAAe,CAAC,CAAC;EACpD,KAAK,SAAS,OAAO,MAAM,OAAO,CAAC,CAAC;EACpC,KAAK,cAAc,OAAO,MAAM,YAAY,CAAC,CAAC;EAC9C,KAAK,cAAc,OAAO,MAAM,YAAY,CAAC,CAAC,QAAQ,iBAAiB,EAAE,OAAO,QAAQ,eAAe,IAAI,CAAC,CAAC;EAC7G,KAAK,WAAW,OAAO,MAAM,SAAS,CAAC,CAAC;EACxC,KAAK,YAAY,OAAO,MAAM,UAAU,CAAC,CAAC,QAAQ,YAAY,CAAC,CAAC;EAChE,KAAK,MAAM,OAAO,MAAM,IAAI,CAAC,CAAC;EAC9B,KAAK,UAAU,OAAO,MAAM,QAAQ,CAAC,CAAC;EACtC,KAAK,YAAY,OAAO,MAAM,UAAU,CAAC,CAAC;EAC1C,KAAK,UAAU,OAAO,MAAM,QAAQ,CAAC,CAAC;EACtC,SAAS,OAAO,KAAK,4BAA4B,GAAG,gCAAgC;CACtF;AACF;;AAGA,SAAS,MAAM,SAAsD,KAA6B,SAAyF;CACzL,MAAM,EAAE,YAAY;CACpB,KAAK,MAAM,cAAc,QAAQ,WAAW,CAAC,GAAG;EAC9C,IAAI,eAAe,mBAAmB,QAAQ,eAAe;EAC7D,IAAI,WAAW,QAAQ,gBAAgB,KAAA,GAAW,OAAO,YAAY,QAAQ,KAAK,WAAW,WAAW;CAC1G;CACA,KAAK,MAAM,YAAY,QAAQ,YAAY,CAAC,GAC1C,IAAI,CAAC,IAAI,IAAI,QAAQ,GAAG,OAAO,aAAa,SAAS;AAGzD;;;;;;;AAQA,SAAS,gBAAmB,UAA2D;CACrF,IAAI,SAAS,MAAK,YAAW,QAAQ,OAAO,UAAU,GAAG,OAAO,CAAC,GAAG,QAAQ;CAC5E,OAAO,SAAS,KAAI,YAAW,QAAQ,OAAO,YAC1C,UACA;EACE,GAAG;EACH,wBAAwB,CAAC,GAAI,QAAQ,mBAAmB,KAAK,CAAC,GAAI,WAAW;EAC7E,aAAY,QAAO,CAAC,GAAI,QAAQ,aAAa,GAAG,KAAK,CAAC,GAAI,WAAW;CACvE,CAAC;AACP;;;;;;;;;;;;AAaA,SAAgB,cAAiB,IAA4B,SAA+C;CAC1G,IAAI,QAAQ,QAAQ,SAAS,cAAc,GAAG,KAAK,oCAAkC;CACrF,MAAM,UAAU,IAAI,IAAI,QAAQ,UAAU,CAAC,CAAC;CAC5C,MAAM,0BAAU,IAAI,IAAiC;CACrD,MAAM,UAAU,KAA2B,cAAgD;EACzF,KAAK,MAAM,MAAM,KAAK;GACpB,IAAI,QAAQ,IAAI,EAAE,KAAK,QAAQ,IAAI,EAAE,GAAG;GACxC,MAAM,UAAU,MAAM,IAAI,IAAI,OAAO;GACrC,IAAI,QAAQ,cAAc,WAAW,KAAK,IAAI,GAAG,WAAW,cAAc,OAAO,UAAU,IAAI,cAAc,gBAAgB,MAAM,GAAG,GAAG,YAAY,SAAS;GAC9J,QAAQ,IAAI,IAAI,OAAO;EACzB;CACF;CACA,MAAM,UAAU,OAAO,QAAQ,YAAY,WAAW,QAAQ,QAAQ,WAAW,QAAQ;CACzF,MAAM,cAAc,OAAO,QAAQ,gBAAgB,WAAW,YAAY,QAAQ,eAAe,QAAQ;CACzG,OAAO,CAAC,gBAAgB,GAAG,OAAO,GAAG,SAAS;CAC9C,OAAO,YAAY,SAAS,CAAC,WAAW,GAAG,WAAW,IAAI,CAAC,GAAG,aAAa;CAC3E,OAAO,QAAQ,KAAK,KAAK,CAAC,GAAG,IAAI;CAGjC,MAAM,MAA0B,CAAC,GADjB,CAAC,GAAG,QAAQ,OAAO,CAAC,CAAC,CAAC,MAAM,GAAG,MAAM,UAAU,QAAQ,EAAE,EAAE,IAAI,UAAU,QAAQ,EAAE,EAAE,CAC3D,GAAG,IAAI,QAAQ,OAAO,CAAC,EAAA,CAAG,QAAO,YAAW,CAAC,QAAQ,IAAI,QAAQ,EAAE,CAAC,CAAC;CAE/G,MAAM,0BAAU,IAAI,IAAuB;CAC3C,IAAI,QAAQ;CACZ,SAAS;EACP,MAAM,MAAM,IAAI,IAAI,MAAM,KAAI,YAAW,QAAQ,EAAE,CAAC;EACpD,MAAM,0BAAU,IAAI,IAAuB;EAC3C,KAAK,MAAM,WAAW,OAAO;GAC3B,MAAM,SAAS,MAAM,SAAS,KAAK,OAAO;GAC1C,IAAI,QAAQ,QAAQ,IAAI,QAAQ,IAAI,MAAM;EAC5C;EACA,IAAI,CAAC,QAAQ,MAAM;EACnB,KAAK,MAAM,CAAC,IAAI,WAAW,SAAS,QAAQ,IAAI,IAAI,MAAM;EAC1D,QAAQ,MAAM,QAAO,YAAW,CAAC,QAAQ,IAAI,QAAQ,EAAE,CAAC;CAC1D;CAEA,MAAM,SAAS,aAAa,EAAE,UAAU,gBAAgB,KAAK,EAAE,CAAC;CAChE,MAAM,UAAU,IAAI,SAAQ,YAAW,QAAQ,IAAI,QAAQ,EAAE,IAAI,CAAC;EAAE,IAAI,QAAQ;EAAI,QAAQ,QAAQ,IAAI,QAAQ,EAAE;CAAG,CAAC,IAAI,CAAC,CAAC;CAC5H,OAAO,OAAO,OAAO;EAAE,GAAG;EAAQ,SAAS,OAAO,OAAO,OAAO;CAAE,CAAC;AACrE;;;;;;;AAQA,MAAa,qBAA4C,cAAqB,EAAE,WAAW,cAAc,GAAG;CAAE,SAAS;CAAS,aAAa;CAAW,IAAI;AAAM,CAAC"}
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { CompositeKind } from "../features/composites/kinds.js";
|
|
1
|
+
import { ComposedEditorHandle, ComposedEditorProps } from "./composed-surface.js";
|
|
3
2
|
//#region src/react/AdvancedEditor.d.ts
|
|
4
3
|
/**
|
|
5
4
|
* Props of the advanced editor: the surface's own (collaboration session or standalone `value`/`onChange`, metadata,
|
|
6
|
-
* abilities, extensions, block actions,
|
|
7
|
-
*
|
|
8
|
-
*
|
|
5
|
+
* abilities, extensions, block actions, commands, `documentId`, `editable`, `settingsUi`, the open state of the sidebar
|
|
6
|
+
* and comments margin, `onReady` and the other callbacks) except the preset, plus the composition: `content`,
|
|
7
|
+
* `interaction`, `ai`, `add`, `remove`, `backend` and the composite kinds. The defaults are the advanced editor's:
|
|
8
|
+
* `content: 'rich'`, `interaction: 'full'`, `ai: true`.
|
|
9
9
|
*/
|
|
10
|
-
export
|
|
11
|
-
/** Composite kinds („Bausteine“) offered in the editor (default: `defaultCompositeKinds(t)`); read once at mount. */
|
|
12
|
-
compositeKinds?: readonly CompositeKind[];
|
|
13
|
-
}
|
|
10
|
+
export type AdvancedEditorProps = ComposedEditorProps;
|
|
14
11
|
/**
|
|
15
|
-
* The advanced editor on the React surface: `
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
12
|
+
* The advanced editor on the React surface: `composeEditor({ content: 'rich', interaction: 'full', ai: true })` mounted
|
|
13
|
+
* through `EditorSurface`; every dimension is overridable by its prop, and the backend (default: the editor context's)
|
|
14
|
+
* prunes what it cannot serve. The ref's `preset` is the composed preset (`omitted` lists the dropped features). The
|
|
15
|
+
* composition is fixed at mount like the kinds it is built from; hosts remount (`key`) to change it. Place
|
|
16
|
+
* `EditorToolbar` and, with `settingsUi: 'external'`, `EditorSettingsModal`/`EditorSettingsPanel` beside it and give
|
|
17
|
+
* them the editor from `onReady`; `useEditorUi(editor)` reaches the chrome of a ready editor. Collaboration is active
|
|
18
|
+
* only when a `collaboration` session is passed; mount `Toaster` once for notices.
|
|
20
19
|
*/
|
|
21
|
-
export declare const AdvancedEditor: import("react").ForwardRefExoticComponent<
|
|
20
|
+
export declare const AdvancedEditor: import("react").ForwardRefExoticComponent<ComposedEditorProps & import("react").RefAttributes<ComposedEditorHandle>>;
|
|
22
21
|
//#endregion
|
|
22
|
+
export type { ComposedEditorHandle as AdvancedEditorHandle };
|
|
23
23
|
//# sourceMappingURL=AdvancedEditor.d.ts.map
|