@ecsplico/editor 3.6.0 → 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 +65 -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/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/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 +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/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 +7 -4
- 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 +6 -6
- 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 -89
- package/dist/features/composites/kinds.js +0 -285
- package/dist/features/composites/kinds.js.map +0 -1
package/dist/vue/compose.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { coreUiFeature } from "../core/core-feature.js";
|
|
2
|
-
import { composeEditor as composeEditor$1 } from "../presets/compose.js";
|
|
3
2
|
import { bulletsTransform, summaryTransform } from "../integrations/composite-ai/transfer-transforms.js";
|
|
4
3
|
import { compositeAiFeature } from "../integrations/composite-ai/index.js";
|
|
5
4
|
import { transcriptAiFeature } from "../integrations/transcript-ai/index.js";
|
|
5
|
+
import { composeEditor as composeEditor$1 } from "../presets/compose.js";
|
|
6
6
|
import { mediaFeature } from "../features/media/vue.js";
|
|
7
7
|
import _sfc_main from "./components/EditorCommandPalette.js";
|
|
8
8
|
import { aiFeature } from "../features/ai/vue.js";
|
|
@@ -40,7 +40,7 @@ const VUE_BINDINGS = {
|
|
|
40
40
|
const composeEditor = (options) => composeEditor$1(VUE_BINDINGS, options);
|
|
41
41
|
/**
|
|
42
42
|
* The advanced editor on the Vue surface: `{ content: 'rich', interaction: 'full', ai: true }`, every dimension option
|
|
43
|
-
* overridable (`
|
|
43
|
+
* overridable (`blockTypes`, `backend`, `add`, `remove`, ...). Collaboration is active only when a session is passed
|
|
44
44
|
* to the surface.
|
|
45
45
|
*/
|
|
46
46
|
const advancedEditor = (options = {}) => composeEditor({
|
package/dist/vue/compose.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compose.js","names":["EditorCommandPalette","compose"],"sources":["../../src/vue/compose.ts"],"sourcesContent":["import type { Component } from 'vue'\nimport { coreUiFeature } from '../core/core-feature'\nimport EditorCommandPalette from './components/EditorCommandPalette.vue'\nimport { aiFeature } from '../features/ai/vue'\nimport { authorsFeature } from '../features/authors/vue'\nimport { blockUiFeature } from '../features/block-ui/vue'\nimport { collabFeature } from '../features/collab/vue'\nimport { commentsFeature } from '../features/comments/vue'\nimport { compositeFeature } from '../features/composites/vue'\nimport { mediaFeature } from '../features/media/vue'\nimport { themesFeature } from '../features/themes/vue'\nimport { transferFeature } from '../features/transfer/vue'\nimport { transcriptFeature } from '../features/transcript/vue'\nimport { bulletsTransform, compositeAiFeature, summaryTransform } from '../integrations/composite-ai'\nimport { transcriptAiFeature } from '../integrations/transcript-ai'\nimport { type ComposedEditor, type ComposeOptions, composeEditor as compose, type UiBindings } from '../presets/compose'\n\n/** The Vue bindings of every UI-bound catalog feature. */\nconst VUE_BINDINGS = {\n 'core-ui': () => coreUiFeature<Component>({ palette: EditorCommandPalette }),\n 'media': mediaFeature,\n 'transcript': transcriptFeature,\n 'composites': compositeFeature,\n 'authors': authorsFeature,\n 'comments': commentsFeature,\n 'ai': aiFeature,\n 'composite-ai': compositeAiFeature,\n 'transcript-ai': transcriptAiFeature,\n 'collab': collabFeature,\n 'block-ui': blockUiFeature,\n 'themes': themesFeature,\n 'transfer': transferFeature,\n 'transfer-ai': () => [summaryTransform, bulletsTransform],\n} satisfies UiBindings<Component>\n\n/**\n * `composeEditor` of `presets/compose` over the Vue bindings: the editor of the three dimensions (`content`,\n * `interaction`, `ai`), pruned by the capabilities of `options.backend`. Call during component setup (`themesFeature()`\n * reads the current Vue app to stop the theme runtime when it unmounts).\n */\nexport const composeEditor = (options: ComposeOptions<Component>): ComposedEditor<Component> => compose(VUE_BINDINGS, options)\n\n/**\n * The advanced editor on the Vue surface: `{ content: 'rich', interaction: 'full', ai: true }`, every dimension option\n * overridable (`
|
|
1
|
+
{"version":3,"file":"compose.js","names":["EditorCommandPalette","compose"],"sources":["../../src/vue/compose.ts"],"sourcesContent":["import type { Component } from 'vue'\nimport { coreUiFeature } from '../core/core-feature'\nimport EditorCommandPalette from './components/EditorCommandPalette.vue'\nimport { aiFeature } from '../features/ai/vue'\nimport { authorsFeature } from '../features/authors/vue'\nimport { blockUiFeature } from '../features/block-ui/vue'\nimport { collabFeature } from '../features/collab/vue'\nimport { commentsFeature } from '../features/comments/vue'\nimport { compositeFeature } from '../features/composites/vue'\nimport { mediaFeature } from '../features/media/vue'\nimport { themesFeature } from '../features/themes/vue'\nimport { transferFeature } from '../features/transfer/vue'\nimport { transcriptFeature } from '../features/transcript/vue'\nimport { bulletsTransform, compositeAiFeature, summaryTransform } from '../integrations/composite-ai'\nimport { transcriptAiFeature } from '../integrations/transcript-ai'\nimport { type ComposedEditor, type ComposeOptions, composeEditor as compose, type UiBindings } from '../presets/compose'\n\n/** The Vue bindings of every UI-bound catalog feature. */\nconst VUE_BINDINGS = {\n 'core-ui': () => coreUiFeature<Component>({ palette: EditorCommandPalette }),\n 'media': mediaFeature,\n 'transcript': transcriptFeature,\n 'composites': compositeFeature,\n 'authors': authorsFeature,\n 'comments': commentsFeature,\n 'ai': aiFeature,\n 'composite-ai': compositeAiFeature,\n 'transcript-ai': transcriptAiFeature,\n 'collab': collabFeature,\n 'block-ui': blockUiFeature,\n 'themes': themesFeature,\n 'transfer': transferFeature,\n 'transfer-ai': () => [summaryTransform, bulletsTransform],\n} satisfies UiBindings<Component>\n\n/**\n * `composeEditor` of `presets/compose` over the Vue bindings: the editor of the three dimensions (`content`,\n * `interaction`, `ai`), pruned by the capabilities of `options.backend`. Call during component setup (`themesFeature()`\n * reads the current Vue app to stop the theme runtime when it unmounts).\n */\nexport const composeEditor = (options: ComposeOptions<Component>): ComposedEditor<Component> => compose(VUE_BINDINGS, options)\n\n/**\n * The advanced editor on the Vue surface: `{ content: 'rich', interaction: 'full', ai: true }`, every dimension option\n * overridable (`blockTypes`, `backend`, `add`, `remove`, ...). Collaboration is active only when a session is passed\n * to the surface.\n */\nexport const advancedEditor = (options: Partial<ComposeOptions<Component>> = {}): ComposedEditor<Component> => composeEditor({ content: 'rich', interaction: 'full', ai: true, ...options })\n"],"mappings":";;;;;;;;;;;;;;;;;;AAkBA,MAAM,eAAe;CACnB,iBAAiB,cAAyB,EAAE,SAASA,UAAqB,CAAC;CAC3E,SAAS;CACT,cAAc;CACd,cAAc;CACd,WAAW;CACX,YAAY;CACZ,MAAM;CACN,gBAAgB;CAChB,iBAAiB;CACjB,UAAU;CACV,YAAY;CACZ,UAAU;CACV,YAAY;CACZ,qBAAqB,CAAC,kBAAkB,gBAAgB;AAC1D;;;;;;AAOA,MAAa,iBAAiB,YAAkEC,gBAAQ,cAAc,OAAO;;;;;;AAO7H,MAAa,kBAAkB,UAA8C,CAAC,MAAiC,cAAc;CAAE,SAAS;CAAQ,aAAa;CAAQ,IAAI;CAAM,GAAG;AAAQ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ecsplico/editor",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Vue and React editor library on TipTap v3 (Vue: Nuxt UI; React: shadcn/ui): framework-free features with Vue and React bindings, simple and advanced presets, tree-shakeable entries. Built ESM with type declarations.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import { CompositeKind } from "./kinds.js";
|
|
2
|
-
import { DERIVATION_KEY } from "./meta-keys.js";
|
|
3
|
-
import { Editor } from "@tiptap/core";
|
|
4
|
-
import { Node as Node$1 } from "@tiptap/pm/model";
|
|
5
|
-
//#region src/features/composites/derivation.d.ts
|
|
6
|
-
/** How a derived Baustein was made; `ai:<kindId>` for a block derived from another block by the model. */
|
|
7
|
-
export type DerivationMethod = 'transcription' | 'pdf-text' | 'ocr' | 'description' | 'bibliography' | (string & {});
|
|
8
|
-
/** What a derived Baustein was made from: an uploaded asset (by asset name) or another block (by block id). */
|
|
9
|
-
export type DerivationSource = {
|
|
10
|
-
asset: string;
|
|
11
|
-
} | {
|
|
12
|
-
block: string; /** Document the block lives in; absent = this document. */
|
|
13
|
-
document?: string;
|
|
14
|
-
};
|
|
15
|
-
/** `meta.derivation` of a derived Baustein. */
|
|
16
|
-
export interface Derivation {
|
|
17
|
-
from: DerivationSource;
|
|
18
|
-
method: DerivationMethod;
|
|
19
|
-
model?: string;
|
|
20
|
-
/** ISO timestamp. */
|
|
21
|
-
createdAt: string;
|
|
22
|
-
/** SHA-256 hex of the asset bytes / of the source block's Markdown; `''` when unknown. */
|
|
23
|
-
inputHash: string;
|
|
24
|
-
/** SHA-256 hex of the produced body's Markdown; `''` when unknown. */
|
|
25
|
-
outputHash: string;
|
|
26
|
-
/** Asset name of the stored raw output (text/markdown). */
|
|
27
|
-
output?: string;
|
|
28
|
-
}
|
|
29
|
-
/** The derivation of a composite (`meta.derivation` with a `from` object and a `method`); null when it has none. */
|
|
30
|
-
export declare function derivationOf(node: Node$1): Derivation | null;
|
|
31
|
-
/** The media block a source-holding kind keeps its original in: first body child of a type in `kind.source`. */
|
|
32
|
-
export declare function sourceOf(composite: Node$1, kinds: readonly CompositeKind[]): {
|
|
33
|
-
node: Node$1;
|
|
34
|
-
index: number;
|
|
35
|
-
asset: {
|
|
36
|
-
documentId: string;
|
|
37
|
-
name: string;
|
|
38
|
-
} | null;
|
|
39
|
-
hash: string | null;
|
|
40
|
-
} | null;
|
|
41
|
-
/** The body children of `composite` that are derived Bausteine, with their child index. */
|
|
42
|
-
export declare function renditionsOf(composite: Node$1): {
|
|
43
|
-
node: Node$1;
|
|
44
|
-
index: number;
|
|
45
|
-
derivation: Derivation;
|
|
46
|
-
}[];
|
|
47
|
-
/**
|
|
48
|
-
* Whether `derived` (a Baustein with a derivation, a child of `composite`) is out of date or was edited since it was made.
|
|
49
|
-
* `stale`: for an asset source, the block `sourceOf(composite, kinds)` finds has a `hash` that differs from `inputHash`; null
|
|
50
|
-
* when either is unknown. A block source is null here: callers with the document compare the hash of the source block's
|
|
51
|
-
* Markdown. `edited`: the body's
|
|
52
|
-
* hash (computed lazily, it serialises the whole body) differs from `outputHash`; null when `outputHash` is unknown.
|
|
53
|
-
*/
|
|
54
|
-
export declare function derivationState(composite: Node$1, derived: Node$1, bodyHash: () => string, kinds: readonly CompositeKind[]): {
|
|
55
|
-
stale: boolean | null;
|
|
56
|
-
edited: boolean | null;
|
|
57
|
-
};
|
|
58
|
-
/** Markdown of the body of `composite` (everything after title, description and tags). */
|
|
59
|
-
export declare function bodyMarkdown(editor: Editor, composite: Node$1): string;
|
|
60
|
-
//#endregion
|
|
61
|
-
export { DERIVATION_KEY };
|
|
62
|
-
//# sourceMappingURL=derivation.d.ts.map
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
import { EDITOR_API } from "../../core/api-routes.js";
|
|
2
|
-
import { compositeKind } from "./kinds.js";
|
|
3
|
-
import { DERIVATION_KEY } from "./meta-keys.js";
|
|
4
|
-
import "./nodes.js";
|
|
5
|
-
//#region src/features/composites/derivation.ts
|
|
6
|
-
/** The derivation of a composite (`meta.derivation` with a `from` object and a `method`); null when it has none. */
|
|
7
|
-
function derivationOf(node) {
|
|
8
|
-
const meta = node.attrs.meta;
|
|
9
|
-
const value = meta && typeof meta === "object" ? meta[DERIVATION_KEY] : void 0;
|
|
10
|
-
if (!value || typeof value !== "object") return null;
|
|
11
|
-
const { from, method } = value;
|
|
12
|
-
if (!from || typeof from !== "object" || typeof method !== "string") return null;
|
|
13
|
-
return value;
|
|
14
|
-
}
|
|
15
|
-
/** Whether `derivation` points at a block of another document than `documentId` (the open one; null/undefined = unknown, so any named document is another). */
|
|
16
|
-
function isForeignSource(derivation, documentId) {
|
|
17
|
-
return "block" in derivation.from && !!derivation.from.document && derivation.from.document !== documentId;
|
|
18
|
-
}
|
|
19
|
-
const ASSET_URL_PREFIX = `${EDITOR_API}/assets/`;
|
|
20
|
-
const ASSET_NAME = /^[0-9a-f-]{36}\.[a-z0-9]{1,8}$/;
|
|
21
|
-
const ASSET_DOCUMENT_ID = /^[A-Za-z0-9_-]{1,64}$/;
|
|
22
|
-
/** The stored asset behind an `/api/editor/assets/<documentId>/<name>` URL; null for any other `src`. */
|
|
23
|
-
function assetRefOf(src) {
|
|
24
|
-
if (!src.startsWith(ASSET_URL_PREFIX)) return null;
|
|
25
|
-
const [documentId, name, ...rest] = src.slice(ASSET_URL_PREFIX.length).split("/");
|
|
26
|
-
if (rest.length || !documentId || !name || !ASSET_DOCUMENT_ID.test(documentId) || !ASSET_NAME.test(name)) return null;
|
|
27
|
-
return {
|
|
28
|
-
documentId,
|
|
29
|
-
name
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
/** The media block a source-holding kind keeps its original in: first body child of a type in `kind.source`. */
|
|
33
|
-
function sourceOf(composite, kinds) {
|
|
34
|
-
if (composite.type.name !== "composite") return null;
|
|
35
|
-
const types = compositeKind(kinds, String(composite.attrs.kind)).source;
|
|
36
|
-
if (!types) return null;
|
|
37
|
-
for (let index = 3; index < composite.childCount; index++) {
|
|
38
|
-
const node = composite.child(index);
|
|
39
|
-
if (!types.includes(node.type.name)) continue;
|
|
40
|
-
const hash = node.attrs.hash;
|
|
41
|
-
return {
|
|
42
|
-
node,
|
|
43
|
-
index,
|
|
44
|
-
asset: assetRefOf(String(node.attrs.src ?? "")),
|
|
45
|
-
hash: typeof hash === "string" && hash ? hash : null
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
return null;
|
|
49
|
-
}
|
|
50
|
-
/** The body children of `composite` that are derived Bausteine, with their child index. */
|
|
51
|
-
function renditionsOf(composite) {
|
|
52
|
-
const found = [];
|
|
53
|
-
composite.forEach((node, _offset, index) => {
|
|
54
|
-
if (index < 3 || node.type.name !== "composite") return;
|
|
55
|
-
const derivation = derivationOf(node);
|
|
56
|
-
if (derivation) found.push({
|
|
57
|
-
node,
|
|
58
|
-
index,
|
|
59
|
-
derivation
|
|
60
|
-
});
|
|
61
|
-
});
|
|
62
|
-
return found;
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* Whether `derived` (a Baustein with a derivation, a child of `composite`) is out of date or was edited since it was made.
|
|
66
|
-
* `stale`: for an asset source, the block `sourceOf(composite, kinds)` finds has a `hash` that differs from `inputHash`; null
|
|
67
|
-
* when either is unknown. A block source is null here: callers with the document compare the hash of the source block's
|
|
68
|
-
* Markdown. `edited`: the body's
|
|
69
|
-
* hash (computed lazily, it serialises the whole body) differs from `outputHash`; null when `outputHash` is unknown.
|
|
70
|
-
*/
|
|
71
|
-
function derivationState(composite, derived, bodyHash, kinds) {
|
|
72
|
-
const derivation = derivationOf(derived);
|
|
73
|
-
if (!derivation) return {
|
|
74
|
-
stale: null,
|
|
75
|
-
edited: null
|
|
76
|
-
};
|
|
77
|
-
let stale = null;
|
|
78
|
-
if ("asset" in derivation.from) {
|
|
79
|
-
const hash = sourceOf(composite, kinds)?.hash;
|
|
80
|
-
stale = hash && derivation.inputHash ? hash !== derivation.inputHash : null;
|
|
81
|
-
}
|
|
82
|
-
const edited = derivation.outputHash ? bodyHash() !== derivation.outputHash : null;
|
|
83
|
-
return {
|
|
84
|
-
stale,
|
|
85
|
-
edited
|
|
86
|
-
};
|
|
87
|
-
}
|
|
88
|
-
/** Markdown of the body of `composite` (everything after title, description and tags). */
|
|
89
|
-
function bodyMarkdown(editor, composite) {
|
|
90
|
-
const content = [];
|
|
91
|
-
composite.forEach((child, _offset, index) => {
|
|
92
|
-
if (index >= 3) content.push(child.toJSON());
|
|
93
|
-
});
|
|
94
|
-
return editor.markdown.serialize({
|
|
95
|
-
type: "doc",
|
|
96
|
-
content
|
|
97
|
-
});
|
|
98
|
-
}
|
|
99
|
-
//#endregion
|
|
100
|
-
export { DERIVATION_KEY, assetRefOf, bodyMarkdown, derivationOf, derivationState, isForeignSource, renditionsOf, sourceOf };
|
|
101
|
-
|
|
102
|
-
//# sourceMappingURL=derivation.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"derivation.js","names":[],"sources":["../../../src/features/composites/derivation.ts"],"sourcesContent":["// Vue-free and server-importable: where a Baustein's content comes from. A source-holding Baustein (`recording`, `paper`,\n// `book`, `figure`, `document`) carries its original as an `image|audio|video|file` block in the body; a derived\n// Baustein (transcript, full text, description, AI result) records in `meta.derivation` what it was made from.\nimport type { Editor, JSONContent } from '@tiptap/core'\n// Types only: brings in the `editor.markdown` augmentation of `@tiptap/markdown` for contexts that do not otherwise load it.\nimport type {} from '@tiptap/markdown'\nimport type { Node as PMNode } from '@tiptap/pm/model'\nimport { EDITOR_API } from '../../core/api-routes'\nimport { type CompositeKind, compositeKind } from './kinds'\nimport { COMPOSITE_CHROME_COUNT } from './nodes'\nimport { DERIVATION_KEY } from './meta-keys'\n\n/** How a derived Baustein was made; `ai:<kindId>` for a block derived from another block by the model. */\nexport type DerivationMethod = 'transcription' | 'pdf-text' | 'ocr' | 'description' | 'bibliography' | (string & {})\n\n/** What a derived Baustein was made from: an uploaded asset (by asset name) or another block (by block id). */\nexport type DerivationSource = { asset: string } | { block: string, /** Document the block lives in; absent = this document. */ document?: string }\n\n/** `meta.derivation` of a derived Baustein. */\nexport interface Derivation {\n from: DerivationSource\n method: DerivationMethod\n model?: string\n /** ISO timestamp. */\n createdAt: string\n /** SHA-256 hex of the asset bytes / of the source block's Markdown; `''` when unknown. */\n inputHash: string\n /** SHA-256 hex of the produced body's Markdown; `''` when unknown. */\n outputHash: string\n /** Asset name of the stored raw output (text/markdown). */\n output?: string\n}\n\nexport { DERIVATION_KEY }\n\n/** The derivation of a composite (`meta.derivation` with a `from` object and a `method`); null when it has none. */\nexport function derivationOf(node: PMNode): Derivation | null {\n const meta: unknown = node.attrs.meta\n const value = meta && typeof meta === 'object' ? (meta as Record<string, unknown>)[DERIVATION_KEY] : undefined\n if (!value || typeof value !== 'object') return null\n const { from, method } = value as Record<string, unknown>\n if (!from || typeof from !== 'object' || typeof method !== 'string') return null\n return value as Derivation\n}\n\n/** Whether `derivation` points at a block of another document than `documentId` (the open one; null/undefined = unknown, so any named document is another). */\nexport function isForeignSource(derivation: Derivation, documentId: string | null | undefined): boolean {\n return 'block' in derivation.from && !!derivation.from.document && derivation.from.document !== documentId\n}\n\nconst ASSET_URL_PREFIX = `${EDITOR_API}/assets/`\n// Same patterns as `features/media/assets.ts`; copied because composites must not import media.\nconst ASSET_NAME = /^[0-9a-f-]{36}\\.[a-z0-9]{1,8}$/\nconst ASSET_DOCUMENT_ID = /^[A-Za-z0-9_-]{1,64}$/\n\n/** The stored asset behind an `/api/editor/assets/<documentId>/<name>` URL; null for any other `src`. */\nexport function assetRefOf(src: string): { documentId: string, name: string } | null {\n if (!src.startsWith(ASSET_URL_PREFIX)) return null\n const [documentId, name, ...rest] = src.slice(ASSET_URL_PREFIX.length).split('/')\n if (rest.length || !documentId || !name || !ASSET_DOCUMENT_ID.test(documentId) || !ASSET_NAME.test(name)) return null\n return { documentId, name }\n}\n\n/** The media block a source-holding kind keeps its original in: first body child of a type in `kind.source`. */\nexport function sourceOf(\n composite: PMNode,\n kinds: readonly CompositeKind[],\n): { node: PMNode, index: number, asset: { documentId: string, name: string } | null, hash: string | null } | null {\n if (composite.type.name !== 'composite') return null\n const types = compositeKind(kinds, String(composite.attrs.kind)).source\n if (!types) return null\n for (let index = COMPOSITE_CHROME_COUNT; index < composite.childCount; index++) {\n const node = composite.child(index)\n if (!(types as readonly string[]).includes(node.type.name)) continue\n const hash: unknown = node.attrs.hash\n return { node, index, asset: assetRefOf(String(node.attrs.src ?? '')), hash: typeof hash === 'string' && hash ? hash : null }\n }\n return null\n}\n\n/** The body children of `composite` that are derived Bausteine, with their child index. */\nexport function renditionsOf(composite: PMNode): { node: PMNode, index: number, derivation: Derivation }[] {\n const found: { node: PMNode, index: number, derivation: Derivation }[] = []\n composite.forEach((node, _offset, index) => {\n if (index < COMPOSITE_CHROME_COUNT || node.type.name !== 'composite') return\n const derivation = derivationOf(node)\n if (derivation) found.push({ node, index, derivation })\n })\n return found\n}\n\n/**\n * Whether `derived` (a Baustein with a derivation, a child of `composite`) is out of date or was edited since it was made.\n * `stale`: for an asset source, the block `sourceOf(composite, kinds)` finds has a `hash` that differs from `inputHash`; null\n * when either is unknown. A block source is null here: callers with the document compare the hash of the source block's\n * Markdown. `edited`: the body's\n * hash (computed lazily, it serialises the whole body) differs from `outputHash`; null when `outputHash` is unknown.\n */\nexport function derivationState(\n composite: PMNode,\n derived: PMNode,\n bodyHash: () => string,\n kinds: readonly CompositeKind[],\n): { stale: boolean | null, edited: boolean | null } {\n const derivation = derivationOf(derived)\n if (!derivation) return { stale: null, edited: null }\n let stale: boolean | null = null\n if ('asset' in derivation.from) {\n const hash = sourceOf(composite, kinds)?.hash\n stale = hash && derivation.inputHash ? hash !== derivation.inputHash : null\n }\n const edited = derivation.outputHash ? bodyHash() !== derivation.outputHash : null\n return { stale, edited }\n}\n\n/** Markdown of the body of `composite` (everything after title, description and tags). */\nexport function bodyMarkdown(editor: Editor, composite: PMNode): string {\n const content: JSONContent[] = []\n composite.forEach((child, _offset, index) => {\n if (index >= COMPOSITE_CHROME_COUNT) content.push(child.toJSON() as JSONContent)\n })\n return editor.markdown!.serialize({ type: 'doc', content })\n}\n"],"mappings":";;;;;;AAoCA,SAAgB,aAAa,MAAiC;CAC5D,MAAM,OAAgB,KAAK,MAAM;CACjC,MAAM,QAAQ,QAAQ,OAAO,SAAS,WAAY,KAAiC,kBAAkB,KAAA;CACrG,IAAI,CAAC,SAAS,OAAO,UAAU,UAAU,OAAO;CAChD,MAAM,EAAE,MAAM,WAAW;CACzB,IAAI,CAAC,QAAQ,OAAO,SAAS,YAAY,OAAO,WAAW,UAAU,OAAO;CAC5E,OAAO;AACT;;AAGA,SAAgB,gBAAgB,YAAwB,YAAgD;CACtG,OAAO,WAAW,WAAW,QAAQ,CAAC,CAAC,WAAW,KAAK,YAAY,WAAW,KAAK,aAAa;AAClG;AAEA,MAAM,mBAAmB,GAAG,WAAW;AAEvC,MAAM,aAAa;AACnB,MAAM,oBAAoB;;AAG1B,SAAgB,WAAW,KAA0D;CACnF,IAAI,CAAC,IAAI,WAAW,gBAAgB,GAAG,OAAO;CAC9C,MAAM,CAAC,YAAY,MAAM,GAAG,QAAQ,IAAI,MAAM,iBAAiB,MAAM,CAAC,CAAC,MAAM,GAAG;CAChF,IAAI,KAAK,UAAU,CAAC,cAAc,CAAC,QAAQ,CAAC,kBAAkB,KAAK,UAAU,KAAK,CAAC,WAAW,KAAK,IAAI,GAAG,OAAO;CACjH,OAAO;EAAE;EAAY;CAAK;AAC5B;;AAGA,SAAgB,SACd,WACA,OACiH;CACjH,IAAI,UAAU,KAAK,SAAS,aAAa,OAAO;CAChD,MAAM,QAAQ,cAAc,OAAO,OAAO,UAAU,MAAM,IAAI,CAAC,CAAC,CAAC;CACjE,IAAI,CAAC,OAAO,OAAO;CACnB,KAAK,IAAI,QAAA,GAAgC,QAAQ,UAAU,YAAY,SAAS;EAC9E,MAAM,OAAO,UAAU,MAAM,KAAK;EAClC,IAAI,CAAE,MAA4B,SAAS,KAAK,KAAK,IAAI,GAAG;EAC5D,MAAM,OAAgB,KAAK,MAAM;EACjC,OAAO;GAAE;GAAM;GAAO,OAAO,WAAW,OAAO,KAAK,MAAM,OAAO,EAAE,CAAC;GAAG,MAAM,OAAO,SAAS,YAAY,OAAO,OAAO;EAAK;CAC9H;CACA,OAAO;AACT;;AAGA,SAAgB,aAAa,WAA8E;CACzG,MAAM,QAAmE,CAAC;CAC1E,UAAU,SAAS,MAAM,SAAS,UAAU;EAC1C,IAAI,QAAA,KAAkC,KAAK,KAAK,SAAS,aAAa;EACtE,MAAM,aAAa,aAAa,IAAI;EACpC,IAAI,YAAY,MAAM,KAAK;GAAE;GAAM;GAAO;EAAW,CAAC;CACxD,CAAC;CACD,OAAO;AACT;;;;;;;;AASA,SAAgB,gBACd,WACA,SACA,UACA,OACmD;CACnD,MAAM,aAAa,aAAa,OAAO;CACvC,IAAI,CAAC,YAAY,OAAO;EAAE,OAAO;EAAM,QAAQ;CAAK;CACpD,IAAI,QAAwB;CAC5B,IAAI,WAAW,WAAW,MAAM;EAC9B,MAAM,OAAO,SAAS,WAAW,KAAK,CAAC,EAAE;EACzC,QAAQ,QAAQ,WAAW,YAAY,SAAS,WAAW,YAAY;CACzE;CACA,MAAM,SAAS,WAAW,aAAa,SAAS,MAAM,WAAW,aAAa;CAC9E,OAAO;EAAE;EAAO;CAAO;AACzB;;AAGA,SAAgB,aAAa,QAAgB,WAA2B;CACtE,MAAM,UAAyB,CAAC;CAChC,UAAU,SAAS,OAAO,SAAS,UAAU;EAC3C,IAAI,SAAA,GAAiC,QAAQ,KAAK,MAAM,OAAO,CAAgB;CACjF,CAAC;CACD,OAAO,OAAO,SAAU,UAAU;EAAE,MAAM;EAAO;CAAQ,CAAC;AAC5D"}
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import { Translate } from "../../i18n/index.js";
|
|
2
|
-
//#region src/features/composites/kinds.d.ts
|
|
3
|
-
/** Media block types a source-holding kind's source may be (`CompositeKind.source`). */
|
|
4
|
-
export declare const SOURCE_MEDIA_TYPES: readonly ["image", "audio", "video", "file"];
|
|
5
|
-
/** One metadata field of a composite kind, stored under `key` in the composite's `meta` attribute. */
|
|
6
|
-
export interface CompositeMetaField {
|
|
7
|
-
key: string;
|
|
8
|
-
label: string;
|
|
9
|
-
/**
|
|
10
|
-
* `bibliography`: CSL-JSON item under `meta.bib`; `derivation`: read-only provenance of a derived Baustein; `reference`: block id of another Baustein;
|
|
11
|
-
* `multiselect`: several of `options`, stored as `string[]` (the key is removed when none is chosen).
|
|
12
|
-
*/
|
|
13
|
-
type: 'text' | 'textarea' | 'date' | 'number' | 'select' | 'multiselect' | 'reference' | 'bibliography' | 'derivation';
|
|
14
|
-
/** Choices of a `select` or `multiselect` field (required for `multiselect`). */
|
|
15
|
-
options?: {
|
|
16
|
-
value: string;
|
|
17
|
-
label: string;
|
|
18
|
-
}[];
|
|
19
|
-
/** `reference`: kind ids the field may point to; absent = any Baustein. */
|
|
20
|
-
targets?: readonly string[];
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* What a kind tells the model beyond its fields. `purpose` goes into every AI request's block model (chat, generate
|
|
24
|
-
* tasks); `instructions`, `instructionsField` and `skeleton` are read only by „Baustein füllen (KI)“ (`fillComposite`).
|
|
25
|
-
*/
|
|
26
|
-
export interface CompositeKindAi {
|
|
27
|
-
/** One or two German sentences: what a Baustein of this kind is for and what its body holds. */
|
|
28
|
-
purpose: string;
|
|
29
|
-
/** Default instruction for filling the body of a Baustein of this kind (what to write, structure, tone). */
|
|
30
|
-
instructions?: string;
|
|
31
|
-
/** Key of a `textarea` field of this kind; a Baustein whose value is non-empty replaces `instructions` with it. */
|
|
32
|
-
instructionsField?: string;
|
|
33
|
-
/** Target text (Vorlage) as Markdown; `{key}` placeholders are replaced by the Baustein's `meta[key]` before it goes to the model, unknown ones stay. */
|
|
34
|
-
skeleton?: string;
|
|
35
|
-
}
|
|
36
|
-
/** A composite kind: what its `kind` attribute selects (label, icon, chrome placeholders, meta fields). */
|
|
37
|
-
export interface CompositeKind {
|
|
38
|
-
id: string;
|
|
39
|
-
label: string;
|
|
40
|
-
icon: string;
|
|
41
|
-
titlePlaceholder: string;
|
|
42
|
-
descriptionPlaceholder: string;
|
|
43
|
-
fields: CompositeMetaField[];
|
|
44
|
-
/**
|
|
45
|
-
* How much of the chrome the kind shows. Absent: all of it. `tags: false` hides the tag row of this kind (the node stays in the schema, empty).
|
|
46
|
-
* `tone`: a CSS colour or `var(...)` that sets the kind apart: a Baustein of this kind gets `data-kind-tone` and `--sk-kind-tone` on its wrapper
|
|
47
|
-
* (a tinted surface and a left border in the tone) and its tree rows tint the kind icon with it. Absent: the kind looks as before.
|
|
48
|
-
* `controls: false` makes the chrome of a Baustein of this kind read-only although the editor is editable (for a kind whose attributes a host
|
|
49
|
-
* guard refuses to change): no basket menu, status menu, title-visibility toggle, tag editing or drag handle on the kind icon, and a read-only
|
|
50
|
-
* details popover; an existing basket, status and tags still show as chips. Default `true`.
|
|
51
|
-
*/
|
|
52
|
-
chrome?: {
|
|
53
|
-
tags?: boolean;
|
|
54
|
-
tone?: string;
|
|
55
|
-
controls?: boolean;
|
|
56
|
-
};
|
|
57
|
-
/** Absent: the kind has no AI brief; „Baustein füllen (KI)“ is not offered for it. */
|
|
58
|
-
ai?: CompositeKindAi;
|
|
59
|
-
/**
|
|
60
|
-
* Baustein kinds this kind accepts as nested Bausteine: a list of kind ids, or `'all'`. Absent: `folder` and `document`
|
|
61
|
-
* accept `'all'`, every other kind accepts none. Non-Baustein content (paragraphs, lists, ...) is always allowed.
|
|
62
|
-
* Only new moves are checked; documents that already nest against it stay as they are.
|
|
63
|
-
*/
|
|
64
|
-
accepts?: readonly string[] | 'all';
|
|
65
|
-
/**
|
|
66
|
-
* Sub-Bausteine follow the Baustein's own content; a merge keeps that order. `mergeCompositeWithNext` merging A = [Ca, Na] and B = [Cb, Nb]
|
|
67
|
-
* (C the leading blocks of the body that are not Bausteine, N the rest from the first sub-Baustein on) gives [Ca, Cb, Na, Nb] instead
|
|
68
|
-
* of [Ca, Na, Cb, Nb]. Default `false`.
|
|
69
|
-
*/
|
|
70
|
-
nestedAfterContent?: boolean;
|
|
71
|
-
/** Present on source-holding kinds: the media block types the kind's source may be; `sourceOf` returns the first body child of one of these. */
|
|
72
|
-
source?: readonly (typeof SOURCE_MEDIA_TYPES)[number][];
|
|
73
|
-
}
|
|
74
|
-
/**
|
|
75
|
-
* The built-in kinds in the language of `t`. The default set is produced from the translator (labels, placeholders, field
|
|
76
|
-
* labels and status choices are catalog messages), so it is built per translator and memoized; hosts that pass their own
|
|
77
|
-
* kinds (`compositeFeature({ kinds })`, `Composite.configure({ kinds })`) keep their labels untouched. Ids, field keys and
|
|
78
|
-
* stored values (`open`, `doing`, `done`) do not depend on the language.
|
|
79
|
-
*/
|
|
80
|
-
export declare function defaultCompositeKinds(t: Translate): readonly CompositeKind[];
|
|
81
|
-
/** Kind `id` from `kinds`; an unknown id gets the `section` kind's presentation (else the first kind's) under its own id and label. */
|
|
82
|
-
export declare function compositeKind(kinds: readonly CompositeKind[], id: string): CompositeKind;
|
|
83
|
-
/**
|
|
84
|
-
* Whether a Baustein of kind `parentKind` accepts one of kind `childKind` as nested Baustein. The `accepts` of the kind
|
|
85
|
-
* in `kinds` decides; without one (or for a kind `kinds` does not list) only `folder` and `document` accept all.
|
|
86
|
-
*/
|
|
87
|
-
export declare function kindAccepts(kinds: readonly CompositeKind[], parentKind: string, childKind: string): boolean;
|
|
88
|
-
//#endregion
|
|
89
|
-
//# sourceMappingURL=kinds.d.ts.map
|
|
@@ -1,285 +0,0 @@
|
|
|
1
|
-
import { createTranslator } from "../../i18n/index.js";
|
|
2
|
-
//#region src/features/composites/kinds.ts
|
|
3
|
-
/** Media block types a source-holding kind's source may be (`CompositeKind.source`). */
|
|
4
|
-
const SOURCE_MEDIA_TYPES = [
|
|
5
|
-
"image",
|
|
6
|
-
"audio",
|
|
7
|
-
"video",
|
|
8
|
-
"file"
|
|
9
|
-
];
|
|
10
|
-
/**
|
|
11
|
-
* The built-in kinds in the language of `t`. The default set is produced from the translator (labels, placeholders, field
|
|
12
|
-
* labels and status choices are catalog messages), so it is built per translator and memoized; hosts that pass their own
|
|
13
|
-
* kinds (`compositeFeature({ kinds })`, `Composite.configure({ kinds })`) keep their labels untouched. Ids, field keys and
|
|
14
|
-
* stored values (`open`, `doing`, `done`) do not depend on the language.
|
|
15
|
-
*/
|
|
16
|
-
function defaultCompositeKinds(t) {
|
|
17
|
-
let kinds = DEFAULT_KINDS.get(t);
|
|
18
|
-
if (!kinds) DEFAULT_KINDS.set(t, kinds = buildDefaultKinds(t));
|
|
19
|
-
return kinds;
|
|
20
|
-
}
|
|
21
|
-
const DEFAULT_KINDS = /* @__PURE__ */ new WeakMap();
|
|
22
|
-
function buildDefaultKinds(t) {
|
|
23
|
-
return [
|
|
24
|
-
{
|
|
25
|
-
id: "section",
|
|
26
|
-
label: t("composites.kind.section.label"),
|
|
27
|
-
icon: "i-lucide-layers",
|
|
28
|
-
titlePlaceholder: t("composites.kind.section.title"),
|
|
29
|
-
descriptionPlaceholder: t("composites.kind.section.description"),
|
|
30
|
-
fields: [],
|
|
31
|
-
accepts: "all"
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
id: "task",
|
|
35
|
-
label: t("composites.kind.task.label"),
|
|
36
|
-
icon: "i-lucide-square-check",
|
|
37
|
-
titlePlaceholder: t("composites.kind.task.title"),
|
|
38
|
-
descriptionPlaceholder: t("composites.kind.task.description"),
|
|
39
|
-
fields: [
|
|
40
|
-
{
|
|
41
|
-
key: "status",
|
|
42
|
-
label: t("composites.kind.task.field.status"),
|
|
43
|
-
type: "select",
|
|
44
|
-
options: [
|
|
45
|
-
{
|
|
46
|
-
value: "open",
|
|
47
|
-
label: t("composites.kind.task.status.open")
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
value: "doing",
|
|
51
|
-
label: t("composites.kind.task.status.doing")
|
|
52
|
-
},
|
|
53
|
-
{
|
|
54
|
-
value: "done",
|
|
55
|
-
label: t("composites.kind.task.status.done")
|
|
56
|
-
}
|
|
57
|
-
]
|
|
58
|
-
},
|
|
59
|
-
{
|
|
60
|
-
key: "due",
|
|
61
|
-
label: t("composites.kind.task.field.due"),
|
|
62
|
-
type: "date"
|
|
63
|
-
},
|
|
64
|
-
{
|
|
65
|
-
key: "assignee",
|
|
66
|
-
label: t("composites.kind.task.field.assignee"),
|
|
67
|
-
type: "text"
|
|
68
|
-
}
|
|
69
|
-
]
|
|
70
|
-
},
|
|
71
|
-
{
|
|
72
|
-
id: "note",
|
|
73
|
-
label: t("composites.kind.note.label"),
|
|
74
|
-
icon: "i-lucide-sticky-note",
|
|
75
|
-
titlePlaceholder: t("composites.kind.note.title"),
|
|
76
|
-
descriptionPlaceholder: t("composites.kind.note.description"),
|
|
77
|
-
fields: [],
|
|
78
|
-
ai: { purpose: "Eigene Notiz zu einer Quelle oder einem Thema: Zusammenfassung, Gedanken, offene Fragen." }
|
|
79
|
-
},
|
|
80
|
-
{
|
|
81
|
-
id: "document",
|
|
82
|
-
label: t("composites.kind.document.label"),
|
|
83
|
-
icon: "i-lucide-file-text",
|
|
84
|
-
titlePlaceholder: t("composites.kind.document.title"),
|
|
85
|
-
descriptionPlaceholder: t("composites.kind.document.description"),
|
|
86
|
-
source: [...SOURCE_MEDIA_TYPES],
|
|
87
|
-
fields: [
|
|
88
|
-
{
|
|
89
|
-
key: "filename",
|
|
90
|
-
label: t("composites.kind.document.field.filename"),
|
|
91
|
-
type: "text"
|
|
92
|
-
},
|
|
93
|
-
{
|
|
94
|
-
key: "mimeType",
|
|
95
|
-
label: t("composites.kind.document.field.mimeType"),
|
|
96
|
-
type: "text"
|
|
97
|
-
},
|
|
98
|
-
{
|
|
99
|
-
key: "size",
|
|
100
|
-
label: t("composites.kind.document.field.size"),
|
|
101
|
-
type: "number"
|
|
102
|
-
},
|
|
103
|
-
{
|
|
104
|
-
key: "importedAt",
|
|
105
|
-
label: t("composites.kind.document.field.importedAt"),
|
|
106
|
-
type: "date"
|
|
107
|
-
}
|
|
108
|
-
]
|
|
109
|
-
},
|
|
110
|
-
{
|
|
111
|
-
id: "recording",
|
|
112
|
-
label: t("composites.kind.recording.label"),
|
|
113
|
-
icon: "i-lucide-mic",
|
|
114
|
-
titlePlaceholder: t("composites.kind.recording.title"),
|
|
115
|
-
descriptionPlaceholder: t("composites.kind.recording.description"),
|
|
116
|
-
accepts: "all",
|
|
117
|
-
source: ["audio", "video"],
|
|
118
|
-
fields: [
|
|
119
|
-
...importFields(t, "recording"),
|
|
120
|
-
{
|
|
121
|
-
key: "recordedAt",
|
|
122
|
-
label: t("composites.kind.recording.field.recordedAt"),
|
|
123
|
-
type: "date"
|
|
124
|
-
},
|
|
125
|
-
{
|
|
126
|
-
key: "participants",
|
|
127
|
-
label: t("composites.kind.recording.field.participants"),
|
|
128
|
-
type: "text"
|
|
129
|
-
},
|
|
130
|
-
{
|
|
131
|
-
key: "durationSeconds",
|
|
132
|
-
label: t("composites.kind.recording.field.durationSeconds"),
|
|
133
|
-
type: "number"
|
|
134
|
-
}
|
|
135
|
-
],
|
|
136
|
-
ai: { purpose: "Aufnahme (Audio oder Video) als Quelle; der Inhalt hält Lesefassungen wie das Transkript und eigene Notizen." }
|
|
137
|
-
},
|
|
138
|
-
{
|
|
139
|
-
id: "paper",
|
|
140
|
-
label: t("composites.kind.paper.label"),
|
|
141
|
-
icon: "i-lucide-scroll-text",
|
|
142
|
-
titlePlaceholder: t("composites.kind.paper.title"),
|
|
143
|
-
descriptionPlaceholder: t("composites.kind.paper.description"),
|
|
144
|
-
accepts: "all",
|
|
145
|
-
source: ["file"],
|
|
146
|
-
fields: [
|
|
147
|
-
...importFields(t, "paper"),
|
|
148
|
-
{
|
|
149
|
-
key: "bib",
|
|
150
|
-
label: t("composites.kind.paper.field.bib"),
|
|
151
|
-
type: "bibliography"
|
|
152
|
-
},
|
|
153
|
-
{
|
|
154
|
-
key: "doi",
|
|
155
|
-
label: t("composites.kind.paper.field.doi"),
|
|
156
|
-
type: "text"
|
|
157
|
-
}
|
|
158
|
-
],
|
|
159
|
-
ai: { purpose: "Wissenschaftliche Arbeit als Quelle (PDF) mit Literaturangabe; der Inhalt hält Volltext, Zusammenfassungen und Notizen." }
|
|
160
|
-
},
|
|
161
|
-
{
|
|
162
|
-
id: "book",
|
|
163
|
-
label: t("composites.kind.book.label"),
|
|
164
|
-
icon: "i-lucide-book",
|
|
165
|
-
titlePlaceholder: t("composites.kind.book.title"),
|
|
166
|
-
descriptionPlaceholder: t("composites.kind.book.description"),
|
|
167
|
-
accepts: "all",
|
|
168
|
-
source: ["file"],
|
|
169
|
-
fields: [
|
|
170
|
-
...importFields(t, "book"),
|
|
171
|
-
{
|
|
172
|
-
key: "bib",
|
|
173
|
-
label: t("composites.kind.book.field.bib"),
|
|
174
|
-
type: "bibliography"
|
|
175
|
-
},
|
|
176
|
-
{
|
|
177
|
-
key: "isbn",
|
|
178
|
-
label: t("composites.kind.book.field.isbn"),
|
|
179
|
-
type: "text"
|
|
180
|
-
}
|
|
181
|
-
],
|
|
182
|
-
ai: { purpose: "Buch als Quelle (PDF) mit Literaturangabe; der Inhalt hält den Volltext, gegliedert in Kapitel, und Notizen." }
|
|
183
|
-
},
|
|
184
|
-
{
|
|
185
|
-
id: "figure",
|
|
186
|
-
label: t("composites.kind.figure.label"),
|
|
187
|
-
icon: "i-lucide-image",
|
|
188
|
-
titlePlaceholder: t("composites.kind.figure.title"),
|
|
189
|
-
descriptionPlaceholder: t("composites.kind.figure.description"),
|
|
190
|
-
accepts: "all",
|
|
191
|
-
source: ["image"],
|
|
192
|
-
fields: [...importFields(t, "figure"), {
|
|
193
|
-
key: "credit",
|
|
194
|
-
label: t("composites.kind.figure.field.credit"),
|
|
195
|
-
type: "text"
|
|
196
|
-
}],
|
|
197
|
-
ai: { purpose: "Bild als Quelle; der Inhalt hält die Bildbeschreibung und eigene Notizen." }
|
|
198
|
-
},
|
|
199
|
-
{
|
|
200
|
-
id: "rendition",
|
|
201
|
-
label: t("composites.kind.rendition.label"),
|
|
202
|
-
icon: "i-lucide-captions",
|
|
203
|
-
titlePlaceholder: t("composites.kind.rendition.title"),
|
|
204
|
-
descriptionPlaceholder: t("composites.kind.rendition.description"),
|
|
205
|
-
accepts: "all",
|
|
206
|
-
fields: [{
|
|
207
|
-
key: "derivation",
|
|
208
|
-
label: t("composites.kind.rendition.field.derivation"),
|
|
209
|
-
type: "derivation"
|
|
210
|
-
}, {
|
|
211
|
-
key: "language",
|
|
212
|
-
label: t("composites.kind.rendition.field.language"),
|
|
213
|
-
type: "text"
|
|
214
|
-
}],
|
|
215
|
-
ai: {
|
|
216
|
-
purpose: "Lesbare Fassung einer Quelle (Transkript, Volltext, Beschreibung, Übersetzung)",
|
|
217
|
-
instructions: "Übertrage den Inhalt vollständig und gut lesbar; nichts weglassen, nichts hinzuerfinden."
|
|
218
|
-
}
|
|
219
|
-
},
|
|
220
|
-
{
|
|
221
|
-
id: "folder",
|
|
222
|
-
label: t("composites.kind.folder.label"),
|
|
223
|
-
icon: "i-lucide-folder",
|
|
224
|
-
titlePlaceholder: t("composites.kind.folder.title"),
|
|
225
|
-
descriptionPlaceholder: t("composites.kind.folder.description"),
|
|
226
|
-
fields: []
|
|
227
|
-
}
|
|
228
|
-
];
|
|
229
|
-
}
|
|
230
|
-
/** The four fields the import of a file fills in (`wrapImport` of `composite-media`), shared by every source-holding kind. */
|
|
231
|
-
function importFields(t, kind) {
|
|
232
|
-
return [
|
|
233
|
-
{
|
|
234
|
-
key: "filename",
|
|
235
|
-
label: t(`composites.kind.${kind}.field.filename`),
|
|
236
|
-
type: "text"
|
|
237
|
-
},
|
|
238
|
-
{
|
|
239
|
-
key: "mimeType",
|
|
240
|
-
label: t(`composites.kind.${kind}.field.mimeType`),
|
|
241
|
-
type: "text"
|
|
242
|
-
},
|
|
243
|
-
{
|
|
244
|
-
key: "size",
|
|
245
|
-
label: t(`composites.kind.${kind}.field.size`),
|
|
246
|
-
type: "number"
|
|
247
|
-
},
|
|
248
|
-
{
|
|
249
|
-
key: "importedAt",
|
|
250
|
-
label: t(`composites.kind.${kind}.field.importedAt`),
|
|
251
|
-
type: "date"
|
|
252
|
-
}
|
|
253
|
-
];
|
|
254
|
-
}
|
|
255
|
-
/** The built-in kinds in the default language, for server-side and context-free code (`Composite`'s default option, an editor without a context). */
|
|
256
|
-
const fallbackCompositeKinds = () => defaultCompositeKinds(DEFAULT_TRANSLATE);
|
|
257
|
-
const DEFAULT_TRANSLATE = createTranslator();
|
|
258
|
-
/** Kind `id` from `kinds`; an unknown id gets the `section` kind's presentation (else the first kind's) under its own id and label. */
|
|
259
|
-
function compositeKind(kinds, id) {
|
|
260
|
-
const known = kinds.find((kind) => kind.id === id);
|
|
261
|
-
if (known) return known;
|
|
262
|
-
return {
|
|
263
|
-
...kinds.find((kind) => kind.id === "section") ?? kinds[0] ?? fallbackCompositeKinds()[0],
|
|
264
|
-
id,
|
|
265
|
-
label: id
|
|
266
|
-
};
|
|
267
|
-
}
|
|
268
|
-
/** Kinds that accept every Baustein kind when their definition sets no `accepts`. */
|
|
269
|
-
const ACCEPTS_ALL_BY_DEFAULT = {
|
|
270
|
-
folder: true,
|
|
271
|
-
document: true
|
|
272
|
-
};
|
|
273
|
-
/**
|
|
274
|
-
* Whether a Baustein of kind `parentKind` accepts one of kind `childKind` as nested Baustein. The `accepts` of the kind
|
|
275
|
-
* in `kinds` decides; without one (or for a kind `kinds` does not list) only `folder` and `document` accept all.
|
|
276
|
-
*/
|
|
277
|
-
function kindAccepts(kinds, parentKind, childKind) {
|
|
278
|
-
const accepts = kinds.find((kind) => kind.id === parentKind)?.accepts;
|
|
279
|
-
if (accepts === void 0) return Object.hasOwn(ACCEPTS_ALL_BY_DEFAULT, parentKind);
|
|
280
|
-
return accepts === "all" || accepts.includes(childKind);
|
|
281
|
-
}
|
|
282
|
-
//#endregion
|
|
283
|
-
export { SOURCE_MEDIA_TYPES, compositeKind, defaultCompositeKinds, fallbackCompositeKinds, kindAccepts };
|
|
284
|
-
|
|
285
|
-
//# sourceMappingURL=kinds.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"kinds.js","names":[],"sources":["../../../src/features/composites/kinds.ts"],"sourcesContent":["// Vue-free and server-importable: the kind registry of the composite block family („Bausteine“).\nimport { createTranslator, type Translate } from '../../i18n'\n\n/** Media block types a source-holding kind's source may be (`CompositeKind.source`). */\nexport const SOURCE_MEDIA_TYPES = ['image', 'audio', 'video', 'file'] as const\n\n/** One metadata field of a composite kind, stored under `key` in the composite's `meta` attribute. */\nexport interface CompositeMetaField {\n key: string\n label: string\n /**\n * `bibliography`: CSL-JSON item under `meta.bib`; `derivation`: read-only provenance of a derived Baustein; `reference`: block id of another Baustein;\n * `multiselect`: several of `options`, stored as `string[]` (the key is removed when none is chosen).\n */\n type: 'text' | 'textarea' | 'date' | 'number' | 'select' | 'multiselect' | 'reference' | 'bibliography' | 'derivation'\n /** Choices of a `select` or `multiselect` field (required for `multiselect`). */\n options?: { value: string, label: string }[]\n /** `reference`: kind ids the field may point to; absent = any Baustein. */\n targets?: readonly string[]\n}\n\n/**\n * What a kind tells the model beyond its fields. `purpose` goes into every AI request's block model (chat, generate\n * tasks); `instructions`, `instructionsField` and `skeleton` are read only by „Baustein füllen (KI)“ (`fillComposite`).\n */\nexport interface CompositeKindAi {\n /** One or two German sentences: what a Baustein of this kind is for and what its body holds. */\n purpose: string\n /** Default instruction for filling the body of a Baustein of this kind (what to write, structure, tone). */\n instructions?: string\n /** Key of a `textarea` field of this kind; a Baustein whose value is non-empty replaces `instructions` with it. */\n instructionsField?: string\n /** Target text (Vorlage) as Markdown; `{key}` placeholders are replaced by the Baustein's `meta[key]` before it goes to the model, unknown ones stay. */\n skeleton?: string\n}\n\n/** A composite kind: what its `kind` attribute selects (label, icon, chrome placeholders, meta fields). */\nexport interface CompositeKind {\n id: string\n label: string\n icon: string\n titlePlaceholder: string\n descriptionPlaceholder: string\n fields: CompositeMetaField[]\n /**\n * How much of the chrome the kind shows. Absent: all of it. `tags: false` hides the tag row of this kind (the node stays in the schema, empty).\n * `tone`: a CSS colour or `var(...)` that sets the kind apart: a Baustein of this kind gets `data-kind-tone` and `--sk-kind-tone` on its wrapper\n * (a tinted surface and a left border in the tone) and its tree rows tint the kind icon with it. Absent: the kind looks as before.\n * `controls: false` makes the chrome of a Baustein of this kind read-only although the editor is editable (for a kind whose attributes a host\n * guard refuses to change): no basket menu, status menu, title-visibility toggle, tag editing or drag handle on the kind icon, and a read-only\n * details popover; an existing basket, status and tags still show as chips. Default `true`.\n */\n chrome?: { tags?: boolean, tone?: string, controls?: boolean }\n /** Absent: the kind has no AI brief; „Baustein füllen (KI)“ is not offered for it. */\n ai?: CompositeKindAi\n /**\n * Baustein kinds this kind accepts as nested Bausteine: a list of kind ids, or `'all'`. Absent: `folder` and `document`\n * accept `'all'`, every other kind accepts none. Non-Baustein content (paragraphs, lists, ...) is always allowed.\n * Only new moves are checked; documents that already nest against it stay as they are.\n */\n accepts?: readonly string[] | 'all'\n /**\n * Sub-Bausteine follow the Baustein's own content; a merge keeps that order. `mergeCompositeWithNext` merging A = [Ca, Na] and B = [Cb, Nb]\n * (C the leading blocks of the body that are not Bausteine, N the rest from the first sub-Baustein on) gives [Ca, Cb, Na, Nb] instead\n * of [Ca, Na, Cb, Nb]. Default `false`.\n */\n nestedAfterContent?: boolean\n /** Present on source-holding kinds: the media block types the kind's source may be; `sourceOf` returns the first body child of one of these. */\n source?: readonly (typeof SOURCE_MEDIA_TYPES)[number][]\n}\n\n/**\n * The built-in kinds in the language of `t`. The default set is produced from the translator (labels, placeholders, field\n * labels and status choices are catalog messages), so it is built per translator and memoized; hosts that pass their own\n * kinds (`compositeFeature({ kinds })`, `Composite.configure({ kinds })`) keep their labels untouched. Ids, field keys and\n * stored values (`open`, `doing`, `done`) do not depend on the language.\n */\nexport function defaultCompositeKinds(t: Translate): readonly CompositeKind[] {\n let kinds = DEFAULT_KINDS.get(t)\n if (!kinds) DEFAULT_KINDS.set(t, kinds = buildDefaultKinds(t))\n return kinds\n}\n\nconst DEFAULT_KINDS = new WeakMap<Translate, readonly CompositeKind[]>()\n\nfunction buildDefaultKinds(t: Translate): readonly CompositeKind[] {\n return [\n { id: 'section', label: t('composites.kind.section.label'), icon: 'i-lucide-layers', titlePlaceholder: t('composites.kind.section.title'), descriptionPlaceholder: t('composites.kind.section.description'), fields: [], accepts: 'all' },\n { id: 'task', label: t('composites.kind.task.label'), icon: 'i-lucide-square-check', titlePlaceholder: t('composites.kind.task.title'), descriptionPlaceholder: t('composites.kind.task.description'), fields: [\n { key: 'status', label: t('composites.kind.task.field.status'), type: 'select', options: [\n { value: 'open', label: t('composites.kind.task.status.open') },\n { value: 'doing', label: t('composites.kind.task.status.doing') },\n { value: 'done', label: t('composites.kind.task.status.done') },\n ] },\n { key: 'due', label: t('composites.kind.task.field.due'), type: 'date' },\n { key: 'assignee', label: t('composites.kind.task.field.assignee'), type: 'text' },\n ] },\n // i18n-ignore: model-facing kind purpose (German prompt text, not UI)\n { id: 'note', label: t('composites.kind.note.label'), icon: 'i-lucide-sticky-note', titlePlaceholder: t('composites.kind.note.title'), descriptionPlaceholder: t('composites.kind.note.description'), fields: [], ai: { purpose: 'Eigene Notiz zu einer Quelle oder einem Thema: Zusammenfassung, Gedanken, offene Fragen.' } },\n { id: 'document', label: t('composites.kind.document.label'), icon: 'i-lucide-file-text', titlePlaceholder: t('composites.kind.document.title'), descriptionPlaceholder: t('composites.kind.document.description'), source: [...SOURCE_MEDIA_TYPES], fields: [\n { key: 'filename', label: t('composites.kind.document.field.filename'), type: 'text' },\n { key: 'mimeType', label: t('composites.kind.document.field.mimeType'), type: 'text' },\n { key: 'size', label: t('composites.kind.document.field.size'), type: 'number' },\n { key: 'importedAt', label: t('composites.kind.document.field.importedAt'), type: 'date' },\n ] },\n // i18n-ignore-start: model-facing kind purposes and instructions (German prompt text, not UI)\n { id: 'recording', label: t('composites.kind.recording.label'), icon: 'i-lucide-mic', titlePlaceholder: t('composites.kind.recording.title'), descriptionPlaceholder: t('composites.kind.recording.description'), accepts: 'all', source: ['audio', 'video'], fields: [\n ...importFields(t, 'recording'),\n { key: 'recordedAt', label: t('composites.kind.recording.field.recordedAt'), type: 'date' },\n { key: 'participants', label: t('composites.kind.recording.field.participants'), type: 'text' },\n { key: 'durationSeconds', label: t('composites.kind.recording.field.durationSeconds'), type: 'number' },\n ], ai: { purpose: 'Aufnahme (Audio oder Video) als Quelle; der Inhalt hält Lesefassungen wie das Transkript und eigene Notizen.' } },\n { id: 'paper', label: t('composites.kind.paper.label'), icon: 'i-lucide-scroll-text', titlePlaceholder: t('composites.kind.paper.title'), descriptionPlaceholder: t('composites.kind.paper.description'), accepts: 'all', source: ['file'], fields: [\n ...importFields(t, 'paper'),\n { key: 'bib', label: t('composites.kind.paper.field.bib'), type: 'bibliography' },\n { key: 'doi', label: t('composites.kind.paper.field.doi'), type: 'text' },\n ], ai: { purpose: 'Wissenschaftliche Arbeit als Quelle (PDF) mit Literaturangabe; der Inhalt hält Volltext, Zusammenfassungen und Notizen.' } },\n { id: 'book', label: t('composites.kind.book.label'), icon: 'i-lucide-book', titlePlaceholder: t('composites.kind.book.title'), descriptionPlaceholder: t('composites.kind.book.description'), accepts: 'all', source: ['file'], fields: [\n ...importFields(t, 'book'),\n { key: 'bib', label: t('composites.kind.book.field.bib'), type: 'bibliography' },\n { key: 'isbn', label: t('composites.kind.book.field.isbn'), type: 'text' },\n ], ai: { purpose: 'Buch als Quelle (PDF) mit Literaturangabe; der Inhalt hält den Volltext, gegliedert in Kapitel, und Notizen.' } },\n { id: 'figure', label: t('composites.kind.figure.label'), icon: 'i-lucide-image', titlePlaceholder: t('composites.kind.figure.title'), descriptionPlaceholder: t('composites.kind.figure.description'), accepts: 'all', source: ['image'], fields: [\n ...importFields(t, 'figure'),\n { key: 'credit', label: t('composites.kind.figure.field.credit'), type: 'text' },\n ], ai: { purpose: 'Bild als Quelle; der Inhalt hält die Bildbeschreibung und eigene Notizen.' } },\n { id: 'rendition', label: t('composites.kind.rendition.label'), icon: 'i-lucide-captions', titlePlaceholder: t('composites.kind.rendition.title'), descriptionPlaceholder: t('composites.kind.rendition.description'), accepts: 'all', fields: [\n { key: 'derivation', label: t('composites.kind.rendition.field.derivation'), type: 'derivation' },\n { key: 'language', label: t('composites.kind.rendition.field.language'), type: 'text' },\n ], ai: {\n purpose: 'Lesbare Fassung einer Quelle (Transkript, Volltext, Beschreibung, Übersetzung)',\n instructions: 'Übertrage den Inhalt vollständig und gut lesbar; nichts weglassen, nichts hinzuerfinden.',\n } },\n // i18n-ignore-end\n { id: 'folder', label: t('composites.kind.folder.label'), icon: 'i-lucide-folder', titlePlaceholder: t('composites.kind.folder.title'), descriptionPlaceholder: t('composites.kind.folder.description'), fields: [] },\n ]\n}\n\n/** The four fields the import of a file fills in (`wrapImport` of `composite-media`), shared by every source-holding kind. */\nfunction importFields(t: Translate, kind: 'recording' | 'paper' | 'book' | 'figure'): CompositeMetaField[] {\n return [\n { key: 'filename', label: t(`composites.kind.${kind}.field.filename`), type: 'text' },\n { key: 'mimeType', label: t(`composites.kind.${kind}.field.mimeType`), type: 'text' },\n { key: 'size', label: t(`composites.kind.${kind}.field.size`), type: 'number' },\n { key: 'importedAt', label: t(`composites.kind.${kind}.field.importedAt`), type: 'date' },\n ]\n}\n\n/** The built-in kinds in the default language, for server-side and context-free code (`Composite`'s default option, an editor without a context). */\nexport const fallbackCompositeKinds = (): readonly CompositeKind[] => defaultCompositeKinds(DEFAULT_TRANSLATE)\n\nconst DEFAULT_TRANSLATE = createTranslator()\n\n/** Kind `id` from `kinds`; an unknown id gets the `section` kind's presentation (else the first kind's) under its own id and label. */\nexport function compositeKind(kinds: readonly CompositeKind[], id: string): CompositeKind {\n const known = kinds.find(kind => kind.id === id)\n if (known) return known\n const base = kinds.find(kind => kind.id === 'section') ?? kinds[0] ?? fallbackCompositeKinds()[0]!\n return { ...base, id, label: id }\n}\n\n/** Kinds that accept every Baustein kind when their definition sets no `accepts`. */\nconst ACCEPTS_ALL_BY_DEFAULT: Record<string, true> = { folder: true, document: true }\n\n/**\n * Whether a Baustein of kind `parentKind` accepts one of kind `childKind` as nested Baustein. The `accepts` of the kind\n * in `kinds` decides; without one (or for a kind `kinds` does not list) only `folder` and `document` accept all.\n */\nexport function kindAccepts(kinds: readonly CompositeKind[], parentKind: string, childKind: string): boolean {\n const accepts = kinds.find(kind => kind.id === parentKind)?.accepts\n if (accepts === undefined) return Object.hasOwn(ACCEPTS_ALL_BY_DEFAULT, parentKind)\n return accepts === 'all' || accepts.includes(childKind)\n}\n"],"mappings":"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"}
|