@ecsplico/editor 2.1.2 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +78 -1
- package/README.md +39 -156
- package/dist/adapters/comments/drizzle.d.ts +1 -1
- package/dist/adapters/comments/record.d.ts +15 -0
- package/dist/adapters/comments/{client.js → rest-model.js} +3 -3
- package/dist/adapters/comments/rest-model.js.map +1 -0
- package/dist/adapters/comments/server.d.ts +2 -1
- package/dist/adapters/comments/server.js +2 -1
- package/dist/adapters/comments/server.js.map +1 -1
- package/dist/adapters/comments/types.d.ts +2 -2
- package/dist/adapters/document-state.d.ts +23 -0
- package/dist/adapters/document-state.js +66 -0
- package/dist/adapters/document-state.js.map +1 -0
- package/dist/adapters/documents.js +14 -11
- package/dist/adapters/documents.js.map +1 -1
- package/dist/adapters/drizzle.d.ts +2 -2
- package/dist/adapters/drizzle.js +97 -88
- package/dist/adapters/drizzle.js.map +1 -1
- package/dist/adapters/forge.d.ts +12 -7
- package/dist/adapters/forge.js +38 -45
- package/dist/adapters/forge.js.map +1 -1
- package/dist/adapters/http.d.ts +20 -0
- package/dist/adapters/http.js +68 -0
- package/dist/adapters/http.js.map +1 -0
- package/dist/adapters/index.d.ts +5 -5
- package/dist/adapters/json.d.ts +3 -3
- package/dist/adapters/json.js +58 -49
- package/dist/adapters/json.js.map +1 -1
- package/dist/adapters/memory.d.ts +21 -0
- package/dist/adapters/memory.js +53 -0
- package/dist/adapters/memory.js.map +1 -0
- package/dist/adapters/nitro.d.ts +27 -20
- package/dist/adapters/nitro.js +59 -163
- package/dist/adapters/nitro.js.map +1 -1
- package/dist/adapters/react.d.ts +55 -0
- package/dist/adapters/react.js +209 -0
- package/dist/adapters/react.js.map +1 -0
- package/dist/adapters/shared.d.ts +15 -21
- package/dist/adapters/shared.js +10 -8
- package/dist/adapters/shared.js.map +1 -1
- package/dist/adapters/vue.d.ts +15 -30
- package/dist/adapters/vue.js +36 -87
- package/dist/adapters/vue.js.map +1 -1
- package/dist/code/CodeSurface.vue.d.ts +2 -2
- package/dist/config/index.d.ts +105 -0
- package/dist/config/index.js +95 -0
- package/dist/config/index.js.map +1 -0
- package/dist/core/abilities.js +1 -0
- package/dist/core/abilities.js.map +1 -1
- package/dist/{adapters/routes.js → core/api-routes.js} +5 -3
- package/dist/core/api-routes.js.map +1 -0
- package/dist/core/backend-capability.d.ts +7 -0
- package/dist/core/backend-capability.js +17 -0
- package/dist/core/backend-capability.js.map +1 -0
- package/dist/core/backend-types.d.ts +245 -0
- package/dist/core/backend-types.js +17 -0
- package/dist/core/backend-types.js.map +1 -0
- package/dist/core/backend.d.ts +108 -0
- package/dist/core/backend.js +14 -0
- package/dist/core/backend.js.map +1 -0
- package/dist/core/block-convert.d.ts +7 -5
- package/dist/core/block-convert.js +28 -5
- package/dist/core/block-convert.js.map +1 -1
- package/dist/core/command-types.d.ts +96 -0
- package/dist/core/commands.d.ts +40 -0
- package/dist/core/commands.js +151 -0
- package/dist/core/commands.js.map +1 -0
- package/dist/core/context.d.ts +17 -20
- package/dist/core/context.js +24 -21
- package/dist/core/context.js.map +1 -1
- package/dist/core/core-feature.d.ts +22 -7
- package/dist/core/core-feature.js +51 -18
- package/dist/core/core-feature.js.map +1 -1
- package/dist/core/define-editor.d.ts +4 -3
- package/dist/core/define-editor.js +14 -7
- package/dist/core/define-editor.js.map +1 -1
- package/dist/core/document-markdown.js +12 -3
- package/dist/core/document-markdown.js.map +1 -1
- package/dist/core/editor-ui.d.ts +8 -1
- package/dist/core/editor-ui.js +9 -8
- package/dist/core/editor-ui.js.map +1 -1
- package/dist/core/extension-points.d.ts +3 -15
- package/dist/core/feature-context.d.ts +8 -7
- package/dist/core/feature-context.js +12 -11
- package/dist/core/feature-context.js.map +1 -1
- package/dist/core/feature.d.ts +41 -19
- package/dist/core/feature.js.map +1 -1
- package/dist/core/fences.d.ts +2 -1
- package/dist/core/fences.js +3 -2
- package/dist/core/fences.js.map +1 -1
- package/dist/core/fetch-error.d.ts +1 -1
- package/dist/core/fetch-error.js +3 -1
- package/dist/core/fetch-error.js.map +1 -1
- package/dist/core/hash.d.ts +5 -0
- package/dist/core/hash.js +11 -0
- package/dist/core/hash.js.map +1 -0
- package/dist/core/http-backend.d.ts +11 -0
- package/dist/core/http-backend.js +195 -0
- package/dist/core/http-backend.js.map +1 -0
- package/dist/core/index.d.ts +15 -9
- package/dist/core/index.js +13 -9
- package/dist/core/palette.d.ts +48 -0
- package/dist/core/palette.js +95 -0
- package/dist/core/palette.js.map +1 -0
- package/dist/core/schema/abilities.d.ts +2 -1
- package/dist/core/schema/abilities.js +5 -1
- package/dist/core/schema/abilities.js.map +1 -1
- package/dist/core/schema/index.d.ts +11 -5
- package/dist/core/schema/index.js +13 -8
- package/dist/core/schema/index.js.map +1 -1
- package/dist/core/schema/mark-flags.d.ts +8 -1
- package/dist/core/schema/of-features.d.ts +13 -0
- package/dist/core/schema/of-features.js +14 -0
- package/dist/core/schema/of-features.js.map +1 -0
- package/dist/core/slash.d.ts +8 -6
- package/dist/core/slash.js +24 -16
- package/dist/core/slash.js.map +1 -1
- package/dist/core/surface-session.js +15 -5
- package/dist/core/surface-session.js.map +1 -1
- package/dist/core/toolbar-items.d.ts +10 -4
- package/dist/core/toolbar-items.js +269 -195
- package/dist/core/toolbar-items.js.map +1 -1
- package/dist/core/transaction-guards.d.ts +21 -0
- package/dist/core/transaction-guards.js +49 -0
- package/dist/core/transaction-guards.js.map +1 -0
- package/dist/core/util.js +11 -0
- package/dist/core/util.js.map +1 -0
- package/dist/document/DocumentSurface.d.ts +1 -1
- package/dist/document/DocumentSurface.vue.d.ts +2 -2
- package/dist/features/ai/agent-op-review.d.ts +1 -1
- package/dist/features/ai/agent-op-review.js +1 -1
- package/dist/features/ai/agent-ops.js +1 -1
- package/dist/features/ai/ai-apply.d.ts +2 -2
- package/dist/features/ai/ai-apply.js +1 -1
- package/dist/features/ai/ai-review.js +1 -1
- package/dist/features/ai/ai-sse.d.ts +6 -6
- package/dist/features/ai/ai-sse.js +20 -63
- package/dist/features/ai/ai-sse.js.map +1 -1
- package/dist/features/ai/assistant.d.ts +8 -7
- package/dist/features/ai/assistant.js +3 -3
- package/dist/features/ai/assistant.js.map +1 -1
- package/dist/features/ai/block-actions.d.ts +3 -2
- package/dist/features/ai/block-actions.js +3 -2
- package/dist/features/ai/block-actions.js.map +1 -1
- package/dist/features/ai/components/AiSelectionMenu.js +1 -1
- package/dist/features/ai/components/DocumentChatAnswer.js +1 -1
- package/dist/features/ai/components/DocumentChatOps.vue.d.ts +1 -1
- package/dist/features/ai/components/SettingsModelProfiles.js +8 -8
- package/dist/features/ai/components/SettingsModelProfiles.js.map +1 -1
- package/dist/features/ai/document-chat-model.d.ts +8 -7
- package/dist/features/ai/document-chat-model.js +5 -5
- package/dist/features/ai/document-chat-model.js.map +1 -1
- package/dist/features/ai/document-chat.js +1 -1
- package/dist/features/ai/feature.js +27 -14
- package/dist/features/ai/feature.js.map +1 -1
- package/dist/features/ai/ghost-autocomplete.d.ts +7 -6
- package/dist/features/ai/ghost-autocomplete.js +6 -9
- package/dist/features/ai/ghost-autocomplete.js.map +1 -1
- package/dist/features/ai/index.d.ts +4 -3
- package/dist/features/ai/index.js +10 -10
- package/dist/features/ai/model-profiles.d.ts +5 -4
- package/dist/features/ai/model-profiles.js +2 -2
- package/dist/features/ai/model-profiles.js.map +1 -1
- package/dist/features/ai/protocol/block-lines.js +1 -1
- package/dist/features/ai/protocol/block-lines.js.map +1 -1
- package/dist/features/ai/protocol/chat.js +6 -2
- package/dist/features/ai/protocol/chat.js.map +1 -1
- package/dist/features/ai/protocol/index.d.ts +3 -2
- package/dist/features/ai/protocol/models.d.ts +2 -16
- package/dist/features/ai/protocol/models.js.map +1 -1
- package/dist/features/ai/rate-limit.d.ts +1 -1
- package/dist/features/ai/rate-limit.js +3 -1
- package/dist/features/ai/rate-limit.js.map +1 -1
- package/dist/features/ai/react/AiSelectionMenu.js +2 -2
- package/dist/features/ai/react/AiSidebar.js +4 -4
- package/dist/features/ai/react/DocumentChatAnswer.js +1 -1
- package/dist/features/ai/react/DocumentChatOps.d.ts +1 -1
- package/dist/features/ai/react/DocumentChatOps.js +1 -1
- package/dist/features/ai/react/SettingsModelProfiles.js +8 -10
- package/dist/features/ai/react/SettingsModelProfiles.js.map +1 -1
- package/dist/features/ai/react/use-ai-assistant.d.ts +1 -1
- package/dist/features/ai/react/use-ai-assistant.js +3 -3
- package/dist/features/ai/react/use-ai-assistant.js.map +1 -1
- package/dist/features/ai/react/use-document-chat.js +2 -2
- package/dist/features/ai/react/use-document-chat.js.map +1 -1
- package/dist/features/ai/react/use-model-profiles.d.ts +2 -1
- package/dist/features/ai/selection-flow.d.ts +1 -1
- package/dist/features/ai/selection-flow.js +1 -1
- package/dist/features/ai/sidebar-flow.d.ts +1 -1
- package/dist/features/ai/sidebar-flow.js +1 -1
- package/dist/features/ai/use-ai-assistant.d.ts +1 -1
- package/dist/features/ai/use-ai-assistant.js +3 -3
- package/dist/features/ai/use-ai-assistant.js.map +1 -1
- package/dist/features/ai/use-document-chat.js +2 -2
- package/dist/features/ai/use-document-chat.js.map +1 -1
- package/dist/features/ai/use-model-profiles.d.ts +2 -1
- package/dist/features/authors/attribution.d.ts +1 -1
- package/dist/features/authors/feature.js +12 -11
- package/dist/features/authors/feature.js.map +1 -1
- package/dist/features/block-ui/block-actions.d.ts +1 -1
- package/dist/features/block-ui/block-actions.js +1 -1
- package/dist/features/block-ui/block-actions.js.map +1 -1
- package/dist/features/block-ui/components/BlockUi.js +1 -1
- package/dist/features/block-ui/feature.js +1 -0
- package/dist/features/block-ui/feature.js.map +1 -1
- package/dist/features/block-ui/react/BlockUi.js +1 -1
- package/dist/features/collab/anchor-resolver.js +1 -1
- package/dist/features/collab/feature.js +2 -0
- package/dist/features/collab/feature.js.map +1 -1
- package/dist/features/comments/components/CommentThreadView.vue.d.ts +2 -1
- package/dist/features/comments/feature.js +12 -11
- package/dist/features/comments/feature.js.map +1 -1
- package/dist/features/comments/index.d.ts +3 -2
- package/dist/features/comments/index.js +1 -1
- package/dist/features/comments/margin-layout.d.ts +3 -2
- package/dist/features/comments/model.d.ts +3 -67
- package/dist/features/comments/model.js +2 -2
- package/dist/features/comments/model.js.map +1 -1
- package/dist/features/comments/react/CommentThreadView.d.ts +3 -2
- package/dist/features/comments/react/use-comments.d.ts +2 -1
- package/dist/features/comments/react.d.ts +1 -1
- package/dist/features/comments/schema.d.ts +2 -52
- package/dist/features/comments/schema.js.map +1 -1
- package/dist/features/comments/snapshot-equality.js.map +1 -1
- package/dist/features/comments/use-comments.d.ts +3 -2
- package/dist/features/comments/vue.d.ts +1 -1
- package/dist/features/composites/accepted-children.d.ts +1 -0
- package/dist/features/composites/accepted-children.js +16 -1
- package/dist/features/composites/accepted-children.js.map +1 -1
- package/dist/features/composites/ai-brief.js +39 -0
- package/dist/features/composites/ai-brief.js.map +1 -1
- package/dist/features/composites/bibliography-command.d.ts +11 -0
- package/dist/features/composites/bibliography-form.js +90 -0
- package/dist/features/composites/bibliography-form.js.map +1 -0
- package/dist/features/composites/bibliography.d.ts +33 -0
- package/dist/features/composites/bibliography.js +120 -0
- package/dist/features/composites/bibliography.js.map +1 -0
- package/dist/features/composites/components/BibliographyEditor.js +261 -0
- package/dist/features/composites/components/BibliographyEditor.js.map +1 -0
- package/dist/features/composites/components/CompositeChrome.js +78 -29
- package/dist/features/composites/components/CompositeChrome.js.map +1 -1
- package/dist/features/composites/components/CompositeChrome.vue.d.ts +1 -1
- package/dist/features/composites/components/CompositeDetails.js +46 -11
- package/dist/features/composites/components/CompositeDetails.js.map +1 -1
- package/dist/features/composites/components/CompositeDetails.vue.d.ts +2 -1
- package/dist/features/composites/components/CompositeFieldEditor.js +64 -5
- package/dist/features/composites/components/CompositeFieldEditor.js.map +1 -1
- package/dist/features/composites/components/CompositeInspector.js +20 -7
- package/dist/features/composites/components/CompositeInspector.js.map +1 -1
- package/dist/features/composites/components/CompositeTable.js +13 -4
- package/dist/features/composites/components/CompositeTable.js.map +1 -1
- package/dist/features/composites/components/CompositeTagsEditor.js +1 -1
- package/dist/features/composites/components/CompositeView.js +11 -1
- package/dist/features/composites/components/CompositeView.js.map +1 -1
- package/dist/features/composites/components/DerivationBadge.js +103 -0
- package/dist/features/composites/components/DerivationBadge.js.map +1 -0
- package/dist/features/composites/components/ReferenceFieldSelect.js +60 -0
- package/dist/features/composites/components/ReferenceFieldSelect.js.map +1 -0
- package/dist/features/composites/components/ReferenceView.js +122 -0
- package/dist/features/composites/components/ReferenceView.js.map +1 -0
- package/dist/features/composites/components/ReferenceView.vue.d.ts +96 -0
- package/dist/features/composites/components/SettingsEditingTab.js +1 -1
- package/dist/features/composites/convert.js +2 -2
- package/dist/features/composites/convert.js.map +1 -1
- package/dist/features/composites/derivation.d.ts +61 -0
- package/dist/features/composites/derivation.js +98 -0
- package/dist/features/composites/derivation.js.map +1 -0
- package/dist/features/composites/derived-chrome.js +69 -0
- package/dist/features/composites/derived-chrome.js.map +1 -0
- package/dist/features/composites/feature.js +159 -109
- package/dist/features/composites/feature.js.map +1 -1
- package/dist/features/composites/fences.d.ts +4 -3
- package/dist/features/composites/fences.js +51 -7
- package/dist/features/composites/fences.js.map +1 -1
- package/dist/features/composites/index.d.ts +12 -3
- package/dist/features/composites/index.js +15 -6
- package/dist/features/composites/inspector-model.d.ts +4 -1
- package/dist/features/composites/inspector-model.js +8 -4
- package/dist/features/composites/inspector-model.js.map +1 -1
- package/dist/features/composites/kinds.d.ts +16 -2
- package/dist/features/composites/kinds.js +145 -6
- package/dist/features/composites/kinds.js.map +1 -1
- package/dist/features/composites/legacy.d.ts +4 -1
- package/dist/features/composites/legacy.js +56 -1
- package/dist/features/composites/legacy.js.map +1 -1
- package/dist/features/composites/meta-display.js +45 -2
- package/dist/features/composites/meta-display.js.map +1 -1
- package/dist/features/composites/meta-keys.d.ts +7 -0
- package/dist/features/composites/meta-keys.js +21 -0
- package/dist/features/composites/meta-keys.js.map +1 -0
- package/dist/features/composites/node-views.d.ts +6 -3
- package/dist/features/composites/node-views.js +7 -3
- package/dist/features/composites/node-views.js.map +1 -1
- package/dist/features/composites/nodes.d.ts +6 -1
- package/dist/features/composites/nodes.js +33 -7
- package/dist/features/composites/nodes.js.map +1 -1
- package/dist/features/composites/react/BibliographyEditor.js +229 -0
- package/dist/features/composites/react/BibliographyEditor.js.map +1 -0
- package/dist/features/composites/react/CompositeChrome.js +67 -19
- package/dist/features/composites/react/CompositeChrome.js.map +1 -1
- package/dist/features/composites/react/CompositeDetails.d.ts +2 -1
- package/dist/features/composites/react/CompositeDetails.js +45 -6
- package/dist/features/composites/react/CompositeDetails.js.map +1 -1
- package/dist/features/composites/react/CompositeFieldEditor.d.ts +1 -1
- package/dist/features/composites/react/CompositeFieldEditor.js +43 -1
- package/dist/features/composites/react/CompositeFieldEditor.js.map +1 -1
- package/dist/features/composites/react/CompositeInspector.js +12 -6
- package/dist/features/composites/react/CompositeInspector.js.map +1 -1
- package/dist/features/composites/react/CompositeStatusMenu.js +1 -1
- package/dist/features/composites/react/CompositeSummaryEditor.js +1 -1
- package/dist/features/composites/react/CompositeTable.js +16 -2
- package/dist/features/composites/react/CompositeTable.js.map +1 -1
- package/dist/features/composites/react/CompositeTagsEditor.js +2 -2
- package/dist/features/composites/react/CompositeView.js +6 -1
- package/dist/features/composites/react/CompositeView.js.map +1 -1
- package/dist/features/composites/react/DerivationBadge.js +116 -0
- package/dist/features/composites/react/DerivationBadge.js.map +1 -0
- package/dist/features/composites/react/ReferenceFieldSelect.js +52 -0
- package/dist/features/composites/react/ReferenceFieldSelect.js.map +1 -0
- package/dist/features/composites/react/ReferenceView.d.ts +11 -0
- package/dist/features/composites/react/ReferenceView.js +115 -0
- package/dist/features/composites/react/ReferenceView.js.map +1 -0
- package/dist/features/composites/react/SettingsEditingTab.js +2 -2
- package/dist/features/composites/react.d.ts +2 -1
- package/dist/features/composites/react.js +7 -3
- package/dist/features/composites/react.js.map +1 -1
- package/dist/features/composites/reference-ai.js +16 -0
- package/dist/features/composites/reference-ai.js.map +1 -0
- package/dist/features/composites/reference-label.d.ts +19 -0
- package/dist/features/composites/reference-label.js +58 -0
- package/dist/features/composites/reference-label.js.map +1 -0
- package/dist/features/composites/reference-suggestion.d.ts +10 -0
- package/dist/features/composites/reference-suggestion.js +41 -0
- package/dist/features/composites/reference-suggestion.js.map +1 -0
- package/dist/features/composites/reference-text.d.ts +18 -0
- package/dist/features/composites/reference-text.js +89 -0
- package/dist/features/composites/reference-text.js.map +1 -0
- package/dist/features/composites/reference.d.ts +44 -0
- package/dist/features/composites/reference.js +148 -0
- package/dist/features/composites/reference.js.map +1 -0
- package/dist/features/composites/reveal-source.d.ts +32 -0
- package/dist/features/composites/reveal-source.js +89 -0
- package/dist/features/composites/reveal-source.js.map +1 -0
- package/dist/features/composites/rows.d.ts +25 -3
- package/dist/features/composites/rows.js +72 -10
- package/dist/features/composites/rows.js.map +1 -1
- package/dist/features/composites/schema.d.ts +9 -3
- package/dist/features/composites/schema.js +11 -4
- package/dist/features/composites/schema.js.map +1 -1
- package/dist/features/composites/table-model.js +12 -21
- package/dist/features/composites/table-model.js.map +1 -1
- package/dist/features/composites/vue.d.ts +3 -2
- package/dist/features/composites/vue.js +8 -4
- package/dist/features/composites/vue.js.map +1 -1
- package/dist/features/media/assets.d.ts +2 -0
- package/dist/features/media/assets.js +3 -2
- package/dist/features/media/assets.js.map +1 -1
- package/dist/features/media/components/FileView.js +13 -4
- package/dist/features/media/components/FileView.js.map +1 -1
- package/dist/features/media/feature.d.ts +3 -3
- package/dist/features/media/feature.js +21 -28
- package/dist/features/media/feature.js.map +1 -1
- package/dist/features/media/file-import.js +2 -2
- package/dist/features/media/file-import.js.map +1 -1
- package/dist/features/media/index.d.ts +2 -2
- package/dist/features/media/index.js +3 -3
- package/dist/features/media/react/AudioRecorderModal.js +1 -1
- package/dist/features/media/react/FileView.js +19 -2
- package/dist/features/media/react/FileView.js.map +1 -1
- package/dist/features/media/react.js +1 -1
- package/dist/features/media/schema.d.ts +8 -0
- package/dist/features/media/schema.js +126 -11
- package/dist/features/media/schema.js.map +1 -1
- package/dist/features/media/upload.d.ts +16 -14
- package/dist/features/media/upload.js +13 -19
- package/dist/features/media/upload.js.map +1 -1
- package/dist/features/mentions/index.d.ts +4 -3
- package/dist/features/mentions/index.js +4 -1
- package/dist/features/mentions/index.js.map +1 -1
- package/dist/features/mentions/mention-text.d.ts +1 -1
- package/dist/features/mentions/mention-text.js.map +1 -1
- package/dist/features/mentions/mention.d.ts +0 -6
- package/dist/features/mentions/mention.js.map +1 -1
- package/dist/features/mentions/metadata-defaults.d.ts +2 -2
- package/dist/features/mentions/metadata-defaults.js +3 -9
- package/dist/features/mentions/metadata-defaults.js.map +1 -1
- package/dist/features/mentions/schema.d.ts +2 -1
- package/dist/features/mentions/schema.js.map +1 -1
- package/dist/features/tables/feature.d.ts +2 -1
- package/dist/features/tables/feature.js +90 -70
- package/dist/features/tables/feature.js.map +1 -1
- package/dist/features/themes/components/SettingsAppearanceTab.js +6 -9
- package/dist/features/themes/components/SettingsAppearanceTab.js.map +1 -1
- package/dist/features/themes/feature.js +2 -0
- package/dist/features/themes/feature.js.map +1 -1
- package/dist/features/themes/index.d.ts +2 -1
- package/dist/features/themes/react/SettingsAppearanceTab.js +7 -10
- package/dist/features/themes/react/SettingsAppearanceTab.js.map +1 -1
- package/dist/features/themes/schema.d.ts +2 -6
- package/dist/features/themes/schema.js.map +1 -1
- package/dist/features/themes/theme-runtime.d.ts +1 -1
- package/dist/features/themes/theme-runtime.js +4 -2
- package/dist/features/themes/theme-runtime.js.map +1 -1
- package/dist/features/transcript/TranscriptSegmentView.js +48 -28
- package/dist/features/transcript/TranscriptSegmentView.js.map +1 -1
- package/dist/features/transcript/feature.js +21 -19
- package/dist/features/transcript/feature.js.map +1 -1
- package/dist/features/transcript/react/TranscriptSegmentView.js +55 -36
- package/dist/features/transcript/react/TranscriptSegmentView.js.map +1 -1
- package/dist/features/transcript/segment-node.d.ts +2 -0
- package/dist/features/transcript/segment-node.js +35 -7
- package/dist/features/transcript/segment-node.js.map +1 -1
- package/dist/i18n/de/composites.js +91 -1
- package/dist/i18n/de/composites.js.map +1 -1
- package/dist/i18n/de/integrations.js +49 -8
- package/dist/i18n/de/integrations.js.map +1 -1
- package/dist/i18n/de/media.js +0 -1
- package/dist/i18n/de/media.js.map +1 -1
- package/dist/i18n/de/palette.js +22 -0
- package/dist/i18n/de/palette.js.map +1 -0
- package/dist/i18n/de/tables.js +0 -1
- package/dist/i18n/de/tables.js.map +1 -1
- package/dist/i18n/de/transcript.js +2 -1
- package/dist/i18n/de/transcript.js.map +1 -1
- package/dist/i18n/de/tree.js +3 -0
- package/dist/i18n/de/tree.js.map +1 -1
- package/dist/i18n/de.d.ts +157 -11
- package/dist/i18n/de.js +3 -1
- package/dist/i18n/de.js.map +1 -1
- package/dist/i18n/en/composites.js +89 -1
- package/dist/i18n/en/composites.js.map +1 -1
- package/dist/i18n/en/integrations.js +49 -8
- package/dist/i18n/en/integrations.js.map +1 -1
- package/dist/i18n/en/media.js +0 -1
- package/dist/i18n/en/media.js.map +1 -1
- package/dist/i18n/en/palette.js +22 -0
- package/dist/i18n/en/palette.js.map +1 -0
- package/dist/i18n/en/tables.js +0 -1
- package/dist/i18n/en/tables.js.map +1 -1
- package/dist/i18n/en/transcript.js +2 -1
- package/dist/i18n/en/transcript.js.map +1 -1
- package/dist/i18n/en/tree.js +3 -0
- package/dist/i18n/en/tree.js.map +1 -1
- package/dist/i18n/en.js +3 -1
- package/dist/i18n/en.js.map +1 -1
- package/dist/index.d.ts +4 -3
- package/dist/integrations/composite-ai/bibliography-fetch.d.ts +31 -0
- package/dist/integrations/composite-ai/bibliography-fetch.js +159 -0
- package/dist/integrations/composite-ai/bibliography-fetch.js.map +1 -0
- package/dist/integrations/composite-ai/composite-fill.d.ts +30 -8
- package/dist/integrations/composite-ai/composite-fill.js +97 -56
- package/dist/integrations/composite-ai/composite-fill.js.map +1 -1
- package/dist/integrations/composite-ai/composite-summary.d.ts +4 -12
- package/dist/integrations/composite-ai/composite-summary.js +7 -26
- package/dist/integrations/composite-ai/composite-summary.js.map +1 -1
- package/dist/integrations/composite-ai/derive.d.ts +29 -0
- package/dist/integrations/composite-ai/derive.js +173 -0
- package/dist/integrations/composite-ai/derive.js.map +1 -0
- package/dist/integrations/composite-ai/index.d.ts +11 -7
- package/dist/integrations/composite-ai/index.js +72 -14
- package/dist/integrations/composite-ai/index.js.map +1 -1
- package/dist/integrations/composite-ai/rendition.d.ts +45 -0
- package/dist/integrations/composite-ai/rendition.js +314 -0
- package/dist/integrations/composite-ai/rendition.js.map +1 -0
- package/dist/integrations/composite-media/index.d.ts +7 -5
- package/dist/integrations/composite-media/index.js +86 -13
- package/dist/integrations/composite-media/index.js.map +1 -1
- package/dist/integrations/transcript-ai/index.d.ts +1 -1
- package/dist/integrations/transcript-ai/index.js +5 -2
- package/dist/integrations/transcript-ai/index.js.map +1 -1
- package/dist/integrations/transcript-ai/protocol.d.ts +2 -12
- package/dist/integrations/transcript-ai/protocol.js +0 -2
- package/dist/integrations/transcript-ai/protocol.js.map +1 -1
- package/dist/integrations/transcript-ai/transcript-cleanup.d.ts +5 -5
- package/dist/integrations/transcript-ai/transcript-cleanup.js +7 -10
- package/dist/integrations/transcript-ai/transcript-cleanup.js.map +1 -1
- package/dist/markdown/MarkdownSurface.vue.d.ts +12 -11
- package/dist/markdown/MarkdownSurface2.js +3 -6
- package/dist/markdown/MarkdownSurface2.js.map +1 -1
- package/dist/markdown/document.js +1 -1
- package/dist/markdown/source-mode.d.ts +1 -1
- package/dist/nuxt/module.d.ts +1402 -54
- package/dist/nuxt/module.js +6 -49
- package/dist/nuxt/module.js.map +1 -1
- package/dist/nuxt/runtime/install-context.d.ts +7 -3
- package/dist/nuxt/runtime/install-context.js +14 -8
- package/dist/nuxt/runtime/install-context.js.map +1 -1
- package/dist/nuxt/runtime/plugins/editor-context-nuxt-ui.client.ts +2 -2
- package/dist/nuxt/runtime/server/plugins/editor-server.js +20 -12
- package/dist/nuxt/runtime/server/plugins/editor-server.js.map +1 -1
- package/dist/presets/compose.d.ts +94 -0
- package/dist/presets/compose.js +164 -0
- package/dist/presets/compose.js.map +1 -0
- package/dist/react/AdvancedEditor.d.ts +15 -15
- package/dist/react/AdvancedEditor.js +15 -13
- package/dist/react/AdvancedEditor.js.map +1 -1
- package/dist/react/EditorCommandPalette.d.ts +13 -0
- package/dist/react/EditorCommandPalette.js +118 -0
- package/dist/react/EditorCommandPalette.js.map +1 -0
- package/dist/react/EditorSettingsModal.d.ts +5 -5
- package/dist/react/EditorSettingsModal.js +7 -4
- package/dist/react/EditorSettingsModal.js.map +1 -1
- package/dist/react/EditorSettingsPanel.d.ts +7 -7
- package/dist/react/EditorSettingsPanel.js +8 -5
- package/dist/react/EditorSettingsPanel.js.map +1 -1
- package/dist/react/EditorSurface.d.ts +7 -7
- package/dist/react/EditorSurface.js +10 -6
- package/dist/react/EditorSurface.js.map +1 -1
- package/dist/react/EditorToolbar.d.ts +4 -6
- package/dist/react/EditorToolbar.js +29 -37
- package/dist/react/EditorToolbar.js.map +1 -1
- package/dist/react/SimpleEditor.d.ts +22 -23
- package/dist/react/SimpleEditor.js +21 -7
- package/dist/react/SimpleEditor.js.map +1 -1
- package/dist/react/advanced.d.ts +4 -3
- package/dist/react/advanced.js +2 -2
- package/dist/react/compose.d.ts +20 -0
- package/dist/react/compose.js +49 -0
- package/dist/react/compose.js.map +1 -0
- package/dist/react/composed-surface.d.ts +39 -0
- package/dist/react/composed-surface.js +71 -0
- package/dist/react/composed-surface.js.map +1 -0
- package/dist/react/context.js +6 -2
- package/dist/react/context.js.map +1 -1
- package/dist/react/index.d.ts +2 -1
- package/dist/react/index.js +2 -1
- package/dist/react/key-labels.js +15 -0
- package/dist/react/key-labels.js.map +1 -0
- package/dist/react/settings.d.ts +1 -1
- package/dist/react/simple.d.ts +2 -2
- package/dist/react/ui/command.js +36 -1
- package/dist/react/ui/command.js.map +1 -1
- package/dist/schema/advanced.d.ts +6 -6
- package/dist/schema/advanced.js +26 -29
- package/dist/schema/advanced.js.map +1 -1
- package/dist/server/ai.d.ts +5 -16
- package/dist/server/ai.js.map +1 -1
- package/dist/server/auth.d.ts +9 -0
- package/dist/server/collab-state.d.ts +1 -1
- package/dist/server/collab-state.js.map +1 -1
- package/dist/server/collab.d.ts +13 -13
- package/dist/server/collab.js +34 -18
- package/dist/server/collab.js.map +1 -1
- package/dist/server/crossref.js +78 -0
- package/dist/server/crossref.js.map +1 -0
- package/dist/server/errors.d.ts +1 -1
- package/dist/server/errors.js +1 -1
- package/dist/server/errors.js.map +1 -1
- package/dist/server/extract.js +308 -0
- package/dist/server/extract.js.map +1 -0
- package/dist/server/h3.d.ts +8 -0
- package/dist/{nuxt/runtime/server/utils/editor-route.js → server/h3.js} +8 -16
- package/dist/server/h3.js.map +1 -0
- package/dist/server/handlers/ai.d.ts +32 -10
- package/dist/server/handlers/ai.js +172 -37
- package/dist/server/handlers/ai.js.map +1 -1
- package/dist/server/handlers/context.d.ts +12 -5
- package/dist/server/handlers/context.js +10 -4
- package/dist/server/handlers/context.js.map +1 -1
- package/dist/server/handlers/editor.d.ts +19 -13
- package/dist/server/handlers/editor.js +49 -38
- package/dist/server/handlers/editor.js.map +1 -1
- package/dist/server/handlers/index.d.ts +4 -4
- package/dist/server/handlers/index.js +4 -4
- package/dist/server/host.d.ts +16 -25
- package/dist/server/host.js +58 -41
- package/dist/server/host.js.map +1 -1
- package/dist/server/index.d.ts +6 -4
- package/dist/server/index.js +3 -2
- package/dist/server/pdf.js +97 -0
- package/dist/server/pdf.js.map +1 -0
- package/dist/server/{adapter.d.ts → ports.d.ts} +81 -30
- package/dist/server/ports.js +29 -0
- package/dist/server/ports.js.map +1 -0
- package/dist/server/routes.d.ts +22 -0
- package/dist/server/routes.js +144 -0
- package/dist/server/routes.js.map +1 -0
- package/dist/settings/index.d.ts +1 -1
- package/dist/settings/index.js.map +1 -1
- package/dist/styles/composites.css +25 -0
- package/dist/tree/DocumentTree.js +56 -29
- package/dist/tree/DocumentTree.js.map +1 -1
- package/dist/tree/react/DocumentTree.js +23 -0
- package/dist/tree/react/DocumentTree.js.map +1 -1
- package/dist/tree/tree-host.js +2 -2
- package/dist/tree/tree-items.js +1 -1
- package/dist/vue/AdvancedEditor.js +30 -9
- package/dist/vue/AdvancedEditor.js.map +1 -1
- package/dist/vue/AdvancedEditor.vue.d.ts +32 -12
- package/dist/vue/SimpleEditor.js +62 -16
- package/dist/vue/SimpleEditor.js.map +1 -1
- package/dist/vue/SimpleEditor.vue.d.ts +39 -9
- package/dist/vue/advanced.d.ts +3 -2
- package/dist/vue/advanced.js +2 -2
- package/dist/vue/components/EditorCommandPalette.js +91 -0
- package/dist/vue/components/EditorCommandPalette.js.map +1 -0
- package/dist/vue/components/EditorCommandPalette.vue.d.ts +15 -0
- package/dist/vue/components/EditorSettingsModal.js +10 -6
- package/dist/vue/components/EditorSettingsModal.js.map +1 -1
- package/dist/vue/components/EditorSettingsModal.vue.d.ts +4 -4
- package/dist/vue/components/EditorSettingsPanel.js +10 -6
- package/dist/vue/components/EditorSettingsPanel.js.map +1 -1
- package/dist/vue/components/EditorSettingsPanel.vue.d.ts +6 -6
- package/dist/vue/components/EditorSurface.js +11 -6
- package/dist/vue/components/EditorSurface.js.map +1 -1
- package/dist/vue/components/EditorSurface.vue.d.ts +11 -11
- package/dist/vue/components/EditorToolbar.js +41 -49
- package/dist/vue/components/EditorToolbar.js.map +1 -1
- package/dist/vue/components/EditorToolbar.vue.d.ts +2 -4
- package/dist/vue/compose.d.ts +17 -0
- package/dist/vue/compose.js +51 -0
- package/dist/vue/compose.js.map +1 -0
- package/dist/vue/context-key.d.ts +6 -0
- package/dist/vue/context-key.js +6 -0
- package/dist/vue/context-key.js.map +1 -0
- package/dist/vue/context.d.ts +8 -6
- package/dist/vue/context.js +6 -5
- package/dist/vue/context.js.map +1 -1
- package/dist/vue/index.d.ts +10 -8
- package/dist/vue/index.js +10 -8
- package/dist/vue/kit/index.d.ts +2 -2
- package/dist/vue/kit/nuxt-ui.js +23 -0
- package/dist/vue/kit/nuxt-ui.js.map +1 -1
- package/dist/vue/kit/types.d.ts +40 -1
- package/package.json +30 -16
- package/dist/adapters/comments/client.d.ts +0 -64
- package/dist/adapters/comments/client.js.map +0 -1
- package/dist/adapters/routes.js.map +0 -1
- package/dist/core/toolbar.d.ts +0 -74
- package/dist/core/toolbar.js +0 -45
- package/dist/core/toolbar.js.map +0 -1
- package/dist/integrations/composite-ai/document-transcribe.d.ts +0 -14
- package/dist/integrations/composite-ai/document-transcribe.js +0 -89
- package/dist/integrations/composite-ai/document-transcribe.js.map +0 -1
- package/dist/nuxt/runtime/server/api/ai/chat.post.d.ts +0 -5
- package/dist/nuxt/runtime/server/api/ai/chat.post.js +0 -8
- package/dist/nuxt/runtime/server/api/ai/chat.post.js.map +0 -1
- package/dist/nuxt/runtime/server/api/ai/complete.post.d.ts +0 -5
- package/dist/nuxt/runtime/server/api/ai/complete.post.js +0 -8
- package/dist/nuxt/runtime/server/api/ai/complete.post.js.map +0 -1
- package/dist/nuxt/runtime/server/api/ai/generate.post.d.ts +0 -5
- package/dist/nuxt/runtime/server/api/ai/generate.post.js +0 -8
- package/dist/nuxt/runtime/server/api/ai/generate.post.js.map +0 -1
- package/dist/nuxt/runtime/server/api/ai/models.get.d.ts +0 -5
- package/dist/nuxt/runtime/server/api/ai/models.get.js +0 -8
- package/dist/nuxt/runtime/server/api/ai/models.get.js.map +0 -1
- package/dist/nuxt/runtime/server/api/ai/transcribe.post.d.ts +0 -5
- package/dist/nuxt/runtime/server/api/ai/transcribe.post.js +0 -8
- package/dist/nuxt/runtime/server/api/ai/transcribe.post.js.map +0 -1
- package/dist/nuxt/runtime/server/api/ai/transcript-cleanup.post.d.ts +0 -5
- package/dist/nuxt/runtime/server/api/ai/transcript-cleanup.post.js +0 -8
- package/dist/nuxt/runtime/server/api/ai/transcript-cleanup.post.js.map +0 -1
- package/dist/nuxt/runtime/server/api/editor/assets/[id]/[name].get.d.ts +0 -5
- package/dist/nuxt/runtime/server/api/editor/assets/[id]/[name].get.js +0 -8
- package/dist/nuxt/runtime/server/api/editor/assets/[id]/[name].get.js.map +0 -1
- package/dist/nuxt/runtime/server/api/editor/assets/[id].post.d.ts +0 -5
- package/dist/nuxt/runtime/server/api/editor/assets/[id].post.js +0 -8
- package/dist/nuxt/runtime/server/api/editor/assets/[id].post.js.map +0 -1
- package/dist/nuxt/runtime/server/api/editor/settings.get.d.ts +0 -5
- package/dist/nuxt/runtime/server/api/editor/settings.get.js +0 -8
- package/dist/nuxt/runtime/server/api/editor/settings.get.js.map +0 -1
- package/dist/nuxt/runtime/server/api/editor/settings.put.d.ts +0 -5
- package/dist/nuxt/runtime/server/api/editor/settings.put.js +0 -8
- package/dist/nuxt/runtime/server/api/editor/settings.put.js.map +0 -1
- package/dist/nuxt/runtime/server/api/editor/tags.get.d.ts +0 -5
- package/dist/nuxt/runtime/server/api/editor/tags.get.js +0 -8
- package/dist/nuxt/runtime/server/api/editor/tags.get.js.map +0 -1
- package/dist/nuxt/runtime/server/api/editor/themes/[id].delete.d.ts +0 -5
- package/dist/nuxt/runtime/server/api/editor/themes/[id].delete.js +0 -8
- package/dist/nuxt/runtime/server/api/editor/themes/[id].delete.js.map +0 -1
- package/dist/nuxt/runtime/server/api/editor/themes/[id].get.d.ts +0 -5
- package/dist/nuxt/runtime/server/api/editor/themes/[id].get.js +0 -8
- package/dist/nuxt/runtime/server/api/editor/themes/[id].get.js.map +0 -1
- package/dist/nuxt/runtime/server/api/editor/themes/index.get.d.ts +0 -5
- package/dist/nuxt/runtime/server/api/editor/themes/index.get.js +0 -8
- package/dist/nuxt/runtime/server/api/editor/themes/index.get.js.map +0 -1
- package/dist/nuxt/runtime/server/api/editor/themes/index.post.d.ts +0 -5
- package/dist/nuxt/runtime/server/api/editor/themes/index.post.js +0 -8
- package/dist/nuxt/runtime/server/api/editor/themes/index.post.js.map +0 -1
- package/dist/nuxt/runtime/server/api/editor/users.get.d.ts +0 -5
- package/dist/nuxt/runtime/server/api/editor/users.get.js +0 -8
- package/dist/nuxt/runtime/server/api/editor/users.get.js.map +0 -1
- package/dist/nuxt/runtime/server/plugins/collab.d.ts +0 -5
- package/dist/nuxt/runtime/server/plugins/collab.js +0 -10
- package/dist/nuxt/runtime/server/plugins/collab.js.map +0 -1
- package/dist/nuxt/runtime/server/routes/collab/[id].d.ts +0 -5
- package/dist/nuxt/runtime/server/routes/collab/[id].js +0 -35
- package/dist/nuxt/runtime/server/routes/collab/[id].js.map +0 -1
- package/dist/nuxt/runtime/server/utils/editor-route.d.ts +0 -11
- package/dist/nuxt/runtime/server/utils/editor-route.js.map +0 -1
- package/dist/presets/advanced.d.ts +0 -33
- package/dist/presets/advanced.js +0 -50
- package/dist/presets/advanced.js.map +0 -1
- package/dist/presets/simple.d.ts +0 -9
- package/dist/presets/simple.js +0 -12
- package/dist/presets/simple.js.map +0 -1
- package/dist/react/advanced-preset.d.ts +0 -11
- package/dist/react/advanced-preset.js +0 -31
- package/dist/react/advanced-preset.js.map +0 -1
- package/dist/vue/advanced-preset.d.ts +0 -13
- package/dist/vue/advanced-preset.js +0 -33
- package/dist/vue/advanced-preset.js.map +0 -1
- package/docs/extending.md +0 -538
- package/docs/integration.md +0 -632
- package/docs/llms.md +0 -383
- package/docs/usage.md +0 -1076
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
import { BackendError } from "./backend.js";
|
|
2
|
+
import { AI_API, EDITOR_API, documentUrl } from "./api-routes.js";
|
|
3
|
+
//#region src/core/http-backend.ts
|
|
4
|
+
function platformSend(url, { method, headers: extra, body, query, signal } = {}) {
|
|
5
|
+
const headers = new Headers(extra);
|
|
6
|
+
let payload;
|
|
7
|
+
if (typeof body === "string" || typeof FormData !== "undefined" && body instanceof FormData) payload = body;
|
|
8
|
+
else if (body !== void 0) {
|
|
9
|
+
headers.set("content-type", "application/json");
|
|
10
|
+
payload = JSON.stringify(body);
|
|
11
|
+
}
|
|
12
|
+
const target = query ? `${url}?${new URLSearchParams(query)}` : url;
|
|
13
|
+
return globalThis.fetch(target, {
|
|
14
|
+
...method && { method },
|
|
15
|
+
headers,
|
|
16
|
+
...payload !== void 0 && { body: payload },
|
|
17
|
+
...signal && { signal }
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
/** The request through `fetcher.raw`: the response comes back unread (`stream`), a non-2xx one is a result, not an exception. */
|
|
21
|
+
function fetcherSend(fetcher) {
|
|
22
|
+
return (url, { method, headers, body, query, signal } = {}) => {
|
|
23
|
+
const options = {
|
|
24
|
+
responseType: "stream",
|
|
25
|
+
ignoreResponseError: true
|
|
26
|
+
};
|
|
27
|
+
if (method) options.method = method;
|
|
28
|
+
if (headers) options.headers = headers;
|
|
29
|
+
if (body !== void 0) options.body = body;
|
|
30
|
+
if (query) options.query = query;
|
|
31
|
+
if (signal) options.signal = signal;
|
|
32
|
+
return fetcher.raw(url, options);
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
/** The transport of `fetch` (default: the platform `fetch`). */
|
|
36
|
+
function createTransport(fetcher) {
|
|
37
|
+
const send = fetcher ? fetcherSend(fetcher) : platformSend;
|
|
38
|
+
async function check(response) {
|
|
39
|
+
if (response.ok) return response;
|
|
40
|
+
let message = `HTTP ${response.status}`;
|
|
41
|
+
try {
|
|
42
|
+
const json = await response.json();
|
|
43
|
+
message = json.statusMessage || json.message || message;
|
|
44
|
+
} catch {}
|
|
45
|
+
throw new BackendError(message, response.status);
|
|
46
|
+
}
|
|
47
|
+
return {
|
|
48
|
+
send,
|
|
49
|
+
check,
|
|
50
|
+
request: async (url, request) => check(await send(url, request))
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
/** Drops a response whose body nobody reads, so the connection is released. */
|
|
54
|
+
const discard = (response) => response.body?.cancel().catch(() => void 0);
|
|
55
|
+
/** The event of an SSE block (`event: x\ndata: {json}`); `data` is `{}` without a payload or with a malformed one. */
|
|
56
|
+
function streamEvent(raw) {
|
|
57
|
+
let event = "message";
|
|
58
|
+
let data = "";
|
|
59
|
+
for (const line of raw.split("\n")) if (line.startsWith("event:")) event = line.slice(6).trim();
|
|
60
|
+
else if (line.startsWith("data:")) data += line.slice(5).trimStart();
|
|
61
|
+
let payload = {};
|
|
62
|
+
if (data) try {
|
|
63
|
+
payload = JSON.parse(data);
|
|
64
|
+
} catch {
|
|
65
|
+
payload = {};
|
|
66
|
+
}
|
|
67
|
+
return {
|
|
68
|
+
event,
|
|
69
|
+
data: payload
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
/** The editor's HTTP routes as an `EditorBackend` without `collaboration` and `comments`. */
|
|
73
|
+
function createFetchBackend(options = {}) {
|
|
74
|
+
const base = options.base ?? "";
|
|
75
|
+
const { request, send, check } = createTransport(options.fetch);
|
|
76
|
+
const editor = (path) => `${base}${EDITOR_API}${path}`;
|
|
77
|
+
const ai = (path) => `${base}${AI_API}${path}`;
|
|
78
|
+
/** The JSON answer of a request that must succeed. */
|
|
79
|
+
const json = async (url, init) => (await request(url, init)).json();
|
|
80
|
+
/** A request that must succeed and whose answer is of no interest. */
|
|
81
|
+
const sent = async (url, init) => {
|
|
82
|
+
await discard(await request(url, init));
|
|
83
|
+
};
|
|
84
|
+
return {
|
|
85
|
+
name: "http",
|
|
86
|
+
documents: {
|
|
87
|
+
async load(id) {
|
|
88
|
+
const response = await send(`${base}${documentUrl(id)}`);
|
|
89
|
+
if (response.status === 404) {
|
|
90
|
+
await discard(response);
|
|
91
|
+
return null;
|
|
92
|
+
}
|
|
93
|
+
return (await check(response)).json();
|
|
94
|
+
},
|
|
95
|
+
save: (id, content) => sent(`${base}${documentUrl(id)}`, {
|
|
96
|
+
method: "PUT",
|
|
97
|
+
body: content
|
|
98
|
+
})
|
|
99
|
+
},
|
|
100
|
+
assets: { upload(documentId, file) {
|
|
101
|
+
const body = new FormData();
|
|
102
|
+
body.append("file", file);
|
|
103
|
+
return json(editor(`/assets/${documentId}`), {
|
|
104
|
+
method: "POST",
|
|
105
|
+
body
|
|
106
|
+
});
|
|
107
|
+
} },
|
|
108
|
+
users: { search: (query, signal) => json(editor("/users"), {
|
|
109
|
+
query: { q: query },
|
|
110
|
+
signal
|
|
111
|
+
}) },
|
|
112
|
+
tags: { search: (query, signal) => json(editor("/tags"), {
|
|
113
|
+
query: { q: query },
|
|
114
|
+
signal
|
|
115
|
+
}) },
|
|
116
|
+
settings: {
|
|
117
|
+
async load() {
|
|
118
|
+
const response = await request(editor("/settings"));
|
|
119
|
+
return response.status === 200 ? await response.json() : null;
|
|
120
|
+
},
|
|
121
|
+
save: (settings) => sent(editor("/settings"), {
|
|
122
|
+
method: "PUT",
|
|
123
|
+
body: settings
|
|
124
|
+
})
|
|
125
|
+
},
|
|
126
|
+
themes: {
|
|
127
|
+
list: () => json(editor("/themes")),
|
|
128
|
+
css: async (id) => (await request(editor(`/themes/${encodeURIComponent(id)}`))).text(),
|
|
129
|
+
store({ css, manifest }) {
|
|
130
|
+
const body = new FormData();
|
|
131
|
+
body.append("css", css);
|
|
132
|
+
if (manifest) body.append("manifest", manifest);
|
|
133
|
+
return json(editor("/themes"), {
|
|
134
|
+
method: "POST",
|
|
135
|
+
body
|
|
136
|
+
});
|
|
137
|
+
},
|
|
138
|
+
async remove(id) {
|
|
139
|
+
await sent(editor(`/themes/${encodeURIComponent(id)}`), { method: "DELETE" });
|
|
140
|
+
return true;
|
|
141
|
+
}
|
|
142
|
+
},
|
|
143
|
+
ai: {
|
|
144
|
+
models: () => json(ai("/models")),
|
|
145
|
+
complete: (body, signal) => json(ai("/complete"), {
|
|
146
|
+
method: "POST",
|
|
147
|
+
body,
|
|
148
|
+
signal
|
|
149
|
+
}),
|
|
150
|
+
async *stream(path, body, signal) {
|
|
151
|
+
const response = await request(ai(`/${path}`), {
|
|
152
|
+
method: "POST",
|
|
153
|
+
body,
|
|
154
|
+
signal
|
|
155
|
+
});
|
|
156
|
+
if (!response.body) throw new BackendError(`HTTP ${response.status}`, response.status);
|
|
157
|
+
const reader = response.body.getReader();
|
|
158
|
+
const decoder = new TextDecoder();
|
|
159
|
+
let buffer = "";
|
|
160
|
+
try {
|
|
161
|
+
while (true) {
|
|
162
|
+
const { value, done } = await reader.read();
|
|
163
|
+
if (done) break;
|
|
164
|
+
buffer += decoder.decode(value, { stream: true }).replace(/\r\n/g, "\n");
|
|
165
|
+
let index = buffer.indexOf("\n\n");
|
|
166
|
+
while (index !== -1) {
|
|
167
|
+
const event = streamEvent(buffer.slice(0, index));
|
|
168
|
+
yield event;
|
|
169
|
+
if (event.event === "done" || event.event === "error") return;
|
|
170
|
+
buffer = buffer.slice(index + 2);
|
|
171
|
+
index = buffer.indexOf("\n\n");
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
if (buffer.trim()) yield streamEvent(buffer);
|
|
175
|
+
} finally {
|
|
176
|
+
await reader.cancel().catch(() => void 0);
|
|
177
|
+
}
|
|
178
|
+
},
|
|
179
|
+
transcriptCleanup: (body, signal) => json(ai("/transcript-cleanup"), {
|
|
180
|
+
method: "POST",
|
|
181
|
+
body,
|
|
182
|
+
signal
|
|
183
|
+
}),
|
|
184
|
+
extract: (body, signal) => json(ai("/extract"), {
|
|
185
|
+
method: "POST",
|
|
186
|
+
body,
|
|
187
|
+
signal
|
|
188
|
+
})
|
|
189
|
+
}
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
//#endregion
|
|
193
|
+
export { createFetchBackend, createTransport };
|
|
194
|
+
|
|
195
|
+
//# sourceMappingURL=http-backend.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http-backend.js","names":[],"sources":["../../src/core/http-backend.ts"],"sourcesContent":["import type { JSONContent } from '@tiptap/core'\nimport type { $Fetch, FetchOptions } from 'ofetch'\nimport type { EditorSettings } from '../settings'\nimport { AI_API, documentUrl, EDITOR_API } from './api-routes'\nimport { type AiStreamEvent, BackendError, type EditorBackend } from './backend'\nimport type { ExtractResponse, MentionUser } from './backend-types'\n\n// The request-response half of the HTTP backend: documents, assets, users, tags, settings, themes and AI over the\n// `/api/editor` and `/api/ai` routes. `createHttpBackend` (`@ecsplico/editor/adapters/http`) adds the two capabilities that\n// need Yjs and the comments client; `createEditorContext` defaults to this half so no editor bundle carries those.\n// Requests go out through the platform `fetch`; a `$Fetch` (ofetch, Nuxt's `$fetch`) is used only when the host hands one\n// in, so no bundle pulls `ofetch` in unasked (the type import above is erased).\n\nexport interface FetchBackendOptions {\n /** HTTP client (default: the platform `fetch`); Nuxt hosts pass `useNuxtApp().$fetch` (it resolves relative paths while rendering on the server). */\n fetch?: $Fetch\n /** Prefix of every path (`https://api.example.com`); default `''` (same origin). */\n base?: string\n}\n\n/** One request of the transport: `body` is sent as it is when it is a string or `FormData`, else JSON-serialised; `query` becomes the query string. */\nexport interface HttpRequest {\n method?: string\n headers?: Record<string, string>\n body?: unknown\n query?: Record<string, string>\n signal?: AbortSignal | undefined\n}\n\nexport interface HttpTransport {\n /** Sends the request and resolves with the response whatever its status; rejects only on a network failure or abort. */\n send: (url: string, request?: HttpRequest) => Promise<Response>\n /** `response` itself when it is 2xx; otherwise rejects with a `BackendError` (the server's `statusMessage`/`message`, else `HTTP <status>`). */\n check: (response: Response) => Promise<Response>\n /** `send` then `check`. */\n request: (url: string, request?: HttpRequest) => Promise<Response>\n}\n\nfunction platformSend(url: string, { method, headers: extra, body, query, signal }: HttpRequest = {}): Promise<Response> {\n const headers = new Headers(extra)\n let payload: BodyInit | undefined\n if (typeof body === 'string' || (typeof FormData !== 'undefined' && body instanceof FormData)) payload = body\n else if (body !== undefined) {\n headers.set('content-type', 'application/json')\n payload = JSON.stringify(body)\n }\n const target = query ? `${url}?${new URLSearchParams(query)}` : url\n return globalThis.fetch(target, { ...(method && { method }), headers, ...(payload !== undefined && { body: payload }), ...(signal && { signal }) })\n}\n\n/** The request through `fetcher.raw`: the response comes back unread (`stream`), a non-2xx one is a result, not an exception. */\nfunction fetcherSend(fetcher: $Fetch) {\n return (url: string, { method, headers, body, query, signal }: HttpRequest = {}): Promise<Response> => {\n const options: FetchOptions<'stream'> = { responseType: 'stream', ignoreResponseError: true }\n if (method) options.method = method\n if (headers) options.headers = headers\n if (body !== undefined) options.body = body as Record<string, unknown>\n if (query) options.query = query\n if (signal) options.signal = signal\n return fetcher.raw(url, options)\n }\n}\n\n/** The transport of `fetch` (default: the platform `fetch`). */\nexport function createTransport(fetcher?: $Fetch): HttpTransport {\n const send = fetcher ? fetcherSend(fetcher) : platformSend\n async function check(response: Response) {\n if (response.ok) return response\n let message = `HTTP ${response.status}`\n try {\n const json = await response.json() as { statusMessage?: string, message?: string }\n message = json.statusMessage || json.message || message\n }\n catch { /* non-JSON error body */ }\n throw new BackendError(message, response.status)\n }\n return { send, check, request: async (url, request) => check(await send(url, request)) }\n}\n\n/** Drops a response whose body nobody reads, so the connection is released. */\nconst discard = (response: Response) => response.body?.cancel().catch(() => undefined)\n\n/** The event of an SSE block (`event: x\\ndata: {json}`); `data` is `{}` without a payload or with a malformed one. */\nfunction streamEvent(raw: string): AiStreamEvent {\n let event = 'message'\n let data = ''\n for (const line of raw.split('\\n')) {\n if (line.startsWith('event:')) event = line.slice(6).trim()\n else if (line.startsWith('data:')) data += line.slice(5).trimStart()\n }\n let payload: unknown = {}\n if (data) {\n try {\n payload = JSON.parse(data)\n }\n catch {\n payload = {}\n }\n }\n return { event: event as AiStreamEvent['event'], data: payload }\n}\n\n/** The editor's HTTP routes as an `EditorBackend` without `collaboration` and `comments`. */\nexport function createFetchBackend(options: FetchBackendOptions = {}): EditorBackend {\n const base = options.base ?? ''\n const { request, send, check } = createTransport(options.fetch)\n const editor = (path: string) => `${base}${EDITOR_API}${path}`\n const ai = (path: string) => `${base}${AI_API}${path}`\n /** The JSON answer of a request that must succeed. */\n const json = async <T>(url: string, init?: HttpRequest) => (await request(url, init)).json() as Promise<T>\n /** A request that must succeed and whose answer is of no interest. */\n const sent = async (url: string, init?: HttpRequest) => { await discard(await request(url, init)) }\n\n return {\n name: 'http',\n documents: {\n async load(id) {\n const response = await send(`${base}${documentUrl(id)}`)\n if (response.status === 404) {\n await discard(response)\n return null\n }\n return (await check(response)).json() as Promise<JSONContent>\n },\n save: (id, content) => sent(`${base}${documentUrl(id)}`, { method: 'PUT', body: content }),\n },\n assets: {\n upload(documentId, file) {\n const body = new FormData()\n body.append('file', file)\n return json<{ url: string, sha256?: string }>(editor(`/assets/${documentId}`), { method: 'POST', body })\n },\n },\n users: {\n search: (query, signal) => json<MentionUser[]>(editor('/users'), { query: { q: query }, signal }),\n },\n tags: {\n search: (query, signal) => json<string[]>(editor('/tags'), { query: { q: query }, signal }),\n },\n settings: {\n async load() {\n const response = await request(editor('/settings'))\n // 204: the host keeps no settings for this account.\n return response.status === 200 ? await response.json() as EditorSettings | null : null\n },\n save: settings => sent(editor('/settings'), { method: 'PUT', body: settings }),\n },\n themes: {\n list: () => json(editor('/themes')),\n css: async id => (await request(editor(`/themes/${encodeURIComponent(id)}`))).text(),\n store({ css, manifest }) {\n const body = new FormData()\n body.append('css', css)\n if (manifest) body.append('manifest', manifest)\n return json(editor('/themes'), { method: 'POST', body })\n },\n async remove(id) {\n await sent(editor(`/themes/${encodeURIComponent(id)}`), { method: 'DELETE' })\n return true\n },\n },\n ai: {\n models: () => json(ai('/models')),\n complete: (body, signal) => json<{ text: string }>(ai('/complete'), { method: 'POST', body, signal }),\n async* stream(path, body, signal) {\n const response = await request(ai(`/${path}`), { method: 'POST', body, signal })\n if (!response.body) throw new BackendError(`HTTP ${response.status}`, response.status)\n const reader = response.body.getReader()\n const decoder = new TextDecoder()\n let buffer = ''\n try {\n while (true) {\n const { value, done } = await reader.read()\n if (done) break\n buffer += decoder.decode(value, { stream: true }).replace(/\\r\\n/g, '\\n')\n let index = buffer.indexOf('\\n\\n')\n while (index !== -1) {\n const event = streamEvent(buffer.slice(0, index))\n yield event\n if (event.event === 'done' || event.event === 'error') return\n buffer = buffer.slice(index + 2)\n index = buffer.indexOf('\\n\\n')\n }\n }\n if (buffer.trim()) yield streamEvent(buffer)\n }\n finally {\n await reader.cancel().catch(() => undefined)\n }\n },\n transcriptCleanup: (body, signal) => json(ai('/transcript-cleanup'), { method: 'POST', body, signal }),\n extract: (body, signal) => json<ExtractResponse>(ai('/extract'), { method: 'POST', body, signal }),\n },\n }\n}\n"],"mappings":"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"}
|
package/dist/core/index.d.ts
CHANGED
|
@@ -1,28 +1,34 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { AbilitiesOptions, BlockAction, BlockActionContext, BlockTarget, SlashCommandItem } from "./extension-points.js";
|
|
3
|
-
import { Abilities, AbilitiesStorage, DEFAULT_ABILITY_RULES, abilitiesAt, abilitiesAtSelection, hasAbility } from "./abilities.js";
|
|
4
|
-
import { CORE_TARGET_IDS, ConvertTarget, Converter, ForeignBlocks, TextblockSpec, childrenOf, convertCoreBlocks, convertTargetId, coreConversionTargets, createConverter, finishConversion, isCoreSource, isCoreTarget, isCurrentTarget, isListNode, isQuoteNode, isTextblockNode, isWrapperBlock, parseCoreTarget, textblockSpecOf } from "./convert.js";
|
|
1
|
+
import { ReadonlyStore, Store, createStore, derived } from "./store.js";
|
|
5
2
|
import { CATALOGS, DEFAULT_LOCALE, LOCALES, Locale, MessageKey, MessageParams, Messages, Translate, createTranslator, isLocale } from "../i18n/index.js";
|
|
3
|
+
import { BackendCapability } from "./backend-capability.js";
|
|
4
|
+
import { AiStreamEvent, BackendCommentsOptions, BackendError, CollaborationToken, EditorBackend } from "./backend.js";
|
|
6
5
|
import { Notice, Notifier, silentNotifier } from "./notify.js";
|
|
7
|
-
import { ReadonlyStore, Store, createStore, derived } from "./store.js";
|
|
8
6
|
import { EditorAiConfig, EditorContext, EditorContextOptions, createEditorContext } from "./context.js";
|
|
7
|
+
import { CORE_TARGET_IDS, ConvertTarget, Converter, ForeignBlocks, TextblockSpec, childrenOf, convertCoreBlocks, convertTargetId, coreConversionTargets, createConverter, finishConversion, isCoreSource, isCoreTarget, isCurrentTarget, isListNode, isQuoteNode, isTextblockNode, isWrapperBlock, parseCoreTarget, textblockSpecOf } from "./convert.js";
|
|
8
|
+
import { CommandBase, CommandDef, CommandState, Creates, InsertGuard, MenuItem, PlacedToolbarGroup, ToolbarGroupDef, TransactionGuard } from "./command-types.js";
|
|
9
|
+
import { AbilitiesOptions, BlockAction, BlockActionContext, BlockTarget } from "./extension-points.js";
|
|
9
10
|
import { EditorEntry, EditorUi, editorEntryOf, notifierOf, registerEditor } from "./editor-ui.js";
|
|
10
11
|
import { EditorMetadata, METADATA_LIST, MetadataItem, MetadataQuery, MetadataSource } from "./metadata-types.js";
|
|
11
12
|
import { Metadata, MetadataRegistry, createMetadataRegistry, filterMetadataItems, metadataOf } from "./metadata.js";
|
|
12
|
-
import { AiBlock, AiBlockDataProvider, AiBlockDataRequest, AiBlockDatum, AiContext, AiContextKind, AnchorResolver, AuthorIdentity, BlockPipeline, CollaborationSession, ConversionProvider, EditorFeature, EditorPreset, FeatureContext, SINGLETON_PIPELINE_HOOKS, SettingsTab
|
|
13
|
+
import { AiBlock, AiBlockDataProvider, AiBlockDataRequest, AiBlockDatum, AiContext, AiContextKind, AnchorResolver, AuthorIdentity, BlockPipeline, CollaborationSession, ConversionProvider, Dimension, EditorFeature, EditorPreset, FeatureContext, SINGLETON_PIPELINE_HOOKS, SettingsTab } from "./feature.js";
|
|
14
|
+
import { Abilities, AbilitiesStorage, DEFAULT_ABILITY_RULES, abilitiesAt, abilitiesAtSelection, hasAbility } from "./abilities.js";
|
|
13
15
|
import { BlockConvert, blockConversion, conversionLabel, conversionTargetGroups, convertMenuItems, coreConversions, parseConversionTarget, targetOwner } from "./block-convert.js";
|
|
14
16
|
import { startBlockDrag } from "./block-drag.js";
|
|
15
17
|
import { BlockFlash } from "./block-flash.js";
|
|
16
|
-
import { coreBlockActions,
|
|
18
|
+
import { CoreUi, coreBlockActions, coreContentFeature, coreUiFeature } from "./core-feature.js";
|
|
19
|
+
import { canCreateAt, command, commandState, commandsOf, guardsAccept, toolbarOf } from "./commands.js";
|
|
20
|
+
import { TransactionGuards, TransactionGuardsOptions, transactionGuardExtensions } from "./transaction-guards.js";
|
|
17
21
|
import { contributions, defineEditor, settingsTabsOf } from "./define-editor.js";
|
|
18
22
|
import { DocumentMarkdown } from "./document-markdown.js";
|
|
19
23
|
import { downloadText } from "./download.js";
|
|
20
24
|
import { DocAnchor, DocAnchors, DocAnchorsMeta, DocAnchorsOptions, anchorResolverOf, captureRange, docAnchorsKey, releaseRanges, resolveRange } from "./doc-anchors.js";
|
|
21
25
|
import { FeatureContextOptions, blockActionsOf, createFeatureContext } from "./feature-context.js";
|
|
22
26
|
import { fetchErrorMessage } from "./fetch-error.js";
|
|
27
|
+
import { sha256Hex } from "./hash.js";
|
|
28
|
+
import { PALETTE_OTHER_GROUP, PaletteEntry, PaletteGroup, filterPalette, paletteGroupsOf } from "./palette.js";
|
|
23
29
|
import { DEFAULT_BLOCK_PIPELINE, PresetStorage, aiBlockDataOf, aiContextOf, conversionsOf, formatAiResultOf, parseBlocks, pipelineOf, presetExtension, structureBlocks, wrapImportBlocks } from "./pipeline.js";
|
|
24
30
|
import { selectionRange } from "./selection-range.js";
|
|
25
31
|
import { SlashCommand, SlashCommandOptions, SlashCommandPluginKey } from "./slash.js";
|
|
26
32
|
import { SuggestionDisplay, SuggestionListProps, SuggestionPopup, SuggestionPopupHandle, SuggestionPopupRenderer, createSuggestionRender, suggestionPopupOf } from "./suggestion-popup.js";
|
|
27
|
-
import {
|
|
28
|
-
export { Abilities, type AbilitiesOptions, type AbilitiesStorage, type AiBlock, type AiBlockDataProvider, type AiBlockDataRequest, type AiBlockDatum, type AiContext, type AiContextKind, type AnchorResolver, type AuthorIdentity, type BlockAction, type BlockActionContext, BlockConvert, BlockFlash, type BlockPipeline, type BlockTarget, CATALOGS, CORE_TARGET_IDS, type CollaborationSession, type ConversionProvider, type ConvertTarget, type Converter, DEFAULT_ABILITY_RULES, DEFAULT_BLOCK_PIPELINE, DEFAULT_LOCALE, type DocAnchor, DocAnchors, type DocAnchorsMeta, type DocAnchorsOptions, DocumentMarkdown, type EditorAiConfig, type EditorContext, type EditorContextOptions, type EditorEntry, type EditorFeature, type EditorMetadata, type EditorPreset, type EditorUi, type FeatureContext, type FeatureContextOptions, type ForeignBlocks, LOCALES, type Locale, METADATA_LIST, type MenuItem, type MessageKey, type MessageParams, type Messages, Metadata, type MetadataItem, type MetadataQuery, type MetadataRegistry, type MetadataSource, type Notice, type Notifier, type PresetStorage, type ReadonlyStore, SINGLETON_PIPELINE_HOOKS, type SettingsTab, SlashCommand, type
|
|
33
|
+
import { CORE_TOOLBAR_GROUPS, coreCommands } from "./toolbar-items.js";
|
|
34
|
+
export { Abilities, type AbilitiesOptions, type AbilitiesStorage, type AiBlock, type AiBlockDataProvider, type AiBlockDataRequest, type AiBlockDatum, type AiContext, type AiContextKind, type AiStreamEvent, type AnchorResolver, type AuthorIdentity, type BackendCapability, type BackendCommentsOptions, BackendError, type BlockAction, type BlockActionContext, BlockConvert, BlockFlash, type BlockPipeline, type BlockTarget, CATALOGS, CORE_TARGET_IDS, CORE_TOOLBAR_GROUPS, type CollaborationSession, type CollaborationToken, type CommandBase, type CommandDef, type CommandState, type ConversionProvider, type ConvertTarget, type Converter, type CoreUi, type Creates, DEFAULT_ABILITY_RULES, DEFAULT_BLOCK_PIPELINE, DEFAULT_LOCALE, type Dimension, type DocAnchor, DocAnchors, type DocAnchorsMeta, type DocAnchorsOptions, DocumentMarkdown, type EditorAiConfig, type EditorBackend, type EditorContext, type EditorContextOptions, type EditorEntry, type EditorFeature, type EditorMetadata, type EditorPreset, type EditorUi, type FeatureContext, type FeatureContextOptions, type ForeignBlocks, type InsertGuard, LOCALES, type Locale, METADATA_LIST, type MenuItem, type MessageKey, type MessageParams, type Messages, Metadata, type MetadataItem, type MetadataQuery, type MetadataRegistry, type MetadataSource, type Notice, type Notifier, PALETTE_OTHER_GROUP, type PaletteEntry, type PaletteGroup, type PlacedToolbarGroup, type PresetStorage, type ReadonlyStore, SINGLETON_PIPELINE_HOOKS, type SettingsTab, SlashCommand, type SlashCommandOptions, SlashCommandPluginKey, type Store, type SuggestionDisplay, type SuggestionListProps, SuggestionPopup, type SuggestionPopupHandle, type SuggestionPopupRenderer, type TextblockSpec, type ToolbarGroupDef, type TransactionGuard, TransactionGuards, type TransactionGuardsOptions, type Translate, abilitiesAt, abilitiesAtSelection, aiBlockDataOf, aiContextOf, anchorResolverOf, blockActionsOf, blockConversion, canCreateAt, captureRange, childrenOf, command, commandState, commandsOf, contributions, conversionLabel, conversionTargetGroups, conversionsOf, convertCoreBlocks, convertMenuItems, convertTargetId, coreBlockActions, coreCommands, coreContentFeature, coreConversionTargets, coreConversions, coreUiFeature, createConverter, createEditorContext, createFeatureContext, createMetadataRegistry, createStore, createSuggestionRender, createTranslator, defineEditor, derived, docAnchorsKey, downloadText, editorEntryOf, fetchErrorMessage, filterMetadataItems, filterPalette, finishConversion, formatAiResultOf, guardsAccept, hasAbility, isCoreSource, isCoreTarget, isCurrentTarget, isListNode, isLocale, isQuoteNode, isTextblockNode, isWrapperBlock, metadataOf, notifierOf, paletteGroupsOf, parseBlocks, parseConversionTarget, parseCoreTarget, pipelineOf, presetExtension, registerEditor, releaseRanges, resolveRange, selectionRange, settingsTabsOf, sha256Hex, silentNotifier, startBlockDrag, structureBlocks, suggestionPopupOf, targetOwner, textblockSpecOf, toolbarOf, transactionGuardExtensions, wrapImportBlocks };
|
package/dist/core/index.js
CHANGED
|
@@ -1,27 +1,31 @@
|
|
|
1
1
|
import { Abilities, DEFAULT_ABILITY_RULES, abilitiesAt, abilitiesAtSelection, hasAbility } from "./abilities.js";
|
|
2
|
-
import {
|
|
2
|
+
import { SINGLETON_PIPELINE_HOOKS } from "./feature.js";
|
|
3
3
|
import { DEFAULT_BLOCK_PIPELINE, aiBlockDataOf, aiContextOf, conversionsOf, formatAiResultOf, parseBlocks, pipelineOf, presetExtension, structureBlocks, wrapImportBlocks } from "./pipeline.js";
|
|
4
|
+
import { contributions, defineEditor, settingsTabsOf } from "./define-editor.js";
|
|
5
|
+
import { Metadata, createMetadataRegistry, filterMetadataItems, metadataOf } from "./metadata.js";
|
|
6
|
+
import { editorEntryOf, notifierOf, registerEditor } from "./editor-ui.js";
|
|
7
|
+
import { canCreateAt, command, commandState, commandsOf, guardsAccept, toolbarOf } from "./commands.js";
|
|
8
|
+
import { CORE_TARGET_IDS, childrenOf, convertCoreBlocks, convertTargetId, coreConversionTargets, createConverter, finishConversion, isCoreSource, isCoreTarget, isCurrentTarget, isListNode, isQuoteNode, isTextblockNode, isWrapperBlock, parseCoreTarget, textblockSpecOf } from "./convert.js";
|
|
4
9
|
import { BlockConvert, blockConversion, conversionLabel, conversionTargetGroups, convertMenuItems, coreConversions, parseConversionTarget, targetOwner } from "./block-convert.js";
|
|
5
10
|
import { startBlockDrag } from "./block-drag.js";
|
|
6
11
|
import { BlockFlash } from "./block-flash.js";
|
|
12
|
+
import { BackendError } from "./backend.js";
|
|
7
13
|
import { CATALOGS, DEFAULT_LOCALE, LOCALES, createTranslator, isLocale } from "../i18n/index.js";
|
|
8
14
|
import { silentNotifier } from "./notify.js";
|
|
9
15
|
import { createStore, derived } from "./store.js";
|
|
10
16
|
import { createEditorContext } from "./context.js";
|
|
11
17
|
import { DocAnchors, anchorResolverOf, captureRange, docAnchorsKey, releaseRanges, resolveRange } from "./doc-anchors.js";
|
|
12
18
|
import { DocumentMarkdown } from "./document-markdown.js";
|
|
13
|
-
import { Metadata, createMetadataRegistry, filterMetadataItems, metadataOf } from "./metadata.js";
|
|
14
19
|
import { SuggestionPopup, createSuggestionRender, suggestionPopupOf } from "./suggestion-popup.js";
|
|
15
20
|
import { SlashCommand, SlashCommandPluginKey } from "./slash.js";
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import { SINGLETON_PIPELINE_HOOKS } from "./feature.js";
|
|
20
|
-
import { contributions, defineEditor, settingsTabsOf } from "./define-editor.js";
|
|
21
|
+
import { CORE_TOOLBAR_GROUPS, coreCommands } from "./toolbar-items.js";
|
|
22
|
+
import { coreBlockActions, coreContentFeature, coreUiFeature } from "./core-feature.js";
|
|
23
|
+
import { TransactionGuards, transactionGuardExtensions } from "./transaction-guards.js";
|
|
21
24
|
import { downloadText } from "./download.js";
|
|
22
|
-
import { editorEntryOf, notifierOf, registerEditor } from "./editor-ui.js";
|
|
23
25
|
import { blockActionsOf, createFeatureContext } from "./feature-context.js";
|
|
24
26
|
import { fetchErrorMessage } from "./fetch-error.js";
|
|
27
|
+
import { sha256Hex } from "./hash.js";
|
|
25
28
|
import { METADATA_LIST } from "./metadata-types.js";
|
|
29
|
+
import { PALETTE_OTHER_GROUP, filterPalette, paletteGroupsOf } from "./palette.js";
|
|
26
30
|
import { selectionRange } from "./selection-range.js";
|
|
27
|
-
export { Abilities, BlockConvert, BlockFlash, CATALOGS, CORE_TARGET_IDS, DEFAULT_ABILITY_RULES, DEFAULT_BLOCK_PIPELINE, DEFAULT_LOCALE, DocAnchors, DocumentMarkdown, LOCALES, METADATA_LIST, Metadata, SINGLETON_PIPELINE_HOOKS, SlashCommand, SlashCommandPluginKey, SuggestionPopup, abilitiesAt, abilitiesAtSelection, aiBlockDataOf, aiContextOf, anchorResolverOf, blockActionsOf, blockConversion, captureRange, childrenOf,
|
|
31
|
+
export { Abilities, BackendError, BlockConvert, BlockFlash, CATALOGS, CORE_TARGET_IDS, CORE_TOOLBAR_GROUPS, DEFAULT_ABILITY_RULES, DEFAULT_BLOCK_PIPELINE, DEFAULT_LOCALE, DocAnchors, DocumentMarkdown, LOCALES, METADATA_LIST, Metadata, PALETTE_OTHER_GROUP, SINGLETON_PIPELINE_HOOKS, SlashCommand, SlashCommandPluginKey, SuggestionPopup, TransactionGuards, abilitiesAt, abilitiesAtSelection, aiBlockDataOf, aiContextOf, anchorResolverOf, blockActionsOf, blockConversion, canCreateAt, captureRange, childrenOf, command, commandState, commandsOf, contributions, conversionLabel, conversionTargetGroups, conversionsOf, convertCoreBlocks, convertMenuItems, convertTargetId, coreBlockActions, coreCommands, coreContentFeature, coreConversionTargets, coreConversions, coreUiFeature, createConverter, createEditorContext, createFeatureContext, createMetadataRegistry, createStore, createSuggestionRender, createTranslator, defineEditor, derived, docAnchorsKey, downloadText, editorEntryOf, fetchErrorMessage, filterMetadataItems, filterPalette, finishConversion, formatAiResultOf, guardsAccept, hasAbility, isCoreSource, isCoreTarget, isCurrentTarget, isListNode, isLocale, isQuoteNode, isTextblockNode, isWrapperBlock, metadataOf, notifierOf, paletteGroupsOf, parseBlocks, parseConversionTarget, parseCoreTarget, pipelineOf, presetExtension, registerEditor, releaseRanges, resolveRange, selectionRange, settingsTabsOf, sha256Hex, silentNotifier, startBlockDrag, structureBlocks, suggestionPopupOf, targetOwner, textblockSpecOf, toolbarOf, transactionGuardExtensions, wrapImportBlocks };
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { EditorEntry } from "./editor-ui.js";
|
|
2
|
+
import { Editor } from "@tiptap/core";
|
|
3
|
+
//#region src/core/palette.d.ts
|
|
4
|
+
/** One row of the palette: a command (leaf, `run`) or a menu command with its menu rows as `children` (the second level). */
|
|
5
|
+
export interface PaletteEntry {
|
|
6
|
+
/** The command id; a row of a menu command is `<command id>:<index>`. */
|
|
7
|
+
id: string;
|
|
8
|
+
/** Already translated. */
|
|
9
|
+
label: string;
|
|
10
|
+
/** Iconify name, e.g. `i-lucide-table`; empty when the row has none. */
|
|
11
|
+
icon: string;
|
|
12
|
+
/** Shortcut keys, e.g. `['meta', 'b']`. */
|
|
13
|
+
kbds?: string[];
|
|
14
|
+
description?: string;
|
|
15
|
+
/** `commandState(...).enabled === false` (a menu command without an enabled row is disabled too). */
|
|
16
|
+
disabled: boolean;
|
|
17
|
+
/** The command is on at the selection (toggle style). */
|
|
18
|
+
active: boolean;
|
|
19
|
+
/** Runs the command; absent on a row that opens a second level. */
|
|
20
|
+
run?: () => void;
|
|
21
|
+
/** The rows of a menu command; selecting the entry opens them. */
|
|
22
|
+
children?: PaletteEntry[];
|
|
23
|
+
}
|
|
24
|
+
/** The entries of one toolbar group, in the group's order; commands without a toolbar group are the last group (`other`). */
|
|
25
|
+
export interface PaletteGroup {
|
|
26
|
+
id: string;
|
|
27
|
+
/** Already translated. */
|
|
28
|
+
label: string;
|
|
29
|
+
entries: PaletteEntry[];
|
|
30
|
+
}
|
|
31
|
+
/** The id and heading key of the group that holds the commands without a toolbar group. */
|
|
32
|
+
export declare const PALETTE_OTHER_GROUP = "other";
|
|
33
|
+
/**
|
|
34
|
+
* The palette of `editor`: every command of its surface (the features' commands after the host's `commands` transformer)
|
|
35
|
+
* that is listed (`palette !== false`, never a `component` command) and visible, grouped by toolbar group in the
|
|
36
|
+
* toolbar's order, the ungrouped commands last. Each entry's state is `commandState(editor, cmd, 'selection')`; menu
|
|
37
|
+
* commands carry the rows of their menu as a second level. Evaluated at call time: build it when the palette opens.
|
|
38
|
+
* `editor` is the raw instance the surface registered.
|
|
39
|
+
*/
|
|
40
|
+
export declare function paletteGroupsOf(editor: Editor, entry: Pick<EditorEntry, 'preset' | 'ctx'>): PaletteGroup[];
|
|
41
|
+
/**
|
|
42
|
+
* The groups with only the entries matching `query`: case-insensitive, `query` is a prefix or any substring of the
|
|
43
|
+
* entry's label or command id; entries that start with it come first. Empty groups drop out; a blank query keeps
|
|
44
|
+
* everything. Only the first level is filtered (a menu command's rows are the framework search's job).
|
|
45
|
+
*/
|
|
46
|
+
export declare function filterPalette(groups: readonly PaletteGroup[], query: string): PaletteGroup[];
|
|
47
|
+
//#endregion
|
|
48
|
+
//# sourceMappingURL=palette.d.ts.map
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { commandState, placeInGroups, toolbarGroupsOf } from "./commands.js";
|
|
2
|
+
//#region src/core/palette.ts
|
|
3
|
+
/** The id and heading key of the group that holds the commands without a toolbar group. */
|
|
4
|
+
const PALETTE_OTHER_GROUP = "other";
|
|
5
|
+
function entryOf(editor, cmd, state) {
|
|
6
|
+
if ("component" in cmd) return void 0;
|
|
7
|
+
const base = {
|
|
8
|
+
id: cmd.id,
|
|
9
|
+
label: cmd.label,
|
|
10
|
+
icon: cmd.icon,
|
|
11
|
+
...cmd.kbds && { kbds: cmd.kbds },
|
|
12
|
+
active: state.active
|
|
13
|
+
};
|
|
14
|
+
if ("run" in cmd) return {
|
|
15
|
+
...base,
|
|
16
|
+
disabled: !state.enabled,
|
|
17
|
+
run: () => cmd.run(editor)
|
|
18
|
+
};
|
|
19
|
+
const children = cmd.menu(editor).flatMap((item, index) => {
|
|
20
|
+
if (item.type || item.label === void 0) return [];
|
|
21
|
+
return [{
|
|
22
|
+
id: `${cmd.id}:${index}`,
|
|
23
|
+
label: item.label,
|
|
24
|
+
icon: item.icon ?? "",
|
|
25
|
+
...item.description !== void 0 && { description: item.description },
|
|
26
|
+
disabled: !!item.disabled,
|
|
27
|
+
active: false,
|
|
28
|
+
...item.onSelect && { run: item.onSelect }
|
|
29
|
+
}];
|
|
30
|
+
});
|
|
31
|
+
return {
|
|
32
|
+
...base,
|
|
33
|
+
disabled: !state.enabled || !children.some((child) => !child.disabled),
|
|
34
|
+
children
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* The palette of `editor`: every command of its surface (the features' commands after the host's `commands` transformer)
|
|
39
|
+
* that is listed (`palette !== false`, never a `component` command) and visible, grouped by toolbar group in the
|
|
40
|
+
* toolbar's order, the ungrouped commands last. Each entry's state is `commandState(editor, cmd, 'selection')`; menu
|
|
41
|
+
* commands carry the rows of their menu as a second level. Evaluated at call time: build it when the palette opens.
|
|
42
|
+
* `editor` is the raw instance the surface registered.
|
|
43
|
+
*/
|
|
44
|
+
function paletteGroupsOf(editor, entry) {
|
|
45
|
+
const { preset, ctx } = entry;
|
|
46
|
+
const rows = /* @__PURE__ */ new Map();
|
|
47
|
+
for (const cmd of ctx.commands()) {
|
|
48
|
+
if (cmd.palette === false) continue;
|
|
49
|
+
const state = commandState(editor, cmd, "selection");
|
|
50
|
+
if (!state.visible) continue;
|
|
51
|
+
const row = entryOf(editor, cmd, state);
|
|
52
|
+
if (row) rows.set(cmd, row);
|
|
53
|
+
}
|
|
54
|
+
const other = [];
|
|
55
|
+
const groups = placeInGroups(toolbarGroupsOf(preset), [...rows.keys()], (cmd) => other.push(rows.get(cmd))).filter((group) => group.items.length > 0 && (!group.visible || group.visible(editor))).map((group) => ({
|
|
56
|
+
id: group.id,
|
|
57
|
+
label: group.labelKey ? ctx.t(group.labelKey) : group.id,
|
|
58
|
+
entries: group.items.map((cmd) => rows.get(cmd))
|
|
59
|
+
}));
|
|
60
|
+
if (other.length) groups.push({
|
|
61
|
+
id: PALETTE_OTHER_GROUP,
|
|
62
|
+
label: ctx.t("palette.group.other"),
|
|
63
|
+
entries: other
|
|
64
|
+
});
|
|
65
|
+
return groups;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* The groups with only the entries matching `query`: case-insensitive, `query` is a prefix or any substring of the
|
|
69
|
+
* entry's label or command id; entries that start with it come first. Empty groups drop out; a blank query keeps
|
|
70
|
+
* everything. Only the first level is filtered (a menu command's rows are the framework search's job).
|
|
71
|
+
*/
|
|
72
|
+
function filterPalette(groups, query) {
|
|
73
|
+
const needle = query.trim().toLowerCase();
|
|
74
|
+
if (!needle) return [...groups];
|
|
75
|
+
const rank = (entry) => {
|
|
76
|
+
const label = entry.label.toLowerCase();
|
|
77
|
+
const id = entry.id.toLowerCase();
|
|
78
|
+
if (label.startsWith(needle) || id.startsWith(needle)) return 0;
|
|
79
|
+
return label.includes(needle) || id.includes(needle) ? 1 : void 0;
|
|
80
|
+
};
|
|
81
|
+
return groups.flatMap((group) => {
|
|
82
|
+
const entries = group.entries.flatMap((entry) => rank(entry) === void 0 ? [] : [{
|
|
83
|
+
entry,
|
|
84
|
+
rank: rank(entry)
|
|
85
|
+
}]).sort((a, b) => a.rank - b.rank).map((item) => item.entry);
|
|
86
|
+
return entries.length ? [{
|
|
87
|
+
...group,
|
|
88
|
+
entries
|
|
89
|
+
}] : [];
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
//#endregion
|
|
93
|
+
export { PALETTE_OTHER_GROUP, filterPalette, paletteGroupsOf };
|
|
94
|
+
|
|
95
|
+
//# sourceMappingURL=palette.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"palette.js","names":[],"sources":["../../src/core/palette.ts"],"sourcesContent":["import type { Editor } from '@tiptap/core'\nimport { type CommandDef, commandState, placeInGroups, toolbarGroupsOf } from './commands'\nimport type { EditorEntry } from './editor-ui'\n\n// The ⌘K palette's model, framework-free: the framework layers (`vue/components/EditorCommandPalette.vue`,\n// `react/EditorCommandPalette.tsx`) render `PaletteGroup`s and own nothing but the dialog and the search box.\n\n/** One row of the palette: a command (leaf, `run`) or a menu command with its menu rows as `children` (the second level). */\nexport interface PaletteEntry {\n /** The command id; a row of a menu command is `<command id>:<index>`. */\n id: string\n /** Already translated. */\n label: string\n /** Iconify name, e.g. `i-lucide-table`; empty when the row has none. */\n icon: string\n /** Shortcut keys, e.g. `['meta', 'b']`. */\n kbds?: string[]\n description?: string\n /** `commandState(...).enabled === false` (a menu command without an enabled row is disabled too). */\n disabled: boolean\n /** The command is on at the selection (toggle style). */\n active: boolean\n /** Runs the command; absent on a row that opens a second level. */\n run?: () => void\n /** The rows of a menu command; selecting the entry opens them. */\n children?: PaletteEntry[]\n}\n\n/** The entries of one toolbar group, in the group's order; commands without a toolbar group are the last group (`other`). */\nexport interface PaletteGroup {\n id: string\n /** Already translated. */\n label: string\n entries: PaletteEntry[]\n}\n\n/** The id and heading key of the group that holds the commands without a toolbar group. */\nexport const PALETTE_OTHER_GROUP = 'other'\n\nfunction entryOf(editor: Editor, cmd: CommandDef, state: { enabled: boolean, active: boolean }): PaletteEntry | undefined {\n if ('component' in cmd) return undefined\n const base = { id: cmd.id, label: cmd.label, icon: cmd.icon, ...(cmd.kbds && { kbds: cmd.kbds }), active: state.active }\n if ('run' in cmd) return { ...base, disabled: !state.enabled, run: () => cmd.run(editor) }\n const children = cmd.menu(editor).flatMap((item, index): PaletteEntry[] => {\n if (item.type || item.label === undefined) return []\n return [{\n id: `${cmd.id}:${index}`,\n label: item.label,\n icon: item.icon ?? '',\n ...(item.description !== undefined && { description: item.description }),\n disabled: !!item.disabled,\n active: false,\n ...(item.onSelect && { run: item.onSelect }),\n }]\n })\n return { ...base, disabled: !state.enabled || !children.some(child => !child.disabled), children }\n}\n\n/**\n * The palette of `editor`: every command of its surface (the features' commands after the host's `commands` transformer)\n * that is listed (`palette !== false`, never a `component` command) and visible, grouped by toolbar group in the\n * toolbar's order, the ungrouped commands last. Each entry's state is `commandState(editor, cmd, 'selection')`; menu\n * commands carry the rows of their menu as a second level. Evaluated at call time: build it when the palette opens.\n * `editor` is the raw instance the surface registered.\n */\nexport function paletteGroupsOf(editor: Editor, entry: Pick<EditorEntry, 'preset' | 'ctx'>): PaletteGroup[] {\n const { preset, ctx } = entry\n const rows = new Map<CommandDef, PaletteEntry>()\n for (const cmd of ctx.commands()) {\n if (cmd.palette === false) continue\n const state = commandState(editor, cmd, 'selection')\n if (!state.visible) continue\n const row = entryOf(editor, cmd, state)\n if (row) rows.set(cmd, row)\n }\n // Unlike the toolbar, a command naming a group no feature declares is not an error here: it is listed under `other`.\n const other: PaletteEntry[] = []\n const groups: PaletteGroup[] = placeInGroups(toolbarGroupsOf(preset), [...rows.keys()], cmd => other.push(rows.get(cmd)!))\n .filter(group => group.items.length > 0 && (!group.visible || group.visible(editor)))\n .map(group => ({ id: group.id, label: group.labelKey ? ctx.t(group.labelKey) : group.id, entries: group.items.map(cmd => rows.get(cmd)!) }))\n if (other.length) groups.push({ id: PALETTE_OTHER_GROUP, label: ctx.t('palette.group.other'), entries: other })\n return groups\n}\n\n/**\n * The groups with only the entries matching `query`: case-insensitive, `query` is a prefix or any substring of the\n * entry's label or command id; entries that start with it come first. Empty groups drop out; a blank query keeps\n * everything. Only the first level is filtered (a menu command's rows are the framework search's job).\n */\nexport function filterPalette(groups: readonly PaletteGroup[], query: string): PaletteGroup[] {\n const needle = query.trim().toLowerCase()\n if (!needle) return [...groups]\n const rank = (entry: PaletteEntry) => {\n const label = entry.label.toLowerCase()\n const id = entry.id.toLowerCase()\n if (label.startsWith(needle) || id.startsWith(needle)) return 0\n return label.includes(needle) || id.includes(needle) ? 1 : undefined\n }\n return groups.flatMap((group) => {\n const entries = group.entries\n .flatMap(entry => (rank(entry) === undefined ? [] : [{ entry, rank: rank(entry)! }]))\n .sort((a, b) => a.rank - b.rank)\n .map(item => item.entry)\n return entries.length ? [{ ...group, entries }] : []\n })\n}\n"],"mappings":"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"}
|
|
@@ -14,6 +14,7 @@ export declare const ABILITY: {
|
|
|
14
14
|
readonly media: "insert.media";
|
|
15
15
|
readonly record: "insert.record";
|
|
16
16
|
readonly mention: "insert.mention";
|
|
17
|
+
readonly reference: "insert.reference";
|
|
17
18
|
readonly tag: "insert.tag";
|
|
18
19
|
readonly aiRewrite: "ai.rewrite";
|
|
19
20
|
readonly aiGenerate: "ai.generate";
|
|
@@ -24,7 +25,7 @@ export declare const ABILITY: {
|
|
|
24
25
|
readonly compositeMeta: "composite.meta";
|
|
25
26
|
readonly compositeSummarize: "composite.summarize";
|
|
26
27
|
readonly compositeExport: "composite.export";
|
|
27
|
-
readonly
|
|
28
|
+
readonly compositeDerive: "composite.derive";
|
|
28
29
|
};
|
|
29
30
|
export type Ability = (typeof ABILITY)[keyof typeof ABILITY] | (string & {});
|
|
30
31
|
/** How a node changes the abilities of everything inside it: `grants`, then `revokes`; `own` only applies when it is the innermost node. */
|
|
@@ -13,6 +13,7 @@ const ABILITY = {
|
|
|
13
13
|
media: "insert.media",
|
|
14
14
|
record: "insert.record",
|
|
15
15
|
mention: "insert.mention",
|
|
16
|
+
reference: "insert.reference",
|
|
16
17
|
tag: "insert.tag",
|
|
17
18
|
aiRewrite: "ai.rewrite",
|
|
18
19
|
aiGenerate: "ai.generate",
|
|
@@ -23,7 +24,7 @@ const ABILITY = {
|
|
|
23
24
|
compositeMeta: "composite.meta",
|
|
24
25
|
compositeSummarize: "composite.summarize",
|
|
25
26
|
compositeExport: "composite.export",
|
|
26
|
-
|
|
27
|
+
compositeDerive: "composite.derive"
|
|
27
28
|
};
|
|
28
29
|
/** Everything a plain paragraph at document root can do. `composite.*` are `own` abilities of composites only. */
|
|
29
30
|
const ROOT_ABILITIES = [
|
|
@@ -39,6 +40,7 @@ const ROOT_ABILITIES = [
|
|
|
39
40
|
ABILITY.media,
|
|
40
41
|
ABILITY.record,
|
|
41
42
|
ABILITY.mention,
|
|
43
|
+
ABILITY.reference,
|
|
42
44
|
ABILITY.tag,
|
|
43
45
|
ABILITY.aiRewrite,
|
|
44
46
|
ABILITY.aiGenerate,
|
|
@@ -61,6 +63,7 @@ const TEXT_ABILITIES = [
|
|
|
61
63
|
ABILITY.media,
|
|
62
64
|
ABILITY.record,
|
|
63
65
|
ABILITY.mention,
|
|
66
|
+
ABILITY.reference,
|
|
64
67
|
ABILITY.tag,
|
|
65
68
|
ABILITY.aiRewrite,
|
|
66
69
|
ABILITY.aiGenerate,
|
|
@@ -88,6 +91,7 @@ const TYPE_ABILITIES = {
|
|
|
88
91
|
video: ABILITY.media,
|
|
89
92
|
file: ABILITY.media,
|
|
90
93
|
mention: ABILITY.mention,
|
|
94
|
+
reference: ABILITY.reference,
|
|
91
95
|
tag: ABILITY.tag
|
|
92
96
|
};
|
|
93
97
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"abilities.js","names":[],"sources":["../../../src/core/schema/abilities.ts"],"sourcesContent":["import type { Node as PMNode } from '@tiptap/pm/model'\n\n// Vue-free and server-importable: node schemas shared with the server declare their rule via `NodeConfig.abilities`.\n\n/** Ability ids. Hosts may add their own strings; these are the ones the editor itself checks. */\nexport const ABILITY = {\n marks: 'format.marks',\n headings: 'format.headings',\n lists: 'format.lists',\n blockquote: 'format.blockquote',\n codeBlock: 'format.codeBlock',\n rule: 'format.rule',\n blockContent: 'block.content',\n composite: 'format.composite',\n transcript: 'transcript.segment',\n media: 'insert.media',\n record: 'insert.record',\n mention: 'insert.mention',\n tag: 'insert.tag',\n aiRewrite: 'ai.rewrite',\n aiGenerate: 'ai.generate',\n aiAutocomplete: 'ai.autocomplete',\n blockDelete: 'block.delete',\n blockDuplicate: 'block.duplicate',\n blockConvert: 'block.convert',\n compositeMeta: 'composite.meta',\n compositeSummarize: 'composite.summarize',\n compositeExport: 'composite.export',\n
|
|
1
|
+
{"version":3,"file":"abilities.js","names":[],"sources":["../../../src/core/schema/abilities.ts"],"sourcesContent":["import type { Node as PMNode } from '@tiptap/pm/model'\n\n// Vue-free and server-importable: node schemas shared with the server declare their rule via `NodeConfig.abilities`.\n\n/** Ability ids. Hosts may add their own strings; these are the ones the editor itself checks. */\nexport const ABILITY = {\n marks: 'format.marks',\n headings: 'format.headings',\n lists: 'format.lists',\n blockquote: 'format.blockquote',\n codeBlock: 'format.codeBlock',\n rule: 'format.rule',\n blockContent: 'block.content',\n composite: 'format.composite',\n transcript: 'transcript.segment',\n media: 'insert.media',\n record: 'insert.record',\n mention: 'insert.mention',\n reference: 'insert.reference',\n tag: 'insert.tag',\n aiRewrite: 'ai.rewrite',\n aiGenerate: 'ai.generate',\n aiAutocomplete: 'ai.autocomplete',\n blockDelete: 'block.delete',\n blockDuplicate: 'block.duplicate',\n blockConvert: 'block.convert',\n compositeMeta: 'composite.meta',\n compositeSummarize: 'composite.summarize',\n compositeExport: 'composite.export',\n compositeDerive: 'composite.derive',\n} as const\n\nexport type Ability = (typeof ABILITY)[keyof typeof ABILITY] | (string & {})\n\n/** How a node changes the abilities of everything inside it: `grants`, then `revokes`; `own` only applies when it is the innermost node. */\nexport interface AbilityRule {\n grants?: readonly Ability[]\n revokes?: readonly Ability[]\n own?: readonly Ability[]\n}\n\nexport type AbilityRuleSource = AbilityRule | ((node: PMNode) => AbilityRule)\n\n/** Everything a plain paragraph at document root can do. `composite.*` are `own` abilities of composites only. */\nexport const ROOT_ABILITIES: readonly Ability[] = [\n ABILITY.marks, ABILITY.headings, ABILITY.lists, ABILITY.blockquote, ABILITY.codeBlock, ABILITY.rule, ABILITY.blockContent, ABILITY.composite,\n ABILITY.transcript, ABILITY.media, ABILITY.record, ABILITY.mention, ABILITY.reference, ABILITY.tag, ABILITY.aiRewrite, ABILITY.aiGenerate,\n ABILITY.aiAutocomplete, ABILITY.blockDelete, ABILITY.blockDuplicate, ABILITY.blockConvert,\n]\n\n/** Text-editing abilities an atom block (image/audio/video) or a tags row can never have. */\nexport const TEXT_ABILITIES: readonly Ability[] = [\n ABILITY.marks, ABILITY.headings, ABILITY.lists, ABILITY.blockquote, ABILITY.codeBlock, ABILITY.rule, ABILITY.blockContent, ABILITY.composite,\n ABILITY.transcript, ABILITY.media, ABILITY.record, ABILITY.mention, ABILITY.reference, ABILITY.tag, ABILITY.aiRewrite, ABILITY.aiGenerate,\n ABILITY.aiAutocomplete,\n]\n\n/** Node/mark type → ability its creation/toggling needs (toolbar fallback, shortcut + input-rule gate). */\nexport const TYPE_ABILITIES: Readonly<Record<string, Ability>> = {\n bold: ABILITY.marks,\n italic: ABILITY.marks,\n strike: ABILITY.marks,\n code: ABILITY.marks,\n heading: ABILITY.headings,\n bulletList: ABILITY.lists,\n orderedList: ABILITY.lists,\n listItem: ABILITY.lists,\n taskList: ABILITY.lists,\n taskItem: ABILITY.lists,\n blockquote: ABILITY.blockquote,\n codeBlock: ABILITY.codeBlock,\n horizontalRule: ABILITY.rule,\n composite: ABILITY.composite,\n transcriptSegment: ABILITY.transcript,\n image: ABILITY.media,\n audio: ABILITY.media,\n video: ABILITY.media,\n file: ABILITY.media,\n mention: ABILITY.mention,\n reference: ABILITY.reference,\n tag: ABILITY.tag,\n}\n\n/**\n * Abilities at the end of `chain` (ancestors from depth 1 down to and including the innermost node):\n * start with `root`; per node add its `grants`, remove its `revokes`; finally add the innermost node's `own`.\n */\nexport function resolveAbilities(rules: ReadonlyMap<string, AbilityRuleSource>, root: readonly Ability[], chain: readonly PMNode[]): ReadonlySet<Ability> {\n const set = new Set<Ability>(root)\n let own: readonly Ability[] | undefined\n for (const node of chain) {\n const source = rules.get(node.type.name)\n const rule = typeof source === 'function' ? source(node) : source\n for (const ability of rule?.grants ?? []) set.add(ability)\n for (const ability of rule?.revokes ?? []) set.delete(ability)\n own = rule?.own\n }\n for (const ability of own ?? []) set.add(ability)\n return set\n}\n\ndeclare module '@tiptap/core' {\n interface NodeConfig<Options, Storage> {\n /** Abilities this node grants/revokes for its content (`own`: only when it is the innermost node). Host rules override it. */\n abilities?: AbilityRuleSource\n }\n}\n"],"mappings":";;AAKA,MAAa,UAAU;CACrB,OAAO;CACP,UAAU;CACV,OAAO;CACP,YAAY;CACZ,WAAW;CACX,MAAM;CACN,cAAc;CACd,WAAW;CACX,YAAY;CACZ,OAAO;CACP,QAAQ;CACR,SAAS;CACT,WAAW;CACX,KAAK;CACL,WAAW;CACX,YAAY;CACZ,gBAAgB;CAChB,aAAa;CACb,gBAAgB;CAChB,cAAc;CACd,eAAe;CACf,oBAAoB;CACpB,iBAAiB;CACjB,iBAAiB;AACnB;;AAcA,MAAa,iBAAqC;CAChD,QAAQ;CAAO,QAAQ;CAAU,QAAQ;CAAO,QAAQ;CAAY,QAAQ;CAAW,QAAQ;CAAM,QAAQ;CAAc,QAAQ;CACnI,QAAQ;CAAY,QAAQ;CAAO,QAAQ;CAAQ,QAAQ;CAAS,QAAQ;CAAW,QAAQ;CAAK,QAAQ;CAAW,QAAQ;CAC/H,QAAQ;CAAgB,QAAQ;CAAa,QAAQ;CAAgB,QAAQ;AAC/E;;AAGA,MAAa,iBAAqC;CAChD,QAAQ;CAAO,QAAQ;CAAU,QAAQ;CAAO,QAAQ;CAAY,QAAQ;CAAW,QAAQ;CAAM,QAAQ;CAAc,QAAQ;CACnI,QAAQ;CAAY,QAAQ;CAAO,QAAQ;CAAQ,QAAQ;CAAS,QAAQ;CAAW,QAAQ;CAAK,QAAQ;CAAW,QAAQ;CAC/H,QAAQ;AACV;;AAGA,MAAa,iBAAoD;CAC/D,MAAM,QAAQ;CACd,QAAQ,QAAQ;CAChB,QAAQ,QAAQ;CAChB,MAAM,QAAQ;CACd,SAAS,QAAQ;CACjB,YAAY,QAAQ;CACpB,aAAa,QAAQ;CACrB,UAAU,QAAQ;CAClB,UAAU,QAAQ;CAClB,UAAU,QAAQ;CAClB,YAAY,QAAQ;CACpB,WAAW,QAAQ;CACnB,gBAAgB,QAAQ;CACxB,WAAW,QAAQ;CACnB,mBAAmB,QAAQ;CAC3B,OAAO,QAAQ;CACf,OAAO,QAAQ;CACf,OAAO,QAAQ;CACf,MAAM,QAAQ;CACd,SAAS,QAAQ;CACjB,WAAW,QAAQ;CACnB,KAAK,QAAQ;AACf;;;;;AAMA,SAAgB,iBAAiB,OAA+C,MAA0B,OAAgD;CACxJ,MAAM,MAAM,IAAI,IAAa,IAAI;CACjC,IAAI;CACJ,KAAK,MAAM,QAAQ,OAAO;EACxB,MAAM,SAAS,MAAM,IAAI,KAAK,KAAK,IAAI;EACvC,MAAM,OAAO,OAAO,WAAW,aAAa,OAAO,IAAI,IAAI;EAC3D,KAAK,MAAM,WAAW,MAAM,UAAU,CAAC,GAAG,IAAI,IAAI,OAAO;EACzD,KAAK,MAAM,WAAW,MAAM,WAAW,CAAC,GAAG,IAAI,OAAO,OAAO;EAC7D,MAAM,MAAM;CACd;CACA,KAAK,MAAM,WAAW,OAAO,CAAC,GAAG,IAAI,IAAI,OAAO;CAChD,OAAO;AACT"}
|
|
@@ -5,17 +5,23 @@ import { HEX_COLOR } from "./hex-color.js";
|
|
|
5
5
|
import { NodeFlags, isBlockContainer, isChromeNode, isEditorBlock } from "./node-flags.js";
|
|
6
6
|
import { OpaqueFence } from "./opaque-fence.js";
|
|
7
7
|
import { StrikeX } from "./strike.js";
|
|
8
|
+
import { schemaExtensionsOf } from "./of-features.js";
|
|
8
9
|
import { AnyExtension, JSONContent } from "@tiptap/core";
|
|
9
10
|
//#region src/core/schema/index.d.ts
|
|
10
11
|
/**
|
|
11
|
-
*
|
|
12
|
-
* editors, collaboration brings its own), StrikeX, the node-flags extension
|
|
13
|
-
* kinds, kept verbatim)
|
|
14
|
-
|
|
12
|
+
* The Vue-free nodes and marks of the content base (`core-content` feature): StarterKit (history off: the surface enables
|
|
13
|
+
* it for standalone editors, collaboration brings its own), StrikeX, the node-flags extension and `OpaqueFence` (Markdown
|
|
14
|
+
* fences of unknown kinds, kept verbatim). Without `BlockId`: `schemaExtensionsOf` appends it last.
|
|
15
|
+
*/
|
|
16
|
+
export declare const coreContentSchemaExtensions: () => AnyExtension[];
|
|
17
|
+
/**
|
|
18
|
+
* Base Vue-free nodes and marks of every editor: `coreContentSchemaExtensions()` and `BlockId`, which adds the `id`
|
|
19
|
+
* attribute to every block type (its ID-assigning plugins only run in an editor). The server builds its schema from
|
|
20
|
+
* these as well (`getSchema(...)`).
|
|
15
21
|
*/
|
|
16
22
|
export declare const coreSchemaExtensions: () => AnyExtension[];
|
|
17
23
|
/** Content of a fresh, empty document. */
|
|
18
24
|
export declare const EMPTY_EDITOR_CONTENT: JSONContent;
|
|
19
25
|
//#endregion
|
|
20
|
-
export { ABILITY, Ability, AbilityRule, AbilityRuleSource, BLOCK_ID_ATTR, BLOCK_ID_TYPES, BlockId, HEX_COLOR, NodeFlags, OpaqueFence, ROOT_ABILITIES, StrikeX, TEXT_ABILITIES, TYPE_ABILITIES, assignBlockIds, blockIdOf, findBlockById, isBlockContainer, isChromeNode, isEditorBlock, newBlockId, resolveAbilities };
|
|
26
|
+
export { ABILITY, Ability, AbilityRule, AbilityRuleSource, BLOCK_ID_ATTR, BLOCK_ID_TYPES, BlockId, HEX_COLOR, NodeFlags, OpaqueFence, ROOT_ABILITIES, StrikeX, TEXT_ABILITIES, TYPE_ABILITIES, assignBlockIds, blockIdOf, findBlockById, isBlockContainer, isChromeNode, isEditorBlock, newBlockId, resolveAbilities, schemaExtensionsOf };
|
|
21
27
|
//# sourceMappingURL=index.d.ts.map
|