@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/react/simple.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { SimpleEditor, SimpleEditorProps } from "./SimpleEditor.js";
|
|
2
|
-
export { SimpleEditor, type SimpleEditorProps };
|
|
1
|
+
import { SimpleEditor, SimpleEditorHandle, SimpleEditorProps } from "./SimpleEditor.js";
|
|
2
|
+
export { SimpleEditor, type SimpleEditorHandle, type SimpleEditorProps };
|
package/dist/react/ui/command.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { cn } from "./utils.js";
|
|
2
|
+
import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle } from "./dialog.js";
|
|
2
3
|
import { InputGroup, InputGroupAddon } from "./input-group.js";
|
|
3
4
|
import "react";
|
|
4
5
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -12,6 +13,19 @@ function Command$1({ className, ...props }) {
|
|
|
12
13
|
...props
|
|
13
14
|
});
|
|
14
15
|
}
|
|
16
|
+
function CommandDialog({ title = "Command Palette", description = "Search for a command to run...", children, className, showCloseButton = false, ...props }) {
|
|
17
|
+
return /* @__PURE__ */ jsxs(Dialog, {
|
|
18
|
+
...props,
|
|
19
|
+
children: [/* @__PURE__ */ jsxs(DialogHeader, {
|
|
20
|
+
className: "sr-only",
|
|
21
|
+
children: [/* @__PURE__ */ jsx(DialogTitle, { children: title }), /* @__PURE__ */ jsx(DialogDescription, { children: description })]
|
|
22
|
+
}), /* @__PURE__ */ jsx(DialogContent, {
|
|
23
|
+
className: cn("top-1/3 translate-y-0 overflow-hidden rounded-xl! p-0", className),
|
|
24
|
+
showCloseButton,
|
|
25
|
+
children
|
|
26
|
+
})]
|
|
27
|
+
});
|
|
28
|
+
}
|
|
15
29
|
function CommandInput({ className, ...props }) {
|
|
16
30
|
return /* @__PURE__ */ jsx("div", {
|
|
17
31
|
"data-slot": "command-input-wrapper",
|
|
@@ -33,6 +47,20 @@ function CommandList({ className, ...props }) {
|
|
|
33
47
|
...props
|
|
34
48
|
});
|
|
35
49
|
}
|
|
50
|
+
function CommandEmpty({ className, ...props }) {
|
|
51
|
+
return /* @__PURE__ */ jsx(Command.Empty, {
|
|
52
|
+
"data-slot": "command-empty",
|
|
53
|
+
className: cn("py-6 text-center text-sm", className),
|
|
54
|
+
...props
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
function CommandGroup({ className, ...props }) {
|
|
58
|
+
return /* @__PURE__ */ jsx(Command.Group, {
|
|
59
|
+
"data-slot": "command-group",
|
|
60
|
+
className: cn("overflow-hidden p-1 text-foreground **:[[cmdk-group-heading]]:px-2 **:[[cmdk-group-heading]]:py-1.5 **:[[cmdk-group-heading]]:text-xs **:[[cmdk-group-heading]]:font-medium **:[[cmdk-group-heading]]:text-muted-foreground", className),
|
|
61
|
+
...props
|
|
62
|
+
});
|
|
63
|
+
}
|
|
36
64
|
function CommandItem({ className, children, ...props }) {
|
|
37
65
|
return /* @__PURE__ */ jsxs(Command.Item, {
|
|
38
66
|
"data-slot": "command-item",
|
|
@@ -41,7 +69,14 @@ function CommandItem({ className, children, ...props }) {
|
|
|
41
69
|
children: [children, /* @__PURE__ */ jsx(CheckIcon, { className: "ml-auto opacity-0 group-has-data-[slot=command-shortcut]/command-item:hidden group-data-[checked=true]/command-item:opacity-100" })]
|
|
42
70
|
});
|
|
43
71
|
}
|
|
72
|
+
function CommandShortcut({ className, ...props }) {
|
|
73
|
+
return /* @__PURE__ */ jsx("span", {
|
|
74
|
+
"data-slot": "command-shortcut",
|
|
75
|
+
className: cn("ml-auto text-xs tracking-widest text-muted-foreground group-data-selected/command-item:text-foreground", className),
|
|
76
|
+
...props
|
|
77
|
+
});
|
|
78
|
+
}
|
|
44
79
|
//#endregion
|
|
45
|
-
export { Command$1 as Command, CommandInput, CommandItem, CommandList };
|
|
80
|
+
export { Command$1 as Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandShortcut };
|
|
46
81
|
|
|
47
82
|
//# sourceMappingURL=command.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command.js","names":["Command","CommandPrimitive"],"sources":["../../../src/react/ui/command.tsx"],"sourcesContent":["import * as React from \"react\"\nimport { Command as CommandPrimitive } from \"cmdk\"\nimport { cn } from \"./utils\"\n\nimport {\n Dialog,\n DialogContent,\n DialogDescription,\n DialogHeader,\n DialogTitle,\n} from \"./dialog\"\nimport {\n InputGroup,\n InputGroupAddon,\n} from \"./input-group\"\nimport { SearchIcon, CheckIcon } from \"lucide-react\"\n\nfunction Command({\n className,\n ...props\n}: React.ComponentProps<typeof CommandPrimitive>) {\n return (\n <CommandPrimitive\n data-slot=\"command\"\n className={cn(\n \"flex size-full flex-col overflow-hidden rounded-xl! bg-popover p-1 text-popover-foreground\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction CommandDialog({\n title = \"Command Palette\",\n description = \"Search for a command to run...\",\n children,\n className,\n showCloseButton = false,\n ...props\n}: React.ComponentProps<typeof Dialog> & {\n title?: string\n description?: string\n className?: string\n showCloseButton?: boolean\n}) {\n return (\n <Dialog {...props}>\n <DialogHeader className=\"sr-only\">\n <DialogTitle>{title}</DialogTitle>\n <DialogDescription>{description}</DialogDescription>\n </DialogHeader>\n <DialogContent\n className={cn(\n \"top-1/3 translate-y-0 overflow-hidden rounded-xl! p-0\",\n className\n )}\n showCloseButton={showCloseButton}\n >\n {children}\n </DialogContent>\n </Dialog>\n )\n}\n\nfunction CommandInput({\n className,\n ...props\n}: React.ComponentProps<typeof CommandPrimitive.Input>) {\n return (\n <div data-slot=\"command-input-wrapper\" className=\"p-1 pb-0\">\n <InputGroup className=\"h-8! rounded-lg! border-input/30 bg-input/30 shadow-none! *:data-[slot=input-group-addon]:pl-2!\">\n <CommandPrimitive.Input\n data-slot=\"command-input\"\n className={cn(\n \"w-full text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50\",\n className\n )}\n {...props}\n />\n <InputGroupAddon>\n <SearchIcon className=\"size-4 shrink-0 opacity-50\" />\n </InputGroupAddon>\n </InputGroup>\n </div>\n )\n}\n\nfunction CommandList({\n className,\n ...props\n}: React.ComponentProps<typeof CommandPrimitive.List>) {\n return (\n <CommandPrimitive.List\n data-slot=\"command-list\"\n className={cn(\n \"no-scrollbar max-h-72 scroll-py-1 overflow-x-hidden overflow-y-auto outline-none\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction CommandEmpty({\n className,\n ...props\n}: React.ComponentProps<typeof CommandPrimitive.Empty>) {\n return (\n <CommandPrimitive.Empty\n data-slot=\"command-empty\"\n className={cn(\"py-6 text-center text-sm\", className)}\n {...props}\n />\n )\n}\n\nfunction CommandGroup({\n className,\n ...props\n}: React.ComponentProps<typeof CommandPrimitive.Group>) {\n return (\n <CommandPrimitive.Group\n data-slot=\"command-group\"\n className={cn(\n \"overflow-hidden p-1 text-foreground **:[[cmdk-group-heading]]:px-2 **:[[cmdk-group-heading]]:py-1.5 **:[[cmdk-group-heading]]:text-xs **:[[cmdk-group-heading]]:font-medium **:[[cmdk-group-heading]]:text-muted-foreground\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction CommandSeparator({\n className,\n ...props\n}: React.ComponentProps<typeof CommandPrimitive.Separator>) {\n return (\n <CommandPrimitive.Separator\n data-slot=\"command-separator\"\n className={cn(\"-mx-1 h-px bg-border\", className)}\n {...props}\n />\n )\n}\n\nfunction CommandItem({\n className,\n children,\n ...props\n}: React.ComponentProps<typeof CommandPrimitive.Item>) {\n return (\n <CommandPrimitive.Item\n data-slot=\"command-item\"\n className={cn(\n \"group/command-item relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none in-data-[slot=dialog-content]:rounded-lg! data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 data-selected:bg-muted data-selected:text-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-selected:*:[svg]:text-foreground\",\n className\n )}\n {...props}\n >\n {children}\n <CheckIcon className=\"ml-auto opacity-0 group-has-data-[slot=command-shortcut]/command-item:hidden group-data-[checked=true]/command-item:opacity-100\" />\n </CommandPrimitive.Item>\n )\n}\n\nfunction CommandShortcut({\n className,\n ...props\n}: React.ComponentProps<\"span\">) {\n return (\n <span\n data-slot=\"command-shortcut\"\n className={cn(\n \"ml-auto text-xs tracking-widest text-muted-foreground group-data-selected/command-item:text-foreground\",\n className\n )}\n {...props}\n />\n )\n}\n\nexport {\n Command,\n CommandDialog,\n CommandInput,\n CommandList,\n CommandEmpty,\n CommandGroup,\n CommandItem,\n CommandShortcut,\n CommandSeparator,\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"command.js","names":["Command","CommandPrimitive"],"sources":["../../../src/react/ui/command.tsx"],"sourcesContent":["import * as React from \"react\"\nimport { Command as CommandPrimitive } from \"cmdk\"\nimport { cn } from \"./utils\"\n\nimport {\n Dialog,\n DialogContent,\n DialogDescription,\n DialogHeader,\n DialogTitle,\n} from \"./dialog\"\nimport {\n InputGroup,\n InputGroupAddon,\n} from \"./input-group\"\nimport { SearchIcon, CheckIcon } from \"lucide-react\"\n\nfunction Command({\n className,\n ...props\n}: React.ComponentProps<typeof CommandPrimitive>) {\n return (\n <CommandPrimitive\n data-slot=\"command\"\n className={cn(\n \"flex size-full flex-col overflow-hidden rounded-xl! bg-popover p-1 text-popover-foreground\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction CommandDialog({\n title = \"Command Palette\",\n description = \"Search for a command to run...\",\n children,\n className,\n showCloseButton = false,\n ...props\n}: React.ComponentProps<typeof Dialog> & {\n title?: string\n description?: string\n className?: string\n showCloseButton?: boolean\n}) {\n return (\n <Dialog {...props}>\n <DialogHeader className=\"sr-only\">\n <DialogTitle>{title}</DialogTitle>\n <DialogDescription>{description}</DialogDescription>\n </DialogHeader>\n <DialogContent\n className={cn(\n \"top-1/3 translate-y-0 overflow-hidden rounded-xl! p-0\",\n className\n )}\n showCloseButton={showCloseButton}\n >\n {children}\n </DialogContent>\n </Dialog>\n )\n}\n\nfunction CommandInput({\n className,\n ...props\n}: React.ComponentProps<typeof CommandPrimitive.Input>) {\n return (\n <div data-slot=\"command-input-wrapper\" className=\"p-1 pb-0\">\n <InputGroup className=\"h-8! rounded-lg! border-input/30 bg-input/30 shadow-none! *:data-[slot=input-group-addon]:pl-2!\">\n <CommandPrimitive.Input\n data-slot=\"command-input\"\n className={cn(\n \"w-full text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50\",\n className\n )}\n {...props}\n />\n <InputGroupAddon>\n <SearchIcon className=\"size-4 shrink-0 opacity-50\" />\n </InputGroupAddon>\n </InputGroup>\n </div>\n )\n}\n\nfunction CommandList({\n className,\n ...props\n}: React.ComponentProps<typeof CommandPrimitive.List>) {\n return (\n <CommandPrimitive.List\n data-slot=\"command-list\"\n className={cn(\n \"no-scrollbar max-h-72 scroll-py-1 overflow-x-hidden overflow-y-auto outline-none\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction CommandEmpty({\n className,\n ...props\n}: React.ComponentProps<typeof CommandPrimitive.Empty>) {\n return (\n <CommandPrimitive.Empty\n data-slot=\"command-empty\"\n className={cn(\"py-6 text-center text-sm\", className)}\n {...props}\n />\n )\n}\n\nfunction CommandGroup({\n className,\n ...props\n}: React.ComponentProps<typeof CommandPrimitive.Group>) {\n return (\n <CommandPrimitive.Group\n data-slot=\"command-group\"\n className={cn(\n \"overflow-hidden p-1 text-foreground **:[[cmdk-group-heading]]:px-2 **:[[cmdk-group-heading]]:py-1.5 **:[[cmdk-group-heading]]:text-xs **:[[cmdk-group-heading]]:font-medium **:[[cmdk-group-heading]]:text-muted-foreground\",\n className\n )}\n {...props}\n />\n )\n}\n\nfunction CommandSeparator({\n className,\n ...props\n}: React.ComponentProps<typeof CommandPrimitive.Separator>) {\n return (\n <CommandPrimitive.Separator\n data-slot=\"command-separator\"\n className={cn(\"-mx-1 h-px bg-border\", className)}\n {...props}\n />\n )\n}\n\nfunction CommandItem({\n className,\n children,\n ...props\n}: React.ComponentProps<typeof CommandPrimitive.Item>) {\n return (\n <CommandPrimitive.Item\n data-slot=\"command-item\"\n className={cn(\n \"group/command-item relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none in-data-[slot=dialog-content]:rounded-lg! data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 data-selected:bg-muted data-selected:text-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-selected:*:[svg]:text-foreground\",\n className\n )}\n {...props}\n >\n {children}\n <CheckIcon className=\"ml-auto opacity-0 group-has-data-[slot=command-shortcut]/command-item:hidden group-data-[checked=true]/command-item:opacity-100\" />\n </CommandPrimitive.Item>\n )\n}\n\nfunction CommandShortcut({\n className,\n ...props\n}: React.ComponentProps<\"span\">) {\n return (\n <span\n data-slot=\"command-shortcut\"\n className={cn(\n \"ml-auto text-xs tracking-widest text-muted-foreground group-data-selected/command-item:text-foreground\",\n className\n )}\n {...props}\n />\n )\n}\n\nexport {\n Command,\n CommandDialog,\n CommandInput,\n CommandList,\n CommandEmpty,\n CommandGroup,\n CommandItem,\n CommandShortcut,\n CommandSeparator,\n}\n"],"mappings":";;;;;;;;AAiBA,SAASA,UAAQ,EACf,WACA,GAAG,SAC6C;CAChD,OACE,oBAACC,SAAD;EACE,aAAU;EACV,WAAW,GACT,8FACA,SACF;EACA,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,cAAc,EACrB,QAAQ,mBACR,cAAc,kCACd,UACA,WACA,kBAAkB,OAClB,GAAG,SAMF;CACD,OACE,qBAAC,QAAD;EAAQ,GAAI;EAAZ,UAAA,CACE,qBAAC,cAAD;GAAc,WAAU;GAAxB,UAAA,CACE,oBAAC,aAAD,EAAA,UAAc,MAAmB,CAAA,GACjC,oBAAC,mBAAD,EAAA,UAAoB,YAA+B,CAAA,CACvC;EACd,CAAA,GAAA,oBAAC,eAAD;GACE,WAAW,GACT,yDACA,SACF;GACiB;GAEhB;EACY,CAAA,CACT;;AAEZ;AAEA,SAAS,aAAa,EACpB,WACA,GAAG,SACmD;CACtD,OACE,oBAAC,OAAD;EAAK,aAAU;EAAwB,WAAU;EAC/C,UAAA,qBAAC,YAAD;GAAY,WAAU;GAAtB,UAAA,CACE,oBAACA,QAAiB,OAAlB;IACE,aAAU;IACV,WAAW,GACT,iFACA,SACF;IACA,GAAI;GACL,CAAA,GACD,oBAAC,iBAAD,EAAA,UACE,oBAAC,YAAD,EAAY,WAAU,6BAA8B,CAAA,EACrC,CAAA,CACP;;CACT,CAAA;AAET;AAEA,SAAS,YAAY,EACnB,WACA,GAAG,SACkD;CACrD,OACE,oBAACA,QAAiB,MAAlB;EACE,aAAU;EACV,WAAW,GACT,oFACA,SACF;EACA,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,aAAa,EACpB,WACA,GAAG,SACmD;CACtD,OACE,oBAACA,QAAiB,OAAlB;EACE,aAAU;EACV,WAAW,GAAG,4BAA4B,SAAS;EACnD,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,aAAa,EACpB,WACA,GAAG,SACmD;CACtD,OACE,oBAACA,QAAiB,OAAlB;EACE,aAAU;EACV,WAAW,GACT,+NACA,SACF;EACA,GAAI;CACL,CAAA;AAEL;AAeA,SAAS,YAAY,EACnB,WACA,UACA,GAAG,SACkD;CACrD,OACE,qBAACA,QAAiB,MAAlB;EACE,aAAU;EACV,WAAW,GACT,gaACA,SACF;EACA,GAAI;EANN,UAAA,CAQG,UACD,oBAAC,WAAD,EAAW,WAAU,kIAAmI,CAAA,CACnI;;AAE3B;AAEA,SAAS,gBAAgB,EACvB,WACA,GAAG,SAC4B;CAC/B,OACE,oBAAC,QAAD;EACE,aAAU;EACV,WAAW,GACT,0GACA,SACF;EACA,GAAI;CACL,CAAA;AAEL"}
|
|
@@ -2,12 +2,12 @@ import { AnyExtension } from "@tiptap/core";
|
|
|
2
2
|
//#region src/schema/advanced.d.ts
|
|
3
3
|
/**
|
|
4
4
|
* The Vue-free schema of the advanced editor, free of node views, UI and collaboration runtime: the server builds the
|
|
5
|
-
* same schema with `getSchema(advancedSchemaExtensions())` to convert between TipTap JSON and Yjs.
|
|
6
|
-
*
|
|
7
|
-
* video, file), transcript, the composite family, mentions/tags, the author and comment marks, the
|
|
8
|
-
* nodes (for hosts whose preset adds `tablesFeature()`; the advanced preset itself has none) and
|
|
9
|
-
* adds the `id` attribute to every block type (its ID-assigning plugins only run in an editor).
|
|
10
|
-
* under collaboration the Collaboration extension provides the (per-user) undo manager.
|
|
5
|
+
* same schema with `getSchema(advancedSchemaExtensions())` to convert between TipTap JSON and Yjs. Derived with
|
|
6
|
+
* `schemaExtensionsOf` from the schema-bearing features: StarterKit/StrikeX, the generic node flags, the opaque fence,
|
|
7
|
+
* media (image, audio, video, file), transcript, the composite family, mentions/tags, the author and comment marks, the
|
|
8
|
+
* GFM table and task-list nodes (for hosts whose preset adds `tablesFeature()`; the advanced preset itself has none) and
|
|
9
|
+
* last `BlockId`, which adds the `id` attribute to every block type (its ID-assigning plugins only run in an editor).
|
|
10
|
+
* `undoRedo: false`: under collaboration the Collaboration extension provides the (per-user) undo manager.
|
|
11
11
|
*/
|
|
12
12
|
export declare const advancedSchemaExtensions: () => AnyExtension[];
|
|
13
13
|
//#endregion
|
package/dist/schema/advanced.js
CHANGED
|
@@ -1,42 +1,39 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { StrikeX } from "../core/schema/strike.js";
|
|
1
|
+
import { schemaExtensionsOf } from "../core/schema/of-features.js";
|
|
2
|
+
import { coreContentSchemaExtensions } from "../core/schema/index.js";
|
|
3
|
+
import { commentsSchemaExtensions } from "../features/comments/schema.js";
|
|
5
4
|
import { compositeSchemaExtensions } from "../features/composites/schema.js";
|
|
6
5
|
import { authorsSchemaExtensions } from "../features/authors/schema.js";
|
|
7
|
-
import { commentsSchemaExtensions } from "../features/comments/schema.js";
|
|
8
6
|
import { mediaSchemaExtensions } from "../features/media/schema.js";
|
|
9
7
|
import { mentionsSchemaExtensions } from "../features/mentions/schema.js";
|
|
10
8
|
import { tablesSchemaExtensions } from "../features/tables/schema.js";
|
|
11
9
|
import { transcriptSchemaExtensions } from "../features/transcript/schema.js";
|
|
12
|
-
import StarterKit from "@tiptap/starter-kit";
|
|
13
10
|
//#region src/schema/advanced.ts
|
|
14
11
|
/**
|
|
15
|
-
* The
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
* nodes (for hosts whose preset adds `tablesFeature()`; the advanced preset itself has none) and last `BlockId`, which
|
|
20
|
-
* adds the `id` attribute to every block type (its ID-assigning plugins only run in an editor). `undoRedo: false`:
|
|
21
|
-
* under collaboration the Collaboration extension provides the (per-user) undo manager.
|
|
12
|
+
* The schema-bearing slice of the rich content features, in schema order: `core-content`, media, transcript, composites,
|
|
13
|
+
* mentions, authors, the comment mark (`comments` is an interaction feature, but stored documents contain its mark), and
|
|
14
|
+
* tables. Each entry is the very `schemaExtensions` function the feature of that id declares; the features themselves
|
|
15
|
+
* are not imported, because they carry node views and UI that a server must never load.
|
|
22
16
|
*/
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
...transcriptSchemaExtensions(),
|
|
33
|
-
...compositeSchemaExtensions(),
|
|
34
|
-
...mentionsSchemaExtensions(),
|
|
35
|
-
...authorsSchemaExtensions(),
|
|
36
|
-
...commentsSchemaExtensions(),
|
|
37
|
-
...tablesSchemaExtensions(),
|
|
38
|
-
BlockId
|
|
17
|
+
const RICH_CONTENT_SCHEMA = [
|
|
18
|
+
{ schemaExtensions: coreContentSchemaExtensions },
|
|
19
|
+
{ schemaExtensions: mediaSchemaExtensions },
|
|
20
|
+
{ schemaExtensions: transcriptSchemaExtensions },
|
|
21
|
+
{ schemaExtensions: () => compositeSchemaExtensions() },
|
|
22
|
+
{ schemaExtensions: mentionsSchemaExtensions },
|
|
23
|
+
{ schemaExtensions: authorsSchemaExtensions },
|
|
24
|
+
{ schemaExtensions: commentsSchemaExtensions },
|
|
25
|
+
{ schemaExtensions: tablesSchemaExtensions }
|
|
39
26
|
];
|
|
27
|
+
/**
|
|
28
|
+
* The Vue-free schema of the advanced editor, free of node views, UI and collaboration runtime: the server builds the
|
|
29
|
+
* same schema with `getSchema(advancedSchemaExtensions())` to convert between TipTap JSON and Yjs. Derived with
|
|
30
|
+
* `schemaExtensionsOf` from the schema-bearing features: StarterKit/StrikeX, the generic node flags, the opaque fence,
|
|
31
|
+
* media (image, audio, video, file), transcript, the composite family, mentions/tags, the author and comment marks, the
|
|
32
|
+
* GFM table and task-list nodes (for hosts whose preset adds `tablesFeature()`; the advanced preset itself has none) and
|
|
33
|
+
* last `BlockId`, which adds the `id` attribute to every block type (its ID-assigning plugins only run in an editor).
|
|
34
|
+
* `undoRedo: false`: under collaboration the Collaboration extension provides the (per-user) undo manager.
|
|
35
|
+
*/
|
|
36
|
+
const advancedSchemaExtensions = () => schemaExtensionsOf(RICH_CONTENT_SCHEMA);
|
|
40
37
|
//#endregion
|
|
41
38
|
export { advancedSchemaExtensions };
|
|
42
39
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"advanced.js","names":[],"sources":["../../src/schema/advanced.ts"],"sourcesContent":["import type { AnyExtension } from '@tiptap/core'\nimport
|
|
1
|
+
{"version":3,"file":"advanced.js","names":[],"sources":["../../src/schema/advanced.ts"],"sourcesContent":["import type { AnyExtension } from '@tiptap/core'\nimport { coreContentSchemaExtensions, schemaExtensionsOf } from '../core/schema'\nimport { authorsSchemaExtensions } from '../features/authors/schema'\nimport { commentsSchemaExtensions } from '../features/comments/schema'\nimport { compositeSchemaExtensions } from '../features/composites/schema'\nimport { mediaSchemaExtensions } from '../features/media/schema'\nimport { mentionsSchemaExtensions } from '../features/mentions/schema'\nimport { tablesSchemaExtensions } from '../features/tables/schema'\nimport { transcriptSchemaExtensions } from '../features/transcript/schema'\n\n/**\n * The schema-bearing slice of the rich content features, in schema order: `core-content`, media, transcript, composites,\n * mentions, authors, the comment mark (`comments` is an interaction feature, but stored documents contain its mark), and\n * tables. Each entry is the very `schemaExtensions` function the feature of that id declares; the features themselves\n * are not imported, because they carry node views and UI that a server must never load.\n */\nconst RICH_CONTENT_SCHEMA = [\n { schemaExtensions: coreContentSchemaExtensions },\n { schemaExtensions: mediaSchemaExtensions },\n { schemaExtensions: transcriptSchemaExtensions },\n { schemaExtensions: () => compositeSchemaExtensions() },\n { schemaExtensions: mentionsSchemaExtensions },\n { schemaExtensions: authorsSchemaExtensions },\n { schemaExtensions: commentsSchemaExtensions },\n { schemaExtensions: tablesSchemaExtensions },\n]\n\n/**\n * The Vue-free schema of the advanced editor, free of node views, UI and collaboration runtime: the server builds the\n * same schema with `getSchema(advancedSchemaExtensions())` to convert between TipTap JSON and Yjs. Derived with\n * `schemaExtensionsOf` from the schema-bearing features: StarterKit/StrikeX, the generic node flags, the opaque fence,\n * media (image, audio, video, file), transcript, the composite family, mentions/tags, the author and comment marks, the\n * GFM table and task-list nodes (for hosts whose preset adds `tablesFeature()`; the advanced preset itself has none) and\n * last `BlockId`, which adds the `id` attribute to every block type (its ID-assigning plugins only run in an editor).\n * `undoRedo: false`: under collaboration the Collaboration extension provides the (per-user) undo manager.\n */\nexport const advancedSchemaExtensions = (): AnyExtension[] => schemaExtensionsOf(RICH_CONTENT_SCHEMA)\n"],"mappings":";;;;;;;;;;;;;;;;AAgBA,MAAM,sBAAsB;CAC1B,EAAE,kBAAkB,4BAA4B;CAChD,EAAE,kBAAkB,sBAAsB;CAC1C,EAAE,kBAAkB,2BAA2B;CAC/C,EAAE,wBAAwB,0BAA0B,EAAE;CACtD,EAAE,kBAAkB,yBAAyB;CAC7C,EAAE,kBAAkB,wBAAwB;CAC5C,EAAE,kBAAkB,yBAAyB;CAC7C,EAAE,kBAAkB,uBAAuB;AAC7C;;;;;;;;;;AAWA,MAAa,iCAAiD,mBAAmB,mBAAmB"}
|
package/dist/server/ai.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ModelSlot } from "../settings/values.js";
|
|
2
2
|
import "../settings/index.js";
|
|
3
|
-
import {
|
|
3
|
+
import { PresetConfig, TranscriptionConfig } from "../config/index.js";
|
|
4
|
+
import { ModelProfile, ModelRef } from "../core/backend-types.js";
|
|
4
5
|
import "../features/ai/protocol/index.js";
|
|
5
6
|
import { HttpError } from "./errors.js";
|
|
6
7
|
import { LanguageModel, ModelMessage, ToolChoice, ToolSet } from "ai";
|
|
@@ -20,19 +21,6 @@ export type ChatTurnPart = {
|
|
|
20
21
|
input: unknown;
|
|
21
22
|
invalid: boolean;
|
|
22
23
|
};
|
|
23
|
-
/** Server-defined model preset (any OpenAI-compatible chat completions endpoint); its key falls back to the shared `apiKey`. */
|
|
24
|
-
export interface PresetConfig {
|
|
25
|
-
label: string;
|
|
26
|
-
endpoint: string;
|
|
27
|
-
model: string;
|
|
28
|
-
apiKey?: string;
|
|
29
|
-
}
|
|
30
|
-
/** Speech-to-text endpoint: any OpenAI-compatible `<endpoint>/audio/transcriptions`. */
|
|
31
|
-
export interface TranscriptionConfig {
|
|
32
|
-
endpoint: string;
|
|
33
|
-
model: string;
|
|
34
|
-
apiKey?: string;
|
|
35
|
-
}
|
|
36
24
|
/** Everything the AI endpoints need, passed explicitly: no runtime config, no globals. */
|
|
37
25
|
export interface AiModelsConfig {
|
|
38
26
|
/** Server-defined model presets, keyed by preset id. */
|
|
@@ -44,11 +32,11 @@ export interface AiModelsConfig {
|
|
|
44
32
|
/** Speech-to-text for audio/video composites; absent = the transcription endpoint answers 501. */
|
|
45
33
|
transcription?: TranscriptionConfig;
|
|
46
34
|
/**
|
|
47
|
-
* The host's own language model for `ref` (`
|
|
35
|
+
* The host's own language model for `ref` (`ModelProvider.languageModel`), consulted before the presets for every
|
|
48
36
|
* model reference; `user` is what `authenticate` returned. `null` or nothing falls through to the presets.
|
|
49
37
|
*/
|
|
50
38
|
languageModel?: (ref: ModelRef, user: object | null) => Promise<LanguageModel | null | undefined>;
|
|
51
|
-
/** The models listed for `user` instead of the presets (`
|
|
39
|
+
/** The models listed for `user` instead of the presets (`ModelProvider.listModels`); `null` or nothing lists the presets. */
|
|
52
40
|
listModels?: (user: object | null) => Promise<ModelProfile[] | null | undefined>;
|
|
53
41
|
/** Appended to the error of a preset without key, e.g. the environment variable names that set it. */
|
|
54
42
|
missingKeyHint?: (presetId: string) => string;
|
|
@@ -98,4 +86,5 @@ export declare function streamChatTurn(opts: {
|
|
|
98
86
|
toolChoice?: ToolChoice<ToolSet>;
|
|
99
87
|
}): AsyncGenerator<ChatTurnPart>;
|
|
100
88
|
//#endregion
|
|
89
|
+
export type { PresetConfig, TranscriptionConfig };
|
|
101
90
|
//# sourceMappingURL=ai.d.ts.map
|
package/dist/server/ai.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ai.js","names":[],"sources":["../../src/server/ai.ts"],"sourcesContent":["import { createOpenAICompatible } from '@ai-sdk/openai-compatible'\nimport { APICallError, type LanguageModel, type ModelMessage, streamText, type ToolChoice, type ToolSet } from 'ai'\nimport type { ModelProfile, ModelRef } from '../features/ai/protocol'\nimport type { ModelSlot } from '../settings'\nimport { HttpError } from './errors'\n\nexport interface ChatMessage { role: 'system' | 'user' | 'assistant', content: string }\n\n/** A streamed text delta, or a finished tool call (`invalid`: unparsable input or unknown tool). */\nexport type ChatTurnPart =\n | { type: 'text', text: string }\n | { type: 'tool-call', toolCallId: string, toolName: string, input: unknown, invalid: boolean }\n\
|
|
1
|
+
{"version":3,"file":"ai.js","names":[],"sources":["../../src/server/ai.ts"],"sourcesContent":["import { createOpenAICompatible } from '@ai-sdk/openai-compatible'\nimport { APICallError, type LanguageModel, type ModelMessage, streamText, type ToolChoice, type ToolSet } from 'ai'\nimport type { ModelProfile, ModelRef } from '../features/ai/protocol'\nimport type { ModelSlot } from '../settings'\nimport type { PresetConfig, TranscriptionConfig } from '../config'\nimport { HttpError } from './errors'\n\nexport interface ChatMessage { role: 'system' | 'user' | 'assistant', content: string }\n\n/** A streamed text delta, or a finished tool call (`invalid`: unparsable input or unknown tool). */\nexport type ChatTurnPart =\n | { type: 'text', text: string }\n | { type: 'tool-call', toolCallId: string, toolName: string, input: unknown, invalid: boolean }\n\nexport type { PresetConfig, TranscriptionConfig }\n\n/** Everything the AI endpoints need, passed explicitly: no runtime config, no globals. */\nexport interface AiModelsConfig {\n /** Server-defined model presets, keyed by preset id. */\n presets: Record<string, PresetConfig>\n /** Shared key of presets without their own. */\n apiKey?: string\n /** Default preset per model slot, answered by `GET /api/ai/models`. */\n slots?: Record<ModelSlot, string>\n /** Speech-to-text for audio/video composites; absent = the transcription endpoint answers 501. */\n transcription?: TranscriptionConfig\n /**\n * The host's own language model for `ref` (`ModelProvider.languageModel`), consulted before the presets for every\n * model reference; `user` is what `authenticate` returned. `null` or nothing falls through to the presets.\n */\n languageModel?: (ref: ModelRef, user: object | null) => Promise<LanguageModel | null | undefined>\n /** The models listed for `user` instead of the presets (`ModelProvider.listModels`); `null` or nothing lists the presets. */\n listModels?: (user: object | null) => Promise<ModelProfile[] | null | undefined>\n /** Appended to the error of a preset without key, e.g. the environment variable names that set it. */\n missingKeyHint?: (presetId: string) => string\n}\n\nexport interface AiModels {\n /**\n * AI SDK language model for `ref` (an OpenAI-compatible chat completions endpoint), for direct `ai` calls. The\n * host's `languageModel(ref, user)` is asked first (`user`: what `authenticate` returned); a model it returns is\n * used as is, `null` (or no such hook) falls through to the configured presets. A preset uses its own key or the\n * shared `apiKey`; a user ref brings its own. Throws `HttpError` 400 for an unknown preset and 500 for a preset\n * without key, so routes can call it before streaming starts.\n */\n resolveModel(ref: ModelRef, user: object | null): Promise<LanguageModel>\n /**\n * The configured presets as the client may see them: without their keys. `user` is what the host's `authenticate`\n * returned; the `listModels` hook supplies the list when it returns one (replacing the presets).\n */\n listModels(user: object | null): Promise<ModelProfile[]>\n readonly slots: Record<ModelSlot, string> | undefined\n readonly transcription: TranscriptionConfig | undefined\n streamChat: typeof streamChat\n streamChatTurn: typeof streamChatTurn\n}\n\n/** The AI model utilities over an explicit configuration. */\nexport function createAiModels(config: AiModelsConfig): AiModels {\n return {\n async resolveModel(ref, user) {\n const hosted = await config.languageModel?.(ref, user)\n if (hosted) return hosted\n if (!('preset' in ref)) return createOpenAICompatible({ name: 'tiptap-editor', baseURL: ref.endpoint, apiKey: ref.apiKey }).chatModel(ref.model)\n const preset = config.presets[ref.preset]\n if (!preset) throw new HttpError(400, 'Unbekanntes Modell-Preset')\n const apiKey = preset.apiKey || config.apiKey\n if (!apiKey) throw new HttpError(500, `API-Key für Preset „${ref.preset}“ fehlt${config.missingKeyHint?.(ref.preset) ?? ''}`)\n return createOpenAICompatible({ name: 'tiptap-editor', baseURL: preset.endpoint, apiKey }).chatModel(preset.model)\n },\n async listModels(user) {\n const listed = await config.listModels?.(user)\n if (listed) return listed\n return Object.entries(config.presets).map(([id, { label, endpoint, model }]) => ({ id, label, endpoint, model, source: 'preset' }))\n },\n slots: config.slots,\n transcription: config.transcription,\n streamChat,\n streamChatTurn,\n }\n}\n\nexport function upstreamError(error: unknown) {\n let detail: string\n if (APICallError.isInstance(error)) detail = [error.statusCode, error.responseBody || error.message].filter(Boolean).join(' ')\n else if (error instanceof Error) detail = error.message\n else detail = (error as { message?: string } | null)?.message ?? JSON.stringify(error)\n return new HttpError(502, `KI-Endpunkt: ${detail}`.slice(0, 500))\n}\n\n/**\n * Streams the text deltas of a chat completion (AI SDK `streamText`) on the resolved language model `model` (see\n * `resolveModel`). System messages may appear in `messages`; a trailing assistant message is a prefill the model\n * continues. Upstream failures throw a 502 `HttpError`; aborting `signal` cancels the upstream request and makes the\n * generator throw.\n */\nexport async function* streamChat(opts: { model: LanguageModel, messages: ChatMessage[], signal: AbortSignal }): AsyncGenerator<string> {\n for await (const part of streamChatTurn(opts)) {\n if (part.type === 'text') yield part.text\n }\n}\n\n/**\n * Like `streamChat`, with `tools` the model may call (tools without `execute`: the turn ends with the calls, which are\n * yielded for the caller to handle) and structured `messages` (tool calls and results in the history).\n */\nexport async function* streamChatTurn(opts: {\n model: LanguageModel\n messages: ModelMessage[]\n signal: AbortSignal\n tools?: ToolSet\n toolChoice?: ToolChoice<ToolSet>\n}): AsyncGenerator<ChatTurnPart> {\n const { model } = opts\n // Also cancels the upstream request when the consumer stops iterating early (break / return).\n const upstream = new AbortController()\n const onAbort = () => upstream.abort(opts.signal.reason)\n if (opts.signal.aborted) onAbort()\n else opts.signal.addEventListener('abort', onAbort, { once: true })\n try {\n const result = streamText({\n model,\n messages: opts.messages,\n tools: opts.tools,\n toolChoice: opts.toolChoice,\n allowSystemInMessages: true,\n abortSignal: upstream.signal,\n maxRetries: 0,\n // Errors surface as `error` parts below and are rethrown; the default handler would only log them.\n onError: () => {},\n })\n for await (const part of result.stream) {\n if (part.type === 'text-delta') {\n if (part.text) yield { type: 'text', text: part.text }\n }\n else if (part.type === 'tool-call') {\n yield { type: 'tool-call', toolCallId: part.toolCallId, toolName: part.toolName, input: part.input, invalid: part.invalid === true }\n }\n else if (part.type === 'error') {\n if (opts.signal.aborted) break\n throw upstreamError(part.error)\n }\n else if (part.type === 'abort') {\n break\n }\n }\n opts.signal.throwIfAborted()\n }\n finally {\n opts.signal.removeEventListener('abort', onAbort)\n upstream.abort()\n }\n}\n"],"mappings":";;;;;AA0DA,SAAgB,eAAe,QAAkC;CAC/D,OAAO;EACL,MAAM,aAAa,KAAK,MAAM;GAC5B,MAAM,SAAS,MAAM,OAAO,gBAAgB,KAAK,IAAI;GACrD,IAAI,QAAQ,OAAO;GACnB,IAAI,EAAE,YAAY,MAAM,OAAO,uBAAuB;IAAE,MAAM;IAAiB,SAAS,IAAI;IAAU,QAAQ,IAAI;GAAO,CAAC,CAAC,CAAC,UAAU,IAAI,KAAK;GAC/I,MAAM,SAAS,OAAO,QAAQ,IAAI;GAClC,IAAI,CAAC,QAAQ,MAAM,IAAI,UAAU,KAAK,2BAA2B;GACjE,MAAM,SAAS,OAAO,UAAU,OAAO;GACvC,IAAI,CAAC,QAAQ,MAAM,IAAI,UAAU,KAAK,uBAAuB,IAAI,OAAO,SAAS,OAAO,iBAAiB,IAAI,MAAM,KAAK,IAAI;GAC5H,OAAO,uBAAuB;IAAE,MAAM;IAAiB,SAAS,OAAO;IAAU;GAAO,CAAC,CAAC,CAAC,UAAU,OAAO,KAAK;EACnH;EACA,MAAM,WAAW,MAAM;GACrB,MAAM,SAAS,MAAM,OAAO,aAAa,IAAI;GAC7C,IAAI,QAAQ,OAAO;GACnB,OAAO,OAAO,QAAQ,OAAO,OAAO,CAAC,CAAC,KAAK,CAAC,IAAI,EAAE,OAAO,UAAU,cAAc;IAAE;IAAI;IAAO;IAAU;IAAO,QAAQ;GAAS,EAAE;EACpI;EACA,OAAO,OAAO;EACd,eAAe,OAAO;EACtB;EACA;CACF;AACF;AAEA,SAAgB,cAAc,OAAgB;CAC5C,IAAI;CACJ,IAAI,aAAa,WAAW,KAAK,GAAG,SAAS,CAAC,MAAM,YAAY,MAAM,gBAAgB,MAAM,OAAO,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG;MACxH,IAAI,iBAAiB,OAAO,SAAS,MAAM;MAC3C,SAAU,OAAuC,WAAW,KAAK,UAAU,KAAK;CACrF,OAAO,IAAI,UAAU,KAAK,gBAAgB,SAAS,MAAM,GAAG,GAAG,CAAC;AAClE;;;;;;;AAQA,gBAAuB,WAAW,MAAsG;CACtI,WAAW,MAAM,QAAQ,eAAe,IAAI,GAC1C,IAAI,KAAK,SAAS,QAAQ,MAAM,KAAK;AAEzC;;;;;AAMA,gBAAuB,eAAe,MAML;CAC/B,MAAM,EAAE,UAAU;CAElB,MAAM,WAAW,IAAI,gBAAgB;CACrC,MAAM,gBAAgB,SAAS,MAAM,KAAK,OAAO,MAAM;CACvD,IAAI,KAAK,OAAO,SAAS,QAAQ;MAC5B,KAAK,OAAO,iBAAiB,SAAS,SAAS,EAAE,MAAM,KAAK,CAAC;CAClE,IAAI;EACF,MAAM,SAAS,WAAW;GACxB;GACA,UAAU,KAAK;GACf,OAAO,KAAK;GACZ,YAAY,KAAK;GACjB,uBAAuB;GACvB,aAAa,SAAS;GACtB,YAAY;GAEZ,eAAe,CAAC;EAClB,CAAC;EACD,WAAW,MAAM,QAAQ,OAAO,QAC9B,IAAI,KAAK,SAAS,cACZ;OAAA,KAAK,MAAM,MAAM;IAAE,MAAM;IAAQ,MAAM,KAAK;GAAK;EAAA,OAElD,IAAI,KAAK,SAAS,aACrB,MAAM;GAAE,MAAM;GAAa,YAAY,KAAK;GAAY,UAAU,KAAK;GAAU,OAAO,KAAK;GAAO,SAAS,KAAK,YAAY;EAAK;OAEhI,IAAI,KAAK,SAAS,SAAS;GAC9B,IAAI,KAAK,OAAO,SAAS;GACzB,MAAM,cAAc,KAAK,KAAK;EAChC,OACK,IAAI,KAAK,SAAS,SACrB;EAGJ,KAAK,OAAO,eAAe;CAC7B,UACQ;EACN,KAAK,OAAO,oBAAoB,SAAS,OAAO;EAChD,SAAS,MAAM;CACjB;AACF"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
//#region src/server/auth.d.ts
|
|
2
|
+
/** What `Identity.authenticate` gets: the headers of the request (the websocket upgrade for collaboration) and the connection's `token`. */
|
|
3
|
+
export interface AuthenticateRequest {
|
|
4
|
+
headers: Headers;
|
|
5
|
+
/** The collaboration client's token (`HocuspocusProvider` `token`, sent right after the socket opened); absent for plain HTTP requests and token-less clients. */
|
|
6
|
+
token?: string;
|
|
7
|
+
}
|
|
8
|
+
//#endregion
|
|
9
|
+
//# sourceMappingURL=auth.d.ts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
//#region src/server/collab-state.d.ts
|
|
2
2
|
export interface CollabState {
|
|
3
|
-
/** `
|
|
3
|
+
/** `DocumentStore.contentVersion` of the content the update was stored with; `null` = none known (also: legacy payload). */
|
|
4
4
|
version: string | null;
|
|
5
5
|
update: Uint8Array;
|
|
6
6
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collab-state.js","names":[],"sources":["../../src/server/collab-state.ts"],"sourcesContent":["// Stored Yjs state payload and the re-seed decision of the collab server. Pure: no Hocuspocus, no adapter, no Yjs.\n//\n// The adapter stores opaque bytes (`loadState`/`storeState` keep their signature); the server prefixes the Yjs update\n// with the content version it was written against:\n//\n// [0xFF, 0x76] marker (cannot start a legacy payload: a Yjs update opens with the varuint number of client groups,\n// and two continuation bytes would mean 16384 or more clients)\n// utf8 version empty = `null`\n// 0x00 terminator, so a version never contains NUL\n// update bytes `Y.encodeStateAsUpdate`\n//\n// Payloads without the marker are legacy raw updates and decode as `version: null`.\n\nconst MARKER = [0xFF, 0x76] as const\nconst TERMINATOR = 0\n\nconst encoder = new TextEncoder()\nconst decoder = new TextDecoder()\n\nexport interface CollabState {\n /** `
|
|
1
|
+
{"version":3,"file":"collab-state.js","names":[],"sources":["../../src/server/collab-state.ts"],"sourcesContent":["// Stored Yjs state payload and the re-seed decision of the collab server. Pure: no Hocuspocus, no adapter, no Yjs.\n//\n// The adapter stores opaque bytes (`loadState`/`storeState` keep their signature); the server prefixes the Yjs update\n// with the content version it was written against:\n//\n// [0xFF, 0x76] marker (cannot start a legacy payload: a Yjs update opens with the varuint number of client groups,\n// and two continuation bytes would mean 16384 or more clients)\n// utf8 version empty = `null`\n// 0x00 terminator, so a version never contains NUL\n// update bytes `Y.encodeStateAsUpdate`\n//\n// Payloads without the marker are legacy raw updates and decode as `version: null`.\n\nconst MARKER = [0xFF, 0x76] as const\nconst TERMINATOR = 0\n\nconst encoder = new TextEncoder()\nconst decoder = new TextDecoder()\n\nexport interface CollabState {\n /** `DocumentStore.contentVersion` of the content the update was stored with; `null` = none known (also: legacy payload). */\n version: string | null\n update: Uint8Array\n}\n\nexport function encodeCollabState({ version, update }: CollabState): Uint8Array {\n const label = encoder.encode(version ?? '')\n if (label.includes(TERMINATOR)) throw new Error('tiptap-editor: contentVersion darf kein NUL-Zeichen enthalten')\n const out = new Uint8Array(MARKER.length + label.length + 1 + update.length)\n out.set(MARKER, 0)\n out.set(label, MARKER.length)\n out[MARKER.length + label.length] = TERMINATOR\n out.set(update, MARKER.length + label.length + 1)\n return out\n}\n\nexport function decodeCollabState(payload: Uint8Array): CollabState {\n if (payload[0] !== MARKER[0] || payload[1] !== MARKER[1]) return { version: null, update: payload }\n const end = payload.indexOf(TERMINATOR, MARKER.length)\n // A marker without terminator is no payload this module wrote: treat it as an opaque legacy update.\n if (end === -1) return { version: null, update: payload }\n const label = decoder.decode(payload.subarray(MARKER.length, end))\n return { version: label === '' ? null : label, update: payload.subarray(end + 1) }\n}\n\n/**\n * Whether stored collaborative state is stale against the content behind it. Only hosts that implement\n * `contentVersion` opt in (`live === undefined`: the adapter has no such method, state is never discarded). A legacy\n * payload (`stored: null`) against a known live version counts as stale: it cannot prove it matches the content.\n */\nexport function isStateStale(stored: string | null, live: string | null | undefined): boolean {\n return live !== undefined && stored !== live\n}\n"],"mappings":";AAaA,MAAM,SAAS,CAAC,KAAM,GAAI;AAC1B,MAAM,aAAa;AAEnB,MAAM,UAAU,IAAI,YAAY;AAChC,MAAM,UAAU,IAAI,YAAY;AAQhC,SAAgB,kBAAkB,EAAE,SAAS,UAAmC;CAC9E,MAAM,QAAQ,QAAQ,OAAO,WAAW,EAAE;CAC1C,IAAI,MAAM,SAAS,UAAU,GAAG,MAAM,IAAI,MAAM,+DAA+D;CAC/G,MAAM,MAAM,IAAI,WAAW,OAAO,SAAS,MAAM,SAAS,IAAI,OAAO,MAAM;CAC3E,IAAI,IAAI,QAAQ,CAAC;CACjB,IAAI,IAAI,OAAO,OAAO,MAAM;CAC5B,IAAI,OAAO,SAAS,MAAM,UAAU;CACpC,IAAI,IAAI,QAAQ,OAAO,SAAS,MAAM,SAAS,CAAC;CAChD,OAAO;AACT;AAEA,SAAgB,kBAAkB,SAAkC;CAClE,IAAI,QAAQ,OAAO,OAAO,MAAM,QAAQ,OAAO,OAAO,IAAI,OAAO;EAAE,SAAS;EAAM,QAAQ;CAAQ;CAClG,MAAM,MAAM,QAAQ,QAAQ,YAAY,OAAO,MAAM;CAErD,IAAI,QAAQ,IAAI,OAAO;EAAE,SAAS;EAAM,QAAQ;CAAQ;CACxD,MAAM,QAAQ,QAAQ,OAAO,QAAQ,SAAS,OAAO,QAAQ,GAAG,CAAC;CACjE,OAAO;EAAE,SAAS,UAAU,KAAK,OAAO;EAAO,QAAQ,QAAQ,SAAS,MAAM,CAAC;CAAE;AACnF;;;;;;AAOA,SAAgB,aAAa,QAAuB,MAA0C;CAC5F,OAAO,SAAS,KAAA,KAAa,WAAW;AAC1C"}
|
package/dist/server/collab.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DocumentStore, EditorPorts, Identity } from "./ports.js";
|
|
2
2
|
import { AnyExtension, JSONContent } from "@tiptap/core";
|
|
3
3
|
import { Schema } from "@tiptap/pm/model";
|
|
4
4
|
import { Configuration, Hocuspocus, WebSocketLike } from "@hocuspocus/server";
|
|
@@ -6,14 +6,14 @@ import { Configuration, Hocuspocus, WebSocketLike } from "@hocuspocus/server";
|
|
|
6
6
|
/** Y.XmlFragment the TipTap Collaboration extension binds to (its default `field`). */
|
|
7
7
|
export declare const COLLAB_FIELD = "default";
|
|
8
8
|
export interface CollabServerOptions {
|
|
9
|
-
/**
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
|
|
13
|
-
/** Per-document access and content versioning; each defaults to the
|
|
9
|
+
/** Identity, documents and Yjs state of the editor backend; `collabState` is required. */
|
|
10
|
+
ports: EditorPorts;
|
|
11
|
+
/** TipTap extensions of the collaboration schema; default `advancedSchemaExtensions()`. Host-defined nodes and marks: `() => [...advancedSchemaExtensions(), HostNode]` (Vue-free node files only, no node views). */
|
|
12
|
+
schema?: () => AnyExtension[];
|
|
13
|
+
/** Per-document access and content versioning; each defaults to the port's method of the same name. */
|
|
14
14
|
hooks?: {
|
|
15
|
-
authorize?: NonNullable<
|
|
16
|
-
contentVersion?: NonNullable<
|
|
15
|
+
authorize?: NonNullable<Identity['authorize']>;
|
|
16
|
+
contentVersion?: NonNullable<DocumentStore['contentVersion']>;
|
|
17
17
|
};
|
|
18
18
|
/** Further Hocuspocus configuration (`debounce`, `timeout`, `quiet`, …); the editor's hooks win over equally named ones. */
|
|
19
19
|
configuration?: Partial<Configuration>;
|
|
@@ -25,11 +25,11 @@ export interface CollabConnection {
|
|
|
25
25
|
}
|
|
26
26
|
export interface CollabServer {
|
|
27
27
|
/**
|
|
28
|
-
* The Hocuspocus instance of this server. The Yjs state (via the
|
|
29
|
-
* truth for content, the host's JSON content (via the
|
|
28
|
+
* The Hocuspocus instance of this server. The Yjs state (via the `collabState` port's `loadState`/`storeState`) is the
|
|
29
|
+
* source of truth for content, the host's JSON content (via the `documents` port) is a mirror kept up to date on every store.
|
|
30
30
|
*/
|
|
31
31
|
hocuspocus: Hocuspocus;
|
|
32
|
-
/** Schema of the collab server: `
|
|
32
|
+
/** Schema of the collab server: `options.schema()` (default `advancedSchemaExtensions()`), built on first use. */
|
|
33
33
|
schema(): Schema;
|
|
34
34
|
/**
|
|
35
35
|
* Serves one websocket connection (any transport: crossws, `ws`, Bun, Deno). The user is authenticated in Hocuspocus'
|
|
@@ -46,7 +46,7 @@ export interface CollabServer {
|
|
|
46
46
|
/**
|
|
47
47
|
* The host rewrote the content behind the editor's back (an agent wrote the file): merge it into the open document now,
|
|
48
48
|
* as a diff-update connected clients see as an ordinary edit. Without this the merge waits for the document's next store.
|
|
49
|
-
* No-op when nobody has the document open or the content version is unchanged; needs the
|
|
49
|
+
* No-op when nobody has the document open or the content version is unchanged; needs the documents port's `contentVersion`.
|
|
50
50
|
*/
|
|
51
51
|
contentChanged(id: string): Promise<void>;
|
|
52
52
|
/** Open collaboration connections and loaded documents of this server. */
|
|
@@ -59,7 +59,7 @@ export interface CollabServer {
|
|
|
59
59
|
}
|
|
60
60
|
/**
|
|
61
61
|
* The editor's collaboration server, independent of any web framework: Hocuspocus with the editor's hooks (seeding from
|
|
62
|
-
* the
|
|
62
|
+
* the stored JSON, versioned state, block-ID backfill, debounced `storeContent`/`storeState`) over `options.ports`.
|
|
63
63
|
* `/nuxt` mounts one in Nitro; any Node/Bun/Deno process can serve `handleConnection` on its own websocket transport.
|
|
64
64
|
*/
|
|
65
65
|
export declare function createCollabServer(options: CollabServerOptions): CollabServer;
|
package/dist/server/collab.js
CHANGED
|
@@ -4,9 +4,9 @@ import { migrateLegacyContent } from "../features/composites/legacy.js";
|
|
|
4
4
|
import { advancedSchemaExtensions } from "../schema/advanced.js";
|
|
5
5
|
import { decodeCollabState, encodeCollabState, isStateStale } from "./collab-state.js";
|
|
6
6
|
import { getSchema } from "@tiptap/core";
|
|
7
|
+
import * as Y from "yjs";
|
|
7
8
|
import { Hocuspocus } from "@hocuspocus/server";
|
|
8
9
|
import { prosemirrorToYDoc, prosemirrorToYXmlFragment, yDocToProsemirrorJSON, yXmlFragmentToProsemirror } from "@tiptap/y-tiptap";
|
|
9
|
-
import * as Y from "yjs";
|
|
10
10
|
//#region src/server/collab.ts
|
|
11
11
|
/** Y.XmlFragment the TipTap Collaboration extension binds to (its default `field`). */
|
|
12
12
|
const COLLAB_FIELD = "default";
|
|
@@ -23,44 +23,58 @@ function contentNode(schema, loaded) {
|
|
|
23
23
|
const node = schema.nodeFromJSON(content.type === "doc" && content.content?.length ? content : EMPTY_EDITOR_CONTENT);
|
|
24
24
|
return assignBlockIds(node) ?? node;
|
|
25
25
|
}
|
|
26
|
+
/** Whether a `document` Baustein of the stored Yjs content still carries the flat `meta.transcript` that `migrateLegacyContent` turns into a `rendition` child. */
|
|
27
|
+
function hasFlatTranscript(fragment) {
|
|
28
|
+
return !fragment.createTreeWalker((node) => {
|
|
29
|
+
if (!(node instanceof Y.XmlElement) || node.nodeName !== "composite" || node.getAttribute("kind") !== "document") return false;
|
|
30
|
+
const meta = node.getAttribute("meta");
|
|
31
|
+
return typeof meta === "object" && meta !== null && "transcript" in meta && typeof meta.transcript === "string";
|
|
32
|
+
}).next().done;
|
|
33
|
+
}
|
|
26
34
|
/** Hocuspocus answers a thrown error's `reason` as permission-denied. */
|
|
27
35
|
const denied = (message, reason) => Object.assign(new Error(message), { reason });
|
|
36
|
+
/** The `collabState` port; the collaboration server cannot run without it. */
|
|
37
|
+
function collabStateOf(ports) {
|
|
38
|
+
if (!ports.collabState) throw new Error("@ecsplico/editor: collaboration needs the collabState port");
|
|
39
|
+
return ports.collabState;
|
|
40
|
+
}
|
|
28
41
|
/**
|
|
29
42
|
* The editor's collaboration server, independent of any web framework: Hocuspocus with the editor's hooks (seeding from
|
|
30
|
-
* the
|
|
43
|
+
* the stored JSON, versioned state, block-ID backfill, debounced `storeContent`/`storeState`) over `options.ports`.
|
|
31
44
|
* `/nuxt` mounts one in Nitro; any Node/Bun/Deno process can serve `handleConnection` on its own websocket transport.
|
|
32
45
|
*/
|
|
33
46
|
function createCollabServer(options) {
|
|
34
|
-
const {
|
|
35
|
-
const
|
|
36
|
-
const
|
|
47
|
+
const { identity, documents } = options.ports;
|
|
48
|
+
const state = collabStateOf(options.ports);
|
|
49
|
+
const authorize = (user, id) => options.hooks?.authorize ? options.hooks.authorize(user, id) : identity.authorize?.(user, id);
|
|
50
|
+
const contentVersion = (id) => options.hooks?.contentVersion ? options.hooks.contentVersion(id) : documents.contentVersion?.(id);
|
|
37
51
|
let schema;
|
|
38
|
-
const collabSchema = () => schema ??= getSchema(
|
|
52
|
+
const collabSchema = () => schema ??= getSchema((options.schema ?? advancedSchemaExtensions)());
|
|
39
53
|
/** Loaded documents deleted via `forgetDocument`; a store still pending for them must not write their Yjs state back. */
|
|
40
54
|
const forgotten = /* @__PURE__ */ new Set();
|
|
41
|
-
/** `contentVersion` the loaded document's content mirror had when it was last read or written; only tracked for
|
|
55
|
+
/** `contentVersion` the loaded document's content mirror had when it was last read or written; only tracked for documents ports with `contentVersion`. */
|
|
42
56
|
const loadedVersions = /* @__PURE__ */ new Map();
|
|
43
57
|
/** Resolvers of `close()` waiting for the last document to unload. */
|
|
44
58
|
const idle = [];
|
|
45
59
|
let closed = false;
|
|
46
60
|
/** Merges content rewritten behind the editor's back into the open document and stores its state against `version`. */
|
|
47
61
|
async function mergeRewrite(id, document, version) {
|
|
48
|
-
const rewritten = await
|
|
62
|
+
const rewritten = await documents.loadContent(id);
|
|
49
63
|
if (!rewritten) return;
|
|
50
64
|
prosemirrorToYXmlFragment(contentNode(collabSchema(), rewritten), document.getXmlFragment(COLLAB_FIELD));
|
|
51
65
|
loadedVersions.set(id, version);
|
|
52
|
-
await
|
|
66
|
+
await state.storeState(id, encodeCollabState({
|
|
53
67
|
version,
|
|
54
68
|
update: Y.encodeStateAsUpdate(document)
|
|
55
69
|
}));
|
|
56
70
|
}
|
|
57
71
|
/** Stored state of a document, `null` when there is none usable: it was written against another content version and is removed. */
|
|
58
72
|
async function loadCurrentState(id, liveVersion) {
|
|
59
|
-
const payload = await
|
|
73
|
+
const payload = await state.loadState(id);
|
|
60
74
|
if (!payload) return null;
|
|
61
75
|
const { version, update } = decodeCollabState(payload);
|
|
62
76
|
if (isStateStale(version, liveVersion)) {
|
|
63
|
-
await
|
|
77
|
+
await state.removeState(id);
|
|
64
78
|
return null;
|
|
65
79
|
}
|
|
66
80
|
return update;
|
|
@@ -69,7 +83,7 @@ function createCollabServer(options) {
|
|
|
69
83
|
...options.configuration,
|
|
70
84
|
async onAuthenticate({ context, token, requestHeaders, documentName, connectionConfig }) {
|
|
71
85
|
let user = context.user;
|
|
72
|
-
if (!user) user = await
|
|
86
|
+
if (!user) user = await identity.authenticate({
|
|
73
87
|
headers: requestHeaders,
|
|
74
88
|
...token && { token }
|
|
75
89
|
});
|
|
@@ -88,7 +102,7 @@ function createCollabServer(options) {
|
|
|
88
102
|
const version = await contentVersion(documentName);
|
|
89
103
|
const stored = await loadCurrentState(documentName, version);
|
|
90
104
|
if (version !== void 0) loadedVersions.set(documentName, version);
|
|
91
|
-
const persist = (doc) =>
|
|
105
|
+
const persist = (doc) => state.storeState(documentName, encodeCollabState({
|
|
92
106
|
version: version ?? null,
|
|
93
107
|
update: Y.encodeStateAsUpdate(doc)
|
|
94
108
|
}));
|
|
@@ -97,7 +111,9 @@ function createCollabServer(options) {
|
|
|
97
111
|
Y.applyUpdate(doc, stored);
|
|
98
112
|
const fragment = doc.getXmlFragment(COLLAB_FIELD);
|
|
99
113
|
if (!!fragment.createTreeWalker((node) => node instanceof Y.XmlElement && node.nodeName === "section").next().done) {
|
|
100
|
-
const
|
|
114
|
+
const current = yXmlFragmentToProsemirror(currentSchema, fragment);
|
|
115
|
+
const migrated = hasFlatTranscript(fragment) ? currentSchema.nodeFromJSON(migrateLegacyContent(current.toJSON())) : current;
|
|
116
|
+
const withIds = assignBlockIds(migrated) ?? (migrated === current ? null : migrated);
|
|
101
117
|
if (withIds) {
|
|
102
118
|
prosemirrorToYXmlFragment(withIds, fragment);
|
|
103
119
|
await persist(doc);
|
|
@@ -105,7 +121,7 @@ function createCollabServer(options) {
|
|
|
105
121
|
return doc;
|
|
106
122
|
}
|
|
107
123
|
}
|
|
108
|
-
const loaded = await
|
|
124
|
+
const loaded = await documents.loadContent(documentName);
|
|
109
125
|
if (!loaded) throw new Error("Dokument nicht gefunden");
|
|
110
126
|
const seeded = prosemirrorToYDoc(contentNode(currentSchema, loaded), COLLAB_FIELD);
|
|
111
127
|
await persist(seeded);
|
|
@@ -119,10 +135,10 @@ function createCollabServer(options) {
|
|
|
119
135
|
await mergeRewrite(documentName, document, current);
|
|
120
136
|
return;
|
|
121
137
|
}
|
|
122
|
-
await
|
|
138
|
+
await documents.storeContent(documentName, yDocToProsemirrorJSON(document, COLLAB_FIELD));
|
|
123
139
|
const version = await contentVersion(documentName);
|
|
124
140
|
if (version !== void 0) loadedVersions.set(documentName, version);
|
|
125
|
-
await
|
|
141
|
+
await state.storeState(documentName, encodeCollabState({
|
|
126
142
|
version: version ?? null,
|
|
127
143
|
update: Y.encodeStateAsUpdate(document)
|
|
128
144
|
}));
|
|
@@ -151,7 +167,7 @@ function createCollabServer(options) {
|
|
|
151
167
|
doc.broadcastStateless("deleted");
|
|
152
168
|
hocuspocus.closeConnections(id);
|
|
153
169
|
}
|
|
154
|
-
await
|
|
170
|
+
await state.removeState(id);
|
|
155
171
|
},
|
|
156
172
|
liveContent(id) {
|
|
157
173
|
const doc = hocuspocus.documents.get(id);
|