@ecsplico/editor 2.1.1 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +74 -1
- package/README.md +39 -156
- package/dist/adapters/comments/drizzle.d.ts +1 -1
- package/dist/adapters/comments/{client.js → rest-model.js} +3 -3
- package/dist/adapters/comments/rest-model.js.map +1 -0
- package/dist/adapters/comments/types.d.ts +2 -2
- package/dist/adapters/document-state.d.ts +23 -0
- package/dist/adapters/document-state.js +66 -0
- package/dist/adapters/document-state.js.map +1 -0
- package/dist/adapters/documents.js +14 -11
- package/dist/adapters/documents.js.map +1 -1
- package/dist/adapters/drizzle.d.ts +2 -2
- package/dist/adapters/drizzle.js +97 -88
- package/dist/adapters/drizzle.js.map +1 -1
- package/dist/adapters/forge.d.ts +12 -7
- package/dist/adapters/forge.js +38 -45
- package/dist/adapters/forge.js.map +1 -1
- package/dist/adapters/http.d.ts +20 -0
- package/dist/adapters/http.js +68 -0
- package/dist/adapters/http.js.map +1 -0
- package/dist/adapters/index.d.ts +5 -5
- package/dist/adapters/json.d.ts +3 -3
- package/dist/adapters/json.js +58 -49
- package/dist/adapters/json.js.map +1 -1
- package/dist/adapters/memory.d.ts +21 -0
- package/dist/adapters/memory.js +53 -0
- package/dist/adapters/memory.js.map +1 -0
- package/dist/adapters/nitro.d.ts +23 -20
- package/dist/adapters/nitro.js +58 -163
- package/dist/adapters/nitro.js.map +1 -1
- package/dist/adapters/react.d.ts +55 -0
- package/dist/adapters/react.js +209 -0
- package/dist/adapters/react.js.map +1 -0
- package/dist/adapters/shared.d.ts +15 -21
- package/dist/adapters/shared.js +10 -8
- package/dist/adapters/shared.js.map +1 -1
- package/dist/adapters/vue.d.ts +15 -30
- package/dist/adapters/vue.js +36 -87
- package/dist/adapters/vue.js.map +1 -1
- package/dist/code/CodeSurface.vue.d.ts +3 -3
- package/dist/config/index.d.ts +105 -0
- package/dist/config/index.js +95 -0
- package/dist/config/index.js.map +1 -0
- package/dist/core/abilities.js +1 -0
- package/dist/core/abilities.js.map +1 -1
- package/dist/{adapters/routes.js → core/api-routes.js} +5 -3
- package/dist/core/api-routes.js.map +1 -0
- package/dist/core/backend-capability.d.ts +7 -0
- package/dist/core/backend-capability.js +17 -0
- package/dist/core/backend-capability.js.map +1 -0
- package/dist/core/backend-types.d.ts +245 -0
- package/dist/core/backend-types.js +17 -0
- package/dist/core/backend-types.js.map +1 -0
- package/dist/core/backend.d.ts +108 -0
- package/dist/core/backend.js +14 -0
- package/dist/core/backend.js.map +1 -0
- package/dist/core/block-convert.d.ts +7 -5
- package/dist/core/block-convert.js +28 -5
- package/dist/core/block-convert.js.map +1 -1
- package/dist/core/command-types.d.ts +89 -0
- package/dist/core/commands.d.ts +40 -0
- package/dist/core/commands.js +151 -0
- package/dist/core/commands.js.map +1 -0
- package/dist/core/context.d.ts +17 -20
- package/dist/core/context.js +24 -21
- package/dist/core/context.js.map +1 -1
- package/dist/core/core-feature.d.ts +22 -7
- package/dist/core/core-feature.js +51 -18
- package/dist/core/core-feature.js.map +1 -1
- package/dist/core/define-editor.d.ts +4 -3
- package/dist/core/define-editor.js +14 -7
- package/dist/core/define-editor.js.map +1 -1
- package/dist/core/document-markdown.js +12 -3
- package/dist/core/document-markdown.js.map +1 -1
- package/dist/core/editor-ui.d.ts +8 -1
- package/dist/core/editor-ui.js +9 -8
- package/dist/core/editor-ui.js.map +1 -1
- package/dist/core/extension-points.d.ts +3 -15
- package/dist/core/feature-context.d.ts +8 -7
- package/dist/core/feature-context.js +12 -11
- package/dist/core/feature-context.js.map +1 -1
- package/dist/core/feature.d.ts +35 -19
- package/dist/core/feature.js.map +1 -1
- package/dist/core/fences.d.ts +2 -1
- package/dist/core/fences.js +3 -2
- package/dist/core/fences.js.map +1 -1
- package/dist/core/fetch-error.d.ts +1 -1
- package/dist/core/fetch-error.js +3 -1
- package/dist/core/fetch-error.js.map +1 -1
- package/dist/core/hash.d.ts +5 -0
- package/dist/core/hash.js +11 -0
- package/dist/core/hash.js.map +1 -0
- package/dist/core/http-backend.d.ts +11 -0
- package/dist/core/http-backend.js +195 -0
- package/dist/core/http-backend.js.map +1 -0
- package/dist/core/index.d.ts +14 -9
- package/dist/core/index.js +12 -9
- package/dist/core/palette.d.ts +48 -0
- package/dist/core/palette.js +95 -0
- package/dist/core/palette.js.map +1 -0
- package/dist/core/schema/abilities.d.ts +2 -1
- package/dist/core/schema/abilities.js +5 -1
- package/dist/core/schema/abilities.js.map +1 -1
- package/dist/core/schema/index.d.ts +11 -5
- package/dist/core/schema/index.js +13 -8
- package/dist/core/schema/index.js.map +1 -1
- package/dist/core/schema/mark-flags.d.ts +8 -1
- package/dist/core/schema/of-features.d.ts +13 -0
- package/dist/core/schema/of-features.js +14 -0
- package/dist/core/schema/of-features.js.map +1 -0
- package/dist/core/slash.d.ts +8 -6
- package/dist/core/slash.js +24 -16
- package/dist/core/slash.js.map +1 -1
- package/dist/core/surface-session.js +13 -5
- package/dist/core/surface-session.js.map +1 -1
- package/dist/core/toolbar-items.d.ts +10 -4
- package/dist/core/toolbar-items.js +269 -195
- package/dist/core/toolbar-items.js.map +1 -1
- package/dist/core/util.js +11 -0
- package/dist/core/util.js.map +1 -0
- package/dist/document/DocumentSurface.d.ts +1 -1
- package/dist/document/DocumentSurface.vue.d.ts +3 -3
- package/dist/features/ai/agent-op-review.d.ts +1 -1
- package/dist/features/ai/agent-op-review.js +1 -1
- package/dist/features/ai/agent-ops.js +1 -1
- package/dist/features/ai/ai-apply.d.ts +2 -2
- package/dist/features/ai/ai-apply.js +1 -1
- package/dist/features/ai/ai-review.js +1 -1
- package/dist/features/ai/ai-sse.d.ts +6 -6
- package/dist/features/ai/ai-sse.js +20 -63
- package/dist/features/ai/ai-sse.js.map +1 -1
- package/dist/features/ai/assistant.d.ts +8 -7
- package/dist/features/ai/assistant.js +3 -3
- package/dist/features/ai/assistant.js.map +1 -1
- package/dist/features/ai/block-actions.d.ts +3 -2
- package/dist/features/ai/block-actions.js +3 -2
- package/dist/features/ai/block-actions.js.map +1 -1
- package/dist/features/ai/components/AiSelectionMenu.js +1 -1
- package/dist/features/ai/components/DocumentChatAnswer.js +1 -1
- package/dist/features/ai/components/DocumentChatOps.vue.d.ts +1 -1
- package/dist/features/ai/components/SettingsModelProfiles.js +8 -8
- package/dist/features/ai/components/SettingsModelProfiles.js.map +1 -1
- package/dist/features/ai/document-chat-model.d.ts +8 -7
- package/dist/features/ai/document-chat-model.js +5 -5
- package/dist/features/ai/document-chat-model.js.map +1 -1
- package/dist/features/ai/document-chat.js +1 -1
- package/dist/features/ai/feature.js +27 -14
- package/dist/features/ai/feature.js.map +1 -1
- package/dist/features/ai/ghost-autocomplete.d.ts +7 -6
- package/dist/features/ai/ghost-autocomplete.js +6 -9
- package/dist/features/ai/ghost-autocomplete.js.map +1 -1
- package/dist/features/ai/index.d.ts +4 -3
- package/dist/features/ai/index.js +10 -10
- package/dist/features/ai/model-profiles.d.ts +5 -4
- package/dist/features/ai/model-profiles.js +2 -2
- package/dist/features/ai/model-profiles.js.map +1 -1
- package/dist/features/ai/protocol/block-lines.js +1 -1
- package/dist/features/ai/protocol/block-lines.js.map +1 -1
- package/dist/features/ai/protocol/chat.js +4 -1
- package/dist/features/ai/protocol/chat.js.map +1 -1
- package/dist/features/ai/protocol/index.d.ts +3 -2
- package/dist/features/ai/protocol/models.d.ts +2 -16
- package/dist/features/ai/protocol/models.js.map +1 -1
- package/dist/features/ai/rate-limit.d.ts +1 -1
- package/dist/features/ai/rate-limit.js +3 -1
- package/dist/features/ai/rate-limit.js.map +1 -1
- package/dist/features/ai/react/AiSelectionMenu.js +2 -2
- package/dist/features/ai/react/AiSidebar.js +4 -4
- package/dist/features/ai/react/DocumentChatAnswer.js +1 -1
- package/dist/features/ai/react/DocumentChatOps.d.ts +1 -1
- package/dist/features/ai/react/DocumentChatOps.js +1 -1
- package/dist/features/ai/react/SettingsModelProfiles.js +8 -10
- package/dist/features/ai/react/SettingsModelProfiles.js.map +1 -1
- package/dist/features/ai/react/use-ai-assistant.d.ts +1 -1
- package/dist/features/ai/react/use-ai-assistant.js +3 -3
- package/dist/features/ai/react/use-ai-assistant.js.map +1 -1
- package/dist/features/ai/react/use-document-chat.js +2 -2
- package/dist/features/ai/react/use-document-chat.js.map +1 -1
- package/dist/features/ai/react/use-model-profiles.d.ts +2 -1
- package/dist/features/ai/selection-flow.d.ts +1 -1
- package/dist/features/ai/selection-flow.js +1 -1
- package/dist/features/ai/sidebar-flow.d.ts +1 -1
- package/dist/features/ai/sidebar-flow.js +1 -1
- package/dist/features/ai/use-ai-assistant.d.ts +1 -1
- package/dist/features/ai/use-ai-assistant.js +3 -3
- package/dist/features/ai/use-ai-assistant.js.map +1 -1
- package/dist/features/ai/use-document-chat.js +2 -2
- package/dist/features/ai/use-document-chat.js.map +1 -1
- package/dist/features/ai/use-model-profiles.d.ts +2 -1
- package/dist/features/authors/attribution.d.ts +1 -1
- package/dist/features/authors/feature.js +12 -11
- package/dist/features/authors/feature.js.map +1 -1
- package/dist/features/block-ui/block-actions.d.ts +22 -1
- package/dist/features/block-ui/block-actions.js +26 -2
- package/dist/features/block-ui/block-actions.js.map +1 -1
- package/dist/features/block-ui/components/BlockActionsOverlay.js +33 -4
- package/dist/features/block-ui/components/BlockActionsOverlay.js.map +1 -1
- package/dist/features/block-ui/components/BlockActionsOverlay.vue.d.ts +4 -0
- package/dist/features/block-ui/components/BlockUi.js +1 -1
- package/dist/features/block-ui/feature.js +1 -0
- package/dist/features/block-ui/feature.js.map +1 -1
- package/dist/features/block-ui/index.d.ts +2 -2
- package/dist/features/block-ui/index.js +2 -2
- package/dist/features/block-ui/react/BlockActionsOverlay.d.ts +4 -0
- package/dist/features/block-ui/react/BlockActionsOverlay.js +38 -12
- package/dist/features/block-ui/react/BlockActionsOverlay.js.map +1 -1
- package/dist/features/block-ui/react/BlockUi.js +1 -1
- package/dist/features/collab/anchor-resolver.js +1 -1
- package/dist/features/collab/feature.js +2 -0
- package/dist/features/collab/feature.js.map +1 -1
- package/dist/features/comments/components/CommentThreadView.vue.d.ts +2 -1
- package/dist/features/comments/feature.js +12 -11
- package/dist/features/comments/feature.js.map +1 -1
- package/dist/features/comments/index.d.ts +3 -2
- package/dist/features/comments/index.js +1 -1
- package/dist/features/comments/margin-layout.d.ts +3 -2
- package/dist/features/comments/model.d.ts +3 -67
- package/dist/features/comments/model.js +2 -2
- package/dist/features/comments/model.js.map +1 -1
- package/dist/features/comments/react/CommentThreadView.d.ts +3 -2
- package/dist/features/comments/react/use-comments.d.ts +2 -1
- package/dist/features/comments/react.d.ts +1 -1
- package/dist/features/comments/schema.d.ts +2 -52
- package/dist/features/comments/schema.js.map +1 -1
- package/dist/features/comments/snapshot-equality.js.map +1 -1
- package/dist/features/comments/use-comments.d.ts +3 -2
- package/dist/features/comments/vue.d.ts +1 -1
- package/dist/features/composites/accepted-children.d.ts +1 -0
- package/dist/features/composites/accepted-children.js +16 -1
- package/dist/features/composites/accepted-children.js.map +1 -1
- package/dist/features/composites/ai-brief.js +31 -0
- package/dist/features/composites/ai-brief.js.map +1 -1
- package/dist/features/composites/bibliography-command.d.ts +11 -0
- package/dist/features/composites/bibliography-form.js +90 -0
- package/dist/features/composites/bibliography-form.js.map +1 -0
- package/dist/features/composites/bibliography.d.ts +33 -0
- package/dist/features/composites/bibliography.js +120 -0
- package/dist/features/composites/bibliography.js.map +1 -0
- package/dist/features/composites/components/BibliographyEditor.js +261 -0
- package/dist/features/composites/components/BibliographyEditor.js.map +1 -0
- package/dist/features/composites/components/CompositeChrome.js +75 -26
- package/dist/features/composites/components/CompositeChrome.js.map +1 -1
- package/dist/features/composites/components/CompositeDetails.js +46 -11
- package/dist/features/composites/components/CompositeDetails.js.map +1 -1
- package/dist/features/composites/components/CompositeDetails.vue.d.ts +2 -1
- package/dist/features/composites/components/CompositeFieldEditor.js +37 -4
- package/dist/features/composites/components/CompositeFieldEditor.js.map +1 -1
- package/dist/features/composites/components/CompositeInspector.js +17 -5
- package/dist/features/composites/components/CompositeInspector.js.map +1 -1
- package/dist/features/composites/components/CompositeTable.js +13 -4
- package/dist/features/composites/components/CompositeTable.js.map +1 -1
- package/dist/features/composites/components/CompositeTagsEditor.js +1 -1
- package/dist/features/composites/components/CompositeView.js +11 -1
- package/dist/features/composites/components/CompositeView.js.map +1 -1
- package/dist/features/composites/components/DerivationBadge.js +103 -0
- package/dist/features/composites/components/DerivationBadge.js.map +1 -0
- package/dist/features/composites/components/ReferenceFieldSelect.js +60 -0
- package/dist/features/composites/components/ReferenceFieldSelect.js.map +1 -0
- package/dist/features/composites/components/ReferenceView.js +122 -0
- package/dist/features/composites/components/ReferenceView.js.map +1 -0
- package/dist/features/composites/components/ReferenceView.vue.d.ts +96 -0
- package/dist/features/composites/components/SettingsEditingTab.js +1 -1
- package/dist/features/composites/convert.js +2 -2
- package/dist/features/composites/convert.js.map +1 -1
- package/dist/features/composites/derivation.d.ts +61 -0
- package/dist/features/composites/derivation.js +98 -0
- package/dist/features/composites/derivation.js.map +1 -0
- package/dist/features/composites/derived-chrome.js +69 -0
- package/dist/features/composites/derived-chrome.js.map +1 -0
- package/dist/features/composites/feature.js +159 -109
- package/dist/features/composites/feature.js.map +1 -1
- package/dist/features/composites/fences.d.ts +4 -3
- package/dist/features/composites/fences.js +51 -7
- package/dist/features/composites/fences.js.map +1 -1
- package/dist/features/composites/index.d.ts +12 -3
- package/dist/features/composites/index.js +15 -6
- package/dist/features/composites/inspector-model.d.ts +4 -1
- package/dist/features/composites/inspector-model.js +8 -4
- package/dist/features/composites/inspector-model.js.map +1 -1
- package/dist/features/composites/kinds.d.ts +8 -1
- package/dist/features/composites/kinds.js +145 -6
- package/dist/features/composites/kinds.js.map +1 -1
- package/dist/features/composites/legacy.d.ts +4 -1
- package/dist/features/composites/legacy.js +56 -1
- package/dist/features/composites/legacy.js.map +1 -1
- package/dist/features/composites/meta-display.js +40 -1
- package/dist/features/composites/meta-display.js.map +1 -1
- package/dist/features/composites/meta-keys.d.ts +7 -0
- package/dist/features/composites/meta-keys.js +21 -0
- package/dist/features/composites/meta-keys.js.map +1 -0
- package/dist/features/composites/node-views.d.ts +6 -3
- package/dist/features/composites/node-views.js +7 -3
- package/dist/features/composites/node-views.js.map +1 -1
- package/dist/features/composites/nodes.d.ts +6 -1
- package/dist/features/composites/nodes.js +33 -7
- package/dist/features/composites/nodes.js.map +1 -1
- package/dist/features/composites/react/BibliographyEditor.js +229 -0
- package/dist/features/composites/react/BibliographyEditor.js.map +1 -0
- package/dist/features/composites/react/CompositeChrome.js +65 -17
- package/dist/features/composites/react/CompositeChrome.js.map +1 -1
- package/dist/features/composites/react/CompositeDetails.d.ts +2 -1
- package/dist/features/composites/react/CompositeDetails.js +45 -6
- package/dist/features/composites/react/CompositeDetails.js.map +1 -1
- package/dist/features/composites/react/CompositeFieldEditor.d.ts +1 -1
- package/dist/features/composites/react/CompositeFieldEditor.js +24 -1
- package/dist/features/composites/react/CompositeFieldEditor.js.map +1 -1
- package/dist/features/composites/react/CompositeInspector.js +11 -5
- package/dist/features/composites/react/CompositeInspector.js.map +1 -1
- package/dist/features/composites/react/CompositeStatusMenu.js +1 -1
- package/dist/features/composites/react/CompositeSummaryEditor.js +1 -1
- package/dist/features/composites/react/CompositeTable.js +16 -2
- package/dist/features/composites/react/CompositeTable.js.map +1 -1
- package/dist/features/composites/react/CompositeTagsEditor.js +2 -2
- package/dist/features/composites/react/CompositeView.js +6 -1
- package/dist/features/composites/react/CompositeView.js.map +1 -1
- package/dist/features/composites/react/DerivationBadge.js +116 -0
- package/dist/features/composites/react/DerivationBadge.js.map +1 -0
- package/dist/features/composites/react/ReferenceFieldSelect.js +52 -0
- package/dist/features/composites/react/ReferenceFieldSelect.js.map +1 -0
- package/dist/features/composites/react/ReferenceView.d.ts +11 -0
- package/dist/features/composites/react/ReferenceView.js +115 -0
- package/dist/features/composites/react/ReferenceView.js.map +1 -0
- package/dist/features/composites/react/SettingsEditingTab.js +2 -2
- package/dist/features/composites/react.d.ts +2 -1
- package/dist/features/composites/react.js +7 -3
- package/dist/features/composites/react.js.map +1 -1
- package/dist/features/composites/reference-ai.js +16 -0
- package/dist/features/composites/reference-ai.js.map +1 -0
- package/dist/features/composites/reference-label.d.ts +19 -0
- package/dist/features/composites/reference-label.js +58 -0
- package/dist/features/composites/reference-label.js.map +1 -0
- package/dist/features/composites/reference-suggestion.d.ts +10 -0
- package/dist/features/composites/reference-suggestion.js +41 -0
- package/dist/features/composites/reference-suggestion.js.map +1 -0
- package/dist/features/composites/reference-text.d.ts +18 -0
- package/dist/features/composites/reference-text.js +89 -0
- package/dist/features/composites/reference-text.js.map +1 -0
- package/dist/features/composites/reference.d.ts +44 -0
- package/dist/features/composites/reference.js +148 -0
- package/dist/features/composites/reference.js.map +1 -0
- package/dist/features/composites/reveal-source.d.ts +32 -0
- package/dist/features/composites/reveal-source.js +89 -0
- package/dist/features/composites/reveal-source.js.map +1 -0
- package/dist/features/composites/rows.d.ts +21 -2
- package/dist/features/composites/rows.js +63 -9
- package/dist/features/composites/rows.js.map +1 -1
- package/dist/features/composites/schema.d.ts +9 -3
- package/dist/features/composites/schema.js +11 -4
- package/dist/features/composites/schema.js.map +1 -1
- package/dist/features/composites/table-model.js +12 -21
- package/dist/features/composites/table-model.js.map +1 -1
- package/dist/features/composites/vue.d.ts +3 -2
- package/dist/features/composites/vue.js +8 -4
- package/dist/features/composites/vue.js.map +1 -1
- package/dist/features/media/assets.d.ts +2 -0
- package/dist/features/media/assets.js +3 -2
- package/dist/features/media/assets.js.map +1 -1
- package/dist/features/media/components/FileView.js +13 -4
- package/dist/features/media/components/FileView.js.map +1 -1
- package/dist/features/media/feature.d.ts +3 -3
- package/dist/features/media/feature.js +21 -28
- package/dist/features/media/feature.js.map +1 -1
- package/dist/features/media/file-import.js +2 -2
- package/dist/features/media/file-import.js.map +1 -1
- package/dist/features/media/index.d.ts +2 -2
- package/dist/features/media/index.js +2 -2
- package/dist/features/media/react/FileView.js +19 -2
- package/dist/features/media/react/FileView.js.map +1 -1
- package/dist/features/media/schema.d.ts +8 -0
- package/dist/features/media/schema.js +126 -11
- package/dist/features/media/schema.js.map +1 -1
- package/dist/features/media/upload.d.ts +16 -14
- package/dist/features/media/upload.js +13 -19
- package/dist/features/media/upload.js.map +1 -1
- package/dist/features/mentions/index.d.ts +4 -3
- package/dist/features/mentions/index.js +4 -1
- package/dist/features/mentions/index.js.map +1 -1
- package/dist/features/mentions/mention-text.d.ts +1 -1
- package/dist/features/mentions/mention-text.js.map +1 -1
- package/dist/features/mentions/mention.d.ts +0 -6
- package/dist/features/mentions/mention.js.map +1 -1
- package/dist/features/mentions/metadata-defaults.d.ts +2 -2
- package/dist/features/mentions/metadata-defaults.js +3 -9
- package/dist/features/mentions/metadata-defaults.js.map +1 -1
- package/dist/features/mentions/schema.d.ts +2 -1
- package/dist/features/mentions/schema.js.map +1 -1
- package/dist/features/tables/feature.d.ts +2 -1
- package/dist/features/tables/feature.js +90 -70
- package/dist/features/tables/feature.js.map +1 -1
- package/dist/features/themes/components/SettingsAppearanceTab.js +6 -9
- package/dist/features/themes/components/SettingsAppearanceTab.js.map +1 -1
- package/dist/features/themes/feature.js +2 -0
- package/dist/features/themes/feature.js.map +1 -1
- package/dist/features/themes/index.d.ts +2 -1
- package/dist/features/themes/react/SettingsAppearanceTab.js +7 -10
- package/dist/features/themes/react/SettingsAppearanceTab.js.map +1 -1
- package/dist/features/themes/schema.d.ts +2 -6
- package/dist/features/themes/schema.js.map +1 -1
- package/dist/features/themes/theme-runtime.d.ts +1 -1
- package/dist/features/themes/theme-runtime.js +4 -2
- package/dist/features/themes/theme-runtime.js.map +1 -1
- package/dist/features/transcript/TranscriptSegmentView.js +48 -28
- package/dist/features/transcript/TranscriptSegmentView.js.map +1 -1
- package/dist/features/transcript/feature.js +21 -19
- package/dist/features/transcript/feature.js.map +1 -1
- package/dist/features/transcript/react/TranscriptSegmentView.js +55 -36
- package/dist/features/transcript/react/TranscriptSegmentView.js.map +1 -1
- package/dist/features/transcript/segment-node.d.ts +2 -0
- package/dist/features/transcript/segment-node.js +35 -7
- package/dist/features/transcript/segment-node.js.map +1 -1
- package/dist/i18n/de/composites.js +91 -1
- package/dist/i18n/de/composites.js.map +1 -1
- package/dist/i18n/de/integrations.js +49 -8
- package/dist/i18n/de/integrations.js.map +1 -1
- package/dist/i18n/de/media.js +0 -1
- package/dist/i18n/de/media.js.map +1 -1
- package/dist/i18n/de/palette.js +22 -0
- package/dist/i18n/de/palette.js.map +1 -0
- package/dist/i18n/de/tables.js +0 -1
- package/dist/i18n/de/tables.js.map +1 -1
- package/dist/i18n/de/transcript.js +2 -1
- package/dist/i18n/de/transcript.js.map +1 -1
- package/dist/i18n/de/tree.js +3 -0
- package/dist/i18n/de/tree.js.map +1 -1
- package/dist/i18n/de.d.ts +157 -11
- package/dist/i18n/de.js +3 -1
- package/dist/i18n/de.js.map +1 -1
- package/dist/i18n/en/composites.js +89 -1
- package/dist/i18n/en/composites.js.map +1 -1
- package/dist/i18n/en/integrations.js +49 -8
- package/dist/i18n/en/integrations.js.map +1 -1
- package/dist/i18n/en/media.js +0 -1
- package/dist/i18n/en/media.js.map +1 -1
- package/dist/i18n/en/palette.js +22 -0
- package/dist/i18n/en/palette.js.map +1 -0
- package/dist/i18n/en/tables.js +0 -1
- package/dist/i18n/en/tables.js.map +1 -1
- package/dist/i18n/en/transcript.js +2 -1
- package/dist/i18n/en/transcript.js.map +1 -1
- package/dist/i18n/en/tree.js +3 -0
- package/dist/i18n/en/tree.js.map +1 -1
- package/dist/i18n/en.js +3 -1
- package/dist/i18n/en.js.map +1 -1
- package/dist/index.d.ts +4 -3
- package/dist/integrations/composite-ai/bibliography-fetch.d.ts +31 -0
- package/dist/integrations/composite-ai/bibliography-fetch.js +159 -0
- package/dist/integrations/composite-ai/bibliography-fetch.js.map +1 -0
- package/dist/integrations/composite-ai/composite-fill.d.ts +30 -8
- package/dist/integrations/composite-ai/composite-fill.js +97 -56
- package/dist/integrations/composite-ai/composite-fill.js.map +1 -1
- package/dist/integrations/composite-ai/composite-summary.d.ts +4 -12
- package/dist/integrations/composite-ai/composite-summary.js +7 -26
- package/dist/integrations/composite-ai/composite-summary.js.map +1 -1
- package/dist/integrations/composite-ai/derive.d.ts +29 -0
- package/dist/integrations/composite-ai/derive.js +173 -0
- package/dist/integrations/composite-ai/derive.js.map +1 -0
- package/dist/integrations/composite-ai/index.d.ts +11 -7
- package/dist/integrations/composite-ai/index.js +72 -14
- package/dist/integrations/composite-ai/index.js.map +1 -1
- package/dist/integrations/composite-ai/rendition.d.ts +45 -0
- package/dist/integrations/composite-ai/rendition.js +314 -0
- package/dist/integrations/composite-ai/rendition.js.map +1 -0
- package/dist/integrations/composite-media/index.d.ts +7 -5
- package/dist/integrations/composite-media/index.js +86 -13
- package/dist/integrations/composite-media/index.js.map +1 -1
- package/dist/integrations/transcript-ai/index.d.ts +1 -1
- package/dist/integrations/transcript-ai/index.js +5 -2
- package/dist/integrations/transcript-ai/index.js.map +1 -1
- package/dist/integrations/transcript-ai/protocol.d.ts +2 -12
- package/dist/integrations/transcript-ai/protocol.js +0 -2
- package/dist/integrations/transcript-ai/protocol.js.map +1 -1
- package/dist/integrations/transcript-ai/transcript-cleanup.d.ts +5 -5
- package/dist/integrations/transcript-ai/transcript-cleanup.js +7 -10
- package/dist/integrations/transcript-ai/transcript-cleanup.js.map +1 -1
- package/dist/markdown/MarkdownSurface.vue.d.ts +10 -9
- package/dist/markdown/MarkdownSurface2.js +3 -6
- package/dist/markdown/MarkdownSurface2.js.map +1 -1
- package/dist/markdown/document.js +1 -1
- package/dist/markdown/source-mode.d.ts +1 -1
- package/dist/nuxt/module.d.ts +1402 -54
- package/dist/nuxt/module.js +6 -49
- package/dist/nuxt/module.js.map +1 -1
- package/dist/nuxt/runtime/install-context.d.ts +7 -3
- package/dist/nuxt/runtime/install-context.js +14 -8
- package/dist/nuxt/runtime/install-context.js.map +1 -1
- package/dist/nuxt/runtime/plugins/editor-context-nuxt-ui.client.ts +2 -2
- package/dist/nuxt/runtime/server/plugins/editor-server.js +20 -12
- package/dist/nuxt/runtime/server/plugins/editor-server.js.map +1 -1
- package/dist/presets/compose.d.ts +94 -0
- package/dist/presets/compose.js +164 -0
- package/dist/presets/compose.js.map +1 -0
- package/dist/react/AdvancedEditor.d.ts +15 -15
- package/dist/react/AdvancedEditor.js +15 -13
- package/dist/react/AdvancedEditor.js.map +1 -1
- package/dist/react/EditorCommandPalette.d.ts +13 -0
- package/dist/react/EditorCommandPalette.js +118 -0
- package/dist/react/EditorCommandPalette.js.map +1 -0
- package/dist/react/EditorSettingsModal.d.ts +5 -5
- package/dist/react/EditorSettingsModal.js +7 -4
- package/dist/react/EditorSettingsModal.js.map +1 -1
- package/dist/react/EditorSettingsPanel.d.ts +7 -7
- package/dist/react/EditorSettingsPanel.js +8 -5
- package/dist/react/EditorSettingsPanel.js.map +1 -1
- package/dist/react/EditorSurface.d.ts +7 -7
- package/dist/react/EditorSurface.js +10 -6
- package/dist/react/EditorSurface.js.map +1 -1
- package/dist/react/EditorToolbar.d.ts +4 -6
- package/dist/react/EditorToolbar.js +29 -37
- package/dist/react/EditorToolbar.js.map +1 -1
- package/dist/react/SimpleEditor.d.ts +22 -23
- package/dist/react/SimpleEditor.js +21 -7
- package/dist/react/SimpleEditor.js.map +1 -1
- package/dist/react/advanced.d.ts +4 -3
- package/dist/react/advanced.js +2 -2
- package/dist/react/compose.d.ts +20 -0
- package/dist/react/compose.js +49 -0
- package/dist/react/compose.js.map +1 -0
- package/dist/react/composed-surface.d.ts +39 -0
- package/dist/react/composed-surface.js +71 -0
- package/dist/react/composed-surface.js.map +1 -0
- package/dist/react/context.js +6 -2
- package/dist/react/context.js.map +1 -1
- package/dist/react/index.d.ts +2 -1
- package/dist/react/index.js +2 -1
- package/dist/react/key-labels.js +15 -0
- package/dist/react/key-labels.js.map +1 -0
- package/dist/react/settings.d.ts +1 -1
- package/dist/react/simple.d.ts +2 -2
- package/dist/react/ui/command.js +36 -1
- package/dist/react/ui/command.js.map +1 -1
- package/dist/schema/advanced.d.ts +6 -6
- package/dist/schema/advanced.js +26 -29
- package/dist/schema/advanced.js.map +1 -1
- package/dist/server/ai.d.ts +5 -16
- package/dist/server/ai.js.map +1 -1
- package/dist/server/auth.d.ts +9 -0
- package/dist/server/collab-state.d.ts +1 -1
- package/dist/server/collab-state.js.map +1 -1
- package/dist/server/collab.d.ts +13 -13
- package/dist/server/collab.js +34 -18
- package/dist/server/collab.js.map +1 -1
- package/dist/server/crossref.js +78 -0
- package/dist/server/crossref.js.map +1 -0
- package/dist/server/errors.d.ts +1 -1
- package/dist/server/errors.js +1 -1
- package/dist/server/errors.js.map +1 -1
- package/dist/server/extract.js +308 -0
- package/dist/server/extract.js.map +1 -0
- package/dist/{nuxt/runtime/server/utils/editor-route.js → server/h3.js} +8 -16
- package/dist/server/h3.js.map +1 -0
- package/dist/server/handlers/ai.d.ts +30 -9
- package/dist/server/handlers/ai.js +170 -36
- package/dist/server/handlers/ai.js.map +1 -1
- package/dist/server/handlers/context.d.ts +12 -5
- package/dist/server/handlers/context.js +10 -4
- package/dist/server/handlers/context.js.map +1 -1
- package/dist/server/handlers/editor.d.ts +19 -13
- package/dist/server/handlers/editor.js +49 -38
- package/dist/server/handlers/editor.js.map +1 -1
- package/dist/server/handlers/index.d.ts +4 -4
- package/dist/server/handlers/index.js +4 -4
- package/dist/server/host.d.ts +16 -25
- package/dist/server/host.js +58 -41
- package/dist/server/host.js.map +1 -1
- package/dist/server/index.d.ts +6 -4
- package/dist/server/index.js +3 -2
- package/dist/server/pdf.js +97 -0
- package/dist/server/pdf.js.map +1 -0
- package/dist/server/{adapter.d.ts → ports.d.ts} +81 -30
- package/dist/server/ports.js +29 -0
- package/dist/server/ports.js.map +1 -0
- package/dist/server/routes.js +144 -0
- package/dist/server/routes.js.map +1 -0
- package/dist/settings/index.d.ts +1 -1
- package/dist/settings/index.js.map +1 -1
- package/dist/styles/composites.css +25 -0
- package/dist/tree/DocumentTree.js +56 -29
- package/dist/tree/DocumentTree.js.map +1 -1
- package/dist/tree/react/DocumentTree.js +23 -0
- package/dist/tree/react/DocumentTree.js.map +1 -1
- package/dist/tree/tree-host.js +1 -1
- package/dist/vue/AdvancedEditor.js +30 -9
- package/dist/vue/AdvancedEditor.js.map +1 -1
- package/dist/vue/AdvancedEditor.vue.d.ts +32 -12
- package/dist/vue/SimpleEditor.js +62 -16
- package/dist/vue/SimpleEditor.js.map +1 -1
- package/dist/vue/SimpleEditor.vue.d.ts +37 -7
- package/dist/vue/advanced.d.ts +3 -2
- package/dist/vue/advanced.js +2 -2
- package/dist/vue/components/EditorCommandPalette.js +91 -0
- package/dist/vue/components/EditorCommandPalette.js.map +1 -0
- package/dist/vue/components/EditorCommandPalette.vue.d.ts +15 -0
- package/dist/vue/components/EditorSettingsModal.js +10 -6
- package/dist/vue/components/EditorSettingsModal.js.map +1 -1
- package/dist/vue/components/EditorSettingsModal.vue.d.ts +4 -4
- package/dist/vue/components/EditorSettingsPanel.js +10 -6
- package/dist/vue/components/EditorSettingsPanel.js.map +1 -1
- package/dist/vue/components/EditorSettingsPanel.vue.d.ts +6 -6
- package/dist/vue/components/EditorSurface.js +11 -6
- package/dist/vue/components/EditorSurface.js.map +1 -1
- package/dist/vue/components/EditorSurface.vue.d.ts +11 -11
- package/dist/vue/components/EditorToolbar.js +41 -49
- package/dist/vue/components/EditorToolbar.js.map +1 -1
- package/dist/vue/components/EditorToolbar.vue.d.ts +2 -4
- package/dist/vue/compose.d.ts +17 -0
- package/dist/vue/compose.js +51 -0
- package/dist/vue/compose.js.map +1 -0
- package/dist/vue/context-key.d.ts +6 -0
- package/dist/vue/context-key.js +6 -0
- package/dist/vue/context-key.js.map +1 -0
- package/dist/vue/context.d.ts +8 -6
- package/dist/vue/context.js +6 -5
- package/dist/vue/context.js.map +1 -1
- package/dist/vue/index.d.ts +10 -8
- package/dist/vue/index.js +10 -8
- package/dist/vue/kit/index.d.ts +2 -2
- package/dist/vue/kit/nuxt-ui.js +23 -0
- package/dist/vue/kit/nuxt-ui.js.map +1 -1
- package/dist/vue/kit/types.d.ts +40 -1
- package/package.json +30 -16
- package/dist/adapters/comments/client.d.ts +0 -64
- package/dist/adapters/comments/client.js.map +0 -1
- package/dist/adapters/routes.js.map +0 -1
- package/dist/core/toolbar.d.ts +0 -74
- package/dist/core/toolbar.js +0 -45
- package/dist/core/toolbar.js.map +0 -1
- package/dist/integrations/composite-ai/document-transcribe.d.ts +0 -14
- package/dist/integrations/composite-ai/document-transcribe.js +0 -89
- package/dist/integrations/composite-ai/document-transcribe.js.map +0 -1
- package/dist/nuxt/runtime/server/api/ai/chat.post.d.ts +0 -5
- package/dist/nuxt/runtime/server/api/ai/chat.post.js +0 -8
- package/dist/nuxt/runtime/server/api/ai/chat.post.js.map +0 -1
- package/dist/nuxt/runtime/server/api/ai/complete.post.d.ts +0 -5
- package/dist/nuxt/runtime/server/api/ai/complete.post.js +0 -8
- package/dist/nuxt/runtime/server/api/ai/complete.post.js.map +0 -1
- package/dist/nuxt/runtime/server/api/ai/generate.post.d.ts +0 -5
- package/dist/nuxt/runtime/server/api/ai/generate.post.js +0 -8
- package/dist/nuxt/runtime/server/api/ai/generate.post.js.map +0 -1
- package/dist/nuxt/runtime/server/api/ai/models.get.d.ts +0 -5
- package/dist/nuxt/runtime/server/api/ai/models.get.js +0 -8
- package/dist/nuxt/runtime/server/api/ai/models.get.js.map +0 -1
- package/dist/nuxt/runtime/server/api/ai/transcribe.post.d.ts +0 -5
- package/dist/nuxt/runtime/server/api/ai/transcribe.post.js +0 -8
- package/dist/nuxt/runtime/server/api/ai/transcribe.post.js.map +0 -1
- package/dist/nuxt/runtime/server/api/ai/transcript-cleanup.post.d.ts +0 -5
- package/dist/nuxt/runtime/server/api/ai/transcript-cleanup.post.js +0 -8
- package/dist/nuxt/runtime/server/api/ai/transcript-cleanup.post.js.map +0 -1
- package/dist/nuxt/runtime/server/api/editor/assets/[id]/[name].get.d.ts +0 -5
- package/dist/nuxt/runtime/server/api/editor/assets/[id]/[name].get.js +0 -8
- package/dist/nuxt/runtime/server/api/editor/assets/[id]/[name].get.js.map +0 -1
- package/dist/nuxt/runtime/server/api/editor/assets/[id].post.d.ts +0 -5
- package/dist/nuxt/runtime/server/api/editor/assets/[id].post.js +0 -8
- package/dist/nuxt/runtime/server/api/editor/assets/[id].post.js.map +0 -1
- package/dist/nuxt/runtime/server/api/editor/settings.get.d.ts +0 -5
- package/dist/nuxt/runtime/server/api/editor/settings.get.js +0 -8
- package/dist/nuxt/runtime/server/api/editor/settings.get.js.map +0 -1
- package/dist/nuxt/runtime/server/api/editor/settings.put.d.ts +0 -5
- package/dist/nuxt/runtime/server/api/editor/settings.put.js +0 -8
- package/dist/nuxt/runtime/server/api/editor/settings.put.js.map +0 -1
- package/dist/nuxt/runtime/server/api/editor/tags.get.d.ts +0 -5
- package/dist/nuxt/runtime/server/api/editor/tags.get.js +0 -8
- package/dist/nuxt/runtime/server/api/editor/tags.get.js.map +0 -1
- package/dist/nuxt/runtime/server/api/editor/themes/[id].delete.d.ts +0 -5
- package/dist/nuxt/runtime/server/api/editor/themes/[id].delete.js +0 -8
- package/dist/nuxt/runtime/server/api/editor/themes/[id].delete.js.map +0 -1
- package/dist/nuxt/runtime/server/api/editor/themes/[id].get.d.ts +0 -5
- package/dist/nuxt/runtime/server/api/editor/themes/[id].get.js +0 -8
- package/dist/nuxt/runtime/server/api/editor/themes/[id].get.js.map +0 -1
- package/dist/nuxt/runtime/server/api/editor/themes/index.get.d.ts +0 -5
- package/dist/nuxt/runtime/server/api/editor/themes/index.get.js +0 -8
- package/dist/nuxt/runtime/server/api/editor/themes/index.get.js.map +0 -1
- package/dist/nuxt/runtime/server/api/editor/themes/index.post.d.ts +0 -5
- package/dist/nuxt/runtime/server/api/editor/themes/index.post.js +0 -8
- package/dist/nuxt/runtime/server/api/editor/themes/index.post.js.map +0 -1
- package/dist/nuxt/runtime/server/api/editor/users.get.d.ts +0 -5
- package/dist/nuxt/runtime/server/api/editor/users.get.js +0 -8
- package/dist/nuxt/runtime/server/api/editor/users.get.js.map +0 -1
- package/dist/nuxt/runtime/server/plugins/collab.d.ts +0 -5
- package/dist/nuxt/runtime/server/plugins/collab.js +0 -10
- package/dist/nuxt/runtime/server/plugins/collab.js.map +0 -1
- package/dist/nuxt/runtime/server/routes/collab/[id].d.ts +0 -5
- package/dist/nuxt/runtime/server/routes/collab/[id].js +0 -35
- package/dist/nuxt/runtime/server/routes/collab/[id].js.map +0 -1
- package/dist/nuxt/runtime/server/utils/editor-route.d.ts +0 -11
- package/dist/nuxt/runtime/server/utils/editor-route.js.map +0 -1
- package/dist/presets/advanced.d.ts +0 -33
- package/dist/presets/advanced.js +0 -50
- package/dist/presets/advanced.js.map +0 -1
- package/dist/presets/simple.d.ts +0 -9
- package/dist/presets/simple.js +0 -12
- package/dist/presets/simple.js.map +0 -1
- package/dist/react/advanced-preset.d.ts +0 -11
- package/dist/react/advanced-preset.js +0 -31
- package/dist/react/advanced-preset.js.map +0 -1
- package/dist/vue/advanced-preset.d.ts +0 -13
- package/dist/vue/advanced-preset.js +0 -33
- package/dist/vue/advanced-preset.js.map +0 -1
- package/docs/extending.md +0 -538
- package/docs/integration.md +0 -630
- package/docs/llms.md +0 -383
- package/docs/usage.md +0 -1076
package/dist/vue/advanced.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ComposeOptions, ComposedEditor, ContentLevel, FeatureId, InteractionLevel, UiBindings } from "../presets/compose.js";
|
|
1
2
|
import _default from "./AdvancedEditor.vue.js";
|
|
2
|
-
import { advancedEditor } from "./
|
|
3
|
-
export { _default as AdvancedEditor, advancedEditor };
|
|
3
|
+
import { advancedEditor, composeEditor } from "./compose.js";
|
|
4
|
+
export { _default as AdvancedEditor, type ComposeOptions, type ComposedEditor, type ContentLevel, type FeatureId, type InteractionLevel, type UiBindings, advancedEditor, composeEditor };
|
package/dist/vue/advanced.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { advancedEditor } from "./
|
|
1
|
+
import { advancedEditor, composeEditor } from "./compose.js";
|
|
2
2
|
import _sfc_main from "./AdvancedEditor.js";
|
|
3
|
-
export { _sfc_main as AdvancedEditor, advancedEditor };
|
|
3
|
+
export { _sfc_main as AdvancedEditor, advancedEditor, composeEditor };
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { editorEntryOf } from "../../core/editor-ui.js";
|
|
2
|
+
import { filterPalette, paletteGroupsOf } from "../../core/palette.js";
|
|
3
|
+
import { useUiKit } from "../kit/use-ui-kit.js";
|
|
4
|
+
import { useEditorI18n } from "../use-editor-i18n.js";
|
|
5
|
+
import { useEditorUi } from "../use-editor-ui.js";
|
|
6
|
+
import { computed, createBlock, createTextVNode, createVNode, defineComponent, openBlock, ref, toDisplayString, toRaw, unref, watch, withCtx } from "vue";
|
|
7
|
+
//#region src/vue/components/EditorCommandPalette.vue
|
|
8
|
+
/**
|
|
9
|
+
* „Befehle“ (⌘K): the commands of the surface's editor (features' and host's, `palette !== false`) in a modal palette,
|
|
10
|
+
* grouped like the toolbar, disabled where `commandState` disables them; a menu command opens its rows as a second
|
|
11
|
+
* level. Mounted by `core-ui` as an overlay of the surface; the surface's `ui.paletteOpen` is its open state.
|
|
12
|
+
*/
|
|
13
|
+
const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
14
|
+
__name: "EditorCommandPalette",
|
|
15
|
+
props: { editor: {} },
|
|
16
|
+
setup(__props) {
|
|
17
|
+
const props = __props;
|
|
18
|
+
const { CommandPalette: UCommandPalette, Modal: UModal } = useUiKit();
|
|
19
|
+
const ui = useEditorUi(() => props.editor);
|
|
20
|
+
const { t } = useEditorI18n();
|
|
21
|
+
const all = ref([]);
|
|
22
|
+
const query = ref("");
|
|
23
|
+
const groups = computed(() => filterPalette(all.value, query.value).map((group) => ({
|
|
24
|
+
id: group.id,
|
|
25
|
+
label: group.label,
|
|
26
|
+
ignoreFilter: true,
|
|
27
|
+
items: group.entries.map(itemOf)
|
|
28
|
+
})));
|
|
29
|
+
function close() {
|
|
30
|
+
if (ui.value?.paletteOpen) ui.value.togglePalette();
|
|
31
|
+
}
|
|
32
|
+
function itemOf(entry) {
|
|
33
|
+
const { run } = entry;
|
|
34
|
+
return {
|
|
35
|
+
id: entry.id,
|
|
36
|
+
label: entry.label,
|
|
37
|
+
...entry.icon && { icon: entry.icon },
|
|
38
|
+
...entry.kbds && { kbds: entry.kbds },
|
|
39
|
+
...entry.description !== void 0 && { description: entry.description },
|
|
40
|
+
disabled: entry.disabled,
|
|
41
|
+
...entry.children ? { children: entry.children.map(itemOf) } : run && { onSelect: () => {
|
|
42
|
+
close();
|
|
43
|
+
run();
|
|
44
|
+
} }
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
watch(() => ui.value?.paletteOpen ?? false, (open) => {
|
|
48
|
+
if (!open) return;
|
|
49
|
+
const entry = editorEntryOf(toRaw(props.editor));
|
|
50
|
+
query.value = "";
|
|
51
|
+
all.value = entry ? paletteGroupsOf(toRaw(props.editor), entry) : [];
|
|
52
|
+
}, { immediate: true });
|
|
53
|
+
function onOpenChange(open) {
|
|
54
|
+
if (open !== !!ui.value?.paletteOpen) ui.value?.togglePalette();
|
|
55
|
+
}
|
|
56
|
+
return (_ctx, _cache) => {
|
|
57
|
+
return openBlock(), createBlock(unref(UModal), {
|
|
58
|
+
open: unref(ui)?.paletteOpen ?? false,
|
|
59
|
+
title: unref(t)("palette.title"),
|
|
60
|
+
description: unref(t)("palette.description"),
|
|
61
|
+
"onUpdate:open": onOpenChange
|
|
62
|
+
}, {
|
|
63
|
+
content: withCtx(() => [createVNode(unref(UCommandPalette), {
|
|
64
|
+
"search-term": query.value,
|
|
65
|
+
"onUpdate:searchTerm": _cache[0] || (_cache[0] = ($event) => query.value = $event),
|
|
66
|
+
groups: groups.value,
|
|
67
|
+
placeholder: unref(t)("palette.placeholder"),
|
|
68
|
+
close: "",
|
|
69
|
+
class: "h-80",
|
|
70
|
+
"onUpdate:open": onOpenChange
|
|
71
|
+
}, {
|
|
72
|
+
empty: withCtx(() => [createTextVNode(toDisplayString(unref(t)("palette.empty")), 1)]),
|
|
73
|
+
_: 1
|
|
74
|
+
}, 8, [
|
|
75
|
+
"search-term",
|
|
76
|
+
"groups",
|
|
77
|
+
"placeholder"
|
|
78
|
+
])]),
|
|
79
|
+
_: 1
|
|
80
|
+
}, 8, [
|
|
81
|
+
"open",
|
|
82
|
+
"title",
|
|
83
|
+
"description"
|
|
84
|
+
]);
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
//#endregion
|
|
89
|
+
export { _sfc_main as default };
|
|
90
|
+
|
|
91
|
+
//# sourceMappingURL=EditorCommandPalette.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EditorCommandPalette.js","names":["_openBlock","_createBlock","_unref","_withCtx","_createVNode","_createTextVNode","_toDisplayString"],"sources":["../../../src/vue/components/EditorCommandPalette.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { Editor } from '@tiptap/core'\nimport { computed, ref, toRaw, watch } from 'vue'\nimport { editorEntryOf } from '../../core/editor-ui'\nimport { filterPalette, type PaletteEntry, type PaletteGroup, paletteGroupsOf } from '../../core/palette'\nimport type { CommandPaletteItem } from '../kit/types'\nimport { useUiKit } from '../kit/use-ui-kit'\nimport { useEditorUi } from '../use-editor-ui'\nimport { useEditorI18n } from '../use-editor-i18n'\n\n/**\n * „Befehle“ (⌘K): the commands of the surface's editor (features' and host's, `palette !== false`) in a modal palette,\n * grouped like the toolbar, disabled where `commandState` disables them; a menu command opens its rows as a second\n * level. Mounted by `core-ui` as an overlay of the surface; the surface's `ui.paletteOpen` is its open state.\n */\nconst props = defineProps<{ editor: Editor }>()\n\nconst { CommandPalette: UCommandPalette, Modal: UModal } = useUiKit()\nconst ui = useEditorUi(() => props.editor)\nconst { t } = useEditorI18n()\n\n// The search is `filterPalette`, the same function the React palette uses: the kit widget lists the rows as given\n// (`ignoreFilter`) and only reports what is typed (`searchTerm`). A menu command's second level is the widget's own search.\nconst all = ref<PaletteGroup[]>([])\nconst query = ref('')\nconst groups = computed(() => filterPalette(all.value, query.value).map(group => ({ id: group.id, label: group.label, ignoreFilter: true, items: group.entries.map(itemOf) })))\n\nfunction close() {\n if (ui.value?.paletteOpen) ui.value.togglePalette()\n}\n\nfunction itemOf(entry: PaletteEntry): CommandPaletteItem {\n const { run } = entry\n return {\n id: entry.id,\n label: entry.label,\n ...(entry.icon && { icon: entry.icon }),\n ...(entry.kbds && { kbds: entry.kbds }),\n ...(entry.description !== undefined && { description: entry.description }),\n disabled: entry.disabled,\n ...(entry.children ? { children: entry.children.map(itemOf) } : run && {\n onSelect: () => {\n close()\n run()\n },\n }),\n }\n}\n\n// The state of every command is read when the palette opens, not while it is closed.\nwatch(() => ui.value?.paletteOpen ?? false, (open) => {\n if (!open) return\n const entry = editorEntryOf(toRaw(props.editor))\n query.value = ''\n all.value = entry ? paletteGroupsOf(toRaw(props.editor), entry) : []\n}, { immediate: true })\n\nfunction onOpenChange(open: boolean) {\n if (open !== !!ui.value?.paletteOpen) ui.value?.togglePalette()\n}\n</script>\n\n<template>\n <UModal\n :open=\"ui?.paletteOpen ?? false\"\n :title=\"t('palette.title')\"\n :description=\"t('palette.description')\"\n @update:open=\"onOpenChange\"\n >\n <template #content>\n <UCommandPalette v-model:search-term=\"query\" :groups=\"groups\" :placeholder=\"t('palette.placeholder')\" close class=\"h-80\" @update:open=\"onOpenChange\">\n <template #empty>\n {{ t('palette.empty') }}\n </template>\n </UCommandPalette>\n </template>\n </UModal>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;EAeA,MAAM,QAAQ;EAEd,MAAM,EAAE,gBAAgB,iBAAiB,OAAO,WAAW,SAAS;EACpE,MAAM,KAAK,kBAAkB,MAAM,MAAM;EACzC,MAAM,EAAE,MAAM,cAAc;EAI5B,MAAM,MAAM,IAAoB,CAAC,CAAC;EAClC,MAAM,QAAQ,IAAI,EAAE;EACpB,MAAM,SAAS,eAAe,cAAc,IAAI,OAAO,MAAM,KAAK,CAAC,CAAC,KAAI,WAAU;GAAE,IAAI,MAAM;GAAI,OAAO,MAAM;GAAO,cAAc;GAAM,OAAO,MAAM,QAAQ,IAAI,MAAM;EAAE,EAAE,CAAC;EAE9K,SAAS,QAAQ;GACf,IAAI,GAAG,OAAO,aAAa,GAAG,MAAM,cAAc;EACpD;EAEA,SAAS,OAAO,OAAyC;GACvD,MAAM,EAAE,QAAQ;GAChB,OAAO;IACL,IAAI,MAAM;IACV,OAAO,MAAM;IACb,GAAI,MAAM,QAAQ,EAAE,MAAM,MAAM,KAAK;IACrC,GAAI,MAAM,QAAQ,EAAE,MAAM,MAAM,KAAK;IACrC,GAAI,MAAM,gBAAgB,KAAA,KAAa,EAAE,aAAa,MAAM,YAAY;IACxE,UAAU,MAAM;IAChB,GAAI,MAAM,WAAW,EAAE,UAAU,MAAM,SAAS,IAAI,MAAM,EAAE,IAAI,OAAO,EACrE,gBAAgB;KACd,MAAM;KACN,IAAI;IACN,EACF;GACF;EACF;EAGA,YAAY,GAAG,OAAO,eAAe,QAAQ,SAAS;GACpD,IAAI,CAAC,MAAM;GACX,MAAM,QAAQ,cAAc,MAAM,MAAM,MAAM,CAAC;GAC/C,MAAM,QAAQ;GACd,IAAI,QAAQ,QAAQ,gBAAgB,MAAM,MAAM,MAAM,GAAG,KAAK,IAAI,CAAC;EACrE,GAAG,EAAE,WAAW,KAAK,CAAC;EAEtB,SAAS,aAAa,MAAe;GACnC,IAAI,SAAS,CAAC,CAAC,GAAG,OAAO,aAAa,GAAG,OAAO,cAAc;EAChE;;GAIE,OAAAA,UAAA,GAAAC,YAaSC,MAAA,MAAA,GAAA;IAZN,MAAMA,MAAA,EAAA,CAAE,EAAE,eAAW;IACrB,OAAOA,MAAA,CAAA,CAAC,CAAA,eAAA;IACR,aAAaA,MAAA,CAAA,CAAC,CAAA,qBAAA;IACd,iBAAa;;IAEH,SAAOC,cAKE,CAJlBC,YAIkBF,MAAA,eAAA,GAAA;KAJO,eAAa,MAAA;KAAA,uBAAA,OAAA,OAAA,OAAA,MAAA,WAAA,MAAK,QAAA;KAAG,QAAQ,OAAA;KAAS,aAAaA,MAAA,CAAA,CAAC,CAAA,qBAAA;KAAyB,OAAA;KAAM,OAAM;KAAQ,iBAAa;;KAC1H,OAAKC,cACU,CAArBE,gBAAAC,gBAAAJ,MAAA,CAAA,CAAC,CAAA,eAAA,CAAA,GAAA,CAAA,CAAA,CAAA"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Editor } from "@tiptap/core";
|
|
2
|
+
//#region src/vue/components/EditorCommandPalette.vue.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* „Befehle“ (⌘K): the commands of the surface's editor (features' and host's, `palette !== false`) in a modal palette,
|
|
5
|
+
* grouped like the toolbar, disabled where `commandState` disables them; a menu command opens its rows as a second
|
|
6
|
+
* level. Mounted by `core-ui` as an overlay of the surface; the surface's `ui.paletteOpen` is its open state.
|
|
7
|
+
*/
|
|
8
|
+
type __VLS_Props = {
|
|
9
|
+
editor: Editor;
|
|
10
|
+
};
|
|
11
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
12
|
+
declare const _default: typeof __VLS_export;
|
|
13
|
+
//#endregion
|
|
14
|
+
export { _default as default };
|
|
15
|
+
//# sourceMappingURL=EditorCommandPalette.vue.d.ts.map
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import { settingsTabsOf } from "../../core/define-editor.js";
|
|
2
|
+
import { editorEntryOf } from "../../core/editor-ui.js";
|
|
2
3
|
import { useUiKit } from "../kit/use-ui-kit.js";
|
|
3
4
|
import { useEditorSettings } from "../settings.js";
|
|
4
5
|
import { useEditorContext } from "../context.js";
|
|
5
6
|
import { useEditorI18n } from "../use-editor-i18n.js";
|
|
6
7
|
import _sfc_main$1 from "./EditorSettingsPanel.js";
|
|
7
|
-
import { computed, createBlock, createCommentVNode, createElementVNode, createVNode, defineComponent, mergeModels, openBlock, unref, useModel, withCtx } from "vue";
|
|
8
|
+
import { computed, createBlock, createCommentVNode, createElementVNode, createVNode, defineComponent, mergeModels, openBlock, toRaw, unref, useModel, withCtx } from "vue";
|
|
8
9
|
//#region src/vue/components/EditorSettingsModal.vue
|
|
9
10
|
const _hoisted_1 = { class: "flex w-full justify-end" };
|
|
10
|
-
/** „Einstellungen“: `EditorSettingsPanel` in a modal. Renders nothing when
|
|
11
|
+
/** „Einstellungen“: `EditorSettingsPanel` in a modal. Renders nothing without an editor or when its preset contributes no settings tab. */
|
|
11
12
|
const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
12
13
|
__name: "EditorSettingsModal",
|
|
13
|
-
props: /*@__PURE__*/ mergeModels({
|
|
14
|
+
props: /*@__PURE__*/ mergeModels({ editor: {} }, {
|
|
14
15
|
"open": {
|
|
15
16
|
type: Boolean,
|
|
16
17
|
default: false
|
|
@@ -29,7 +30,10 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
|
29
30
|
const app = useEditorContext();
|
|
30
31
|
const { t } = useEditorI18n();
|
|
31
32
|
const { synced } = useEditorSettings();
|
|
32
|
-
const hasTabs = computed(() =>
|
|
33
|
+
const hasTabs = computed(() => {
|
|
34
|
+
const preset = editorEntryOf(props.editor && toRaw(props.editor))?.preset;
|
|
35
|
+
return !!preset && settingsTabsOf(preset, app).length > 0;
|
|
36
|
+
});
|
|
33
37
|
return (_ctx, _cache) => {
|
|
34
38
|
return hasTabs.value ? (openBlock(), createBlock(unref(UModal), {
|
|
35
39
|
key: 0,
|
|
@@ -45,9 +49,9 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
|
45
49
|
body: withCtx(() => [createVNode(_sfc_main$1, {
|
|
46
50
|
tab: tab.value,
|
|
47
51
|
"onUpdate:tab": _cache[0] || (_cache[0] = ($event) => tab.value = $event),
|
|
48
|
-
|
|
52
|
+
editor: __props.editor,
|
|
49
53
|
"content-class": "h-[32rem] overflow-y-auto pt-4 pr-2"
|
|
50
|
-
}, null, 8, ["tab", "
|
|
54
|
+
}, null, 8, ["tab", "editor"])]),
|
|
51
55
|
footer: withCtx(() => [createElementVNode("div", _hoisted_1, [createVNode(unref(UButton), {
|
|
52
56
|
label: unref(t)("common.close"),
|
|
53
57
|
color: "neutral",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EditorSettingsModal.js","names":["_useModel","_openBlock","_createBlock","_unref","_withCtx","_createVNode","EditorSettingsPanel","_createElementVNode","_createCommentVNode"],"sources":["../../../src/vue/components/EditorSettingsModal.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { useUiKit } from '../kit/use-ui-kit'\nimport { computed } from 'vue'\nimport { settingsTabsOf } from '../../core/define-editor'\nimport
|
|
1
|
+
{"version":3,"file":"EditorSettingsModal.js","names":["_useModel","_openBlock","_createBlock","_unref","_withCtx","_createVNode","EditorSettingsPanel","_createElementVNode","_createCommentVNode"],"sources":["../../../src/vue/components/EditorSettingsModal.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { useUiKit } from '../kit/use-ui-kit'\nimport { computed, toRaw } from 'vue'\nimport type { Editor } from '@tiptap/core'\nimport { settingsTabsOf } from '../../core/define-editor'\nimport { editorEntryOf } from '../../core/editor-ui'\nimport { useEditorContext } from '../context'\nimport { useEditorI18n } from '../use-editor-i18n'\nimport { useEditorSettings } from '../settings'\nimport EditorSettingsPanel from './EditorSettingsPanel.vue'\n\n/** „Einstellungen“: `EditorSettingsPanel` in a modal. Renders nothing without an editor or when its preset contributes no settings tab. */\nconst props = defineProps<{\n /** The editor whose preset (registered by its surface, from its `ready` event) contributes the tabs. */\n editor?: Editor\n}>()\n\nconst { Button: UButton, Modal: UModal } = useUiKit()\n\nconst open = defineModel<boolean>('open', { default: false })\n/** Shown tab id (see `EditorSettingsPanel`). */\nconst tab = defineModel<string | undefined>('tab', { default: undefined })\n\nconst app = useEditorContext()\nconst { t } = useEditorI18n()\nconst { synced } = useEditorSettings()\nconst hasTabs = computed(() => {\n const preset = editorEntryOf(props.editor && toRaw(props.editor))?.preset\n return !!preset && settingsTabsOf(preset, app).length > 0\n})\n</script>\n\n<template>\n <UModal\n v-if=\"hasTabs\"\n :open=\"open\"\n :title=\"t('settings.title')\"\n :description=\"t(synced ? 'settings.scope.account' : 'settings.scope.browser')\"\n :ui=\"{ overlay: 'bg-[color-mix(in_oklab,var(--sk-bg-elevated)_60%,transparent)] backdrop-blur-sm', content: 'sm:w-[42rem] sm:max-w-[42rem]' }\"\n @update:open=\"open = $event\"\n >\n <template #body>\n <EditorSettingsPanel v-model:tab=\"tab\" :editor=\"editor\" content-class=\"h-[32rem] overflow-y-auto pt-4 pr-2\" />\n </template>\n <template #footer>\n <div class=\"flex w-full justify-end\">\n <UButton :label=\"t('common.close')\" color=\"neutral\" variant=\"ghost\" @click=\"open = false\" />\n </div>\n </template>\n </UModal>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;EAYA,MAAM,QAAQ;EAKd,MAAM,EAAE,QAAQ,SAAS,OAAO,WAAW,SAAS;EAEpD,MAAM,OAAOA,SAAoB,SAAC,MAA0B;;EAE5D,MAAM,MAAMA,SAA+B,SAAC,KAA6B;EAEzE,MAAM,MAAM,iBAAiB;EAC7B,MAAM,EAAE,MAAM,cAAc;EAC5B,MAAM,EAAE,WAAW,kBAAkB;EACrC,MAAM,UAAU,eAAe;GAC7B,MAAM,SAAS,cAAc,MAAM,UAAU,MAAM,MAAM,MAAM,CAAC,CAAC,EAAE;GACnE,OAAO,CAAC,CAAC,UAAU,eAAe,QAAQ,GAAG,CAAC,CAAC,SAAS;EAC1D,CAAC;;GAKS,OAAA,QAAA,SADRC,UAAA,GAAAC,YAgBSC,MAAA,MAAA,GAAA;;IAdN,MAAM,KAAA;IACN,OAAOA,MAAA,CAAA,CAAC,CAAA,gBAAA;IACR,aAAaA,MAAA,CAAA,CAAC,CAACA,MAAA,MAAA,IAAM,2BAAA,wBAAA;IACrB,IAAI;KAAA,SAAA;KAAA,SAAA;IAAA;IACJ,iBAAW,OAAA,OAAA,OAAA,MAAA,WAAE,KAAA,QAAO;;IAEV,MAAIC,cACiG,CAA9GC,YAA8GC,aAAA;KAAjF,KAAK,IAAA;KAAA,gBAAA,OAAA,OAAA,OAAA,MAAA,WAAA,IAAG,QAAA;KAAG,QAAQ,QAAA;KAAQ,iBAAc;;IAE7D,QAAMF,cAGT,CAFNG,mBAEM,OAFN,YAEM,CADJF,YAA4FF,MAAA,OAAA,GAAA;KAAlF,OAAOA,MAAA,CAAA,CAAC,CAAA,cAAA;KAAkB,OAAM;KAAU,SAAQ;KAAS,SAAK,OAAA,OAAA,OAAA,MAAA,WAAE,KAAA,QAAI"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Editor } from "@tiptap/core";
|
|
2
2
|
//#region src/vue/components/EditorSettingsModal.vue.d.ts
|
|
3
|
-
/** „Einstellungen“: `EditorSettingsPanel` in a modal. Renders nothing when
|
|
3
|
+
/** „Einstellungen“: `EditorSettingsPanel` in a modal. Renders nothing without an editor or when its preset contributes no settings tab. */
|
|
4
4
|
type __VLS_Props = {
|
|
5
|
-
/** The
|
|
6
|
-
|
|
5
|
+
/** The editor whose preset (registered by its surface, from its `ready` event) contributes the tabs. */
|
|
6
|
+
editor?: Editor;
|
|
7
7
|
};
|
|
8
8
|
type __VLS_ModelProps = {
|
|
9
9
|
'open'?: boolean;
|
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
import { settingsTabsOf } from "../../core/define-editor.js";
|
|
2
|
+
import { editorEntryOf } from "../../core/editor-ui.js";
|
|
2
3
|
import { useUiKit } from "../kit/use-ui-kit.js";
|
|
3
4
|
import { useEditorContext } from "../context.js";
|
|
4
|
-
import { computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createVNode, defineComponent, mergeModels, mergeProps, normalizeClass, openBlock, resolveDynamicComponent, unref, useModel } from "vue";
|
|
5
|
+
import { computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createVNode, defineComponent, mergeModels, mergeProps, normalizeClass, openBlock, resolveDynamicComponent, toRaw, unref, useModel } from "vue";
|
|
5
6
|
//#region src/vue/components/EditorSettingsPanel.vue
|
|
6
7
|
const _hoisted_1 = {
|
|
7
8
|
key: 0,
|
|
8
9
|
class: "flex w-full flex-col"
|
|
9
10
|
};
|
|
10
11
|
/**
|
|
11
|
-
* The settings of an editor: one tab per settings tab the preset
|
|
12
|
-
* `ai`). Place it anywhere; it renders nothing when the preset contributes no tab. The values
|
|
13
|
-
* settings (`useEditorSettings`), so panels of several editors edit the same preferences.
|
|
12
|
+
* The settings of an editor: one tab per settings tab the features of its preset contribute (composites: `editing`,
|
|
13
|
+
* AI: `ai`). Place it anywhere; it renders nothing without an editor or when the preset contributes no tab. The values
|
|
14
|
+
* live in the app's shared settings (`useEditorSettings`), so panels of several editors edit the same preferences.
|
|
14
15
|
*/
|
|
15
16
|
const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
16
17
|
__name: "EditorSettingsPanel",
|
|
17
18
|
props: /*@__PURE__*/ mergeModels({
|
|
18
|
-
|
|
19
|
+
editor: {},
|
|
19
20
|
contentClass: { default: "pt-4" }
|
|
20
21
|
}, {
|
|
21
22
|
"tab": { default: void 0 },
|
|
@@ -28,7 +29,10 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
|
28
29
|
/** Shown tab id; a missing or removed id shows the first contributed tab. */
|
|
29
30
|
const tab = useModel(__props, "tab");
|
|
30
31
|
const app = useEditorContext();
|
|
31
|
-
const tabs = computed(() =>
|
|
32
|
+
const tabs = computed(() => {
|
|
33
|
+
const preset = editorEntryOf(props.editor && toRaw(props.editor))?.preset;
|
|
34
|
+
return preset ? settingsTabsOf(preset, app) : [];
|
|
35
|
+
});
|
|
32
36
|
const active = computed(() => tabs.value.find((candidate) => candidate.id === tab.value) ?? tabs.value[0]);
|
|
33
37
|
const items = computed(() => tabs.value.map(({ id, label, icon }) => ({
|
|
34
38
|
label,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EditorSettingsPanel.js","names":["_useModel","_openBlock","_createElementBlock","_createVNode","_unref","_createElementVNode","_normalizeClass","_createBlock","_resolveDynamicComponent","_mergeProps","_createCommentVNode"],"sources":["../../../src/vue/components/EditorSettingsPanel.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { useUiKit } from '../kit/use-ui-kit'\nimport type { TabItem } from '../kit/types'\nimport { type Component, computed } from 'vue'\nimport { settingsTabsOf } from '../../core/define-editor'\nimport
|
|
1
|
+
{"version":3,"file":"EditorSettingsPanel.js","names":["_useModel","_openBlock","_createElementBlock","_createVNode","_unref","_createElementVNode","_normalizeClass","_createBlock","_resolveDynamicComponent","_mergeProps","_createCommentVNode"],"sources":["../../../src/vue/components/EditorSettingsPanel.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { useUiKit } from '../kit/use-ui-kit'\nimport type { TabItem } from '../kit/types'\nimport type { Editor } from '@tiptap/core'\nimport { type Component, computed, toRaw } from 'vue'\nimport { settingsTabsOf } from '../../core/define-editor'\nimport { editorEntryOf } from '../../core/editor-ui'\nimport { useEditorContext } from '../context'\n\n/**\n * The settings of an editor: one tab per settings tab the features of its preset contribute (composites: `editing`,\n * AI: `ai`). Place it anywhere; it renders nothing without an editor or when the preset contributes no tab. The values\n * live in the app's shared settings (`useEditorSettings`), so panels of several editors edit the same preferences.\n */\nconst props = withDefaults(defineProps<{\n /** The editor whose preset (registered by its surface, from its `ready` event) contributes the tabs. */\n editor?: Editor\n /** Classes of the tab content area, e.g. a fixed height with scrolling. */\n contentClass?: string\n}>(), { contentClass: 'pt-4' })\n\nconst { Tabs: UTabs } = useUiKit()\n\n/** Shown tab id; a missing or removed id shows the first contributed tab. */\nconst tab = defineModel<string | undefined>('tab', { default: undefined })\n\nconst app = useEditorContext()\nconst tabs = computed(() => {\n const preset = editorEntryOf(props.editor && toRaw(props.editor))?.preset\n return preset ? settingsTabsOf(preset, app) : []\n})\nconst active = computed(() => tabs.value.find(candidate => candidate.id === tab.value) ?? tabs.value[0])\nconst items = computed<TabItem[]>(() => tabs.value.map(({ id, label, icon }) => ({ label, value: id, ...(icon && { icon }) })))\n// The descriptors are framework-agnostic (`component: unknown`); in this Vue panel they are Vue components.\nconst activeComponent = computed(() => active.value?.component as Component | undefined)\n</script>\n\n<template>\n <div v-if=\"active\" class=\"flex w-full flex-col\">\n <UTabs\n :model-value=\"active.id\"\n :items=\"items\"\n :content=\"false\"\n orientation=\"horizontal\"\n variant=\"link\"\n class=\"w-full\"\n @update:model-value=\"tab = String($event)\"\n />\n <div :class=\"contentClass\" data-settings-panel-content>\n <component :is=\"activeComponent\" :key=\"active.id\" v-bind=\"active.props\" />\n </div>\n </div>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;EAcA,MAAM,QAAQ;EAOd,MAAM,EAAE,MAAM,UAAU,SAAS;;EAGjC,MAAM,MAAMA,SAA+B,SAAC,KAA6B;EAEzE,MAAM,MAAM,iBAAiB;EAC7B,MAAM,OAAO,eAAe;GAC1B,MAAM,SAAS,cAAc,MAAM,UAAU,MAAM,MAAM,MAAM,CAAC,CAAC,EAAE;GACnE,OAAO,SAAS,eAAe,QAAQ,GAAG,IAAI,CAAC;EACjD,CAAC;EACD,MAAM,SAAS,eAAe,KAAK,MAAM,MAAK,cAAa,UAAU,OAAO,IAAI,KAAK,KAAK,KAAK,MAAM,EAAE;EACvG,MAAM,QAAQ,eAA0B,KAAK,MAAM,KAAK,EAAE,IAAI,OAAO,YAAY;GAAE;GAAO,OAAO;GAAI,GAAI,QAAQ,EAAE,KAAK;EAAG,EAAE,CAAC;EAE9H,MAAM,kBAAkB,eAAe,OAAO,OAAO,SAAkC;;GAI1E,OAAA,OAAA,SAAXC,UAAA,GAAAC,mBAaM,OAbN,YAaM,CAZJC,YAQEC,MAAA,KAAA,GAAA;IAPC,eAAa,OAAA,MAAO;IACpB,OAAO,MAAA;IACP,SAAS;IACV,aAAY;IACZ,SAAQ;IACR,OAAM;IACL,uBAAkB,OAAA,OAAA,OAAA,MAAA,WAAE,IAAA,QAAM,OAAO,MAAM;GAE1C,GAAA,MAAA,GAAA,CAAA,eAAA,OAAA,CAAA,GAAAC,mBAEM,OAAA;IAFA,OAAKC,eAAE,QAAA,YAAY;IAAE,+BAAA;GACzB,GAAA,EAAAL,UAAA,GAAAM,YAA0EC,wBAA1D,gBAAA,KAAe,GAA/BC,WAA0E,EAAxC,KAAK,OAAA,MAAO,GAAY,GAAA,OAAA,MAAO,KAAK,GAAA,MAAA,EAAA,EAAA,GAAA,CAAA,CAAA,CAAA,KAAA,mBAAA,QAAA,IAAA"}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Editor } from "@tiptap/core";
|
|
2
2
|
//#region src/vue/components/EditorSettingsPanel.vue.d.ts
|
|
3
3
|
/**
|
|
4
|
-
* The settings of an editor: one tab per settings tab the preset
|
|
5
|
-
* `ai`). Place it anywhere; it renders nothing when the preset contributes no tab. The values
|
|
6
|
-
* settings (`useEditorSettings`), so panels of several editors edit the same preferences.
|
|
4
|
+
* The settings of an editor: one tab per settings tab the features of its preset contribute (composites: `editing`,
|
|
5
|
+
* AI: `ai`). Place it anywhere; it renders nothing without an editor or when the preset contributes no tab. The values
|
|
6
|
+
* live in the app's shared settings (`useEditorSettings`), so panels of several editors edit the same preferences.
|
|
7
7
|
*/
|
|
8
8
|
type __VLS_Props = {
|
|
9
|
-
/** The
|
|
10
|
-
|
|
9
|
+
/** The editor whose preset (registered by its surface, from its `ready` event) contributes the tabs. */
|
|
10
|
+
editor?: Editor;
|
|
11
11
|
/** Classes of the tab content area, e.g. a fixed height with scrolling. */
|
|
12
12
|
contentClass?: string;
|
|
13
13
|
};
|
|
@@ -21,9 +21,8 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
|
21
21
|
abilities: {},
|
|
22
22
|
extensions: {},
|
|
23
23
|
blockActions: {},
|
|
24
|
-
|
|
24
|
+
commands: {},
|
|
25
25
|
documentId: {},
|
|
26
|
-
upload: {},
|
|
27
26
|
editable: {
|
|
28
27
|
type: Boolean,
|
|
29
28
|
default: true
|
|
@@ -68,6 +67,7 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
|
68
67
|
const app = useEditorContext();
|
|
69
68
|
const settingsOpen = ref(false);
|
|
70
69
|
const settingsTab = ref();
|
|
70
|
+
const paletteOpen = ref(false);
|
|
71
71
|
const ui = {
|
|
72
72
|
openSettings: (tab) => {
|
|
73
73
|
if (!settingsTabsOf(preset, app).length) return;
|
|
@@ -86,6 +86,12 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
|
86
86
|
},
|
|
87
87
|
get commentsOpen() {
|
|
88
88
|
return commentsOpen.value;
|
|
89
|
+
},
|
|
90
|
+
togglePalette: () => {
|
|
91
|
+
paletteOpen.value = !paletteOpen.value;
|
|
92
|
+
},
|
|
93
|
+
get paletteOpen() {
|
|
94
|
+
return paletteOpen.value;
|
|
89
95
|
}
|
|
90
96
|
};
|
|
91
97
|
provide(EDITOR_UI, ui);
|
|
@@ -103,9 +109,8 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
|
103
109
|
editable: props.editable,
|
|
104
110
|
metadata: props.metadata,
|
|
105
111
|
documentId: props.documentId,
|
|
106
|
-
upload: props.upload,
|
|
107
112
|
abilities: props.abilities,
|
|
108
|
-
|
|
113
|
+
commands: props.commands,
|
|
109
114
|
extensions: props.extensions,
|
|
110
115
|
blockActions: props.blockActions,
|
|
111
116
|
onChange: (content) => emit("update:modelValue", content),
|
|
@@ -153,11 +158,11 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
|
153
158
|
"onUpdate:open": _cache[0] || (_cache[0] = ($event) => settingsOpen.value = $event),
|
|
154
159
|
tab: settingsTab.value,
|
|
155
160
|
"onUpdate:tab": _cache[1] || (_cache[1] = ($event) => settingsTab.value = $event),
|
|
156
|
-
|
|
161
|
+
editor: unref(editor)
|
|
157
162
|
}, null, 8, [
|
|
158
163
|
"open",
|
|
159
164
|
"tab",
|
|
160
|
-
"
|
|
165
|
+
"editor"
|
|
161
166
|
])) : createCommentVNode("v-if", true)
|
|
162
167
|
], 64)) : createCommentVNode("v-if", true);
|
|
163
168
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EditorSurface.js","names":["_useModel","_unref","_openBlock","_createElementBlock","_Fragment","_createElementVNode","_createVNode","_renderList","_createBlock","_resolveDynamicComponent","EditorSettingsModal","_createCommentVNode"],"sources":["../../../src/vue/components/EditorSurface.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { AnyExtension, Editor, JSONContent } from '@tiptap/vue-3'\nimport { EditorContent, useEditor } from '@tiptap/vue-3'\nimport { type Component, onBeforeUnmount, provide, ref, toRaw, watch } from 'vue'\nimport { settingsTabsOf } from '../../core/define-editor'\nimport type { EditorUi } from '../../core/editor-ui'\nimport { useEditorContext } from '../context'\nimport { attachNotifier } from '../notify'\nimport { useUiKit } from '../kit/use-ui-kit'\nimport { EDITOR_UI } from '../use-editor-ui'\nimport type { AbilitiesOptions, BlockAction, SlashCommandItem } from '../../core/extension-points'\nimport type { CollaborationSession, EditorPreset, UploadFn } from '../../core/feature'\nimport type { EditorMetadata, MetadataItem } from '../../core/metadata-types'\nimport { createSurfaceSession } from '../../core/surface-session'\nimport { vueSuggestionRenderer } from '../suggestion-renderer'\nimport EditorSettingsModal from './EditorSettingsModal.vue'\n\ndefineOptions({ inheritAttrs: false })\n\nconst props = withDefaults(defineProps<{\n /** The features this editor is made of (`simpleEditor()`, `defineEditor(...)`); fixed at mount, remount (`key`) to change it. */\n preset: EditorPreset\n /** Collaborative mode: the Y.Doc is the document. Needs a preset with the collaboration feature; fixed at mount. */\n collaboration?: CollaborationSession\n /** Standalone mode (without `collaboration`): TipTap JSON via `v-model`; the editor keeps its own undo history. */\n modelValue?: JSONContent\n /** Host lists (`mentions`, `hashtags`, `speakers`, custom) features' suggestions search. */\n metadata?: EditorMetadata\n /** Deep-merged into the `Abilities` defaults; read once at setup. */\n abilities?: Partial<AbilitiesOptions>\n /** Added after the features' extensions; read once at setup. */\n extensions?: AnyExtension[]\n /** Hover actions shown after the features' own; shown by an installed block-UI feature. */\n blockActions?: BlockAction[]\n /** Builds the `/` menu from the features' commands; absent = the features' commands. Read once at setup. */\n slashCommands?: (defaults: SlashCommandItem[]) => SlashCommandItem[]\n /** Document whose package stores uploads (media feature). Read once at setup. */\n documentId?: string\n /** Stores an uploaded file and returns its URL (media feature). Read once at setup. */\n upload?: UploadFn\n editable?: boolean\n /** `internal`: the surface owns its settings UI; `external`: it emits `settingsOpen` and the host shows the panel. */\n settingsUi?: 'internal' | 'external'\n}>(), { editable: true, settingsUi: 'internal' })\n\nconst emit = defineEmits<{\n 'ready': [editor: Editor]\n 'update:modelValue': [content: JSONContent]\n 'metadataCreate': [list: string, item: MetadataItem]\n /** The JSON handed in (initially or later) does not fit this editor's schema; the last valid document stays. */\n 'contentError': [error: Error]\n /** `settingsUi: 'external'`: the editor asks the host to open its settings (on `tab` when given). */\n 'settingsOpen': [tab?: string]\n}>()\n\n/** Whether this editor's AI sidebar is open (`toggleSidebar`): hosts bind it (`v-model:sidebar-open`). */\nconst sidebarOpen = defineModel<boolean>('sidebarOpen', { default: false })\n/**\n * Whether this editor's comments margin is open (`toggleComments`, Mod-Shift-m of the comments feature): hosts bind it\n * (`v-model:comments-open`). The AI sidebar and the margin exclude each other: whichever opens last closes the other.\n */\nconst commentsOpen = defineModel<boolean>('commentsOpen', { default: false })\nwatch(sidebarOpen, (open) => {\n if (open) commentsOpen.value = false\n})\nwatch(commentsOpen, (open) => {\n if (open) sidebarOpen.value = false\n})\n\nconst { preset } = props\nconst app = useEditorContext()\n\n\n// The editor's chrome for its subtree (EDITOR_UI) and, registered by editor instance once it exists, for components\n// a host places beside it (EditorToolbar, outline, sidebar).\nconst settingsOpen = ref(false)\nconst settingsTab = ref<string | undefined>()\nconst ui: EditorUi = {\n openSettings: (tab) => {\n // Nothing to open without a contributed tab.\n if (!settingsTabsOf(preset, app).length) return\n if (props.settingsUi === 'external') {\n emit('settingsOpen', tab)\n return\n }\n if (tab) settingsTab.value = tab\n settingsOpen.value = true\n },\n toggleSidebar: () => {\n sidebarOpen.value = !sidebarOpen.value\n },\n toggleComments: () => {\n commentsOpen.value = !commentsOpen.value\n },\n get commentsOpen() {\n return commentsOpen.value\n },\n}\nprovide(EDITOR_UI, ui)\n\n// Captured in setup: features raise notices later, outside it.\nconst kitNotify = useUiKit().notifier()\nattachNotifier(app.notify, kitNotify)\n\n// Everything framework-free: mode, context, extensions, content validation, setup lifecycle. The mode is fixed at\n// setup; hosts switch it by remounting (`key`).\nconst session = createSurfaceSession({\n app,\n preset,\n ui,\n notify: kitNotify,\n suggestionRenderer: vueSuggestionRenderer,\n getEditor: () => editor.value,\n collaboration: props.collaboration,\n // Raw: a reactive host value would put Vue proxies into node attributes.\n value: props.modelValue && toRaw(props.modelValue),\n editable: props.editable,\n metadata: props.metadata,\n documentId: props.documentId,\n upload: props.upload,\n abilities: props.abilities,\n slashCommands: props.slashCommands,\n extensions: props.extensions,\n blockActions: props.blockActions,\n onChange: content => emit('update:modelValue', content),\n onMetadataCreate: (list, item) => emit('metadataCreate', list, item),\n onContentError: error => emit('contentError', error),\n // The registered instance is the one `useEditor` created: the vue-3 `Editor` subclass.\n onReady: instance => emit('ready', instance as Editor),\n})\n// Descriptors are framework-agnostic (`overlays: unknown[]`); in this Vue surface they are Vue components.\nconst overlays = session.overlays as readonly Component[]\n\n// Setup contributions run during setup (also on the server) and are torn down when the surface unmounts.\nsession.activate()\n\nconst editor = useEditor(session.editorOptions)\n\nwatch(() => props.modelValue, value => session.setValue(value && toRaw(value)))\nwatch(() => props.editable, editable => session.setEditable(editable))\nwatch(() => props.metadata, metadata => session.setMetadata(metadata))\n\n// `useEditor` creates the instance in onMounted; announce it once it exists (its chrome registered first, so a host\n// toolbar that receives it through `ready` finds the chrome).\nlet unregister: (() => void) | undefined\nconst stopReady = watch(editor, (instance) => {\n if (!instance) return\n unregister = session.register(toRaw(instance))\n stopReady()\n})\n\nonBeforeUnmount(() => {\n unregister?.()\n session.deactivate()\n editor.value?.destroy()\n})\n\ndefineExpose({ editor, settingsOpen, settingsTab })\n</script>\n\n<template>\n <template v-if=\"editor\">\n <div class=\"relative\">\n <EditorContent :editor=\"editor\" class=\"relative\" />\n </div>\n <component :is=\"overlay\" v-for=\"(overlay, index) in overlays\" :key=\"index\" :editor=\"editor\" />\n <EditorSettingsModal v-if=\"settingsUi === 'internal'\" v-model:open=\"settingsOpen\" v-model:tab=\"settingsTab\" :preset=\"preset\" />\n </template>\n</template>\n"],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"EditorSurface.js","names":["_useModel","_unref","_openBlock","_createElementBlock","_Fragment","_createElementVNode","_createVNode","_renderList","_createBlock","_resolveDynamicComponent","EditorSettingsModal","_createCommentVNode"],"sources":["../../../src/vue/components/EditorSurface.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { AnyExtension, Editor, JSONContent } from '@tiptap/vue-3'\nimport { EditorContent, useEditor } from '@tiptap/vue-3'\nimport { type Component, onBeforeUnmount, provide, ref, toRaw, watch } from 'vue'\nimport { settingsTabsOf } from '../../core/define-editor'\nimport type { EditorUi } from '../../core/editor-ui'\nimport { useEditorContext } from '../context'\nimport { attachNotifier } from '../notify'\nimport { useUiKit } from '../kit/use-ui-kit'\nimport { EDITOR_UI } from '../use-editor-ui'\nimport type { CommandDef } from '../../core/commands'\nimport type { AbilitiesOptions, BlockAction } from '../../core/extension-points'\nimport type { CollaborationSession, EditorPreset } from '../../core/feature'\nimport type { EditorMetadata, MetadataItem } from '../../core/metadata-types'\nimport { createSurfaceSession } from '../../core/surface-session'\nimport { vueSuggestionRenderer } from '../suggestion-renderer'\nimport EditorSettingsModal from './EditorSettingsModal.vue'\n\ndefineOptions({ inheritAttrs: false })\n\nconst props = withDefaults(defineProps<{\n /** The features this editor is made of (`simpleEditor()`, `defineEditor(...)`); fixed at mount, remount (`key`) to change it. */\n preset: EditorPreset\n /** Collaborative mode: the Y.Doc is the document. Needs a preset with the collaboration feature; fixed at mount. */\n collaboration?: CollaborationSession\n /** Standalone mode (without `collaboration`): TipTap JSON via `v-model`; the editor keeps its own undo history. */\n modelValue?: JSONContent\n /** Host lists (`mentions`, `hashtags`, `speakers`, custom) features' suggestions search. */\n metadata?: EditorMetadata\n /** Deep-merged into the `Abilities` defaults; read once at setup. */\n abilities?: Partial<AbilitiesOptions>\n /** Added after the features' extensions; read once at setup. */\n extensions?: AnyExtension[]\n /** Hover actions shown after the features' own; shown by an installed block-UI feature. */\n blockActions?: BlockAction[]\n /** Builds the final commands (and with them the `/` menu) from the features' commands; absent = the features' commands. Read once at setup. */\n commands?: (defaults: CommandDef[]) => CommandDef[]\n /** Document whose package stores uploads (`backend.assets`, media feature). Read once at setup. */\n documentId?: string\n editable?: boolean\n /** `internal`: the surface owns its settings UI; `external`: it emits `settingsOpen` and the host shows the panel. */\n settingsUi?: 'internal' | 'external'\n}>(), { editable: true, settingsUi: 'internal' })\n\nconst emit = defineEmits<{\n 'ready': [editor: Editor]\n 'update:modelValue': [content: JSONContent]\n 'metadataCreate': [list: string, item: MetadataItem]\n /** The JSON handed in (initially or later) does not fit this editor's schema; the last valid document stays. */\n 'contentError': [error: Error]\n /** `settingsUi: 'external'`: the editor asks the host to open its settings (on `tab` when given). */\n 'settingsOpen': [tab?: string]\n}>()\n\n/** Whether this editor's AI sidebar is open (`toggleSidebar`): hosts bind it (`v-model:sidebar-open`). */\nconst sidebarOpen = defineModel<boolean>('sidebarOpen', { default: false })\n/**\n * Whether this editor's comments margin is open (`toggleComments`, Mod-Shift-m of the comments feature): hosts bind it\n * (`v-model:comments-open`). The AI sidebar and the margin exclude each other: whichever opens last closes the other.\n */\nconst commentsOpen = defineModel<boolean>('commentsOpen', { default: false })\nwatch(sidebarOpen, (open) => {\n if (open) commentsOpen.value = false\n})\nwatch(commentsOpen, (open) => {\n if (open) sidebarOpen.value = false\n})\n\nconst { preset } = props\nconst app = useEditorContext()\n\n// The editor's chrome for its subtree (EDITOR_UI) and, registered by editor instance once it exists, for components\n// a host places beside it (EditorToolbar, outline, sidebar).\nconst settingsOpen = ref(false)\nconst settingsTab = ref<string | undefined>()\n// The ⌘K palette (the `core-ui` overlay, when the preset has one) shows while this is true.\nconst paletteOpen = ref(false)\nconst ui: EditorUi = {\n openSettings: (tab) => {\n // Nothing to open without a contributed tab.\n if (!settingsTabsOf(preset, app).length) return\n if (props.settingsUi === 'external') {\n emit('settingsOpen', tab)\n return\n }\n if (tab) settingsTab.value = tab\n settingsOpen.value = true\n },\n toggleSidebar: () => {\n sidebarOpen.value = !sidebarOpen.value\n },\n toggleComments: () => {\n commentsOpen.value = !commentsOpen.value\n },\n get commentsOpen() {\n return commentsOpen.value\n },\n togglePalette: () => {\n paletteOpen.value = !paletteOpen.value\n },\n get paletteOpen() {\n return paletteOpen.value\n },\n}\nprovide(EDITOR_UI, ui)\n\n// Captured in setup: features raise notices later, outside it.\nconst kitNotify = useUiKit().notifier()\nattachNotifier(app.notify, kitNotify)\n\n// Everything framework-free: mode, context, extensions, content validation, setup lifecycle. The mode is fixed at\n// setup; hosts switch it by remounting (`key`).\nconst session = createSurfaceSession({\n app,\n preset,\n ui,\n notify: kitNotify,\n suggestionRenderer: vueSuggestionRenderer,\n getEditor: () => editor.value,\n collaboration: props.collaboration,\n // Raw: a reactive host value would put Vue proxies into node attributes.\n value: props.modelValue && toRaw(props.modelValue),\n editable: props.editable,\n metadata: props.metadata,\n documentId: props.documentId,\n abilities: props.abilities,\n commands: props.commands,\n extensions: props.extensions,\n blockActions: props.blockActions,\n onChange: content => emit('update:modelValue', content),\n onMetadataCreate: (list, item) => emit('metadataCreate', list, item),\n onContentError: error => emit('contentError', error),\n // The registered instance is the one `useEditor` created: the vue-3 `Editor` subclass.\n onReady: instance => emit('ready', instance as Editor),\n})\n// Descriptors are framework-agnostic (`overlays: unknown[]`); in this Vue surface they are Vue components.\nconst overlays = session.overlays as readonly Component[]\n\n// Setup contributions run during setup (also on the server) and are torn down when the surface unmounts.\nsession.activate()\n\nconst editor = useEditor(session.editorOptions)\n\nwatch(() => props.modelValue, value => session.setValue(value && toRaw(value)))\nwatch(() => props.editable, editable => session.setEditable(editable))\nwatch(() => props.metadata, metadata => session.setMetadata(metadata))\n\n// `useEditor` creates the instance in onMounted; announce it once it exists (its chrome registered first, so a host\n// toolbar that receives it through `ready` finds the chrome).\nlet unregister: (() => void) | undefined\nconst stopReady = watch(editor, (instance) => {\n if (!instance) return\n unregister = session.register(toRaw(instance))\n stopReady()\n})\n\nonBeforeUnmount(() => {\n unregister?.()\n session.deactivate()\n editor.value?.destroy()\n})\n\ndefineExpose({ editor, settingsOpen, settingsTab })\n</script>\n\n<template>\n <template v-if=\"editor\">\n <div class=\"relative\">\n <EditorContent :editor=\"editor\" class=\"relative\" />\n </div>\n <component :is=\"overlay\" v-for=\"(overlay, index) in overlays\" :key=\"index\" :editor=\"editor\" />\n <EditorSettingsModal v-if=\"settingsUi === 'internal'\" v-model:open=\"settingsOpen\" v-model:tab=\"settingsTab\" :editor=\"editor\" />\n </template>\n</template>\n"],"mappings":"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"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CommandDef } from "../../core/command-types.js";
|
|
2
|
+
import { AbilitiesOptions, BlockAction } from "../../core/extension-points.js";
|
|
2
3
|
import { EditorMetadata, MetadataItem } from "../../core/metadata-types.js";
|
|
3
|
-
import { CollaborationSession, EditorPreset
|
|
4
|
+
import { CollaborationSession, EditorPreset } from "../../core/feature.js";
|
|
5
|
+
import "../../core/commands.js";
|
|
4
6
|
import { AnyExtension, Editor, JSONContent } from "@tiptap/vue-3";
|
|
5
7
|
//#region src/vue/components/EditorSurface.vue.d.ts
|
|
6
8
|
type __VLS_Props = {
|
|
@@ -18,12 +20,10 @@ type __VLS_Props = {
|
|
|
18
20
|
extensions?: AnyExtension[];
|
|
19
21
|
/** Hover actions shown after the features' own; shown by an installed block-UI feature. */
|
|
20
22
|
blockActions?: BlockAction[];
|
|
21
|
-
/** Builds the `/` menu from the features' commands; absent = the features' commands. Read once at setup. */
|
|
22
|
-
|
|
23
|
-
/** Document whose package stores uploads (media feature). Read once at setup. */
|
|
23
|
+
/** Builds the final commands (and with them the `/` menu) from the features' commands; absent = the features' commands. Read once at setup. */
|
|
24
|
+
commands?: (defaults: CommandDef[]) => CommandDef[];
|
|
25
|
+
/** Document whose package stores uploads (`backend.assets`, media feature). Read once at setup. */
|
|
24
26
|
documentId?: string;
|
|
25
|
-
/** Stores an uploaded file and returns its URL (media feature). Read once at setup. */
|
|
26
|
-
upload?: UploadFn;
|
|
27
27
|
editable?: boolean;
|
|
28
28
|
/** `internal`: the surface owns its settings UI; `external`: it emits `settingsOpen` and the host shows the panel. */
|
|
29
29
|
settingsUi?: 'internal' | 'external';
|
|
@@ -43,19 +43,19 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {
|
|
|
43
43
|
settingsOpen: import("vue").Ref<boolean, boolean>;
|
|
44
44
|
settingsTab: import("vue").Ref<string | undefined, string | undefined>;
|
|
45
45
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
46
|
-
"update:modelValue": (content: JSONContent) => any;
|
|
47
|
-
ready: (editor: Editor) => any;
|
|
48
46
|
settingsOpen: (tab?: string | undefined) => any;
|
|
49
47
|
"update:sidebarOpen": (value: boolean) => any;
|
|
50
48
|
"update:commentsOpen": (value: boolean) => any;
|
|
49
|
+
"update:modelValue": (content: JSONContent) => any;
|
|
50
|
+
ready: (editor: Editor) => any;
|
|
51
51
|
metadataCreate: (list: string, item: MetadataItem) => any;
|
|
52
52
|
contentError: (error: Error) => any;
|
|
53
53
|
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
54
|
-
"onUpdate:modelValue"?: ((content: JSONContent) => any) | undefined;
|
|
55
|
-
onReady?: ((editor: Editor) => any) | undefined;
|
|
56
54
|
onSettingsOpen?: ((tab?: string | undefined) => any) | undefined;
|
|
57
55
|
"onUpdate:sidebarOpen"?: ((value: boolean) => any) | undefined;
|
|
58
56
|
"onUpdate:commentsOpen"?: ((value: boolean) => any) | undefined;
|
|
57
|
+
"onUpdate:modelValue"?: ((content: JSONContent) => any) | undefined;
|
|
58
|
+
onReady?: ((editor: Editor) => any) | undefined;
|
|
59
59
|
onMetadataCreate?: ((list: string, item: MetadataItem) => any) | undefined;
|
|
60
60
|
onContentError?: ((error: Error) => any) | undefined;
|
|
61
61
|
}>, {
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import { abilitiesAtSelection } from "../../core/abilities.js";
|
|
2
|
-
import { mergeToolbarGroups } from "../../core/toolbar.js";
|
|
3
|
-
import { contributions } from "../../core/define-editor.js";
|
|
4
1
|
import { borrowedFeatureContext, editorEntryOf } from "../../core/editor-ui.js";
|
|
2
|
+
import { commandState, toolbarOf } from "../../core/commands.js";
|
|
5
3
|
import { useUiKit } from "../kit/use-ui-kit.js";
|
|
6
4
|
import { useEditorContext } from "../context.js";
|
|
7
5
|
import { useEditorI18n } from "../use-editor-i18n.js";
|
|
@@ -17,15 +15,12 @@ const _hoisted_2 = {
|
|
|
17
15
|
};
|
|
18
16
|
/**
|
|
19
17
|
* The toolbar of an editor, placed anywhere on the page. `editor` is the instance it works on (from the surface's
|
|
20
|
-
* `ready` event); the preset registered for that instance supplies the groups
|
|
21
|
-
*
|
|
18
|
+
* `ready` event); the preset registered for that instance (`editorEntryOf`) supplies the groups. Without an editor
|
|
19
|
+
* (not mounted yet, or read-only by the host's choice) it renders no groups. Never reads a global active editor.
|
|
22
20
|
*/
|
|
23
21
|
const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
24
22
|
__name: "EditorToolbar",
|
|
25
|
-
props: {
|
|
26
|
-
editor: {},
|
|
27
|
-
preset: {}
|
|
28
|
-
},
|
|
23
|
+
props: { editor: {} },
|
|
29
24
|
setup(__props) {
|
|
30
25
|
const props = __props;
|
|
31
26
|
const { Button: UButton, DropdownMenu: UDropdownMenu, FieldGroup: UFieldGroup, Tooltip: UTooltip } = useUiKit();
|
|
@@ -43,38 +38,35 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
|
43
38
|
if (!preset) return [];
|
|
44
39
|
const cached = built.get(preset);
|
|
45
40
|
if (cached) return cached;
|
|
46
|
-
const build = () =>
|
|
41
|
+
const build = () => toolbarOf(preset, ctx);
|
|
47
42
|
const groups = instance ? instance.appContext.app.runWithContext(build) : build();
|
|
48
43
|
built.set(preset, groups);
|
|
49
44
|
return groups;
|
|
50
45
|
}
|
|
51
|
-
|
|
46
|
+
const NO_EDITOR = {
|
|
47
|
+
visible: true,
|
|
48
|
+
enabled: false,
|
|
49
|
+
active: false
|
|
50
|
+
};
|
|
52
51
|
const visibleGroups = computed(() => {
|
|
53
|
-
const editor = props.editor;
|
|
54
|
-
return groupsOf(editorEntryOf(editor
|
|
52
|
+
const editor = props.editor && toRaw(props.editor);
|
|
53
|
+
return groupsOf(editorEntryOf(editor)?.preset).filter((group) => !editor || !group.visible || group.visible(editor)).map((group) => ({
|
|
55
54
|
group,
|
|
56
|
-
items: group.items.
|
|
55
|
+
items: group.items.map((cmd) => ({
|
|
56
|
+
cmd,
|
|
57
|
+
state: editor ? commandState(editor, cmd, "selection") : NO_EDITOR
|
|
58
|
+
})).filter(({ state }) => state.visible)
|
|
57
59
|
})).filter(({ items }) => items.length > 0);
|
|
58
60
|
});
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
return !!props.editor && !!item.active?.(props.editor);
|
|
62
|
-
}
|
|
63
|
-
function disabled(item) {
|
|
64
|
-
const editor = props.editor;
|
|
65
|
-
if (!editor) return true;
|
|
66
|
-
if (item.disabled?.(editor)) return true;
|
|
67
|
-
return !active(item) && !!item.ability && !abilities.value.has(item.ability);
|
|
68
|
-
}
|
|
69
|
-
function run(item) {
|
|
70
|
-
if (props.editor) item.run?.(props.editor);
|
|
61
|
+
function run(cmd) {
|
|
62
|
+
if (props.editor && "run" in cmd) cmd.run(props.editor);
|
|
71
63
|
}
|
|
72
|
-
function menuOf(
|
|
73
|
-
return props.editor &&
|
|
64
|
+
function menuOf(cmd) {
|
|
65
|
+
return props.editor && "menu" in cmd ? cmd.menu(props.editor) : [];
|
|
74
66
|
}
|
|
75
67
|
/** Descriptors are framework-agnostic (`component: unknown`); in this Vue toolbar they are Vue components. */
|
|
76
|
-
function componentOf(
|
|
77
|
-
return
|
|
68
|
+
function componentOf(cmd) {
|
|
69
|
+
return "component" in cmd ? cmd.component : void 0;
|
|
78
70
|
}
|
|
79
71
|
return (_ctx, _cache) => {
|
|
80
72
|
return openBlock(), createElementBlock("div", {
|
|
@@ -83,25 +75,25 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
|
83
75
|
"aria-label": unref(t)("toolbar.label")
|
|
84
76
|
}, [(openBlock(true), createElementBlock(Fragment, null, renderList(visibleGroups.value, ({ group, items }, gi) => {
|
|
85
77
|
return openBlock(), createElementBlock(Fragment, { key: group.id }, [gi > 0 ? (openBlock(), createElementBlock("span", _hoisted_2)) : createCommentVNode("v-if", true), createVNode(unref(UFieldGroup), { size: "sm" }, {
|
|
86
|
-
default: withCtx(() => [(openBlock(true), createElementBlock(Fragment, null, renderList(items, (
|
|
87
|
-
return openBlock(), createElementBlock(Fragment, { key:
|
|
78
|
+
default: withCtx(() => [(openBlock(true), createElementBlock(Fragment, null, renderList(items, ({ cmd, state }) => {
|
|
79
|
+
return openBlock(), createElementBlock(Fragment, { key: cmd.id }, [componentOf(cmd) ? (openBlock(), createBlock(resolveDynamicComponent(componentOf(cmd)), {
|
|
88
80
|
key: 0,
|
|
89
81
|
editor: props.editor
|
|
90
|
-
}, null, 8, ["editor"])) :
|
|
82
|
+
}, null, 8, ["editor"])) : "menu" in cmd ? (openBlock(), createBlock(unref(UDropdownMenu), {
|
|
91
83
|
key: 1,
|
|
92
|
-
items: menuOf(
|
|
84
|
+
items: menuOf(cmd)
|
|
93
85
|
}, {
|
|
94
86
|
default: withCtx(() => [createVNode(unref(UTooltip), {
|
|
95
|
-
text:
|
|
96
|
-
kbds:
|
|
87
|
+
text: cmd.label,
|
|
88
|
+
kbds: cmd.kbds
|
|
97
89
|
}, {
|
|
98
90
|
default: withCtx(() => [(openBlock(), createBlock(unref(UButton), {
|
|
99
|
-
key:
|
|
91
|
+
key: cmd.icon,
|
|
100
92
|
color: "neutral",
|
|
101
93
|
variant: "ghost",
|
|
102
|
-
icon:
|
|
103
|
-
"aria-label":
|
|
104
|
-
disabled:
|
|
94
|
+
icon: cmd.icon,
|
|
95
|
+
"aria-label": cmd.label,
|
|
96
|
+
disabled: !state.enabled,
|
|
105
97
|
onMousedown: _cache[0] || (_cache[0] = withModifiers(() => {}, ["prevent"]))
|
|
106
98
|
}, null, 8, [
|
|
107
99
|
"icon",
|
|
@@ -113,22 +105,22 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
|
113
105
|
_: 2
|
|
114
106
|
}, 1032, ["items"])) : (openBlock(), createBlock(unref(UTooltip), {
|
|
115
107
|
key: 2,
|
|
116
|
-
text:
|
|
117
|
-
kbds:
|
|
108
|
+
text: cmd.label,
|
|
109
|
+
kbds: cmd.kbds
|
|
118
110
|
}, {
|
|
119
111
|
default: withCtx(() => [(openBlock(), createBlock(unref(UButton), {
|
|
120
|
-
key:
|
|
112
|
+
key: cmd.icon,
|
|
121
113
|
color: "neutral",
|
|
122
114
|
variant: "ghost",
|
|
123
115
|
"active-color": "primary",
|
|
124
116
|
"active-variant": "soft",
|
|
125
|
-
icon:
|
|
126
|
-
"aria-label":
|
|
127
|
-
active: active
|
|
128
|
-
"aria-pressed":
|
|
129
|
-
disabled:
|
|
117
|
+
icon: cmd.icon,
|
|
118
|
+
"aria-label": cmd.label,
|
|
119
|
+
active: state.active,
|
|
120
|
+
"aria-pressed": cmd.active ? state.active : void 0,
|
|
121
|
+
disabled: !state.enabled,
|
|
130
122
|
onMousedown: _cache[1] || (_cache[1] = withModifiers(() => {}, ["prevent"])),
|
|
131
|
-
onClick: ($event) => run(
|
|
123
|
+
onClick: ($event) => run(cmd)
|
|
132
124
|
}, null, 8, [
|
|
133
125
|
"icon",
|
|
134
126
|
"aria-label",
|