@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
|
@@ -4,19 +4,19 @@ import { Extension } from "@tiptap/core";
|
|
|
4
4
|
import { Plugin, PluginKey, TextSelection } from "@tiptap/pm/state";
|
|
5
5
|
import { Decoration, DecorationSet } from "@tiptap/pm/view";
|
|
6
6
|
//#region src/features/composites/focus.ts
|
|
7
|
-
/** Class of every node hidden by focus mode (siblings of the focused
|
|
7
|
+
/** Class of every node hidden by focus mode (siblings of the focused Typed block and of each ancestor). */
|
|
8
8
|
const FOCUS_HIDDEN_CLASS = "sk-focus-hidden";
|
|
9
|
-
/** Class of the focused
|
|
9
|
+
/** Class of the focused Typed block. */
|
|
10
10
|
const FOCUS_TARGET_CLASS = "sk-focus-target";
|
|
11
|
-
/** Class of every ancestor of the focused
|
|
11
|
+
/** Class of every ancestor of the focused Typed block. */
|
|
12
12
|
const FOCUS_ANCESTOR_CLASS = "sk-focus-ancestor";
|
|
13
13
|
const compositeFocusKey = new PluginKey("compositeFocus");
|
|
14
|
-
/** The block id of the focused
|
|
14
|
+
/** The block id of the focused Typed block in `state`, `null` without focus (or without the extension). */
|
|
15
15
|
const compositeFocusOf = (state) => compositeFocusKey.getState(state)?.id ?? null;
|
|
16
16
|
/**
|
|
17
|
-
* The decorations of focus mode on
|
|
18
|
-
* `sk-focus-hidden` (a
|
|
19
|
-
* keep their titles), the
|
|
17
|
+
* The decorations of focus mode on Typed block `id` in `doc`: every sibling of the Typed block and of each of its ancestors gets
|
|
18
|
+
* `sk-focus-hidden` (a Typed block's title, description and tags are not siblings in this sense: they stay, so the ancestors
|
|
19
|
+
* keep their titles), the Typed block itself `sk-focus-target`, each ancestor `sk-focus-ancestor`. Empty when `id` is not in `doc`.
|
|
20
20
|
*/
|
|
21
21
|
function focusDecorations(doc, id) {
|
|
22
22
|
const found = findBlockById(doc, id);
|
|
@@ -27,7 +27,7 @@ function focusDecorations(doc, id) {
|
|
|
27
27
|
const parent = $pos.node(depth);
|
|
28
28
|
const onPath = $pos.index(depth);
|
|
29
29
|
const start = $pos.start(depth);
|
|
30
|
-
const isComposite = parent.type.name === "
|
|
30
|
+
const isComposite = parent.type.name === "typedBlock";
|
|
31
31
|
parent.forEach((child, offset, index) => {
|
|
32
32
|
if (index === onPath || isComposite && index < 3) return;
|
|
33
33
|
const pos = start + offset;
|
|
@@ -42,15 +42,15 @@ const unfocused = {
|
|
|
42
42
|
decorations: DecorationSet.empty
|
|
43
43
|
};
|
|
44
44
|
/**
|
|
45
|
-
* Focus mode of
|
|
46
|
-
* when the focused
|
|
45
|
+
* Focus mode of Typed blocks (client-only, no schema): the `focusComposite` command, the plugin behind it and a reset
|
|
46
|
+
* when the focused Typed block disappears. The hiding itself is CSS on the classes the decorations carry (`composites.css`).
|
|
47
47
|
*/
|
|
48
48
|
const CompositeFocus = Extension.create({
|
|
49
49
|
name: "compositeFocus",
|
|
50
50
|
addCommands: () => ({ focusComposite: (id) => ({ state, tr }) => {
|
|
51
51
|
if (id !== null) {
|
|
52
52
|
const found = findBlockById(state.doc, id);
|
|
53
|
-
if (found?.node.type.name !== "
|
|
53
|
+
if (found?.node.type.name !== "typedBlock") return false;
|
|
54
54
|
const { from, to } = state.selection;
|
|
55
55
|
if (from < found.pos || to > found.pos + found.node.nodeSize) tr.setSelection(TextSelection.near(tr.doc.resolve(found.pos + 2)));
|
|
56
56
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"focus.js","names":[],"sources":["../../../src/features/composites/focus.ts"],"sourcesContent":["import { Extension } from '@tiptap/core'\nimport type { Node as PMNode } from '@tiptap/pm/model'\nimport { type EditorState, Plugin, PluginKey, TextSelection } from '@tiptap/pm/state'\nimport { Decoration, DecorationSet } from '@tiptap/pm/view'\nimport { findBlockById } from '../../core/schema'\nimport { COMPOSITE_CHROME_COUNT } from './nodes'\n\n/** State of `compositeFocusKey`: the focused
|
|
1
|
+
{"version":3,"file":"focus.js","names":[],"sources":["../../../src/features/composites/focus.ts"],"sourcesContent":["import { Extension } from '@tiptap/core'\nimport type { Node as PMNode } from '@tiptap/pm/model'\nimport { type EditorState, Plugin, PluginKey, TextSelection } from '@tiptap/pm/state'\nimport { Decoration, DecorationSet } from '@tiptap/pm/view'\nimport { findBlockById } from '../../core/schema'\nimport { COMPOSITE_CHROME_COUNT } from './nodes'\n\n/** State of `compositeFocusKey`: the focused Typed block's block id (`null` = no focus) and the decorations that hide the rest. */\nexport interface CompositeFocusState {\n id: string | null\n decorations: DecorationSet\n}\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n compositeFocus: {\n /**\n * Focus mode: show only the Typed block with block id `id` and the titles of the Typed blocks around it (the siblings of it\n * and of every ancestor are hidden); `null` ends it. False when `id` is not a Typed block of the document. A caret outside\n * the focused Typed block moves into its title, so no edit lands in hidden content. Resets by itself when the Typed block is gone.\n */\n focusComposite: (id: string | null) => ReturnType\n }\n }\n}\n\n/** Class of every node hidden by focus mode (siblings of the focused Typed block and of each ancestor). */\nexport const FOCUS_HIDDEN_CLASS = 'sk-focus-hidden'\n/** Class of the focused Typed block. */\nexport const FOCUS_TARGET_CLASS = 'sk-focus-target'\n/** Class of every ancestor of the focused Typed block. */\nexport const FOCUS_ANCESTOR_CLASS = 'sk-focus-ancestor'\n\nexport const compositeFocusKey = new PluginKey<CompositeFocusState>('compositeFocus')\n\n/** The block id of the focused Typed block in `state`, `null` without focus (or without the extension). */\nexport const compositeFocusOf = (state: EditorState): string | null => compositeFocusKey.getState(state)?.id ?? null\n\n/**\n * The decorations of focus mode on Typed block `id` in `doc`: every sibling of the Typed block and of each of its ancestors gets\n * `sk-focus-hidden` (a Typed block's title, description and tags are not siblings in this sense: they stay, so the ancestors\n * keep their titles), the Typed block itself `sk-focus-target`, each ancestor `sk-focus-ancestor`. Empty when `id` is not in `doc`.\n */\nexport function focusDecorations(doc: PMNode, id: string): DecorationSet {\n const found = findBlockById(doc, id)\n if (!found) return DecorationSet.empty\n const $pos = doc.resolve(found.pos)\n const decorations: Decoration[] = [Decoration.node(found.pos, found.pos + found.node.nodeSize, { class: FOCUS_TARGET_CLASS })]\n for (let depth = $pos.depth; depth >= 0; depth--) {\n const parent = $pos.node(depth)\n const onPath = $pos.index(depth)\n const start = $pos.start(depth)\n const isComposite = parent.type.name === 'typedBlock'\n parent.forEach((child, offset, index) => {\n if (index === onPath || (isComposite && index < COMPOSITE_CHROME_COUNT)) return\n const pos = start + offset\n decorations.push(Decoration.node(pos, pos + child.nodeSize, { class: FOCUS_HIDDEN_CLASS }))\n })\n if (depth > 0) decorations.push(Decoration.node($pos.before(depth), $pos.after(depth), { class: FOCUS_ANCESTOR_CLASS }))\n }\n return DecorationSet.create(doc, decorations)\n}\n\nconst unfocused: CompositeFocusState = { id: null, decorations: DecorationSet.empty }\n\n/**\n * Focus mode of Typed blocks (client-only, no schema): the `focusComposite` command, the plugin behind it and a reset\n * when the focused Typed block disappears. The hiding itself is CSS on the classes the decorations carry (`composites.css`).\n */\nexport const CompositeFocus = Extension.create({\n name: 'compositeFocus',\n addCommands: () => ({\n focusComposite: (id: string | null) => ({ state, tr }) => {\n if (id !== null) {\n const found = findBlockById(state.doc, id)\n if (found?.node.type.name !== 'typedBlock') return false\n const { from, to } = state.selection\n // The caret in hidden content would edit what nobody sees: move it into the focused Typed block's title.\n if (from < found.pos || to > found.pos + found.node.nodeSize) tr.setSelection(TextSelection.near(tr.doc.resolve(found.pos + 2)))\n }\n tr.setMeta(compositeFocusKey, { id })\n return true\n },\n }),\n addProseMirrorPlugins: () => [\n new Plugin<CompositeFocusState>({\n key: compositeFocusKey,\n state: {\n init: () => unfocused,\n apply(tr, value) {\n const meta = tr.getMeta(compositeFocusKey) as { id: string | null } | undefined\n const id = meta ? meta.id : value.id\n if (id === null) return value.id === null ? value : unfocused\n if (!meta && !tr.docChanged) return value\n return { id, decorations: focusDecorations(tr.doc, id) }\n },\n },\n appendTransaction(transactions, _before, after) {\n const id = compositeFocusKey.getState(after)?.id\n if (!id || !transactions.some(tr => tr.docChanged || tr.getMeta(compositeFocusKey))) return null\n return findBlockById(after.doc, id) ? null : after.tr.setMeta(compositeFocusKey, { id: null }).setMeta('addToHistory', false)\n },\n props: {\n decorations: state => compositeFocusKey.getState(state)?.decorations,\n },\n }),\n ],\n})\n"],"mappings":";;;;;;;AA2BA,MAAa,qBAAqB;;AAElC,MAAa,qBAAqB;;AAElC,MAAa,uBAAuB;AAEpC,MAAa,oBAAoB,IAAI,UAA+B,gBAAgB;;AAGpF,MAAa,oBAAoB,UAAsC,kBAAkB,SAAS,KAAK,CAAC,EAAE,MAAM;;;;;;AAOhH,SAAgB,iBAAiB,KAAa,IAA2B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QAAQ,MAAM,MAAM,CAAC,CAAC,CAAC;EACjI;EACA,GAAG,QAAQ,mBAAmB,EAAE,GAAG,CAAC;EACpC,OAAO;CACT,EACF;CACA,6BAA6B,CAC3B,IAAI,OAA4B;EAC9B,KAAK;EACL,OAAO;GACL,YAAY;GACZ,MAAM,IAAI,OAAO;IACf,MAAM,OAAO,GAAG,QAAQ,iBAAiB;IACzC,MAAM,KAAK,OAAO,KAAK,KAAK,MAAM;IAClC,IAAI,OAAO,MAAM,OAAO,MAAM,OAAO,OAAO,QAAQ;IACpD,IAAI,CAAC,QAAQ,CAAC,GAAG,YAAY,OAAO;IACpC,OAAO;KAAE;KAAI,aAAa,iBAAiB,GAAG,KAAK,EAAE;IAAE;GACzD;EACF;EACA,kBAAkB,cAAc,SAAS,OAAO;GAC9C,MAAM,KAAK,kBAAkB,SAAS,KAAK,CAAC,EAAE;GAC9C,IAAI,CAAC,MAAM,CAAC,aAAa,MAAK,OAAM,GAAG,cAAc,GAAG,QAAQ,iBAAiB,CAAC,GAAG,OAAO;GAC5F,OAAO,cAAc,MAAM,KAAK,EAAE,IAAI,OAAO,MAAM,GAAG,QAAQ,mBAAmB,EAAE,IAAI,KAAK,CAAC,CAAC,CAAC,QAAQ,gBAAgB,KAAK;EAC9H;EACA,OAAO,EACL,cAAa,UAAS,kBAAkB,SAAS,KAAK,CAAC,EAAE,YAC3D;CACF,CAAC,CACH;AACF,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { StructureMode } from "../../settings/values.js";
|
|
2
2
|
import "../../settings/index.js";
|
|
3
|
-
import {
|
|
3
|
+
import { BlockType } from "./block-types.js";
|
|
4
4
|
import { Node, Schema } from "@tiptap/pm/model";
|
|
5
5
|
//#region src/features/composites/heading-composites.d.ts
|
|
6
6
|
/**
|
|
@@ -19,18 +19,18 @@ export declare function headingGroupRange(parent: Node, index: number): {
|
|
|
19
19
|
* description italic, the tags as tag chips (`#name` text without a `tag` node), the meta as one `Label: Wert · …` line
|
|
20
20
|
* (labels and option labels from the composite's kind in `kinds`; raw keys and values for an unknown kind).
|
|
21
21
|
*/
|
|
22
|
-
export declare function compositeChromeBlocks(schema: Schema, composite: Node, kinds: readonly
|
|
22
|
+
export declare function compositeChromeBlocks(schema: Schema, composite: Node, kinds: readonly BlockType[]): Node[];
|
|
23
23
|
/**
|
|
24
24
|
* Inverse of `groupHeadingsIntoComposites`: every composite in `blocks` (siblings) becomes a heading of `level` (max 6)
|
|
25
25
|
* with its title, then its chrome (`compositeChromeBlocks`), then its body (dropped when it is one empty paragraph).
|
|
26
26
|
* Recursive: nested composites in bodies become headings of `level + 1` and so on; flat: they stay. `null` when
|
|
27
27
|
* `blocks` holds no composite. Created blocks carry no id; carried-over body blocks keep theirs.
|
|
28
28
|
*/
|
|
29
|
-
export declare function flattenCompositesToHeadings(schema: Schema, blocks: readonly Node[], recursive: boolean, level: number, kinds: readonly
|
|
29
|
+
export declare function flattenCompositesToHeadings(schema: Schema, blocks: readonly Node[], recursive: boolean, level: number, kinds: readonly BlockType[]): Node[] | null;
|
|
30
30
|
/**
|
|
31
|
-
* `blocks` (siblings) in the preferred `structure`: `'
|
|
31
|
+
* `blocks` (siblings) in the preferred `structure`: `'structured'` groups headings into `section` composites at every
|
|
32
32
|
* level, `'flat'` turns composites into headings starting at `level`. Unchanged blocks come back as a copy of the array.
|
|
33
33
|
*/
|
|
34
|
-
export declare function structureBlocks(schema: Schema, blocks: readonly Node[], structure: StructureMode, level: number, kinds: readonly
|
|
34
|
+
export declare function structureBlocks(schema: Schema, blocks: readonly Node[], structure: StructureMode, level: number, kinds: readonly BlockType[]): Node[];
|
|
35
35
|
//#endregion
|
|
36
36
|
//# sourceMappingURL=heading-composites.d.ts.map
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { TYPED_BLOCK, TYPED_BLOCK_DESCRIPTION, TYPED_BLOCK_TAGS, TYPED_BLOCK_TITLE } from "../../core/schema/persisted-names.js";
|
|
2
|
+
import { blockTypeOf, propertiesOf } from "./block-types.js";
|
|
2
3
|
import { Fragment } from "@tiptap/pm/model";
|
|
3
4
|
//#region src/features/composites/heading-composites.ts
|
|
4
5
|
const HEADING = "heading";
|
|
5
|
-
const COMPOSITE = "composite";
|
|
6
|
-
const TITLE = "compositeTitle";
|
|
7
|
-
const DESCRIPTION = "compositeDescription";
|
|
8
|
-
const TAGS = "compositeTags";
|
|
9
6
|
const PARAGRAPH = "paragraph";
|
|
10
7
|
/** Title, description and tags: the fixed children in front of a composite's body. */
|
|
11
8
|
const CHROME_COUNT = 3;
|
|
@@ -20,7 +17,7 @@ function groupHeadingsIntoComposites(schema, blocks, recursive, kind) {
|
|
|
20
17
|
let changed = false;
|
|
21
18
|
let input = [...blocks];
|
|
22
19
|
if (recursive) input = input.map((block) => {
|
|
23
|
-
if (block.type.name !==
|
|
20
|
+
if (block.type.name !== "typedBlock") return block;
|
|
24
21
|
const children = [];
|
|
25
22
|
block.forEach((child) => children.push(child));
|
|
26
23
|
const body = groupHeadingsIntoComposites(schema, children.slice(CHROME_COUNT), true, kind);
|
|
@@ -45,10 +42,10 @@ function groupHeadingsIntoComposites(schema, blocks, recursive, kind) {
|
|
|
45
42
|
let content = body;
|
|
46
43
|
if (recursive) content = groupHeadingsIntoComposites(schema, content, true, kind) ?? content;
|
|
47
44
|
if (!content.length) content = [nodes[PARAGRAPH].create()];
|
|
48
|
-
return nodes[
|
|
49
|
-
nodes[
|
|
50
|
-
nodes[
|
|
51
|
-
nodes[
|
|
45
|
+
return nodes[TYPED_BLOCK].create({ blockType: kind }, [
|
|
46
|
+
nodes[TYPED_BLOCK_TITLE].create(null, heading.content),
|
|
47
|
+
nodes[TYPED_BLOCK_DESCRIPTION].create(),
|
|
48
|
+
nodes[TYPED_BLOCK_TAGS].create(),
|
|
52
49
|
...content
|
|
53
50
|
]);
|
|
54
51
|
});
|
|
@@ -91,8 +88,8 @@ function compositeChromeBlocks(schema, composite, kinds) {
|
|
|
91
88
|
const chips = names.flatMap((name, index) => [...index ? [schema.text(" ")] : [], n.tag ? n.tag.create({ name }) : schema.text(`#${name}`)]);
|
|
92
89
|
blocks.push(paragraph.create(null, chips));
|
|
93
90
|
}
|
|
94
|
-
const kind = composite.attrs.
|
|
95
|
-
const fields = kinds.some((known) => known.id === kind) ?
|
|
91
|
+
const kind = composite.attrs.blockType;
|
|
92
|
+
const fields = kinds.some((known) => known.id === kind) ? propertiesOf(blockTypeOf(kinds, kind)) : [];
|
|
96
93
|
const meta = composite.attrs.meta ?? {};
|
|
97
94
|
const entries = Object.entries(meta).filter(([, value]) => value !== "" && value !== null && value !== void 0).map(([key, value]) => {
|
|
98
95
|
const field = fields.find((candidate) => candidate.key === key);
|
|
@@ -109,10 +106,10 @@ function compositeChromeBlocks(schema, composite, kinds) {
|
|
|
109
106
|
* `blocks` holds no composite. Created blocks carry no id; carried-over body blocks keep theirs.
|
|
110
107
|
*/
|
|
111
108
|
function flattenCompositesToHeadings(schema, blocks, recursive, level, kinds) {
|
|
112
|
-
if (!blocks.some((block) => block.type.name ===
|
|
109
|
+
if (!blocks.some((block) => block.type.name === "typedBlock")) return null;
|
|
113
110
|
const heading = schema.nodes[HEADING];
|
|
114
111
|
return blocks.flatMap((block) => {
|
|
115
|
-
if (block.type.name !==
|
|
112
|
+
if (block.type.name !== "typedBlock") return [block];
|
|
116
113
|
let body = [];
|
|
117
114
|
block.forEach((child, _offset, index) => {
|
|
118
115
|
if (index >= CHROME_COUNT) body.push(child);
|
|
@@ -127,11 +124,11 @@ function flattenCompositesToHeadings(schema, blocks, recursive, level, kinds) {
|
|
|
127
124
|
});
|
|
128
125
|
}
|
|
129
126
|
/**
|
|
130
|
-
* `blocks` (siblings) in the preferred `structure`: `'
|
|
127
|
+
* `blocks` (siblings) in the preferred `structure`: `'structured'` groups headings into `section` composites at every
|
|
131
128
|
* level, `'flat'` turns composites into headings starting at `level`. Unchanged blocks come back as a copy of the array.
|
|
132
129
|
*/
|
|
133
130
|
function structureBlocks(schema, blocks, structure, level, kinds) {
|
|
134
|
-
if (structure === "
|
|
131
|
+
if (structure === "structured") return groupHeadingsIntoComposites(schema, blocks, true, "section") ?? [...blocks];
|
|
135
132
|
return flattenCompositesToHeadings(schema, blocks, true, level, kinds) ?? [...blocks];
|
|
136
133
|
}
|
|
137
134
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"heading-composites.js","names":[],"sources":["../../../src/features/composites/heading-composites.ts"],"sourcesContent":["import { Fragment, type Node as PMNode, type Schema } from '@tiptap/pm/model'\nimport { type CompositeKind, compositeKind } from './kinds'\nimport type { StructureMode } from '../../settings'\n\n// Node names hardcoded (not imported from composite.ts) so composite.ts can import this file without a cycle.\nconst HEADING = 'heading'\nconst COMPOSITE = 'composite'\nconst TITLE = 'compositeTitle'\nconst DESCRIPTION = 'compositeDescription'\nconst TAGS = 'compositeTags'\nconst PARAGRAPH = 'paragraph'\n/** Title, description and tags: the fixed children in front of a composite's body. */\nconst CHROME_COUNT = 3\n\n\nconst isHeading = (node: PMNode) => node.type.name === HEADING\nconst levelOf = (node: PMNode) => node.attrs.level as number\n\n/**\n * `blocks` (siblings) with headings grouped into composites of `kind`. Flat: only headings of the lowest level present\n * become composites; everything before the first such heading is kept. Recursive: bodies, the part before the first\n * heading and the bodies of existing composites are grouped the same way. `null` when nothing changed.\n */\nexport function groupHeadingsIntoComposites(schema: Schema, blocks: readonly PMNode[], recursive: boolean, kind: string): PMNode[] | null {\n let changed = false\n let input: PMNode[] = [...blocks]\n if (recursive) {\n input = input.map((block) => {\n if (block.type.name !== COMPOSITE) return block\n const children: PMNode[] = []\n block.forEach(child => children.push(child))\n const body = groupHeadingsIntoComposites(schema, children.slice(CHROME_COUNT), true, kind)\n if (!body) return block\n changed = true\n return block.copy(Fragment.from([...children.slice(0, CHROME_COUNT), ...body]))\n })\n }\n\n let minLevel = Infinity\n for (const block of input) if (isHeading(block)) minLevel = Math.min(minLevel, levelOf(block))\n if (minLevel === Infinity) return changed ? input : null\n\n const { nodes } = schema\n let preamble: PMNode[] = []\n const groups: { heading: PMNode, body: PMNode[] }[] = []\n for (const block of input) {\n if (isHeading(block) && levelOf(block) <= minLevel) groups.push({ heading: block, body: [] })\n else if (groups.length) groups[groups.length - 1]!.body.push(block)\n else preamble.push(block)\n }\n if (recursive) preamble = groupHeadingsIntoComposites(schema, preamble, true, kind) ?? preamble\n\n const composites = groups.map(({ heading, body }) => {\n let content = body\n if (recursive) content = groupHeadingsIntoComposites(schema, content, true, kind) ?? content\n if (!content.length) content = [nodes[PARAGRAPH]!.create()]\n return nodes[COMPOSITE]!.create({ kind }, [\n nodes[TITLE]!.create(null, heading.content), nodes[DESCRIPTION]!.create(), nodes[TAGS]!.create(), ...content,\n ])\n })\n return [...preamble, ...composites]\n}\n\n/** Index range `[from, to)` of the heading at `index` in `parent` plus its content: up to the next sibling heading of the same or a higher level. */\nexport function headingGroupRange(parent: PMNode, index: number): { from: number, to: number } {\n const level = levelOf(parent.child(index))\n for (let i = index + 1; i < parent.childCount; i++) {\n const child = parent.child(i)\n if (isHeading(child) && levelOf(child) <= level) return { from: index, to: i }\n }\n return { from: index, to: parent.childCount }\n}\n\n/**\n * Description, tags and meta of `composite` as plain paragraphs, in this order, each only when non-empty: the\n * description italic, the tags as tag chips (`#name` text without a `tag` node), the meta as one `Label: Wert · …` line\n * (labels and option labels from the composite's kind in `kinds`; raw keys and values for an unknown kind).\n */\nexport function compositeChromeBlocks(schema: Schema, composite: PMNode, kinds: readonly CompositeKind[]): PMNode[] {\n const n = schema.nodes\n const paragraph = n[PARAGRAPH]!\n const description = composite.child(1)\n const tags: unknown = composite.child(2).attrs.tags\n const blocks: PMNode[] = []\n if (description.content.size) {\n const italic = schema.marks.italic\n const content: PMNode[] = []\n description.forEach(child => content.push(italic && child.isText ? child.mark(italic.create().addToSet(child.marks)) : child))\n blocks.push(paragraph.create(null, content))\n }\n const names = Array.isArray(tags) ? tags.filter((tag): tag is string => typeof tag === 'string' && tag !== '') : []\n if (names.length) {\n const chips = names.flatMap((name, index) => [\n ...(index ? [schema.text(' ')] : []),\n n.tag ? n.tag.create({ name }) : schema.text(`#${name}`),\n ])\n blocks.push(paragraph.create(null, chips))\n }\n const kind = composite.attrs.kind as string\n const fields = kinds.some(known => known.id === kind) ? compositeKind(kinds, kind).fields : []\n const meta = (composite.attrs.meta ?? {}) as Record<string, unknown>\n const entries = Object.entries(meta)\n .filter(([, value]) => value !== '' && value !== null && value !== undefined)\n .map(([key, value]) => {\n const field = fields.find(candidate => candidate.key === key)\n const display = field?.options?.find(option => option.value === value)?.label ?? String(value)\n return `${field?.label ?? key}: ${display}`\n })\n if (entries.length) blocks.push(paragraph.create(null, schema.text(entries.join(' · '))))\n return blocks\n}\n\n/**\n * Inverse of `groupHeadingsIntoComposites`: every composite in `blocks` (siblings) becomes a heading of `level` (max 6)\n * with its title, then its chrome (`compositeChromeBlocks`), then its body (dropped when it is one empty paragraph).\n * Recursive: nested composites in bodies become headings of `level + 1` and so on; flat: they stay. `null` when\n * `blocks` holds no composite. Created blocks carry no id; carried-over body blocks keep theirs.\n */\nexport function flattenCompositesToHeadings(schema: Schema, blocks: readonly PMNode[], recursive: boolean, level: number, kinds: readonly CompositeKind[]): PMNode[] | null {\n if (!blocks.some(block => block.type.name === COMPOSITE)) return null\n const heading = schema.nodes[HEADING]!\n return blocks.flatMap((block) => {\n if (block.type.name !== COMPOSITE) return [block]\n let body: PMNode[] = []\n block.forEach((child, _offset, index) => {\n if (index >= CHROME_COUNT) body.push(child)\n })\n if (body.length === 1 && body[0]!.type.name === PARAGRAPH && !body[0]!.content.size) body = []\n if (recursive) body = flattenCompositesToHeadings(schema, body, true, level + 1, kinds) ?? body\n return [heading.create({ level: Math.min(level, 6) }, block.child(0).content), ...compositeChromeBlocks(schema, block, kinds), ...body]\n })\n}\n\n/**\n * `blocks` (siblings) in the preferred `structure`: `'composite'` groups headings into `section` composites at every\n * level, `'flat'` turns composites into headings starting at `level`. Unchanged blocks come back as a copy of the array.\n */\nexport function structureBlocks(schema: Schema, blocks: readonly PMNode[], structure: StructureMode, level: number, kinds: readonly CompositeKind[]): PMNode[] {\n if (structure === 'composite') return groupHeadingsIntoComposites(schema, blocks, true, 'section') ?? [...blocks]\n return flattenCompositesToHeadings(schema, blocks, true, level, kinds) ?? [...blocks]\n}\n"],"mappings":";;;AAKA,MAAM,UAAU;AAChB,MAAM,YAAY;AAClB,MAAM,QAAQ;AACd,MAAM,cAAc;AACpB,MAAM,OAAO;AACb,MAAM,YAAY;;AAElB,MAAM,eAAe;AAGrB,MAAM,aAAa,SAAiB,KAAK,KAAK,SAAS;AACvD,MAAM,WAAW,SAAiB,KAAK,MAAM;;;;;;AAO7C,SAAgB,4BAA4B,QAAgB,QAA2B,WAAoB,MAA+B;CACxI,IAAI,UAAU;CACd,IAAI,QAAkB,CAAC,GAAG,MAAM;CAChC,IAAI,WACF,QAAQ,MAAM,KAAK,UAAU;EAC3B,IAAI,MAAM,KAAK,SAAS,WAAW,OAAO;EAC1C,MAAM,WAAqB,CAAC;EAC5B,MAAM,SAAQ,UAAS,SAAS,KAAK,KAAK,CAAC;EAC3C,MAAM,OAAO,4BAA4B,QAAQ,SAAS,MAAM,YAAY,GAAG,MAAM,IAAI;EACzF,IAAI,CAAC,MAAM,OAAO;EAClB,UAAU;EACV,OAAO,MAAM,KAAK,SAAS,KAAK,CAAC,GAAG,SAAS,MAAM,GAAG,YAAY,GAAG,GAAG,IAAI,CAAC,CAAC;CAChF,CAAC;CAGH,IAAI,WAAW;CACf,KAAK,MAAM,SAAS,OAAO,IAAI,UAAU,KAAK,GAAG,WAAW,KAAK,IAAI,UAAU,QAAQ,KAAK,CAAC;CAC7F,IAAI,aAAa,UAAU,OAAO,UAAU,QAAQ;CAEpD,MAAM,EAAE,UAAU;CAClB,IAAI,WAAqB,CAAC;CAC1B,MAAM,SAAgD,CAAC;CACvD,KAAK,MAAM,SAAS,OAClB,IAAI,UAAU,KAAK,KAAK,QAAQ,KAAK,KAAK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AO,KAAK,UAAU,OAAO,MAAM,OAAO,KAAK,QAAQ,KAAK,KAAK,CAAC,CAAC,CAAC;CACxF,OAAO;AACT;;;;;;;AAQA,SAAgB,4BAA4B,QAAgB,QAA2B,WAAoB,OAAe,OAAkD;CAC1K,IAAI,CAAC,OAAO,MAAK,UAAS,MAAM,KAAK,SAAS,SAAS,GAAG,OAAO;CACjE,MAAM,UAAU,OAAO,MAAM;CAC7B,OAAO,OAAO,SAAS,UAAU;EAC/B,IAAI,MAAM,KAAK,SAAS,WAAW,OAAO,CAAC,KAAK;EAChD,IAAI,OAAiB,CAAC;EACtB,MAAM,SAAS,OAAO,SAAS,UAAU;GACvC,IAAI,SAAS,cAAc,KAAK,KAAK,KAAK;EAC5C,CAAC;EACD,IAAI,KAAK,WAAW,KAAK,KAAK,EAAE,CAAE,KAAK,SAAS,aAAa,CAAC,KAAK,EAAE,CAAE,QAAQ,MAAM,OAAO,CAAC;EAC7F,IAAI,WAAW,OAAO,4BAA4B,QAAQ,MAAM,MAAM,QAAQ,GAAG,KAAK,KAAK;EAC3F,OAAO;GAAC,QAAQ,OAAO,EAAE,OAAO,KAAK,IAAI,OAAO,CAAC,EAAE,GAAG,MAAM,MAAM,CAAC,CAAC,CAAC,OAAO;GAAG,GAAG,sBAAsB,QAAQ,OAAO,KAAK;GAAG,GAAG;EAAI;CACxI,CAAC;AACH;;;;;AAMA,SAAgB,gBAAgB,QAAgB,QAA2B,WAA0B,OAAe,OAA2C;CAC7J,IAAI,cAAc,aAAa,OAAO,4BAA4B,QAAQ,QAAQ,MAAM,SAAS,KAAK,CAAC,GAAG,MAAM;CAChH,OAAO,4BAA4B,QAAQ,QAAQ,MAAM,OAAO,KAAK,KAAK,CAAC,GAAG,MAAM;AACtF"}
|
|
1
|
+
{"version":3,"file":"heading-composites.js","names":[],"sources":["../../../src/features/composites/heading-composites.ts"],"sourcesContent":["import { Fragment, type Node as PMNode, type Schema } from '@tiptap/pm/model'\nimport { type BlockType, blockTypeOf, propertiesOf } from './block-types'\nimport { TYPED_BLOCK, TYPED_BLOCK_DESCRIPTION, TYPED_BLOCK_TAGS, TYPED_BLOCK_TITLE } from '../../core/schema/persisted-names'\nimport type { StructureMode } from '../../settings'\n\nconst HEADING = 'heading'\nconst PARAGRAPH = 'paragraph'\n/** Title, description and tags: the fixed children in front of a composite's body. */\nconst CHROME_COUNT = 3\n\nconst isHeading = (node: PMNode) => node.type.name === HEADING\nconst levelOf = (node: PMNode) => node.attrs.level as number\n\n/**\n * `blocks` (siblings) with headings grouped into composites of `kind`. Flat: only headings of the lowest level present\n * become composites; everything before the first such heading is kept. Recursive: bodies, the part before the first\n * heading and the bodies of existing composites are grouped the same way. `null` when nothing changed.\n */\nexport function groupHeadingsIntoComposites(schema: Schema, blocks: readonly PMNode[], recursive: boolean, kind: string): PMNode[] | null {\n let changed = false\n let input: PMNode[] = [...blocks]\n if (recursive) {\n input = input.map((block) => {\n if (block.type.name !== TYPED_BLOCK) return block\n const children: PMNode[] = []\n block.forEach(child => children.push(child))\n const body = groupHeadingsIntoComposites(schema, children.slice(CHROME_COUNT), true, kind)\n if (!body) return block\n changed = true\n return block.copy(Fragment.from([...children.slice(0, CHROME_COUNT), ...body]))\n })\n }\n\n let minLevel = Infinity\n for (const block of input) if (isHeading(block)) minLevel = Math.min(minLevel, levelOf(block))\n if (minLevel === Infinity) return changed ? input : null\n\n const { nodes } = schema\n let preamble: PMNode[] = []\n const groups: { heading: PMNode, body: PMNode[] }[] = []\n for (const block of input) {\n if (isHeading(block) && levelOf(block) <= minLevel) groups.push({ heading: block, body: [] })\n else if (groups.length) groups[groups.length - 1]!.body.push(block)\n else preamble.push(block)\n }\n if (recursive) preamble = groupHeadingsIntoComposites(schema, preamble, true, kind) ?? preamble\n\n const composites = groups.map(({ heading, body }) => {\n let content = body\n if (recursive) content = groupHeadingsIntoComposites(schema, content, true, kind) ?? content\n if (!content.length) content = [nodes[PARAGRAPH]!.create()]\n return nodes[TYPED_BLOCK]!.create({ blockType: kind }, [\n nodes[TYPED_BLOCK_TITLE]!.create(null, heading.content), nodes[TYPED_BLOCK_DESCRIPTION]!.create(), nodes[TYPED_BLOCK_TAGS]!.create(), ...content,\n ])\n })\n return [...preamble, ...composites]\n}\n\n/** Index range `[from, to)` of the heading at `index` in `parent` plus its content: up to the next sibling heading of the same or a higher level. */\nexport function headingGroupRange(parent: PMNode, index: number): { from: number, to: number } {\n const level = levelOf(parent.child(index))\n for (let i = index + 1; i < parent.childCount; i++) {\n const child = parent.child(i)\n if (isHeading(child) && levelOf(child) <= level) return { from: index, to: i }\n }\n return { from: index, to: parent.childCount }\n}\n\n/**\n * Description, tags and meta of `composite` as plain paragraphs, in this order, each only when non-empty: the\n * description italic, the tags as tag chips (`#name` text without a `tag` node), the meta as one `Label: Wert · …` line\n * (labels and option labels from the composite's kind in `kinds`; raw keys and values for an unknown kind).\n */\nexport function compositeChromeBlocks(schema: Schema, composite: PMNode, kinds: readonly BlockType[]): PMNode[] {\n const n = schema.nodes\n const paragraph = n[PARAGRAPH]!\n const description = composite.child(1)\n const tags: unknown = composite.child(2).attrs.tags\n const blocks: PMNode[] = []\n if (description.content.size) {\n const italic = schema.marks.italic\n const content: PMNode[] = []\n description.forEach(child => content.push(italic && child.isText ? child.mark(italic.create().addToSet(child.marks)) : child))\n blocks.push(paragraph.create(null, content))\n }\n const names = Array.isArray(tags) ? tags.filter((tag): tag is string => typeof tag === 'string' && tag !== '') : []\n if (names.length) {\n const chips = names.flatMap((name, index) => [\n ...(index ? [schema.text(' ')] : []),\n n.tag ? n.tag.create({ name }) : schema.text(`#${name}`),\n ])\n blocks.push(paragraph.create(null, chips))\n }\n const kind = composite.attrs.blockType as string\n const fields = kinds.some(known => known.id === kind) ? propertiesOf(blockTypeOf(kinds, kind)) : []\n const meta = (composite.attrs.meta ?? {}) as Record<string, unknown>\n const entries = Object.entries(meta)\n .filter(([, value]) => value !== '' && value !== null && value !== undefined)\n .map(([key, value]) => {\n const field = fields.find(candidate => candidate.key === key)\n const display = field?.options?.find(option => option.value === value)?.label ?? String(value)\n return `${field?.label ?? key}: ${display}`\n })\n if (entries.length) blocks.push(paragraph.create(null, schema.text(entries.join(' · '))))\n return blocks\n}\n\n/**\n * Inverse of `groupHeadingsIntoComposites`: every composite in `blocks` (siblings) becomes a heading of `level` (max 6)\n * with its title, then its chrome (`compositeChromeBlocks`), then its body (dropped when it is one empty paragraph).\n * Recursive: nested composites in bodies become headings of `level + 1` and so on; flat: they stay. `null` when\n * `blocks` holds no composite. Created blocks carry no id; carried-over body blocks keep theirs.\n */\nexport function flattenCompositesToHeadings(schema: Schema, blocks: readonly PMNode[], recursive: boolean, level: number, kinds: readonly BlockType[]): PMNode[] | null {\n if (!blocks.some(block => block.type.name === TYPED_BLOCK)) return null\n const heading = schema.nodes[HEADING]!\n return blocks.flatMap((block) => {\n if (block.type.name !== TYPED_BLOCK) return [block]\n let body: PMNode[] = []\n block.forEach((child, _offset, index) => {\n if (index >= CHROME_COUNT) body.push(child)\n })\n if (body.length === 1 && body[0]!.type.name === PARAGRAPH && !body[0]!.content.size) body = []\n if (recursive) body = flattenCompositesToHeadings(schema, body, true, level + 1, kinds) ?? body\n return [heading.create({ level: Math.min(level, 6) }, block.child(0).content), ...compositeChromeBlocks(schema, block, kinds), ...body]\n })\n}\n\n/**\n * `blocks` (siblings) in the preferred `structure`: `'structured'` groups headings into `section` composites at every\n * level, `'flat'` turns composites into headings starting at `level`. Unchanged blocks come back as a copy of the array.\n */\nexport function structureBlocks(schema: Schema, blocks: readonly PMNode[], structure: StructureMode, level: number, kinds: readonly BlockType[]): PMNode[] {\n if (structure === 'structured') return groupHeadingsIntoComposites(schema, blocks, true, 'section') ?? [...blocks]\n return flattenCompositesToHeadings(schema, blocks, true, level, kinds) ?? [...blocks]\n}\n"],"mappings":";;;;AAKA,MAAM,UAAU;AAChB,MAAM,YAAY;;AAElB,MAAM,eAAe;AAErB,MAAM,aAAa,SAAiB,KAAK,KAAK,SAAS;AACvD,MAAM,WAAW,SA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,OAAO,SAAS,UAAU;GACvC,IAAI,SAAS,cAAc,KAAK,KAAK,KAAK;EAC5C,CAAC;EACD,IAAI,KAAK,WAAW,KAAK,KAAK,EAAE,CAAE,KAAK,SAAS,aAAa,CAAC,KAAK,EAAE,CAAE,QAAQ,MAAM,OAAO,CAAC;EAC7F,IAAI,WAAW,OAAO,4BAA4B,QAAQ,MAAM,MAAM,QAAQ,GAAG,KAAK,KAAK;EAC3F,OAAO;GAAC,QAAQ,OAAO,EAAE,OAAO,KAAK,IAAI,OAAO,CAAC,EAAE,GAAG,MAAM,MAAM,CAAC,CAAC,CAAC,OAAO;GAAG,GAAG,sBAAsB,QAAQ,OAAO,KAAK;GAAG,GAAG;EAAI;CACxI,CAAC;AACH;;;;;AAMA,SAAgB,gBAAgB,QAAgB,QAA2B,WAA0B,OAAe,OAAuC;CACzJ,IAAI,cAAc,cAAc,OAAO,4BAA4B,QAAQ,QAAQ,MAAM,SAAS,KAAK,CAAC,GAAG,MAAM;CACjH,OAAO,4BAA4B,QAAQ,QAAQ,MAAM,OAAO,KAAK,KAAK,CAAC,GAAG,MAAM;AACtF"}
|
|
@@ -1,11 +1,23 @@
|
|
|
1
1
|
import { CSL_TYPES, CslDate, CslItem, CslName, CslType } from "../../core/backend-types.js";
|
|
2
|
-
import { CompositeAiBrief, compositeAiBrief } from "./ai-brief.js";
|
|
3
|
-
import { CompositeKind, CompositeKindAi, CompositeMetaField, SOURCE_MEDIA_TYPES, compositeKind, defaultCompositeKinds, kindAccepts } from "./kinds.js";
|
|
4
|
-
import { CompositeBacklink, CompositeMention, CompositeReference, CompositeRow, compositeBacklinks, compositeDescriptionText, compositeMetaWith, compositeOfRow, compositeRowAt, compositeRows, setCompositeDescription, setCompositeMetaField, setCompositeTags } from "./rows.js";
|
|
5
|
-
import { CompositeAnchor, CompositeAnchorsHandle, CompositeFrame, compositeSectionOf, observeCompositeAnchors } from "./anchors.js";
|
|
6
2
|
import { BASKET_IDS, Basket, basketById, basketOf, defaultBaskets, titleHiddenOf } from "./baskets.js";
|
|
7
|
-
import {
|
|
3
|
+
import { BlockType, BlockTypeAi, SOURCE_MEDIA_TYPES, acceptsChild, acceptsImport, aiBlockTypesOf, blockTypeOf, defaultBlockTypes, isRootBlockType } from "./block-types.js";
|
|
4
|
+
import { CompositeAiBrief, compositeAiBrief } from "./ai-brief.js";
|
|
5
|
+
import { compositeConversions, convertCompositeBlocks } from "./convert.js";
|
|
6
|
+
import { CompositeFence, FenceSegment, splitCompositeFences } from "../../core/fences.js";
|
|
7
|
+
import { blocksFromMarkdown, compositeFence, compositeFromMarkdown } from "./fences.js";
|
|
8
|
+
import { compositeChromeBlocks, flattenCompositesToHeadings, groupHeadingsIntoComposites, headingGroupRange, structureBlocks } from "./heading-composites.js";
|
|
9
|
+
import { BASKET_KEY, BIB_KEY, TITLE_HIDDEN_KEY } from "./meta-keys.js";
|
|
10
|
+
import { bibOf, bibtexOf, citeFull, citeShort, cslOf, cslTypeOptions, yearOf } from "./bibliography.js";
|
|
11
|
+
import { bodyMarkdown, sourceOf } from "./source.js";
|
|
12
|
+
import { BlockTypeJsonError, BlockTypeJsonIssue, mergeBlockTypes, parseBlockTypes } from "./block-types-json.js";
|
|
13
|
+
import { migrateLegacyContent } from "./legacy.js";
|
|
8
14
|
import { REFERENCE_NODE, ReferenceAttrs, ReferenceNode, ReferenceOptions, ReferenceSuggestionPluginKey, referenceMarkdown } from "./reference.js";
|
|
15
|
+
import { normalizeReferences, referencesFromText } from "./reference-text.js";
|
|
16
|
+
import { COMPOSITE_CHROME_COUNT, CompositeDescriptionNode, CompositeNode, CompositeOptions, CompositeStorage, CompositeTagsNode, CompositeTitleNode, blockTypesOf, compositeBasketsOf, compositeJSON } from "./nodes.js";
|
|
17
|
+
import { compositeSchemaExtensions } from "./schema.js";
|
|
18
|
+
import { BlockProperties, blockPropertiesAt, blockPropertiesOf, carriesProperties, metaWithProperty, propertyHostOf, setBlockProperty } from "./properties.js";
|
|
19
|
+
import { CompositeBacklink, CompositeMention, CompositeReference, CompositeRow, compositeBacklinks, compositeDescriptionText, compositeOfRow, compositeRowAt, compositeRows, setCompositeDescription, setCompositeTags } from "./rows.js";
|
|
20
|
+
import { CompositeAnchor, CompositeAnchorsHandle, CompositeFrame, compositeSectionOf, observeCompositeAnchors } from "./anchors.js";
|
|
9
21
|
import { CompositeNodeViews, compositeNodes } from "./node-views.js";
|
|
10
22
|
import { CompositeFeatureOptions, CompositesUi, compositeFeatureCore } from "./feature.js";
|
|
11
23
|
import { CompositeFocus, CompositeFocusState, compositeFocusKey, compositeFocusOf, focusDecorations } from "./focus.js";
|
|
@@ -13,8 +25,8 @@ import { documentCompositeMarkdown, headingsMarkdown, markdownFileName } from ".
|
|
|
13
25
|
import { MoveVerdict, OutlineNode, canMoveBlockInto, compositeOutline, moveBlockInto, moveIntoVerdict } from "./outline.js";
|
|
14
26
|
import { SourceLocator, SourceReveal, parseLocator, revealSource, seekSource } from "./reveal-source.js";
|
|
15
27
|
import { AcceptedChildren, AcceptedChildrenOptions } from "./accepted-children.js";
|
|
16
|
-
import {
|
|
17
|
-
import { CompositeInspector, CompositeInspectorSection, CompositeInspectorState,
|
|
28
|
+
import { BlockTypeCount, CompositeRowsHandle, CompositeRowsState, createCompositeRows } from "./rows-model.js";
|
|
29
|
+
import { BlockTypeOption, CompositeInspector, CompositeInspectorSection, CompositeInspectorState, InspectorDerivation, compositeFieldText, createCompositeInspector } from "./inspector-model.js";
|
|
18
30
|
import { ReferenceTarget, referenceLabel, referenceTarget, referenceTitle } from "./reference-label.js";
|
|
19
31
|
import { referenceSuggestion } from "./reference-suggestion.js";
|
|
20
32
|
import { CompositeMerge, mergeBody } from "./merge.js";
|
|
@@ -22,14 +34,4 @@ import { CompositeSplit, CompositeSplitOptions, SplitMode, childKindFor, generat
|
|
|
22
34
|
import { Structure, StructureStorage, structureOf } from "./structure.js";
|
|
23
35
|
import { STRUCTURE_MODE_KEYS } from "./structure-mode.js";
|
|
24
36
|
import { TREE_ROOT_KEYS } from "./tree-root.js";
|
|
25
|
-
|
|
26
|
-
import { CompositeFence, FenceSegment, splitCompositeFences } from "../../core/fences.js";
|
|
27
|
-
import { blocksFromMarkdown, compositeFence, compositeFromMarkdown } from "./fences.js";
|
|
28
|
-
import { compositeChromeBlocks, flattenCompositesToHeadings, groupHeadingsIntoComposites, headingGroupRange, structureBlocks } from "./heading-composites.js";
|
|
29
|
-
import { BASKET_KEY, BIB_KEY, DERIVATION_KEY, TITLE_HIDDEN_KEY } from "./meta-keys.js";
|
|
30
|
-
import { bibOf, bibtexOf, citeFull, citeShort, cslOf, cslTypeOptions, yearOf } from "./bibliography.js";
|
|
31
|
-
import { Derivation, DerivationMethod, DerivationSource, bodyMarkdown, derivationOf, derivationState, renditionsOf, sourceOf } from "./derivation.js";
|
|
32
|
-
import { LEGACY_COMPOSITE_NODE, migrateLegacyContent } from "./legacy.js";
|
|
33
|
-
import { normalizeReferences, referencesFromText } from "./reference-text.js";
|
|
34
|
-
import { compositeSchemaExtensions } from "./schema.js";
|
|
35
|
-
export { AcceptedChildren, type AcceptedChildrenOptions, BASKET_IDS, BASKET_KEY, BIB_KEY, type Basket, COMPOSITE_CHROME_COUNT, CSL_TYPES, type CompositeAiBrief, type CompositeAnchor, type CompositeAnchorsHandle, type CompositeBacklink, CompositeDescriptionNode, type CompositeFeatureOptions, type CompositeFence, CompositeFocus, type CompositeFocusState, type CompositeFrame, type CompositeInspector, type CompositeInspectorSection, type CompositeInspectorState, type CompositeKind, type CompositeKindAi, type CompositeKindCount, type CompositeKindOption, type CompositeMention, CompositeMerge, type CompositeMetaField, CompositeNode, type CompositeNodeViews, type CompositeOptions, type CompositeReference, type CompositeRow, type CompositeRowsHandle, type CompositeRowsState, CompositeSplit, type CompositeSplitOptions, type CompositeStorage, CompositeTagsNode, CompositeTitleNode, type CompositesUi, type CslDate, type CslItem, type CslName, type CslType, DERIVATION_KEY, type Derivation, type DerivationMethod, type DerivationSource, type FenceSegment, LEGACY_COMPOSITE_NODE, type MoveVerdict, type OutlineNode, REFERENCE_NODE, type ReferenceAttrs, ReferenceNode, type ReferenceOptions, ReferenceSuggestionPluginKey, type ReferenceTarget, SOURCE_MEDIA_TYPES, STRUCTURE_MODE_KEYS, type SourceLocator, SourceReveal, type SplitMode, Structure, type StructureStorage, TITLE_HIDDEN_KEY, TREE_ROOT_KEYS, basketById, basketOf, bibOf, bibtexOf, blocksFromMarkdown, bodyMarkdown, canMoveBlockInto, childKindFor, citeFull, citeShort, compositeAiBrief, compositeBacklinks, compositeBasketsOf, compositeChromeBlocks, compositeConversions, compositeDescriptionText, compositeFeatureCore, compositeFence, compositeFieldText, compositeFocusKey, compositeFocusOf, compositeFromMarkdown, compositeJSON, compositeKind, compositeKindsOf, compositeMetaWith, compositeNodes, compositeOfRow, compositeOutline, compositeRowAt, compositeRows, compositeSchemaExtensions, compositeSectionOf, convertCompositeBlocks, createCompositeInspector, createCompositeRows, cslOf, cslTypeOptions, defaultBaskets, defaultCompositeKinds, derivationOf, derivationState, documentCompositeMarkdown, flattenCompositesToHeadings, focusDecorations, generatedTitle, groupHeadingsIntoComposites, headingGroupRange, headingsMarkdown, kindAccepts, markdownFileName, mergeBody, migrateLegacyContent, moveBlockInto, moveIntoVerdict, normalizeReferences, observeCompositeAnchors, parseLocator, referenceLabel, referenceMarkdown, referenceSuggestion, referenceTarget, referenceTitle, referencesFromText, renditionsOf, revealSource, seekSource, setCompositeDescription, setCompositeMetaField, setCompositeTags, sourceOf, splitBodyByLength, splitComposite, splitCompositeFences, structureBlocks as structureCompositeBlocks, structureOf, titleHiddenOf, yearOf };
|
|
37
|
+
export { AcceptedChildren, type AcceptedChildrenOptions, BASKET_IDS, BASKET_KEY, BIB_KEY, type Basket, type BlockProperties, type BlockType, type BlockTypeAi, type BlockTypeCount, BlockTypeJsonError, type BlockTypeJsonIssue, type BlockTypeOption, COMPOSITE_CHROME_COUNT, CSL_TYPES, type CompositeAiBrief, type CompositeAnchor, type CompositeAnchorsHandle, type CompositeBacklink, CompositeDescriptionNode, type CompositeFeatureOptions, type CompositeFence, CompositeFocus, type CompositeFocusState, type CompositeFrame, type CompositeInspector, type CompositeInspectorSection, type CompositeInspectorState, type CompositeMention, CompositeMerge, CompositeNode, type CompositeNodeViews, type CompositeOptions, type CompositeReference, type CompositeRow, type CompositeRowsHandle, type CompositeRowsState, CompositeSplit, type CompositeSplitOptions, type CompositeStorage, CompositeTagsNode, CompositeTitleNode, type CompositesUi, type CslDate, type CslItem, type CslName, type CslType, type FenceSegment, type InspectorDerivation, type MoveVerdict, type OutlineNode, REFERENCE_NODE, type ReferenceAttrs, ReferenceNode, type ReferenceOptions, ReferenceSuggestionPluginKey, type ReferenceTarget, SOURCE_MEDIA_TYPES, STRUCTURE_MODE_KEYS, type SourceLocator, SourceReveal, type SplitMode, Structure, type StructureStorage, TITLE_HIDDEN_KEY, TREE_ROOT_KEYS, acceptsChild, acceptsImport, aiBlockTypesOf, basketById, basketOf, bibOf, bibtexOf, blockPropertiesAt, blockPropertiesOf, blockTypeOf, blockTypesOf, blocksFromMarkdown, bodyMarkdown, canMoveBlockInto, carriesProperties, childKindFor, citeFull, citeShort, compositeAiBrief, compositeBacklinks, compositeBasketsOf, compositeChromeBlocks, compositeConversions, compositeDescriptionText, compositeFeatureCore, compositeFence, compositeFieldText, compositeFocusKey, compositeFocusOf, compositeFromMarkdown, compositeJSON, compositeNodes, compositeOfRow, compositeOutline, compositeRowAt, compositeRows, compositeSchemaExtensions, compositeSectionOf, convertCompositeBlocks, createCompositeInspector, createCompositeRows, cslOf, cslTypeOptions, defaultBaskets, defaultBlockTypes, documentCompositeMarkdown, flattenCompositesToHeadings, focusDecorations, generatedTitle, groupHeadingsIntoComposites, headingGroupRange, headingsMarkdown, isRootBlockType, markdownFileName, mergeBlockTypes, mergeBody, metaWithProperty, migrateLegacyContent, moveBlockInto, moveIntoVerdict, normalizeReferences, observeCompositeAnchors, parseBlockTypes, parseLocator, propertyHostOf, referenceLabel, referenceMarkdown, referenceSuggestion, referenceTarget, referenceTitle, referencesFromText, revealSource, seekSource, setBlockProperty, setCompositeDescription, setCompositeTags, sourceOf, splitBodyByLength, splitComposite, splitCompositeFences, structureBlocks as structureCompositeBlocks, structureOf, titleHiddenOf, yearOf };
|
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
import { splitCompositeFences } from "../../core/fences.js";
|
|
2
|
-
import { SOURCE_MEDIA_TYPES,
|
|
3
|
-
import { BASKET_KEY, BIB_KEY,
|
|
2
|
+
import { SOURCE_MEDIA_TYPES, acceptsChild, acceptsImport, aiBlockTypesOf, blockTypeOf, defaultBlockTypes, isRootBlockType } from "./block-types.js";
|
|
3
|
+
import { BASKET_KEY, BIB_KEY, TITLE_HIDDEN_KEY } from "./meta-keys.js";
|
|
4
4
|
import { blocksFromMarkdown, compositeFence, compositeFromMarkdown } from "./fences.js";
|
|
5
5
|
import { BASKET_IDS, basketById, basketOf, defaultBaskets, titleHiddenOf } from "./baskets.js";
|
|
6
|
-
import { bodyMarkdown, derivationOf, derivationState, renditionsOf, sourceOf } from "./derivation.js";
|
|
7
6
|
import { compositeChromeBlocks, flattenCompositesToHeadings, groupHeadingsIntoComposites, headingGroupRange, structureBlocks } from "./heading-composites.js";
|
|
8
|
-
import { COMPOSITE_CHROME_COUNT, CompositeDescriptionNode, CompositeNode, CompositeTagsNode, CompositeTitleNode, compositeBasketsOf, compositeJSON
|
|
7
|
+
import { COMPOSITE_CHROME_COUNT, CompositeDescriptionNode, CompositeNode, CompositeTagsNode, CompositeTitleNode, blockTypesOf, compositeBasketsOf, compositeJSON } from "./nodes.js";
|
|
9
8
|
import { REFERENCE_NODE, ReferenceNode, ReferenceSuggestionPluginKey, referenceMarkdown } from "./reference.js";
|
|
10
9
|
import { CSL_TYPES } from "../../core/backend-types.js";
|
|
11
10
|
import { bibOf, bibtexOf, citeFull, citeShort, cslOf, cslTypeOptions, yearOf } from "./bibliography.js";
|
|
12
11
|
import { compositeAiBrief } from "./ai-brief.js";
|
|
13
12
|
import { compositeConversions, convertCompositeBlocks } from "./convert.js";
|
|
14
|
-
import {
|
|
13
|
+
import { bodyMarkdown, sourceOf } from "./source.js";
|
|
14
|
+
import { blockPropertiesAt, blockPropertiesOf, carriesProperties, metaWithProperty, propertyHostOf, setBlockProperty } from "./properties.js";
|
|
15
|
+
import { BlockTypeJsonError, mergeBlockTypes, parseBlockTypes } from "./block-types-json.js";
|
|
16
|
+
import { migrateLegacyContent } from "./legacy.js";
|
|
15
17
|
import { normalizeReferences, referencesFromText } from "./reference-text.js";
|
|
16
18
|
import { compositeSchemaExtensions } from "./schema.js";
|
|
17
19
|
import { AcceptedChildren } from "./accepted-children.js";
|
|
@@ -20,7 +22,7 @@ import { compositeNodes } from "./node-views.js";
|
|
|
20
22
|
import { CompositeFocus, compositeFocusKey, compositeFocusOf, focusDecorations } from "./focus.js";
|
|
21
23
|
import { CompositeMerge, mergeBody } from "./merge.js";
|
|
22
24
|
import { referenceLabel, referenceTarget, referenceTitle } from "./reference-label.js";
|
|
23
|
-
import { compositeBacklinks, compositeDescriptionText,
|
|
25
|
+
import { compositeBacklinks, compositeDescriptionText, compositeOfRow, compositeRowAt, compositeRows, setCompositeDescription, setCompositeTags } from "./rows.js";
|
|
24
26
|
import { referenceSuggestion } from "./reference-suggestion.js";
|
|
25
27
|
import { SourceReveal, parseLocator, revealSource, seekSource } from "./reveal-source.js";
|
|
26
28
|
import { CompositeSplit, childKindFor, generatedTitle, splitBodyByLength, splitComposite } from "./split.js";
|
|
@@ -32,4 +34,4 @@ import { createCompositeRows } from "./rows-model.js";
|
|
|
32
34
|
import { TREE_ROOT_KEYS } from "./tree-root.js";
|
|
33
35
|
import { compositeFieldText, createCompositeInspector } from "./inspector-model.js";
|
|
34
36
|
import { canMoveBlockInto, compositeOutline, moveBlockInto, moveIntoVerdict } from "./outline.js";
|
|
35
|
-
export { AcceptedChildren, BASKET_IDS, BASKET_KEY, BIB_KEY, COMPOSITE_CHROME_COUNT, CSL_TYPES, CompositeDescriptionNode, CompositeFocus, CompositeMerge, CompositeNode, CompositeSplit, CompositeTagsNode, CompositeTitleNode,
|
|
37
|
+
export { AcceptedChildren, BASKET_IDS, BASKET_KEY, BIB_KEY, BlockTypeJsonError, COMPOSITE_CHROME_COUNT, CSL_TYPES, CompositeDescriptionNode, CompositeFocus, CompositeMerge, CompositeNode, CompositeSplit, CompositeTagsNode, CompositeTitleNode, REFERENCE_NODE, ReferenceNode, ReferenceSuggestionPluginKey, SOURCE_MEDIA_TYPES, STRUCTURE_MODE_KEYS, SourceReveal, Structure, TITLE_HIDDEN_KEY, TREE_ROOT_KEYS, acceptsChild, acceptsImport, aiBlockTypesOf, basketById, basketOf, bibOf, bibtexOf, blockPropertiesAt, blockPropertiesOf, blockTypeOf, blockTypesOf, blocksFromMarkdown, bodyMarkdown, canMoveBlockInto, carriesProperties, childKindFor, citeFull, citeShort, compositeAiBrief, compositeBacklinks, compositeBasketsOf, compositeChromeBlocks, compositeConversions, compositeDescriptionText, compositeFeatureCore, compositeFence, compositeFieldText, compositeFocusKey, compositeFocusOf, compositeFromMarkdown, compositeJSON, compositeNodes, compositeOfRow, compositeOutline, compositeRowAt, compositeRows, compositeSchemaExtensions, compositeSectionOf, convertCompositeBlocks, createCompositeInspector, createCompositeRows, cslOf, cslTypeOptions, defaultBaskets, defaultBlockTypes, documentCompositeMarkdown, flattenCompositesToHeadings, focusDecorations, generatedTitle, groupHeadingsIntoComposites, headingGroupRange, headingsMarkdown, isRootBlockType, markdownFileName, mergeBlockTypes, mergeBody, metaWithProperty, migrateLegacyContent, moveBlockInto, moveIntoVerdict, normalizeReferences, observeCompositeAnchors, parseBlockTypes, parseLocator, propertyHostOf, referenceLabel, referenceMarkdown, referenceSuggestion, referenceTarget, referenceTitle, referencesFromText, revealSource, seekSource, setBlockProperty, setCompositeDescription, setCompositeTags, sourceOf, splitBodyByLength, splitComposite, splitCompositeFences, structureBlocks as structureCompositeBlocks, structureOf, titleHiddenOf, yearOf };
|
|
@@ -1,35 +1,58 @@
|
|
|
1
1
|
import { ReadonlyStore } from "../../core/store.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { PropertyDefinition } from "../../core/properties.js";
|
|
3
|
+
import { Derivation } from "../../core/derivation.js";
|
|
4
|
+
import { BlockProperties } from "./properties.js";
|
|
4
5
|
import { CompositeRowsState } from "./rows-model.js";
|
|
5
6
|
import { Editor } from "@tiptap/core";
|
|
7
|
+
import { Node as Node$1 } from "@tiptap/pm/model";
|
|
6
8
|
//#region src/features/composites/inspector-model.d.ts
|
|
7
|
-
/** Which section of the inspector shows: the document's facts, or the properties of the
|
|
8
|
-
export type CompositeInspectorSection = 'document' | '
|
|
9
|
-
/** A
|
|
10
|
-
export interface
|
|
9
|
+
/** Which section of the inspector shows: the document's facts, or the properties of the Typed block under the caret. */
|
|
10
|
+
export type CompositeInspectorSection = 'document' | 'typedBlock';
|
|
11
|
+
/** A Block type the Typed block can be switched to, as the Block type select lists it. */
|
|
12
|
+
export interface BlockTypeOption {
|
|
11
13
|
value: string;
|
|
12
14
|
label: string;
|
|
13
15
|
icon: string;
|
|
14
16
|
}
|
|
17
|
+
/**
|
|
18
|
+
* The Derivation of the block the Block properties section shows, for a block whose capabilities include `derived`. `node` is
|
|
19
|
+
* that block, for the origin display; `sourceMissing` is the source-missing state of its Derivation (the original was deleted).
|
|
20
|
+
*/
|
|
21
|
+
export interface InspectorDerivation {
|
|
22
|
+
node: Node$1;
|
|
23
|
+
derivation: Derivation;
|
|
24
|
+
sourceMissing: boolean;
|
|
25
|
+
}
|
|
15
26
|
/** Everything the inspector renders (see `createCompositeInspector`): the live rows plus the inspector's own state. */
|
|
16
27
|
export interface CompositeInspectorState extends CompositeRowsState {
|
|
17
|
-
/** `'
|
|
28
|
+
/** `'typedBlock'` only while the caret last was in the editor and a Typed block is focused, else `'document'`. */
|
|
18
29
|
section: CompositeInspectorSection;
|
|
19
30
|
/** Whether the editor accepts edits; follows `setEditable` (see `createCompositeInspector`). */
|
|
20
31
|
editable: boolean;
|
|
21
|
-
/** The description text as the user sees it in the focused
|
|
32
|
+
/** The description text as the user sees it in the focused Typed block's textarea; may be ahead of the document until it is committed. */
|
|
22
33
|
draft: string;
|
|
23
34
|
/** The text typed into the tag search. */
|
|
24
35
|
searchTerm: string;
|
|
25
36
|
/** Tag names the metadata source suggested for the latest search that was not superseded. */
|
|
26
37
|
tagItems: string[];
|
|
27
38
|
/** The kinds the editor was configured with, in configured order; empty without an editor. */
|
|
28
|
-
kindOptions:
|
|
29
|
-
/** How many
|
|
39
|
+
kindOptions: BlockTypeOption[];
|
|
40
|
+
/** How many Typed blocks have a description. */
|
|
30
41
|
summarized: number;
|
|
31
|
-
/** The focused
|
|
42
|
+
/** The focused Typed block has a description. */
|
|
32
43
|
hasSummary: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* The Block properties section: the properties of the innermost block around the caret that carries property values, with the
|
|
46
|
+
* Property definitions its Block type declares through the `properties` capability (`definitions`; empty when it has none). Null
|
|
47
|
+
* outside such a block. The section is shown for any block that has the capability, not for a particular node type.
|
|
48
|
+
*/
|
|
49
|
+
properties: BlockProperties | null;
|
|
50
|
+
/**
|
|
51
|
+
* The Derivation of the block in `properties` when it is a Derived block (its capabilities include `derived`), whatever its Block
|
|
52
|
+
* type, with the source-missing state. Null for a block that is not Derived, and for one whose Block type lists a `derivation`
|
|
53
|
+
* Property definition: that definition already shows it among `properties.definitions`, so it never shows twice.
|
|
54
|
+
*/
|
|
55
|
+
derivation: InspectorDerivation | null;
|
|
33
56
|
}
|
|
34
57
|
/** The inspector model of an editor: observable `state`, the actions of the panel, and `dispose()`. */
|
|
35
58
|
export interface CompositeInspector {
|
|
@@ -39,11 +62,11 @@ export interface CompositeInspector {
|
|
|
39
62
|
* the section to `'document'`; the section stays there after the input blurs, until the editor takes the focus.
|
|
40
63
|
*/
|
|
41
64
|
setDocumentFocused: (focused: boolean) => void;
|
|
42
|
-
/** Switches the focused
|
|
65
|
+
/** Switches the focused Typed block to `kind`; ignored when it already has it or no Typed block is focused. */
|
|
43
66
|
setKind: (kind: string) => void;
|
|
44
67
|
/**
|
|
45
68
|
* The user typed `text` into the description. The draft is written to the document 600 ms after the last call and
|
|
46
|
-
* on `blurDescription`; the
|
|
69
|
+
* on `blurDescription`; the Typed block focused at the first call of a pending draft is the one that is written.
|
|
47
70
|
*/
|
|
48
71
|
inputDescription: (text: string) => void;
|
|
49
72
|
/**
|
|
@@ -52,33 +75,33 @@ export interface CompositeInspector {
|
|
|
52
75
|
* started) it shows the peer's text.
|
|
53
76
|
*/
|
|
54
77
|
blurDescription: () => void;
|
|
55
|
-
/** Replaces the tags of the focused
|
|
78
|
+
/** Replaces the tags of the focused Typed block. */
|
|
56
79
|
setTags: (tags: readonly string[]) => void;
|
|
57
|
-
/** Creates the tag `raw` (normalized) on the focused
|
|
80
|
+
/** Creates the tag `raw` (normalized) on the focused Typed block and registers it with the metadata source; clears the search term. */
|
|
58
81
|
createTag: (raw: string) => void;
|
|
59
82
|
/** Sets the tag search term and schedules a search for it. */
|
|
60
83
|
setSearchTerm: (term: string) => void;
|
|
61
84
|
/** Schedules a tag search for the current term (the picker opened). */
|
|
62
85
|
searchTags: () => void;
|
|
63
86
|
/**
|
|
64
|
-
* Writes the text `value` to the
|
|
87
|
+
* Writes the text `value` to the property `field` of the block in `state.properties`; ignored while the editor is not editable and
|
|
65
88
|
* for structured fields (`isStructuredField`), whose values are not text and have their own editors.
|
|
66
89
|
*/
|
|
67
|
-
setField: (field:
|
|
90
|
+
setField: (field: PropertyDefinition, value: unknown) => void;
|
|
68
91
|
/** Commits a pending description draft and detaches from the editor. Idempotent; the model is inert afterwards. */
|
|
69
92
|
dispose: () => void;
|
|
70
93
|
}
|
|
71
94
|
/** The text of `field` in `row`'s meta as an input shows it: strings and numbers, otherwise empty. */
|
|
72
|
-
export declare function compositeFieldText(row: Pick<
|
|
95
|
+
export declare function compositeFieldText(row: Pick<BlockProperties, 'meta'> | null, field: Pick<PropertyDefinition, 'key'>): string;
|
|
73
96
|
/**
|
|
74
|
-
* The properties panel of `editor`: which section shows, the focused
|
|
97
|
+
* The properties panel of `editor`: which section shows, the focused Typed block's description draft, the tag search
|
|
75
98
|
* and the writes. Owns its own `createCompositeRows(editor)`, so a focus change and the rows it refers to arrive in
|
|
76
99
|
* one notification and the draft is committed before it is replaced. Create one model per editor (a framework hook
|
|
77
100
|
* follows an editor that changes); without an editor the state is empty and every action is ignored.
|
|
78
101
|
*
|
|
79
102
|
* Section: the caret is either in the host's input (`setDocumentFocused`) or in the editor. Only the editor's `focus`
|
|
80
103
|
* event moves it to the editor (not `selectionUpdate`: collaboration sync moves the selection while the host's input
|
|
81
|
-
* has the focus). A deleted
|
|
104
|
+
* has the focus). A deleted Typed block falls back to the document section.
|
|
82
105
|
*
|
|
83
106
|
* `isEditable` is not reactive: `editable` follows it on every editor `transaction`, so whoever calls `setEditable`
|
|
84
107
|
* must dispatch a transaction afterwards (`EditorSurface` does).
|
|
@@ -86,8 +109,8 @@ export declare function compositeFieldText(row: Pick<CompositeRow, 'meta'> | nul
|
|
|
86
109
|
* Description: edits go to a local `draft` so the asynchronous re-read of the document never overwrites the text
|
|
87
110
|
* (and moves the caret) while it is typed. `base` is the document text the draft started from; the write lands only
|
|
88
111
|
* while the description still holds it, so a peer's change made meanwhile is never replaced. The draft is committed
|
|
89
|
-
* 600 ms after typing pauses, on blur, when another
|
|
90
|
-
* the panel leaves the
|
|
112
|
+
* 600 ms after typing pauses, on blur, when another Typed block takes the focus (before the draft is replaced), when
|
|
113
|
+
* the panel leaves the Typed block section, and on `dispose()`. A commit is skipped when the editor is destroyed or not
|
|
91
114
|
* editable, and refused when a peer changed the description; the draft then reloads the live text. A draft that is
|
|
92
115
|
* not dirty follows every change of the focused description.
|
|
93
116
|
*
|