@ecsplico/editor 2.1.2 → 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 +68 -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/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/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 +1 -1
- package/dist/features/block-ui/block-actions.js +1 -1
- package/dist/features/block-ui/block-actions.js.map +1 -1
- package/dist/features/block-ui/components/BlockUi.js +1 -1
- package/dist/features/block-ui/feature.js +1 -0
- package/dist/features/block-ui/feature.js.map +1 -1
- package/dist/features/block-ui/react/BlockUi.js +1 -1
- package/dist/features/collab/anchor-resolver.js +1 -1
- package/dist/features/collab/feature.js +2 -0
- package/dist/features/collab/feature.js.map +1 -1
- package/dist/features/comments/components/CommentThreadView.vue.d.ts +2 -1
- package/dist/features/comments/feature.js +12 -11
- package/dist/features/comments/feature.js.map +1 -1
- package/dist/features/comments/index.d.ts +3 -2
- package/dist/features/comments/index.js +1 -1
- package/dist/features/comments/margin-layout.d.ts +3 -2
- package/dist/features/comments/model.d.ts +3 -67
- package/dist/features/comments/model.js +2 -2
- package/dist/features/comments/model.js.map +1 -1
- package/dist/features/comments/react/CommentThreadView.d.ts +3 -2
- package/dist/features/comments/react/use-comments.d.ts +2 -1
- package/dist/features/comments/react.d.ts +1 -1
- package/dist/features/comments/schema.d.ts +2 -52
- package/dist/features/comments/schema.js.map +1 -1
- package/dist/features/comments/snapshot-equality.js.map +1 -1
- package/dist/features/comments/use-comments.d.ts +3 -2
- package/dist/features/comments/vue.d.ts +1 -1
- package/dist/features/composites/accepted-children.d.ts +1 -0
- package/dist/features/composites/accepted-children.js +16 -1
- package/dist/features/composites/accepted-children.js.map +1 -1
- package/dist/features/composites/ai-brief.js +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 +6 -5
- 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 +2 -2
- package/dist/tree/tree-items.js +1 -1
- package/dist/vue/AdvancedEditor.js +30 -9
- package/dist/vue/AdvancedEditor.js.map +1 -1
- package/dist/vue/AdvancedEditor.vue.d.ts +28 -8
- 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 +7 -7
- package/dist/vue/components/EditorToolbar.js +41 -49
- package/dist/vue/components/EditorToolbar.js.map +1 -1
- package/dist/vue/components/EditorToolbar.vue.d.ts +2 -4
- package/dist/vue/compose.d.ts +17 -0
- package/dist/vue/compose.js +51 -0
- package/dist/vue/compose.js.map +1 -0
- package/dist/vue/context-key.d.ts +6 -0
- package/dist/vue/context-key.js +6 -0
- package/dist/vue/context-key.js.map +1 -0
- package/dist/vue/context.d.ts +8 -6
- package/dist/vue/context.js +6 -5
- package/dist/vue/context.js.map +1 -1
- package/dist/vue/index.d.ts +10 -8
- package/dist/vue/index.js +10 -8
- package/dist/vue/kit/index.d.ts +2 -2
- package/dist/vue/kit/nuxt-ui.js +23 -0
- package/dist/vue/kit/nuxt-ui.js.map +1 -1
- package/dist/vue/kit/types.d.ts +40 -1
- package/package.json +30 -16
- package/dist/adapters/comments/client.d.ts +0 -64
- package/dist/adapters/comments/client.js.map +0 -1
- package/dist/adapters/routes.js.map +0 -1
- package/dist/core/toolbar.d.ts +0 -74
- package/dist/core/toolbar.js +0 -45
- package/dist/core/toolbar.js.map +0 -1
- package/dist/integrations/composite-ai/document-transcribe.d.ts +0 -14
- package/dist/integrations/composite-ai/document-transcribe.js +0 -89
- package/dist/integrations/composite-ai/document-transcribe.js.map +0 -1
- package/dist/nuxt/runtime/server/api/ai/chat.post.d.ts +0 -5
- package/dist/nuxt/runtime/server/api/ai/chat.post.js +0 -8
- package/dist/nuxt/runtime/server/api/ai/chat.post.js.map +0 -1
- package/dist/nuxt/runtime/server/api/ai/complete.post.d.ts +0 -5
- package/dist/nuxt/runtime/server/api/ai/complete.post.js +0 -8
- package/dist/nuxt/runtime/server/api/ai/complete.post.js.map +0 -1
- package/dist/nuxt/runtime/server/api/ai/generate.post.d.ts +0 -5
- package/dist/nuxt/runtime/server/api/ai/generate.post.js +0 -8
- package/dist/nuxt/runtime/server/api/ai/generate.post.js.map +0 -1
- package/dist/nuxt/runtime/server/api/ai/models.get.d.ts +0 -5
- package/dist/nuxt/runtime/server/api/ai/models.get.js +0 -8
- package/dist/nuxt/runtime/server/api/ai/models.get.js.map +0 -1
- package/dist/nuxt/runtime/server/api/ai/transcribe.post.d.ts +0 -5
- package/dist/nuxt/runtime/server/api/ai/transcribe.post.js +0 -8
- package/dist/nuxt/runtime/server/api/ai/transcribe.post.js.map +0 -1
- package/dist/nuxt/runtime/server/api/ai/transcript-cleanup.post.d.ts +0 -5
- package/dist/nuxt/runtime/server/api/ai/transcript-cleanup.post.js +0 -8
- package/dist/nuxt/runtime/server/api/ai/transcript-cleanup.post.js.map +0 -1
- package/dist/nuxt/runtime/server/api/editor/assets/[id]/[name].get.d.ts +0 -5
- package/dist/nuxt/runtime/server/api/editor/assets/[id]/[name].get.js +0 -8
- package/dist/nuxt/runtime/server/api/editor/assets/[id]/[name].get.js.map +0 -1
- package/dist/nuxt/runtime/server/api/editor/assets/[id].post.d.ts +0 -5
- package/dist/nuxt/runtime/server/api/editor/assets/[id].post.js +0 -8
- package/dist/nuxt/runtime/server/api/editor/assets/[id].post.js.map +0 -1
- package/dist/nuxt/runtime/server/api/editor/settings.get.d.ts +0 -5
- package/dist/nuxt/runtime/server/api/editor/settings.get.js +0 -8
- package/dist/nuxt/runtime/server/api/editor/settings.get.js.map +0 -1
- package/dist/nuxt/runtime/server/api/editor/settings.put.d.ts +0 -5
- package/dist/nuxt/runtime/server/api/editor/settings.put.js +0 -8
- package/dist/nuxt/runtime/server/api/editor/settings.put.js.map +0 -1
- package/dist/nuxt/runtime/server/api/editor/tags.get.d.ts +0 -5
- package/dist/nuxt/runtime/server/api/editor/tags.get.js +0 -8
- package/dist/nuxt/runtime/server/api/editor/tags.get.js.map +0 -1
- package/dist/nuxt/runtime/server/api/editor/themes/[id].delete.d.ts +0 -5
- package/dist/nuxt/runtime/server/api/editor/themes/[id].delete.js +0 -8
- package/dist/nuxt/runtime/server/api/editor/themes/[id].delete.js.map +0 -1
- package/dist/nuxt/runtime/server/api/editor/themes/[id].get.d.ts +0 -5
- package/dist/nuxt/runtime/server/api/editor/themes/[id].get.js +0 -8
- package/dist/nuxt/runtime/server/api/editor/themes/[id].get.js.map +0 -1
- package/dist/nuxt/runtime/server/api/editor/themes/index.get.d.ts +0 -5
- package/dist/nuxt/runtime/server/api/editor/themes/index.get.js +0 -8
- package/dist/nuxt/runtime/server/api/editor/themes/index.get.js.map +0 -1
- package/dist/nuxt/runtime/server/api/editor/themes/index.post.d.ts +0 -5
- package/dist/nuxt/runtime/server/api/editor/themes/index.post.js +0 -8
- package/dist/nuxt/runtime/server/api/editor/themes/index.post.js.map +0 -1
- package/dist/nuxt/runtime/server/api/editor/users.get.d.ts +0 -5
- package/dist/nuxt/runtime/server/api/editor/users.get.js +0 -8
- package/dist/nuxt/runtime/server/api/editor/users.get.js.map +0 -1
- package/dist/nuxt/runtime/server/plugins/collab.d.ts +0 -5
- package/dist/nuxt/runtime/server/plugins/collab.js +0 -10
- package/dist/nuxt/runtime/server/plugins/collab.js.map +0 -1
- package/dist/nuxt/runtime/server/routes/collab/[id].d.ts +0 -5
- package/dist/nuxt/runtime/server/routes/collab/[id].js +0 -35
- package/dist/nuxt/runtime/server/routes/collab/[id].js.map +0 -1
- package/dist/nuxt/runtime/server/utils/editor-route.d.ts +0 -11
- package/dist/nuxt/runtime/server/utils/editor-route.js.map +0 -1
- package/dist/presets/advanced.d.ts +0 -33
- package/dist/presets/advanced.js +0 -50
- package/dist/presets/advanced.js.map +0 -1
- package/dist/presets/simple.d.ts +0 -9
- package/dist/presets/simple.js +0 -12
- package/dist/presets/simple.js.map +0 -1
- package/dist/react/advanced-preset.d.ts +0 -11
- package/dist/react/advanced-preset.js +0 -31
- package/dist/react/advanced-preset.js.map +0 -1
- package/dist/vue/advanced-preset.d.ts +0 -13
- package/dist/vue/advanced-preset.js +0 -33
- package/dist/vue/advanced-preset.js.map +0 -1
- package/docs/extending.md +0 -538
- package/docs/integration.md +0 -632
- package/docs/llms.md +0 -383
- package/docs/usage.md +0 -1076
|
@@ -1,13 +1,12 @@
|
|
|
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 { useEditorContext } from "./context.js";
|
|
6
4
|
import { useEditorI18n } from "./use-editor-i18n.js";
|
|
7
5
|
import { cn } from "./ui/utils.js";
|
|
8
6
|
import { Icon } from "./Icon.js";
|
|
9
7
|
import { useStore } from "./use-store.js";
|
|
10
8
|
import { Button } from "./ui/button.js";
|
|
9
|
+
import { shortcutLabel } from "./key-labels.js";
|
|
11
10
|
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "./ui/tooltip.js";
|
|
12
11
|
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuTrigger } from "./ui/dropdown-menu.js";
|
|
13
12
|
import { Separator } from "./ui/separator.js";
|
|
@@ -15,7 +14,11 @@ import { useState } from "react";
|
|
|
15
14
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
16
15
|
import { useEditorState } from "@tiptap/react";
|
|
17
16
|
//#region src/react/EditorToolbar.tsx
|
|
18
|
-
const
|
|
17
|
+
const NO_EDITOR = {
|
|
18
|
+
visible: true,
|
|
19
|
+
enabled: false,
|
|
20
|
+
active: false
|
|
21
|
+
};
|
|
19
22
|
const built = /* @__PURE__ */ new WeakMap();
|
|
20
23
|
function groupsOf(ctx, preset) {
|
|
21
24
|
if (!preset) return [];
|
|
@@ -23,25 +26,17 @@ function groupsOf(ctx, preset) {
|
|
|
23
26
|
if (!byPreset) built.set(ctx, byPreset = /* @__PURE__ */ new WeakMap());
|
|
24
27
|
const cached = byPreset.get(preset);
|
|
25
28
|
if (cached) return cached;
|
|
26
|
-
const groups =
|
|
29
|
+
const groups = toolbarOf(preset, ctx);
|
|
27
30
|
byPreset.set(preset, groups);
|
|
28
31
|
return groups;
|
|
29
32
|
}
|
|
30
|
-
const isMac = typeof navigator !== "undefined" && /Mac|iPhone|iPad/.test(navigator.platform);
|
|
31
|
-
const KEY_LABELS = {
|
|
32
|
-
meta: isMac ? "⌘" : "Ctrl",
|
|
33
|
-
ctrl: "Ctrl",
|
|
34
|
-
alt: isMac ? "⌥" : "Alt",
|
|
35
|
-
shift: "⇧",
|
|
36
|
-
enter: "↵"
|
|
37
|
-
};
|
|
38
33
|
/**
|
|
39
34
|
* The toolbar of an editor, placed anywhere on the page. `editor` is the instance it works on (from the surface's
|
|
40
|
-
* `onReady`); the preset registered for that instance supplies the groups
|
|
41
|
-
*
|
|
42
|
-
* which its keyed surface remounts. Never reads a global active editor.
|
|
35
|
+
* `onReady`); the preset registered for that instance (`editorEntryOf`) supplies the groups. Without an editor (not
|
|
36
|
+
* mounted yet, or read-only by the host's choice) it renders no groups. A destroyed editor counts as none: a host still
|
|
37
|
+
* holds the old instance for the render in which its keyed surface remounts. Never reads a global active editor.
|
|
43
38
|
*/
|
|
44
|
-
function EditorToolbar({ editor: given
|
|
39
|
+
function EditorToolbar({ editor: given }) {
|
|
45
40
|
const editor = given?.isDestroyed ? void 0 : given;
|
|
46
41
|
const app = useEditorContext();
|
|
47
42
|
const { t } = useEditorI18n();
|
|
@@ -56,22 +51,19 @@ function EditorToolbar({ editor: given, preset }) {
|
|
|
56
51
|
};
|
|
57
52
|
});
|
|
58
53
|
state.ref.current = editor;
|
|
59
|
-
|
|
60
|
-
const abilities = useEditorState({
|
|
54
|
+
useEditorState({
|
|
61
55
|
editor: editor ?? null,
|
|
62
|
-
selector: ({ editor: current }) => current && !current.isDestroyed ?
|
|
56
|
+
selector: ({ editor: current }) => current && !current.isDestroyed ? current.state : null,
|
|
63
57
|
equalityFn: () => false
|
|
64
|
-
})
|
|
65
|
-
|
|
58
|
+
});
|
|
59
|
+
useStore(app.settings);
|
|
60
|
+
const groups = groupsOf(state.ctx, editorEntryOf(editor)?.preset).filter((group) => !editor || !group.visible || group.visible(editor)).map((group) => ({
|
|
66
61
|
group,
|
|
67
|
-
items: group.items.
|
|
62
|
+
items: group.items.map((item) => ({
|
|
63
|
+
item,
|
|
64
|
+
state: editor ? commandState(editor, item, "selection") : NO_EDITOR
|
|
65
|
+
})).filter(({ state: itemState }) => itemState.visible)
|
|
68
66
|
})).filter(({ items }) => items.length > 0);
|
|
69
|
-
const active = (item) => !!editor && !!item.active?.(editor);
|
|
70
|
-
const disabled = (item) => {
|
|
71
|
-
if (!editor) return true;
|
|
72
|
-
if (item.disabled?.(editor)) return true;
|
|
73
|
-
return !active(item) && !!item.ability && !abilities.has(item.ability);
|
|
74
|
-
};
|
|
75
67
|
return /* @__PURE__ */ jsx(TooltipProvider, { children: /* @__PURE__ */ jsx("div", {
|
|
76
68
|
className: "flex flex-wrap items-center gap-1.5",
|
|
77
69
|
role: "toolbar",
|
|
@@ -83,27 +75,27 @@ function EditorToolbar({ editor: given, preset }) {
|
|
|
83
75
|
className: "mx-2 h-6 data-[orientation=vertical]:h-6"
|
|
84
76
|
}), /* @__PURE__ */ jsx("div", {
|
|
85
77
|
className: "flex items-center gap-0.5",
|
|
86
|
-
children: items.map((item) =>
|
|
78
|
+
children: items.map(({ item, state }) => "component" in item ? /* @__PURE__ */ jsx(item.component, { editor }, item.id) : /* @__PURE__ */ jsx(ToolbarButton, {
|
|
87
79
|
item,
|
|
88
80
|
editor,
|
|
89
|
-
|
|
90
|
-
disabled: disabled(item)
|
|
81
|
+
state
|
|
91
82
|
}, item.id))
|
|
92
83
|
})]
|
|
93
84
|
}, group.id))
|
|
94
85
|
}) });
|
|
95
86
|
}
|
|
96
|
-
function ToolbarButton({ item, editor,
|
|
87
|
+
function ToolbarButton({ item, editor, state }) {
|
|
88
|
+
const { active, enabled } = state;
|
|
97
89
|
const button = /* @__PURE__ */ jsx(Button, {
|
|
98
90
|
variant: "ghost",
|
|
99
91
|
size: "icon-sm",
|
|
100
92
|
"aria-label": item.label,
|
|
101
93
|
"aria-pressed": item.active ? active : void 0,
|
|
102
94
|
"data-state": item.active ? active ? "on" : "off" : void 0,
|
|
103
|
-
disabled,
|
|
95
|
+
disabled: !enabled,
|
|
104
96
|
className: cn(active && "bg-primary/10 text-primary hover:bg-primary/15 hover:text-primary"),
|
|
105
97
|
onMouseDown: (event) => event.preventDefault(),
|
|
106
|
-
onClick:
|
|
98
|
+
onClick: "run" in item && editor ? () => item.run(editor) : void 0,
|
|
107
99
|
children: /* @__PURE__ */ jsx(Icon, { name: item.icon })
|
|
108
100
|
});
|
|
109
101
|
const tooltip = (trigger) => /* @__PURE__ */ jsxs(Tooltip, { children: [/* @__PURE__ */ jsx(TooltipTrigger, {
|
|
@@ -112,9 +104,9 @@ function ToolbarButton({ item, editor, active, disabled }) {
|
|
|
112
104
|
}), /* @__PURE__ */ jsxs(TooltipContent, { children: [item.label, item.kbds && item.kbds.length > 0 && /* @__PURE__ */ jsx("kbd", {
|
|
113
105
|
"data-slot": "kbd",
|
|
114
106
|
className: "rounded-sm bg-background/20 px-1 font-sans",
|
|
115
|
-
children: item.kbds
|
|
107
|
+
children: shortcutLabel(item.kbds)
|
|
116
108
|
})] })] });
|
|
117
|
-
if (!item
|
|
109
|
+
if (!("menu" in item)) return tooltip(button);
|
|
118
110
|
return /* @__PURE__ */ jsxs(DropdownMenu, { children: [tooltip(/* @__PURE__ */ jsx(DropdownMenuTrigger, {
|
|
119
111
|
asChild: true,
|
|
120
112
|
children: button
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EditorToolbar.js","names":[],"sources":["../../src/react/EditorToolbar.tsx"],"sourcesContent":["import type { Editor } from '@tiptap/core'\nimport { useEditorState } from '@tiptap/react'\nimport { type ComponentType, type ReactNode, useState } from 'react'\nimport { abilitiesAtSelection } from '../core/abilities'\nimport { contributions } from '../core/define-editor'\nimport { borrowedFeatureContext, editorEntryOf } from '../core/editor-ui'\nimport type { FeatureContext } from '../core/feature'\nimport type { Ability } from '../core/schema/abilities'\nimport { mergeToolbarGroups, type MenuItem, type ToolbarGroup, type ToolbarItem } from '../core/toolbar'\nimport { useEditorContext } from './context'\nimport type { ReactPreset } from './EditorSurface'\nimport { Icon } from './Icon'\nimport { Button } from './ui/button'\nimport {\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuLabel,\n DropdownMenuSeparator,\n DropdownMenuTrigger,\n} from './ui/dropdown-menu'\nimport { Separator } from './ui/separator'\nimport { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from './ui/tooltip'\nimport { useEditorI18n } from './use-editor-i18n'\nimport { useStore } from './use-store'\nimport { cn } from './ui/utils'\n\ntype ItemComponent = ComponentType<{ editor: Editor }>\ntype Item = ToolbarItem<ItemComponent>\ntype Group = ToolbarGroup<ItemComponent>\n\nconst NO_ABILITIES: ReadonlySet<Ability> = new Set()\n\n// Factories are plain functions here (React features must not call hooks in them): built once per preset, app-wide,\n// keyed by the toolbar's `ctx` so each toolbar's items delegate to its own editor.\nconst built = new WeakMap<FeatureContext, WeakMap<ReactPreset, Group[]>>()\nfunction groupsOf(ctx: FeatureContext, preset: ReactPreset | undefined): Group[] {\n if (!preset) return []\n let byPreset = built.get(ctx)\n if (!byPreset) built.set(ctx, byPreset = new WeakMap())\n const cached = byPreset.get(preset)\n if (cached) return cached\n const groups = mergeToolbarGroups(contributions(preset, 'toolbar').flatMap(factory => factory(ctx)))\n byPreset.set(preset, groups)\n return groups\n}\n\nconst isMac = typeof navigator !== 'undefined' && /Mac|iPhone|iPad/.test(navigator.platform)\nconst KEY_LABELS: Record<string, string> = {\n meta: isMac ? '⌘' : 'Ctrl',\n ctrl: 'Ctrl',\n // i18n-ignore: keyboard key name, shown as on the keycap\n alt: isMac ? '⌥' : 'Alt',\n shift: '⇧',\n enter: '↵',\n}\n\n/**\n * The toolbar of an editor, placed anywhere on the page. `editor` is the instance it works on (from the surface's\n * `onReady`); the preset registered for that instance supplies the groups, `preset` renders them (disabled) while\n * there is no editor yet. A destroyed editor counts as none: a host still holds the old instance for the render in\n * which its keyed surface remounts. Never reads a global active editor.\n */\nexport function EditorToolbar({ editor: given, preset }: { editor?: Editor, preset?: ReactPreset }) {\n const editor = given?.isDestroyed ? undefined : given\n const app = useEditorContext()\n const { t } = useEditorI18n()\n\n // The context toolbar factories see: settings and fetch of the app, everything per-surface delegates to the editor's\n // registered context while there is one. Built once; `ref` keeps it pointing at the current editor.\n const [state] = useState(() => {\n const ref: { current: Editor | undefined } = { current: editor }\n return { ref, ctx: borrowedFeatureContext({ app, getEditor: () => ref.current }) }\n })\n state.ref.current = editor\n\n // `active`/`visible`/`menu` may read the settings: re-render when they change.\n useStore(app.settings)\n // `active`, `can()` and the abilities read the editor state: re-render on every transaction.\n const abilities = useEditorState({\n editor: editor ?? null,\n selector: ({ editor: current }) => current && !current.isDestroyed ? abilitiesAtSelection(current) : NO_ABILITIES,\n equalityFn: () => false,\n }) ?? NO_ABILITIES\n\n const groups = groupsOf(state.ctx, (editorEntryOf(editor)?.preset as ReactPreset | undefined) ?? preset)\n .filter(group => !editor || !group.visible || group.visible(editor))\n .map(group => ({ group, items: group.items.filter(item => !editor || !item.visible || item.visible(editor)) }))\n .filter(({ items }) => items.length > 0)\n\n const active = (item: Item) => !!editor && !!item.active?.(editor)\n const disabled = (item: Item) => {\n if (!editor) return true\n if (item.disabled?.(editor)) return true\n return !active(item) && !!item.ability && !abilities.has(item.ability)\n }\n\n return (\n <TooltipProvider>\n <div className=\"flex flex-wrap items-center gap-1.5\" role=\"toolbar\" aria-label={t('toolbar.label')}>\n {groups.map(({ group, items }, index) => (\n <div key={group.id} className=\"contents\">\n {index > 0 && <Separator orientation=\"vertical\" className=\"mx-2 h-6 data-[orientation=vertical]:h-6\" />}\n <div className=\"flex items-center gap-0.5\">\n {items.map(item => item.component\n ? <item.component key={item.id} editor={editor!} />\n : <ToolbarButton\n key={item.id}\n item={item}\n editor={editor}\n active={active(item)}\n disabled={disabled(item)}\n />)}\n </div>\n </div>\n ))}\n </div>\n </TooltipProvider>\n )\n}\n\nfunction ToolbarButton({ item, editor, active, disabled }: { item: Item, editor: Editor | undefined, active: boolean, disabled: boolean }) {\n const button = (\n <Button\n variant=\"ghost\"\n size=\"icon-sm\"\n aria-label={item.label}\n aria-pressed={item.active ? active : undefined}\n data-state={item.active ? (active ? 'on' : 'off') : undefined}\n disabled={disabled}\n className={cn(active && 'bg-primary/10 text-primary hover:bg-primary/15 hover:text-primary')}\n onMouseDown={event => event.preventDefault()}\n onClick={item.run && editor ? () => item.run!(editor) : undefined}\n >\n <Icon name={item.icon} />\n </Button>\n )\n const tooltip = (trigger: ReactNode) => (\n <Tooltip>\n <TooltipTrigger asChild>{trigger}</TooltipTrigger>\n <TooltipContent>\n {item.label}\n {item.kbds && item.kbds.length > 0 && (\n <kbd data-slot=\"kbd\" className=\"rounded-sm bg-background/20 px-1 font-sans\">{item.kbds.map(key => KEY_LABELS[key] ?? key.toUpperCase()).join('+')}</kbd>\n )}\n </TooltipContent>\n </Tooltip>\n )\n if (!item.menu) return tooltip(button)\n return (\n <DropdownMenu>\n {tooltip(<DropdownMenuTrigger asChild>{button}</DropdownMenuTrigger>)}\n <DropdownMenuContent align=\"start\">\n {editor && item.menu(editor).map((entry, index) => <MenuRow key={index} entry={entry} />)}\n </DropdownMenuContent>\n </DropdownMenu>\n )\n}\n\nfunction MenuRow({ entry }: { entry: MenuItem }) {\n if (entry.type === 'label') return <DropdownMenuLabel>{entry.label}</DropdownMenuLabel>\n if (entry.type === 'separator') return <DropdownMenuSeparator />\n return (\n <DropdownMenuItem disabled={entry.disabled} onSelect={() => entry.onSelect?.()}>\n {entry.icon && <Icon name={entry.icon} />}\n <span>{entry.label}</span>\n {entry.description && <span className=\"ml-auto text-xs text-muted-foreground\">{entry.description}</span>}\n </DropdownMenuItem>\n )\n}\n"],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"EditorToolbar.js","names":[],"sources":["../../src/react/EditorToolbar.tsx"],"sourcesContent":["import type { Editor } from '@tiptap/core'\nimport { useEditorState } from '@tiptap/react'\nimport { type ComponentType, type ReactNode, useState } from 'react'\nimport { type CommandDef, type CommandState, commandState, type MenuItem, type PlacedToolbarGroup, toolbarOf } from '../core/commands'\nimport { borrowedFeatureContext, editorEntryOf } from '../core/editor-ui'\nimport type { FeatureContext } from '../core/feature'\nimport { useEditorContext } from './context'\nimport type { ReactPreset } from './EditorSurface'\nimport { Icon } from './Icon'\nimport { Button } from './ui/button'\nimport {\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuLabel,\n DropdownMenuSeparator,\n DropdownMenuTrigger,\n} from './ui/dropdown-menu'\nimport { Separator } from './ui/separator'\nimport { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from './ui/tooltip'\nimport { shortcutLabel } from './key-labels'\nimport { useEditorI18n } from './use-editor-i18n'\nimport { useStore } from './use-store'\nimport { cn } from './ui/utils'\n\ntype ItemComponent = ComponentType<{ editor: Editor }>\ntype Item = CommandDef<ItemComponent>\ntype Group = PlacedToolbarGroup<ItemComponent>\n\nconst NO_EDITOR: CommandState = { visible: true, enabled: false, active: false }\n\n// Factories are plain functions here (React features must not call hooks in them): built once per preset, app-wide,\n// keyed by the toolbar's `ctx` so each toolbar's items delegate to its own editor.\nconst built = new WeakMap<FeatureContext, WeakMap<ReactPreset, Group[]>>()\nfunction groupsOf(ctx: FeatureContext, preset: ReactPreset | undefined): Group[] {\n if (!preset) return []\n let byPreset = built.get(ctx)\n if (!byPreset) built.set(ctx, byPreset = new WeakMap())\n const cached = byPreset.get(preset)\n if (cached) return cached\n const groups = toolbarOf(preset, ctx)\n byPreset.set(preset, groups)\n return groups\n}\n\n/**\n * The toolbar of an editor, placed anywhere on the page. `editor` is the instance it works on (from the surface's\n * `onReady`); the preset registered for that instance (`editorEntryOf`) supplies the groups. Without an editor (not\n * mounted yet, or read-only by the host's choice) it renders no groups. A destroyed editor counts as none: a host still\n * holds the old instance for the render in which its keyed surface remounts. Never reads a global active editor.\n */\nexport function EditorToolbar({ editor: given }: { editor?: Editor }) {\n const editor = given?.isDestroyed ? undefined : given\n const app = useEditorContext()\n const { t } = useEditorI18n()\n\n // The context toolbar factories see: settings and fetch of the app, everything per-surface delegates to the editor's\n // registered context while there is one. Built once; `ref` keeps it pointing at the current editor.\n const [state] = useState(() => {\n const ref: { current: Editor | undefined } = { current: editor }\n return { ref, ctx: borrowedFeatureContext({ app, getEditor: () => ref.current }) }\n })\n state.ref.current = editor\n\n // `active`, `can()` and the abilities read the editor state: re-render on every transaction.\n useEditorState({\n editor: editor ?? null,\n selector: ({ editor: current }) => current && !current.isDestroyed ? current.state : null,\n equalityFn: () => false,\n })\n // `active`/`visible`/`menu` may read the settings: re-render when they change.\n useStore(app.settings)\n\n // Every enabled/visible/active state comes from `commandState`.\n const groups = groupsOf(state.ctx, editorEntryOf(editor)?.preset as ReactPreset | undefined)\n .filter(group => !editor || !group.visible || group.visible(editor))\n .map(group => ({\n group,\n items: group.items\n .map(item => ({ item, state: editor ? commandState(editor, item, 'selection') : NO_EDITOR }))\n .filter(({ state: itemState }) => itemState.visible),\n }))\n .filter(({ items }) => items.length > 0)\n\n return (\n <TooltipProvider>\n <div className=\"flex flex-wrap items-center gap-1.5\" role=\"toolbar\" aria-label={t('toolbar.label')}>\n {groups.map(({ group, items }, index) => (\n <div key={group.id} className=\"contents\">\n {index > 0 && <Separator orientation=\"vertical\" className=\"mx-2 h-6 data-[orientation=vertical]:h-6\" />}\n <div className=\"flex items-center gap-0.5\">\n {items.map(({ item, state }) => 'component' in item\n ? <item.component key={item.id} editor={editor!} />\n : <ToolbarButton\n key={item.id}\n item={item}\n editor={editor}\n state={state}\n />)}\n </div>\n </div>\n ))}\n </div>\n </TooltipProvider>\n )\n}\n\nfunction ToolbarButton({ item, editor, state }: { item: Item, editor: Editor | undefined, state: CommandState }) {\n const { active, enabled } = state\n const button = (\n <Button\n variant=\"ghost\"\n size=\"icon-sm\"\n aria-label={item.label}\n aria-pressed={item.active ? active : undefined}\n data-state={item.active ? (active ? 'on' : 'off') : undefined}\n disabled={!enabled}\n className={cn(active && 'bg-primary/10 text-primary hover:bg-primary/15 hover:text-primary')}\n onMouseDown={event => event.preventDefault()}\n onClick={'run' in item && editor ? () => item.run(editor) : undefined}\n >\n <Icon name={item.icon} />\n </Button>\n )\n const tooltip = (trigger: ReactNode) => (\n <Tooltip>\n <TooltipTrigger asChild>{trigger}</TooltipTrigger>\n <TooltipContent>\n {item.label}\n {item.kbds && item.kbds.length > 0 && (\n <kbd data-slot=\"kbd\" className=\"rounded-sm bg-background/20 px-1 font-sans\">{shortcutLabel(item.kbds)}</kbd>\n )}\n </TooltipContent>\n </Tooltip>\n )\n if (!('menu' in item)) return tooltip(button)\n return (\n <DropdownMenu>\n {tooltip(<DropdownMenuTrigger asChild>{button}</DropdownMenuTrigger>)}\n <DropdownMenuContent align=\"start\">\n {editor && item.menu(editor).map((entry, index) => <MenuRow key={index} entry={entry} />)}\n </DropdownMenuContent>\n </DropdownMenu>\n )\n}\n\nfunction MenuRow({ entry }: { entry: MenuItem }) {\n if (entry.type === 'label') return <DropdownMenuLabel>{entry.label}</DropdownMenuLabel>\n if (entry.type === 'separator') return <DropdownMenuSeparator />\n return (\n <DropdownMenuItem disabled={entry.disabled} onSelect={() => entry.onSelect?.()}>\n {entry.icon && <Icon name={entry.icon} />}\n <span>{entry.label}</span>\n {entry.description && <span className=\"ml-auto text-xs text-muted-foreground\">{entry.description}</span>}\n </DropdownMenuItem>\n )\n}\n"],"mappings":"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"}
|
|
@@ -1,27 +1,26 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { EditorMetadata, MetadataItem } from "../core/metadata-types.js";
|
|
3
|
-
import { AnyExtension, Editor, JSONContent } from "@tiptap/core";
|
|
1
|
+
import { EditorSurfaceHandle, EditorSurfaceProps, ReactFeature, ReactPreset } from "./EditorSurface.js";
|
|
4
2
|
//#region src/react/SimpleEditor.d.ts
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
/** Builds the `/` menu from the defaults (none in the simple editor); absent = no `/` menu. Read once at mount. */
|
|
17
|
-
slashCommands?: (defaults: SlashCommandItem[]) => SlashCommandItem[];
|
|
18
|
-
onReady?: (editor: Editor) => void;
|
|
19
|
-
onMetadataCreate?: (list: string, item: MetadataItem) => void;
|
|
20
|
-
onContentError?: (error: Error) => void;
|
|
3
|
+
/**
|
|
4
|
+
* Props of the simple editor: those of the surface except the preset (`value`/`onChange`, `editable`, `metadata`,
|
|
5
|
+
* `abilities`, `extensions`, `commands`, `onReady`, ...) plus `add`.
|
|
6
|
+
*/
|
|
7
|
+
export interface SimpleEditorProps extends Omit<EditorSurfaceProps, 'preset'> {
|
|
8
|
+
/**
|
|
9
|
+
* Host features appended after `core-content` and `core-ui` (an own block, or the AI feature from `/ai/react` for the
|
|
10
|
+
* AI sidebar); read once at mount. Only what the host imports is in the bundle: for the composition dimensions
|
|
11
|
+
* (`content`, `interaction`, `ai`, `remove`, `backend`) use `AdvancedEditor`.
|
|
12
|
+
*/
|
|
13
|
+
add?: readonly ReactFeature[];
|
|
21
14
|
}
|
|
22
|
-
/** The
|
|
23
|
-
export
|
|
24
|
-
|
|
25
|
-
}
|
|
15
|
+
/** The handle of the simple editor: the surface's (`editor`, `openSettings`) plus the preset it mounts. */
|
|
16
|
+
export interface SimpleEditorHandle extends EditorSurfaceHandle {
|
|
17
|
+
readonly preset: ReactPreset;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* The simple editor: `core-content` + `core-ui` (formatting, headings, lists, quotes, code, undo/redo; no backend, no
|
|
21
|
+
* AI) plus the features in `add`. It builds the preset directly (not through `composeEditor`, whose UI bindings import
|
|
22
|
+
* every catalog feature), so its bundle holds nothing else. Remount (`key`) to change `add`.
|
|
23
|
+
*/
|
|
24
|
+
export declare const SimpleEditor: import("react").ForwardRefExoticComponent<SimpleEditorProps & import("react").RefAttributes<SimpleEditorHandle>>;
|
|
26
25
|
//#endregion
|
|
27
26
|
//# sourceMappingURL=SimpleEditor.d.ts.map
|
|
@@ -1,15 +1,29 @@
|
|
|
1
|
+
import { defineEditor } from "../core/define-editor.js";
|
|
2
|
+
import { coreContentFeature, coreUiFeature } from "../core/core-feature.js";
|
|
1
3
|
import { EditorSurface } from "./EditorSurface.js";
|
|
2
|
-
import {
|
|
4
|
+
import { EditorCommandPalette } from "./EditorCommandPalette.js";
|
|
3
5
|
import { forwardRef, useImperativeHandle, useRef, useState } from "react";
|
|
4
6
|
import { jsx } from "react/jsx-runtime";
|
|
5
7
|
//#region src/react/SimpleEditor.tsx
|
|
6
|
-
/**
|
|
7
|
-
|
|
8
|
-
|
|
8
|
+
/**
|
|
9
|
+
* The simple editor: `core-content` + `core-ui` (formatting, headings, lists, quotes, code, undo/redo; no backend, no
|
|
10
|
+
* AI) plus the features in `add`. It builds the preset directly (not through `composeEditor`, whose UI bindings import
|
|
11
|
+
* every catalog feature), so its bundle holds nothing else. Remount (`key`) to change `add`.
|
|
12
|
+
*/
|
|
13
|
+
const SimpleEditor = forwardRef(function SimpleEditor({ add, ...props }, ref) {
|
|
14
|
+
const [preset] = useState(() => defineEditor({ features: [
|
|
15
|
+
coreContentFeature(),
|
|
16
|
+
coreUiFeature({ palette: EditorCommandPalette }),
|
|
17
|
+
...add ?? []
|
|
18
|
+
] }));
|
|
9
19
|
const surface = useRef(null);
|
|
10
|
-
useImperativeHandle(ref, () => ({
|
|
11
|
-
|
|
12
|
-
|
|
20
|
+
useImperativeHandle(ref, () => ({
|
|
21
|
+
get editor() {
|
|
22
|
+
return surface.current?.editor ?? null;
|
|
23
|
+
},
|
|
24
|
+
openSettings: (tab) => surface.current?.openSettings(tab),
|
|
25
|
+
preset
|
|
26
|
+
}), [preset]);
|
|
13
27
|
return /* @__PURE__ */ jsx(EditorSurface, {
|
|
14
28
|
ref: surface,
|
|
15
29
|
preset,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SimpleEditor.js","names":[],"sources":["../../src/react/SimpleEditor.tsx"],"sourcesContent":["import type {
|
|
1
|
+
{"version":3,"file":"SimpleEditor.js","names":[],"sources":["../../src/react/SimpleEditor.tsx"],"sourcesContent":["import type { Editor } from '@tiptap/core'\nimport type { ComponentType } from 'react'\nimport { forwardRef, useImperativeHandle, useRef, useState } from 'react'\nimport { coreContentFeature, coreUiFeature } from '../core/core-feature'\nimport { defineEditor } from '../core/define-editor'\nimport { EditorCommandPalette } from './EditorCommandPalette'\nimport { EditorSurface, type EditorSurfaceHandle, type EditorSurfaceProps, type ReactFeature, type ReactPreset } from './EditorSurface'\n\n/**\n * Props of the simple editor: those of the surface except the preset (`value`/`onChange`, `editable`, `metadata`,\n * `abilities`, `extensions`, `commands`, `onReady`, ...) plus `add`.\n */\nexport interface SimpleEditorProps extends Omit<EditorSurfaceProps, 'preset'> {\n /**\n * Host features appended after `core-content` and `core-ui` (an own block, or the AI feature from `/ai/react` for the\n * AI sidebar); read once at mount. Only what the host imports is in the bundle: for the composition dimensions\n * (`content`, `interaction`, `ai`, `remove`, `backend`) use `AdvancedEditor`.\n */\n add?: readonly ReactFeature[]\n}\n\n/** The handle of the simple editor: the surface's (`editor`, `openSettings`) plus the preset it mounts. */\nexport interface SimpleEditorHandle extends EditorSurfaceHandle {\n readonly preset: ReactPreset\n}\n\n/**\n * The simple editor: `core-content` + `core-ui` (formatting, headings, lists, quotes, code, undo/redo; no backend, no\n * AI) plus the features in `add`. It builds the preset directly (not through `composeEditor`, whose UI bindings import\n * every catalog feature), so its bundle holds nothing else. Remount (`key`) to change `add`.\n */\nexport const SimpleEditor = forwardRef<SimpleEditorHandle, SimpleEditorProps>(function SimpleEditor({ add, ...props }, ref) {\n const [preset] = useState(() => defineEditor({ features: [coreContentFeature(), coreUiFeature<ComponentType<{ editor: Editor }>>({ palette: EditorCommandPalette }), ...(add ?? [])] }))\n const surface = useRef<EditorSurfaceHandle>(null)\n useImperativeHandle(ref, () => ({\n get editor() { return surface.current?.editor ?? null },\n openSettings: tab => surface.current?.openSettings(tab),\n preset,\n }), [preset])\n return <EditorSurface ref={surface} preset={preset} {...props} />\n})\n"],"mappings":";;;;;;;;;;;;AA+BA,MAAa,eAAe,WAAkD,SAAS,aAAa,EAAE,KAAK,GAAG,SAAS,KAAK;CAC1H,MAAM,CAAC,UAAU,eAAe,aAAa,EAAE,UAAU;EAAC,mBAAmB;EAAG,cAAiD,EAAE,SAAS,qBAAqB,CAAC;EAAG,GAAI,OAAO,CAAC;CAAE,EAAE,CAAC,CAAC;CACvL,MAAM,UAAU,OAA4B,IAAI;CAChD,oBAAoB,YAAY;EAC9B,IAAI,SAAS;GAAE,OAAO,QAAQ,SAAS,UAAU;EAAK;EACtD,eAAc,QAAO,QAAQ,SAAS,aAAa,GAAG;EACtD;CACF,IAAI,CAAC,MAAM,CAAC;CACZ,OAAO,oBAAC,eAAD;EAAe,KAAK;EAAiB;EAAQ,GAAI;CAAQ,CAAA;AAClE,CAAC"}
|
package/dist/react/advanced.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ComposeOptions, ComposedEditor, ContentLevel, FeatureId, InteractionLevel, UiBindings } from "../presets/compose.js";
|
|
2
|
+
import { ComposedEditorHandle } from "./composed-surface.js";
|
|
2
3
|
import { AdvancedEditor, AdvancedEditorProps } from "./AdvancedEditor.js";
|
|
3
|
-
import { advancedEditor } from "./
|
|
4
|
-
export { AdvancedEditor, type
|
|
4
|
+
import { advancedEditor, composeEditor } from "./compose.js";
|
|
5
|
+
export { AdvancedEditor, type ComposedEditorHandle as AdvancedEditorHandle, type AdvancedEditorProps, type ComposeOptions, type ComposedEditor, type ContentLevel, type FeatureId, type InteractionLevel, type UiBindings, advancedEditor, composeEditor };
|
package/dist/react/advanced.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { advancedEditor } from "./
|
|
1
|
+
import { advancedEditor, composeEditor } from "./compose.js";
|
|
2
2
|
import { AdvancedEditor } from "./AdvancedEditor.js";
|
|
3
|
-
export { AdvancedEditor, advancedEditor };
|
|
3
|
+
export { AdvancedEditor, advancedEditor, composeEditor };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ComposeOptions, ComposedEditor } from "../presets/compose.js";
|
|
2
|
+
import { Editor } from "@tiptap/core";
|
|
3
|
+
import { ComponentType } from "react";
|
|
4
|
+
//#region src/react/compose.d.ts
|
|
5
|
+
type ReactComponent = ComponentType<{
|
|
6
|
+
editor: Editor;
|
|
7
|
+
}>;
|
|
8
|
+
/**
|
|
9
|
+
* `composeEditor` of `presets/compose` over the React bindings: the editor of the three dimensions (`content`,
|
|
10
|
+
* `interaction`, `ai`), pruned by the capabilities of `options.backend`.
|
|
11
|
+
*/
|
|
12
|
+
export declare const composeEditor: (options: ComposeOptions<ReactComponent>) => ComposedEditor<ReactComponent>;
|
|
13
|
+
/**
|
|
14
|
+
* The advanced editor on the React surface: `{ content: 'rich', interaction: 'full', ai: true }`, every dimension option
|
|
15
|
+
* overridable (`compositeKinds`, `backend`, `add`, `remove`, ...), so the schema is the one of `advancedSchemaExtensions()`.
|
|
16
|
+
*/
|
|
17
|
+
export declare const advancedEditor: (options?: Partial<ComposeOptions<ReactComponent>>) => ComposedEditor<ReactComponent>;
|
|
18
|
+
//#endregion
|
|
19
|
+
export {};
|
|
20
|
+
//# sourceMappingURL=compose.d.ts.map
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { coreUiFeature } from "../core/core-feature.js";
|
|
2
|
+
import { composeEditor as composeEditor$1 } from "../presets/compose.js";
|
|
3
|
+
import { EditorCommandPalette } from "./EditorCommandPalette.js";
|
|
4
|
+
import { aiFeature } from "../features/ai/react.js";
|
|
5
|
+
import { authorsFeature } from "../features/authors/react.js";
|
|
6
|
+
import { blockUiFeature } from "../features/block-ui/react.js";
|
|
7
|
+
import { collabFeature } from "../features/collab/react.js";
|
|
8
|
+
import { commentsFeature } from "../features/comments/react.js";
|
|
9
|
+
import { compositeFeature } from "../features/composites/react.js";
|
|
10
|
+
import { mediaFeature } from "../features/media/react.js";
|
|
11
|
+
import { themesFeature } from "../features/themes/react.js";
|
|
12
|
+
import { transcriptFeature } from "../features/transcript/react.js";
|
|
13
|
+
import { compositeAiFeature } from "../integrations/composite-ai/index.js";
|
|
14
|
+
import { transcriptAiFeature } from "../integrations/transcript-ai/index.js";
|
|
15
|
+
//#region src/react/compose.ts
|
|
16
|
+
/** The React bindings of every UI-bound catalog feature. */
|
|
17
|
+
const REACT_BINDINGS = {
|
|
18
|
+
"core-ui": () => coreUiFeature({ palette: EditorCommandPalette }),
|
|
19
|
+
"media": mediaFeature,
|
|
20
|
+
"transcript": transcriptFeature,
|
|
21
|
+
"composites": compositeFeature,
|
|
22
|
+
"authors": authorsFeature,
|
|
23
|
+
"comments": commentsFeature,
|
|
24
|
+
"ai": aiFeature,
|
|
25
|
+
"composite-ai": compositeAiFeature,
|
|
26
|
+
"transcript-ai": transcriptAiFeature,
|
|
27
|
+
"collab": collabFeature,
|
|
28
|
+
"block-ui": blockUiFeature,
|
|
29
|
+
"themes": themesFeature
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* `composeEditor` of `presets/compose` over the React bindings: the editor of the three dimensions (`content`,
|
|
33
|
+
* `interaction`, `ai`), pruned by the capabilities of `options.backend`.
|
|
34
|
+
*/
|
|
35
|
+
const composeEditor = (options) => composeEditor$1(REACT_BINDINGS, options);
|
|
36
|
+
/**
|
|
37
|
+
* The advanced editor on the React surface: `{ content: 'rich', interaction: 'full', ai: true }`, every dimension option
|
|
38
|
+
* overridable (`compositeKinds`, `backend`, `add`, `remove`, ...), so the schema is the one of `advancedSchemaExtensions()`.
|
|
39
|
+
*/
|
|
40
|
+
const advancedEditor = (options = {}) => composeEditor({
|
|
41
|
+
content: "rich",
|
|
42
|
+
interaction: "full",
|
|
43
|
+
ai: true,
|
|
44
|
+
...options
|
|
45
|
+
});
|
|
46
|
+
//#endregion
|
|
47
|
+
export { advancedEditor, composeEditor };
|
|
48
|
+
|
|
49
|
+
//# sourceMappingURL=compose.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compose.js","names":["compose"],"sources":["../../src/react/compose.ts"],"sourcesContent":["import type { Editor } from '@tiptap/core'\nimport type { ComponentType } from 'react'\nimport { coreUiFeature } from '../core/core-feature'\nimport { EditorCommandPalette } from './EditorCommandPalette'\nimport { aiFeature } from '../features/ai/react'\nimport { authorsFeature } from '../features/authors/react'\nimport { blockUiFeature } from '../features/block-ui/react'\nimport { collabFeature } from '../features/collab/react'\nimport { commentsFeature } from '../features/comments/react'\nimport { compositeFeature } from '../features/composites/react'\nimport { mediaFeature } from '../features/media/react'\nimport { themesFeature } from '../features/themes/react'\nimport { transcriptFeature } from '../features/transcript/react'\nimport { compositeAiFeature } from '../integrations/composite-ai'\nimport { transcriptAiFeature } from '../integrations/transcript-ai'\nimport { type ComposedEditor, type ComposeOptions, composeEditor as compose, type UiBindings } from '../presets/compose'\n\ntype ReactComponent = ComponentType<{ editor: Editor }>\n\n/** The React bindings of every UI-bound catalog feature. */\nconst REACT_BINDINGS = {\n 'core-ui': () => coreUiFeature<ReactComponent>({ palette: EditorCommandPalette }),\n 'media': mediaFeature,\n 'transcript': transcriptFeature,\n 'composites': compositeFeature,\n 'authors': authorsFeature,\n 'comments': commentsFeature,\n 'ai': aiFeature,\n 'composite-ai': compositeAiFeature,\n 'transcript-ai': transcriptAiFeature,\n 'collab': collabFeature,\n 'block-ui': blockUiFeature,\n 'themes': themesFeature,\n} satisfies UiBindings<ReactComponent>\n\n/**\n * `composeEditor` of `presets/compose` over the React bindings: the editor of the three dimensions (`content`,\n * `interaction`, `ai`), pruned by the capabilities of `options.backend`.\n */\nexport const composeEditor = (options: ComposeOptions<ReactComponent>): ComposedEditor<ReactComponent> => compose(REACT_BINDINGS, options)\n\n/**\n * The advanced editor on the React surface: `{ content: 'rich', interaction: 'full', ai: true }`, every dimension option\n * overridable (`compositeKinds`, `backend`, `add`, `remove`, ...), so the schema is the one of `advancedSchemaExtensions()`.\n */\nexport const advancedEditor = (options: Partial<ComposeOptions<ReactComponent>> = {}): ComposedEditor<ReactComponent> => composeEditor({ content: 'rich', interaction: 'full', ai: true, ...options })\n"],"mappings":";;;;;;;;;;;;;;;;AAoBA,MAAM,iBAAiB;CACrB,iBAAiB,cAA8B,EAAE,SAAS,qBAAqB,CAAC;CAChF,SAAS;CACT,cAAc;CACd,cAAc;CACd,WAAW;CACX,YAAY;CACZ,MAAM;CACN,gBAAgB;CAChB,iBAAiB;CACjB,UAAU;CACV,YAAY;CACZ,UAAU;AACZ;;;;;AAMA,MAAa,iBAAiB,YAA4EA,gBAAQ,gBAAgB,OAAO;;;;;AAMzI,MAAa,kBAAkB,UAAmD,CAAC,MAAsC,cAAc;CAAE,SAAS;CAAQ,aAAa;CAAQ,IAAI;CAAM,GAAG;AAAQ,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { EditorBackend } from "../core/backend.js";
|
|
2
|
+
import { EditorSurfaceHandle, EditorSurfaceProps, ReactFeature } from "./EditorSurface.js";
|
|
3
|
+
import { CompositeKind } from "../features/composites/kinds.js";
|
|
4
|
+
import { ComposedEditor, ContentLevel, FeatureId, InteractionLevel } from "../presets/compose.js";
|
|
5
|
+
import { Editor } from "@tiptap/core";
|
|
6
|
+
import { ComponentType } from "react";
|
|
7
|
+
//#region src/react/composed-surface.d.ts
|
|
8
|
+
/** The preset a composed editor mounts: the three dimensions' features, with `omitted` listing what the backend or `remove` dropped. */
|
|
9
|
+
export type ReactComposedPreset = ComposedEditor<ComponentType<{
|
|
10
|
+
editor: Editor;
|
|
11
|
+
}>>;
|
|
12
|
+
/** The handle of a composed editor: the surface's (`editor`, `openSettings`) plus the preset it composed. */
|
|
13
|
+
export interface ComposedEditorHandle extends EditorSurfaceHandle {
|
|
14
|
+
readonly preset: ReactComposedPreset;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* The surface's own props (collaboration session or standalone `value`/`onChange`, metadata, abilities, extensions,
|
|
18
|
+
* block actions, commands, `documentId`, `editable`, `settingsUi`, the open state of the sidebar and comments margin,
|
|
19
|
+
* `onReady` and the other callbacks) except the preset, plus the composition. Every composition prop is read once at
|
|
20
|
+
* mount; hosts remount (`key`) to change one.
|
|
21
|
+
*/
|
|
22
|
+
export interface ComposedEditorProps extends Omit<EditorSurfaceProps, 'preset'> {
|
|
23
|
+
/** Document model: a level or the content feature ids to install. */
|
|
24
|
+
content?: ContentLevel | readonly FeatureId[];
|
|
25
|
+
/** Editing UX: a level or the interaction feature ids; `[]` = no interaction (a viewer). */
|
|
26
|
+
interaction?: InteractionLevel | readonly FeatureId[];
|
|
27
|
+
/** Installs the AI feature and the integrations whose content is present. */
|
|
28
|
+
ai?: boolean;
|
|
29
|
+
/** Host features, appended after the catalog. */
|
|
30
|
+
add?: readonly ReactFeature[];
|
|
31
|
+
/** Features (catalog or host) left out, with the features that require them. */
|
|
32
|
+
remove?: readonly FeatureId[];
|
|
33
|
+
/** The backend the composition is pruned by (default: the editor context's backend). */
|
|
34
|
+
backend?: EditorBackend;
|
|
35
|
+
/** Composite kinds („Bausteine“) when `content` includes composites (default: `defaultCompositeKinds(t)`). */
|
|
36
|
+
compositeKinds?: readonly CompositeKind[];
|
|
37
|
+
}
|
|
38
|
+
//#endregion
|
|
39
|
+
//# sourceMappingURL=composed-surface.d.ts.map
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { useEditorContext } from "./context.js";
|
|
2
|
+
import { EditorSurface } from "./EditorSurface.js";
|
|
3
|
+
import { composeEditor } from "./compose.js";
|
|
4
|
+
import { forwardRef, useEffect, useImperativeHandle, useRef, useState } from "react";
|
|
5
|
+
import { jsx } from "react/jsx-runtime";
|
|
6
|
+
//#region src/react/composed-surface.tsx
|
|
7
|
+
/** `EditorSurface` over an already composed preset; hands out the preset through the ref. */
|
|
8
|
+
const ReadySurface = forwardRef(function ReadySurface({ preset, ...surface }, ref) {
|
|
9
|
+
const surfaceRef = useRef(null);
|
|
10
|
+
useImperativeHandle(ref, () => ({
|
|
11
|
+
get editor() {
|
|
12
|
+
return surfaceRef.current?.editor ?? null;
|
|
13
|
+
},
|
|
14
|
+
openSettings: (tab) => surfaceRef.current?.openSettings(tab),
|
|
15
|
+
preset
|
|
16
|
+
}), [preset]);
|
|
17
|
+
return /* @__PURE__ */ jsx(EditorSurface, {
|
|
18
|
+
ref: surfaceRef,
|
|
19
|
+
preset,
|
|
20
|
+
...surface
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
/**
|
|
24
|
+
* `EditorSurface` over the preset `composeEditor` builds from the composition props, at mount. A backend that probes
|
|
25
|
+
* its capabilities (`backend.ready`) is awaited first, so the composition is pruned by what it really offers; until
|
|
26
|
+
* then nothing renders. Passing the host's own `collaboration` session keeps `collab` and `comments` whatever the
|
|
27
|
+
* backend offers.
|
|
28
|
+
*/
|
|
29
|
+
const ComposedSurface = forwardRef(function ComposedSurface({ content, interaction, ai, add, remove, backend, compositeKinds, ...surface }, ref) {
|
|
30
|
+
const app = useEditorContext();
|
|
31
|
+
const [source] = useState(() => backend ?? app.backend);
|
|
32
|
+
const [compose] = useState(() => {
|
|
33
|
+
const options = {
|
|
34
|
+
content,
|
|
35
|
+
interaction,
|
|
36
|
+
ai,
|
|
37
|
+
collaboration: surface.collaboration !== void 0,
|
|
38
|
+
...compositeKinds && { compositeKinds },
|
|
39
|
+
...add && { add },
|
|
40
|
+
...remove && { remove }
|
|
41
|
+
};
|
|
42
|
+
return () => composeEditor({
|
|
43
|
+
...options,
|
|
44
|
+
backend: source
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
const [preset, setPreset] = useState(() => source.ready ? void 0 : compose());
|
|
48
|
+
useEffect(() => {
|
|
49
|
+
if (preset || !source.ready) return;
|
|
50
|
+
let live = true;
|
|
51
|
+
source.ready.then(() => {
|
|
52
|
+
if (live) setPreset(compose());
|
|
53
|
+
});
|
|
54
|
+
return () => {
|
|
55
|
+
live = false;
|
|
56
|
+
};
|
|
57
|
+
}, [
|
|
58
|
+
preset,
|
|
59
|
+
source,
|
|
60
|
+
compose
|
|
61
|
+
]);
|
|
62
|
+
return preset ? /* @__PURE__ */ jsx(ReadySurface, {
|
|
63
|
+
ref,
|
|
64
|
+
preset,
|
|
65
|
+
...surface
|
|
66
|
+
}) : null;
|
|
67
|
+
});
|
|
68
|
+
//#endregion
|
|
69
|
+
export { ComposedSurface };
|
|
70
|
+
|
|
71
|
+
//# sourceMappingURL=composed-surface.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"composed-surface.js","names":[],"sources":["../../src/react/composed-surface.tsx"],"sourcesContent":["import type { Editor } from '@tiptap/core'\nimport { type ComponentType, forwardRef, useEffect, useImperativeHandle, useRef, useState } from 'react'\nimport type { EditorBackend } from '../core/backend'\nimport type { CompositeKind } from '../features/composites/kinds'\nimport type { ComposedEditor, ContentLevel, FeatureId, InteractionLevel } from '../presets/compose'\nimport { composeEditor } from './compose'\nimport { useEditorContext } from './context'\nimport { EditorSurface, type EditorSurfaceHandle, type EditorSurfaceProps, type ReactFeature } from './EditorSurface'\n\n/** The preset a composed editor mounts: the three dimensions' features, with `omitted` listing what the backend or `remove` dropped. */\nexport type ReactComposedPreset = ComposedEditor<ComponentType<{ editor: Editor }>>\n\n/** The handle of a composed editor: the surface's (`editor`, `openSettings`) plus the preset it composed. */\nexport interface ComposedEditorHandle extends EditorSurfaceHandle {\n readonly preset: ReactComposedPreset\n}\n\n/**\n * The surface's own props (collaboration session or standalone `value`/`onChange`, metadata, abilities, extensions,\n * block actions, commands, `documentId`, `editable`, `settingsUi`, the open state of the sidebar and comments margin,\n * `onReady` and the other callbacks) except the preset, plus the composition. Every composition prop is read once at\n * mount; hosts remount (`key`) to change one.\n */\nexport interface ComposedEditorProps extends Omit<EditorSurfaceProps, 'preset'> {\n /** Document model: a level or the content feature ids to install. */\n content?: ContentLevel | readonly FeatureId[]\n /** Editing UX: a level or the interaction feature ids; `[]` = no interaction (a viewer). */\n interaction?: InteractionLevel | readonly FeatureId[]\n /** Installs the AI feature and the integrations whose content is present. */\n ai?: boolean\n /** Host features, appended after the catalog. */\n add?: readonly ReactFeature[]\n /** Features (catalog or host) left out, with the features that require them. */\n remove?: readonly FeatureId[]\n /** The backend the composition is pruned by (default: the editor context's backend). */\n backend?: EditorBackend\n /** Composite kinds („Bausteine“) when `content` includes composites (default: `defaultCompositeKinds(t)`). */\n compositeKinds?: readonly CompositeKind[]\n}\n\n/** `EditorSurface` over an already composed preset; hands out the preset through the ref. */\nconst ReadySurface = forwardRef<ComposedEditorHandle, Omit<EditorSurfaceProps, 'preset'> & { preset: ReactComposedPreset }>(function ReadySurface({ preset, ...surface }, ref) {\n const surfaceRef = useRef<EditorSurfaceHandle>(null)\n useImperativeHandle(ref, () => ({\n get editor() { return surfaceRef.current?.editor ?? null },\n openSettings: tab => surfaceRef.current?.openSettings(tab),\n preset,\n }), [preset])\n return <EditorSurface ref={surfaceRef} preset={preset} {...surface} />\n})\n\n/**\n * `EditorSurface` over the preset `composeEditor` builds from the composition props, at mount. A backend that probes\n * its capabilities (`backend.ready`) is awaited first, so the composition is pruned by what it really offers; until\n * then nothing renders. Passing the host's own `collaboration` session keeps `collab` and `comments` whatever the\n * backend offers.\n */\nexport const ComposedSurface = forwardRef<ComposedEditorHandle, ComposedEditorProps & Required<Pick<ComposedEditorProps, 'content' | 'interaction' | 'ai'>>>(function ComposedSurface(\n { content, interaction, ai, add, remove, backend, compositeKinds, ...surface },\n ref,\n) {\n const app = useEditorContext()\n // Read once at mount, like every composition prop, although the preset may only be built after `backend.ready`.\n const [source] = useState(() => backend ?? app.backend)\n const [compose] = useState(() => {\n const options = {\n content,\n interaction,\n ai,\n collaboration: surface.collaboration !== undefined,\n ...(compositeKinds && { compositeKinds }),\n ...(add && { add }),\n ...(remove && { remove }),\n }\n return () => composeEditor({ ...options, backend: source })\n })\n const [preset, setPreset] = useState<ReactComposedPreset | undefined>(() => source.ready ? undefined : compose())\n useEffect(() => {\n if (preset || !source.ready) return\n let live = true\n void source.ready.then(() => { if (live) setPreset(compose()) })\n return () => { live = false }\n }, [preset, source, compose])\n return preset ? <ReadySurface ref={ref} preset={preset} {...surface} /> : null\n})\n"],"mappings":";;;;;;;AAyCA,MAAM,eAAe,WAAuG,SAAS,aAAa,EAAE,QAAQ,GAAG,WAAW,KAAK;CAC7K,MAAM,aAAa,OAA4B,IAAI;CACnD,oBAAoB,YAAY;EAC9B,IAAI,SAAS;GAAE,OAAO,WAAW,SAAS,UAAU;EAAK;EACzD,eAAc,QAAO,WAAW,SAAS,aAAa,GAAG;EACzD;CACF,IAAI,CAAC,MAAM,CAAC;CACZ,OAAO,oBAAC,eAAD;EAAe,KAAK;EAAoB;EAAQ,GAAI;CAAU,CAAA;AACvE,CAAC;;;;;;;AAQD,MAAa,kBAAkB,WAA8H,SAAS,gBACpK,EAAE,SAAS,aAAa,IAAI,KAAK,QAAQ,SAAS,gBAAgB,GAAG,WACrE,KACA;CACA,MAAM,MAAM,iBAAiB;CAE7B,MAAM,CAAC,UAAU,eAAe,WAAW,IAAI,OAAO;CACtD,MAAM,CAAC,WAAW,eAAe;EAC/B,MAAM,UAAU;GACd;GACA;GACA;GACA,eAAe,QAAQ,kBAAkB,KAAA;GACzC,GAAI,kBAAkB,EAAE,eAAe;GACvC,GAAI,OAAO,EAAE,IAAI;GACjB,GAAI,UAAU,EAAE,OAAO;EACzB;EACA,aAAa,cAAc;GAAE,GAAG;GAAS,SAAS;EAAO,CAAC;CAC5D,CAAC;CACD,MAAM,CAAC,QAAQ,aAAa,eAAgD,OAAO,QAAQ,KAAA,IAAY,QAAQ,CAAC;CAChH,gBAAgB;EACd,IAAI,UAAU,CAAC,OAAO,OAAO;EAC7B,IAAI,OAAO;EACX,OAAY,MAAM,WAAW;GAAE,IAAI,MAAM,UAAU,QAAQ,CAAC;EAAE,CAAC;EAC/D,aAAa;GAAE,OAAO;EAAM;CAC9B,GAAG;EAAC;EAAQ;EAAQ;CAAO,CAAC;CAC5B,OAAO,SAAS,oBAAC,cAAD;EAAmB;EAAa;EAAQ,GAAI;CAAU,CAAA,IAAI;AAC5E,CAAC"}
|
package/dist/react/context.js
CHANGED
|
@@ -9,13 +9,17 @@ function EditorContextProvider({ context, children }) {
|
|
|
9
9
|
children
|
|
10
10
|
});
|
|
11
11
|
}
|
|
12
|
+
/** The `EditorContext` of the nearest `EditorContextProvider`, or `null` outside one. */
|
|
13
|
+
function useOptionalEditorContext() {
|
|
14
|
+
return useContext(Ctx);
|
|
15
|
+
}
|
|
12
16
|
/** The `EditorContext` of the nearest `EditorContextProvider`. */
|
|
13
17
|
function useEditorContext() {
|
|
14
|
-
const context =
|
|
18
|
+
const context = useOptionalEditorContext();
|
|
15
19
|
if (!context) throw new Error("@ecsplico/editor: no editor context; wrap the tree in <EditorContextProvider context={createEditorContext()}>");
|
|
16
20
|
return context;
|
|
17
21
|
}
|
|
18
22
|
//#endregion
|
|
19
|
-
export { EditorContextProvider, useEditorContext };
|
|
23
|
+
export { EditorContextProvider, useEditorContext, useOptionalEditorContext };
|
|
20
24
|
|
|
21
25
|
//# sourceMappingURL=context.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.js","names":[],"sources":["../../src/react/context.tsx"],"sourcesContent":["import { createContext, type ReactNode, useContext } from 'react'\nimport type { EditorContext } from '../core/context'\n\nconst Ctx = createContext<EditorContext | null>(null)\n\n/** Makes `context` (from `createEditorContext()`) available to the editor components below. The host owns it and disposes it. */\nexport function EditorContextProvider({ context, children }: { context: EditorContext, children: ReactNode }) {\n return <Ctx.Provider value={context}>{children}</Ctx.Provider>\n}\n\n/** The `EditorContext` of the nearest `EditorContextProvider`. */\nexport function useEditorContext(): EditorContext {\n const context =
|
|
1
|
+
{"version":3,"file":"context.js","names":[],"sources":["../../src/react/context.tsx"],"sourcesContent":["import { createContext, type ReactNode, useContext } from 'react'\nimport type { EditorContext } from '../core/context'\n\nconst Ctx = createContext<EditorContext | null>(null)\n\n/** Makes `context` (from `createEditorContext()`) available to the editor components below. The host owns it and disposes it. */\nexport function EditorContextProvider({ context, children }: { context: EditorContext, children: ReactNode }) {\n return <Ctx.Provider value={context}>{children}</Ctx.Provider>\n}\n\n/** The `EditorContext` of the nearest `EditorContextProvider`, or `null` outside one. */\nexport function useOptionalEditorContext(): EditorContext | null {\n return useContext(Ctx)\n}\n\n/** The `EditorContext` of the nearest `EditorContextProvider`. */\nexport function useEditorContext(): EditorContext {\n const context = useOptionalEditorContext()\n if (!context) throw new Error('@ecsplico/editor: no editor context; wrap the tree in <EditorContextProvider context={createEditorContext()}>')\n return context\n}\n"],"mappings":";;;AAGA,MAAM,MAAM,cAAoC,IAAI;;AAGpD,SAAgB,sBAAsB,EAAE,SAAS,YAA6D;CAC5G,OAAO,oBAAC,IAAI,UAAL;EAAc,OAAO;EAAU;CAAuB,CAAA;AAC/D;;AAGA,SAAgB,2BAAiD;CAC/D,OAAO,WAAW,GAAG;AACvB;;AAGA,SAAgB,mBAAkC;CAChD,MAAM,UAAU,yBAAyB;CACzC,IAAI,CAAC,SAAS,MAAM,IAAI,MAAM,+GAA+G;CAC7I,OAAO;AACT"}
|
package/dist/react/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { EditorSurface, EditorSurfaceHandle, EditorSurfaceProps, ReactFeature, ReactPreset } from "./EditorSurface.js";
|
|
2
2
|
import { EditorContextProvider, useEditorContext } from "./context.js";
|
|
3
|
+
import { EditorCommandPalette } from "./EditorCommandPalette.js";
|
|
3
4
|
import { EditorSettingsModal } from "./EditorSettingsModal.js";
|
|
4
5
|
import { EditorSettingsPanel } from "./EditorSettingsPanel.js";
|
|
5
6
|
import { EditorToolbar } from "./EditorToolbar.js";
|
|
@@ -14,4 +15,4 @@ import { cn } from "./ui/utils.js";
|
|
|
14
15
|
import { useNotifier } from "./use-notifier.js";
|
|
15
16
|
import { useStore } from "./use-store.js";
|
|
16
17
|
import { Toaster } from "sonner";
|
|
17
|
-
export { EditorContextProvider, EditorSettingsModal, EditorSettingsPanel, EditorSurface, type EditorSurfaceHandle, type EditorSurfaceProps, EditorToolbar, EditorUiContext, Icon, type ReactFeature, type ReactPreset, SettingsSection, SuggestionList, type SuggestionListHandle, Toaster, cn, reactNotifier, reactSuggestionRenderer, useEditorContext, useEditorI18n, useEditorSettings, useEditorUi, useNotifier, useStore };
|
|
18
|
+
export { EditorCommandPalette, EditorContextProvider, EditorSettingsModal, EditorSettingsPanel, EditorSurface, type EditorSurfaceHandle, type EditorSurfaceProps, EditorToolbar, EditorUiContext, Icon, type ReactFeature, type ReactPreset, SettingsSection, SuggestionList, type SuggestionListHandle, Toaster, cn, reactNotifier, reactSuggestionRenderer, useEditorContext, useEditorI18n, useEditorSettings, useEditorUi, useNotifier, useStore };
|
package/dist/react/index.js
CHANGED
|
@@ -10,8 +10,9 @@ import { EditorUiContext, useEditorUi } from "./editor-ui.js";
|
|
|
10
10
|
import { reactNotifier } from "./notify.js";
|
|
11
11
|
import { SuggestionList, reactSuggestionRenderer } from "./suggestion-renderer.js";
|
|
12
12
|
import { EditorSurface } from "./EditorSurface.js";
|
|
13
|
+
import { EditorCommandPalette } from "./EditorCommandPalette.js";
|
|
13
14
|
import { useNotifier } from "./use-notifier.js";
|
|
14
15
|
import { SettingsSection } from "./SettingsSection.js";
|
|
15
16
|
import { EditorToolbar } from "./EditorToolbar.js";
|
|
16
17
|
import { Toaster } from "sonner";
|
|
17
|
-
export { EditorContextProvider, EditorSettingsModal, EditorSettingsPanel, EditorSurface, EditorToolbar, EditorUiContext, Icon, SettingsSection, SuggestionList, Toaster, cn, reactNotifier, reactSuggestionRenderer, useEditorContext, useEditorI18n, useEditorSettings, useEditorUi, useNotifier, useStore };
|
|
18
|
+
export { EditorCommandPalette, EditorContextProvider, EditorSettingsModal, EditorSettingsPanel, EditorSurface, EditorToolbar, EditorUiContext, Icon, SettingsSection, SuggestionList, Toaster, cn, reactNotifier, reactSuggestionRenderer, useEditorContext, useEditorI18n, useEditorSettings, useEditorUi, useNotifier, useStore };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
//#region src/react/key-labels.ts
|
|
2
|
+
const isMac = typeof navigator !== "undefined" && /Mac|iPhone|iPad/.test(navigator.platform);
|
|
3
|
+
const KEY_LABELS = {
|
|
4
|
+
meta: isMac ? "⌘" : "Ctrl",
|
|
5
|
+
ctrl: "Ctrl",
|
|
6
|
+
alt: isMac ? "⌥" : "Alt",
|
|
7
|
+
shift: "⇧",
|
|
8
|
+
enter: "↵"
|
|
9
|
+
};
|
|
10
|
+
/** A command's shortcut keys (`['meta', 'shift', 'a']`) as shown on the keycaps of this platform (`⌘+⇧+A`). Vue's `UKbd` does the same inside Nuxt UI. */
|
|
11
|
+
const shortcutLabel = (kbds) => kbds.map((key) => KEY_LABELS[key] ?? key.toUpperCase()).join("+");
|
|
12
|
+
//#endregion
|
|
13
|
+
export { shortcutLabel };
|
|
14
|
+
|
|
15
|
+
//# sourceMappingURL=key-labels.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"key-labels.js","names":[],"sources":["../../src/react/key-labels.ts"],"sourcesContent":["const isMac = typeof navigator !== 'undefined' && /Mac|iPhone|iPad/.test(navigator.platform)\nconst KEY_LABELS: Record<string, string> = {\n meta: isMac ? '⌘' : 'Ctrl',\n ctrl: 'Ctrl',\n // i18n-ignore: keyboard key name, shown as on the keycap\n alt: isMac ? '⌥' : 'Alt',\n shift: '⇧',\n enter: '↵',\n}\n\n/** A command's shortcut keys (`['meta', 'shift', 'a']`) as shown on the keycaps of this platform (`⌘+⇧+A`). Vue's `UKbd` does the same inside Nuxt UI. */\nexport const shortcutLabel = (kbds: readonly string[]): string => kbds.map(key => KEY_LABELS[key] ?? key.toUpperCase()).join('+')\n"],"mappings":";AAAA,MAAM,QAAQ,OAAO,cAAc,eAAe,kBAAkB,KAAK,UAAU,QAAQ;AAC3F,MAAM,aAAqC;CACzC,MAAM,QAAQ,MAAM;CACpB,MAAM;CAEN,KAAK,QAAQ,MAAM;CACnB,OAAO;CACP,OAAO;AACT;;AAGA,MAAa,iBAAiB,SAAoC,KAAK,KAAI,QAAO,WAAW,QAAQ,IAAI,YAAY,CAAC,CAAC,CAAC,KAAK,GAAG"}
|
package/dist/react/settings.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { EditorSettings } from "../settings/index.js";
|
|
2
1
|
import { Store } from "../core/store.js";
|
|
2
|
+
import { EditorSettings } from "../settings/index.js";
|
|
3
3
|
//#region src/react/settings.d.ts
|
|
4
4
|
/**
|
|
5
5
|
* The editor settings shared by all editors of the app (see `createEditorContext` for persistence). `settings` is
|