@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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nodes.js","names":[],"sources":["../../../src/features/composites/nodes.ts"],"sourcesContent":["import type { Editor } from '@tiptap/core'\nimport { type JSONContent, mergeAttributes, Node } from '@tiptap/core'\nimport type { Node as PMNode, ResolvedPos } from '@tiptap/pm/model'\nimport { type EditorState, Selection, TextSelection } from '@tiptap/pm/state'\nimport { editorEntryOf } from '../../core/editor-ui'\nimport { createStore, type Store } from '../../core/store'\nimport { ABILITY, isChromeNode, TEXT_ABILITIES } from '../../core/schema'\nimport type { HeadingConversionScope } from '../../settings'\nimport { compositeFence, withReferencedFenceIds } from './fences'\nimport { type Basket, basketById, defaultBaskets, fallbackBaskets, titleHiddenOf } from './baskets'\nimport { derivationOf } from './derivation'\nimport { flattenCompositesToHeadings, groupHeadingsIntoComposites, headingGroupRange } from './heading-composites'\nimport { type CompositeKind, compositeKind, defaultCompositeKinds, fallbackCompositeKinds } from './kinds'\nimport { BASKET_KEY, keptMeta, TITLE_HIDDEN_KEY } from './meta-keys'\n\n/** Options of the `composite` node: the kinds its `kind` attribute selects from and the baskets its `meta.basket` selects from. */\nexport interface CompositeOptions {\n kinds: readonly CompositeKind[]\n baskets: readonly Basket[]\n}\n\n/** Storage of the `composite` node: mirrors `options.kinds` and `options.baskets` for code that only has the editor. */\nexport interface CompositeStorage {\n kinds: readonly CompositeKind[]\n baskets: readonly Basket[]\n /** Ids of the Bausteine with a hidden title (`meta.titleHidden`) whose title the caret entered; they show it for the rest of the editor session. */\n revealedTitles: Store<ReadonlySet<string>>\n /** Ids of the derived Bausteine (those with a `meta.derivation`) the user opened; every other derived Baustein shows collapsed. */\n expanded: Store<ReadonlySet<string>>\n}\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n composite: {\n /** Insert an empty composite of `kind` after the caret's block (replacing an empty paragraph; at the body start from the composite chrome), caret in its title. */\n insertComposite: (kind?: string) => ReturnType\n /** Wrap the selected blocks into a new composite of `kind`, caret in its title. */\n wrapInComposite: (kind?: string) => ReturnType\n /** Leave the caret's innermost composite: new paragraph right after it (a trailing empty body paragraph is moved there). */\n exitComposite: () => ReturnType\n /** Group headings in the selected blocks (or, without a selection, in `scope`) into composites of `kind`; `recursive` nests every heading level. False when the range holds no heading. */\n convertHeadingsToComposites: (options: { recursive: boolean, scope: HeadingConversionScope, kind?: string }) => ReturnType\n /** Turn composites among the selected blocks (or, without a selection, in `scope`) into headings of their nesting level, with description, tags and meta as text lines; `recursive` flattens every level. False when the range holds no composite. */\n convertCompositesToHeadings: (options: { recursive: boolean, scope: HeadingConversionScope }) => ReturnType\n /** Switch the composite at `pos` (default: the caret's innermost composite) to `kind`; `meta` keeps the target kind's fields plus `derivation` and `bib`. */\n setCompositeKind: (kind: string, pos?: number) => ReturnType\n /** Open the derived Baustein with block id `id` if it is collapsed, collapse it if it is open. */\n toggleCompositeExpanded: (id: string) => ReturnType\n /** Put the composite at `pos` (default: the caret's innermost composite) into the basket `basket` (an id of the editor's baskets; false for an unknown id), or take it out with `null`. */\n setCompositeBasket: (basket: string | null, pos?: number) => ReturnType\n /** Hide (`true`) or show (`false`) the title of the composite at `pos` (default: the caret's innermost composite); showing also ends the caret reveal of its title. */\n setCompositeTitleHidden: (hidden: boolean, pos?: number) => ReturnType\n }\n }\n\n interface Storage {\n composite: CompositeStorage\n }\n}\n\nconst COMPOSITE = 'composite'\nconst TITLE = 'compositeTitle'\nconst DESCRIPTION = 'compositeDescription'\nconst TAGS = 'compositeTags'\n/** Kind of a composite created without an explicit one (also the attribute default). */\nconst DEFAULT_KIND = 'section'\n/** Title, description and tags: the fixed children in front of a composite's body. */\nexport const COMPOSITE_CHROME_COUNT = 3\nconst CHROME_COUNT = COMPOSITE_CHROME_COUNT\n\n/**\n * Composite kinds `editor` was configured with. An editor without the composite node gets the built-in kinds in the\n * language of its surface (the default language without one).\n */\nexport function compositeKindsOf(editor: Editor): readonly CompositeKind[] {\n const configured: readonly CompositeKind[] | undefined = editor.storage.composite?.kinds\n if (configured) return configured\n const entry = editorEntryOf(editor)\n return entry ? defaultCompositeKinds(entry.ctx.t) : fallbackCompositeKinds()\n}\n\n/** Baskets `editor` was configured with (the built-in ones in the default language for an editor without the composite node). */\nexport function compositeBasketsOf(editor: Editor): readonly Basket[] {\n const configured: readonly Basket[] | undefined = editor.storage.composite?.baskets\n if (configured) return configured\n const entry = editorEntryOf(editor)\n return entry ? defaultBaskets(entry.ctx.t) : fallbackBaskets()\n}\n\n/** JSON of a fresh composite of `kind` (empty title/description/tags, hidden meta) with `body`. */\nexport function compositeJSON(kind: string, body: JSONContent[] = [{ type: 'paragraph' }]): JSONContent {\n return { type: COMPOSITE, attrs: { kind }, content: [{ type: TITLE }, { type: DESCRIPTION }, { type: TAGS }, ...body] }\n}\n\n/** Innermost composite around `$pos`: its depth, position and node. */\nexport function compositeAround($pos: ResolvedPos): { depth: number, pos: number, node: PMNode } | null {\n for (let depth = $pos.depth; depth > 0; depth--) {\n const node = $pos.node(depth)\n if (node.type.name === COMPOSITE) return { depth, pos: $pos.before(depth), node }\n }\n return null\n}\n\n/** The composite starting at `pos`, or without `pos` the caret's innermost composite. */\nexport function compositeAt(state: EditorState, pos: number | undefined): { pos: number, node: PMNode } | null {\n if (pos === undefined) return compositeAround(state.selection.$head)\n const node = state.doc.nodeAt(pos)\n return node?.type.name === COMPOSITE ? { pos, node } : null\n}\n\n/** Position right in front of the body (= after the tags row) of the composite whose content starts at `start`. */\nfunction bodyStart(composite: PMNode, start: number): number {\n let pos = start\n for (let i = 0; i < CHROME_COUNT; i++) pos += composite.child(i).nodeSize\n return pos\n}\n\nconst isEmptyParagraph = (node: PMNode) => node.type.name === 'paragraph' && node.content.size === 0\n\n/** The caret's block is an empty paragraph, the last child of a composite whose body has more than this one block. */\nfunction inTrailingEmptyParagraph($head: ResolvedPos): boolean {\n if ($head.depth < 2 || !isEmptyParagraph($head.parent)) return false\n const composite = $head.node($head.depth - 1)\n return composite.type.name === COMPOSITE\n && $head.index($head.depth - 1) === composite.childCount - 1\n && composite.childCount > CHROME_COUNT + 1\n}\n\n/** Nothing typed yet: empty title and description, no tags, body is one empty paragraph. */\nfunction isEmptyComposite(composite: PMNode): boolean {\n const tags: unknown = composite.child(2).attrs.tags\n return composite.child(0).content.size === 0\n && composite.child(1).content.size === 0\n && (!Array.isArray(tags) || tags.length === 0)\n && composite.childCount === CHROME_COUNT + 1\n && isEmptyParagraph(composite.child(CHROME_COUNT))\n}\n\n/** Child range of `parent` a structure conversion works on: the selected blocks (composite chrome excluded), or without a selection the `scope` — for `'heading'` the caret's heading group (`'group'`) or innermost composite (`'flatten'`). */\nfunction structureRange(state: EditorState, scope: HeadingConversionScope, direction: 'group' | 'flatten'): { parent: PMNode, parentDepth: number, parentStart: number, fromIndex: number, toIndex: number } | null {\n const { $from, $to, $head, empty } = state.selection\n if (!empty) {\n const range = $from.blockRange($to, node => node.type.name === 'doc' || node.type.name === COMPOSITE)\n if (!range) return null\n const parent = range.parent\n // The composite chrome (title, description, tags) is never part of the converted blocks.\n const fromIndex = Math.max(range.startIndex, parent.type.name === COMPOSITE ? CHROME_COUNT : 0)\n const toIndex = range.endIndex\n if (fromIndex >= toIndex) return null\n return { parent, parentDepth: range.depth, parentStart: range.$from.start(range.depth), fromIndex, toIndex }\n }\n if (scope === 'container') {\n const found = compositeAround($head)\n if (found) return { parent: found.node, parentDepth: found.depth, parentStart: $head.start(found.depth), fromIndex: CHROME_COUNT, toIndex: found.node.childCount }\n return { parent: state.doc, parentDepth: 0, parentStart: 0, fromIndex: 0, toIndex: state.doc.childCount }\n }\n if (scope === 'heading') {\n if (direction === 'flatten') {\n const found = compositeAround($head)\n if (!found) return null\n const depth = found.depth - 1\n const fromIndex = $head.index(depth)\n return { parent: $head.node(depth), parentDepth: depth, parentStart: $head.start(depth), fromIndex, toIndex: fromIndex + 1 }\n }\n let depth = $head.depth\n while (depth > 0 && !['doc', COMPOSITE].includes($head.node(depth - 1).type.name)) depth--\n if (depth === 0) return null\n const parent = $head.node(depth - 1)\n const minIndex = parent.type.name === COMPOSITE ? CHROME_COUNT : 0\n let index = $head.index(depth - 1)\n while (index >= minIndex && parent.child(index).type.name !== 'heading') index--\n if (index < minIndex) return null\n const group = headingGroupRange(parent, index)\n return { parent, parentDepth: depth - 1, parentStart: $head.start(depth - 1), fromIndex: group.from, toIndex: group.to }\n }\n return { parent: state.doc, parentDepth: 0, parentStart: 0, fromIndex: 0, toIndex: state.doc.childCount }\n}\n\n/** Children `fromIndex..toIndex` of `parent` (content starting at `parentStart`) and their document range. */\nfunction rangeBlocks(parent: PMNode, parentStart: number, fromIndex: number, toIndex: number): { blocks: PMNode[], from: number, to: number } {\n const blocks: PMNode[] = []\n let from = parentStart\n let to = parentStart\n parent.forEach((child, _offset, index) => {\n if (index < fromIndex) from += child.nodeSize\n else if (index < toIndex) blocks.push(child)\n if (index < toIndex) to += child.nodeSize\n })\n return { blocks, from, to }\n}\n\n// Revoked inside title and description: they are single lines of text, not containers for blocks.\nconst CHROME_REVOKES = [\n ABILITY.headings, ABILITY.lists, ABILITY.blockquote, ABILITY.codeBlock, ABILITY.rule, ABILITY.composite, ABILITY.transcript,\n ABILITY.media, ABILITY.imageStudio, ABILITY.record, ABILITY.aiGenerate, ABILITY.blockDuplicate,\n]\n\n// Schema-only nodes (no node views): shared by the client editor and the server-side Yjs schema.\n// The client adds the node view of `composite` in `node-views.ts`; `compositeTags` needs none (a hidden data row).\nexport const CompositeNode = Node.create<CompositeOptions, CompositeStorage>({\n name: COMPOSITE,\n // Above StarterKit's default (100) so this Enter / Backspace / Delete keymap runs first,\n // below Paragraph (1000) so the paragraph stays the schema's default block.\n priority: 101,\n group: 'block',\n content: `${TITLE} ${DESCRIPTION} ${TAGS} block+`,\n isolating: true,\n defining: true,\n editorBlockContainer: true,\n abilities: { own: [ABILITY.compositeMeta, ABILITY.compositeSummarize, ABILITY.compositeExport, ABILITY.compositeDerive] },\n addOptions: () => ({ kinds: fallbackCompositeKinds(), baskets: fallbackBaskets() }),\n addStorage() {\n return {\n kinds: this.options.kinds,\n baskets: this.options.baskets,\n expanded: createStore<ReadonlySet<string>>(new Set()),\n revealedTitles: createStore<ReadonlySet<string>>(new Set()),\n }\n },\n // A caret inside the body of a collapsed derived Baustein (also inside nested ones) opens it: typing into hidden text would be blind.\n // A caret inside the title of a Baustein with a hidden title reveals that title for the rest of the session.\n onSelectionUpdate() {\n const { expanded, revealedTitles } = this.storage\n const { $head } = this.editor.state.selection\n let open: Set<string> | null = null\n for (let depth = $head.depth; depth > 0; depth--) {\n const node = $head.node(depth)\n const id: unknown = node.attrs.id\n if (node.type.name !== COMPOSITE || typeof id !== 'string' || !id || $head.index(depth) < CHROME_COUNT) continue\n if (derivationOf(node) && !expanded.get().has(id)) (open ??= new Set(expanded.get())).add(id)\n }\n if (open) expanded.set(open)\n if ($head.parent.type.name === TITLE && $head.depth > 0) {\n const composite = $head.node($head.depth - 1)\n const id: unknown = composite.attrs.id\n if (composite.type.name === COMPOSITE && typeof id === 'string' && id && titleHiddenOf(composite) && !revealedTitles.get().has(id)) {\n revealedTitles.set(new Set(revealedTitles.get()).add(id))\n }\n }\n },\n // Block ids reach the Markdown only for referenced Bausteine (see `fences.ts`): `DocumentMarkdown` runs this on the\n // document JSON before serializing, it drops the ids of unreferenced composites, `renderMarkdown` writes the ones left.\n markdownPrepare: (json, editor) => withReferencedFenceIds(json, compositeKindsOf(editor)),\n addAttributes: () => ({\n kind: {\n default: DEFAULT_KIND,\n // `null` (no `data-kind`, e.g. legacy markup) falls back to the default kind.\n parseHTML: el => el.getAttribute('data-kind') || null,\n renderHTML: attrs => ({ 'data-kind': attrs.kind }),\n },\n meta: {\n default: {},\n parseHTML: (el) => {\n try {\n const value: unknown = JSON.parse(el.getAttribute('data-meta') ?? '{}')\n return value && typeof value === 'object' && !Array.isArray(value) ? value : {}\n }\n catch {\n return {}\n }\n },\n renderHTML: attrs => ({ 'data-meta': JSON.stringify(attrs.meta) }),\n },\n }),\n parseHTML: () => [\n { tag: 'section[data-type=\"composite\"]' },\n // Legacy markup of the block the composite family replaced: no `data-kind`, so it parses as kind `section`.\n { tag: 'section[data-type=\"section\"]' },\n ],\n renderHTML: ({ HTMLAttributes }) => ['section', mergeAttributes(HTMLAttributes, { 'data-type': COMPOSITE }), 0],\n // Fenced: `::: <kind> {meta JSON, only when non-empty}`, then title, description, tags and body blocks as separate\n // Markdown blocks (empty description/tags render nothing), then `:::`. Same child iteration as the blockquote's\n // renderMarkdown (keeps list numbering etc. per sibling index).\n renderMarkdown: (node, h) => {\n const kind = typeof node.attrs?.kind === 'string' && node.attrs.kind ? node.attrs.kind : DEFAULT_KIND\n const meta: unknown = node.attrs?.meta\n const body = (node.content ?? [])\n .map((child, index) => h.renderChild?.(child, index) ?? h.renderChildren([child]))\n .filter(Boolean)\n .join('\\n\\n')\n const id: unknown = node.attrs?.id\n return compositeFence(kind, meta && typeof meta === 'object' ? meta as Record<string, unknown> : {}, body, typeof id === 'string' && id ? id : undefined)\n },\n\n addCommands() {\n return {\n toggleCompositeExpanded: id => () => {\n const { expanded } = this.storage\n const next = new Set(expanded.get())\n if (!next.delete(id)) next.add(id)\n expanded.set(next)\n return true\n },\n\n setCompositeBasket: (basket, pos) => ({ state, tr, dispatch }) => {\n const found = compositeAt(state, pos)\n if (!found) return false\n if (basket !== null && !basketById(this.options.baskets, basket)) return false\n if (dispatch) {\n const { [BASKET_KEY]: _previous, ...meta } = found.node.attrs.meta as Record<string, unknown>\n tr.setNodeMarkup(found.pos, undefined, { ...found.node.attrs, meta: basket === null ? meta : { ...meta, [BASKET_KEY]: basket } })\n }\n return true\n },\n\n setCompositeTitleHidden: (hidden, pos) => ({ state, tr, dispatch }) => {\n const found = compositeAt(state, pos)\n if (!found) return false\n if (dispatch) {\n const { [TITLE_HIDDEN_KEY]: _previous, ...meta } = found.node.attrs.meta as Record<string, unknown>\n tr.setNodeMarkup(found.pos, undefined, { ...found.node.attrs, meta: hidden ? { ...meta, [TITLE_HIDDEN_KEY]: true } : meta })\n const id: unknown = found.node.attrs.id\n const { revealedTitles } = this.storage\n if (!hidden && typeof id === 'string' && revealedTitles.get().has(id)) {\n const next = new Set(revealedTitles.get())\n next.delete(id)\n revealedTitles.set(next)\n }\n }\n return true\n },\n\n insertComposite: (kind = DEFAULT_KIND) => ({ state, tr, dispatch }) => {\n const { $head } = state.selection\n let depth = $head.depth\n while (depth > 0 && !['doc', COMPOSITE].includes($head.node(depth - 1).type.name)) depth--\n let from = $head.pos\n let to = from\n if (depth > 0) {\n const block = $head.node(depth)\n if (isChromeNode(block)) from = to = bodyStart($head.node(depth - 1), $head.start(depth - 1))\n else if (isEmptyParagraph(block)) {\n from = $head.before(depth)\n to = $head.after(depth)\n }\n else from = to = $head.after(depth)\n }\n const $from = state.doc.resolve(from)\n if (!$from.parent.canReplaceWith($from.index(), state.doc.resolve(to).index(), this.type)) return false\n if (dispatch) {\n const json = compositeJSON(kind)\n tr.replaceWith(from, to, state.schema.nodeFromJSON(json))\n tr.setSelection(TextSelection.create(tr.doc, from + 2)).scrollIntoView()\n }\n return true\n },\n\n wrapInComposite: (kind = DEFAULT_KIND) => ({ state, tr, dispatch }) => {\n const { $from, $to } = state.selection\n const range = $from.blockRange($to, node => node.type.name === 'doc' || node.type.name === COMPOSITE)\n if (!range) return false\n if (range.parent.type.name === COMPOSITE && range.startIndex < CHROME_COUNT) return false\n if (!range.parent.canReplaceWith(range.startIndex, range.endIndex, this.type)) return false\n if (dispatch) {\n const { nodes } = state.schema\n const composite = this.type.create({ kind }, [\n nodes[TITLE]!.create(), nodes[DESCRIPTION]!.create(), nodes[TAGS]!.create(),\n ...state.doc.slice(range.start, range.end).content.content,\n ])\n tr.replaceWith(range.start, range.end, composite)\n tr.setSelection(TextSelection.create(tr.doc, range.start + 2)).scrollIntoView()\n }\n return true\n },\n\n setCompositeKind: (kind, pos) => ({ state, tr, dispatch }) => {\n const found = compositeAt(state, pos)\n if (!found) return false\n if (dispatch) {\n const meta = keptMeta(compositeKind(this.options.kinds, kind), found.node.attrs.meta as Record<string, unknown>)\n tr.setNodeMarkup(found.pos, undefined, { ...found.node.attrs, kind, meta })\n }\n return true\n },\n\n exitComposite: () => ({ state, tr, dispatch }) => {\n const { $head } = state.selection\n const composite = compositeAround($head)\n if (!composite) return false\n if (dispatch) {\n // Leaving from a trailing empty paragraph moves it out instead of leaving an empty line behind.\n if ($head.depth === composite.depth + 1 && inTrailingEmptyParagraph($head)) tr.delete($head.before(), $head.after())\n const after = tr.mapping.map($head.after(composite.depth))\n tr.insert(after, state.schema.nodes.paragraph!.create())\n tr.setSelection(TextSelection.create(tr.doc, after + 1)).scrollIntoView()\n }\n return true\n },\n\n convertHeadingsToComposites: ({ recursive, scope, kind = DEFAULT_KIND }) => ({ state, tr, dispatch }) => {\n const range = structureRange(state, scope, 'group')\n if (!range) return false\n const { blocks, from, to } = rangeBlocks(range.parent, range.parentStart, range.fromIndex, range.toIndex)\n const result = groupHeadingsIntoComposites(state.schema, blocks, recursive, kind)\n if (!result) return false\n if (dispatch) {\n tr.replaceWith(from, to, result)\n tr.setSelection(Selection.near(tr.doc.resolve(from), 1)).scrollIntoView()\n }\n return true\n },\n\n convertCompositesToHeadings: ({ recursive, scope }) => ({ state, tr, dispatch }) => {\n const range = structureRange(state, scope, 'flatten')\n if (!range) return false\n const $pos = state.selection.empty ? state.selection.$head : state.selection.$from\n let level = 1\n for (let depth = 1; depth <= range.parentDepth; depth++) {\n if ($pos.node(depth).type.name === COMPOSITE) level++\n }\n const { blocks, from, to } = rangeBlocks(range.parent, range.parentStart, range.fromIndex, range.toIndex)\n const result = flattenCompositesToHeadings(state.schema, blocks, recursive, level, this.options.kinds)\n if (!result) return false\n if (dispatch) {\n tr.replaceWith(from, to, result)\n tr.setSelection(Selection.near(tr.doc.resolve(from), 1)).scrollIntoView()\n }\n return true\n },\n }\n },\n\n addKeyboardShortcuts() {\n return {\n Enter: () => {\n const { $head } = this.editor.state.selection\n const type = $head.parent.type.name\n if (type === TITLE || type === DESCRIPTION) {\n const depth = $head.depth - 1\n const composite = $head.node(depth)\n const start = $head.start(depth)\n return this.editor.commands.command(({ tr }) => {\n const selection = Selection.findFrom(tr.doc.resolve(bodyStart(composite, start)), 1)\n if (!selection) return false\n tr.setSelection(selection).scrollIntoView()\n return true\n })\n }\n if (this.editor.state.selection.empty && inTrailingEmptyParagraph($head)) return this.editor.commands.exitComposite()\n return false\n },\n\n Backspace: () => {\n const { selection } = this.editor.state\n const { $head } = selection\n if (!selection.empty || !$head.parent.isTextblock || $head.parentOffset !== 0 || $head.depth < 2) return false\n const depth = $head.depth - 1\n const composite = $head.node(depth)\n if (composite.type.name !== COMPOSITE) return false\n const start = $head.start(depth)\n const titleEnd = start + composite.child(0).nodeSize - 1\n const type = $head.parent.type.name\n\n if (type === DESCRIPTION) {\n return this.editor.commands.command(({ tr }) => {\n tr.setSelection(TextSelection.create(tr.doc, titleEnd))\n return true\n })\n }\n if (type === TITLE) {\n // Never joins anything into the title; an untouched composite turns back into a paragraph.\n if (!isEmptyComposite(composite)) return true\n return this.editor.commands.command(({ tr, state }) => {\n const from = $head.before(depth)\n tr.replaceWith(from, $head.after(depth), state.schema.nodes.paragraph!.create())\n tr.setSelection(TextSelection.create(tr.doc, from + 1))\n return true\n })\n }\n // First body block: ProseMirror's joinBackward would delete the tags row (an atom) — move into the chrome instead.\n if ($head.index(depth) !== CHROME_COUNT) return false\n return this.editor.commands.command(({ tr }) => {\n if (isEmptyParagraph($head.parent) && composite.childCount > CHROME_COUNT + 1) tr.delete($head.before(), $head.after())\n tr.setSelection(TextSelection.create(tr.doc, titleEnd))\n return true\n })\n },\n\n // No join of the following block into title or description.\n Delete: () => {\n const { selection } = this.editor.state\n const { $head } = selection\n const type = $head.parent.type.name\n return selection.empty && (type === TITLE || type === DESCRIPTION) && $head.parentOffset === $head.parent.content.size\n },\n\n 'Mod-Shift-a': () => this.editor.commands.insertComposite(DEFAULT_KIND),\n }\n },\n})\n\nexport const CompositeTitleNode = Node.create({\n name: TITLE,\n // Above StarterKit's hard break (100), which also binds Mod-Enter.\n priority: 101,\n content: 'inline*',\n defining: true,\n editorChrome: true,\n abilities: { revokes: CHROME_REVOKES },\n // Above the heading's `h2` rule; the second rule reads legacy markup.\n parseHTML: () => [\n { tag: 'h2[data-type=\"composite-title\"]', priority: 60 },\n { tag: 'h2[data-type=\"section-title\"]', priority: 60 },\n ],\n renderHTML: ({ HTMLAttributes }) => ['h2', mergeAttributes(HTMLAttributes, { 'data-type': 'composite-title', class: 'composite-title' }), 0],\n renderMarkdown: (node, h) => `## ${h.renderChildren(node.content ?? [])}`,\n addKeyboardShortcuts() {\n return {\n // Here rather than on CompositeNode: the ability gate swallows every Mod-/Alt- key of the `composite` type where\n // `format.composite` is missing (title, code blocks, speaker segments), but leaving a composite must work everywhere.\n 'Mod-Enter': () => this.editor.commands.exitComposite(),\n }\n },\n})\n\nexport const CompositeDescriptionNode = Node.create({\n name: DESCRIPTION,\n content: 'inline*',\n defining: true,\n editorChrome: true,\n abilities: { revokes: CHROME_REVOKES },\n // Above the paragraph's `p` rule; the second rule reads legacy markup.\n parseHTML: () => [\n { tag: 'p[data-type=\"composite-description\"]', priority: 60 },\n { tag: 'p[data-type=\"section-summary\"]', priority: 60 },\n ],\n renderHTML: ({ HTMLAttributes }) => ['p', mergeAttributes(HTMLAttributes, { 'data-type': 'composite-description', class: 'composite-description' }), 0],\n renderMarkdown: (node, h) => {\n const text = h.renderChildren(node.content ?? [])\n return text ? `> ${text}` : ''\n },\n})\n\nexport const CompositeTagsNode = Node.create({\n name: TAGS,\n atom: true,\n selectable: false,\n draggable: false,\n allowGapCursor: false,\n editorChrome: true,\n abilities: { revokes: [...TEXT_ABILITIES, ABILITY.blockDelete, ABILITY.blockDuplicate] },\n addAttributes: () => ({\n tags: {\n default: [],\n parseHTML: (el) => {\n try {\n const value: unknown = JSON.parse(el.getAttribute('data-tags') ?? '[]')\n return Array.isArray(value) ? value.filter(tag => typeof tag === 'string') : []\n }\n catch {\n return []\n }\n },\n renderHTML: attrs => ({ 'data-tags': JSON.stringify(attrs.tags) }),\n },\n }),\n // The second rule reads legacy markup.\n parseHTML: () => [{ tag: 'div[data-type=\"composite-tags\"]' }, { tag: 'div[data-type=\"section-tags\"]' }],\n renderHTML: ({ HTMLAttributes }) => ['div', mergeAttributes(HTMLAttributes, { 'data-type': 'composite-tags', class: 'composite-tags' })],\n renderMarkdown: (node) => {\n const tags: unknown = node.attrs?.tags\n return Array.isArray(tags) && tags.length ? `Tags: ${tags.map(tag => `#${tag}`).join(' ')}` : ''\n },\n})\n\nexport const CompositeNodes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,eAAe,KAAK,WAAW,CAAC,CAAC;EAChD,OAAO,OAAO,KAAK,SAAS;CAC9B;AACF,CAAC;AAED,MAAa,oBAAoB,KAAK,OAAO;CAC3C,MAAM;CACN,MAAM;CACN,YAAY;CACZ,WAAW;CACX,gBAAgB;CAChB,cAAc;CACd,WAAW,EAAE,SAAS;EAAC,GAAG;EAAgB,QAAQ;EAAa,QAAQ;CAAc,EAAE;CACvF,sBAAsB,EACpB,MAAM;EACJ,SAAS,CAAC;EACV,YAAY,OAAO;GACjB,IAAI;IACF,MAAM,QAAiB,KAAK,MAAM,GAAG,aAAa,WAAW,KAAK,IAAI;IACtE,OAAO,MAAM,QAAQ,KAAK,IAAI,MAAM,QAAO,QAAO,OAAO,QAAQ,QAAQ,IAAI,CAAC;GAChF,QACM;IACJ,OAAO,CAAC;GACV;EACF;EACA,aAAY,WAAU,EAAE,aAAa,KAAK,UAAU,MAAM,IAAI,EAAE;CAClE,EACF;CAEA,iBAAiB,CAAC,EAAE,KAAK,oCAAkC,GAAG,EAAE,KAAK,kCAAgC,CAAC;CACtG,aAAa,EAAE,qBAAqB,CAAC,OAAO,gBAAgB,gBAAgB;EAAE,aAAa;EAAkB,OAAO;CAAiB,CAAC,CAAC;CACvI,iBAAiB,SAAS;EACxB,MAAM,OAAgB,KAAK,OAAO;EAClC,OAAO,MAAM,QAAQ,IAAI,KAAK,KAAK,SAAS,SAAS,KAAK,KAAI,QAAO,IAAI,KAAK,CAAC,CAAC,KAAK,GAAG,MAAM;CAChG;AACF,CAAC"}
|
|
1
|
+
{"version":3,"file":"nodes.js","names":[],"sources":["../../../src/features/composites/nodes.ts"],"sourcesContent":["import type { Editor } from '@tiptap/core'\nimport { type JSONContent, mergeAttributes, Node } from '@tiptap/core'\nimport type { Node as PMNode, ResolvedPos } from '@tiptap/pm/model'\nimport { type EditorState, Selection, TextSelection } from '@tiptap/pm/state'\nimport { editorEntryOf } from '../../core/editor-ui'\nimport { createStore, type Store } from '../../core/store'\nimport { ABILITY, isChromeNode, OLD_HTML, TEXT_ABILITIES, TYPED_BLOCK, TYPED_BLOCK_DESCRIPTION, TYPED_BLOCK_TAGS, TYPED_BLOCK_TITLE } from '../../core/schema'\nimport type { HeadingConversionScope } from '../../settings'\nimport { compositeFence, withReferencedFenceIds } from './fences'\nimport { type Basket, basketById, defaultBaskets, fallbackBaskets, titleHiddenOf } from './baskets'\nimport { derivationOf } from '../../core/derivation'\nimport { flattenCompositesToHeadings, groupHeadingsIntoComposites, headingGroupRange } from './heading-composites'\nimport { type BlockType, blockTypeOf, defaultBlockTypes, fallbackBlockTypes } from './block-types'\nimport { BASKET_KEY, keptMeta, TITLE_HIDDEN_KEY } from './meta-keys'\n\n/** The `data-type` of the chrome elements of a Typed block (title, description, tags) in the HTML the nodes render and parse. */\nconst TITLE_DATA_TYPE = 'typed-block-title'\nconst DESCRIPTION_DATA_TYPE = 'typed-block-description'\nconst TAGS_DATA_TYPE = 'typed-block-tags'\n\n/** Options of the `typedBlock` node: the Block types its `blockType` attribute selects from and the baskets its `meta.basket` selects from. */\nexport interface CompositeOptions {\n blockTypes: readonly BlockType[]\n baskets: readonly Basket[]\n}\n\n/** Storage of the `typedBlock` node: mirrors `options.blockTypes` and `options.baskets` for code that only has the editor. */\nexport interface CompositeStorage {\n blockTypes: readonly BlockType[]\n baskets: readonly Basket[]\n /** Ids of the Typed blocks with a hidden title (`meta.titleHidden`) whose title the caret entered; they show it for the rest of the editor session. */\n revealedTitles: Store<ReadonlySet<string>>\n /** Ids of the derived Typed blocks (those with a `meta.derivation`) the user opened; every other derived Typed block shows collapsed. */\n expanded: Store<ReadonlySet<string>>\n}\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n composite: {\n /** Insert an empty composite of `kind` after the caret's block (replacing an empty paragraph; at the body start from the composite chrome), caret in its title. */\n insertComposite: (kind?: string) => ReturnType\n /** Wrap the selected blocks into a new composite of `kind`, caret in its title. */\n wrapInComposite: (kind?: string) => ReturnType\n /** Leave the caret's innermost composite: new paragraph right after it (a trailing empty body paragraph is moved there). */\n exitComposite: () => ReturnType\n /** Group headings in the selected blocks (or, without a selection, in `scope`) into composites of `kind`; `recursive` nests every heading level. False when the range holds no heading. */\n convertHeadingsToComposites: (options: { recursive: boolean, scope: HeadingConversionScope, kind?: string }) => ReturnType\n /** Turn composites among the selected blocks (or, without a selection, in `scope`) into headings of their nesting level, with description, tags and meta as text lines; `recursive` flattens every level. False when the range holds no composite. */\n convertCompositesToHeadings: (options: { recursive: boolean, scope: HeadingConversionScope }) => ReturnType\n /** Switch the composite at `pos` (default: the caret's innermost composite) to the Block type `blockTypeId`; `meta` keeps the new Block type's properties plus `derivation` and `bib`. */\n changeBlockType: (blockTypeId: string, pos?: number) => ReturnType\n /** Open the derived Typed block with block id `id` if it is collapsed, collapse it if it is open. */\n toggleCompositeExpanded: (id: string) => ReturnType\n /** Put the composite at `pos` (default: the caret's innermost composite) into the basket `basket` (an id of the editor's baskets; false for an unknown id), or take it out with `null`. */\n setCompositeBasket: (basket: string | null, pos?: number) => ReturnType\n /** Hide (`true`) or show (`false`) the title of the composite at `pos` (default: the caret's innermost composite); showing also ends the caret reveal of its title. */\n setCompositeTitleHidden: (hidden: boolean, pos?: number) => ReturnType\n }\n }\n\n interface Storage {\n typedBlock: CompositeStorage\n }\n}\n\n/** Kind of a composite created without an explicit one (also the attribute default). */\nconst DEFAULT_KIND = 'section'\n/** Title, description and tags: the fixed children in front of a composite's body. */\nexport const COMPOSITE_CHROME_COUNT = 3\nconst CHROME_COUNT = COMPOSITE_CHROME_COUNT\n\n/**\n * Block types `editor` was configured with. An editor without the composite node gets the built-in Block types in the\n * language of its surface (the default language without one).\n */\nexport function blockTypesOf(editor: Editor): readonly BlockType[] {\n const configured: readonly BlockType[] | undefined = editor.storage.typedBlock?.blockTypes\n if (configured) return configured\n const entry = editorEntryOf(editor)\n return entry ? defaultBlockTypes(entry.ctx.t) : fallbackBlockTypes()\n}\n\n/** Baskets `editor` was configured with (the built-in ones in the default language for an editor without the composite node). */\nexport function compositeBasketsOf(editor: Editor): readonly Basket[] {\n const configured: readonly Basket[] | undefined = editor.storage.typedBlock?.baskets\n if (configured) return configured\n const entry = editorEntryOf(editor)\n return entry ? defaultBaskets(entry.ctx.t) : fallbackBaskets()\n}\n\n/** JSON of a fresh composite of `kind` (empty title/description/tags, hidden meta) with `body`. */\nexport function compositeJSON(kind: string, body: JSONContent[] = [{ type: 'paragraph' }]): JSONContent {\n return { type: TYPED_BLOCK, attrs: { blockType: kind }, content: [{ type: TYPED_BLOCK_TITLE }, { type: TYPED_BLOCK_DESCRIPTION }, { type: TYPED_BLOCK_TAGS }, ...body] }\n}\n\n/** Innermost composite around `$pos`: its depth, position and node. */\nexport function compositeAround($pos: ResolvedPos): { depth: number, pos: number, node: PMNode } | null {\n for (let depth = $pos.depth; depth > 0; depth--) {\n const node = $pos.node(depth)\n if (node.type.name === TYPED_BLOCK) return { depth, pos: $pos.before(depth), node }\n }\n return null\n}\n\n/** The composite starting at `pos`, or without `pos` the caret's innermost composite. */\nexport function compositeAt(state: EditorState, pos: number | undefined): { pos: number, node: PMNode } | null {\n if (pos === undefined) return compositeAround(state.selection.$head)\n const node = state.doc.nodeAt(pos)\n return node?.type.name === TYPED_BLOCK ? { pos, node } : null\n}\n\n/** Position right in front of the body (= after the tags row) of the composite whose content starts at `start`. */\nfunction bodyStart(composite: PMNode, start: number): number {\n let pos = start\n for (let i = 0; i < CHROME_COUNT; i++) pos += composite.child(i).nodeSize\n return pos\n}\n\nconst isEmptyParagraph = (node: PMNode) => node.type.name === 'paragraph' && node.content.size === 0\n\n/** The caret's block is an empty paragraph, the last child of a composite whose body has more than this one block. */\nfunction inTrailingEmptyParagraph($head: ResolvedPos): boolean {\n if ($head.depth < 2 || !isEmptyParagraph($head.parent)) return false\n const composite = $head.node($head.depth - 1)\n return composite.type.name === TYPED_BLOCK\n && $head.index($head.depth - 1) === composite.childCount - 1\n && composite.childCount > CHROME_COUNT + 1\n}\n\n/** Nothing typed yet: empty title and description, no tags, body is one empty paragraph. */\nfunction isEmptyComposite(composite: PMNode): boolean {\n const tags: unknown = composite.child(2).attrs.tags\n return composite.child(0).content.size === 0\n && composite.child(1).content.size === 0\n && (!Array.isArray(tags) || tags.length === 0)\n && composite.childCount === CHROME_COUNT + 1\n && isEmptyParagraph(composite.child(CHROME_COUNT))\n}\n\n/** Child range of `parent` a structure conversion works on: the selected blocks (composite chrome excluded), or without a selection the `scope` — for `'heading'` the caret's heading group (`'group'`) or innermost composite (`'flatten'`). */\nfunction structureRange(state: EditorState, scope: HeadingConversionScope, direction: 'group' | 'flatten'): { parent: PMNode, parentDepth: number, parentStart: number, fromIndex: number, toIndex: number } | null {\n const { $from, $to, $head, empty } = state.selection\n if (!empty) {\n const range = $from.blockRange($to, node => node.type.name === 'doc' || node.type.name === TYPED_BLOCK)\n if (!range) return null\n const parent = range.parent\n // The composite chrome (title, description, tags) is never part of the converted blocks.\n const fromIndex = Math.max(range.startIndex, parent.type.name === TYPED_BLOCK ? CHROME_COUNT : 0)\n const toIndex = range.endIndex\n if (fromIndex >= toIndex) return null\n return { parent, parentDepth: range.depth, parentStart: range.$from.start(range.depth), fromIndex, toIndex }\n }\n if (scope === 'container') {\n const found = compositeAround($head)\n if (found) return { parent: found.node, parentDepth: found.depth, parentStart: $head.start(found.depth), fromIndex: CHROME_COUNT, toIndex: found.node.childCount }\n return { parent: state.doc, parentDepth: 0, parentStart: 0, fromIndex: 0, toIndex: state.doc.childCount }\n }\n if (scope === 'heading') {\n if (direction === 'flatten') {\n const found = compositeAround($head)\n if (!found) return null\n const depth = found.depth - 1\n const fromIndex = $head.index(depth)\n return { parent: $head.node(depth), parentDepth: depth, parentStart: $head.start(depth), fromIndex, toIndex: fromIndex + 1 }\n }\n let depth = $head.depth\n while (depth > 0 && !['doc', TYPED_BLOCK].includes($head.node(depth - 1).type.name)) depth--\n if (depth === 0) return null\n const parent = $head.node(depth - 1)\n const minIndex = parent.type.name === TYPED_BLOCK ? CHROME_COUNT : 0\n let index = $head.index(depth - 1)\n while (index >= minIndex && parent.child(index).type.name !== 'heading') index--\n if (index < minIndex) return null\n const group = headingGroupRange(parent, index)\n return { parent, parentDepth: depth - 1, parentStart: $head.start(depth - 1), fromIndex: group.from, toIndex: group.to }\n }\n return { parent: state.doc, parentDepth: 0, parentStart: 0, fromIndex: 0, toIndex: state.doc.childCount }\n}\n\n/** Children `fromIndex..toIndex` of `parent` (content starting at `parentStart`) and their document range. */\nfunction rangeBlocks(parent: PMNode, parentStart: number, fromIndex: number, toIndex: number): { blocks: PMNode[], from: number, to: number } {\n const blocks: PMNode[] = []\n let from = parentStart\n let to = parentStart\n parent.forEach((child, _offset, index) => {\n if (index < fromIndex) from += child.nodeSize\n else if (index < toIndex) blocks.push(child)\n if (index < toIndex) to += child.nodeSize\n })\n return { blocks, from, to }\n}\n\n// Revoked inside title and description: they are single lines of text, not containers for blocks.\nconst CHROME_REVOKES = [\n ABILITY.headings, ABILITY.lists, ABILITY.blockquote, ABILITY.codeBlock, ABILITY.rule, ABILITY.composite, ABILITY.transcript,\n ABILITY.media, ABILITY.imageStudio, ABILITY.record, ABILITY.aiGenerate, ABILITY.blockDuplicate,\n]\n\n// Schema-only nodes (no node views): shared by the client editor and the server-side Yjs schema.\n// The client adds the node view of `typedBlock` in `node-views.ts`; `typedBlockTags` needs none (a hidden data row).\nexport const CompositeNode = Node.create<CompositeOptions, CompositeStorage>({\n name: TYPED_BLOCK,\n // Above StarterKit's default (100) so this Enter / Backspace / Delete keymap runs first,\n // below Paragraph (1000) so the paragraph stays the schema's default block.\n priority: 101,\n group: 'block',\n content: `${TYPED_BLOCK_TITLE} ${TYPED_BLOCK_DESCRIPTION} ${TYPED_BLOCK_TAGS} block+`,\n isolating: true,\n defining: true,\n editorBlockContainer: true,\n abilities: { own: [ABILITY.compositeMeta, ABILITY.compositeSummarize, ABILITY.compositeExport, ABILITY.compositeDerive] },\n addOptions: () => ({ blockTypes: fallbackBlockTypes(), baskets: fallbackBaskets() }),\n addStorage() {\n return {\n blockTypes: this.options.blockTypes,\n baskets: this.options.baskets,\n expanded: createStore<ReadonlySet<string>>(new Set()),\n revealedTitles: createStore<ReadonlySet<string>>(new Set()),\n }\n },\n // A caret inside the body of a collapsed derived Typed block (also inside nested ones) opens it: typing into hidden text would be blind.\n // A caret inside the title of a Typed block with a hidden title reveals that title for the rest of the session.\n onSelectionUpdate() {\n const { expanded, revealedTitles } = this.storage\n const { $head } = this.editor.state.selection\n let open: Set<string> | null = null\n for (let depth = $head.depth; depth > 0; depth--) {\n const node = $head.node(depth)\n const id: unknown = node.attrs.id\n if (node.type.name !== TYPED_BLOCK || typeof id !== 'string' || !id || $head.index(depth) < CHROME_COUNT) continue\n if (derivationOf(node) && !expanded.get().has(id)) (open ??= new Set(expanded.get())).add(id)\n }\n if (open) expanded.set(open)\n if ($head.parent.type.name === TYPED_BLOCK_TITLE && $head.depth > 0) {\n const composite = $head.node($head.depth - 1)\n const id: unknown = composite.attrs.id\n if (composite.type.name === TYPED_BLOCK && typeof id === 'string' && id && titleHiddenOf(composite) && !revealedTitles.get().has(id)) {\n revealedTitles.set(new Set(revealedTitles.get()).add(id))\n }\n }\n },\n // Block ids reach the Markdown only for referenced Typed blocks (see `fences.ts`): `DocumentMarkdown` runs this on the\n // document JSON before serializing, it drops the ids of unreferenced composites, `renderMarkdown` writes the ones left.\n markdownPrepare: (json, editor) => withReferencedFenceIds(json, blockTypesOf(editor)),\n addAttributes: () => ({\n blockType: {\n default: DEFAULT_KIND,\n // `null` (no `data-block-type` and no `OLD_HTML.blockTypeAttr` attribute of markup from before the rename, or legacy `section` markup) falls back to the default Block type.\n parseHTML: el => el.getAttribute('data-block-type') || el.getAttribute(OLD_HTML.blockTypeAttr) || null,\n renderHTML: attrs => ({ 'data-block-type': attrs.blockType }),\n },\n meta: {\n default: {},\n parseHTML: (el) => {\n try {\n const value: unknown = JSON.parse(el.getAttribute('data-meta') ?? '{}')\n return value && typeof value === 'object' && !Array.isArray(value) ? value : {}\n }\n catch {\n return {}\n }\n },\n renderHTML: attrs => ({ 'data-meta': JSON.stringify(attrs.meta) }),\n },\n }),\n parseHTML: () => [\n { tag: `section[data-type=\"${TYPED_BLOCK}\"]` },\n // Read only: markup written before the rename (`OLD_HTML`) and the legacy markup of the block the Typed block replaced (no Block type: `section`).\n { tag: `section[data-type=\"${OLD_HTML.typedBlock}\"]` },\n { tag: `section[data-type=\"${OLD_HTML.earliestBlock}\"]` },\n ],\n renderHTML: ({ HTMLAttributes }) => ['section', mergeAttributes(HTMLAttributes, { 'data-type': TYPED_BLOCK }), 0],\n // Fenced: `::: <kind> {meta JSON, only when non-empty}`, then title, description, tags and body blocks as separate\n // Markdown blocks (empty description/tags render nothing), then `:::`. Same child iteration as the blockquote's\n // renderMarkdown (keeps list numbering etc. per sibling index).\n renderMarkdown: (node, h) => {\n const kind = typeof node.attrs?.blockType === 'string' && node.attrs.blockType ? node.attrs.blockType : DEFAULT_KIND\n const meta: unknown = node.attrs?.meta\n const body = (node.content ?? [])\n .map((child, index) => h.renderChild?.(child, index) ?? h.renderChildren([child]))\n .filter(Boolean)\n .join('\\n\\n')\n const id: unknown = node.attrs?.id\n return compositeFence(kind, meta && typeof meta === 'object' ? meta as Record<string, unknown> : {}, body, typeof id === 'string' && id ? id : undefined)\n },\n\n addCommands() {\n return {\n toggleCompositeExpanded: id => () => {\n const { expanded } = this.storage\n const next = new Set(expanded.get())\n if (!next.delete(id)) next.add(id)\n expanded.set(next)\n return true\n },\n\n setCompositeBasket: (basket, pos) => ({ state, tr, dispatch }) => {\n const found = compositeAt(state, pos)\n if (!found) return false\n if (basket !== null && !basketById(this.options.baskets, basket)) return false\n if (dispatch) {\n const { [BASKET_KEY]: _previous, ...meta } = found.node.attrs.meta as Record<string, unknown>\n tr.setNodeMarkup(found.pos, undefined, { ...found.node.attrs, meta: basket === null ? meta : { ...meta, [BASKET_KEY]: basket } })\n }\n return true\n },\n\n setCompositeTitleHidden: (hidden, pos) => ({ state, tr, dispatch }) => {\n const found = compositeAt(state, pos)\n if (!found) return false\n if (dispatch) {\n const { [TITLE_HIDDEN_KEY]: _previous, ...meta } = found.node.attrs.meta as Record<string, unknown>\n tr.setNodeMarkup(found.pos, undefined, { ...found.node.attrs, meta: hidden ? { ...meta, [TITLE_HIDDEN_KEY]: true } : meta })\n const id: unknown = found.node.attrs.id\n const { revealedTitles } = this.storage\n if (!hidden && typeof id === 'string' && revealedTitles.get().has(id)) {\n const next = new Set(revealedTitles.get())\n next.delete(id)\n revealedTitles.set(next)\n }\n }\n return true\n },\n\n insertComposite: (kind = DEFAULT_KIND) => ({ state, tr, dispatch }) => {\n const { $head } = state.selection\n let depth = $head.depth\n while (depth > 0 && !['doc', TYPED_BLOCK].includes($head.node(depth - 1).type.name)) depth--\n let from = $head.pos\n let to = from\n if (depth > 0) {\n const block = $head.node(depth)\n if (isChromeNode(block)) from = to = bodyStart($head.node(depth - 1), $head.start(depth - 1))\n else if (isEmptyParagraph(block)) {\n from = $head.before(depth)\n to = $head.after(depth)\n }\n else from = to = $head.after(depth)\n }\n const $from = state.doc.resolve(from)\n if (!$from.parent.canReplaceWith($from.index(), state.doc.resolve(to).index(), this.type)) return false\n if (dispatch) {\n const json = compositeJSON(kind)\n tr.replaceWith(from, to, state.schema.nodeFromJSON(json))\n tr.setSelection(TextSelection.create(tr.doc, from + 2)).scrollIntoView()\n }\n return true\n },\n\n wrapInComposite: (kind = DEFAULT_KIND) => ({ state, tr, dispatch }) => {\n const { $from, $to } = state.selection\n const range = $from.blockRange($to, node => node.type.name === 'doc' || node.type.name === TYPED_BLOCK)\n if (!range) return false\n if (range.parent.type.name === TYPED_BLOCK && range.startIndex < CHROME_COUNT) return false\n if (!range.parent.canReplaceWith(range.startIndex, range.endIndex, this.type)) return false\n if (dispatch) {\n const { nodes } = state.schema\n const composite = this.type.create({ blockType: kind }, [\n nodes[TYPED_BLOCK_TITLE]!.create(), nodes[TYPED_BLOCK_DESCRIPTION]!.create(), nodes[TYPED_BLOCK_TAGS]!.create(),\n ...state.doc.slice(range.start, range.end).content.content,\n ])\n tr.replaceWith(range.start, range.end, composite)\n tr.setSelection(TextSelection.create(tr.doc, range.start + 2)).scrollIntoView()\n }\n return true\n },\n\n changeBlockType: (blockTypeId, pos) => ({ state, tr, dispatch }) => {\n const found = compositeAt(state, pos)\n if (!found) return false\n if (dispatch) {\n const meta = keptMeta(blockTypeOf(this.options.blockTypes, blockTypeId), found.node.attrs.meta as Record<string, unknown>)\n tr.setNodeMarkup(found.pos, undefined, { ...found.node.attrs, blockType: blockTypeId, meta })\n }\n return true\n },\n\n exitComposite: () => ({ state, tr, dispatch }) => {\n const { $head } = state.selection\n const composite = compositeAround($head)\n if (!composite) return false\n if (dispatch) {\n // Leaving from a trailing empty paragraph moves it out instead of leaving an empty line behind.\n if ($head.depth === composite.depth + 1 && inTrailingEmptyParagraph($head)) tr.delete($head.before(), $head.after())\n const after = tr.mapping.map($head.after(composite.depth))\n tr.insert(after, state.schema.nodes.paragraph!.create())\n tr.setSelection(TextSelection.create(tr.doc, after + 1)).scrollIntoView()\n }\n return true\n },\n\n convertHeadingsToComposites: ({ recursive, scope, kind = DEFAULT_KIND }) => ({ state, tr, dispatch }) => {\n const range = structureRange(state, scope, 'group')\n if (!range) return false\n const { blocks, from, to } = rangeBlocks(range.parent, range.parentStart, range.fromIndex, range.toIndex)\n const result = groupHeadingsIntoComposites(state.schema, blocks, recursive, kind)\n if (!result) return false\n if (dispatch) {\n tr.replaceWith(from, to, result)\n tr.setSelection(Selection.near(tr.doc.resolve(from), 1)).scrollIntoView()\n }\n return true\n },\n\n convertCompositesToHeadings: ({ recursive, scope }) => ({ state, tr, dispatch }) => {\n const range = structureRange(state, scope, 'flatten')\n if (!range) return false\n const $pos = state.selection.empty ? state.selection.$head : state.selection.$from\n let level = 1\n for (let depth = 1; depth <= range.parentDepth; depth++) {\n if ($pos.node(depth).type.name === TYPED_BLOCK) level++\n }\n const { blocks, from, to } = rangeBlocks(range.parent, range.parentStart, range.fromIndex, range.toIndex)\n const result = flattenCompositesToHeadings(state.schema, blocks, recursive, level, this.options.blockTypes)\n if (!result) return false\n if (dispatch) {\n tr.replaceWith(from, to, result)\n tr.setSelection(Selection.near(tr.doc.resolve(from), 1)).scrollIntoView()\n }\n return true\n },\n }\n },\n\n addKeyboardShortcuts() {\n return {\n Enter: () => {\n const { $head } = this.editor.state.selection\n const type = $head.parent.type.name\n if (type === TYPED_BLOCK_TITLE || type === TYPED_BLOCK_DESCRIPTION) {\n const depth = $head.depth - 1\n const composite = $head.node(depth)\n const start = $head.start(depth)\n return this.editor.commands.command(({ tr }) => {\n const selection = Selection.findFrom(tr.doc.resolve(bodyStart(composite, start)), 1)\n if (!selection) return false\n tr.setSelection(selection).scrollIntoView()\n return true\n })\n }\n if (this.editor.state.selection.empty && inTrailingEmptyParagraph($head)) return this.editor.commands.exitComposite()\n return false\n },\n\n Backspace: () => {\n const { selection } = this.editor.state\n const { $head } = selection\n if (!selection.empty || !$head.parent.isTextblock || $head.parentOffset !== 0 || $head.depth < 2) return false\n const depth = $head.depth - 1\n const composite = $head.node(depth)\n if (composite.type.name !== TYPED_BLOCK) return false\n const start = $head.start(depth)\n const titleEnd = start + composite.child(0).nodeSize - 1\n const type = $head.parent.type.name\n\n if (type === TYPED_BLOCK_DESCRIPTION) {\n return this.editor.commands.command(({ tr }) => {\n tr.setSelection(TextSelection.create(tr.doc, titleEnd))\n return true\n })\n }\n if (type === TYPED_BLOCK_TITLE) {\n // Never joins anything into the title; an untouched composite turns back into a paragraph.\n if (!isEmptyComposite(composite)) return true\n return this.editor.commands.command(({ tr, state }) => {\n const from = $head.before(depth)\n tr.replaceWith(from, $head.after(depth), state.schema.nodes.paragraph!.create())\n tr.setSelection(TextSelection.create(tr.doc, from + 1))\n return true\n })\n }\n // First body block: ProseMirror's joinBackward would delete the tags row (an atom) — move into the chrome instead.\n if ($head.index(depth) !== CHROME_COUNT) return false\n return this.editor.commands.command(({ tr }) => {\n if (isEmptyParagraph($head.parent) && composite.childCount > CHROME_COUNT + 1) tr.delete($head.before(), $head.after())\n tr.setSelection(TextSelection.create(tr.doc, titleEnd))\n return true\n })\n },\n\n // No join of the following block into title or description.\n Delete: () => {\n const { selection } = this.editor.state\n const { $head } = selection\n const type = $head.parent.type.name\n return selection.empty && (type === TYPED_BLOCK_TITLE || type === TYPED_BLOCK_DESCRIPTION) && $head.parentOffset === $head.parent.content.size\n },\n\n 'Mod-Shift-a': () => this.editor.commands.insertComposite(DEFAULT_KIND),\n }\n },\n})\n\nexport const CompositeTitleNode = Node.create({\n name: TYPED_BLOCK_TITLE,\n // Above StarterKit's hard break (100), which also binds Mod-Enter.\n priority: 101,\n content: 'inline*',\n defining: true,\n editorChrome: true,\n abilities: { revokes: CHROME_REVOKES },\n // Above the heading's `h2` rule; the second rule reads legacy markup.\n parseHTML: () => [\n { tag: `h2[data-type=\"${TITLE_DATA_TYPE}\"]`, priority: 60 },\n // Read only: markup written before the rename and legacy markup.\n { tag: `h2[data-type=\"${OLD_HTML.title}\"]`, priority: 60 },\n { tag: `h2[data-type=\"${OLD_HTML.earliestTitle}\"]`, priority: 60 },\n ],\n renderHTML: ({ HTMLAttributes }) => ['h2', mergeAttributes(HTMLAttributes, { 'data-type': TITLE_DATA_TYPE, class: 'composite-title' }), 0],\n renderMarkdown: (node, h) => `## ${h.renderChildren(node.content ?? [])}`,\n addKeyboardShortcuts() {\n return {\n // Here rather than on CompositeNode: the ability gate swallows every Mod-/Alt- key of the `typedBlock` type where\n // `format.composite` is missing (title, code blocks, speaker segments), but leaving a composite must work everywhere.\n 'Mod-Enter': () => this.editor.commands.exitComposite(),\n }\n },\n})\n\nexport const CompositeDescriptionNode = Node.create({\n name: TYPED_BLOCK_DESCRIPTION,\n content: 'inline*',\n defining: true,\n editorChrome: true,\n abilities: { revokes: CHROME_REVOKES },\n // Above the paragraph's `p` rule; the second rule reads legacy markup.\n parseHTML: () => [\n { tag: `p[data-type=\"${DESCRIPTION_DATA_TYPE}\"]`, priority: 60 },\n { tag: `p[data-type=\"${OLD_HTML.description}\"]`, priority: 60 },\n { tag: `p[data-type=\"${OLD_HTML.earliestDescription}\"]`, priority: 60 },\n ],\n renderHTML: ({ HTMLAttributes }) => ['p', mergeAttributes(HTMLAttributes, { 'data-type': DESCRIPTION_DATA_TYPE, class: 'composite-description' }), 0],\n renderMarkdown: (node, h) => {\n const text = h.renderChildren(node.content ?? [])\n return text ? `> ${text}` : ''\n },\n})\n\nexport const CompositeTagsNode = Node.create({\n name: TYPED_BLOCK_TAGS,\n atom: true,\n selectable: false,\n draggable: false,\n allowGapCursor: false,\n editorChrome: true,\n abilities: { revokes: [...TEXT_ABILITIES, ABILITY.blockDelete, ABILITY.blockDuplicate] },\n addAttributes: () => ({\n tags: {\n default: [],\n parseHTML: (el) => {\n try {\n const value: unknown = JSON.parse(el.getAttribute('data-tags') ?? '[]')\n return Array.isArray(value) ? value.filter(tag => typeof tag === 'string') : []\n }\n catch {\n return []\n }\n },\n renderHTML: attrs => ({ 'data-tags': JSON.stringify(attrs.tags) }),\n },\n }),\n // The read-only rules read markup written before the rename and legacy markup.\n parseHTML: () => [{ tag: `div[data-type=\"${TAGS_DATA_TYPE}\"]` }, { tag: `div[data-type=\"${OLD_HTML.tags}\"]` }, { tag: `div[data-type=\"${OLD_HTML.earliestTags}\"]` }],\n renderHTML: ({ HTMLAttributes }) => ['div', mergeAttributes(HTMLAttributes, { 'data-type': TAGS_DATA_TYPE, class: 'composite-tags' })],\n renderMarkdown: (node) => {\n const tags: unknown = node.attrs?.tags\n return Array.isArray(tags) && tags.length ? `Tags: ${tags.map(tag => `#${tag}`).join(' ')}` : ''\n },\n})\n\nexport const CompositeNodes = [CompositeNode, CompositeTitleNode, CompositeDescriptionNode, CompositeTagsNode]\n"],"mappings":";;;;;;;;;;;;;;;AAgBA,MAAM,kBAAkB;AACxB,MAAM,wBAAwB;AAC9B,MAAM,iBAAiB;;AAgDvB,MAAM,eAAe;;AAErB,MAAa,yBAAyB;AACtC,MAA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|
|
|
2
2
|
import { Editor } from "@tiptap/core";
|
|
3
3
|
import { Node as Node$1 } from "@tiptap/pm/model";
|
|
4
4
|
//#region src/features/composites/outline.d.ts
|
|
5
|
-
/** One
|
|
5
|
+
/** One Typed block of a document's outline. */
|
|
6
6
|
export interface OutlineNode {
|
|
7
7
|
/** Block ID, or `pos:<pos>` for a block without one yet; unique within the document. */
|
|
8
8
|
key: string;
|
|
@@ -15,7 +15,7 @@ export interface OutlineNode {
|
|
|
15
15
|
* text of its own body (`labelFromBody`), else the caller's `untitled`.
|
|
16
16
|
*/
|
|
17
17
|
title: string;
|
|
18
|
-
/** `title` is derived from the body, the
|
|
18
|
+
/** `title` is derived from the body, the Typed block itself has no title. */
|
|
19
19
|
labelFromBody: boolean;
|
|
20
20
|
/** The composite has a description (the summary). */
|
|
21
21
|
hasSummary: boolean;
|
|
@@ -23,16 +23,19 @@ export interface OutlineNode {
|
|
|
23
23
|
basket: string | null;
|
|
24
24
|
/** The title is hidden in the editor (`meta.titleHidden`). */
|
|
25
25
|
titleHidden: boolean;
|
|
26
|
+
/** The Block is a Derived block whose original was deleted (the source-missing state of its Derivation). */
|
|
27
|
+
sourceMissing: boolean;
|
|
26
28
|
children: OutlineNode[];
|
|
27
29
|
}
|
|
28
30
|
/**
|
|
29
31
|
* The composites of `doc` as a tree (title, kind, summary flag). A composite without a title is labelled by its body
|
|
30
32
|
* (`labelFromBody`: first heading, else the start of the first text; nested composites do not count) and only an empty
|
|
31
33
|
* one gets `untitled` (the caller's translated „(ohne Titel)“). Composites of a kind in `hiddenKinds` are omitted and their visible descendants
|
|
32
|
-
* take their place in the parent's list.
|
|
34
|
+
* take their place in the parent's list. With `capabilitiesOf` (the editor's block capabilities) a composite without the `basket` capability has no basket.
|
|
35
|
+
* `sourceMissing` marks a Derived block whose original is gone (`derivationOriginOf` against `documentId`, the open document).
|
|
33
36
|
*/
|
|
34
|
-
export declare function compositeOutline(doc: Node$1, hiddenKinds: ReadonlySet<string>, untitled: string): OutlineNode[];
|
|
35
|
-
/** Whether a block may move into a
|
|
37
|
+
export declare function compositeOutline(doc: Node$1, hiddenKinds: ReadonlySet<string>, untitled: string, capabilitiesOf?: (node: Node$1) => ReadonlySet<string>, documentId?: string | null): OutlineNode[];
|
|
38
|
+
/** Whether a block may move into a Typed block; `reason` is a short sentence for the UI (in the language of the `t` it was judged with) when it may not. */
|
|
36
39
|
export type MoveVerdict = {
|
|
37
40
|
ok: true;
|
|
38
41
|
} | {
|
|
@@ -40,17 +43,17 @@ export type MoveVerdict = {
|
|
|
40
43
|
reason: string;
|
|
41
44
|
};
|
|
42
45
|
/**
|
|
43
|
-
* Whether block `id` may move into the
|
|
44
|
-
* not: a block is missing, the target is no
|
|
45
|
-
* does not accept the block's
|
|
46
|
-
* unless it holds
|
|
47
|
-
* checked. Moving a block to the end of the
|
|
46
|
+
* Whether block `id` may move into the Typed block `targetId` (`null` = the end of the document), with the reason when
|
|
47
|
+
* not: a block is missing, the target is no Typed block, the target is the block itself or inside it, or the target's Block type
|
|
48
|
+
* does not accept the block's Block type (`BlockType.accepts`). A block that is no Typed block may move into any Typed block,
|
|
49
|
+
* unless it holds Typed blocks of a refused Block type; Typed blocks nested inside a moved Typed block stay with it and are not
|
|
50
|
+
* checked. Moving a block to the end of the Typed block it already sits in adds no nesting and is never refused for it.
|
|
48
51
|
*/
|
|
49
52
|
export declare function moveIntoVerdict(editor: Editor, id: string, targetId: string | null, t: Translate): MoveVerdict;
|
|
50
|
-
/** Whether block `id` can move into the
|
|
53
|
+
/** Whether block `id` can move into the Typed block `targetId` (`null` = the end of the document); see `moveIntoVerdict`. */
|
|
51
54
|
export declare function canMoveBlockInto(editor: Editor, id: string, targetId: string | null): boolean;
|
|
52
55
|
/**
|
|
53
|
-
* Moves block `id` to the end of the body of the
|
|
56
|
+
* Moves block `id` to the end of the body of the Typed block `targetId` (`null` = the end of the document) in a single
|
|
54
57
|
* transaction, i.e. one undo step. `false` when nothing moved: `moveIntoVerdict` refuses the move (or the editor
|
|
55
58
|
* refused the transaction).
|
|
56
59
|
*/
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { blockIdOf, findBlockById } from "../../core/schema/block-ids.js";
|
|
2
|
-
import {
|
|
2
|
+
import { derivationOf, derivationOriginOf } from "../../core/derivation.js";
|
|
3
|
+
import { acceptsChild } from "./block-types.js";
|
|
3
4
|
import { basketOf, titleHiddenOf } from "./baskets.js";
|
|
4
|
-
import {
|
|
5
|
+
import { blockTypesOf } from "./nodes.js";
|
|
5
6
|
import { nestingReason, outermostComposites } from "./accepted-children.js";
|
|
6
7
|
//#region src/features/composites/outline.ts
|
|
7
8
|
/** Longest label taken from a paragraph; longer text is cut and ends in an ellipsis. */
|
|
@@ -20,7 +21,7 @@ const clipLabel = (text) => {
|
|
|
20
21
|
function scanBody(parent, from, found) {
|
|
21
22
|
for (let i = from; i < parent.childCount && found.heading === null; i++) {
|
|
22
23
|
const node = parent.child(i);
|
|
23
|
-
if (node.type.name === "
|
|
24
|
+
if (node.type.name === "typedBlock") continue;
|
|
24
25
|
if (node.isTextblock) {
|
|
25
26
|
const text = node.textContent.trim();
|
|
26
27
|
if (!text) continue;
|
|
@@ -42,14 +43,15 @@ function bodyLabel(composite) {
|
|
|
42
43
|
* The composites of `doc` as a tree (title, kind, summary flag). A composite without a title is labelled by its body
|
|
43
44
|
* (`labelFromBody`: first heading, else the start of the first text; nested composites do not count) and only an empty
|
|
44
45
|
* one gets `untitled` (the caller's translated „(ohne Titel)“). Composites of a kind in `hiddenKinds` are omitted and their visible descendants
|
|
45
|
-
* take their place in the parent's list.
|
|
46
|
+
* take their place in the parent's list. With `capabilitiesOf` (the editor's block capabilities) a composite without the `basket` capability has no basket.
|
|
47
|
+
* `sourceMissing` marks a Derived block whose original is gone (`derivationOriginOf` against `documentId`, the open document).
|
|
46
48
|
*/
|
|
47
|
-
function compositeOutline(doc, hiddenKinds, untitled) {
|
|
49
|
+
function compositeOutline(doc, hiddenKinds, untitled, capabilitiesOf, documentId) {
|
|
48
50
|
function collect(parent, start, into) {
|
|
49
51
|
parent.forEach((node, offset) => {
|
|
50
52
|
const pos = start + offset;
|
|
51
|
-
if (node.type.name === "
|
|
52
|
-
const kind = String(node.attrs.
|
|
53
|
+
if (node.type.name === "typedBlock") {
|
|
54
|
+
const kind = String(node.attrs.blockType);
|
|
53
55
|
const children = [];
|
|
54
56
|
collect(node, pos + 1, children);
|
|
55
57
|
if (hiddenKinds.has(kind)) {
|
|
@@ -67,8 +69,9 @@ function compositeOutline(doc, hiddenKinds, untitled) {
|
|
|
67
69
|
title: ownTitle || derived || untitled,
|
|
68
70
|
labelFromBody: derived !== null,
|
|
69
71
|
hasSummary: (node.maybeChild(1)?.content.size ?? 0) > 0,
|
|
70
|
-
basket: basketOf(node),
|
|
72
|
+
basket: capabilitiesOf && !capabilitiesOf(node).has("basket") ? null : basketOf(node),
|
|
71
73
|
titleHidden: titleHiddenOf(node),
|
|
74
|
+
sourceMissing: derivationOf(node) !== null && derivationOriginOf(doc, pos, documentId)?.status === "missing",
|
|
72
75
|
children
|
|
73
76
|
});
|
|
74
77
|
} else if (!node.isTextblock && !node.isLeaf) collect(node, pos + 1, into);
|
|
@@ -83,11 +86,11 @@ const refused = (reason) => ({
|
|
|
83
86
|
reason
|
|
84
87
|
});
|
|
85
88
|
/**
|
|
86
|
-
* Whether block `id` may move into the
|
|
87
|
-
* not: a block is missing, the target is no
|
|
88
|
-
* does not accept the block's
|
|
89
|
-
* unless it holds
|
|
90
|
-
* checked. Moving a block to the end of the
|
|
89
|
+
* Whether block `id` may move into the Typed block `targetId` (`null` = the end of the document), with the reason when
|
|
90
|
+
* not: a block is missing, the target is no Typed block, the target is the block itself or inside it, or the target's Block type
|
|
91
|
+
* does not accept the block's Block type (`BlockType.accepts`). A block that is no Typed block may move into any Typed block,
|
|
92
|
+
* unless it holds Typed blocks of a refused Block type; Typed blocks nested inside a moved Typed block stay with it and are not
|
|
93
|
+
* checked. Moving a block to the end of the Typed block it already sits in adds no nesting and is never refused for it.
|
|
91
94
|
*/
|
|
92
95
|
function moveIntoVerdict(editor, id, targetId, t) {
|
|
93
96
|
const { doc } = editor.state;
|
|
@@ -96,32 +99,32 @@ function moveIntoVerdict(editor, id, targetId, t) {
|
|
|
96
99
|
if (targetId === null) return { ok: true };
|
|
97
100
|
const target = findBlockById(doc, targetId);
|
|
98
101
|
if (!target) return refused(t("composites.move.targetGone"));
|
|
99
|
-
if (target.node.type.name !== "
|
|
102
|
+
if (target.node.type.name !== "typedBlock") return refused(t("composites.move.targetNotBlock"));
|
|
100
103
|
if (target.pos === block.pos) return refused(t("composites.move.intoSelf"));
|
|
101
104
|
if (target.pos > block.pos && target.pos < block.pos + block.node.nodeSize) return refused(t("composites.move.intoOwn"));
|
|
102
105
|
const $block = doc.resolve(block.pos);
|
|
103
106
|
let parentPos = -1;
|
|
104
|
-
for (let depth = $block.depth; depth > 0; depth--) if ($block.node(depth).type.name === "
|
|
107
|
+
for (let depth = $block.depth; depth > 0; depth--) if ($block.node(depth).type.name === "typedBlock") {
|
|
105
108
|
parentPos = $block.before(depth);
|
|
106
109
|
break;
|
|
107
110
|
}
|
|
108
111
|
if (parentPos === target.pos) return { ok: true };
|
|
109
|
-
const kinds =
|
|
110
|
-
const targetKind = String(target.node.attrs.
|
|
112
|
+
const kinds = blockTypesOf(editor);
|
|
113
|
+
const targetKind = String(target.node.attrs.blockType);
|
|
111
114
|
for (const child of outermostComposites(block.node)) {
|
|
112
|
-
const childKind = String(child.attrs.
|
|
113
|
-
if (!
|
|
115
|
+
const childKind = String(child.attrs.blockType);
|
|
116
|
+
if (!acceptsChild(kinds, targetKind, childKind)) return refused(nestingReason(kinds, targetKind, childKind, t));
|
|
114
117
|
}
|
|
115
118
|
return { ok: true };
|
|
116
119
|
}
|
|
117
120
|
/** `canMoveBlockInto` reads only `ok`, so its verdict needs no text: the message keys stand in for the sentences. */
|
|
118
121
|
const untranslated = (key) => key;
|
|
119
|
-
/** Whether block `id` can move into the
|
|
122
|
+
/** Whether block `id` can move into the Typed block `targetId` (`null` = the end of the document); see `moveIntoVerdict`. */
|
|
120
123
|
function canMoveBlockInto(editor, id, targetId) {
|
|
121
124
|
return moveIntoVerdict(editor, id, targetId, untranslated).ok;
|
|
122
125
|
}
|
|
123
126
|
/**
|
|
124
|
-
* Moves block `id` to the end of the body of the
|
|
127
|
+
* Moves block `id` to the end of the body of the Typed block `targetId` (`null` = the end of the document) in a single
|
|
125
128
|
* transaction, i.e. one undo step. `false` when nothing moved: `moveIntoVerdict` refuses the move (or the editor
|
|
126
129
|
* refused the transaction).
|
|
127
130
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"outline.js","names":[],"sources":["../../../src/features/composites/outline.ts"],"sourcesContent":["import type { Editor } from '@tiptap/core'\nimport type { Node as PMNode } from '@tiptap/pm/model'\nimport { blockIdOf, findBlockById } from '../../core/schema'\nimport type { Translate } from '../../i18n'\nimport { nestingReason, outermostComposites } from './accepted-children'\nimport { basketOf, titleHiddenOf } from './baskets'\nimport { kindAccepts } from './kinds'\nimport { compositeKindsOf } from './nodes'\n\n/** One Baustein of a document's outline. */\nexport interface OutlineNode {\n /** Block ID, or `pos:<pos>` for a block without one yet; unique within the document. */\n key: string\n id: string | null\n /** Position of the composite in the document it was read from. */\n pos: number\n kind: string\n /**\n * The title; for a composite without one, the text of the first heading of its own body, else the start of the first\n * text of its own body (`labelFromBody`), else the caller's `untitled`.\n */\n title: string\n /** `title` is derived from the body, the Baustein itself has no title. */\n labelFromBody: boolean\n /** The composite has a description (the summary). */\n hasSummary: boolean\n /** Basket id (`meta.basket`), `null` without one. */\n basket: string | null\n /** The title is hidden in the editor (`meta.titleHidden`). */\n titleHidden: boolean\n children: OutlineNode[]\n}\n\n/** Longest label taken from a paragraph; longer text is cut and ends in an ellipsis. */\nconst BODY_LABEL_CHARS = 60\n\nconst clipLabel = (text: string) => {\n if (text.length <= BODY_LABEL_CHARS) return text\n let end = BODY_LABEL_CHARS\n const last = text.charCodeAt(end - 1)\n if (last >= 0xD800 && last <= 0xDBFF) end-- // do not cut a surrogate pair\n return `${text.slice(0, end).trimEnd()}…`\n}\n\n/**\n * Walks the blocks of a composite's own body (not the ones inside a nested composite) in order. The text of the first\n * heading ends the walk; `found.text` collects the first non-empty text block as the fallback.\n */\nfunction scanBody(parent: PMNode, from: number, found: { heading: string | null, text: string | null }): void {\n for (let i = from; i < parent.childCount && found.heading === null; i++) {\n const node = parent.child(i)\n if (node.type.name === 'composite') continue\n if (node.isTextblock) {\n const text = node.textContent.trim()\n if (!text) continue\n if (node.type.name === 'heading') found.heading = text\n else found.text ??= text.replace(/\\s+/g, ' ')\n }\n else if (!node.isLeaf) scanBody(node, 0, found)\n }\n}\n\n/** The label of a composite without a title: its first heading, else the start of its first text; `null` for an empty body. */\nfunction bodyLabel(composite: PMNode): string | null {\n const found = { heading: null as string | null, text: null as string | null }\n scanBody(composite, 3, found) // title, description and tags come first\n return found.heading ?? (found.text === null ? null : clipLabel(found.text))\n}\n\n/**\n * The composites of `doc` as a tree (title, kind, summary flag). A composite without a title is labelled by its body\n * (`labelFromBody`: first heading, else the start of the first text; nested composites do not count) and only an empty\n * one gets `untitled` (the caller's translated „(ohne Titel)“). Composites of a kind in `hiddenKinds` are omitted and their visible descendants\n * take their place in the parent's list.\n */\nexport function compositeOutline(doc: PMNode, hiddenKinds: ReadonlySet<string>, untitled: string): OutlineNode[] {\n function collect(parent: PMNode, start: number, into: OutlineNode[]) {\n parent.forEach((node, offset) => {\n const pos = start + offset\n if (node.type.name === 'composite') {\n const kind = String(node.attrs.kind)\n const children: OutlineNode[] = []\n collect(node, pos + 1, children)\n if (hiddenKinds.has(kind)) {\n into.push(...children)\n return\n }\n const id = blockIdOf(node)\n const ownTitle = node.firstChild?.textContent.trim() ?? ''\n const derived = ownTitle ? null : bodyLabel(node)\n into.push({\n key: id ?? `pos:${pos}`,\n id,\n pos,\n kind,\n title: ownTitle || derived || untitled,\n labelFromBody: derived !== null,\n hasSummary: (node.maybeChild(1)?.content.size ?? 0) > 0,\n basket: basketOf(node),\n titleHidden: titleHiddenOf(node),\n children,\n })\n }\n else if (!node.isTextblock && !node.isLeaf) {\n // Composites can sit in quotes or lists as well.\n collect(node, pos + 1, into)\n }\n })\n }\n const roots: OutlineNode[] = []\n collect(doc, 0, roots)\n return roots\n}\n\n/** Whether a block may move into a Baustein; `reason` is a short sentence for the UI (in the language of the `t` it was judged with) when it may not. */\nexport type MoveVerdict = { ok: true } | { ok: false, reason: string }\n\nconst refused = (reason: string): MoveVerdict => ({ ok: false, reason })\n\n/**\n * Whether block `id` may move into the Baustein `targetId` (`null` = the end of the document), with the reason when\n * not: a block is missing, the target is no Baustein, the target is the block itself or inside it, or the target's kind\n * does not accept the block's kind (`CompositeKind.accepts`). A block that is no Baustein may move into any Baustein,\n * unless it holds Bausteine of a refused kind; Bausteine nested inside a moved Baustein stay with it and are not\n * checked. Moving a block to the end of the Baustein it already sits in adds no nesting and is never refused for it.\n */\nexport function moveIntoVerdict(editor: Editor, id: string, targetId: string | null, t: Translate): MoveVerdict {\n const { doc } = editor.state\n const block = findBlockById(doc, id)\n if (!block) return refused(t('composites.move.blockGone'))\n if (targetId === null) return { ok: true }\n const target = findBlockById(doc, targetId)\n if (!target) return refused(t('composites.move.targetGone'))\n if (target.node.type.name !== 'composite') return refused(t('composites.move.targetNotBlock'))\n if (target.pos === block.pos) return refused(t('composites.move.intoSelf'))\n if (target.pos > block.pos && target.pos < block.pos + block.node.nodeSize) return refused(t('composites.move.intoOwn'))\n\n // The nearest Baustein around the block: when it is the target, the block only moves within it.\n const $block = doc.resolve(block.pos)\n let parentPos = -1\n for (let depth = $block.depth; depth > 0; depth--) {\n if ($block.node(depth).type.name === 'composite') {\n parentPos = $block.before(depth)\n break\n }\n }\n if (parentPos === target.pos) return { ok: true }\n\n const kinds = compositeKindsOf(editor)\n const targetKind = String(target.node.attrs.kind)\n for (const child of outermostComposites(block.node)) {\n const childKind = String(child.attrs.kind)\n if (!kindAccepts(kinds, targetKind, childKind)) return refused(nestingReason(kinds, targetKind, childKind, t))\n }\n return { ok: true }\n}\n\n/** `canMoveBlockInto` reads only `ok`, so its verdict needs no text: the message keys stand in for the sentences. */\nconst untranslated: Translate = key => key\n\n/** Whether block `id` can move into the Baustein `targetId` (`null` = the end of the document); see `moveIntoVerdict`. */\nexport function canMoveBlockInto(editor: Editor, id: string, targetId: string | null): boolean {\n return moveIntoVerdict(editor, id, targetId, untranslated).ok\n}\n\n/**\n * Moves block `id` to the end of the body of the Baustein `targetId` (`null` = the end of the document) in a single\n * transaction, i.e. one undo step. `false` when nothing moved: `moveIntoVerdict` refuses the move (or the editor\n * refused the transaction).\n */\nexport function moveBlockInto(editor: Editor, id: string, targetId: string | null): boolean {\n if (!canMoveBlockInto(editor, id, targetId)) return false\n const { doc, tr } = editor.state\n const block = findBlockById(doc, id)!\n const target = targetId === null ? null : findBlockById(doc, targetId)!\n // A composite's body is its last children, so its end is just before the composite's closing token.\n const insertPos = target ? target.pos + target.node.nodeSize - 1 : doc.content.size\n tr.delete(block.pos, block.pos + block.node.nodeSize)\n tr.insert(tr.mapping.map(insertPos), block.node)\n editor.view.dispatch(tr.scrollIntoView())\n return editor.state.doc !== doc\n}\n"],"mappings":";;;;;;;AAkCA,MAAM,mBAAmB;AAEzB,MAAM,aAAa,SAAiB;CAClC,IAAI,KAAK,UAAU,kBAAkB,OAAO;CAC5C,IAAI,MAAM;CACV,MAAM,OAAO,KAAK,WAAW,MAAM,CAAC;CACpC,IAAI,QAAQ,SAAU,QAAQ,OAAQ;CACtC,OAAO,GAAG,KAAK,MAAM,GAAG,GAAG,CAAC,CAAC,QAAQ,EAAE;AACzC;;;;;AAMA,SAAS,SAAS,QAAgB,MAAc,OAA8D;CAC5G,KAAK,IAAI,IAAI,MAAM,IAAI,OAAO,cAAc,MAAM,YAAY,MAAM,KAAK;EACvE,MAAM,OAAO,OAAO,MAAM,CAAC;EAC3B,IAAI,KAAK,KAAK,SAAS,aAAa;EACp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AAQ,cAAc,OAAO,YAAY,WAAW,CAAC,CAAC;CAC/G;CACA,OAAO,EAAE,IAAI,KAAK;AACpB;;AAGA,MAAM,gBAA0B,QAAO;;AAGvC,SAAgB,iBAAiB,QAAgB,IAAY,UAAkC;CAC7F,OAAO,gBAAgB,QAAQ,IAAI,UAAU,YAAY,CAAC,CAAC;AAC7D;;;;;;AAOA,SAAgB,cAAc,QAAgB,IAAY,UAAkC;CAC1F,IAAI,CAAC,iBAAiB,QAAQ,IAAI,QAAQ,GAAG,OAAO;CACpD,MAAM,EAAE,KAAK,OAAO,OAAO;CAC3B,MAAM,QAAQ,cAAc,KAAK,EAAE;CACnC,MAAM,SAAS,aAAa,OAAO,OAAO,cAAc,KAAK,QAAQ;CAErE,MAAM,YAAY,SAAS,OAAO,MAAM,OAAO,KAAK,WAAW,IAAI,IAAI,QAAQ;CAC/E,GAAG,OAAO,MAAM,KAAK,MAAM,MAAM,MAAM,KAAK,QAAQ;CACpD,GAAG,OAAO,GAAG,QAAQ,IAAI,SAAS,GAAG,MAAM,IAAI;CAC/C,OAAO,KAAK,SAAS,GAAG,eAAe,CAAC;CACxC,OAAO,OAAO,MAAM,QAAQ;AAC9B"}
|
|
1
|
+
{"version":3,"file":"outline.js","names":[],"sources":["../../../src/features/composites/outline.ts"],"sourcesContent":["import type { Editor } from '@tiptap/core'\nimport type { Node as PMNode } from '@tiptap/pm/model'\nimport { derivationOf, derivationOriginOf } from '../../core/derivation'\nimport { blockIdOf, findBlockById } from '../../core/schema'\nimport type { Translate } from '../../i18n'\nimport { nestingReason, outermostComposites } from './accepted-children'\nimport { basketOf, titleHiddenOf } from './baskets'\nimport { acceptsChild } from './block-types'\nimport { blockTypesOf } from './nodes'\n\n/** One Typed block of a document's outline. */\nexport interface OutlineNode {\n /** Block ID, or `pos:<pos>` for a block without one yet; unique within the document. */\n key: string\n id: string | null\n /** Position of the composite in the document it was read from. */\n pos: number\n kind: string\n /**\n * The title; for a composite without one, the text of the first heading of its own body, else the start of the first\n * text of its own body (`labelFromBody`), else the caller's `untitled`.\n */\n title: string\n /** `title` is derived from the body, the Typed block itself has no title. */\n labelFromBody: boolean\n /** The composite has a description (the summary). */\n hasSummary: boolean\n /** Basket id (`meta.basket`), `null` without one. */\n basket: string | null\n /** The title is hidden in the editor (`meta.titleHidden`). */\n titleHidden: boolean\n /** The Block is a Derived block whose original was deleted (the source-missing state of its Derivation). */\n sourceMissing: boolean\n children: OutlineNode[]\n}\n\n/** Longest label taken from a paragraph; longer text is cut and ends in an ellipsis. */\nconst BODY_LABEL_CHARS = 60\n\nconst clipLabel = (text: string) => {\n if (text.length <= BODY_LABEL_CHARS) return text\n let end = BODY_LABEL_CHARS\n const last = text.charCodeAt(end - 1)\n if (last >= 0xD800 && last <= 0xDBFF) end-- // do not cut a surrogate pair\n return `${text.slice(0, end).trimEnd()}…`\n}\n\n/**\n * Walks the blocks of a composite's own body (not the ones inside a nested composite) in order. The text of the first\n * heading ends the walk; `found.text` collects the first non-empty text block as the fallback.\n */\nfunction scanBody(parent: PMNode, from: number, found: { heading: string | null, text: string | null }): void {\n for (let i = from; i < parent.childCount && found.heading === null; i++) {\n const node = parent.child(i)\n if (node.type.name === 'typedBlock') continue\n if (node.isTextblock) {\n const text = node.textContent.trim()\n if (!text) continue\n if (node.type.name === 'heading') found.heading = text\n else found.text ??= text.replace(/\\s+/g, ' ')\n }\n else if (!node.isLeaf) scanBody(node, 0, found)\n }\n}\n\n/** The label of a composite without a title: its first heading, else the start of its first text; `null` for an empty body. */\nfunction bodyLabel(composite: PMNode): string | null {\n const found = { heading: null as string | null, text: null as string | null }\n scanBody(composite, 3, found) // title, description and tags come first\n return found.heading ?? (found.text === null ? null : clipLabel(found.text))\n}\n\n/**\n * The composites of `doc` as a tree (title, kind, summary flag). A composite without a title is labelled by its body\n * (`labelFromBody`: first heading, else the start of the first text; nested composites do not count) and only an empty\n * one gets `untitled` (the caller's translated „(ohne Titel)“). Composites of a kind in `hiddenKinds` are omitted and their visible descendants\n * take their place in the parent's list. With `capabilitiesOf` (the editor's block capabilities) a composite without the `basket` capability has no basket.\n * `sourceMissing` marks a Derived block whose original is gone (`derivationOriginOf` against `documentId`, the open document).\n */\nexport function compositeOutline(doc: PMNode, hiddenKinds: ReadonlySet<string>, untitled: string, capabilitiesOf?: (node: PMNode) => ReadonlySet<string>, documentId?: string | null): OutlineNode[] {\n function collect(parent: PMNode, start: number, into: OutlineNode[]) {\n parent.forEach((node, offset) => {\n const pos = start + offset\n if (node.type.name === 'typedBlock') {\n const kind = String(node.attrs.blockType)\n const children: OutlineNode[] = []\n collect(node, pos + 1, children)\n if (hiddenKinds.has(kind)) {\n into.push(...children)\n return\n }\n const id = blockIdOf(node)\n const ownTitle = node.firstChild?.textContent.trim() ?? ''\n const derived = ownTitle ? null : bodyLabel(node)\n into.push({\n key: id ?? `pos:${pos}`,\n id,\n pos,\n kind,\n title: ownTitle || derived || untitled,\n labelFromBody: derived !== null,\n hasSummary: (node.maybeChild(1)?.content.size ?? 0) > 0,\n basket: capabilitiesOf && !capabilitiesOf(node).has('basket') ? null : basketOf(node),\n titleHidden: titleHiddenOf(node),\n sourceMissing: derivationOf(node) !== null && derivationOriginOf(doc, pos, documentId)?.status === 'missing',\n children,\n })\n }\n else if (!node.isTextblock && !node.isLeaf) {\n // Composites can sit in quotes or lists as well.\n collect(node, pos + 1, into)\n }\n })\n }\n const roots: OutlineNode[] = []\n collect(doc, 0, roots)\n return roots\n}\n\n/** Whether a block may move into a Typed block; `reason` is a short sentence for the UI (in the language of the `t` it was judged with) when it may not. */\nexport type MoveVerdict = { ok: true } | { ok: false, reason: string }\n\nconst refused = (reason: string): MoveVerdict => ({ ok: false, reason })\n\n/**\n * Whether block `id` may move into the Typed block `targetId` (`null` = the end of the document), with the reason when\n * not: a block is missing, the target is no Typed block, the target is the block itself or inside it, or the target's Block type\n * does not accept the block's Block type (`BlockType.accepts`). A block that is no Typed block may move into any Typed block,\n * unless it holds Typed blocks of a refused Block type; Typed blocks nested inside a moved Typed block stay with it and are not\n * checked. Moving a block to the end of the Typed block it already sits in adds no nesting and is never refused for it.\n */\nexport function moveIntoVerdict(editor: Editor, id: string, targetId: string | null, t: Translate): MoveVerdict {\n const { doc } = editor.state\n const block = findBlockById(doc, id)\n if (!block) return refused(t('composites.move.blockGone'))\n if (targetId === null) return { ok: true }\n const target = findBlockById(doc, targetId)\n if (!target) return refused(t('composites.move.targetGone'))\n if (target.node.type.name !== 'typedBlock') return refused(t('composites.move.targetNotBlock'))\n if (target.pos === block.pos) return refused(t('composites.move.intoSelf'))\n if (target.pos > block.pos && target.pos < block.pos + block.node.nodeSize) return refused(t('composites.move.intoOwn'))\n\n // The nearest Typed block around the block: when it is the target, the block only moves within it.\n const $block = doc.resolve(block.pos)\n let parentPos = -1\n for (let depth = $block.depth; depth > 0; depth--) {\n if ($block.node(depth).type.name === 'typedBlock') {\n parentPos = $block.before(depth)\n break\n }\n }\n if (parentPos === target.pos) return { ok: true }\n\n const kinds = blockTypesOf(editor)\n const targetKind = String(target.node.attrs.blockType)\n for (const child of outermostComposites(block.node)) {\n const childKind = String(child.attrs.blockType)\n if (!acceptsChild(kinds, targetKind, childKind)) return refused(nestingReason(kinds, targetKind, childKind, t))\n }\n return { ok: true }\n}\n\n/** `canMoveBlockInto` reads only `ok`, so its verdict needs no text: the message keys stand in for the sentences. */\nconst untranslated: Translate = key => key\n\n/** Whether block `id` can move into the Typed block `targetId` (`null` = the end of the document); see `moveIntoVerdict`. */\nexport function canMoveBlockInto(editor: Editor, id: string, targetId: string | null): boolean {\n return moveIntoVerdict(editor, id, targetId, untranslated).ok\n}\n\n/**\n * Moves block `id` to the end of the body of the Typed block `targetId` (`null` = the end of the document) in a single\n * transaction, i.e. one undo step. `false` when nothing moved: `moveIntoVerdict` refuses the move (or the editor\n * refused the transaction).\n */\nexport function moveBlockInto(editor: Editor, id: string, targetId: string | null): boolean {\n if (!canMoveBlockInto(editor, id, targetId)) return false\n const { doc, tr } = editor.state\n const block = findBlockById(doc, id)!\n const target = targetId === null ? null : findBlockById(doc, targetId)!\n // A composite's body is its last children, so its end is just before the composite's closing token.\n const insertPos = target ? target.pos + target.node.nodeSize - 1 : doc.content.size\n tr.delete(block.pos, block.pos + block.node.nodeSize)\n tr.insert(tr.mapping.map(insertPos), block.node)\n editor.view.dispatch(tr.scrollIntoView())\n return editor.state.doc !== doc\n}\n"],"mappings":";;;;;;;;AAqCA,MAAM,mBAAmB;AAEzB,MAAM,aAAa,SAAiB;CAClC,IAAI,KAAK,UAAU,kBAAkB,OAAO;CAC5C,IAAI,MAAM;CACV,MAAM,OAAO,KAAK,WAAW,MAAM,CAAC;CACpC,IAAI,QAAQ,SAAU,QAAQ,OAAQ;CACtC,OAAO,GAAG,KAAK,MAAM,GAAG,GAAG,CAAC,CAAC,QAAQ,EAAE;AACzC;;;;;AAMA,SAAS,SAAS,QAAgB,MAAc,OAA8D;CAC5G,KAAK,IAAI,IAAI,MAAM,IAAI,OAAO,cAAc,MAAM,YAAY,MAAM,KAAK;EACvE,MAAM,OAAO,OAAO,MAAM,CAAC;EAC3B,IAAI,KAAK,KAAK,SAAS,cAAc;EACrC,IAAI,KAAK,aAAa;GACpB,MAAM,OAAO,KAAK,YAAY,KAAK;GACnC,IAAI,CAAC,MAAM;GACX,IAAI,KAAK,KAAK,SAAS,WAAW,MAAM,UAAU;QAC7C,MAAM,SAAS,KAAK,QAAQ,QAAQ,GAAG;EAC9C,OACK,IAAI,CAAC,KAAK,QAAQ,SAAS,MAAM,GAAG,KAAK;CAChD;AACF;;AAGA,SAAS,UAAU,WAAkC;CACnD,MAAM,QAAQ;EAAE,SAAS;EAAuB,MAAM;CAAsB;CAC5E,SAAS,WAAW,GAAG,KAAK;CAC5B,OAAO,MAAM,YAAY,MAAM,SAAS,OAAO,OAAO,UAAU,MAAM,IAAI;AAC5E;;;;;;;;AASA,SAAgB,iBAAiB,KAAa,aAAkC,UAAkB,gBAAwD,YAA2C;CACnM,SAAS,QAAQ,QAAgB,OAAe,MAA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AAM,QAAQ,cAAc,KAAK,EAAE;CACnC,MAAM,SAAS,aAAa,OAAO,OAAO,cAAc,KAAK,QAAQ;CAErE,MAAM,YAAY,SAAS,OAAO,MAAM,OAAO,KAAK,WAAW,IAAI,IAAI,QAAQ;CAC/E,GAAG,OAAO,MAAM,KAAK,MAAM,MAAM,MAAM,KAAK,QAAQ;CACpD,GAAG,OAAO,GAAG,QAAQ,IAAI,SAAS,GAAG,MAAM,IAAI;CAC/C,OAAO,KAAK,SAAS,GAAG,eAAe,CAAC;CACxC,OAAO,OAAO,MAAM,QAAQ;AAC9B"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { PropertyDefinition } from "../../core/properties.js";
|
|
2
|
+
import { BlockType } from "./block-types.js";
|
|
3
|
+
import { Editor } from "@tiptap/core";
|
|
4
|
+
import { Node as Node$1, ResolvedPos } from "@tiptap/pm/model";
|
|
5
|
+
//#region src/features/composites/properties.d.ts
|
|
6
|
+
/** Whether the node type has the `meta` attribute, where Block properties (and the bibliography, the basket, the derivation) are stored. This is what the `properties` capability's `appliesTo` asks of a node. */
|
|
7
|
+
export declare const carriesProperties: (node: Node$1) => boolean;
|
|
8
|
+
/** A block that carries property values, with the Property definitions its Block type declares and the values it holds. */
|
|
9
|
+
export interface BlockProperties {
|
|
10
|
+
/** Block ID, or `pos:<pos>` for a block without one yet; unique within the document. */
|
|
11
|
+
key: string;
|
|
12
|
+
id: string | null;
|
|
13
|
+
/** Position of the block when it was read; the write helpers re-resolve it, so a stale value is safe for blocks with an ID. */
|
|
14
|
+
pos: number;
|
|
15
|
+
/** The values, as stored: `meta`. */
|
|
16
|
+
meta: Record<string, unknown>;
|
|
17
|
+
/** The Property definitions of the block's Block type: empty without the `properties` capability; `bibliography` definitions drop out without the `bibliography` capability. */
|
|
18
|
+
definitions: readonly PropertyDefinition[];
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* The properties of `node` at `pos`, a node that carries property values (`carriesProperties`; its `meta` is read as the
|
|
22
|
+
* values). `capabilities` is what `capabilitiesOf` answers for the node; `blockTypes` are the editor's Block types.
|
|
23
|
+
*/
|
|
24
|
+
export declare function blockPropertiesOf(node: Node$1, pos: number, blockTypes: readonly BlockType[], capabilities: ReadonlySet<string>): BlockProperties;
|
|
25
|
+
/**
|
|
26
|
+
* The properties of the innermost block around `$pos` that carries property values (`carriesProperties`), with its node; null
|
|
27
|
+
* when none does. A block of that kind whose type lacks the `properties` capability answers with no `definitions` rather than handing
|
|
28
|
+
* the caret to an outer block. `blockTypes` are the editor's Block types.
|
|
29
|
+
*/
|
|
30
|
+
export declare function blockPropertiesAt(editor: Editor, $pos: ResolvedPos, blockTypes: readonly BlockType[]): {
|
|
31
|
+
node: Node$1;
|
|
32
|
+
properties: BlockProperties;
|
|
33
|
+
} | null;
|
|
34
|
+
/** The block `target` stands for in `doc` and that carries property values: by block ID, else (no ID yet) by its position. Positions are re-resolved on every call. */
|
|
35
|
+
export declare function propertyHostOf(doc: Node$1, target: Pick<BlockProperties, 'id' | 'pos'>): {
|
|
36
|
+
pos: number;
|
|
37
|
+
node: Node$1;
|
|
38
|
+
} | null;
|
|
39
|
+
/**
|
|
40
|
+
* `meta` with `value` stored under `definition.key`: a number property converts a numeric string, an empty value (`''`,
|
|
41
|
+
* `null`, `undefined`, `NaN`) removes the key. A `multiselect` property keeps the string entries of an array value and
|
|
42
|
+
* removes the key when none is left. Returns a new object; `meta` is not changed.
|
|
43
|
+
*/
|
|
44
|
+
export declare function metaWithProperty(meta: Record<string, unknown>, definition: Pick<PropertyDefinition, 'key' | 'type'>, value: unknown): Record<string, unknown>;
|
|
45
|
+
/**
|
|
46
|
+
* Stores `value` under the property `key` of the block `target` stands for (see `metaWithProperty`), in one transaction; a key
|
|
47
|
+
* the block's `definitions` do not define is written as text. False when the block is gone or carries no property values.
|
|
48
|
+
*/
|
|
49
|
+
export declare function setBlockProperty(editor: Editor, target: Pick<BlockProperties, 'id' | 'pos' | 'definitions'>, key: string, value: unknown): boolean;
|
|
50
|
+
//#endregion
|
|
51
|
+
//# sourceMappingURL=properties.d.ts.map
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { blockIdOf, findBlockById } from "../../core/schema/block-ids.js";
|
|
2
|
+
import { blockTypeIdOf, capabilitiesOf } from "../../core/capabilities.js";
|
|
3
|
+
import { blockTypeOf, propertiesOf } from "./block-types.js";
|
|
4
|
+
//#region src/features/composites/properties.ts
|
|
5
|
+
/** Whether the node type has the `meta` attribute, where Block properties (and the bibliography, the basket, the derivation) are stored. This is what the `properties` capability's `appliesTo` asks of a node. */
|
|
6
|
+
const carriesProperties = (node) => "meta" in (node.type.spec.attrs ?? {});
|
|
7
|
+
/**
|
|
8
|
+
* The properties of `node` at `pos`, a node that carries property values (`carriesProperties`; its `meta` is read as the
|
|
9
|
+
* values). `capabilities` is what `capabilitiesOf` answers for the node; `blockTypes` are the editor's Block types.
|
|
10
|
+
*/
|
|
11
|
+
function blockPropertiesOf(node, pos, blockTypes, capabilities) {
|
|
12
|
+
const id = blockIdOf(node);
|
|
13
|
+
const typeId = blockTypeIdOf(node);
|
|
14
|
+
const definitions = typeId !== null && capabilities.has("properties") ? propertiesOf(blockTypeOf(blockTypes, typeId)).filter((field) => field.type !== "bibliography" || capabilities.has("bibliography")) : [];
|
|
15
|
+
return {
|
|
16
|
+
key: id ?? `pos:${pos}`,
|
|
17
|
+
id,
|
|
18
|
+
pos,
|
|
19
|
+
meta: node.attrs.meta ?? {},
|
|
20
|
+
definitions
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* The properties of the innermost block around `$pos` that carries property values (`carriesProperties`), with its node; null
|
|
25
|
+
* when none does. A block of that kind whose type lacks the `properties` capability answers with no `definitions` rather than handing
|
|
26
|
+
* the caret to an outer block. `blockTypes` are the editor's Block types.
|
|
27
|
+
*/
|
|
28
|
+
function blockPropertiesAt(editor, $pos, blockTypes) {
|
|
29
|
+
for (let depth = $pos.depth; depth > 0; depth--) {
|
|
30
|
+
const node = $pos.node(depth);
|
|
31
|
+
if (carriesProperties(node)) return {
|
|
32
|
+
node,
|
|
33
|
+
properties: blockPropertiesOf(node, $pos.before(depth), blockTypes, capabilitiesOf(editor, node))
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
38
|
+
/** The block `target` stands for in `doc` and that carries property values: by block ID, else (no ID yet) by its position. Positions are re-resolved on every call. */
|
|
39
|
+
function propertyHostOf(doc, target) {
|
|
40
|
+
const found = target.id ? findBlockById(doc, target.id) : (() => {
|
|
41
|
+
const node = doc.nodeAt(target.pos);
|
|
42
|
+
return node ? {
|
|
43
|
+
pos: target.pos,
|
|
44
|
+
node
|
|
45
|
+
} : null;
|
|
46
|
+
})();
|
|
47
|
+
return found && carriesProperties(found.node) ? found : null;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* `meta` with `value` stored under `definition.key`: a number property converts a numeric string, an empty value (`''`,
|
|
51
|
+
* `null`, `undefined`, `NaN`) removes the key. A `multiselect` property keeps the string entries of an array value and
|
|
52
|
+
* removes the key when none is left. Returns a new object; `meta` is not changed.
|
|
53
|
+
*/
|
|
54
|
+
function metaWithProperty(meta, definition, value) {
|
|
55
|
+
const next = { ...meta };
|
|
56
|
+
if (definition.type === "multiselect") {
|
|
57
|
+
const chosen = Array.isArray(value) ? value.filter((item) => typeof item === "string") : [];
|
|
58
|
+
if (chosen.length) next[definition.key] = chosen;
|
|
59
|
+
else delete next[definition.key];
|
|
60
|
+
return next;
|
|
61
|
+
}
|
|
62
|
+
const stored = definition.type === "number" && typeof value === "string" && value !== "" ? Number(value) : value;
|
|
63
|
+
if (stored === "" || stored === null || stored === void 0 || Number.isNaN(stored)) delete next[definition.key];
|
|
64
|
+
else next[definition.key] = stored;
|
|
65
|
+
return next;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Stores `value` under the property `key` of the block `target` stands for (see `metaWithProperty`), in one transaction; a key
|
|
69
|
+
* the block's `definitions` do not define is written as text. False when the block is gone or carries no property values.
|
|
70
|
+
*/
|
|
71
|
+
function setBlockProperty(editor, target, key, value) {
|
|
72
|
+
const definition = target.definitions.find((candidate) => candidate.key === key) ?? {
|
|
73
|
+
key,
|
|
74
|
+
type: "text"
|
|
75
|
+
};
|
|
76
|
+
return editor.commands.command(({ tr }) => {
|
|
77
|
+
const found = propertyHostOf(tr.doc, target);
|
|
78
|
+
if (!found) return false;
|
|
79
|
+
tr.setNodeMarkup(found.pos, void 0, {
|
|
80
|
+
...found.node.attrs,
|
|
81
|
+
meta: metaWithProperty(found.node.attrs.meta ?? {}, definition, value)
|
|
82
|
+
});
|
|
83
|
+
return true;
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
//#endregion
|
|
87
|
+
export { blockPropertiesAt, blockPropertiesOf, carriesProperties, metaWithProperty, propertyHostOf, setBlockProperty };
|
|
88
|
+
|
|
89
|
+
//# sourceMappingURL=properties.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"properties.js","names":[],"sources":["../../../src/features/composites/properties.ts"],"sourcesContent":["// Vue-free: Block properties as one mechanism. A block carries property values when its node type has the `meta` attribute; the\n// `properties` capability (`capabilities.ts`) says which of its Property definitions a block's type declares. Reading, resolving\n// and writing the values never ask for a node type name, so every node type that gains a `meta` attribute is covered.\nimport type { Editor } from '@tiptap/core'\nimport type { Node as PMNode, ResolvedPos } from '@tiptap/pm/model'\nimport { blockTypeIdOf, capabilitiesOf } from '../../core/capabilities'\nimport type { PropertyDefinition } from '../../core/properties'\nimport { blockIdOf, findBlockById } from '../../core/schema'\nimport { type BlockType, blockTypeOf, propertiesOf } from './block-types'\n\n/** Whether the node type has the `meta` attribute, where Block properties (and the bibliography, the basket, the derivation) are stored. This is what the `properties` capability's `appliesTo` asks of a node. */\nexport const carriesProperties = (node: PMNode): boolean => 'meta' in (node.type.spec.attrs ?? {})\n\n/** A block that carries property values, with the Property definitions its Block type declares and the values it holds. */\nexport interface BlockProperties {\n /** Block ID, or `pos:<pos>` for a block without one yet; unique within the document. */\n key: string\n id: string | null\n /** Position of the block when it was read; the write helpers re-resolve it, so a stale value is safe for blocks with an ID. */\n pos: number\n /** The values, as stored: `meta`. */\n meta: Record<string, unknown>\n /** The Property definitions of the block's Block type: empty without the `properties` capability; `bibliography` definitions drop out without the `bibliography` capability. */\n definitions: readonly PropertyDefinition[]\n}\n\n/**\n * The properties of `node` at `pos`, a node that carries property values (`carriesProperties`; its `meta` is read as the\n * values). `capabilities` is what `capabilitiesOf` answers for the node; `blockTypes` are the editor's Block types.\n */\nexport function blockPropertiesOf(node: PMNode, pos: number, blockTypes: readonly BlockType[], capabilities: ReadonlySet<string>): BlockProperties {\n const id = blockIdOf(node)\n const typeId = blockTypeIdOf(node)\n const definitions = typeId !== null && capabilities.has('properties')\n ? propertiesOf(blockTypeOf(blockTypes, typeId)).filter(field => field.type !== 'bibliography' || capabilities.has('bibliography'))\n : []\n return { key: id ?? `pos:${pos}`, id, pos, meta: (node.attrs.meta ?? {}) as Record<string, unknown>, definitions }\n}\n\n/**\n * The properties of the innermost block around `$pos` that carries property values (`carriesProperties`), with its node; null\n * when none does. A block of that kind whose type lacks the `properties` capability answers with no `definitions` rather than handing\n * the caret to an outer block. `blockTypes` are the editor's Block types.\n */\nexport function blockPropertiesAt(editor: Editor, $pos: ResolvedPos, blockTypes: readonly BlockType[]): { node: PMNode, properties: BlockProperties } | null {\n for (let depth = $pos.depth; depth > 0; depth--) {\n const node = $pos.node(depth)\n if (carriesProperties(node)) return { node, properties: blockPropertiesOf(node, $pos.before(depth), blockTypes, capabilitiesOf(editor, node)) }\n }\n return null\n}\n\n/** The block `target` stands for in `doc` and that carries property values: by block ID, else (no ID yet) by its position. Positions are re-resolved on every call. */\nexport function propertyHostOf(doc: PMNode, target: Pick<BlockProperties, 'id' | 'pos'>): { pos: number, node: PMNode } | null {\n const found = target.id ? findBlockById(doc, target.id) : (() => {\n const node = doc.nodeAt(target.pos)\n return node ? { pos: target.pos, node } : null\n })()\n return found && carriesProperties(found.node) ? found : null\n}\n\n/**\n * `meta` with `value` stored under `definition.key`: a number property converts a numeric string, an empty value (`''`,\n * `null`, `undefined`, `NaN`) removes the key. A `multiselect` property keeps the string entries of an array value and\n * removes the key when none is left. Returns a new object; `meta` is not changed.\n */\nexport function metaWithProperty(meta: Record<string, unknown>, definition: Pick<PropertyDefinition, 'key' | 'type'>, value: unknown): Record<string, unknown> {\n const next = { ...meta }\n if (definition.type === 'multiselect') {\n const chosen = Array.isArray(value) ? value.filter((item): item is string => typeof item === 'string') : []\n if (chosen.length) next[definition.key] = chosen\n else delete next[definition.key]\n return next\n }\n const stored = definition.type === 'number' && typeof value === 'string' && value !== '' ? Number(value) : value\n if (stored === '' || stored === null || stored === undefined || Number.isNaN(stored)) delete next[definition.key]\n else next[definition.key] = stored\n return next\n}\n\n/**\n * Stores `value` under the property `key` of the block `target` stands for (see `metaWithProperty`), in one transaction; a key\n * the block's `definitions` do not define is written as text. False when the block is gone or carries no property values.\n */\nexport function setBlockProperty(editor: Editor, target: Pick<BlockProperties, 'id' | 'pos' | 'definitions'>, key: string, value: unknown): boolean {\n const definition = target.definitions.find(candidate => candidate.key === key) ?? { key, type: 'text' as const }\n return editor.commands.command(({ tr }) => {\n const found = propertyHostOf(tr.doc, target)\n if (!found) return false\n tr.setNodeMarkup(found.pos, undefined, { ...found.node.attrs, meta: metaWithProperty(found.node.attrs.meta ?? {}, definition, value) })\n return true\n })\n}\n"],"mappings":";;;;;AAWA,MAAa,qBAAqB,SAA0B,WAAW,KAAK,KAAK,KAAK,SAAS,CAAC;;;;;AAmBhG,SAAgB,kBAAkB,MAAc,KAAa,YAAkC,cAAoD;CACjJ,MAAM,KAAK,UAAU,IAAI;CACzB,MAAM,SAAS,cAAc,IAAI;CACjC,MAAM,cAAc,WAAW,QAAQ,aAAa,IAAI,YAAY,IAChE,aAAa,YAAY,YAAY,MAAM,CAAC,CAAC,CAAC,QAAO,UAA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