@ecsplico/editor 3.6.0 → 4.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +73 -0
- package/dist/adapters/direct-ai.d.ts +4 -4
- package/dist/adapters/direct-ai.js +2 -2
- package/dist/adapters/direct-ai.js.map +1 -1
- package/dist/adapters/document-state.d.ts +1 -1
- package/dist/adapters/document-state.js.map +1 -1
- package/dist/adapters/forge.d.ts +2 -2
- package/dist/adapters/forge.js.map +1 -1
- package/dist/adapters/nitro.d.ts +11 -3
- package/dist/adapters/nitro.js +3 -1
- package/dist/adapters/nitro.js.map +1 -1
- package/dist/adapters/shared.d.ts +6 -6
- package/dist/adapters/shared.js.map +1 -1
- package/dist/code/CodeSurface.vue.d.ts +3 -3
- package/dist/config/index.d.ts +14 -14
- package/dist/config/index.js +8 -8
- package/dist/config/index.js.map +1 -1
- package/dist/core/backend-types.d.ts +3 -3
- package/dist/core/backend-types.js.map +1 -1
- package/dist/core/backend.d.ts +4 -4
- package/dist/core/backend.js.map +1 -1
- package/dist/core/block-convert.d.ts +1 -1
- package/dist/core/block-convert.js +5 -5
- package/dist/core/block-convert.js.map +1 -1
- package/dist/core/block-transfer.d.ts +8 -4
- package/dist/core/block-transfer.js +23 -14
- package/dist/core/block-transfer.js.map +1 -1
- package/dist/core/capabilities.d.ts +113 -0
- package/dist/core/capabilities.js +155 -0
- package/dist/core/capabilities.js.map +1 -0
- package/dist/core/command-types.d.ts +1 -1
- package/dist/core/context.js.map +1 -1
- package/dist/core/convert.d.ts +5 -5
- package/dist/core/convert.js +5 -5
- package/dist/core/convert.js.map +1 -1
- package/dist/core/core-feature.js +1 -1
- package/dist/core/define-editor.d.ts +2 -2
- package/dist/core/define-editor.js +34 -6
- package/dist/core/define-editor.js.map +1 -1
- package/dist/core/derivation.d.ts +119 -0
- package/dist/core/derivation.js +187 -0
- package/dist/core/derivation.js.map +1 -0
- package/dist/core/derive.d.ts +61 -0
- package/dist/core/derive.js +69 -0
- package/dist/core/derive.js.map +1 -0
- package/dist/core/extension-points.d.ts +16 -0
- package/dist/core/feature-context.d.ts +5 -1
- package/dist/core/feature-context.js +10 -3
- package/dist/core/feature-context.js.map +1 -1
- package/dist/core/feature.d.ts +41 -19
- package/dist/core/feature.js.map +1 -1
- package/dist/core/fences.js +1 -1
- package/dist/core/fences.js.map +1 -1
- package/dist/core/index.d.ts +6 -2
- package/dist/core/index.js +5 -1
- package/dist/core/pipeline.d.ts +14 -5
- package/dist/core/pipeline.js +19 -7
- package/dist/core/pipeline.js.map +1 -1
- package/dist/core/properties.d.ts +22 -0
- package/dist/core/properties.js +17 -0
- package/dist/core/properties.js.map +1 -0
- package/dist/core/schema/block-ids.js +5 -5
- package/dist/core/schema/block-ids.js.map +1 -1
- package/dist/core/schema/index.d.ts +2 -1
- package/dist/core/schema/index.js +2 -1
- package/dist/core/schema/index.js.map +1 -1
- package/dist/core/schema/opaque-fence.d.ts +4 -4
- package/dist/core/schema/opaque-fence.js +7 -7
- package/dist/core/schema/opaque-fence.js.map +1 -1
- package/dist/core/schema/persisted-names.d.ts +58 -0
- package/dist/core/schema/persisted-names.js +96 -0
- package/dist/core/schema/persisted-names.js.map +1 -0
- package/dist/core/toolbar-items.js +1 -1
- package/dist/core/toolbar-items.js.map +1 -1
- package/dist/core/util.js +5 -1
- package/dist/core/util.js.map +1 -1
- package/dist/document/DocumentSurface.vue.d.ts +3 -3
- package/dist/features/ai/agent-ops.js +1 -1
- package/dist/features/ai/ai-review.js +1 -1
- package/dist/features/ai/assistant.d.ts +4 -4
- package/dist/features/ai/assistant.js +1 -1
- package/dist/features/ai/assistant.js.map +1 -1
- package/dist/features/ai/components/AiSelectionMenu.js +1 -1
- package/dist/features/ai/components/AiSelectionMenu.js.map +1 -1
- package/dist/features/ai/components/ModelQuickSwitch.js +7 -7
- package/dist/features/ai/components/ModelQuickSwitch.js.map +1 -1
- package/dist/features/ai/components/ModelQuickSwitch.vue.d.ts +4 -4
- package/dist/features/ai/components/SettingsAiTab.js +8 -8
- package/dist/features/ai/components/SettingsAiTab.js.map +1 -1
- package/dist/features/ai/components/SettingsModelProfiles.js +1 -1
- package/dist/features/ai/components/SettingsModelProfiles.js.map +1 -1
- package/dist/features/ai/document-chat-model.d.ts +2 -2
- 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 +2 -2
- package/dist/features/ai/document-chat.js.map +1 -1
- package/dist/features/ai/feature.d.ts +2 -2
- package/dist/features/ai/feature.js +2 -2
- package/dist/features/ai/feature.js.map +1 -1
- package/dist/features/ai/ghost-autocomplete.d.ts +4 -4
- package/dist/features/ai/ghost-autocomplete.js +1 -1
- package/dist/features/ai/ghost-autocomplete.js.map +1 -1
- package/dist/features/ai/index.d.ts +3 -3
- package/dist/features/ai/index.js +2 -2
- package/dist/features/ai/model-profiles.d.ts +9 -9
- package/dist/features/ai/model-profiles.js +13 -13
- package/dist/features/ai/model-profiles.js.map +1 -1
- package/dist/features/ai/protocol/agent-ops.d.ts +2 -2
- package/dist/features/ai/protocol/agent-ops.js +1 -1
- package/dist/features/ai/protocol/agent-ops.js.map +1 -1
- package/dist/features/ai/protocol/block-lines.d.ts +7 -7
- package/dist/features/ai/protocol/block-lines.js +10 -10
- package/dist/features/ai/protocol/block-lines.js.map +1 -1
- package/dist/features/ai/protocol/chat.d.ts +5 -5
- package/dist/features/ai/protocol/chat.js +12 -12
- package/dist/features/ai/protocol/chat.js.map +1 -1
- package/dist/features/ai/protocol/generate.d.ts +1 -1
- package/dist/features/ai/protocol/generate.js +1 -1
- package/dist/features/ai/protocol/generate.js.map +1 -1
- package/dist/features/ai/protocol/index.d.ts +3 -3
- package/dist/features/ai/protocol/index.js +2 -2
- package/dist/features/ai/protocol/models.d.ts +3 -3
- package/dist/features/ai/protocol/models.js +3 -3
- package/dist/features/ai/protocol/models.js.map +1 -1
- package/dist/features/ai/protocol/schemas.d.ts +1 -1
- package/dist/features/ai/protocol/schemas.js +1 -1
- package/dist/features/ai/protocol/schemas.js.map +1 -1
- package/dist/features/ai/protocol/tasks.d.ts +5 -5
- package/dist/features/ai/protocol/tasks.js +12 -12
- package/dist/features/ai/protocol/tasks.js.map +1 -1
- package/dist/features/ai/react/AiSelectionMenu.js.map +1 -1
- package/dist/features/ai/react/ModelQuickSwitch.d.ts +4 -4
- package/dist/features/ai/react/ModelQuickSwitch.js +6 -6
- package/dist/features/ai/react/ModelQuickSwitch.js.map +1 -1
- package/dist/features/ai/react/SettingsAiTab.d.ts +1 -1
- package/dist/features/ai/react/SettingsAiTab.js +8 -8
- package/dist/features/ai/react/SettingsAiTab.js.map +1 -1
- package/dist/features/ai/react/SettingsModelProfiles.d.ts +1 -1
- package/dist/features/ai/react/SettingsModelProfiles.js +1 -1
- 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 +1 -1
- package/dist/features/ai/react/use-ai-assistant.js.map +1 -1
- package/dist/features/ai/react/use-model-profiles.d.ts +5 -5
- package/dist/features/ai/react/use-model-profiles.js +2 -2
- package/dist/features/ai/react/use-model-profiles.js.map +1 -1
- package/dist/features/ai/use-ai-assistant.d.ts +1 -1
- package/dist/features/ai/use-ai-assistant.js +1 -1
- package/dist/features/ai/use-ai-assistant.js.map +1 -1
- package/dist/features/ai/use-model-profiles.d.ts +4 -4
- package/dist/features/ai/use-model-profiles.js +2 -2
- package/dist/features/ai/use-model-profiles.js.map +1 -1
- package/dist/features/block-ui/block-actions.d.ts +8 -4
- package/dist/features/block-ui/block-actions.js +38 -22
- package/dist/features/block-ui/block-actions.js.map +1 -1
- package/dist/features/block-ui/block-target.d.ts +29 -0
- package/dist/features/block-ui/block-target.js +63 -0
- package/dist/features/block-ui/block-target.js.map +1 -0
- package/dist/features/block-ui/components/BlockHandles.js +3 -3
- package/dist/features/block-ui/components/BlockHandles.js.map +1 -1
- package/dist/features/block-ui/components/BlockUi.js +11 -23
- package/dist/features/block-ui/components/BlockUi.js.map +1 -1
- package/dist/features/block-ui/feature.d.ts +3 -2
- package/dist/features/block-ui/feature.js +3 -2
- package/dist/features/block-ui/feature.js.map +1 -1
- package/dist/features/block-ui/handle-geometry.js +12 -23
- package/dist/features/block-ui/handle-geometry.js.map +1 -1
- package/dist/features/block-ui/index.d.ts +2 -1
- package/dist/features/block-ui/index.js +2 -1
- package/dist/features/block-ui/react/BlockHandles.d.ts +1 -1
- package/dist/features/block-ui/react/BlockHandles.js +4 -4
- package/dist/features/block-ui/react/BlockHandles.js.map +1 -1
- package/dist/features/block-ui/react/BlockUi.js +13 -25
- package/dist/features/block-ui/react/BlockUi.js.map +1 -1
- package/dist/features/comments/model.js +1 -1
- package/dist/features/composites/accepted-children.d.ts +5 -4
- package/dist/features/composites/accepted-children.js +26 -26
- package/dist/features/composites/accepted-children.js.map +1 -1
- package/dist/features/composites/ai-brief.d.ts +4 -4
- package/dist/features/composites/ai-brief.js +14 -12
- package/dist/features/composites/ai-brief.js.map +1 -1
- package/dist/features/composites/anchors.d.ts +1 -1
- package/dist/features/composites/anchors.js.map +1 -1
- package/dist/features/composites/baskets.d.ts +1 -1
- package/dist/features/composites/baskets.js.map +1 -1
- package/dist/features/composites/bibliography-command.d.ts +1 -1
- package/dist/features/composites/bibliography-form.js +1 -1
- package/dist/features/composites/bibliography-form.js.map +1 -1
- package/dist/features/composites/bibliography.js.map +1 -1
- package/dist/features/composites/block-types-json.d.ts +38 -0
- package/dist/features/composites/block-types-json.js +122 -0
- package/dist/features/composites/block-types-json.js.map +1 -0
- package/dist/features/composites/block-types.d.ts +119 -0
- package/dist/features/composites/block-types.js +343 -0
- package/dist/features/composites/block-types.js.map +1 -0
- package/dist/features/composites/capabilities.js +109 -0
- package/dist/features/composites/capabilities.js.map +1 -0
- package/dist/features/composites/components/BibliographyEditor.js +5 -5
- package/dist/features/composites/components/BibliographyEditor.js.map +1 -1
- package/dist/features/composites/components/CompositeBasketMenu.js +2 -2
- package/dist/features/composites/components/CompositeBasketMenu.js.map +1 -1
- package/dist/features/composites/components/CompositeChrome.js +18 -8
- package/dist/features/composites/components/CompositeChrome.js.map +1 -1
- package/dist/features/composites/components/CompositeChrome.vue.d.ts +1 -1
- package/dist/features/composites/components/CompositeDetails.js +11 -10
- package/dist/features/composites/components/CompositeDetails.js.map +1 -1
- package/dist/features/composites/components/CompositeDetails.vue.d.ts +1 -1
- package/dist/features/composites/components/CompositeFieldEditor.js +7 -7
- package/dist/features/composites/components/CompositeFieldEditor.js.map +1 -1
- package/dist/features/composites/components/CompositeFieldEditor.vue.d.ts +5 -5
- package/dist/features/composites/components/CompositeInspector.js +136 -113
- package/dist/features/composites/components/CompositeInspector.js.map +1 -1
- package/dist/features/composites/components/CompositeInspector.vue.d.ts +3 -3
- package/dist/features/composites/components/CompositeStatusMenu.js +2 -2
- package/dist/features/composites/components/CompositeStatusMenu.js.map +1 -1
- package/dist/features/composites/components/CompositeSummaryEditor.js +1 -1
- package/dist/features/composites/components/CompositeSummaryEditor.js.map +1 -1
- package/dist/features/composites/components/CompositeSummaryEditor.vue.d.ts +1 -1
- package/dist/features/composites/components/CompositeTable.js +2 -2
- package/dist/features/composites/components/CompositeTable.js.map +1 -1
- package/dist/features/composites/components/CompositeTagsEditor.js +1 -1
- package/dist/features/composites/components/CompositeTagsEditor.js.map +1 -1
- package/dist/features/composites/components/CompositeTagsEditor.vue.d.ts +1 -1
- package/dist/features/composites/components/CompositeView.js +19 -17
- package/dist/features/composites/components/CompositeView.js.map +1 -1
- package/dist/features/composites/components/DerivationBadge.js +15 -6
- package/dist/features/composites/components/DerivationBadge.js.map +1 -1
- package/dist/features/composites/components/FocusChip.js +1 -1
- package/dist/features/composites/components/FocusChip.js.map +1 -1
- package/dist/features/composites/components/FocusChip.vue.d.ts +1 -1
- package/dist/features/composites/components/ReferenceFieldSelect.js +3 -3
- package/dist/features/composites/components/ReferenceFieldSelect.js.map +1 -1
- package/dist/features/composites/components/ReferenceView.js +1 -1
- package/dist/features/composites/components/ReferenceView.js.map +1 -1
- package/dist/features/composites/components/SettingsEditingTab.js +18 -18
- package/dist/features/composites/components/SettingsEditingTab.js.map +1 -1
- package/dist/features/composites/components/SettingsEditingTab.vue.d.ts +3 -3
- package/dist/features/composites/convert.d.ts +4 -4
- package/dist/features/composites/convert.js +27 -28
- package/dist/features/composites/convert.js.map +1 -1
- package/dist/features/composites/derived-chrome.js +34 -28
- package/dist/features/composites/derived-chrome.js.map +1 -1
- package/dist/features/composites/editing-settings-keys.js +6 -6
- package/dist/features/composites/editing-settings-keys.js.map +1 -1
- package/dist/features/composites/feature.d.ts +10 -10
- package/dist/features/composites/feature.js +58 -46
- package/dist/features/composites/feature.js.map +1 -1
- package/dist/features/composites/fences.d.ts +3 -3
- package/dist/features/composites/fences.js +18 -13
- package/dist/features/composites/fences.js.map +1 -1
- package/dist/features/composites/focus.d.ts +10 -10
- package/dist/features/composites/focus.js +11 -11
- package/dist/features/composites/focus.js.map +1 -1
- package/dist/features/composites/heading-composites.d.ts +5 -5
- package/dist/features/composites/heading-composites.js +13 -16
- package/dist/features/composites/heading-composites.js.map +1 -1
- package/dist/features/composites/index.d.ts +20 -18
- package/dist/features/composites/index.js +9 -7
- package/dist/features/composites/inspector-model.d.ts +45 -22
- package/dist/features/composites/inspector-model.js +53 -14
- package/dist/features/composites/inspector-model.js.map +1 -1
- package/dist/features/composites/legacy.d.ts +5 -4
- package/dist/features/composites/legacy.js +16 -23
- package/dist/features/composites/legacy.js.map +1 -1
- package/dist/features/composites/markdown-export.js +3 -3
- package/dist/features/composites/markdown-export.js.map +1 -1
- package/dist/features/composites/merge.d.ts +8 -8
- package/dist/features/composites/merge.js +23 -22
- package/dist/features/composites/merge.js.map +1 -1
- package/dist/features/composites/meta-display.js +5 -5
- package/dist/features/composites/meta-display.js.map +1 -1
- package/dist/features/composites/meta-keys.d.ts +5 -5
- package/dist/features/composites/meta-keys.js +8 -8
- package/dist/features/composites/meta-keys.js.map +1 -1
- package/dist/features/composites/node-views.d.ts +3 -3
- package/dist/features/composites/node-views.js +2 -2
- package/dist/features/composites/node-views.js.map +1 -1
- package/dist/features/composites/nodes.d.ts +13 -13
- package/dist/features/composites/nodes.js +100 -77
- package/dist/features/composites/nodes.js.map +1 -1
- package/dist/features/composites/outline.d.ts +15 -12
- package/dist/features/composites/outline.js +24 -21
- package/dist/features/composites/outline.js.map +1 -1
- package/dist/features/composites/properties.d.ts +51 -0
- package/dist/features/composites/properties.js +89 -0
- package/dist/features/composites/properties.js.map +1 -0
- package/dist/features/composites/react/BibliographyEditor.js +5 -5
- package/dist/features/composites/react/BibliographyEditor.js.map +1 -1
- package/dist/features/composites/react/CompositeBasketMenu.js +2 -2
- package/dist/features/composites/react/CompositeBasketMenu.js.map +1 -1
- package/dist/features/composites/react/CompositeChrome.d.ts +1 -1
- package/dist/features/composites/react/CompositeChrome.js +15 -6
- package/dist/features/composites/react/CompositeChrome.js.map +1 -1
- package/dist/features/composites/react/CompositeDetails.d.ts +1 -1
- package/dist/features/composites/react/CompositeDetails.js +11 -10
- package/dist/features/composites/react/CompositeDetails.js.map +1 -1
- package/dist/features/composites/react/CompositeFieldEditor.d.ts +5 -5
- package/dist/features/composites/react/CompositeFieldEditor.js +6 -6
- package/dist/features/composites/react/CompositeFieldEditor.js.map +1 -1
- package/dist/features/composites/react/CompositeInspector.d.ts +3 -3
- package/dist/features/composites/react/CompositeInspector.js +142 -128
- package/dist/features/composites/react/CompositeInspector.js.map +1 -1
- package/dist/features/composites/react/CompositeStatusMenu.js +2 -2
- package/dist/features/composites/react/CompositeStatusMenu.js.map +1 -1
- package/dist/features/composites/react/CompositeSummaryEditor.d.ts +1 -1
- package/dist/features/composites/react/CompositeSummaryEditor.js +1 -1
- package/dist/features/composites/react/CompositeSummaryEditor.js.map +1 -1
- package/dist/features/composites/react/CompositeTable.d.ts +1 -1
- package/dist/features/composites/react/CompositeTable.js +3 -3
- package/dist/features/composites/react/CompositeTable.js.map +1 -1
- package/dist/features/composites/react/CompositeTagsEditor.d.ts +1 -1
- package/dist/features/composites/react/CompositeTagsEditor.js +1 -1
- package/dist/features/composites/react/CompositeTagsEditor.js.map +1 -1
- package/dist/features/composites/react/CompositeView.js +17 -15
- package/dist/features/composites/react/CompositeView.js.map +1 -1
- package/dist/features/composites/react/DerivationBadge.js +13 -4
- package/dist/features/composites/react/DerivationBadge.js.map +1 -1
- package/dist/features/composites/react/FocusChip.d.ts +1 -1
- package/dist/features/composites/react/FocusChip.js +1 -1
- package/dist/features/composites/react/FocusChip.js.map +1 -1
- package/dist/features/composites/react/ReferenceFieldSelect.js +3 -3
- package/dist/features/composites/react/ReferenceFieldSelect.js.map +1 -1
- package/dist/features/composites/react/ReferenceView.d.ts +1 -1
- package/dist/features/composites/react/ReferenceView.js +1 -1
- package/dist/features/composites/react/ReferenceView.js.map +1 -1
- package/dist/features/composites/react/SettingsEditingTab.d.ts +4 -4
- package/dist/features/composites/react/SettingsEditingTab.js +20 -20
- package/dist/features/composites/react/SettingsEditingTab.js.map +1 -1
- package/dist/features/composites/react.js +1 -1
- package/dist/features/composites/react.js.map +1 -1
- package/dist/features/composites/reference-ai.js +1 -1
- package/dist/features/composites/reference-ai.js.map +1 -1
- package/dist/features/composites/reference-label.d.ts +3 -3
- package/dist/features/composites/reference-label.js +6 -6
- package/dist/features/composites/reference-label.js.map +1 -1
- package/dist/features/composites/reference-suggestion.d.ts +1 -1
- package/dist/features/composites/reference-suggestion.js +3 -3
- package/dist/features/composites/reference-suggestion.js.map +1 -1
- package/dist/features/composites/reference-text.d.ts +2 -2
- package/dist/features/composites/reference-text.js +4 -4
- package/dist/features/composites/reference-text.js.map +1 -1
- package/dist/features/composites/reference.d.ts +3 -3
- package/dist/features/composites/reference.js +1 -1
- package/dist/features/composites/reference.js.map +1 -1
- package/dist/features/composites/reveal-source.d.ts +3 -3
- package/dist/features/composites/reveal-source.js +6 -6
- package/dist/features/composites/reveal-source.js.map +1 -1
- package/dist/features/composites/rows-model.d.ts +2 -2
- package/dist/features/composites/rows-model.js +4 -3
- package/dist/features/composites/rows-model.js.map +1 -1
- package/dist/features/composites/rows.d.ts +16 -28
- package/dist/features/composites/rows.js +20 -54
- package/dist/features/composites/rows.js.map +1 -1
- package/dist/features/composites/schema.d.ts +12 -11
- package/dist/features/composites/schema.js +10 -9
- package/dist/features/composites/schema.js.map +1 -1
- package/dist/features/composites/source.d.ts +20 -0
- package/dist/features/composites/source.js +40 -0
- package/dist/features/composites/source.js.map +1 -0
- package/dist/features/composites/split.d.ts +11 -11
- package/dist/features/composites/split.js +20 -20
- package/dist/features/composites/split.js.map +1 -1
- package/dist/features/composites/structure-mode.js +3 -3
- package/dist/features/composites/structure-mode.js.map +1 -1
- package/dist/features/composites/table-model.js +2 -2
- package/dist/features/composites/table-model.js.map +1 -1
- package/dist/features/composites/use-composite-inspector.js +3 -1
- package/dist/features/composites/use-composite-inspector.js.map +1 -1
- package/dist/features/composites/use-composite-rows.d.ts +2 -2
- package/dist/features/composites/use-composite-rows.js.map +1 -1
- package/dist/features/composites/vue.js +1 -1
- package/dist/features/composites/vue.js.map +1 -1
- package/dist/features/image-studio/components/ImageStudioDialog.js +150 -87
- package/dist/features/image-studio/components/ImageStudioDialog.js.map +1 -1
- package/dist/features/image-studio/components/ImageStudioDialog.vue.d.ts +5 -1
- package/dist/features/image-studio/components/ImageStudioLibraryPanel.js +186 -0
- package/dist/features/image-studio/components/ImageStudioLibraryPanel.js.map +1 -0
- package/dist/features/image-studio/components/ImageStudioLibraryTile.js +134 -0
- package/dist/features/image-studio/components/ImageStudioLibraryTile.js.map +1 -0
- package/dist/features/image-studio/components/ImageStudioView.js.map +1 -1
- package/dist/features/image-studio/feature.d.ts +1 -1
- package/dist/features/image-studio/feature.js +1 -1
- package/dist/features/image-studio/feature.js.map +1 -1
- package/dist/features/image-studio/index.d.ts +3 -2
- package/dist/features/image-studio/index.js +2 -2
- package/dist/features/image-studio/library.d.ts +35 -0
- package/dist/features/image-studio/node-core.d.ts +3 -3
- package/dist/features/image-studio/node-core.js +1 -1
- package/dist/features/image-studio/node-core.js.map +1 -1
- package/dist/features/image-studio/node-store.d.ts +1 -1
- package/dist/features/image-studio/node-store.js +1 -1
- package/dist/features/image-studio/node-store.js.map +1 -1
- package/dist/features/image-studio/react/ImageStudioDialog.d.ts +1 -1
- package/dist/features/image-studio/react/ImageStudioDialog.js +46 -5
- package/dist/features/image-studio/react/ImageStudioDialog.js.map +1 -1
- package/dist/features/image-studio/react/ImageStudioLibraryPanel.js +141 -0
- package/dist/features/image-studio/react/ImageStudioLibraryPanel.js.map +1 -0
- package/dist/features/image-studio/react/ImageStudioLibraryTile.js +105 -0
- package/dist/features/image-studio/react/ImageStudioLibraryTile.js.map +1 -0
- package/dist/features/image-studio/react/ImageStudioView.js +1 -1
- package/dist/features/image-studio/react/ImageStudioView.js.map +1 -1
- package/dist/features/image-studio/react/store.d.ts +8 -3
- package/dist/features/image-studio/react/store.js.map +1 -1
- package/dist/features/image-studio/react.d.ts +4 -3
- package/dist/features/image-studio/react.js +3 -3
- package/dist/features/image-studio/react.js.map +1 -1
- package/dist/features/image-studio/schema.d.ts +1 -1
- package/dist/features/image-studio/schema.js +1 -1
- package/dist/features/image-studio/schema.js.map +1 -1
- package/dist/features/image-studio/state.d.ts +8 -3
- package/dist/features/image-studio/state.js +11 -3
- package/dist/features/image-studio/state.js.map +1 -1
- package/dist/features/image-studio/store.d.ts +8 -3
- package/dist/features/image-studio/vue.d.ts +4 -3
- package/dist/features/image-studio/vue.js +3 -3
- package/dist/features/image-studio/vue.js.map +1 -1
- package/dist/features/mentions/tag.js +2 -1
- package/dist/features/mentions/tag.js.map +1 -1
- package/dist/features/themes/components/SettingsAppearanceTab.js +1 -1
- package/dist/features/themes/components/SettingsAppearanceTab.js.map +1 -1
- package/dist/features/themes/feature.d.ts +1 -1
- package/dist/features/themes/feature.js.map +1 -1
- package/dist/features/themes/react/SettingsAppearanceTab.d.ts +1 -1
- package/dist/features/themes/react/SettingsAppearanceTab.js +1 -1
- package/dist/features/themes/react/SettingsAppearanceTab.js.map +1 -1
- package/dist/features/themes/theme-runtime.js +1 -1
- package/dist/features/themes/theme-runtime.js.map +1 -1
- package/dist/features/transcript/TranscriptSegmentView.js +1 -1
- package/dist/features/transcript/TranscriptSegmentView.js.map +1 -1
- package/dist/features/transcript/react/TranscriptSegmentView.js +1 -1
- package/dist/features/transcript/react/TranscriptSegmentView.js.map +1 -1
- package/dist/features/transcript/segment-node.js.map +1 -1
- package/dist/features/transfer/feature.js +1 -1
- package/dist/features/transfer/feature.js.map +1 -1
- package/dist/features/transfer/transforms.d.ts +4 -4
- package/dist/features/transfer/transforms.js +12 -12
- package/dist/features/transfer/transforms.js.map +1 -1
- package/dist/i18n/de/ai.js +4 -4
- package/dist/i18n/de/ai.js.map +1 -1
- package/dist/i18n/de/authors.js +1 -1
- package/dist/i18n/de/authors.js.map +1 -1
- package/dist/i18n/de/comments.js +1 -1
- package/dist/i18n/de/comments.js.map +1 -1
- package/dist/i18n/de/composites.js +62 -59
- package/dist/i18n/de/composites.js.map +1 -1
- package/dist/i18n/de/image-studio.js +11 -2
- package/dist/i18n/de/image-studio.js.map +1 -1
- package/dist/i18n/de/integrations.js +20 -20
- package/dist/i18n/de/integrations.js.map +1 -1
- package/dist/i18n/de/markdown.js +1 -1
- package/dist/i18n/de/markdown.js.map +1 -1
- package/dist/i18n/de/palette.js +1 -1
- package/dist/i18n/de/palette.js.map +1 -1
- package/dist/i18n/de/themes.js +3 -3
- package/dist/i18n/de/themes.js.map +1 -1
- package/dist/i18n/de/transfer.js +2 -2
- package/dist/i18n/de/transfer.js.map +1 -1
- package/dist/i18n/de/tree.js +6 -6
- package/dist/i18n/de/tree.js.map +1 -1
- package/dist/i18n/de.d.ts +110 -98
- package/dist/i18n/en/ai.js +2 -2
- package/dist/i18n/en/ai.js.map +1 -1
- package/dist/i18n/en/composites.js +64 -61
- package/dist/i18n/en/composites.js.map +1 -1
- package/dist/i18n/en/image-studio.js +9 -0
- package/dist/i18n/en/image-studio.js.map +1 -1
- package/dist/i18n/en/integrations.js +9 -9
- package/dist/i18n/en/integrations.js.map +1 -1
- package/dist/i18n/en/markdown.js +1 -1
- package/dist/i18n/en/markdown.js.map +1 -1
- package/dist/i18n/en/palette.js +1 -1
- package/dist/i18n/en/palette.js.map +1 -1
- package/dist/i18n/en/themes.js +4 -4
- package/dist/i18n/en/themes.js.map +1 -1
- package/dist/i18n/en/tree.js +5 -5
- package/dist/i18n/en/tree.js.map +1 -1
- package/dist/index.d.ts +4 -1
- package/dist/integrations/composite-ai/bibliography-fetch.d.ts +6 -6
- package/dist/integrations/composite-ai/bibliography-fetch.js +19 -19
- package/dist/integrations/composite-ai/bibliography-fetch.js.map +1 -1
- package/dist/integrations/composite-ai/composite-fill.d.ts +4 -4
- package/dist/integrations/composite-ai/composite-fill.js +5 -5
- package/dist/integrations/composite-ai/composite-fill.js.map +1 -1
- package/dist/integrations/composite-ai/composite-summary.d.ts +2 -2
- package/dist/integrations/composite-ai/composite-summary.js +5 -5
- package/dist/integrations/composite-ai/composite-summary.js.map +1 -1
- package/dist/integrations/composite-ai/derive.d.ts +17 -17
- package/dist/integrations/composite-ai/derive.js +27 -26
- package/dist/integrations/composite-ai/derive.js.map +1 -1
- package/dist/integrations/composite-ai/index.d.ts +14 -15
- package/dist/integrations/composite-ai/index.js +98 -77
- package/dist/integrations/composite-ai/index.js.map +1 -1
- package/dist/integrations/composite-ai/outline-sanitize.d.ts +1 -1
- package/dist/integrations/composite-ai/outline-sanitize.js +1 -1
- package/dist/integrations/composite-ai/outline-sanitize.js.map +1 -1
- package/dist/integrations/composite-ai/rendition.d.ts +9 -9
- package/dist/integrations/composite-ai/rendition.js +27 -27
- package/dist/integrations/composite-ai/rendition.js.map +1 -1
- package/dist/integrations/composite-ai/split.d.ts +8 -8
- package/dist/integrations/composite-ai/split.js +12 -12
- package/dist/integrations/composite-ai/split.js.map +1 -1
- package/dist/integrations/composite-ai/transfer-transforms.d.ts +2 -2
- package/dist/integrations/composite-ai/transfer-transforms.js +11 -11
- package/dist/integrations/composite-ai/transfer-transforms.js.map +1 -1
- package/dist/integrations/composite-media/index.d.ts +4 -3
- package/dist/integrations/composite-media/index.js +20 -14
- package/dist/integrations/composite-media/index.js.map +1 -1
- package/dist/markdown/MarkdownSurface.vue.d.ts +7 -7
- package/dist/markdown/document.js +1 -1
- package/dist/markdown/document.js.map +1 -1
- package/dist/nuxt/module.d.ts +48 -24
- package/dist/nuxt/module.js.map +1 -1
- package/dist/nuxt/runtime/server/plugins/editor-server.js +3 -2
- package/dist/nuxt/runtime/server/plugins/editor-server.js.map +1 -1
- package/dist/presets/compose.d.ts +6 -6
- package/dist/presets/compose.js +7 -4
- package/dist/presets/compose.js.map +1 -1
- package/dist/react/AdvancedEditor.d.ts +2 -2
- package/dist/react/AdvancedEditor.js +1 -1
- package/dist/react/AdvancedEditor.js.map +1 -1
- package/dist/react/compose.d.ts +1 -1
- package/dist/react/compose.js +1 -1
- package/dist/react/compose.js.map +1 -1
- package/dist/react/composed-surface.d.ts +5 -5
- package/dist/react/composed-surface.js +2 -2
- package/dist/react/composed-surface.js.map +1 -1
- package/dist/server/ai.d.ts +7 -7
- package/dist/server/ai.js +1 -1
- package/dist/server/ai.js.map +1 -1
- package/dist/server/auth.d.ts +1 -1
- package/dist/server/collab-state.d.ts +1 -1
- package/dist/server/collab-state.js.map +1 -1
- package/dist/server/collab.d.ts +4 -4
- package/dist/server/collab.js +22 -17
- package/dist/server/collab.js.map +1 -1
- package/dist/server/handlers/ai.d.ts +9 -6
- package/dist/server/handlers/ai.js +13 -17
- package/dist/server/handlers/ai.js.map +1 -1
- package/dist/server/handlers/context.d.ts +4 -0
- package/dist/server/handlers/context.js.map +1 -1
- package/dist/server/handlers/editor.d.ts +33 -32
- package/dist/server/handlers/editor.js +13 -8
- package/dist/server/handlers/editor.js.map +1 -1
- package/dist/server/handlers/images.d.ts +1 -1
- package/dist/server/handlers/images.js +1 -1
- package/dist/server/handlers/images.js.map +1 -1
- package/dist/server/host.d.ts +4 -0
- package/dist/server/host.js +10 -2
- package/dist/server/host.js.map +1 -1
- package/dist/server/index.d.ts +3 -3
- package/dist/server/ports.d.ts +8 -8
- package/dist/server/ports.js.map +1 -1
- package/dist/settings/index.d.ts +20 -19
- package/dist/settings/index.js +25 -24
- package/dist/settings/index.js.map +1 -1
- package/dist/settings/migrate.d.ts +18 -0
- package/dist/settings/migrate.js +46 -0
- package/dist/settings/migrate.js.map +1 -0
- package/dist/settings/values.d.ts +12 -12
- package/dist/settings/values.js +11 -11
- package/dist/settings/values.js.map +1 -1
- package/dist/styles/composites.css +10 -10
- package/dist/tree/DocumentTree.js +12 -5
- package/dist/tree/DocumentTree.js.map +1 -1
- package/dist/tree/drop-rules.js +5 -5
- package/dist/tree/drop-rules.js.map +1 -1
- package/dist/tree/react/DocumentTree.js +14 -5
- package/dist/tree/react/DocumentTree.js.map +1 -1
- package/dist/tree/tree-host.js +5 -5
- package/dist/tree/tree-host.js.map +1 -1
- package/dist/tree/tree-items.js +34 -28
- package/dist/tree/tree-items.js.map +1 -1
- package/dist/tree/tree-model.js +16 -16
- package/dist/tree/tree-model.js.map +1 -1
- package/dist/tree/tree-rows.js +2 -2
- package/dist/tree/tree-rows.js.map +1 -1
- package/dist/tree/tree-view-model.d.ts +2 -2
- package/dist/tree/tree-view-model.js.map +1 -1
- package/dist/vue/AdvancedEditor.js +2 -2
- package/dist/vue/AdvancedEditor.js.map +1 -1
- package/dist/vue/AdvancedEditor.vue.d.ts +10 -10
- package/dist/vue/SimpleEditor.vue.d.ts +4 -4
- package/dist/vue/components/EditorSurface.vue.d.ts +4 -4
- package/dist/vue/compose.d.ts +1 -1
- package/dist/vue/compose.js +1 -1
- package/dist/vue/compose.js.map +1 -1
- package/package.json +1 -1
- package/dist/features/composites/derivation.d.ts +0 -62
- package/dist/features/composites/derivation.js +0 -102
- package/dist/features/composites/derivation.js.map +0 -1
- package/dist/features/composites/kinds.d.ts +0 -89
- package/dist/features/composites/kinds.js +0 -285
- package/dist/features/composites/kinds.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transfer-transforms.js","names":[],"sources":["../../../src/integrations/composite-ai/transfer-transforms.ts"],"sourcesContent":["import type { JSONContent } from '@tiptap/core'\nimport
|
|
1
|
+
{"version":3,"file":"transfer-transforms.js","names":[],"sources":["../../../src/integrations/composite-ai/transfer-transforms.ts"],"sourcesContent":["import type { JSONContent } from '@tiptap/core'\nimport { aiContextOf, type BlockTransfer, DERIVATION_KEY, type Derivation } from '../../core'\nimport type { Creates } from '../../core/command-types'\nimport type { AiBlock } from '../../core/feature'\nimport { newBlockId } from '../../core/schema'\nimport { de } from '../../i18n/de'\nimport type { MessageKey } from '../../i18n'\nimport { AI_LIMITS, type AiTaskId, type ModelRef, modelProfiles, notifyAiRateLimited, postAiSse } from '../../features/ai'\nimport { compositeJSON } from '../../features/composites/schema'\nimport { type BlockTransform, type TransformContext, transferKindOf, transferSourceHash } from '../../features/transfer'\nimport { discardDerived, writeDerivedBody } from './derive'\n\n/** The task ids of the AI transforms. */\ntype TransferTask = Extract<AiTaskId, 'transfer-summary' | 'transfer-bullets'>\n\n/** The body of the `generate` request an AI transform sends: the dragged block's Markdown (cut to the task limit) as the selection. */\nexport function transferRequest(payload: BlockTransfer, blocks: readonly AiBlock[], model: ModelRef, task: TransferTask) {\n return { task, prompt: '', selection: payload.markdown.slice(0, AI_LIMITS.selection), context: '', blocks, model }\n}\n\ninterface AiTransformSpec {\n id: string\n label: string\n labelKey: MessageKey\n icon: string\n task: TransferTask\n /** `Derivation.method` of the new Typed block. */\n method: 'transform:summary' | 'transform:bullets'\n titleKey: 'transfer.summaryTitle' | 'transfer.bulletsTitle'\n}\n\n/** The `Creates` of the Typed block the AI transforms insert (`transferKindOf`). */\nconst compositeCreates = (ctx: TransformContext): Creates => ({ type: 'typedBlock', attrs: { blockType: transferKindOf(ctx.editor) } })\n\n/** Whether the AI transforms can run for this drop: an AI backend, the source's Markdown and the composite node in the schema. */\nconst aiAvailable = (ctx: TransformContext) => !!ctx.ai && ctx.payload.markdown.trim().length > 0 && ctx.editor.schema.nodes.typedBlock !== undefined\n\n/**\n * An AI transform: inserts an empty Typed block (Block type `transferKindOf`, titled after the source, `meta.derivation` naming the\n * source block and the transform), streams the model's answer (`transferRequest`) and writes it into the Typed block with the\n * write-back of „Ableiten (KI)“ (`writeDerivedBody`). A failed, aborted or empty run removes the Typed block again.\n */\nfunction aiTransform(spec: AiTransformSpec): BlockTransform {\n return {\n id: spec.id,\n label: spec.label,\n labelKey: spec.labelKey,\n icon: spec.icon,\n available: aiAvailable,\n creates: compositeCreates,\n run: async ({ editor, payload, pos, ai, app, notify, t }) => {\n if (!ai || !payload.markdown.trim()) return\n const derivation: Derivation | undefined = payload.blockId\n ? {\n from: { block: payload.blockId, ...(payload.documentId && { document: payload.documentId }) },\n method: spec.method,\n createdAt: new Date().toISOString(),\n inputHash: transferSourceHash(editor, payload),\n outputHash: '',\n }\n : undefined\n const id = newBlockId()\n const title = t(spec.titleKey, { title: payload.title.trim() || t('composites.untitled') })\n const json = compositeJSON(transferKindOf(editor))\n const [titleRow, ...rest] = json.content as JSONContent[]\n const created: JSONContent = {\n ...json,\n attrs: { ...json.attrs, id, ...(derivation && { meta: { [DERIVATION_KEY]: derivation } }) },\n content: [{ ...titleRow!, content: [{ type: 'text', text: title }] }, ...rest],\n }\n editor.view.dispatch(editor.state.tr.insert(pos, editor.schema.nodeFromJSON(created)).scrollIntoView())\n\n const toastId = `transfer-${id}`\n const controller = new AbortController()\n const abort = () => controller.abort()\n editor.on('destroy', abort)\n notify({ id: toastId, title: t('transfer.running', { title }), kind: 'info', icon: 'i-lucide-loader-circle', duration: 0 })\n const discard = () => discardDerived(editor, id)\n try {\n let output = ''\n const outcome = await postAiSse(ai, 'generate', transferRequest(payload, aiContextOf(editor).blocks, modelProfiles(app).modelRef('generate'), spec.task), { signal: controller.signal, t, onDelta: (text) => { output += text } })\n if (editor.isDestroyed) return\n if (outcome.status === 'aborted') {\n discard()\n return\n }\n if (outcome.status === 'rate-limited') {\n discard()\n notifyAiRateLimited(notify, t)\n return\n }\n if (outcome.status === 'error') {\n discard()\n notify({ title: t('integrations.compositeDerive.failed'), description: outcome.message, kind: 'error' })\n return\n }\n writeDerivedBody(editor, id, output, { ...(derivation && { derivation }), discard, notify, t, done: t('transfer.done', { title }) })\n }\n finally {\n notify.dismiss?.(toastId)\n editor.off('destroy', abort)\n }\n },\n }\n}\n\n/** „Zusammenfassung einfügen“: a new Typed block with a model-written summary of the dragged block (needs an AI backend). */\nexport const summaryTransform: BlockTransform = aiTransform({\n id: 'summary',\n label: de['transfer.summary'],\n labelKey: 'transfer.summary',\n icon: 'i-lucide-text-quote',\n task: 'transfer-summary',\n method: 'transform:summary',\n titleKey: 'transfer.summaryTitle',\n})\n\n/** „Stichpunkte einfügen“: a new Typed block with the dragged block's key statements as a list (needs an AI backend). */\nexport const bulletsTransform: BlockTransform = aiTransform({\n id: 'bullets',\n label: de['transfer.bullets'],\n labelKey: 'transfer.bullets',\n icon: 'i-lucide-list',\n task: 'transfer-bullets',\n method: 'transform:bullets',\n titleKey: 'transfer.bulletsTitle',\n})\n"],"mappings":";;;;;;;;;;;;;AAgBA,SAAgB,gBAAgB,SAAwB,QAA4B,OAAiB,MAAoB;CACvH,OAAO;EAAE;EAAM,QAAQ;EAAI,WAAW,QAAQ,SAAS,MAAM,GAAG,UAAU,SAAS;EAAG,SAAS;EAAI;EAAQ;CAAM;AACnH;;AAcA,MAAM,oBAAoB,SAAoC;CAAE,MAAM;CAAc,OAAO,EAAE,WAAW,eAAe,IAAI,MAAM,EAAE;AAAE;;AAGrI,MAAM,eAAe,QAA0B,CAAC,CAAC,IAAI,MAAM,IAAI,QAAQ,SAAS,KAAK,CAAC,CAAC,SAAS,KAAK,IAAI,OAAO,OAAO,MAAM,eAAe,KAAA;;;;;;AAO5I,SAAS,YAAY,MAAuC;C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down, or the
|
|
8
8
|
* uploaded media or file block; drop, paste, picker and recorder alike) into one composite titled with the
|
|
9
|
-
* file's name stem and carrying its filename, type, size and import date as meta. The
|
|
10
|
-
* audio and video become a `recording`, images a `figure`, everything
|
|
11
|
-
* Without
|
|
9
|
+
* file's name stem and carrying its filename, type, size and import date as meta. The Block type is the one whose
|
|
10
|
+
* `import` capability takes the file's media: by default audio and video become a `recording`, images a `figure`, everything
|
|
11
|
+
* else (PDFs, office files, text) a `document`. Without a Block type that takes the file, or without this feature, the
|
|
12
|
+
* blocks are inserted as they are.
|
|
12
13
|
* - **Actions:** the `/` command „Datei importieren“ (`datei`, ability `composite`) picks any files and imports them
|
|
13
14
|
* through `editor.storage.media.importFiles` at the caret; the block action „Quelle ersetzen“ (`source-replace`, on
|
|
14
15
|
* composites with a source block) uploads a new file into the existing source block, keeping its id.
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { ABILITY } from "../../core/schema/abilities.js";
|
|
2
2
|
import { blockIdOf, findBlockById } from "../../core/schema/block-ids.js";
|
|
3
3
|
import { fetchErrorMessage } from "../../core/fetch-error.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { importTypeOf } from "../../features/composites/block-types.js";
|
|
5
|
+
import { blockTypesOf, compositeJSON } from "../../features/composites/nodes.js";
|
|
6
|
+
import { sourceOf } from "../../features/composites/source.js";
|
|
6
7
|
import { acceptFor, mediaKindOf, mediaMime } from "../../features/media/schema.js";
|
|
7
8
|
import { pickFiles } from "../../features/media/upload.js";
|
|
8
9
|
import { isTextFile } from "../../features/media/file-import.js";
|
|
@@ -12,13 +13,12 @@ function stemOf(name) {
|
|
|
12
13
|
const dot = name.lastIndexOf(".");
|
|
13
14
|
return dot > 0 ? name.slice(0, dot) : name;
|
|
14
15
|
}
|
|
15
|
-
/** The
|
|
16
|
+
/** The Block type an imported `file` becomes: the type whose `import` capability takes the file's media (`importTypeOf`); undefined when no Block type takes it. */
|
|
16
17
|
function importKindOf(editor, file, text) {
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
return compositeKindsOf(editor).some((k) => k.id === id) ? id : "document";
|
|
18
|
+
const media = text ? null : mediaKindOf(file.type);
|
|
19
|
+
return importTypeOf(blockTypesOf(editor), media);
|
|
20
20
|
}
|
|
21
|
-
/** A
|
|
21
|
+
/** A Typed block of Block type `kind` titled with the stem of `file`'s name, holding its original name, type, size and import date. */
|
|
22
22
|
function documentComposite(kind, file, text, body) {
|
|
23
23
|
const composite = compositeJSON(kind, body);
|
|
24
24
|
const [title, ...rest] = composite.content;
|
|
@@ -26,7 +26,7 @@ function documentComposite(kind, file, text, body) {
|
|
|
26
26
|
return {
|
|
27
27
|
...composite,
|
|
28
28
|
attrs: {
|
|
29
|
-
kind,
|
|
29
|
+
blockType: kind,
|
|
30
30
|
meta: {
|
|
31
31
|
filename: file.name,
|
|
32
32
|
mimeType: mediaMime(file.type) || (text ? "text/markdown" : "application/octet-stream"),
|
|
@@ -49,7 +49,7 @@ function documentComposite(kind, file, text, body) {
|
|
|
49
49
|
* block keeps its attributes otherwise, its id included, and so do the composite and every reference to either.
|
|
50
50
|
*/
|
|
51
51
|
async function replaceSource(editor, composite, ctx) {
|
|
52
|
-
const source = sourceOf(composite,
|
|
52
|
+
const source = sourceOf(composite, blockTypesOf(editor));
|
|
53
53
|
const sourceId = source && blockIdOf(source.node);
|
|
54
54
|
if (!source || !sourceId) return;
|
|
55
55
|
const type = source.node.type.name;
|
|
@@ -96,7 +96,8 @@ function sourceActions(ctx) {
|
|
|
96
96
|
icon: "i-lucide-file-input",
|
|
97
97
|
ability: ABILITY.media,
|
|
98
98
|
order: 420,
|
|
99
|
-
|
|
99
|
+
requires: ["source"],
|
|
100
|
+
isVisible: ({ editor, node }) => sourceOf(node, blockTypesOf(editor)) !== null,
|
|
100
101
|
run: ({ editor, node }) => {
|
|
101
102
|
replaceSource(editor, node, ctx);
|
|
102
103
|
}
|
|
@@ -107,9 +108,10 @@ function sourceActions(ctx) {
|
|
|
107
108
|
*
|
|
108
109
|
* - **Wrapping:** the `wrapImport` stage puts the blocks of every imported file (parsed text or Markdown, or the
|
|
109
110
|
* uploaded media or file block; drop, paste, picker and recorder alike) into one composite titled with the
|
|
110
|
-
* file's name stem and carrying its filename, type, size and import date as meta. The
|
|
111
|
-
* audio and video become a `recording`, images a `figure`, everything
|
|
112
|
-
* Without
|
|
111
|
+
* file's name stem and carrying its filename, type, size and import date as meta. The Block type is the one whose
|
|
112
|
+
* `import` capability takes the file's media: by default audio and video become a `recording`, images a `figure`, everything
|
|
113
|
+
* else (PDFs, office files, text) a `document`. Without a Block type that takes the file, or without this feature, the
|
|
114
|
+
* blocks are inserted as they are.
|
|
113
115
|
* - **Actions:** the `/` command „Datei importieren“ (`datei`, ability `composite`) picks any files and imports them
|
|
114
116
|
* through `editor.storage.media.importFiles` at the caret; the block action „Quelle ersetzen“ (`source-replace`, on
|
|
115
117
|
* composites with a source block) uploads a new file into the existing source block, keeping its id.
|
|
@@ -122,7 +124,11 @@ function compositeMediaFeature() {
|
|
|
122
124
|
id: "composite-media",
|
|
123
125
|
dimension: "content",
|
|
124
126
|
requires: ["composites", "media"],
|
|
125
|
-
blocks: { wrapImport: (editor, file, blocks) =>
|
|
127
|
+
blocks: { wrapImport: (editor, file, blocks) => {
|
|
128
|
+
const text = isTextFile(file);
|
|
129
|
+
const kind = importKindOf(editor, file, text);
|
|
130
|
+
return kind ? [documentComposite(kind, file, text, blocks)] : blocks;
|
|
131
|
+
} },
|
|
126
132
|
blockActions: sourceActions,
|
|
127
133
|
commands: (ctx) => [{
|
|
128
134
|
id: "datei",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../src/integrations/composite-media/index.ts"],"sourcesContent":["import type { Editor, JSONContent } from '@tiptap/core'\nimport type { Node as PMNode } from '@tiptap/pm/model'\nimport { type BlockAction, type EditorFeature, type FeatureContext, fetchErrorMessage } from '../../core'\nimport { ABILITY, blockIdOf, findBlockById } from '../../core/schema'\nimport { compositeJSON,
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/integrations/composite-media/index.ts"],"sourcesContent":["import type { Editor, JSONContent } from '@tiptap/core'\nimport type { Node as PMNode } from '@tiptap/pm/model'\nimport { type BlockAction, type EditorFeature, type FeatureContext, fetchErrorMessage } from '../../core'\nimport { ABILITY, blockIdOf, findBlockById } from '../../core/schema'\nimport { blockTypesOf, compositeJSON, importTypeOf, sourceOf } from '../../features/composites/schema'\nimport { isTextFile, pickFiles } from '../../features/media'\nimport { acceptFor, type MediaKind, mediaKindOf, mediaMime } from '../../features/media/schema'\n\n/** The file name without its last extension; the whole name when nothing else is left (`.env`). */\nfunction stemOf(name: string): string {\n const dot = name.lastIndexOf('.')\n return dot > 0 ? name.slice(0, dot) : name\n}\n\n/** The Block type an imported `file` becomes: the type whose `import` capability takes the file's media (`importTypeOf`); undefined when no Block type takes it. */\nfunction importKindOf(editor: Editor, file: File, text: boolean): string | undefined {\n const media = text ? null : mediaKindOf(file.type)\n return importTypeOf(blockTypesOf(editor), media)\n}\n\n/** A Typed block of Block type `kind` titled with the stem of `file`'s name, holding its original name, type, size and import date. */\nfunction documentComposite(kind: string, file: File, text: boolean, body: JSONContent[]): JSONContent {\n const composite = compositeJSON(kind, body)\n const [title, ...rest] = composite.content!\n const stem = stemOf(file.name)\n return {\n ...composite,\n attrs: {\n blockType: kind,\n meta: {\n filename: file.name,\n mimeType: mediaMime(file.type) || (text ? 'text/markdown' : 'application/octet-stream'),\n size: file.size,\n importedAt: new Date().toISOString().slice(0, 10),\n },\n },\n content: [stem ? { ...title!, content: [{ type: 'text', text: stem }] } : title!, ...rest],\n }\n}\n\n/**\n * Swaps the source file of `composite` in place: picks a file of the source block's media type, uploads it and rewrites\n * `src`, `hash`, `mimeType`, `title` and `size` of the existing source block (those of them its node type has). The\n * block keeps its attributes otherwise, its id included, and so do the composite and every reference to either.\n */\nasync function replaceSource(editor: Editor, composite: PMNode, ctx: FeatureContext): Promise<void> {\n const source = sourceOf(composite, blockTypesOf(editor))\n const sourceId = source && blockIdOf(source.node)\n if (!source || !sourceId) return\n const type = source.node.type.name\n const [file] = await pickFiles(acceptFor(type as MediaKind), false)\n if (!file || editor.isDestroyed) return\n try {\n if ((mediaKindOf(file.type) ?? 'file') !== type) throw new Error(`${file.type || file.name}: ${type}`)\n const { url, sha256 } = await editor.storage.media.upload(file)\n if (editor.isDestroyed) return\n // The upload takes a while: the source block is found again by its id.\n const target = findBlockById(editor.state.doc, sourceId)\n if (!target) {\n ctx.notify({ title: ctx.t('integrations.sourceReplace.gone'), kind: 'error' })\n return\n }\n const next: Record<string, unknown> = {\n src: url,\n hash: sha256 ?? null,\n mimeType: mediaMime(file.type) || 'application/octet-stream',\n title: file.name,\n size: file.size,\n }\n const attrs: Record<string, unknown> = { ...target.node.attrs }\n for (const [key, value] of Object.entries(next)) if (key in attrs) attrs[key] = value\n editor.view.dispatch(editor.state.tr.setNodeMarkup(target.pos, undefined, attrs))\n ctx.notify({ title: ctx.t('integrations.sourceReplace.done'), kind: 'success' })\n }\n catch (error) {\n ctx.notify({ title: ctx.t('integrations.sourceReplace.failed'), description: fetchErrorMessage(error), kind: 'error' })\n }\n}\n\nfunction sourceActions(ctx: FeatureContext): BlockAction[] {\n return [{\n id: 'source-replace',\n label: ctx.t('integrations.sourceReplace.action'),\n icon: 'i-lucide-file-input',\n ability: ABILITY.media,\n order: 420,\n requires: ['source'],\n isVisible: ({ editor, node }) => sourceOf(node, blockTypesOf(editor)) !== null,\n run: ({ editor, node }) => {\n void replaceSource(editor, node, ctx)\n },\n }]\n}\n\n/**\n * File import into composites. Needs the `composites` and `media` features; neither imports this one.\n *\n * - **Wrapping:** the `wrapImport` stage puts the blocks of every imported file (parsed text or Markdown, or the\n * uploaded media or file block; drop, paste, picker and recorder alike) into one composite titled with the\n * file's name stem and carrying its filename, type, size and import date as meta. The Block type is the one whose\n * `import` capability takes the file's media: by default audio and video become a `recording`, images a `figure`, everything\n * else (PDFs, office files, text) a `document`. Without a Block type that takes the file, or without this feature, the\n * blocks are inserted as they are.\n * - **Actions:** the `/` command „Datei importieren“ (`datei`, ability `composite`) picks any files and imports them\n * through `editor.storage.media.importFiles` at the caret; the block action „Quelle ersetzen“ (`source-replace`, on\n * composites with a source block) uploads a new file into the existing source block, keeping its id.\n *\n * Install it anywhere after `composites` and `media`; the `/` entry follows the order of the feature list. Framework-free\n * (`EditorFeature<never>`: no component slots), so one instance serves the Vue and the React surface.\n */\nexport function compositeMediaFeature(): EditorFeature<never> {\n return {\n id: 'composite-media',\n dimension: 'content',\n requires: ['composites', 'media'],\n blocks: {\n wrapImport: (editor, file, blocks) => {\n const text = isTextFile(file)\n const kind = importKindOf(editor, file, text)\n return kind ? [documentComposite(kind, file, text, blocks)] : blocks\n },\n },\n blockActions: sourceActions,\n commands: ctx => [{\n id: 'datei',\n slash: {},\n label: ctx.t('integrations.compositeMedia.import'),\n icon: 'i-lucide-file-up',\n ability: ABILITY.composite,\n run: (editor) => {\n const pos = editor.state.selection.from\n void pickFiles('*/*').then((files) => {\n if (files.length && !editor.isDestroyed) return editor.storage.media.importFiles(editor, files, pos)\n })\n },\n }],\n }\n}\n"],"mappings":";;;;;;;;;;;AASA,SAAS,OAAO,MAAsB;CACpC,MAAM,MAAM,KAAK,YAAY,GAAG;CAChC,OAAO,MAAM,IAAI,KAAK,MAAM,GAAG,GAAG,IAAI;AACxC;;AAGA,SAAS,aAAa,QAAgB,MAAY,MAAmC;CACnF,MAAM,QAAQ,OAAO,OAAO,YAAY,KAAK,IAAI;CACjD,OAAO,aAAa,aAAa,MAAM,GAAG,KAAK;AACjD;;AAGA,SAAS,kBAAkB,MAAc,MAAY,MAAe,MAAkC;CACpG,MAAM,YAAY,cAAc,MAAM,IAAI;CAC1C,MAAM,CAAC,OAAO,GAAG,QAAQ,UAAU;CACnC,MAAM,OAAO,OAAO,KAAK,IAAI;CAC7B,OAAO;EACL,GAAG;EACH,OAAO;GACL,WAAW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Q,OAAO,GAAG;IACrG,CAAC;GACH;EACF,CAAC;CACH;AACF"}
|
|
@@ -41,29 +41,29 @@ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {
|
|
|
41
41
|
settingsOpen: import("vue").WritableComputedRef<boolean, boolean>;
|
|
42
42
|
settingsTab: import("vue").WritableComputedRef<string | undefined, string | undefined>;
|
|
43
43
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
44
|
-
settingsOpen: (tab?: string | undefined) => any;
|
|
45
44
|
"update:sidebarOpen": (value: boolean) => any;
|
|
46
45
|
"update:commentsOpen": (value: boolean) => any;
|
|
47
|
-
"update:modelValue": (markdown: string) => any;
|
|
48
|
-
frontmatter: (frontmatter: string | null) => any;
|
|
49
46
|
ready: (editor: Editor) => any;
|
|
47
|
+
"update:modelValue": (markdown: string) => any;
|
|
50
48
|
metadataCreate: (list: string, item: MetadataItem) => any;
|
|
51
49
|
contentError: (error: Error) => any;
|
|
50
|
+
settingsOpen: (tab?: string | undefined) => any;
|
|
51
|
+
frontmatter: (frontmatter: string | null) => any;
|
|
52
52
|
diagnostics: (diagnostics: MarkdownDiagnostic[]) => any;
|
|
53
53
|
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
54
|
-
onSettingsOpen?: ((tab?: string | undefined) => any) | undefined;
|
|
55
54
|
"onUpdate:sidebarOpen"?: ((value: boolean) => any) | undefined;
|
|
56
55
|
"onUpdate:commentsOpen"?: ((value: boolean) => any) | undefined;
|
|
57
|
-
"onUpdate:modelValue"?: ((markdown: string) => any) | undefined;
|
|
58
|
-
onFrontmatter?: ((frontmatter: string | null) => any) | undefined;
|
|
59
56
|
onReady?: ((editor: Editor) => any) | undefined;
|
|
57
|
+
"onUpdate:modelValue"?: ((markdown: string) => any) | undefined;
|
|
60
58
|
onMetadataCreate?: ((list: string, item: MetadataItem) => any) | undefined;
|
|
61
59
|
onContentError?: ((error: Error) => any) | undefined;
|
|
60
|
+
onSettingsOpen?: ((tab?: string | undefined) => any) | undefined;
|
|
61
|
+
onFrontmatter?: ((frontmatter: string | null) => any) | undefined;
|
|
62
62
|
onDiagnostics?: ((diagnostics: MarkdownDiagnostic[]) => any) | undefined;
|
|
63
63
|
}>, {
|
|
64
|
-
modelValue: string;
|
|
65
64
|
editable: boolean;
|
|
66
65
|
settingsUi: "internal" | "external";
|
|
66
|
+
modelValue: string;
|
|
67
67
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
68
68
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
69
69
|
declare const _default: typeof __VLS_export;
|
|
@@ -76,7 +76,7 @@ function markdownToContent(editor, body, options = {}) {
|
|
|
76
76
|
diagnostics.push({
|
|
77
77
|
code: "unknown-fence",
|
|
78
78
|
severity: "info",
|
|
79
|
-
message: t("markdown.diagnostic.unknownFence", { kind: String(fence.attrs?.
|
|
79
|
+
message: t("markdown.diagnostic.unknownFence", { kind: String(fence.attrs?.blockType) }),
|
|
80
80
|
...line && { line }
|
|
81
81
|
});
|
|
82
82
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"document.js","names":[],"sources":["../../src/markdown/document.ts"],"sourcesContent":["import type { Editor, JSONContent } from '@tiptap/core'\nimport { splitFences } from '../core/fences'\nimport { parseBlocks, pipelineOf } from '../core/pipeline'\nimport { EMPTY_EDITOR_CONTENT } from '../core/schema'\nimport { editorEntryOf } from '../core/editor-ui'\nimport { createTranslator, type Translate } from '../i18n'\nimport { enforceUrlPolicy, locate, type MarkdownDiagnostic, type MarkdownPolicy } from './policy'\n\n/** A Markdown body as document JSON, with what the parse dropped or could not understand. */\nexport interface MarkdownContent {\n content: JSONContent\n diagnostics: MarkdownDiagnostic[]\n}\n\n/** The part of `@tiptap/markdown`'s manager the HTML policy swaps out for the duration of one parse. */\ninterface HtmlParsing {\n parseHTMLToken: (token: { raw?: string, text?: string }) => unknown\n}\n\n/**\n * Runs `parse` with raw HTML tokens (block and inline, tags and comments) dropped instead of handed to the schema's\n * `parseHTML` rules, and reports each in `diagnostics`.\n */\nfunction withoutRawHtml<T>(editor: Editor, source: string, diagnostics: MarkdownDiagnostic[], t: Translate, parse: () => T): T {\n const manager = editor.markdown as unknown as HtmlParsing | undefined\n if (!manager) return parse()\n const own = Object.hasOwn(manager, 'parseHTMLToken')\n const original = manager.parseHTMLToken\n let from = 0\n manager.parseHTMLToken = (token) => {\n const html = (token.raw ?? token.text ?? '').trim()\n if (html) {\n const { line, next } = locate(source, html, from)\n from = next\n diagnostics.push({ code: 'raw-html', severity: 'warning', message: t('markdown.diagnostic.rawHtml', { html: JSON.stringify(html.length > 60 ? `${html.slice(0, 57)}…` : html) }), ...(line && { line }) })\n }\n return null\n }\n try {\n return parse()\n }\n finally {\n if (own) manager.parseHTMLToken = original\n else delete (manager as Partial<HtmlParsing>).parseHTMLToken\n }\n}\n\nconst opaqueFences = (node: JSONContent): JSONContent[] => [...(node.type === 'opaqueFence' ? [node] : []), ...(node.content ?? []).flatMap(opaqueFences)]\n\n/**\n * `body` (Markdown without frontmatter) as the document JSON of `editor`, plus `diagnostics`: the preset's block\n * pipeline parses it (`parseBlocks`: Markdown tokens, then the features' normalize and segment stages), the blocks\n * become the children of a `doc`, `policy` is enforced and the preset's `migrateContent` stage runs. An empty body is\n * the empty document (one empty paragraph). Nothing is applied to the editor.\n *\n * The diagnostics' `message` is in the language of `options.t`, by default that of the editor's registered surface, else\n * the default locale.\n *\n * Diagnostics: `raw-html` (dropped unless `policy.allowHtml`), `unsafe-url` (links and media with a scheme other than\n * http(s), mailto and tel are dropped; base64 `data:image` URLs are kept only with `policy.allowDataUrls`),\n * `unknown-fence` (a `:::` fence of a kind no feature registered, kept verbatim as an `opaqueFence`), and the fatal\n * `unclosed-fence` and `invalid-fence-meta` (a fence opener that stayed plain text).\n */\nexport function markdownToContent(editor: Editor, body: string, options: { policy?: MarkdownPolicy, t?: Translate } = {}): MarkdownContent {\n const policy = options.policy ?? {}\n const t = options.t ?? editorEntryOf(editor)?.ctx.t ?? createTranslator()\n const diagnostics: MarkdownDiagnostic[] = []\n\n const { blocks } = policy.allowHtml ? parseBlocks(editor, body) : withoutRawHtml(editor, body, diagnostics, t, () => parseBlocks(editor, body))\n let content: JSONContent = blocks.length ? { type: 'doc', content: blocks } : EMPTY_EDITOR_CONTENT\n content = enforceUrlPolicy(content, policy, body, diagnostics, t)\n if (!content.content?.length) content = EMPTY_EDITOR_CONTENT\n\n for (const problem of splitFences(body).problems) {\n diagnostics.push({\n code: problem.code,\n severity: 'error',\n line: problem.line,\n message: t(problem.code === 'unclosed-fence' ? 'markdown.diagnostic.unclosedFence' : 'markdown.diagnostic.invalidFenceMeta', { kind: problem.kind }),\n })\n }\n let from = 0\n for (const fence of opaqueFences(content)) {\n const raw = String(fence.attrs?.raw ?? '')\n const { line, next } = locate(body, raw, from)\n from = next\n diagnostics.push({ code: 'unknown-fence', severity: 'info', message: t('markdown.diagnostic.unknownFence', { kind: String(fence.attrs?.
|
|
1
|
+
{"version":3,"file":"document.js","names":[],"sources":["../../src/markdown/document.ts"],"sourcesContent":["import type { Editor, JSONContent } from '@tiptap/core'\nimport { splitFences } from '../core/fences'\nimport { parseBlocks, pipelineOf } from '../core/pipeline'\nimport { EMPTY_EDITOR_CONTENT } from '../core/schema'\nimport { editorEntryOf } from '../core/editor-ui'\nimport { createTranslator, type Translate } from '../i18n'\nimport { enforceUrlPolicy, locate, type MarkdownDiagnostic, type MarkdownPolicy } from './policy'\n\n/** A Markdown body as document JSON, with what the parse dropped or could not understand. */\nexport interface MarkdownContent {\n content: JSONContent\n diagnostics: MarkdownDiagnostic[]\n}\n\n/** The part of `@tiptap/markdown`'s manager the HTML policy swaps out for the duration of one parse. */\ninterface HtmlParsing {\n parseHTMLToken: (token: { raw?: string, text?: string }) => unknown\n}\n\n/**\n * Runs `parse` with raw HTML tokens (block and inline, tags and comments) dropped instead of handed to the schema's\n * `parseHTML` rules, and reports each in `diagnostics`.\n */\nfunction withoutRawHtml<T>(editor: Editor, source: string, diagnostics: MarkdownDiagnostic[], t: Translate, parse: () => T): T {\n const manager = editor.markdown as unknown as HtmlParsing | undefined\n if (!manager) return parse()\n const own = Object.hasOwn(manager, 'parseHTMLToken')\n const original = manager.parseHTMLToken\n let from = 0\n manager.parseHTMLToken = (token) => {\n const html = (token.raw ?? token.text ?? '').trim()\n if (html) {\n const { line, next } = locate(source, html, from)\n from = next\n diagnostics.push({ code: 'raw-html', severity: 'warning', message: t('markdown.diagnostic.rawHtml', { html: JSON.stringify(html.length > 60 ? `${html.slice(0, 57)}…` : html) }), ...(line && { line }) })\n }\n return null\n }\n try {\n return parse()\n }\n finally {\n if (own) manager.parseHTMLToken = original\n else delete (manager as Partial<HtmlParsing>).parseHTMLToken\n }\n}\n\nconst opaqueFences = (node: JSONContent): JSONContent[] => [...(node.type === 'opaqueFence' ? [node] : []), ...(node.content ?? []).flatMap(opaqueFences)]\n\n/**\n * `body` (Markdown without frontmatter) as the document JSON of `editor`, plus `diagnostics`: the preset's block\n * pipeline parses it (`parseBlocks`: Markdown tokens, then the features' normalize and segment stages), the blocks\n * become the children of a `doc`, `policy` is enforced and the preset's `migrateContent` stage runs. An empty body is\n * the empty document (one empty paragraph). Nothing is applied to the editor.\n *\n * The diagnostics' `message` is in the language of `options.t`, by default that of the editor's registered surface, else\n * the default locale.\n *\n * Diagnostics: `raw-html` (dropped unless `policy.allowHtml`), `unsafe-url` (links and media with a scheme other than\n * http(s), mailto and tel are dropped; base64 `data:image` URLs are kept only with `policy.allowDataUrls`),\n * `unknown-fence` (a `:::` fence of a kind no feature registered, kept verbatim as an `opaqueFence`), and the fatal\n * `unclosed-fence` and `invalid-fence-meta` (a fence opener that stayed plain text).\n */\nexport function markdownToContent(editor: Editor, body: string, options: { policy?: MarkdownPolicy, t?: Translate } = {}): MarkdownContent {\n const policy = options.policy ?? {}\n const t = options.t ?? editorEntryOf(editor)?.ctx.t ?? createTranslator()\n const diagnostics: MarkdownDiagnostic[] = []\n\n const { blocks } = policy.allowHtml ? parseBlocks(editor, body) : withoutRawHtml(editor, body, diagnostics, t, () => parseBlocks(editor, body))\n let content: JSONContent = blocks.length ? { type: 'doc', content: blocks } : EMPTY_EDITOR_CONTENT\n content = enforceUrlPolicy(content, policy, body, diagnostics, t)\n if (!content.content?.length) content = EMPTY_EDITOR_CONTENT\n\n for (const problem of splitFences(body).problems) {\n diagnostics.push({\n code: problem.code,\n severity: 'error',\n line: problem.line,\n message: t(problem.code === 'unclosed-fence' ? 'markdown.diagnostic.unclosedFence' : 'markdown.diagnostic.invalidFenceMeta', { kind: problem.kind }),\n })\n }\n let from = 0\n for (const fence of opaqueFences(content)) {\n const raw = String(fence.attrs?.raw ?? '')\n const { line, next } = locate(body, raw, from)\n from = next\n diagnostics.push({ code: 'unknown-fence', severity: 'info', message: t('markdown.diagnostic.unknownFence', { kind: String(fence.attrs?.blockType) }), ...(line && { line }) })\n }\n\n return { content: pipelineOf(editor).migrateContent(content), diagnostics }\n}\n\n/**\n * The document of `editor` as Markdown (`editor.getMarkdown()`: the registered Markdown handlers render every node,\n * tables as pipe tables and task items as `- [ ]`/`- [x]`), without trailing line breaks: Tiptap keeps an empty\n * paragraph after a last block that is not a paragraph, and it is not content. Callers that write files add their own\n * final line break.\n */\nexport function contentToMarkdown(editor: Editor): string {\n return editor.getMarkdown().replace(/\\n+$/, '')\n}\n"],"mappings":";;;;;;;;;;;AAuBA,SAAS,eAAkB,QAAgB,QAAgB,aAAmC,GAAc,OAAmB;CAC7H,MAAM,UAAU,OAAO;CACvB,IAAI,CAAC,SAAS,OAAO,MAAM;CAC3B,MAAM,MAAM,OAAO,OAAO,SAAS,gBAAgB;CACnD,MAAM,WAAW,QAAQ;CACzB,IAAI,OAAO;CACX,QAAQ,kBAAkB,UAAU;EAClC,MAAM,QAAQ,MAAM,OAAO,MAAM,QAAQ,GAAA,CAAI,KAAK;EAClD,IAAI,MAAM;GAC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Q,KAAK,CAAC;CACrJ,CAAC;CAEH,IAAI,OAAO;CACX,KAAK,MAAM,SAAS,aAAa,OAAO,GAAG;EACzC,MAAM,MAAM,OAAO,MAAM,OAAO,OAAO,EAAE;EACzC,MAAM,EAAE,MAAM,SAAS,OAAO,MAAM,KAAK,IAAI;EAC7C,OAAO;EACP,YAAY,KAAK;GAAE,MAAM;GAAiB,UAAU;GAAQ,SAAS,EAAE,oCAAoC,EAAE,MAAM,OAAO,MAAM,OAAO,SAAS,EAAE,CAAC;GAAG,GAAI,QAAQ,EAAE,KAAK;EAAG,CAAC;CAC/K;CAEA,OAAO;EAAE,SAAS,WAAW,MAAM,CAAC,CAAC,eAAe,OAAO;EAAG;CAAY;AAC5E;;;;;;;AAQA,SAAgB,kBAAkB,QAAwB;CACxD,OAAO,OAAO,YAAY,CAAC,CAAC,QAAQ,QAAQ,EAAE;AAChD"}
|
package/dist/nuxt/module.d.ts
CHANGED
|
@@ -246,6 +246,15 @@ declare const _default: import("@nuxt/schema").NuxtModule<{
|
|
|
246
246
|
"imageStudio.dialog.chat.running"?: string | undefined;
|
|
247
247
|
"imageStudio.dialog.chat.fromDescription"?: string | undefined;
|
|
248
248
|
"imageStudio.dialog.chat.turnImage"?: string | undefined;
|
|
249
|
+
"imageStudio.dialog.tabs.block"?: string | undefined;
|
|
250
|
+
"imageStudio.dialog.tabs.library"?: string | undefined;
|
|
251
|
+
"imageStudio.dialog.library.search"?: string | undefined;
|
|
252
|
+
"imageStudio.dialog.library.loading"?: string | undefined;
|
|
253
|
+
"imageStudio.dialog.library.empty"?: string | undefined;
|
|
254
|
+
"imageStudio.dialog.library.failed"?: string | undefined;
|
|
255
|
+
"imageStudio.dialog.library.reference"?: string | undefined;
|
|
256
|
+
"imageStudio.dialog.library.rename"?: string | undefined;
|
|
257
|
+
"imageStudio.dialog.library.remove"?: string | undefined;
|
|
249
258
|
"imageStudio.node.noDescription"?: string | undefined;
|
|
250
259
|
"imageStudio.node.open"?: string | undefined;
|
|
251
260
|
"imageStudio.node.dialogTitle"?: string | undefined;
|
|
@@ -416,6 +425,7 @@ declare const _default: import("@nuxt/schema").NuxtModule<{
|
|
|
416
425
|
"composites.derivation.badge"?: string | undefined;
|
|
417
426
|
"composites.derivation.stale"?: string | undefined;
|
|
418
427
|
"composites.derivation.foreign"?: string | undefined;
|
|
428
|
+
"composites.derivation.sourceMissing"?: string | undefined;
|
|
419
429
|
"composites.derivation.edited"?: string | undefined;
|
|
420
430
|
"composites.derivation.expand"?: string | undefined;
|
|
421
431
|
"composites.derivation.collapse"?: string | undefined;
|
|
@@ -443,6 +453,8 @@ declare const _default: import("@nuxt/schema").NuxtModule<{
|
|
|
443
453
|
"composites.inspector.mentions"?: string | undefined;
|
|
444
454
|
"composites.inspector.composite"?: string | undefined;
|
|
445
455
|
"composites.inspector.kind"?: string | undefined;
|
|
456
|
+
"composites.inspector.properties"?: string | undefined;
|
|
457
|
+
"composites.inspector.derivation"?: string | undefined;
|
|
446
458
|
"composites.inspector.title"?: string | undefined;
|
|
447
459
|
"composites.inspector.titleHelp"?: string | undefined;
|
|
448
460
|
"composites.inspector.untitled"?: string | undefined;
|
|
@@ -475,8 +487,8 @@ declare const _default: import("@nuxt/schema").NuxtModule<{
|
|
|
475
487
|
"composites.settings.structure.legend"?: string | undefined;
|
|
476
488
|
"composites.settings.structure.flat.label"?: string | undefined;
|
|
477
489
|
"composites.settings.structure.flat.description"?: string | undefined;
|
|
478
|
-
"composites.settings.structure.
|
|
479
|
-
"composites.settings.structure.
|
|
490
|
+
"composites.settings.structure.structured.label"?: string | undefined;
|
|
491
|
+
"composites.settings.structure.structured.description"?: string | undefined;
|
|
480
492
|
"composites.settings.scope.legend"?: string | undefined;
|
|
481
493
|
"composites.settings.scope.container.label"?: string | undefined;
|
|
482
494
|
"composites.settings.scope.container.description"?: string | undefined;
|
|
@@ -491,13 +503,13 @@ declare const _default: import("@nuxt/schema").NuxtModule<{
|
|
|
491
503
|
"composites.settings.treeRoot.file.label"?: string | undefined;
|
|
492
504
|
"composites.settings.treeRoot.file.description"?: string | undefined;
|
|
493
505
|
"composites.settings.composites.title"?: string | undefined;
|
|
494
|
-
"composites.settings.
|
|
495
|
-
"composites.settings.
|
|
496
|
-
"composites.settings.
|
|
497
|
-
"composites.settings.
|
|
498
|
-
"composites.settings.
|
|
499
|
-
"composites.settings.
|
|
500
|
-
"composites.settings.
|
|
506
|
+
"composites.settings.defaultBlockType.label"?: string | undefined;
|
|
507
|
+
"composites.settings.defaultBlockType.description"?: string | undefined;
|
|
508
|
+
"composites.settings.blockTypeIcon.legend"?: string | undefined;
|
|
509
|
+
"composites.settings.blockTypeIcon.always.label"?: string | undefined;
|
|
510
|
+
"composites.settings.blockTypeIcon.always.description"?: string | undefined;
|
|
511
|
+
"composites.settings.blockTypeIcon.hover.label"?: string | undefined;
|
|
512
|
+
"composites.settings.blockTypeIcon.hover.description"?: string | undefined;
|
|
501
513
|
"composites.settings.dragHandle.legend"?: string | undefined;
|
|
502
514
|
"composites.settings.dragHandle.hover.label"?: string | undefined;
|
|
503
515
|
"composites.settings.dragHandle.hover.description"?: string | undefined;
|
|
@@ -709,8 +721,8 @@ declare const _default: import("@nuxt/schema").NuxtModule<{
|
|
|
709
721
|
"ai.settings.autocomplete.description"?: string | undefined;
|
|
710
722
|
"ai.settings.language.label"?: string | undefined;
|
|
711
723
|
"ai.settings.language.description"?: string | undefined;
|
|
712
|
-
"ai.settings.
|
|
713
|
-
"ai.settings.
|
|
724
|
+
"ai.settings.roles.title"?: string | undefined;
|
|
725
|
+
"ai.settings.roles.description"?: string | undefined;
|
|
714
726
|
"ai.settings.profiles.title"?: string | undefined;
|
|
715
727
|
"ai.settings.profiles.description"?: string | undefined;
|
|
716
728
|
"ai.profiles.server"?: string | undefined;
|
|
@@ -775,7 +787,7 @@ declare const _default: import("@nuxt/schema").NuxtModule<{
|
|
|
775
787
|
} | undefined;
|
|
776
788
|
} | undefined;
|
|
777
789
|
apiKey?: string | undefined;
|
|
778
|
-
|
|
790
|
+
roles?: {
|
|
779
791
|
complete?: string | undefined;
|
|
780
792
|
rewrite?: string | undefined;
|
|
781
793
|
generate?: string | undefined;
|
|
@@ -1033,6 +1045,15 @@ declare const _default: import("@nuxt/schema").NuxtModule<{
|
|
|
1033
1045
|
"imageStudio.dialog.chat.running"?: string | undefined;
|
|
1034
1046
|
"imageStudio.dialog.chat.fromDescription"?: string | undefined;
|
|
1035
1047
|
"imageStudio.dialog.chat.turnImage"?: string | undefined;
|
|
1048
|
+
"imageStudio.dialog.tabs.block"?: string | undefined;
|
|
1049
|
+
"imageStudio.dialog.tabs.library"?: string | undefined;
|
|
1050
|
+
"imageStudio.dialog.library.search"?: string | undefined;
|
|
1051
|
+
"imageStudio.dialog.library.loading"?: string | undefined;
|
|
1052
|
+
"imageStudio.dialog.library.empty"?: string | undefined;
|
|
1053
|
+
"imageStudio.dialog.library.failed"?: string | undefined;
|
|
1054
|
+
"imageStudio.dialog.library.reference"?: string | undefined;
|
|
1055
|
+
"imageStudio.dialog.library.rename"?: string | undefined;
|
|
1056
|
+
"imageStudio.dialog.library.remove"?: string | undefined;
|
|
1036
1057
|
"imageStudio.node.noDescription"?: string | undefined;
|
|
1037
1058
|
"imageStudio.node.open"?: string | undefined;
|
|
1038
1059
|
"imageStudio.node.dialogTitle"?: string | undefined;
|
|
@@ -1203,6 +1224,7 @@ declare const _default: import("@nuxt/schema").NuxtModule<{
|
|
|
1203
1224
|
"composites.derivation.badge"?: string | undefined;
|
|
1204
1225
|
"composites.derivation.stale"?: string | undefined;
|
|
1205
1226
|
"composites.derivation.foreign"?: string | undefined;
|
|
1227
|
+
"composites.derivation.sourceMissing"?: string | undefined;
|
|
1206
1228
|
"composites.derivation.edited"?: string | undefined;
|
|
1207
1229
|
"composites.derivation.expand"?: string | undefined;
|
|
1208
1230
|
"composites.derivation.collapse"?: string | undefined;
|
|
@@ -1230,6 +1252,8 @@ declare const _default: import("@nuxt/schema").NuxtModule<{
|
|
|
1230
1252
|
"composites.inspector.mentions"?: string | undefined;
|
|
1231
1253
|
"composites.inspector.composite"?: string | undefined;
|
|
1232
1254
|
"composites.inspector.kind"?: string | undefined;
|
|
1255
|
+
"composites.inspector.properties"?: string | undefined;
|
|
1256
|
+
"composites.inspector.derivation"?: string | undefined;
|
|
1233
1257
|
"composites.inspector.title"?: string | undefined;
|
|
1234
1258
|
"composites.inspector.titleHelp"?: string | undefined;
|
|
1235
1259
|
"composites.inspector.untitled"?: string | undefined;
|
|
@@ -1262,8 +1286,8 @@ declare const _default: import("@nuxt/schema").NuxtModule<{
|
|
|
1262
1286
|
"composites.settings.structure.legend"?: string | undefined;
|
|
1263
1287
|
"composites.settings.structure.flat.label"?: string | undefined;
|
|
1264
1288
|
"composites.settings.structure.flat.description"?: string | undefined;
|
|
1265
|
-
"composites.settings.structure.
|
|
1266
|
-
"composites.settings.structure.
|
|
1289
|
+
"composites.settings.structure.structured.label"?: string | undefined;
|
|
1290
|
+
"composites.settings.structure.structured.description"?: string | undefined;
|
|
1267
1291
|
"composites.settings.scope.legend"?: string | undefined;
|
|
1268
1292
|
"composites.settings.scope.container.label"?: string | undefined;
|
|
1269
1293
|
"composites.settings.scope.container.description"?: string | undefined;
|
|
@@ -1278,13 +1302,13 @@ declare const _default: import("@nuxt/schema").NuxtModule<{
|
|
|
1278
1302
|
"composites.settings.treeRoot.file.label"?: string | undefined;
|
|
1279
1303
|
"composites.settings.treeRoot.file.description"?: string | undefined;
|
|
1280
1304
|
"composites.settings.composites.title"?: string | undefined;
|
|
1281
|
-
"composites.settings.
|
|
1282
|
-
"composites.settings.
|
|
1283
|
-
"composites.settings.
|
|
1284
|
-
"composites.settings.
|
|
1285
|
-
"composites.settings.
|
|
1286
|
-
"composites.settings.
|
|
1287
|
-
"composites.settings.
|
|
1305
|
+
"composites.settings.defaultBlockType.label"?: string | undefined;
|
|
1306
|
+
"composites.settings.defaultBlockType.description"?: string | undefined;
|
|
1307
|
+
"composites.settings.blockTypeIcon.legend"?: string | undefined;
|
|
1308
|
+
"composites.settings.blockTypeIcon.always.label"?: string | undefined;
|
|
1309
|
+
"composites.settings.blockTypeIcon.always.description"?: string | undefined;
|
|
1310
|
+
"composites.settings.blockTypeIcon.hover.label"?: string | undefined;
|
|
1311
|
+
"composites.settings.blockTypeIcon.hover.description"?: string | undefined;
|
|
1288
1312
|
"composites.settings.dragHandle.legend"?: string | undefined;
|
|
1289
1313
|
"composites.settings.dragHandle.hover.label"?: string | undefined;
|
|
1290
1314
|
"composites.settings.dragHandle.hover.description"?: string | undefined;
|
|
@@ -1496,8 +1520,8 @@ declare const _default: import("@nuxt/schema").NuxtModule<{
|
|
|
1496
1520
|
"ai.settings.autocomplete.description"?: string | undefined;
|
|
1497
1521
|
"ai.settings.language.label"?: string | undefined;
|
|
1498
1522
|
"ai.settings.language.description"?: string | undefined;
|
|
1499
|
-
"ai.settings.
|
|
1500
|
-
"ai.settings.
|
|
1523
|
+
"ai.settings.roles.title"?: string | undefined;
|
|
1524
|
+
"ai.settings.roles.description"?: string | undefined;
|
|
1501
1525
|
"ai.settings.profiles.title"?: string | undefined;
|
|
1502
1526
|
"ai.settings.profiles.description"?: string | undefined;
|
|
1503
1527
|
"ai.profiles.server"?: string | undefined;
|
|
@@ -1562,7 +1586,7 @@ declare const _default: import("@nuxt/schema").NuxtModule<{
|
|
|
1562
1586
|
} | undefined;
|
|
1563
1587
|
} | undefined;
|
|
1564
1588
|
apiKey?: string | undefined;
|
|
1565
|
-
|
|
1589
|
+
roles?: {
|
|
1566
1590
|
complete?: string | undefined;
|
|
1567
1591
|
rewrite?: string | undefined;
|
|
1568
1592
|
generate?: string | undefined;
|
package/dist/nuxt/module.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.js","names":[],"sources":["../../src/nuxt/module.ts"],"sourcesContent":["import { addPlugin, addServerScanDir, createResolver, defineNuxtModule } from 'nuxt/kit'\nimport { defineEditorConfig, type EditorConfigInput, publicConfig, serverConfig } from '../config'\n\n/** Module options (`tiptapEditor` in `nuxt.config`): the editor's configuration with every key optional, see `EditorConfig`. */\nexport type ModuleOptions = EditorConfigInput\n\n/**\n * Nuxt/Nitro integration of the editor package: the client context plugin (settings persistence, AI configuration),\n * a server plugin that mounts the editor's routes and the collaboration websocket (`installEditorServer`) and the AI configuration with its server-only secrets. The host\n * plugs in through `setEditorPorts()` (`@ecsplico/editor/server`) in a Nitro plugin (auth, loading and storing\n * document content). Components are imported explicitly from the package entries; nothing is auto-registered.\n */\nexport default defineNuxtModule<ModuleOptions>({\n meta: { name: 'tiptap-editor', configKey: 'tiptapEditor' },\n setup(options, nuxt) {\n const { resolve } = createResolver(import.meta.url)\n // `resolve('..')` is the package root of the built output (`dist`) or of `src` in this repository's app: both\n // hold the stylesheets and the unbundled `nuxt/runtime` files, which Nuxt compiles for the client and Nitro for the server.\n const packageSrc = resolve('..')\n nuxt.options.build.transpile.push(packageSrc)\n // The Nuxt UI token map comes first: the feature sheets (and an Obsidian theme, `themes.css`, last) read and may override `--sk-*`.\n nuxt.options.css.push(resolve('../vue/kit/nuxt-ui.css'))\n nuxt.options.css.push(\n resolve('../styles/core.css'),\n resolve('../styles/media.css'),\n resolve('../styles/mentions.css'),\n resolve('../styles/authors.css'),\n resolve('../styles/comments.css'),\n resolve('../styles/transcript.css'),\n resolve('../styles/composites.css'),\n resolve('../styles/ai.css'),\n resolve('../styles/collab.css'),\n resolve('../styles/block-ui.css'),\n resolve('../styles/themes.css'),\n )\n addPlugin({ src: resolve('./runtime/plugins/editor-context-nuxt-ui.client.ts'), mode: 'client' })\n addServerScanDir(resolve('./runtime/server'))\n // Tailwind only scans the app layers listed in Nuxt UI's generated `ui.css` (`@source \"<layer>/app/**/*\"`), so the\n // utility classes used by the package's components would never be generated. Append its source. `@nuxt/ui` must be\n // registered before this module.\n nuxt.hook('modules:done', () => {\n const uiCss = nuxt.options.build.templates.find(t => t.filename === 'ui.css')\n if (!uiCss?.getContents) throw new Error('tiptap-editor: @nuxt/ui muss vor diesem Modul registriert sein (ui.css-Template fehlt)')\n const getContents = uiCss.getContents\n uiCss.getContents = async data => `@source \"${packageSrc}/**/*\";\\n${await getContents(data)}`\n })\n nuxt.options.nitro.experimental = { ...nuxt.options.nitro.experimental, websocket: true }\n // Nitro bundles the package (the runtime files import `h3` and `nitropack/runtime`, which the host's Nitro resolves): never leave it external.\n nuxt.options.nitro.externals = { ...nuxt.options.nitro.externals, inline: [...(nuxt.options.nitro.externals?.inline ?? []), '@ecsplico/editor', packageSrc] }\n const config = defineEditorConfig(options)\n // The server view keeps an empty `apiKey` on the shared key, every preset and the transcription, so their `NUXT_TIPTAP_EDITOR_AI_*` env variables have a key to override.\n nuxt.options.runtimeConfig.tiptapEditor = {\n ...serverConfig(config),\n ...(nuxt.options.runtimeConfig.tiptapEditor as object | undefined),\n }\n // Default
|
|
1
|
+
{"version":3,"file":"module.js","names":[],"sources":["../../src/nuxt/module.ts"],"sourcesContent":["import { addPlugin, addServerScanDir, createResolver, defineNuxtModule } from 'nuxt/kit'\nimport { defineEditorConfig, type EditorConfigInput, publicConfig, serverConfig } from '../config'\n\n/** Module options (`tiptapEditor` in `nuxt.config`): the editor's configuration with every key optional, see `EditorConfig`. */\nexport type ModuleOptions = EditorConfigInput\n\n/**\n * Nuxt/Nitro integration of the editor package: the client context plugin (settings persistence, AI configuration),\n * a server plugin that mounts the editor's routes and the collaboration websocket (`installEditorServer`) and the AI configuration with its server-only secrets. The host\n * plugs in through `setEditorPorts()` (`@ecsplico/editor/server`) in a Nitro plugin (auth, loading and storing\n * document content). Components are imported explicitly from the package entries; nothing is auto-registered.\n */\nexport default defineNuxtModule<ModuleOptions>({\n meta: { name: 'tiptap-editor', configKey: 'tiptapEditor' },\n setup(options, nuxt) {\n const { resolve } = createResolver(import.meta.url)\n // `resolve('..')` is the package root of the built output (`dist`) or of `src` in this repository's app: both\n // hold the stylesheets and the unbundled `nuxt/runtime` files, which Nuxt compiles for the client and Nitro for the server.\n const packageSrc = resolve('..')\n nuxt.options.build.transpile.push(packageSrc)\n // The Nuxt UI token map comes first: the feature sheets (and an Obsidian theme, `themes.css`, last) read and may override `--sk-*`.\n nuxt.options.css.push(resolve('../vue/kit/nuxt-ui.css'))\n nuxt.options.css.push(\n resolve('../styles/core.css'),\n resolve('../styles/media.css'),\n resolve('../styles/mentions.css'),\n resolve('../styles/authors.css'),\n resolve('../styles/comments.css'),\n resolve('../styles/transcript.css'),\n resolve('../styles/composites.css'),\n resolve('../styles/ai.css'),\n resolve('../styles/collab.css'),\n resolve('../styles/block-ui.css'),\n resolve('../styles/themes.css'),\n )\n addPlugin({ src: resolve('./runtime/plugins/editor-context-nuxt-ui.client.ts'), mode: 'client' })\n addServerScanDir(resolve('./runtime/server'))\n // Tailwind only scans the app layers listed in Nuxt UI's generated `ui.css` (`@source \"<layer>/app/**/*\"`), so the\n // utility classes used by the package's components would never be generated. Append its source. `@nuxt/ui` must be\n // registered before this module.\n nuxt.hook('modules:done', () => {\n const uiCss = nuxt.options.build.templates.find(t => t.filename === 'ui.css')\n if (!uiCss?.getContents) throw new Error('tiptap-editor: @nuxt/ui muss vor diesem Modul registriert sein (ui.css-Template fehlt)')\n const getContents = uiCss.getContents\n uiCss.getContents = async data => `@source \"${packageSrc}/**/*\";\\n${await getContents(data)}`\n })\n nuxt.options.nitro.experimental = { ...nuxt.options.nitro.experimental, websocket: true }\n // Nitro bundles the package (the runtime files import `h3` and `nitropack/runtime`, which the host's Nitro resolves): never leave it external.\n nuxt.options.nitro.externals = { ...nuxt.options.nitro.externals, inline: [...(nuxt.options.nitro.externals?.inline ?? []), '@ecsplico/editor', packageSrc] }\n const config = defineEditorConfig(options)\n // The server view keeps an empty `apiKey` on the shared key, every preset and the transcription, so their `NUXT_TIPTAP_EDITOR_AI_*` env variables have a key to override.\n nuxt.options.runtimeConfig.tiptapEditor = {\n ...serverConfig(config),\n ...(nuxt.options.runtimeConfig.tiptapEditor as object | undefined),\n }\n // Default role presets for the client before `GET /api/ai/models` has answered; read by the client context plugin.\n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AAC;IAAI;IAAoB;GAAU;EAAE;EAC5J,MAAM,SAAS,mBAAmB,OAAO;EAEzC,KAAK,QAAQ,cAAc,eAAe;GACxC,GAAG,aAAa,MAAM;GACtB,GAAI,KAAK,QAAQ,cAAc;EACjC;EAEA,KAAK,QAAQ,cAAc,OAAO,eAAe;GAC/C,GAAG,aAAa,MAAM;GACtB,GAAI,KAAK,QAAQ,cAAc,OAAO;EACxC;CACF;AACF,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useEditorPorts, useEditorSchema } from "../../../../server/host.js";
|
|
1
|
+
import { useEditorBlockTypes, useEditorPorts, useEditorSchema } from "../../../../server/host.js";
|
|
2
2
|
import { installEditorServer } from "../../../../adapters/nitro.js";
|
|
3
3
|
import { defineNitroPlugin, useRuntimeConfig } from "nitropack/runtime";
|
|
4
4
|
//#region src/nuxt/runtime/server/plugins/editor-server.ts
|
|
@@ -18,7 +18,8 @@ var editor_server_default = defineNitroPlugin((nitroApp) => {
|
|
|
18
18
|
missingKeyHint: (id) => ` (NUXT_TIPTAP_EDITOR_AI_PRESETS_${id.replace(/([a-z0-9])([A-Z])/g, "$1_$2").toUpperCase()}_API_KEY oder NUXT_TIPTAP_EDITOR_AI_API_KEY)`
|
|
19
19
|
},
|
|
20
20
|
rateLimit,
|
|
21
|
-
schema: useEditorSchema()
|
|
21
|
+
schema: useEditorSchema(),
|
|
22
|
+
blockTypes: useEditorBlockTypes()
|
|
22
23
|
});
|
|
23
24
|
}
|
|
24
25
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"editor-server.js","names":[],"sources":["../../../../../src/nuxt/runtime/server/plugins/editor-server.ts"],"sourcesContent":["// Nitro's auto-imports are not applied to files under node_modules (the built package), so every Nitro/h3 helper is imported explicitly.\nimport { defineNitroPlugin, useRuntimeConfig } from 'nitropack/runtime'\nimport { type EditorServer, installEditorServer } from '../../../../adapters/nitro'\nimport type { EditorServerConfig } from '../../../../config'\nimport { useEditorPorts, useEditorSchema } from '../../../../server/host'\n\n// Mounts the editor's routes and the collaboration websocket (`installEditorServer`) over the ports the host registered\n// with `setEditorPorts()`, and takes the AI configuration (presets, keys,
|
|
1
|
+
{"version":3,"file":"editor-server.js","names":[],"sources":["../../../../../src/nuxt/runtime/server/plugins/editor-server.ts"],"sourcesContent":["// Nitro's auto-imports are not applied to files under node_modules (the built package), so every Nitro/h3 helper is imported explicitly.\nimport { defineNitroPlugin, useRuntimeConfig } from 'nitropack/runtime'\nimport { type EditorServer, installEditorServer } from '../../../../adapters/nitro'\nimport type { EditorServerConfig } from '../../../../config'\nimport { useEditorBlockTypes, useEditorPorts, useEditorSchema } from '../../../../server/host'\n\n// Mounts the editor's routes and the collaboration websocket (`installEditorServer`) over the ports the host registered\n// with `setEditorPorts()`, and takes the AI configuration (presets, keys, roles, transcription), the rate limit and\n// `collab.authenticateUpgrade` from the module's runtime config.\n//\n// The host registers its ports in a Nitro plugin of its own, and Nitro does not order plugins of different layers and\n// modules reliably; the first request is the first moment every plugin has run (the routes it served before this\n// were file-based and read the ports per request, too). A failed install is retried by the next request.\nexport default defineNitroPlugin((nitroApp) => {\n let server: EditorServer | undefined\n nitroApp.hooks.hook('request', () => {\n server ??= install()\n })\n\n function install(): EditorServer {\n // The module's `serverConfig(defineEditorConfig(options))`, with the host's runtime-config and env overrides applied.\n const { ai, rateLimit, collab } = useRuntimeConfig().tiptapEditor as EditorServerConfig\n const ports = useEditorPorts()\n return installEditorServer(nitroApp, {\n ports,\n // Without persisted collaboration state the editor runs without the websocket (documents still load and save over HTTP).\n collab: ports.collabState ? collab : false,\n // Env names use the preset id in upper snake case (`flashLite` → `FLASH_LITE`), like Nuxt's runtime config mapping.\n ai: { ...ai, missingKeyHint: id => ` (NUXT_TIPTAP_EDITOR_AI_PRESETS_${id.replace(/([a-z0-9])([A-Z])/g, '$1_$2').toUpperCase()}_API_KEY oder NUXT_TIPTAP_EDITOR_AI_API_KEY)` },\n rateLimit,\n schema: useEditorSchema(),\n blockTypes: useEditorBlockTypes(),\n })\n }\n})\n"],"mappings":";;;;AAaA,IAAA,wBAAe,mBAAmB,aAAa;CAC7C,IAAI;CACJ,SAAS,MAAM,KAAK,iBAAiB;EACnC,WAAW,QAAQ;CACrB,CAAC;CAED,SAAS,UAAwB;EAE/B,MAAM,EAAE,IAAI,WAAW,WAAW,iBAAiB,CAAC,CAAC;EACrD,MAAM,QAAQ,eAAe;EAC7B,OAAO,oBAAoB,UAAU;GACnC;GAEA,QAAQ,MAAM,cAAc,SAAS;GAErC,IAAI;IAAE,GAAG;IAAI,iBAAgB,OAAM,mCAAmC,GAAG,QAAQ,sBAAsB,OAAO,CAAC,CAAC,YAAY,EAAE;GAA8C;GAC5K;GACA,QAAQ,gBAAgB;GACxB,YAAY,oBAAoB;EAClC,CAAC;CACH;AACF,CAAC"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { EditorBackend } from "../core/backend.js";
|
|
2
2
|
import { BlockUiOptions } from "../core/extension-points.js";
|
|
3
3
|
import { EditorFeature, EditorPreset } from "../core/feature.js";
|
|
4
|
+
import { Basket } from "../features/composites/baskets.js";
|
|
5
|
+
import { BlockType } from "../features/composites/block-types.js";
|
|
4
6
|
import { CoreContentOptions } from "../core/schema/index.js";
|
|
5
7
|
import { CommentsFeatureOptions } from "../features/comments/feature.js";
|
|
6
|
-
import { CompositeKind } from "../features/composites/kinds.js";
|
|
7
|
-
import { Basket } from "../features/composites/baskets.js";
|
|
8
8
|
import { CompositeFeatureOptions } from "../features/composites/feature.js";
|
|
9
9
|
import { BlockTransform } from "../features/transfer/transforms.js";
|
|
10
10
|
import { TransferFeatureOptions } from "../features/transfer/feature.js";
|
|
@@ -20,7 +20,7 @@ export type InteractionLevel = 'minimal' | 'full';
|
|
|
20
20
|
* features are bound too, although `composite-ai` and `transcript-ai` have no components: the layer owns every import of
|
|
21
21
|
* `features/ai`, so a composition without `ai` binds none of them and its bundle holds no AI code. Each binding is a
|
|
22
22
|
* factory, called only for a feature the composition selects (`themes` reads the current Vue app when built, so
|
|
23
|
-
* unselected features are never built). `composites` receives the composition's `
|
|
23
|
+
* unselected features are never built). `composites` receives the composition's `blockTypes` and `compositeBaskets`, `comments` its
|
|
24
24
|
* `comments` options. `core-ui` takes no parameter here: the framework-free `simpleEditor()` has no command palette;
|
|
25
25
|
* a layer that has one (the `SimpleEditor` surfaces) builds `coreUiFeature({ palette })` itself.
|
|
26
26
|
*/
|
|
@@ -61,9 +61,9 @@ export interface ComposeOptions<C> {
|
|
|
61
61
|
add?: readonly EditorFeature<C>[];
|
|
62
62
|
/** Features left out (catalog or host); features that require them are omitted as well. */
|
|
63
63
|
remove?: readonly FeatureId[];
|
|
64
|
-
/** The
|
|
65
|
-
|
|
66
|
-
/** The colour baskets a
|
|
64
|
+
/** The Block types offered in the editor (default: the built-in Block types); read once. */
|
|
65
|
+
blockTypes?: readonly BlockType[];
|
|
66
|
+
/** The colour baskets a Typed block can be put into (default: the built-in red/orange/yellow/green/blue set); read once. */
|
|
67
67
|
compositeBaskets?: readonly Basket[];
|
|
68
68
|
/** Options of the comments feature, e.g. a host `model` (then comments need no `collab`). */
|
|
69
69
|
comments?: CommentsFeatureOptions;
|
package/dist/presets/compose.js
CHANGED
|
@@ -39,10 +39,13 @@ const CATALOG = {
|
|
|
39
39
|
"composites": {
|
|
40
40
|
dimension: "content",
|
|
41
41
|
levels: ["rich"],
|
|
42
|
-
build: (ui, options) =>
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
42
|
+
build: (ui, options) => {
|
|
43
|
+
const { blockTypes } = options;
|
|
44
|
+
return bound(ui, "composites")({
|
|
45
|
+
...blockTypes && { blockTypes },
|
|
46
|
+
...options.compositeBaskets && { baskets: options.compositeBaskets }
|
|
47
|
+
});
|
|
48
|
+
}
|
|
46
49
|
},
|
|
47
50
|
"mentions": {
|
|
48
51
|
dimension: "content",
|