@ecsplico/editor 3.5.1 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +71 -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 -7
- package/dist/features/composites/merge.js +39 -12
- 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 +1 -1
- package/dist/features/image-studio/components/ImageStudioDialog.js.map +1 -1
- package/dist/features/image-studio/components/ImageStudioDialog.vue.d.ts +1 -1
- 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/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 +1 -1
- package/dist/features/image-studio/react/ImageStudioDialog.js.map +1 -1
- 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 +3 -3
- package/dist/features/image-studio/react/store.js.map +1 -1
- package/dist/features/image-studio/react.d.ts +1 -1
- package/dist/features/image-studio/react.js +1 -1
- 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 +3 -3
- package/dist/features/image-studio/state.js +2 -2
- package/dist/features/image-studio/state.js.map +1 -1
- package/dist/features/image-studio/store.d.ts +3 -3
- package/dist/features/image-studio/vue.d.ts +1 -1
- package/dist/features/image-studio/vue.js +1 -1
- package/dist/features/image-studio/vue.js.map +1 -1
- package/dist/features/media/index.js +1 -1
- package/dist/features/media/react/AudioRecorderModal.js +1 -1
- package/dist/features/media/react.js +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 +2 -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 +101 -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/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 +12 -12
- 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 +30 -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 +8 -5
- 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 +2 -2
- 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 +6 -6
- 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 +2 -2
- 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 -83
- package/dist/features/composites/kinds.js +0 -285
- package/dist/features/composites/kinds.js.map +0 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { DRAG_HANDLE_VISIBILITIES, HEADING_CONVERSION_SCOPES,
|
|
1
|
+
import { BLOCK_TYPE_ICON_VISIBILITIES, DRAG_HANDLE_VISIBILITIES, HEADING_CONVERSION_SCOPES, STRUCTURE_MODES, TREE_ROOTS } from "../../../settings/values.js";
|
|
2
2
|
import { SPLIT_TARGET_CHARS_MAX, clampSplitTargetChars } from "../../../settings/index.js";
|
|
3
3
|
import { useUiKit } from "../../../vue/kit/use-ui-kit.js";
|
|
4
4
|
import { useEditorSettings } from "../../../vue/settings.js";
|
|
5
5
|
import { useEditorI18n } from "../../../vue/use-editor-i18n.js";
|
|
6
6
|
import { STRUCTURE_MODE_KEYS } from "../structure-mode.js";
|
|
7
|
-
import { DRAG_HANDLE_KEYS, HEADING_SCOPE_KEYS,
|
|
7
|
+
import { BLOCK_TYPE_ICON_KEYS, DRAG_HANDLE_KEYS, HEADING_SCOPE_KEYS, optionItems } from "../editing-settings-keys.js";
|
|
8
8
|
import { TREE_ROOT_KEYS } from "../tree-root.js";
|
|
9
9
|
import _sfc_main$1 from "../../../vue/components/SettingsSection.js";
|
|
10
10
|
import { computed, createElementBlock, createElementVNode, createVNode, defineComponent, openBlock, ref, unref, watch, withCtx, withKeys } from "vue";
|
|
@@ -15,10 +15,10 @@ const _hoisted_3 = { class: "py-3" };
|
|
|
15
15
|
const _hoisted_4 = { class: "py-3" };
|
|
16
16
|
const _hoisted_5 = { class: "py-3" };
|
|
17
17
|
const _hoisted_6 = { class: "py-3" };
|
|
18
|
-
/** „Bearbeiten“: Gliederung (structure mode, conversion scope),
|
|
18
|
+
/** „Bearbeiten“: Gliederung (structure mode, conversion scope), Typed blocks defaults and the visibility of the block handles. */
|
|
19
19
|
const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
20
20
|
__name: "SettingsEditingTab",
|
|
21
|
-
props: {
|
|
21
|
+
props: { blockTypes: {} },
|
|
22
22
|
setup(__props) {
|
|
23
23
|
const props = __props;
|
|
24
24
|
const { FormField: UFormField, Input: UInput, RadioGroup: URadioGroup, Select: USelect } = useUiKit();
|
|
@@ -27,12 +27,12 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
|
27
27
|
const scopeItems = computed(() => optionItems(HEADING_CONVERSION_SCOPES, HEADING_SCOPE_KEYS, t));
|
|
28
28
|
const structureItems = computed(() => optionItems(STRUCTURE_MODES, STRUCTURE_MODE_KEYS, t));
|
|
29
29
|
const treeRootItems = computed(() => optionItems(TREE_ROOTS, TREE_ROOT_KEYS, t));
|
|
30
|
-
const
|
|
30
|
+
const blockTypeIconItems = computed(() => optionItems(BLOCK_TYPE_ICON_VISIBILITIES, BLOCK_TYPE_ICON_KEYS, t));
|
|
31
31
|
const dragHandleItems = computed(() => optionItems(DRAG_HANDLE_VISIBILITIES, DRAG_HANDLE_KEYS, t));
|
|
32
|
-
const
|
|
33
|
-
label:
|
|
34
|
-
icon:
|
|
35
|
-
value:
|
|
32
|
+
const blockTypeItems = computed(() => props.blockTypes.map((blockType) => ({
|
|
33
|
+
label: blockType.label,
|
|
34
|
+
icon: blockType.icon,
|
|
35
|
+
value: blockType.id
|
|
36
36
|
})));
|
|
37
37
|
const splitTarget = ref(String(settings.value.blocks.splitTargetChars));
|
|
38
38
|
watch(() => settings.value.blocks.splitTargetChars, (value) => {
|
|
@@ -85,13 +85,13 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
|
85
85
|
createVNode(unref(UFormField), {
|
|
86
86
|
orientation: "horizontal",
|
|
87
87
|
class: "py-3",
|
|
88
|
-
label: unref(t)("composites.settings.
|
|
89
|
-
description: unref(t)("composites.settings.
|
|
88
|
+
label: unref(t)("composites.settings.defaultBlockType.label"),
|
|
89
|
+
description: unref(t)("composites.settings.defaultBlockType.description")
|
|
90
90
|
}, {
|
|
91
91
|
default: withCtx(() => [createVNode(unref(USelect), {
|
|
92
|
-
modelValue: unref(settings).blocks.
|
|
93
|
-
"onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => unref(settings).blocks.
|
|
94
|
-
items:
|
|
92
|
+
modelValue: unref(settings).blocks.defaultBlockType,
|
|
93
|
+
"onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => unref(settings).blocks.defaultBlockType = $event),
|
|
94
|
+
items: blockTypeItems.value,
|
|
95
95
|
class: "w-64"
|
|
96
96
|
}, null, 8, ["modelValue", "items"])]),
|
|
97
97
|
_: 1
|
|
@@ -123,10 +123,10 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
|
123
123
|
_: 1
|
|
124
124
|
}, 8, ["label"]),
|
|
125
125
|
createElementVNode("div", _hoisted_5, [createVNode(unref(URadioGroup), {
|
|
126
|
-
modelValue: unref(settings).blocks.
|
|
127
|
-
"onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => unref(settings).blocks.
|
|
128
|
-
legend: unref(t)("composites.settings.
|
|
129
|
-
items:
|
|
126
|
+
modelValue: unref(settings).blocks.blockTypeIcon,
|
|
127
|
+
"onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => unref(settings).blocks.blockTypeIcon = $event),
|
|
128
|
+
legend: unref(t)("composites.settings.blockTypeIcon.legend"),
|
|
129
|
+
items: blockTypeIconItems.value
|
|
130
130
|
}, null, 8, [
|
|
131
131
|
"modelValue",
|
|
132
132
|
"legend",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SettingsEditingTab.js","names":["_openBlock","_createElementBlock","_createVNode","SettingsSection","_unref","_withCtx","_createElementVNode","_withKeys"],"sources":["../../../../src/features/composites/components/SettingsEditingTab.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed, ref, watch } from 'vue'\nimport SettingsSection from '../../../vue/components/SettingsSection.vue'\nimport { useUiKit } from '../../../vue/kit/use-ui-kit'\nimport { useEditorSettings } from '../../../vue/settings'\nimport { useEditorI18n } from '../../../vue/use-editor-i18n'\nimport { clampSplitTargetChars, DRAG_HANDLE_VISIBILITIES, HEADING_CONVERSION_SCOPES,
|
|
1
|
+
{"version":3,"file":"SettingsEditingTab.js","names":["_openBlock","_createElementBlock","_createVNode","SettingsSection","_unref","_withCtx","_createElementVNode","_withKeys"],"sources":["../../../../src/features/composites/components/SettingsEditingTab.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed, ref, watch } from 'vue'\nimport SettingsSection from '../../../vue/components/SettingsSection.vue'\nimport { useUiKit } from '../../../vue/kit/use-ui-kit'\nimport { useEditorSettings } from '../../../vue/settings'\nimport { useEditorI18n } from '../../../vue/use-editor-i18n'\nimport { BLOCK_TYPE_ICON_VISIBILITIES, clampSplitTargetChars, DRAG_HANDLE_VISIBILITIES, HEADING_CONVERSION_SCOPES, SPLIT_TARGET_CHARS_MAX, SPLIT_TARGET_CHARS_MIN, STRUCTURE_MODES, TREE_ROOTS } from '../../../settings'\nimport { BLOCK_TYPE_ICON_KEYS, DRAG_HANDLE_KEYS, HEADING_SCOPE_KEYS, optionItems } from '../editing-settings-keys'\nimport type { BlockType } from '../block-types'\nimport { STRUCTURE_MODE_KEYS } from '../structure-mode'\nimport { TREE_ROOT_KEYS } from '../tree-root'\n\n/** „Bearbeiten“: Gliederung (structure mode, conversion scope), Typed blocks defaults and the visibility of the block handles. */\nconst props = defineProps<{ blockTypes: readonly BlockType[] }>()\n\nconst { FormField: UFormField, Input: UInput, RadioGroup: URadioGroup, Select: USelect } = useUiKit()\nconst { t } = useEditorI18n()\n\nconst { settings } = useEditorSettings()\n\nconst scopeItems = computed(() => optionItems(HEADING_CONVERSION_SCOPES, HEADING_SCOPE_KEYS, t))\nconst structureItems = computed(() => optionItems(STRUCTURE_MODES, STRUCTURE_MODE_KEYS, t))\nconst treeRootItems = computed(() => optionItems(TREE_ROOTS, TREE_ROOT_KEYS, t))\nconst blockTypeIconItems = computed(() => optionItems(BLOCK_TYPE_ICON_VISIBILITIES, BLOCK_TYPE_ICON_KEYS, t))\nconst dragHandleItems = computed(() => optionItems(DRAG_HANDLE_VISIBILITIES, DRAG_HANDLE_KEYS, t))\n\nconst blockTypeItems = computed(() => props.blockTypes.map(blockType => ({ label: blockType.label, icon: blockType.icon, value: blockType.id })))\n\n// The target size is edited as text and written back clamped to its range when the field is left, so a half-typed number never reaches the settings.\nconst splitTarget = ref(String(settings.value.blocks.splitTargetChars))\nwatch(() => settings.value.blocks.splitTargetChars, (value) => { splitTarget.value = String(value) })\nfunction commitSplitTarget() {\n const next = clampSplitTargetChars(splitTarget.value, settings.value.blocks.splitTargetChars)\n settings.value.blocks.splitTargetChars = next\n splitTarget.value = String(next)\n}\n</script>\n\n<template>\n <div class=\"flex flex-col gap-8\">\n <SettingsSection :title=\"t('composites.settings.structure.title')\">\n <div class=\"py-3\">\n <URadioGroup v-model=\"settings.blocks.structure\" :legend=\"t('composites.settings.structure.legend')\" :items=\"structureItems\" />\n </div>\n <div class=\"py-3\">\n <URadioGroup\n v-model=\"settings.editing.headingConversionScope\"\n :legend=\"t('composites.settings.scope.legend')\"\n :items=\"scopeItems\"\n />\n </div>\n </SettingsSection>\n\n <SettingsSection :title=\"t('composites.settings.sidebar.title')\">\n <div class=\"py-3\">\n <URadioGroup v-model=\"settings.blocks.treeRoot\" :legend=\"t('composites.settings.treeRoot.legend')\" :items=\"treeRootItems\" />\n </div>\n </SettingsSection>\n\n <SettingsSection :title=\"t('composites.settings.composites.title')\">\n <UFormField\n orientation=\"horizontal\"\n class=\"py-3\"\n :label=\"t('composites.settings.defaultBlockType.label')\"\n :description=\"t('composites.settings.defaultBlockType.description')\"\n >\n <USelect v-model=\"settings.blocks.defaultBlockType\" :items=\"blockTypeItems\" class=\"w-64\" />\n </UFormField>\n <UFormField orientation=\"horizontal\" class=\"py-3\" :label=\"t('settings.editing.splitTargetChars')\">\n <UInput\n :model-value=\"splitTarget\"\n type=\"number\"\n :min=\"SPLIT_TARGET_CHARS_MIN\"\n :max=\"SPLIT_TARGET_CHARS_MAX\"\n :step=\"100\"\n :aria-label=\"t('settings.editing.splitTargetChars')\"\n class=\"w-32\"\n @blur=\"commitSplitTarget\"\n @keydown.enter=\"commitSplitTarget\"\n @update:model-value=\"(value: unknown) => { splitTarget = String(value) }\"\n />\n </UFormField>\n <div class=\"py-3\">\n <URadioGroup v-model=\"settings.blocks.blockTypeIcon\" :legend=\"t('composites.settings.blockTypeIcon.legend')\" :items=\"blockTypeIconItems\" />\n </div>\n <div class=\"py-3\">\n <URadioGroup v-model=\"settings.blocks.dragHandle\" :legend=\"t('composites.settings.dragHandle.legend')\" :items=\"dragHandleItems\" />\n </div>\n </SettingsSection>\n </div>\n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AaaE,MAAA,UAAA,GAAA;OAbD,aAAY;OAAa,OAAM;OAAQ,OAAOA,MAAA,CAAA,CAAC,CAAA,mCAAA;;OACzD,SAAAC,cAWE,CAXFH,YAWEE,MAAA,MAAA,GAAA;QAVC,eAAa,YAAA;QACd,MAAK;QACJ,KAAKA,MAAAA,GAAA;QACL,KAAKA,MAAA,sBAAA;QACL,MAAM;QACN,cAAYA,MAAA,CAAA,CAAC,CAAA,mCAAA;QACd,OAAM;QACL,QAAM;QACN,WAAOG,SAAQ,mBAAiB,CAAA,OAAA,CAAA;QAChC,uBAAkB,OAAA,OAAA,OAAA,MAAG,UAAc;SAAO,YAAA,QAAc,OAAO,KAAK;QAAA;;;;;;;;;MAGzED,mBAEM,OAFN,YAEM,CADJJ,YAA2IE,MAAA,WAAA,GAAA;OAArH,YAAAA,MAAA,QAAA,CAAQ,CAAC,OAAO;OAAhB,uBAAA,OAAA,OAAA,OAAA,MAAA,WAAA,MAAA,QAAA,CAAQ,CAAC,OAAO,gBAAa;OAAG,QAAQA,MAAA,CAAA,CAAC,CAAA,0CAAA;OAA+C,OAAO,mBAAA;;;;;;MAEvHE,mBAEM,OAFN,YAEM,CADJJ,YAAkIE,MAAA,WAAA,GAAA;OAA5G,YAAAA,MAAA,QAAA,CAAQ,CAAC,OAAO;OAAhB,uBAAA,OAAA,OAAA,OAAA,MAAA,WAAA,MAAA,QAAA,CAAQ,CAAC,OAAO,aAAU;OAAG,QAAQA,MAAA,CAAA,CAAC,CAAA,uCAAA;OAA4C,OAAO,gBAAA"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BlockType } from "../block-types.js";
|
|
2
2
|
//#region src/features/composites/components/SettingsEditingTab.vue.d.ts
|
|
3
|
-
/** „Bearbeiten“: Gliederung (structure mode, conversion scope),
|
|
3
|
+
/** „Bearbeiten“: Gliederung (structure mode, conversion scope), Typed blocks defaults and the visibility of the block handles. */
|
|
4
4
|
type __VLS_Props = {
|
|
5
|
-
|
|
5
|
+
blockTypes: readonly BlockType[];
|
|
6
6
|
};
|
|
7
7
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
8
8
|
declare const _default: typeof __VLS_export;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ConvertTarget } from "../../core/convert.js";
|
|
2
2
|
import { ConversionProvider } from "../../core/feature.js";
|
|
3
|
-
import {
|
|
3
|
+
import { BlockType } from "./block-types.js";
|
|
4
4
|
import { Node, Schema } from "@tiptap/pm/model";
|
|
5
5
|
//#region src/features/composites/convert.d.ts
|
|
6
6
|
/**
|
|
@@ -10,15 +10,15 @@ import { Node, Schema } from "@tiptap/pm/model";
|
|
|
10
10
|
* changes, the target is not a composite or core target or a node is not a textblock, list, quote or composite.
|
|
11
11
|
* Never looks outside `nodes`: a heading's group is the caller's business.
|
|
12
12
|
*/
|
|
13
|
-
export declare function convertCompositeBlocks(schema: Schema, nodes: Node[], target: ConvertTarget, kinds: readonly
|
|
13
|
+
export declare function convertCompositeBlocks(schema: Schema, nodes: Node[], target: ConvertTarget, kinds: readonly BlockType[]): Node[] | null;
|
|
14
14
|
/**
|
|
15
15
|
* The composite feature's providers, in menu order. The first claims composites as source blocks (`handlesSource`): it
|
|
16
16
|
* offers the core targets for them and executes every conversion of a composite, including kind changes. The second
|
|
17
|
-
* owns the `
|
|
17
|
+
* owns the `typedBlock:<kind>` targets: blocks and kind switches. `kinds` are the host's configured kinds; without them the
|
|
18
18
|
* built-in kinds apply, and their labels (the menu entries) follow the language of the `t` the menu renders with. What
|
|
19
19
|
* a conversion writes into the document (the `Label: Wert` line of a composite's meta) uses the built-in kinds in the
|
|
20
20
|
* default language, since `convert` runs without a translator.
|
|
21
21
|
*/
|
|
22
|
-
export declare function compositeConversions(kinds?: readonly
|
|
22
|
+
export declare function compositeConversions(kinds?: readonly BlockType[]): readonly ConversionProvider[];
|
|
23
23
|
//#endregion
|
|
24
24
|
//# sourceMappingURL=convert.d.ts.map
|
|
@@ -1,14 +1,13 @@
|
|
|
1
|
+
import { TYPED_BLOCK, TYPED_BLOCK_DESCRIPTION, TYPED_BLOCK_TAGS, TYPED_BLOCK_TITLE } from "../../core/schema/persisted-names.js";
|
|
1
2
|
import { CORE_TARGET_IDS, childrenOf, createConverter, finishConversion, isCoreTarget, isCurrentTarget, isListNode, isQuoteNode, isTextblockNode, parseCoreTarget, textblockSpecOf } from "../../core/convert.js";
|
|
2
|
-
import {
|
|
3
|
+
import { blockTypeOf, defaultBlockTypes, fallbackBlockTypes } from "./block-types.js";
|
|
3
4
|
import { keptMeta } from "./meta-keys.js";
|
|
4
5
|
import { compositeChromeBlocks, flattenCompositesToHeadings, headingGroupRange } from "./heading-composites.js";
|
|
5
6
|
import "./nodes.js";
|
|
6
7
|
import { Fragment } from "@tiptap/pm/model";
|
|
7
8
|
//#region src/features/composites/convert.ts
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const COMPOSITE_PREFIX = "composite:";
|
|
11
|
-
const isComposite = (node) => node.type.name === COMPOSITE;
|
|
9
|
+
const TYPED_BLOCK_PREFIX = "typedBlock:";
|
|
10
|
+
const isComposite = (node) => node.type.name === TYPED_BLOCK;
|
|
12
11
|
/** The conversion targets of the core provider, offered for composites (they unwrap into them). */
|
|
13
12
|
const UNWRAP_TARGETS = CORE_TARGET_IDS.flatMap((id) => parseCoreTarget(id) ?? []);
|
|
14
13
|
/**
|
|
@@ -41,35 +40,35 @@ function convertCompositeBlocks(schema, nodes, target, kinds) {
|
|
|
41
40
|
});
|
|
42
41
|
function toComposite(head, rest, kind) {
|
|
43
42
|
if (isComposite(head)) {
|
|
44
|
-
const meta = keptMeta(
|
|
43
|
+
const meta = keptMeta(blockTypeOf(kinds, kind), head.attrs.meta);
|
|
45
44
|
return head.type.create({
|
|
46
45
|
...head.attrs,
|
|
47
|
-
kind,
|
|
46
|
+
blockType: kind,
|
|
48
47
|
meta
|
|
49
48
|
}, [...childrenOf(head), ...rest]);
|
|
50
49
|
}
|
|
51
50
|
let title = Fragment.empty;
|
|
52
51
|
let body = [];
|
|
53
|
-
if (isTextblockNode(head)) title = converter.inline(head,
|
|
52
|
+
if (isTextblockNode(head)) title = converter.inline(head, TYPED_BLOCK_TITLE);
|
|
54
53
|
else if (isQuoteNode(head)) body = childrenOf(head);
|
|
55
54
|
else {
|
|
56
55
|
const [item, ...more] = childrenOf(head);
|
|
57
56
|
const [itemHead, ...itemRest] = item ? childrenOf(item) : [];
|
|
58
|
-
if (itemHead && isTextblockNode(itemHead)) title = converter.inline(itemHead,
|
|
57
|
+
if (itemHead && isTextblockNode(itemHead)) title = converter.inline(itemHead, TYPED_BLOCK_TITLE);
|
|
59
58
|
else if (itemHead) itemRest.unshift(itemHead);
|
|
60
59
|
body = [...itemRest, ...more.length ? [head.type.create(null, more)] : []];
|
|
61
60
|
}
|
|
62
61
|
body = [...body, ...rest];
|
|
63
62
|
if (!body.length) body = [paragraph.create()];
|
|
64
|
-
return n[
|
|
65
|
-
n[
|
|
66
|
-
n.
|
|
67
|
-
n.
|
|
63
|
+
return n[TYPED_BLOCK].create({ blockType: kind }, [
|
|
64
|
+
n[TYPED_BLOCK_TITLE].create(null, title),
|
|
65
|
+
n[TYPED_BLOCK_DESCRIPTION].create(),
|
|
66
|
+
n[TYPED_BLOCK_TAGS].create(),
|
|
68
67
|
...body
|
|
69
68
|
]);
|
|
70
69
|
}
|
|
71
70
|
let output;
|
|
72
|
-
if (target.type === "
|
|
71
|
+
if (target.type === "typedBlock") output = [toComposite(first, nodes.slice(1), target.blockType)];
|
|
73
72
|
else if (!isCoreTarget(target)) return null;
|
|
74
73
|
else if (target.type === "bulletList" || target.type === "orderedList") output = converter.toList(nodes, target.type);
|
|
75
74
|
else if (target.type === "blockquote") output = converter.toQuote(nodes);
|
|
@@ -84,7 +83,7 @@ function convertAt(kinds) {
|
|
|
84
83
|
return (state, $start, target) => {
|
|
85
84
|
const parent = $start.parent;
|
|
86
85
|
const from = $start.index();
|
|
87
|
-
const to = target.type === "
|
|
86
|
+
const to = target.type === "typedBlock" && parent.child(from).type.name === "heading" ? headingGroupRange(parent, from).to : from + 1;
|
|
88
87
|
const nodes = [];
|
|
89
88
|
for (let index = from; index < to; index++) nodes.push(parent.child(index));
|
|
90
89
|
const blocks = convertCompositeBlocks(state.schema, nodes, target, kinds);
|
|
@@ -98,13 +97,13 @@ function convertAt(kinds) {
|
|
|
98
97
|
/**
|
|
99
98
|
* The composite feature's providers, in menu order. The first claims composites as source blocks (`handlesSource`): it
|
|
100
99
|
* offers the core targets for them and executes every conversion of a composite, including kind changes. The second
|
|
101
|
-
* owns the `
|
|
100
|
+
* owns the `typedBlock:<kind>` targets: blocks and kind switches. `kinds` are the host's configured kinds; without them the
|
|
102
101
|
* built-in kinds apply, and their labels (the menu entries) follow the language of the `t` the menu renders with. What
|
|
103
102
|
* a conversion writes into the document (the `Label: Wert` line of a composite's meta) uses the built-in kinds in the
|
|
104
103
|
* default language, since `convert` runs without a translator.
|
|
105
104
|
*/
|
|
106
105
|
function compositeConversions(kinds) {
|
|
107
|
-
const structure = kinds ??
|
|
106
|
+
const structure = kinds ?? fallbackBlockTypes();
|
|
108
107
|
const convert = convertAt(structure);
|
|
109
108
|
return [{
|
|
110
109
|
handlesSource: isComposite,
|
|
@@ -114,23 +113,23 @@ function compositeConversions(kinds) {
|
|
|
114
113
|
convert
|
|
115
114
|
}, {
|
|
116
115
|
targets: (_editor, node) => {
|
|
117
|
-
if (!(isTextblockNode(node) || isListNode(node) || isQuoteNode(node) || isComposite(node)) || !node.type.schema.nodes[
|
|
118
|
-
return structure.map((
|
|
119
|
-
type: "
|
|
120
|
-
|
|
116
|
+
if (!(isTextblockNode(node) || isListNode(node) || isQuoteNode(node) || isComposite(node)) || !node.type.schema.nodes["typedBlock"]) return [];
|
|
117
|
+
return structure.map((blockType) => ({
|
|
118
|
+
type: "typedBlock",
|
|
119
|
+
blockType: blockType.id
|
|
121
120
|
})).filter((target) => !isCurrentTarget(node, target));
|
|
122
121
|
},
|
|
123
122
|
parseTarget: (id) => {
|
|
124
|
-
if (!id.startsWith(
|
|
125
|
-
const
|
|
126
|
-
return structure.some((known) => known.id ===
|
|
127
|
-
type: "
|
|
128
|
-
|
|
123
|
+
if (!id.startsWith(TYPED_BLOCK_PREFIX)) return null;
|
|
124
|
+
const blockTypeId = id.slice(11);
|
|
125
|
+
return structure.some((known) => known.id === blockTypeId) ? {
|
|
126
|
+
type: "typedBlock",
|
|
127
|
+
blockType: blockTypeId
|
|
129
128
|
} : null;
|
|
130
129
|
},
|
|
131
130
|
label: (target, t) => {
|
|
132
|
-
if (target.type !== "
|
|
133
|
-
const kind =
|
|
131
|
+
if (target.type !== "typedBlock") return null;
|
|
132
|
+
const kind = blockTypeOf(kinds ?? defaultBlockTypes(t), target.blockType);
|
|
134
133
|
return {
|
|
135
134
|
label: t("composites.convert.kind", { kind: kind.label }),
|
|
136
135
|
icon: kind.icon
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"convert.js","names":[],"sources":["../../../src/features/composites/convert.ts"],"sourcesContent":["import { Fragment, type Node as PMNode, type Schema } from '@tiptap/pm/model'\nimport {\n CORE_TARGET_IDS,\n childrenOf,\n type ConvertTarget,\n createConverter,\n finishConversion,\n isCoreTarget,\n isCurrentTarget,\n isListNode,\n isQuoteNode,\n isTextblockNode,\n parseCoreTarget,\n textblockSpecOf,\n} from '../../core/convert'\nimport type { ConversionProvider } from '../../core/feature'\nimport { compositeChromeBlocks, flattenCompositesToHeadings, headingGroupRange } from './heading-composites'\nimport { type CompositeKind, compositeKind, defaultCompositeKinds, fallbackCompositeKinds } from './kinds'\nimport { keptMeta } from './meta-keys'\nimport { COMPOSITE_CHROME_COUNT } from './nodes'\n\n// Vue-free and server-importable: the composite family's block conversions — wrapping blocks into a composite,\n// switching its kind and unwrapping it into plain blocks — as `ConversionProvider`s of the composite feature.\n\nconst COMPOSITE = 'composite'\nconst TITLE = 'compositeTitle'\nconst COMPOSITE_PREFIX = 'composite:'\n\nconst isComposite = (node: PMNode) => node.type.name === COMPOSITE\n\n/** The conversion targets of the core provider, offered for composites (they unwrap into them). */\nconst UNWRAP_TARGETS: readonly ConvertTarget[] = CORE_TARGET_IDS.flatMap(id => parseCoreTarget(id) ?? [])\n\n/**\n * Blocks `nodes` (siblings) converted to `target`. A composite takes the first block as title and the rest as body;\n * composites unwrap into the core targets (title first, description as italic paragraph, tags as a paragraph of tag\n * chips, meta as a `Label: Wert` line); into a heading, nested composites become sub-headings. Null when nothing\n * changes, the target is not a composite or core target or a node is not a textblock, list, quote or composite.\n * Never looks outside `nodes`: a heading's group is the caller's business.\n */\nexport function convertCompositeBlocks(schema: Schema, nodes: PMNode[], target: ConvertTarget, kinds: readonly CompositeKind[]): PMNode[] | null {\n const first = nodes[0]\n if (!first || !schema.nodes[target.type]) return null\n if (!nodes.every(node => isTextblockNode(node) || isListNode(node) || isQuoteNode(node) || isComposite(node))) return null\n if (nodes.length === 1 && isCurrentTarget(first, target)) return null\n const n = schema.nodes\n const paragraph = n.paragraph!\n\n /** A composite as plain blocks: title paragraph (an empty one only with `keepEmptyTitle`), description, tags, meta, body. */\n function unwrapComposite(composite: PMNode, keepEmptyTitle: boolean, headingLevel?: number): PMNode[] {\n const title = composite.child(0)\n const blocks: PMNode[] = []\n if (keepEmptyTitle || title.content.size) blocks.push(paragraph.create(null, title.content))\n blocks.push(...compositeChromeBlocks(schema, composite, kinds))\n let body = childrenOf(composite, COMPOSITE_CHROME_COUNT)\n if (headingLevel !== undefined) body = flattenCompositesToHeadings(schema, body, true, headingLevel + 1, kinds) ?? body\n return [...blocks, ...body]\n }\n\n const converter = createConverter(schema, { is: isComposite, unwrap: unwrapComposite })\n\n function toComposite(head: PMNode, rest: PMNode[], kind: string): PMNode {\n if (isComposite(head)) {\n // Another kind: the same node; `meta` keeps the fields of the new kind plus `derivation` and `bib`. Further blocks join its body.\n const meta = keptMeta(compositeKind(kinds, kind), head.attrs.meta as Record<string, unknown>)\n return head.type.create({ ...head.attrs, kind, meta }, [...childrenOf(head), ...rest])\n }\n let title = Fragment.empty\n let body: PMNode[] = []\n if (isTextblockNode(head)) title = converter.inline(head, TITLE)\n else if (isQuoteNode(head)) body = childrenOf(head)\n else {\n // List: the first item's paragraph is the title, its other blocks and the remaining items (same list type) the body.\n const [item, ...more] = childrenOf(head)\n const [itemHead, ...itemRest] = item ? childrenOf(item) : []\n if (itemHead && isTextblockNode(itemHead)) title = converter.inline(itemHead, TITLE)\n else if (itemHead) itemRest.unshift(itemHead)\n body = [...itemRest, ...(more.length ? [head.type.create(null, more)] : [])]\n }\n body = [...body, ...rest]\n if (!body.length) body = [paragraph.create()]\n return n[COMPOSITE]!.create({ kind }, [n[TITLE]!.create(null, title), n.compositeDescription!.create(), n.compositeTags!.create(), ...body])\n }\n\n let output: PMNode[]\n if (target.type === 'composite') output = [toComposite(first, nodes.slice(1), target.kind)]\n else if (!isCoreTarget(target)) return null\n else if (target.type === 'bulletList' || target.type === 'orderedList') output = converter.toList(nodes, target.type)\n else if (target.type === 'blockquote') output = converter.toQuote(nodes)\n else output = converter.toTextblocks(nodes, textblockSpecOf(target))\n return finishConversion(nodes, output)\n}\n\n/**\n * The conversion of the block right after `$start` into `target`: the range it replaces (a heading becoming a composite\n * takes its group along, which turns into the composite's body) and the converted blocks.\n */\nfunction convertAt(kinds: readonly CompositeKind[]): ConversionProvider['convert'] {\n return (state, $start, target) => {\n const parent = $start.parent\n const from = $start.index()\n const to = target.type === 'composite' && parent.child(from).type.name === 'heading' ? headingGroupRange(parent, from).to : from + 1\n const nodes: PMNode[] = []\n for (let index = from; index < to; index++) nodes.push(parent.child(index))\n const blocks = convertCompositeBlocks(state.schema, nodes, target, kinds)\n return blocks ? { from: $start.pos, to: nodes.reduce((end, node) => end + node.nodeSize, $start.pos), blocks } : null\n }\n}\n\n/**\n * The composite feature's providers, in menu order. The first claims composites as source blocks (`handlesSource`): it\n * offers the core targets for them and executes every conversion of a composite, including kind changes. The second\n * owns the `composite:<kind>` targets: blocks and kind switches. `kinds` are the host's configured kinds; without them the\n * built-in kinds apply, and their labels (the menu entries) follow the language of the `t` the menu renders with. What\n * a conversion writes into the document (the `Label: Wert` line of a composite's meta) uses the built-in kinds in the\n * default language, since `convert` runs without a translator.\n */\nexport function compositeConversions(kinds?: readonly CompositeKind[]): readonly ConversionProvider[] {\n const structure = kinds ?? fallbackCompositeKinds()\n const convert = convertAt(structure)\n const unwrap: ConversionProvider = {\n handlesSource: isComposite,\n targets: (_editor, node) => isComposite(node) ? UNWRAP_TARGETS.filter(target => node.type.schema.nodes[target.type]) : [],\n parseTarget: () => null,\n label: () => null,\n convert,\n }\n const wrap: ConversionProvider = {\n targets: (_editor, node) => {\n if (!(isTextblockNode(node) || isListNode(node) || isQuoteNode(node) || isComposite(node)) || !node.type.schema.nodes[COMPOSITE]) return []\n return structure.map((kind): ConvertTarget => ({ type: 'composite', kind: kind.id })).filter(target => !isCurrentTarget(node, target))\n },\n parseTarget: (id) => {\n if (!id.startsWith(COMPOSITE_PREFIX)) return null\n const kind = id.slice(COMPOSITE_PREFIX.length)\n return structure.some(known => known.id === kind) ? { type: 'composite', kind } : null\n },\n label: (target, t) => {\n if (target.type !== 'composite') return null\n const kind = compositeKind(kinds ?? defaultCompositeKinds(t), target.kind)\n return { label: t('composites.convert.kind', { kind: kind.label }), icon: kind.icon }\n },\n convert,\n }\n return [unwrap, wrap]\n}\n"],"mappings":";;;;;;;AAwBA,MAAM,YAAY;AAClB,MAAM,QAAQ;AACd,MAAM,mBAAmB;AAEzB,MAAM,eAAe,SAAiB,KAAK,KAAK,SAAS;;AAGzD,MAAM,iBAA2C,gBAAgB,SAAQ,OAAM,gBAAgB,EAAE,KAAK,CAAC,CAAC;;;;;;;;AASxG,SAAgB,uBAAuB,Q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OAAO;GACxC,MAAM,OAAO,cAAc,SAAS,sBAAsB,CAAC,GAAG,OAAO,IAAI;GACzE,OAAO;IAAE,OAAO,EAAE,2BAA2B,EAAE,MAAM,KAAK,MAAM,CAAC;IAAG,MAAM,KAAK;GAAK;EACtF;EACA;CAEiB,CAAC;AACtB"}
|
|
1
|
+
{"version":3,"file":"convert.js","names":[],"sources":["../../../src/features/composites/convert.ts"],"sourcesContent":["import { Fragment, type Node as PMNode, type Schema } from '@tiptap/pm/model'\nimport {\n CORE_TARGET_IDS,\n childrenOf,\n type ConvertTarget,\n createConverter,\n finishConversion,\n isCoreTarget,\n isCurrentTarget,\n isListNode,\n isQuoteNode,\n isTextblockNode,\n parseCoreTarget,\n textblockSpecOf,\n} from '../../core/convert'\nimport type { ConversionProvider } from '../../core/feature'\nimport { TYPED_BLOCK, TYPED_BLOCK_DESCRIPTION, TYPED_BLOCK_TAGS, TYPED_BLOCK_TITLE } from '../../core/schema/persisted-names'\nimport { compositeChromeBlocks, flattenCompositesToHeadings, headingGroupRange } from './heading-composites'\nimport { type BlockType, blockTypeOf, defaultBlockTypes, fallbackBlockTypes } from './block-types'\nimport { keptMeta } from './meta-keys'\nimport { COMPOSITE_CHROME_COUNT } from './nodes'\n\n// Vue-free and server-importable: the composite family's block conversions — wrapping blocks into a composite,\n// switching its kind and unwrapping it into plain blocks — as `ConversionProvider`s of the composite feature.\n\nconst TYPED_BLOCK_PREFIX = 'typedBlock:'\n\nconst isComposite = (node: PMNode) => node.type.name === TYPED_BLOCK\n\n/** The conversion targets of the core provider, offered for composites (they unwrap into them). */\nconst UNWRAP_TARGETS: readonly ConvertTarget[] = CORE_TARGET_IDS.flatMap(id => parseCoreTarget(id) ?? [])\n\n/**\n * Blocks `nodes` (siblings) converted to `target`. A composite takes the first block as title and the rest as body;\n * composites unwrap into the core targets (title first, description as italic paragraph, tags as a paragraph of tag\n * chips, meta as a `Label: Wert` line); into a heading, nested composites become sub-headings. Null when nothing\n * changes, the target is not a composite or core target or a node is not a textblock, list, quote or composite.\n * Never looks outside `nodes`: a heading's group is the caller's business.\n */\nexport function convertCompositeBlocks(schema: Schema, nodes: PMNode[], target: ConvertTarget, kinds: readonly BlockType[]): PMNode[] | null {\n const first = nodes[0]\n if (!first || !schema.nodes[target.type]) return null\n if (!nodes.every(node => isTextblockNode(node) || isListNode(node) || isQuoteNode(node) || isComposite(node))) return null\n if (nodes.length === 1 && isCurrentTarget(first, target)) return null\n const n = schema.nodes\n const paragraph = n.paragraph!\n\n /** A composite as plain blocks: title paragraph (an empty one only with `keepEmptyTitle`), description, tags, meta, body. */\n function unwrapComposite(composite: PMNode, keepEmptyTitle: boolean, headingLevel?: number): PMNode[] {\n const title = composite.child(0)\n const blocks: PMNode[] = []\n if (keepEmptyTitle || title.content.size) blocks.push(paragraph.create(null, title.content))\n blocks.push(...compositeChromeBlocks(schema, composite, kinds))\n let body = childrenOf(composite, COMPOSITE_CHROME_COUNT)\n if (headingLevel !== undefined) body = flattenCompositesToHeadings(schema, body, true, headingLevel + 1, kinds) ?? body\n return [...blocks, ...body]\n }\n\n const converter = createConverter(schema, { is: isComposite, unwrap: unwrapComposite })\n\n function toComposite(head: PMNode, rest: PMNode[], kind: string): PMNode {\n if (isComposite(head)) {\n // Another kind: the same node; `meta` keeps the fields of the new kind plus `derivation` and `bib`. Further blocks join its body.\n const meta = keptMeta(blockTypeOf(kinds, kind), head.attrs.meta as Record<string, unknown>)\n return head.type.create({ ...head.attrs, blockType: kind, meta }, [...childrenOf(head), ...rest])\n }\n let title = Fragment.empty\n let body: PMNode[] = []\n if (isTextblockNode(head)) title = converter.inline(head, TYPED_BLOCK_TITLE)\n else if (isQuoteNode(head)) body = childrenOf(head)\n else {\n // List: the first item's paragraph is the title, its other blocks and the remaining items (same list type) the body.\n const [item, ...more] = childrenOf(head)\n const [itemHead, ...itemRest] = item ? childrenOf(item) : []\n if (itemHead && isTextblockNode(itemHead)) title = converter.inline(itemHead, TYPED_BLOCK_TITLE)\n else if (itemHead) itemRest.unshift(itemHead)\n body = [...itemRest, ...(more.length ? [head.type.create(null, more)] : [])]\n }\n body = [...body, ...rest]\n if (!body.length) body = [paragraph.create()]\n return n[TYPED_BLOCK]!.create({ blockType: kind }, [n[TYPED_BLOCK_TITLE]!.create(null, title), n[TYPED_BLOCK_DESCRIPTION]!.create(), n[TYPED_BLOCK_TAGS]!.create(), ...body])\n }\n\n let output: PMNode[]\n if (target.type === 'typedBlock') output = [toComposite(first, nodes.slice(1), target.blockType)]\n else if (!isCoreTarget(target)) return null\n else if (target.type === 'bulletList' || target.type === 'orderedList') output = converter.toList(nodes, target.type)\n else if (target.type === 'blockquote') output = converter.toQuote(nodes)\n else output = converter.toTextblocks(nodes, textblockSpecOf(target))\n return finishConversion(nodes, output)\n}\n\n/**\n * The conversion of the block right after `$start` into `target`: the range it replaces (a heading becoming a composite\n * takes its group along, which turns into the composite's body) and the converted blocks.\n */\nfunction convertAt(kinds: readonly BlockType[]): ConversionProvider['convert'] {\n return (state, $start, target) => {\n const parent = $start.parent\n const from = $start.index()\n const to = target.type === 'typedBlock' && parent.child(from).type.name === 'heading' ? headingGroupRange(parent, from).to : from + 1\n const nodes: PMNode[] = []\n for (let index = from; index < to; index++) nodes.push(parent.child(index))\n const blocks = convertCompositeBlocks(state.schema, nodes, target, kinds)\n return blocks ? { from: $start.pos, to: nodes.reduce((end, node) => end + node.nodeSize, $start.pos), blocks } : null\n }\n}\n\n/**\n * The composite feature's providers, in menu order. The first claims composites as source blocks (`handlesSource`): it\n * offers the core targets for them and executes every conversion of a composite, including kind changes. The second\n * owns the `typedBlock:<kind>` targets: blocks and kind switches. `kinds` are the host's configured kinds; without them the\n * built-in kinds apply, and their labels (the menu entries) follow the language of the `t` the menu renders with. What\n * a conversion writes into the document (the `Label: Wert` line of a composite's meta) uses the built-in kinds in the\n * default language, since `convert` runs without a translator.\n */\nexport function compositeConversions(kinds?: readonly BlockType[]): readonly ConversionProvider[] {\n const structure = kinds ?? fallbackBlockTypes()\n const convert = convertAt(structure)\n const unwrap: ConversionProvider = {\n handlesSource: isComposite,\n targets: (_editor, node) => isComposite(node) ? UNWRAP_TARGETS.filter(target => node.type.schema.nodes[target.type]) : [],\n parseTarget: () => null,\n label: () => null,\n convert,\n }\n const wrap: ConversionProvider = {\n targets: (_editor, node) => {\n if (!(isTextblockNode(node) || isListNode(node) || isQuoteNode(node) || isComposite(node)) || !node.type.schema.nodes[TYPED_BLOCK]) return []\n return structure.map((blockType): ConvertTarget => ({ type: 'typedBlock', blockType: blockType.id })).filter(target => !isCurrentTarget(node, target))\n },\n parseTarget: (id) => {\n if (!id.startsWith(TYPED_BLOCK_PREFIX)) return null\n const blockTypeId = id.slice(TYPED_BLOCK_PREFIX.length)\n return structure.some(known => known.id === blockTypeId) ? { type: 'typedBlock', blockType: blockTypeId } : null\n },\n label: (target, t) => {\n if (target.type !== 'typedBlock') return null\n const kind = blockTypeOf(kinds ?? defaultBlockTypes(t), target.blockType)\n return { label: t('composites.convert.kind', { kind: kind.label }), icon: kind.icon }\n },\n convert,\n }\n return [unwrap, wrap]\n}\n"],"mappings":";;;;;;;;AAyBA,MAAM,qBAAqB;AAE3B,MAAM,eAAe,SAAiB,KAAK,KAAK,SAAS;;AAGzD,MAAM,iBAA2C,gBAAgB,SAAQ,OAAM,gBAAgB,EAAE,KAAK,CAAC,CAAC;;;;;;;;AASxG,SAAgB,uBAAuB,QAAgB,OAAiB,QAAuB,OAA8C;CAC3I,MAAM,QAAQ,MAAM;CACpB,IAAI,CAAC,SAAS,CAAC,OAAO,MAAM,OAAO,OAAO,OAAO;CACjD,IAAI,CAAC,MAAM,OAAM,SAAQ,gBAAgB,IAAI,KAAK,WAAW,IAAI,KAAK,YAAY,IAAI,KAAK,YAAY,IAAI,CAAC,GAAG,OAAO;CACtH,IAAI,MAAM,WAAW,KAAK,gBAAgB,OAAO,MAAM,GAAG,OAAO;CACjE,MAAM,IAAI,OAAO;CACjB,MAAM,YAAY,EAAE;;CAGpB,SAAS,gBAAgB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f, derivationOf, derivationOriginOf, derivationState, isForeignSource } from "../../core/derivation.js";
|
|
4
|
+
import { documentIdOf } from "../../core/block-transfer.js";
|
|
3
5
|
import { sha256Hex } from "../../core/hash.js";
|
|
4
|
-
import { bodyMarkdown
|
|
5
|
-
import { compositeKindsOf } from "./nodes.js";
|
|
6
|
+
import { bodyMarkdown } from "./source.js";
|
|
6
7
|
import { compositeOfRow } from "./rows.js";
|
|
7
8
|
//#region src/features/composites/derived-chrome.ts
|
|
8
9
|
/**
|
|
9
|
-
* The chrome state of the row's
|
|
10
|
-
* changed since it was made, i.e. the
|
|
11
|
-
* Cheap on purpose (no body hashing): the chrome runs it for every row on every refresh.
|
|
12
|
-
* of a block-derived
|
|
10
|
+
* The chrome state of the row's Typed block when it is Derived (null when it is not): `stale` when its asset source has
|
|
11
|
+
* changed since it was made, i.e. the block that holds the asset has a hash that differs from the stored `inputHash`; `sourceMissing`
|
|
12
|
+
* when the original no longer exists. Cheap on purpose (no body hashing): the chrome runs it for every row on every refresh.
|
|
13
|
+
* „bearbeitet“ and the staleness of a block-derived Typed block hash Markdown, so only the details card computes them (`derivationDetailsOf`).
|
|
13
14
|
*/
|
|
14
15
|
function derivedChromeOf(editor, row) {
|
|
15
16
|
const { doc } = editor.state;
|
|
16
17
|
const at = doc.nodeAt(row.pos);
|
|
17
|
-
const found = at?.type.name === "
|
|
18
|
+
const found = at?.type.name === "typedBlock" && (at.attrs.id ?? null) === row.id ? {
|
|
18
19
|
pos: row.pos,
|
|
19
20
|
node: at
|
|
20
21
|
} : compositeOfRow(doc, row);
|
|
21
22
|
if (!found || !derivationOf(found.node)) return null;
|
|
22
|
-
const
|
|
23
|
-
return {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
return editor.storage.blockTransfer?.documentId ?? null;
|
|
23
|
+
const state = derivationState(doc, found.pos, () => "", documentIdOf(editor));
|
|
24
|
+
return {
|
|
25
|
+
stale: state?.stale === true,
|
|
26
|
+
sourceMissing: state?.source === "missing"
|
|
27
|
+
};
|
|
28
28
|
}
|
|
29
29
|
/** Whether `derivation` was made from a block of another document than `editor`'s (its source cannot be looked up here). */
|
|
30
30
|
function derivationIsForeign(editor, derivation) {
|
|
31
31
|
return isForeignSource(derivation, documentIdOf(editor));
|
|
32
32
|
}
|
|
33
33
|
/**
|
|
34
|
-
*
|
|
35
|
-
*
|
|
34
|
+
* Whether the Derived block `node` of `editor`'s document has lost its original (the source-missing state). False for a block that is
|
|
35
|
+
* not Derived, not in the document, or whose original lives in another document.
|
|
36
|
+
*/
|
|
37
|
+
function isSourceMissing(editor, node) {
|
|
38
|
+
const id = node.attrs.id;
|
|
39
|
+
const found = typeof id === "string" && id ? findBlockById(editor.state.doc, id) : null;
|
|
40
|
+
return !!found && derivationOriginOf(editor.state.doc, found.pos, documentIdOf(editor))?.status === "missing";
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Details of the Derived block `node` of `editor`'s document (null when it is not Derived). Serialises and hashes
|
|
44
|
+
* the body (and for a block source the source block), so call it for one Typed block at a time, not for every row.
|
|
36
45
|
*/
|
|
37
46
|
function derivationDetailsOf(editor, node) {
|
|
38
47
|
const derivation = derivationOf(node);
|
|
39
48
|
if (!derivation) return null;
|
|
40
49
|
const { doc } = editor.state;
|
|
41
|
-
const
|
|
50
|
+
const documentId = documentIdOf(editor);
|
|
42
51
|
const id = node.attrs.id;
|
|
43
52
|
const found = typeof id === "string" && id ? findBlockById(doc, id) : null;
|
|
44
|
-
const parent = found ? doc.resolve(found.pos).parent : null;
|
|
45
|
-
const holder = parent?.type.name === "composite" ? parent : null;
|
|
46
53
|
let bodyHash;
|
|
47
|
-
const state = derivationState(
|
|
54
|
+
const state = found ? derivationState(doc, found.pos, () => bodyHash ??= sha256Hex(bodyMarkdown(editor, node)), documentId) : null;
|
|
55
|
+
const origin = found ? derivationOriginOf(doc, found.pos, documentId) : null;
|
|
48
56
|
const foreign = derivationIsForeign(editor, derivation);
|
|
49
|
-
let stale = state
|
|
50
|
-
if ("block" in derivation.from &&
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}
|
|
54
|
-
const documentId = holder ? sourceOf(holder, kinds)?.asset?.documentId : void 0;
|
|
55
|
-
const outputUrl = derivation.output && documentId ? `${EDITOR_API}/assets/${documentId}/${derivation.output}` : null;
|
|
57
|
+
let stale = state?.stale ?? null;
|
|
58
|
+
if ("block" in derivation.from && origin?.status === "found") stale = derivation.inputHash ? sha256Hex(bodyMarkdown(editor, origin.node)) !== derivation.inputHash : null;
|
|
59
|
+
const outputDocument = (origin?.status === "found" ? assetRefOf(String(origin.node.attrs.src ?? ""))?.documentId : void 0) ?? documentId;
|
|
60
|
+
const outputUrl = derivation.output && outputDocument ? `${EDITOR_API}/assets/${outputDocument}/${derivation.output}` : null;
|
|
56
61
|
return {
|
|
57
62
|
derivation,
|
|
58
63
|
foreign,
|
|
64
|
+
sourceMissing: origin?.status === "missing",
|
|
59
65
|
stale,
|
|
60
|
-
edited: state
|
|
66
|
+
edited: state?.edited ?? null,
|
|
61
67
|
outputUrl
|
|
62
68
|
};
|
|
63
69
|
}
|
|
@@ -74,6 +80,6 @@ function derivationMethodLabel(t, method) {
|
|
|
74
80
|
return KNOWN_METHODS.includes(method) ? t(`composites.derivation.method.${method}`) : method;
|
|
75
81
|
}
|
|
76
82
|
//#endregion
|
|
77
|
-
export { derivationDetailsOf, derivationIsForeign, derivationMethodLabel, derivedChromeOf };
|
|
83
|
+
export { derivationDetailsOf, derivationIsForeign, derivationMethodLabel, derivedChromeOf, isSourceMissing };
|
|
78
84
|
|
|
79
85
|
//# sourceMappingURL=derived-chrome.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"derived-chrome.js","names":[],"sources":["../../../src/features/composites/derived-chrome.ts"],"sourcesContent":["// Vue-free: what the composite chrome
|
|
1
|
+
{"version":3,"file":"derived-chrome.js","names":[],"sources":["../../../src/features/composites/derived-chrome.ts"],"sourcesContent":["// Vue-free: what the composite chrome, the details card, the inspector and the outline show for a Derived block (one with a `meta.derivation`).\nimport type { Editor } from '@tiptap/core'\nimport type { Node as PMNode } from '@tiptap/pm/model'\nimport { EDITOR_API } from '../../core/api-routes'\nimport { documentIdOf } from '../../core/block-transfer'\nimport { type Derivation, assetRefOf, derivationOf, derivationOriginOf, derivationState, isForeignSource } from '../../core/derivation'\nimport { sha256Hex } from '../../core/hash'\nimport { findBlockById } from '../../core/schema/block-ids'\nimport type { MessageKey, Translate } from '../../i18n'\nimport { bodyMarkdown } from './source'\nimport { type CompositeRow, compositeOfRow } from './rows'\n\n/** The state of the chrome of a Derived block: `stale` when its asset source has changed since it was made, `sourceMissing` when its original was deleted. */\nexport interface DerivedChrome {\n stale: boolean\n /** The original is gone (deleted, or never in this document): the Derived block stays on its own. */\n sourceMissing: boolean\n}\n\n/**\n * The chrome state of the row's Typed block when it is Derived (null when it is not): `stale` when its asset source has\n * changed since it was made, i.e. the block that holds the asset has a hash that differs from the stored `inputHash`; `sourceMissing`\n * when the original no longer exists. Cheap on purpose (no body hashing): the chrome runs it for every row on every refresh.\n * „bearbeitet“ and the staleness of a block-derived Typed block hash Markdown, so only the details card computes them (`derivationDetailsOf`).\n */\nexport function derivedChromeOf(editor: Editor, row: Pick<CompositeRow, 'id' | 'pos'>): DerivedChrome | null {\n const { doc } = editor.state\n // The row's position may be stale for a moment after an edit; take it only when it still holds the same Typed block.\n const at = doc.nodeAt(row.pos)\n const found = at?.type.name === 'typedBlock' && (at.attrs.id ?? null) === row.id ? { pos: row.pos, node: at } : compositeOfRow(doc, row)\n if (!found || !derivationOf(found.node)) return null\n const state = derivationState(doc, found.pos, () => '', documentIdOf(editor))\n return { stale: state?.stale === true, sourceMissing: state?.source === 'missing' }\n}\n\n/** Whether `derivation` was made from a block of another document than `editor`'s (its source cannot be looked up here). */\nexport function derivationIsForeign(editor: Editor, derivation: Derivation): boolean {\n return isForeignSource(derivation, documentIdOf(editor))\n}\n\n/**\n * Whether the Derived block `node` of `editor`'s document has lost its original (the source-missing state). False for a block that is\n * not Derived, not in the document, or whose original lives in another document.\n */\nexport function isSourceMissing(editor: Editor, node: PMNode): boolean {\n const id: unknown = node.attrs.id\n const found = typeof id === 'string' && id ? findBlockById(editor.state.doc, id) : null\n return !!found && derivationOriginOf(editor.state.doc, found.pos, documentIdOf(editor))?.status === 'missing'\n}\n\n/** Everything the details card shows about the derivation of `node`; `stale`/`edited` are null when they cannot be told. */\nexport interface DerivationDetails {\n derivation: Derivation\n /** The source lives in another document: nothing to compare with (`stale` is null) and nothing to reveal. */\n foreign: boolean\n /** The original was deleted: the Derived block stays without it (`derivationState`: `source: 'missing'`). */\n sourceMissing: boolean\n /** The source changed since `node` was made: asset hash for an asset source, Markdown hash of the source block for a block source; null for a foreign or missing source. */\n stale: boolean | null\n /** The body differs from what was generated. */\n edited: boolean | null\n /** URL of the stored raw output, when there is one and its document is known. */\n outputUrl: string | null\n}\n\n/**\n * Details of the Derived block `node` of `editor`'s document (null when it is not Derived). Serialises and hashes\n * the body (and for a block source the source block), so call it for one Typed block at a time, not for every row.\n */\nexport function derivationDetailsOf(editor: Editor, node: PMNode): DerivationDetails | null {\n const derivation = derivationOf(node)\n if (!derivation) return null\n const { doc } = editor.state\n const documentId = documentIdOf(editor)\n const id: unknown = node.attrs.id\n const found = typeof id === 'string' && id ? findBlockById(doc, id) : null\n\n let bodyHash: string | undefined\n const state = found ? derivationState(doc, found.pos, () => (bodyHash ??= sha256Hex(bodyMarkdown(editor, node))), documentId) : null\n const origin = found ? derivationOriginOf(doc, found.pos, documentId) : null\n const foreign = derivationIsForeign(editor, derivation)\n let stale = state?.stale ?? null\n if ('block' in derivation.from && origin?.status === 'found') {\n stale = derivation.inputHash ? sha256Hex(bodyMarkdown(editor, origin.node)) !== derivation.inputHash : null\n }\n\n // The stored raw output lives in the document that holds the original's asset; without an original, in the open document.\n const assetDocument = origin?.status === 'found' ? assetRefOf(String(origin.node.attrs.src ?? ''))?.documentId : undefined\n const outputDocument = assetDocument ?? documentId\n const outputUrl = derivation.output && outputDocument ? `${EDITOR_API}/assets/${outputDocument}/${derivation.output}` : null\n return { derivation, foreign, sourceMissing: origin?.status === 'missing', stale, edited: state?.edited ?? null, outputUrl }\n}\n\nconst KNOWN_METHODS: readonly string[] = ['transcription', 'pdf-text', 'ocr', 'description', 'bibliography']\n\n/** The words for a derivation method: the known ones translated, `ai:<kind>` as „KI-Ableitung“, anything else as stored. */\nexport function derivationMethodLabel(t: Translate, method: string): string {\n if (method.startsWith('ai:')) return t('composites.derivation.method.ai')\n return KNOWN_METHODS.includes(method) ? t(`composites.derivation.method.${method}` as MessageKey) : method\n}\n"],"mappings":";;;;;;;;;;;;;;AAyBA,SAAgB,gBAAgB,QAAgB,KAA6D;CAC3G,MAAM,EAAE,QAAQ,OAAO;CAEvB,MAAM,KAAK,IAAI,OAAO,IAAI,GAAG;CAC7B,MAAM,QAAQ,IAAI,KAAK,SAAS,iBAAiB,GAAG,MAAM,MAAM,UAAU,IAAI,KAAK;EAAE,KAAK,IAAI;EAAK,MAAM;CAAG,IAAI,eAAe,KAAK,GAAG;CACvI,IAAI,CAAC,SAAS,CAAC,aAAa,MAAM,IAAI,GAAG,OAAO;CAChD,MAAM,QAAQ,gBAAgB,KAAK,MAAM,WAAW,IAAI,aAAa,MAAM,CAAC;CAC5E,OAAO;EAAE,OAAO,OAAO,UAAU;EAAM,eAAe,OAAO,WAAW;CAAU;AACpF;;AAGA,SAAgB,oBAAoB,QAAgB,YAAiC;CACnF,OAAO,gBAAgB,YAAY,aAAa,MAAM,CAAC;AACzD;;;;;AAMA,SAAgB,gBAAgB,QAAgB,MAAuB;CACrE,MAAM,KAAc,KAAK,MAAM;CAC/B,MAAM,QAAQ,OAAO,OAAO,YAAY,KAAK,cAAc,OAAO,MAAM,KAAK,EAAE,IAAI;CACnF,OAAO,CAAC,CAAC,SAAS,mBAAmB,OAAO,MAAM,KAAK,MAAM,KAAK,aAAa,MAAM,CAAC,CAAC,EAAE,WAAW;AACtG;;;;;A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: "composites.settings.scope.heading.description"
|
|
14
14
|
}
|
|
15
15
|
};
|
|
16
|
-
const
|
|
16
|
+
const BLOCK_TYPE_ICON_KEYS = {
|
|
17
17
|
always: {
|
|
18
|
-
labelKey: "composites.settings.
|
|
19
|
-
descriptionKey: "composites.settings.
|
|
18
|
+
labelKey: "composites.settings.blockTypeIcon.always.label",
|
|
19
|
+
descriptionKey: "composites.settings.blockTypeIcon.always.description"
|
|
20
20
|
},
|
|
21
21
|
hover: {
|
|
22
|
-
labelKey: "composites.settings.
|
|
23
|
-
descriptionKey: "composites.settings.
|
|
22
|
+
labelKey: "composites.settings.blockTypeIcon.hover.label",
|
|
23
|
+
descriptionKey: "composites.settings.blockTypeIcon.hover.description"
|
|
24
24
|
}
|
|
25
25
|
};
|
|
26
26
|
const DRAG_HANDLE_KEYS = {
|
|
@@ -42,6 +42,6 @@ function optionItems(values, keys, t) {
|
|
|
42
42
|
}));
|
|
43
43
|
}
|
|
44
44
|
//#endregion
|
|
45
|
-
export { DRAG_HANDLE_KEYS, HEADING_SCOPE_KEYS,
|
|
45
|
+
export { BLOCK_TYPE_ICON_KEYS, DRAG_HANDLE_KEYS, HEADING_SCOPE_KEYS, optionItems };
|
|
46
46
|
|
|
47
47
|
//# sourceMappingURL=editing-settings-keys.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"editing-settings-keys.js","names":[],"sources":["../../../src/features/composites/editing-settings-keys.ts"],"sourcesContent":["import type { MessageKey, Translate } from '../../i18n'\nimport type { DragHandleVisibility, HeadingConversionScope
|
|
1
|
+
{"version":3,"file":"editing-settings-keys.js","names":[],"sources":["../../../src/features/composites/editing-settings-keys.ts"],"sourcesContent":["import type { MessageKey, Translate } from '../../i18n'\nimport type { BlockTypeIconVisibility, DragHandleVisibility, HeadingConversionScope } from '../../settings'\n\n/** Message keys of the labels of the „Bearbeiten“ settings radios (Vue and React); resolve them with `t`. The stored values stay the ids. */\nexport interface OptionKeys { labelKey: MessageKey, descriptionKey: MessageKey }\n\nexport const HEADING_SCOPE_KEYS: Record<HeadingConversionScope, OptionKeys> = {\n container: { labelKey: 'composites.settings.scope.container.label', descriptionKey: 'composites.settings.scope.container.description' },\n document: { labelKey: 'composites.settings.scope.document.label', descriptionKey: 'composites.settings.scope.document.description' },\n heading: { labelKey: 'composites.settings.scope.heading.label', descriptionKey: 'composites.settings.scope.heading.description' },\n}\n\nexport const BLOCK_TYPE_ICON_KEYS: Record<BlockTypeIconVisibility, OptionKeys> = {\n always: { labelKey: 'composites.settings.blockTypeIcon.always.label', descriptionKey: 'composites.settings.blockTypeIcon.always.description' },\n hover: { labelKey: 'composites.settings.blockTypeIcon.hover.label', descriptionKey: 'composites.settings.blockTypeIcon.hover.description' },\n}\n\nexport const DRAG_HANDLE_KEYS: Record<DragHandleVisibility, OptionKeys> = {\n hover: { labelKey: 'composites.settings.dragHandle.hover.label', descriptionKey: 'composites.settings.dragHandle.hover.description' },\n always: { labelKey: 'composites.settings.dragHandle.always.label', descriptionKey: 'composites.settings.dragHandle.always.description' },\n}\n\n/** The radio items of `values`, with the label and description of each resolved through `t`. */\nexport function optionItems<T extends string>(values: readonly T[], keys: Record<T, OptionKeys>, t: Translate): { value: T, label: string, description: string }[] {\n return values.map(value => ({ value, label: t(keys[value].labelKey), description: t(keys[value].descriptionKey) }))\n}\n"],"mappings":";AAMA,MAAa,qBAAiE;CAC5E,WAAW;EAAE,UAAU;EAA6C,gBAAgB;CAAkD;CACtI,UAAU;EAAE,UAAU;EAA4C,gBAAgB;CAAiD;CACnI,SAAS;EAAE,UAAU;EAA2C,gBAAgB;CAAgD;AAClI;AAEA,MAAa,uBAAoE;CAC/E,QAAQ;EAAE,UAAU;EAAkD,gBAAgB;CAAuD;CAC7I,OAAO;EAAE,UAAU;EAAiD,gBAAgB;CAAsD;AAC5I;AAEA,MAAa,mBAA6D;CACxE,OAAO;EAAE,UAAU;EAA8C,gBAAgB;CAAmD;CACpI,QAAQ;EAAE,UAAU;EAA+C,gBAAgB;CAAoD;AACzI;;AAGA,SAAgB,YAA8B,QAAsB,MAA6B,GAAkE;CACjK,OAAO,OAAO,KAAI,WAAU;EAAE;EAAO,OAAO,EAAE,KAAK,MAAM,CAAC,QAAQ;EAAG,aAAa,EAAE,KAAK,MAAM,CAAC,cAAc;CAAE,EAAE;AACpH"}
|
|
@@ -1,34 +1,34 @@
|
|
|
1
1
|
import { EditorFeature } from "../../core/feature.js";
|
|
2
|
-
import "../../core/index.js";
|
|
3
|
-
import { CompositeKind } from "./kinds.js";
|
|
4
2
|
import { Basket } from "./baskets.js";
|
|
3
|
+
import { BlockType } from "./block-types.js";
|
|
4
|
+
import "../../core/index.js";
|
|
5
5
|
import { CompositeNodeViews } from "./node-views.js";
|
|
6
6
|
//#region src/features/composites/feature.d.ts
|
|
7
7
|
/** What a framework binding supplies to the composites feature. */
|
|
8
8
|
export interface CompositesUi<C> {
|
|
9
9
|
/** The chips on each title line and the details popover on the kind icon; mounted as an overlay. */
|
|
10
10
|
chrome: C;
|
|
11
|
-
/** The focus chip („Fokus: <Titel> · Aufheben“) shown while a
|
|
11
|
+
/** The focus chip („Fokus: <Titel> · Aufheben“) shown while a Typed block is focused; mounted as an overlay. Absent: no chip (the focus mode itself works). */
|
|
12
12
|
focusChip?: C;
|
|
13
|
-
/** The „Bearbeiten“ settings tab; receives `{
|
|
13
|
+
/** The „Bearbeiten“ settings tab; receives `{ blockTypes }` as props. */
|
|
14
14
|
settingsTab: C;
|
|
15
15
|
/** The composite block view of the framework. */
|
|
16
16
|
nodeViews: CompositeNodeViews;
|
|
17
17
|
}
|
|
18
18
|
/** Options of `compositeFeature`. */
|
|
19
19
|
export interface CompositeFeatureOptions {
|
|
20
|
-
/** The
|
|
21
|
-
|
|
22
|
-
/** The colour baskets a
|
|
20
|
+
/** The Block types offered in the editor, with their own labels (default: `defaultBlockTypes(t)`, the built-in Block types in the editor's language); read once. */
|
|
21
|
+
blockTypes?: readonly BlockType[];
|
|
22
|
+
/** The colour baskets a Typed block can be put into (default: `defaultBaskets(t)`, red/orange/yellow/green/blue in the editor's language; colours are the `--sk-basket-<id>` CSS variables); read once. */
|
|
23
23
|
baskets?: readonly Basket[];
|
|
24
24
|
}
|
|
25
25
|
/**
|
|
26
|
-
* Composites (
|
|
26
|
+
* Composites (Typed blocks): the node family with its node views, the toolbar group (insert, „In Block umwandeln“,
|
|
27
27
|
* „Gliederung umwandeln“), `/` commands, the conversion providers (wrap into / switch kind of / unwrap composites),
|
|
28
28
|
* Markdown `:::` fences, legacy `section` migration, the preferred-structure setting and its `editing` settings tab,
|
|
29
29
|
* the chips on each title line (status, tags) and the details popover on the kind icon (the binding's `chrome` overlay), focus mode on one
|
|
30
|
-
*
|
|
31
|
-
* the AI view of
|
|
30
|
+
* Typed block (`CompositeFocus`, the „Fokussieren“ block action and the binding's `focusChip` overlay), and
|
|
31
|
+
* the AI view of Block types and structure, and the Block types' accepted children (`AcceptedChildren`: an edit that nests a Typed block
|
|
32
32
|
* into one that does not accept its kind is refused with a notice). Contributes the `parseMarkdown`,
|
|
33
33
|
* `structure` and `migrateContent` stages. Imports no AI, media or transcript code.
|
|
34
34
|
*/
|