@ecsplico/editor 3.1.1 → 3.3.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 +42 -0
- package/dist/adapters/direct-ai.d.ts +36 -0
- package/dist/adapters/direct-ai.js +169 -0
- package/dist/adapters/direct-ai.js.map +1 -0
- package/dist/adapters/memory.js.map +1 -1
- package/dist/code/CodeSurface.vue.d.ts +1 -1
- package/dist/core/block-drag.js +3 -0
- package/dist/core/block-drag.js.map +1 -1
- package/dist/core/block-transfer.d.ts +44 -0
- package/dist/core/block-transfer.js +68 -0
- package/dist/core/block-transfer.js.map +1 -0
- package/dist/core/commands.js +5 -0
- package/dist/core/commands.js.map +1 -1
- package/dist/core/core-feature.d.ts +4 -1
- package/dist/core/core-feature.js +8 -3
- package/dist/core/core-feature.js.map +1 -1
- package/dist/core/editor-ui.d.ts +3 -1
- package/dist/core/editor-ui.js.map +1 -1
- package/dist/core/extension-points.d.ts +17 -1
- package/dist/core/feature.d.ts +6 -1
- package/dist/core/feature.js.map +1 -1
- package/dist/core/index.d.ts +4 -2
- package/dist/core/index.js +3 -2
- package/dist/core/schema/index.d.ts +24 -3
- package/dist/core/schema/index.js +21 -4
- package/dist/core/schema/index.js.map +1 -1
- package/dist/core/surface-session.js +3 -1
- package/dist/core/surface-session.js.map +1 -1
- package/dist/core/toolbar-items.js +1 -1
- package/dist/core/toolbar-items.js.map +1 -1
- package/dist/document/DocumentSurface.vue.d.ts +1 -1
- package/dist/features/ai/agent-op-review.js +1 -1
- package/dist/features/ai/agent-ops.js +2 -2
- package/dist/features/ai/ai-apply.js +1 -1
- package/dist/features/ai/assistant.js +1 -1
- package/dist/features/ai/components/AiSelectionMenu.js +2 -2
- package/dist/features/ai/components/AiSidebar.js +2 -2
- package/dist/features/ai/components/SettingsAiTab.js +1 -1
- package/dist/features/ai/components/SettingsModelProfiles.js +1 -1
- package/dist/features/ai/document-chat-model.js +1 -1
- package/dist/features/ai/document-chat.js +2 -2
- package/dist/features/ai/ghost-autocomplete.js +1 -1
- package/dist/features/ai/index.d.ts +4 -3
- package/dist/features/ai/index.js +6 -5
- package/dist/features/ai/protocol/complete.d.ts +19 -0
- package/dist/features/ai/protocol/complete.js +27 -1
- package/dist/features/ai/protocol/complete.js.map +1 -1
- package/dist/features/ai/protocol/generate.d.ts +95 -0
- package/dist/features/ai/protocol/generate.js +58 -0
- package/dist/features/ai/protocol/generate.js.map +1 -0
- package/dist/features/ai/protocol/index.d.ts +4 -3
- package/dist/features/ai/protocol/index.js +6 -5
- package/dist/features/ai/protocol/tasks.d.ts +3 -1
- package/dist/features/ai/protocol/tasks.js +74 -2
- package/dist/features/ai/protocol/tasks.js.map +1 -1
- package/dist/features/ai/react/AiSelectionMenu.js +2 -2
- package/dist/features/ai/react/AiSidebar.js +2 -2
- package/dist/features/ai/react/SettingsAiTab.js +1 -1
- package/dist/features/ai/react/SettingsModelProfiles.js +1 -1
- package/dist/features/ai/selection-flow.js +1 -1
- package/dist/features/ai/sidebar-flow.js +1 -1
- package/dist/features/block-ui/block-actions.d.ts +19 -3
- package/dist/features/block-ui/block-actions.js +49 -3
- package/dist/features/block-ui/block-actions.js.map +1 -1
- package/dist/features/block-ui/components/BlockActionsOverlay.js +24 -13
- package/dist/features/block-ui/components/BlockActionsOverlay.js.map +1 -1
- package/dist/features/block-ui/components/BlockActionsOverlay.vue.d.ts +12 -5
- package/dist/features/block-ui/components/BlockUi.js +52 -20
- package/dist/features/block-ui/components/BlockUi.js.map +1 -1
- package/dist/features/block-ui/components/BlockUi.vue.d.ts +6 -4
- package/dist/features/block-ui/feature.d.ts +8 -2
- package/dist/features/block-ui/feature.js +7 -2
- package/dist/features/block-ui/feature.js.map +1 -1
- package/dist/features/block-ui/index.d.ts +3 -2
- package/dist/features/block-ui/index.js +2 -2
- package/dist/features/block-ui/react/BlockActionsOverlay.d.ts +14 -7
- package/dist/features/block-ui/react/BlockActionsOverlay.js +25 -13
- package/dist/features/block-ui/react/BlockActionsOverlay.js.map +1 -1
- package/dist/features/block-ui/react/BlockUi.d.ts +6 -4
- package/dist/features/block-ui/react/BlockUi.js +43 -15
- package/dist/features/block-ui/react/BlockUi.js.map +1 -1
- package/dist/features/block-ui/react.d.ts +4 -2
- package/dist/features/block-ui/react.js +3 -3
- package/dist/features/block-ui/react.js.map +1 -1
- package/dist/features/block-ui/vue.d.ts +4 -2
- package/dist/features/block-ui/vue.js +3 -3
- package/dist/features/block-ui/vue.js.map +1 -1
- package/dist/features/composites/baskets.d.ts +27 -0
- package/dist/features/composites/baskets.js +46 -0
- package/dist/features/composites/baskets.js.map +1 -0
- package/dist/features/composites/components/CompositeBasketMenu.js +97 -0
- package/dist/features/composites/components/CompositeBasketMenu.js.map +1 -0
- package/dist/features/composites/components/CompositeChrome.js +79 -23
- package/dist/features/composites/components/CompositeChrome.js.map +1 -1
- package/dist/features/composites/components/CompositeView.js +21 -2
- package/dist/features/composites/components/CompositeView.js.map +1 -1
- package/dist/features/composites/components/DerivationBadge.js +12 -3
- package/dist/features/composites/components/DerivationBadge.js.map +1 -1
- package/dist/features/composites/components/FocusChip.js +53 -0
- package/dist/features/composites/components/FocusChip.js.map +1 -0
- package/dist/features/composites/components/FocusChip.vue.d.ts +14 -0
- package/dist/features/composites/components/SettingsEditingTab.js +40 -4
- package/dist/features/composites/components/SettingsEditingTab.js.map +1 -1
- package/dist/features/composites/derivation.d.ts +2 -1
- package/dist/features/composites/derivation.js +5 -1
- package/dist/features/composites/derivation.js.map +1 -1
- package/dist/features/composites/derived-chrome.js +13 -3
- package/dist/features/composites/derived-chrome.js.map +1 -1
- package/dist/features/composites/feature.d.ts +7 -1
- package/dist/features/composites/feature.js +107 -23
- package/dist/features/composites/feature.js.map +1 -1
- package/dist/features/composites/focus.d.ts +38 -0
- package/dist/features/composites/focus.js +86 -0
- package/dist/features/composites/focus.js.map +1 -0
- package/dist/features/composites/index.d.ts +7 -3
- package/dist/features/composites/index.js +7 -3
- package/dist/features/composites/kinds.d.ts +6 -1
- package/dist/features/composites/kinds.js.map +1 -1
- package/dist/features/composites/merge.d.ts +24 -0
- package/dist/features/composites/merge.js +47 -0
- package/dist/features/composites/merge.js.map +1 -0
- package/dist/features/composites/meta-keys.d.ts +4 -0
- package/dist/features/composites/meta-keys.js +8 -4
- package/dist/features/composites/meta-keys.js.map +1 -1
- package/dist/features/composites/nodes.d.ts +15 -2
- package/dist/features/composites/nodes.js +61 -5
- package/dist/features/composites/nodes.js.map +1 -1
- package/dist/features/composites/outline.d.ts +4 -0
- package/dist/features/composites/outline.js +3 -0
- package/dist/features/composites/outline.js.map +1 -1
- package/dist/features/composites/react/CompositeBasketMenu.js +88 -0
- package/dist/features/composites/react/CompositeBasketMenu.js.map +1 -0
- package/dist/features/composites/react/CompositeChrome.js +52 -4
- package/dist/features/composites/react/CompositeChrome.js.map +1 -1
- package/dist/features/composites/react/CompositeView.js +15 -2
- package/dist/features/composites/react/CompositeView.js.map +1 -1
- package/dist/features/composites/react/DerivationBadge.js +10 -1
- package/dist/features/composites/react/DerivationBadge.js.map +1 -1
- package/dist/features/composites/react/FocusChip.d.ts +11 -0
- package/dist/features/composites/react/FocusChip.js +50 -0
- package/dist/features/composites/react/FocusChip.js.map +1 -0
- package/dist/features/composites/react/SettingsEditingTab.js +36 -1
- package/dist/features/composites/react/SettingsEditingTab.js.map +1 -1
- package/dist/features/composites/react.d.ts +2 -1
- package/dist/features/composites/react.js +3 -1
- package/dist/features/composites/react.js.map +1 -1
- package/dist/features/composites/schema.d.ts +5 -3
- package/dist/features/composites/schema.js +8 -4
- package/dist/features/composites/schema.js.map +1 -1
- package/dist/features/composites/split.d.ts +62 -0
- package/dist/features/composites/split.js +172 -0
- package/dist/features/composites/split.js.map +1 -0
- package/dist/features/composites/vue.d.ts +4 -3
- package/dist/features/composites/vue.js +7 -5
- package/dist/features/composites/vue.js.map +1 -1
- package/dist/features/transfer/components/TransferMenu.js +93 -0
- package/dist/features/transfer/components/TransferMenu.js.map +1 -0
- package/dist/features/transfer/components/TransferMenu.vue.d.ts +15 -0
- package/dist/features/transfer/feature.d.ts +76 -0
- package/dist/features/transfer/feature.js +169 -0
- package/dist/features/transfer/feature.js.map +1 -0
- package/dist/features/transfer/index.d.ts +3 -0
- package/dist/features/transfer/index.js +3 -0
- package/dist/features/transfer/react/TransferMenu.d.ts +12 -0
- package/dist/features/transfer/react/TransferMenu.js +71 -0
- package/dist/features/transfer/react/TransferMenu.js.map +1 -0
- package/dist/features/transfer/react.d.ts +10 -0
- package/dist/features/transfer/react.js +11 -0
- package/dist/features/transfer/react.js.map +1 -0
- package/dist/features/transfer/transforms.d.ts +83 -0
- package/dist/features/transfer/transforms.js +137 -0
- package/dist/features/transfer/transforms.js.map +1 -0
- package/dist/features/transfer/vue.d.ts +9 -0
- package/dist/features/transfer/vue.js +11 -0
- package/dist/features/transfer/vue.js.map +1 -0
- package/dist/i18n/de/ai.js +4 -0
- package/dist/i18n/de/ai.js.map +1 -1
- package/dist/i18n/de/composites.js +21 -1
- package/dist/i18n/de/composites.js.map +1 -1
- package/dist/i18n/de/integrations.js +16 -0
- package/dist/i18n/de/integrations.js.map +1 -1
- package/dist/i18n/de/transfer.js +17 -0
- package/dist/i18n/de/transfer.js.map +1 -0
- package/dist/i18n/de/tree.js +7 -0
- package/dist/i18n/de/tree.js.map +1 -1
- package/dist/i18n/de.d.ts +57 -0
- package/dist/i18n/de.js +3 -1
- package/dist/i18n/de.js.map +1 -1
- package/dist/i18n/en/ai.js +4 -0
- package/dist/i18n/en/ai.js.map +1 -1
- package/dist/i18n/en/composites.js +21 -1
- package/dist/i18n/en/composites.js.map +1 -1
- package/dist/i18n/en/integrations.js +16 -0
- package/dist/i18n/en/integrations.js.map +1 -1
- package/dist/i18n/en/transfer.js +17 -0
- package/dist/i18n/en/transfer.js.map +1 -0
- package/dist/i18n/en/tree.js +7 -0
- package/dist/i18n/en/tree.js.map +1 -1
- package/dist/i18n/en.js +3 -1
- package/dist/i18n/en.js.map +1 -1
- package/dist/integrations/composite-ai/composite-fill.js +1 -1
- package/dist/integrations/composite-ai/composite-summary.js +1 -1
- package/dist/integrations/composite-ai/derive.d.ts +21 -0
- package/dist/integrations/composite-ai/derive.js +69 -47
- package/dist/integrations/composite-ai/derive.js.map +1 -1
- package/dist/integrations/composite-ai/index.d.ts +8 -3
- package/dist/integrations/composite-ai/index.js +50 -4
- package/dist/integrations/composite-ai/index.js.map +1 -1
- package/dist/integrations/composite-ai/outline-sanitize.d.ts +48 -0
- package/dist/integrations/composite-ai/outline-sanitize.js +175 -0
- package/dist/integrations/composite-ai/outline-sanitize.js.map +1 -0
- package/dist/integrations/composite-ai/split.d.ts +44 -0
- package/dist/integrations/composite-ai/split.js +187 -0
- package/dist/integrations/composite-ai/split.js.map +1 -0
- package/dist/integrations/composite-ai/transfer-transforms.d.ts +27 -0
- package/dist/integrations/composite-ai/transfer-transforms.js +153 -0
- package/dist/integrations/composite-ai/transfer-transforms.js.map +1 -0
- package/dist/integrations/transcript-ai/protocol.d.ts +13 -0
- package/dist/integrations/transcript-ai/protocol.js +49 -1
- package/dist/integrations/transcript-ai/protocol.js.map +1 -1
- package/dist/integrations/transcript-ai/transcript-cleanup.js +1 -1
- package/dist/markdown/MarkdownSurface.vue.d.ts +1 -1
- package/dist/nuxt/module.d.ts +114 -0
- package/dist/presets/compose.d.ts +24 -8
- package/dist/presets/compose.js +117 -58
- package/dist/presets/compose.js.map +1 -1
- package/dist/react/compose.js +5 -1
- package/dist/react/compose.js.map +1 -1
- package/dist/react/composed-surface.d.ts +9 -0
- package/dist/react/composed-surface.js +4 -1
- package/dist/react/composed-surface.js.map +1 -1
- package/dist/server/ai.d.ts +2 -5
- package/dist/server/ai.js.map +1 -1
- package/dist/server/handlers/ai.d.ts +4 -75
- package/dist/server/handlers/ai.js +30 -94
- package/dist/server/handlers/ai.js.map +1 -1
- package/dist/server/handlers/editor.d.ts +1 -0
- package/dist/server/handlers/index.d.ts +3 -1
- package/dist/server/handlers/index.js +3 -1
- package/dist/server/index.d.ts +2 -1
- package/dist/settings/index.d.ts +8 -0
- package/dist/settings/index.js +16 -4
- package/dist/settings/index.js.map +1 -1
- package/dist/styles/composites.css +41 -0
- package/dist/tree/DocumentTree.js +246 -80
- package/dist/tree/DocumentTree.js.map +1 -1
- package/dist/tree/drop-rules.js +8 -0
- package/dist/tree/drop-rules.js.map +1 -1
- package/dist/tree/react/DocumentTree.js +164 -32
- package/dist/tree/react/DocumentTree.js.map +1 -1
- package/dist/tree/tree-host.js +41 -2
- package/dist/tree/tree-host.js.map +1 -1
- package/dist/tree/tree-items.js +53 -5
- package/dist/tree/tree-items.js.map +1 -1
- package/dist/tree/tree-model.js +122 -10
- package/dist/tree/tree-model.js.map +1 -1
- package/dist/tree/tree-rows.js +20 -7
- package/dist/tree/tree-rows.js.map +1 -1
- package/dist/tree/tree-view-model.d.ts +5 -0
- package/dist/tree/tree-view-model.js +13 -0
- package/dist/tree/tree-view-model.js.map +1 -1
- package/dist/vue/AdvancedEditor.js +6 -0
- package/dist/vue/AdvancedEditor.js.map +1 -1
- package/dist/vue/AdvancedEditor.vue.d.ts +9 -1
- package/dist/vue/compose.js +5 -1
- package/dist/vue/compose.js.map +1 -1
- package/package.json +21 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CompositeChrome.js","names":["_unref","_openBlock","_createBlock","_Teleport","_createElementVNode","_createElementBlock","_Fragment","_renderList","_withCtx","_createVNode","CompositeDetails","_normalizeClass","_normalizeStyle","_withKeys","_withModifiers","_createCommentVNode","_createTextVNode","_toDisplayString","CompositeStatusMenu","CompositeTagsEditor"],"sources":["../../../../src/features/composites/components/CompositeChrome.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { Editor } from '@tiptap/vue-3'\nimport { computed, shallowRef, watch } from 'vue'\nimport { startBlockDrag } from '../../../core'\nimport { useUiKit } from '../../../vue/kit/use-ui-kit'\nimport { useEditorI18n } from '../../../vue/use-editor-i18n'\nimport { useStoreRef } from '../../../vue/store-ref'\nimport { useEditorSettings } from '../../../vue/settings'\nimport { compositeSectionOf } from '../anchors'\nimport { derivedChromeOf } from '../derived-chrome'\nimport { rowStatus } from '../meta-display'\nimport { compositeOfRow, type CompositeRow, setCompositeTags } from '../rows'\nimport { useCompositeAnchors } from '../use-composite-anchors'\nimport { useCompositeRows } from '../use-composite-rows'\nimport CompositeDetails from './CompositeDetails.vue'\nimport CompositeStatusMenu from './CompositeStatusMenu.vue'\nimport CompositeTagsEditor from './CompositeTagsEditor.vue'\n\n/**\n * Chrome of every composite, laid over the editor (mounted by the composites feature): on the title line the status\n * chip and one chip per tag (with a `+` chip to add tags), and on the front the kind icon. The icon is a button that\n * opens the details popover (kind with a confirmation before it changes, the kind's fields and the summary;\n * `CompositeDetails`) and, in an editable editor, the composite's drag handle: dragging it moves the composite\n * (`startBlockDrag`). A kind with `chrome.tags: false` shows no tag chips and no `+` chip. With `blocks.kindIcon: 'hover'` it shows only while the composite is hovered, its popover is\n * open or the icon has keyboard focus. Chips and popover also render in read-only editors, without edit affordances.\n * The node view's own description and tags rows are hidden by CSS; this overlay shows and edits them.\n */\nconst props = defineProps<{ editor: Editor }>()\n\nconst { Icon: UIcon, Popover: UPopover } = useUiKit()\nconst { t } = useEditorI18n()\n\nconst { rows } = useCompositeRows(() => props.editor)\nconst { host, anchors, frame } = useCompositeAnchors(() => props.editor, rows)\n\n// `isEditable` is not reactive: follow it on every transaction (`EditorSurface` dispatches one after `setEditable`).\nconst editable = shallowRef(false)\nwatch(() => props.editor, (instance, _previous, onCleanup) => {\n editable.value = !instance.isDestroyed && instance.isEditable\n const sync = () => {\n editable.value = !instance.isDestroyed && instance.isEditable\n }\n instance.on('transaction', sync)\n onCleanup(() => instance.off('transaction', sync))\n}, { immediate: true })\n\nconst { settings } = useEditorSettings()\nconst iconOnHover = computed(() => settings.value.blocks.kindIcon === 'hover')\n\n// Hover state of `kindIcon: 'hover'`: the keys of the rows whose composite is under the pointer (that one and every\n// composite around it), plus the row whose chips the pointer is on (they sit outside the editor's DOM).\nconst hoveredKeys = shallowRef<ReadonlySet<string>>(new Set())\nconst chipsHoveredKey = shallowRef<string | null>(null)\nlet hoveredSection: Element | null = null\n\nfunction onEditorMouseover(event: MouseEvent) {\n const section = event.target instanceof Element ? event.target.closest('.composite') : null\n if (section === hoveredSection) return\n hoveredSection = section\n const chain = new Set<Element>()\n for (let el = section; el; el = el.parentElement?.closest('.composite') ?? null) chain.add(el)\n const { view, state } = props.editor\n hoveredKeys.value = new Set(rows.value.filter((row) => {\n const found = compositeOfRow(state.doc, row)\n const dom = found ? view.nodeDOM(found.pos) : null\n const section = dom instanceof Element ? compositeSectionOf(dom) : null\n return section !== null && chain.has(section)\n }).map(row => row.key))\n}\n\nfunction onEditorMouseleave() {\n hoveredSection = null\n hoveredKeys.value = new Set()\n}\n\nwatch([() => props.editor, iconOnHover], ([instance, hover], _previous, onCleanup) => {\n onEditorMouseleave()\n if (!hover || instance.isDestroyed) return\n const { dom } = instance.view\n dom.addEventListener('mouseover', onEditorMouseover)\n dom.addEventListener('mouseleave', onEditorMouseleave)\n onCleanup(() => {\n dom.removeEventListener('mouseover', onEditorMouseover)\n dom.removeEventListener('mouseleave', onEditorMouseleave)\n })\n}, { immediate: true })\n\nfunction onIconDragStart(event: DragEvent, row: CompositeRow) {\n const found = compositeOfRow(props.editor.state.doc, row)\n if (!found || !startBlockDrag(props.editor, event, found.pos)) event.preventDefault()\n}\n\n/** Chips start right after the title's last character and run on to the editor's right edge. */\nconst ROW_HEIGHT = 24\n\nconst expanded = useStoreRef(() => props.editor.storage.composite.expanded)\n\nconst placed = computed(() => {\n // End of the collapsed derived Baustein the rows being walked sit in: its clipped content shows no chrome.\n let hiddenUntil = -1\n return rows.value.flatMap((row) => {\n if (row.pos < hiddenUntil) return []\n const derived = derivedChromeOf(props.editor, row)\n const open = !derived || !row.id || expanded.value.has(row.id)\n if (!open) hiddenUntil = row.end\n const anchor = anchors.value.get(row.key)\n if (!anchor) return []\n // An empty title shows a placeholder the anchor cannot measure: keep clear of it.\n const left = anchor.lineEnd + (anchor.titleEmpty ? 116 : 12)\n return [{\n row,\n anchor,\n left,\n top: anchor.lastCenter - ROW_HEIGHT / 2,\n width: Math.max((frame.value?.right ?? anchor.right) - left, 120),\n status: rowStatus(row, t),\n derived: derived && { stale: derived.stale, open, toggleable: !!row.id },\n }]\n })\n})\n\nfunction toggleExpanded(row: CompositeRow) {\n if (row.id) props.editor.commands.toggleCompositeExpanded(row.id)\n}\n\nfunction removeTag(row: CompositeRow, tag: string) {\n setCompositeTags(props.editor, row, row.tags.filter(candidate => candidate !== tag))\n}\n\nconst chip = 'inline-flex h-5 shrink-0 items-center gap-1 rounded-sm px-1.5 text-xs leading-none whitespace-nowrap text-[var(--sk-muted)]'\nconst chipButton = `${chip} transition-colors duration-150 hover:bg-[var(--sk-bg-elevated)] hover:text-[var(--sk-fg-highlighted)] focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-[var(--sk-primary)]`\n\n/** Scale and fade in from the icon (`transform-origin` is Reka's), a bit longer than Nuxt UI's default; `composites.css` defines the keyframes and the reduced-motion override. */\nconst detailsPopoverUi = {\n content: 'composite-popover data-[state=open]:animate-[composite-pop-in_160ms_var(--ease-out)] data-[state=closed]:animate-[composite-pop-out_120ms_var(--ease-out)]',\n}\n</script>\n\n<template>\n <Teleport v-if=\"host\" :to=\"host\">\n <div class=\"absolute left-0 top-0 h-0 w-0\">\n <template v-for=\"item in placed\" :key=\"item.row.key\">\n <UPopover\n v-if=\"item.anchor.toggleSize\"\n :content=\"{ side: 'bottom', align: 'start', sideOffset: 4 }\"\n :ui=\"detailsPopoverUi\"\n >\n <!-- A span, not a `button`: Firefox does not start drags from buttons. -->\n <span\n role=\"button\"\n tabindex=\"0\"\n :draggable=\"editable\"\n :class=\"[\n 'absolute z-10 flex items-center justify-center rounded-sm bg-[var(--sk-bg)] text-[var(--sk-muted)] transition-[color,background-color,opacity] duration-120 motion-reduce:transition-none hover:bg-[var(--sk-bg-elevated)] hover:text-[var(--sk-fg-highlighted)] focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-[var(--sk-primary)]',\n editable ? 'cursor-grab active:cursor-grabbing' : 'cursor-pointer',\n iconOnHover && !hoveredKeys.has(item.row.key) && chipsHoveredKey !== item.row.key && 'opacity-0 hover:opacity-100 focus-visible:opacity-100 data-[state=open]:opacity-100',\n ]\"\n :style=\"{ top: `${item.anchor.toggleTop}px`, left: `${item.anchor.toggleLeft}px`, width: `${item.anchor.toggleSize}px`, height: `${item.anchor.toggleSize}px` }\"\n :aria-label=\"t('composites.chrome.details', { kind: item.row.kindLabel })\"\n :title=\"editable ? t('composites.chrome.detailsDrag', { kind: item.row.kindLabel }) : t('composites.chrome.details', { kind: item.row.kindLabel })\"\n @keydown.enter.space.prevent=\"($event.currentTarget as HTMLElement).click()\"\n @dragstart=\"onIconDragStart($event, item.row)\"\n >\n <UIcon :key=\"item.row.icon\" :name=\"item.row.icon\" class=\"size-3.5\" />\n </span>\n <template #content>\n <CompositeDetails :editor=\"editor\" :row=\"item.row\" :editable=\"editable\" />\n </template>\n </UPopover>\n\n <div\n v-if=\"item.status || item.derived || (item.row.tagsVisible && (item.row.tags.length || editable))\"\n class=\"absolute z-10 flex items-center gap-px overflow-hidden rounded-md bg-[var(--sk-bg)]\"\n :style=\"{ top: `${item.top}px`, left: `${item.left}px`, maxWidth: `${item.width}px`, height: `${ROW_HEIGHT}px` }\"\n @mouseenter=\"chipsHoveredKey = item.row.key\"\n @mouseleave=\"chipsHoveredKey = null\"\n >\n <template v-if=\"item.derived\">\n <button\n v-if=\"item.derived.toggleable\"\n type=\"button\"\n :class=\"chipButton\"\n :aria-expanded=\"item.derived.open\"\n :aria-label=\"t(item.derived.open ? 'composites.derivation.collapse' : 'composites.derivation.expand')\"\n :title=\"t(item.derived.open ? 'composites.derivation.collapse' : 'composites.derivation.expand')\"\n @click=\"toggleExpanded(item.row)\"\n >\n <UIcon :name=\"item.derived.open ? 'i-lucide-chevron-down' : 'i-lucide-chevron-right'\" class=\"size-3.5\" />\n </button>\n <span :class=\"chip\">\n <UIcon name=\"i-lucide-git-branch\" class=\"size-3.5\" />{{ t('composites.derivation.badge') }}\n </span>\n <span v-if=\"item.derived.stale\" :class=\"[chip, 'text-[var(--sk-warning)]']\">\n <UIcon name=\"i-lucide-triangle-alert\" class=\"size-3.5\" />{{ t('composites.derivation.stale') }}\n </span>\n </template>\n\n <template v-if=\"item.status\">\n <CompositeStatusMenu v-if=\"editable\" :editor=\"editor\" :row=\"item.row\">\n <button type=\"button\" :class=\"chipButton\" :aria-label=\"t('composites.status.label', { status: item.status.label })\">\n <UIcon :name=\"item.status.icon\" :class=\"['size-3.5', item.status.color]\" />{{ item.status.label }}\n </button>\n </CompositeStatusMenu>\n <span v-else :class=\"chip\">\n <UIcon :name=\"item.status.icon\" :class=\"['size-3.5', item.status.color]\" />{{ item.status.label }}\n </span>\n </template>\n\n <span v-for=\"tag in item.row.tagsVisible ? item.row.tags : []\" :key=\"tag\" :class=\"[chip, 'group max-w-40 gap-0']\">\n <span class=\"truncate\">#{{ tag }}</span>\n <button\n v-if=\"editable\"\n type=\"button\"\n class=\"flex h-4 w-0 shrink-0 items-center justify-center overflow-hidden rounded-sm opacity-0 transition-all duration-150 group-hover:ml-1 group-hover:w-4 group-hover:opacity-100 hover:bg-[var(--sk-bg-elevated)] hover:text-[var(--sk-fg-highlighted)] focus-visible:ml-1 focus-visible:w-4 focus-visible:opacity-100 focus-visible:outline-2 focus-visible:outline-[var(--sk-primary)]\"\n :aria-label=\"t('composites.tag.remove', { tag })\"\n @click=\"removeTag(item.row, tag)\"\n >\n <UIcon name=\"i-lucide-x\" class=\"size-3\" />\n </button>\n </span>\n\n <UPopover\n v-if=\"editable && item.row.tagsVisible\"\n :content=\"{ side: 'bottom', align: 'start', sideOffset: 6, onCloseAutoFocus: (event: Event) => event.preventDefault() }\"\n >\n <button type=\"button\" :class=\"chipButton\" :aria-label=\"t('composites.tag.add')\" :title=\"t('composites.tag.add')\">\n <UIcon name=\"i-lucide-plus\" class=\"size-3.5\" />\n </button>\n <template #content>\n <div class=\"w-64 p-3\">\n <CompositeTagsEditor :editor=\"editor\" :row=\"item.row\" />\n </div>\n </template>\n </UPopover>\n </div>\n </template>\n </div>\n </Teleport>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6FA,MAAM,aAAa;AAoCnB,MAAM,OAAO;;;;;EAtGb,MAAM,QAAQ;EAEd,MAAM,EAAE,MAAM,OAAO,SAAS,aAAa,SAAS;EACpD,MAAM,EAAE,MAAM,cAAc;EAE5B,MAAM,EAAE,SAAS,uBAAuB,MAAM,MAAM;EACpD,MAAM,EAAE,MAAM,SAAS,UAAU,0BAA0B,MAAM,QAAQ,IAAI;EAG7E,MAAM,WAAW,WAAW,KAAK;EACjC,YAAY,MAAM,SAAS,UAAU,WAAW,cAAc;GAC5D,SAAS,QAAQ,CAAC,SAAS,eAAe,SAAS;GACnD,MAAM,aAAa;IACjB,SAAS,QAAQ,CAAC,SAAS,eAAe,SAAS;GACrD;GACA,SAAS,GAAG,eAAe,IAAI;GAC/B,gBAAgB,SAAS,IAAI,eAAe,IAAI,CAAC;EACnD,GAAG,EAAE,WAAW,KAAK,CAAC;EAEtB,MAAM,EAAE,aAAa,kBAAkB;EACvC,MAAM,cAAc,eAAe,SAAS,MAAM,OAAO,aAAa,OAAO;EAI7E,MAAM,cAAc,2BAAgC,IAAI,IAAI,CAAC;EAC7D,MAAM,kBAAkB,WAA0B,IAAI;EACtD,IAAI,iBAAiC;EAErC,SAAS,kBAAkB,OAAmB;GAC5C,MAAM,UAAU,MAAM,kBAAkB,UAAU,MAAM,OAAO,QAAQ,YAAY,IAAI;GACvF,IAAI,YAAY,gBAAgB;GAChC,iBAAiB;GACjB,MAAM,wBAAQ,IAAI,IAAa;GAC/B,KAAK,IAAI,KAAK,SAAS,IAAI,KAAK,GAAG,eAAe,QAAQ,YAAY,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P,mBAAwC,QAAxC,YAAuB,MAACa,gBAAG,GAAG,GAAA,CAAA,GAEtB,SAAA,SADRhB,UAAA,GAAAI,mBAQS,UAAA;;OANP,MAAK;OACL,OAAM;OACL,cAAYL,MAAA,CAAA,CAAC,CAAA,yBAAA,EAA4B,IAAG,CAAA;OAC5C,UAAK,WAAE,UAAU,KAAK,KAAK,GAAG;MAE/B,GAAA,CAAAS,YAA0CT,MAAA,KAAA,GAAA;OAAnC,MAAK;OAAa,OAAM;;;KAK3B,SAAA,SAAY,KAAK,IAAI,eAD7BC,UAAA,GAAAC,YAYWF,MAAA,QAAA,GAAA;;MAVR,SAAO;OAAA,MAAA;OAAA,OAAA;OAAA,YAAA;OAAA,mBAAsE,UAAiB,MAAM,eAAc;MAAA;;MAKxG,SAAOQ,cAGV,CAFNJ,mBAEM,OAFN,YAEM,CADJK,YAAwDU,aAAA;OAAlC,QAAQ,QAAA;OAAS,KAAK,KAAK;;MALrD,SAAAX,cAES,CAFTJ,mBAES,UAAA;OAFD,MAAK;OAAU,OAAKO,eAAE,UAAU;OAAG,cAAYX,MAAA,CAAA,CAAC,CAAA,oBAAA;OAAyB,OAAOA,MAAA,CAAA,CAAC,CAAA,oBAAA;MACvF,GAAA,CAAAS,YAA+CT,MAAA,KAAA,GAAA;OAAxC,MAAK;OAAgB,OAAM"}
|
|
1
|
+
{"version":3,"file":"CompositeChrome.js","names":["_unref","_openBlock","_createBlock","_Teleport","_createElementVNode","_createElementBlock","_Fragment","_renderList","_withCtx","_createVNode","CompositeDetails","_normalizeClass","_normalizeStyle","_withKeys","_withModifiers","_createCommentVNode","CompositeBasketMenu","_createTextVNode","_toDisplayString","CompositeStatusMenu","CompositeTagsEditor"],"sources":["../../../../src/features/composites/components/CompositeChrome.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { Editor } from '@tiptap/vue-3'\nimport { computed, shallowRef, watch } from 'vue'\nimport { startBlockDrag } from '../../../core'\nimport { useUiKit } from '../../../vue/kit/use-ui-kit'\nimport { useEditorI18n } from '../../../vue/use-editor-i18n'\nimport { useStoreRef } from '../../../vue/store-ref'\nimport { useEditorSettings } from '../../../vue/settings'\nimport { compositeSectionOf } from '../anchors'\nimport { derivedChromeOf } from '../derived-chrome'\nimport { rowStatus } from '../meta-display'\nimport { basketById, basketOf, titleHiddenOf } from '../baskets'\nimport { compositeBasketsOf } from '../nodes'\nimport { compositeOfRow, type CompositeRow, setCompositeTags } from '../rows'\nimport { useCompositeAnchors } from '../use-composite-anchors'\nimport { useCompositeRows } from '../use-composite-rows'\nimport CompositeBasketMenu from './CompositeBasketMenu.vue'\nimport CompositeDetails from './CompositeDetails.vue'\nimport CompositeStatusMenu from './CompositeStatusMenu.vue'\nimport CompositeTagsEditor from './CompositeTagsEditor.vue'\n\n/**\n * Chrome of every composite, laid over the editor (mounted by the composites feature): on the title line the status\n * chip and one chip per tag (with a `+` chip to add tags), and on the front the kind icon. The icon is a button that\n * opens the details popover (kind with a confirmation before it changes, the kind's fields and the summary;\n * `CompositeDetails`) and, in an editable editor, the composite's drag handle: dragging it moves the composite\n * (`startBlockDrag`). A kind with `chrome.tags: false` shows no tag chips and no `+` chip. With `blocks.kindIcon: 'hover'` it shows only while the composite is hovered, its popover is\n * open or the icon has keyboard focus. Chips and popover also render in read-only editors, without edit affordances.\n * The node view's own description and tags rows are hidden by CSS; this overlay shows and edits them.\n */\nconst props = defineProps<{ editor: Editor }>()\n\nconst { Icon: UIcon, Popover: UPopover } = useUiKit()\nconst { t } = useEditorI18n()\n\nconst { rows } = useCompositeRows(() => props.editor)\nconst { host, anchors, frame } = useCompositeAnchors(() => props.editor, rows)\n\n// `isEditable` is not reactive: follow it on every transaction (`EditorSurface` dispatches one after `setEditable`).\nconst editable = shallowRef(false)\nwatch(() => props.editor, (instance, _previous, onCleanup) => {\n editable.value = !instance.isDestroyed && instance.isEditable\n const sync = () => {\n editable.value = !instance.isDestroyed && instance.isEditable\n }\n instance.on('transaction', sync)\n onCleanup(() => instance.off('transaction', sync))\n}, { immediate: true })\n\nconst { settings } = useEditorSettings()\nconst iconOnHover = computed(() => settings.value.blocks.kindIcon === 'hover')\n\n// Hover state of `kindIcon: 'hover'`: the keys of the rows whose composite is under the pointer (that one and every\n// composite around it), plus the row whose chips the pointer is on (they sit outside the editor's DOM).\nconst hoveredKeys = shallowRef<ReadonlySet<string>>(new Set())\nconst chipsHoveredKey = shallowRef<string | null>(null)\nlet hoveredSection: Element | null = null\n\nfunction onEditorMouseover(event: MouseEvent) {\n const section = event.target instanceof Element ? event.target.closest('.composite') : null\n if (section === hoveredSection) return\n hoveredSection = section\n const chain = new Set<Element>()\n for (let el = section; el; el = el.parentElement?.closest('.composite') ?? null) chain.add(el)\n const { view, state } = props.editor\n hoveredKeys.value = new Set(rows.value.filter((row) => {\n const found = compositeOfRow(state.doc, row)\n const dom = found ? view.nodeDOM(found.pos) : null\n const section = dom instanceof Element ? compositeSectionOf(dom) : null\n return section !== null && chain.has(section)\n }).map(row => row.key))\n}\n\nfunction onEditorMouseleave() {\n hoveredSection = null\n hoveredKeys.value = new Set()\n}\n\nwatch([() => props.editor, iconOnHover], ([instance, hover], _previous, onCleanup) => {\n onEditorMouseleave()\n if (!hover || instance.isDestroyed) return\n const { dom } = instance.view\n dom.addEventListener('mouseover', onEditorMouseover)\n dom.addEventListener('mouseleave', onEditorMouseleave)\n onCleanup(() => {\n dom.removeEventListener('mouseover', onEditorMouseover)\n dom.removeEventListener('mouseleave', onEditorMouseleave)\n })\n}, { immediate: true })\n\nfunction onIconDragStart(event: DragEvent, row: CompositeRow) {\n const found = compositeOfRow(props.editor.state.doc, row)\n if (!found || !startBlockDrag(props.editor, event, found.pos)) event.preventDefault()\n}\n\n/** Chips start right after the title's last character and run on to the editor's right edge. */\nconst ROW_HEIGHT = 24\n\nconst expanded = useStoreRef(() => props.editor.storage.composite.expanded)\nconst revealedTitles = useStoreRef(() => props.editor.storage.composite.revealedTitles)\n\nconst placed = computed(() => {\n const baskets = compositeBasketsOf(props.editor)\n // End of the collapsed derived Baustein the rows being walked sit in: its clipped content shows no chrome.\n let hiddenUntil = -1\n return rows.value.flatMap((row) => {\n if (row.pos < hiddenUntil) return []\n const derived = derivedChromeOf(props.editor, row)\n const open = !derived || !row.id || expanded.value.has(row.id)\n if (!open) hiddenUntil = row.end\n const anchor = anchors.value.get(row.key)\n if (!anchor) return []\n const titleHidden = titleHiddenOf(row)\n // A hidden title leaves nothing to measure: the chips sit in the strip beside the kind icon (`composites.css`).\n const inStrip = titleHidden && !(row.id && revealedTitles.value.has(row.id)) && anchor.toggleSize > 0\n // An empty title shows a placeholder the anchor cannot measure: keep clear of it.\n const left = inStrip ? anchor.toggleLeft + anchor.toggleSize + 6 : anchor.lineEnd + (anchor.titleEmpty ? 116 : 12)\n return [{\n row,\n anchor,\n left,\n top: (inStrip ? anchor.toggleTop + anchor.toggleSize / 2 : anchor.lastCenter) - ROW_HEIGHT / 2,\n width: Math.max((frame.value?.right ?? anchor.right) - left, 120),\n status: rowStatus(row, t),\n derived: derived && { stale: derived.stale, open, toggleable: !!row.id },\n basket: basketById(baskets, basketOf(row)) ?? null,\n titleHidden,\n }]\n })\n})\n\nfunction toggleExpanded(row: CompositeRow) {\n if (row.id) props.editor.commands.toggleCompositeExpanded(row.id)\n}\n\nfunction removeTag(row: CompositeRow, tag: string) {\n setCompositeTags(props.editor, row, row.tags.filter(candidate => candidate !== tag))\n}\n\nfunction toggleTitleHidden(row: CompositeRow) {\n const found = compositeOfRow(props.editor.state.doc, row)\n if (found) props.editor.commands.setCompositeTitleHidden(!titleHiddenOf(row), found.pos)\n}\n\nconst chip = 'inline-flex h-5 shrink-0 items-center gap-1 rounded-sm px-1.5 text-xs leading-none whitespace-nowrap text-[var(--sk-muted)]'\nconst chipButton = `${chip} transition-colors duration-150 hover:bg-[var(--sk-bg-elevated)] hover:text-[var(--sk-fg-highlighted)] focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-[var(--sk-primary)]`\n\n/** Scale and fade in from the icon (`transform-origin` is Reka's), a bit longer than Nuxt UI's default; `composites.css` defines the keyframes and the reduced-motion override. */\nconst detailsPopoverUi = {\n content: 'composite-popover data-[state=open]:animate-[composite-pop-in_160ms_var(--ease-out)] data-[state=closed]:animate-[composite-pop-out_120ms_var(--ease-out)]',\n}\n</script>\n\n<template>\n <Teleport v-if=\"host\" :to=\"host\">\n <div class=\"absolute left-0 top-0 h-0 w-0\">\n <template v-for=\"item in placed\" :key=\"item.row.key\">\n <UPopover\n v-if=\"item.anchor.toggleSize\"\n :content=\"{ side: 'bottom', align: 'start', sideOffset: 4 }\"\n :ui=\"detailsPopoverUi\"\n >\n <!-- A span, not a `button`: Firefox does not start drags from buttons. -->\n <span\n role=\"button\"\n tabindex=\"0\"\n :draggable=\"editable\"\n :class=\"[\n 'absolute z-10 flex items-center justify-center rounded-sm bg-[var(--sk-bg)] text-[var(--sk-muted)] transition-[color,background-color,opacity] duration-120 motion-reduce:transition-none hover:bg-[var(--sk-bg-elevated)] hover:text-[var(--sk-fg-highlighted)] focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-[var(--sk-primary)]',\n editable ? 'cursor-grab active:cursor-grabbing' : 'cursor-pointer',\n iconOnHover && !hoveredKeys.has(item.row.key) && chipsHoveredKey !== item.row.key && 'opacity-0 hover:opacity-100 focus-visible:opacity-100 data-[state=open]:opacity-100',\n ]\"\n :style=\"{ top: `${item.anchor.toggleTop}px`, left: `${item.anchor.toggleLeft}px`, width: `${item.anchor.toggleSize}px`, height: `${item.anchor.toggleSize}px` }\"\n :aria-label=\"t('composites.chrome.details', { kind: item.row.kindLabel })\"\n :title=\"editable ? t('composites.chrome.detailsDrag', { kind: item.row.kindLabel }) : t('composites.chrome.details', { kind: item.row.kindLabel })\"\n @keydown.enter.space.prevent=\"($event.currentTarget as HTMLElement).click()\"\n @dragstart=\"onIconDragStart($event, item.row)\"\n >\n <UIcon :key=\"item.row.icon\" :name=\"item.row.icon\" class=\"size-3.5\" />\n </span>\n <template #content>\n <CompositeDetails :editor=\"editor\" :row=\"item.row\" :editable=\"editable\" />\n </template>\n </UPopover>\n\n <div\n v-if=\"editable || item.basket || item.status || item.derived || (item.row.tagsVisible && item.row.tags.length)\"\n class=\"absolute z-10 flex items-center gap-px overflow-hidden rounded-md bg-[var(--sk-bg)]\"\n :style=\"{ top: `${item.top}px`, left: `${item.left}px`, maxWidth: `${item.width}px`, height: `${ROW_HEIGHT}px` }\"\n @mouseenter=\"chipsHoveredKey = item.row.key\"\n @mouseleave=\"chipsHoveredKey = null\"\n >\n <template v-if=\"editable\">\n <CompositeBasketMenu :editor=\"editor\" :row=\"item.row\">\n <button type=\"button\" :class=\"chipButton\" :aria-label=\"t('composites.basket.label')\" :title=\"item.basket ? `${t('composites.basket.label')}: ${item.basket.label}` : t('composites.basket.label')\">\n <span v-if=\"item.basket\" class=\"size-2.5 rounded-full\" :style=\"{ backgroundColor: item.basket.color }\" />\n <UIcon v-else name=\"i-lucide-circle-dashed\" class=\"size-3.5\" />\n </button>\n </CompositeBasketMenu>\n <button\n type=\"button\"\n :class=\"chipButton\"\n :aria-label=\"t(item.titleHidden ? 'composites.titleHidden.show' : 'composites.titleHidden.hide')\"\n :title=\"t(item.titleHidden ? 'composites.titleHidden.show' : 'composites.titleHidden.hide')\"\n @click=\"toggleTitleHidden(item.row)\"\n >\n <UIcon :name=\"item.titleHidden ? 'i-lucide-eye' : 'i-lucide-eye-off'\" class=\"size-3.5\" />\n </button>\n </template>\n <span v-else-if=\"item.basket\" :class=\"chip\" :title=\"item.basket.label\">\n <span class=\"size-2.5 rounded-full\" :style=\"{ backgroundColor: item.basket.color }\" />\n </span>\n\n <template v-if=\"item.derived\">\n <button\n v-if=\"item.derived.toggleable\"\n type=\"button\"\n :class=\"chipButton\"\n :aria-expanded=\"item.derived.open\"\n :aria-label=\"t(item.derived.open ? 'composites.derivation.collapse' : 'composites.derivation.expand')\"\n :title=\"t(item.derived.open ? 'composites.derivation.collapse' : 'composites.derivation.expand')\"\n @click=\"toggleExpanded(item.row)\"\n >\n <UIcon :name=\"item.derived.open ? 'i-lucide-chevron-down' : 'i-lucide-chevron-right'\" class=\"size-3.5\" />\n </button>\n <span :class=\"chip\">\n <UIcon name=\"i-lucide-git-branch\" class=\"size-3.5\" />{{ t('composites.derivation.badge') }}\n </span>\n <span v-if=\"item.derived.stale\" :class=\"[chip, 'text-[var(--sk-warning)]']\">\n <UIcon name=\"i-lucide-triangle-alert\" class=\"size-3.5\" />{{ t('composites.derivation.stale') }}\n </span>\n </template>\n\n <template v-if=\"item.status\">\n <CompositeStatusMenu v-if=\"editable\" :editor=\"editor\" :row=\"item.row\">\n <button type=\"button\" :class=\"chipButton\" :aria-label=\"t('composites.status.label', { status: item.status.label })\">\n <UIcon :name=\"item.status.icon\" :class=\"['size-3.5', item.status.color]\" />{{ item.status.label }}\n </button>\n </CompositeStatusMenu>\n <span v-else :class=\"chip\">\n <UIcon :name=\"item.status.icon\" :class=\"['size-3.5', item.status.color]\" />{{ item.status.label }}\n </span>\n </template>\n\n <span v-for=\"tag in item.row.tagsVisible ? item.row.tags : []\" :key=\"tag\" :class=\"[chip, 'group max-w-40 gap-0']\">\n <span class=\"truncate\">#{{ tag }}</span>\n <button\n v-if=\"editable\"\n type=\"button\"\n class=\"flex h-4 w-0 shrink-0 items-center justify-center overflow-hidden rounded-sm opacity-0 transition-all duration-150 group-hover:ml-1 group-hover:w-4 group-hover:opacity-100 hover:bg-[var(--sk-bg-elevated)] hover:text-[var(--sk-fg-highlighted)] focus-visible:ml-1 focus-visible:w-4 focus-visible:opacity-100 focus-visible:outline-2 focus-visible:outline-[var(--sk-primary)]\"\n :aria-label=\"t('composites.tag.remove', { tag })\"\n @click=\"removeTag(item.row, tag)\"\n >\n <UIcon name=\"i-lucide-x\" class=\"size-3\" />\n </button>\n </span>\n\n <UPopover\n v-if=\"editable && item.row.tagsVisible\"\n :content=\"{ side: 'bottom', align: 'start', sideOffset: 6, onCloseAutoFocus: (event: Event) => event.preventDefault() }\"\n >\n <button type=\"button\" :class=\"chipButton\" :aria-label=\"t('composites.tag.add')\" :title=\"t('composites.tag.add')\">\n <UIcon name=\"i-lucide-plus\" class=\"size-3.5\" />\n </button>\n <template #content>\n <div class=\"w-64 p-3\">\n <CompositeTagsEditor :editor=\"editor\" :row=\"item.row\" />\n </div>\n </template>\n </UPopover>\n </div>\n </template>\n </div>\n </Teleport>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgGA,MAAM,aAAa;AAgDnB,MAAM,OAAO;;;;;EAlHb,MAAM,QAAQ;EAEd,MAAM,EAAE,MAAM,OAAO,SAAS,aAAa,SAAS;EACpD,MAAM,EAAE,MAAM,cAAc;EAE5B,MAAM,EAAE,SAAS,uBAAuB,MAAM,MAAM;EACpD,MAAM,EAAE,MAAM,SAAS,UAAU,0BAA0B,MAAM,QAAQ,IAAI;EAG7E,MAAM,WAAW,WAAW,KAAK;EACjC,YAAY,MAAM,SAAS,UAAU,WAAW,cAAc;GAC5D,SAAS,QAAQ,CAAC,SAAS,eAAe,SAAS;GACnD,MAAM,aAAa;IACjB,SAAS,QAAQ,CAAC,SAAS,eAAe,SAAS;GACrD;GACA,SAAS,GAAG,eAAe,IAAI;GAC/B,gBAAgB,SAAS,IAAI,eAAe,IAAI,CAAC;EACnD,GAAG,EAAE,WAAW,KAAK,CAAC;EAEtB,MAAM,EAAE,aAAa,kBAAkB;EACvC,MAAM,cAAc,eAAe,SAAS,MAAM,OAAO,aAAa,OAAO;EAI7E,MAAM,cAAc,2BAAgC,IAAI,IAAI,CAAC;EAC7D,MAAM,kBAAkB,WAA0B,IAAI;EACtD,IAAI,iBAAiC;EAErC,SAAS,kBAAkB,OAAmB;GAC5C,MAAM,UAAU,MAAM,kBAAkB,UAAU,MAAM,OAAO,QAAQ,YAAY,IAAI;GACvF,IAAI,YAAY,gBAAgB;GAChC,iBAAiB;GACjB,MAAM,wBAAQ,IAAI,IAAa;GAC/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,cAES,CAFTJ,mBAES,UAAA;OAFD,MAAK;OAAU,OAAKO,eAAE,UAAU;OAAG,cAAYX,MAAA,CAAA,CAAC,CAAA,oBAAA;OAAyB,OAAOA,MAAA,CAAA,CAAC,CAAA,oBAAA;MACvF,GAAA,CAAAS,YAA+CT,MAAA,KAAA,GAAA;OAAxC,MAAK;OAAgB,OAAM"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { compositeKind } from "../kinds.js";
|
|
2
|
+
import { basketOf, titleHiddenOf } from "../baskets.js";
|
|
2
3
|
import { derivationOf } from "../derivation.js";
|
|
3
|
-
import { compositeKindsOf } from "../nodes.js";
|
|
4
|
+
import { compositeBasketsOf, compositeKindsOf } from "../nodes.js";
|
|
4
5
|
import { useStoreRef } from "../../../vue/store-ref.js";
|
|
5
6
|
import { computed, createBlock, createCommentVNode, createElementVNode, createVNode, defineComponent, normalizeClass, normalizeStyle, openBlock, unref, withCtx } from "vue";
|
|
6
7
|
import { NodeViewContent, NodeViewWrapper, nodeViewProps } from "@tiptap/vue-3";
|
|
@@ -16,9 +17,21 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
|
16
17
|
const id = props.node.attrs.id;
|
|
17
18
|
return typeof id === "string" && id !== "" && derivationOf(props.node) !== null && !expanded.value.has(id);
|
|
18
19
|
});
|
|
20
|
+
const basket = computed(() => basketOf(props.node));
|
|
21
|
+
const basketColor = computed(() => compositeBasketsOf(props.editor).find((candidate) => candidate.id === basket.value)?.color);
|
|
22
|
+
const kindTone = computed(() => kind.value.chrome?.tone || void 0);
|
|
23
|
+
const revealedTitles = useStoreRef(() => props.editor.storage.composite.revealedTitles);
|
|
24
|
+
const titleHidden = computed(() => {
|
|
25
|
+
const id = props.node.attrs.id;
|
|
26
|
+
return titleHiddenOf(props.node) && !(typeof id === "string" && revealedTitles.value.has(id));
|
|
27
|
+
});
|
|
19
28
|
/** `text` as a CSS string literal (for `content:`). */
|
|
20
29
|
const cssString = (text) => `"${text.replace(/["\\]/g, "\\$&").replace(/\n/g, "\\a ")}"`;
|
|
21
|
-
const placeholderVars = computed(() => ({
|
|
30
|
+
const placeholderVars = computed(() => ({
|
|
31
|
+
"--composite-title-placeholder": cssString(kind.value.titlePlaceholder),
|
|
32
|
+
...basketColor.value ? { "--sk-basket-color": basketColor.value } : {},
|
|
33
|
+
...kindTone.value ? { "--sk-kind-tone": kindTone.value } : {}
|
|
34
|
+
}));
|
|
22
35
|
return (_ctx, _cache) => {
|
|
23
36
|
return openBlock(), createBlock(unref(NodeViewWrapper), {
|
|
24
37
|
as: "section",
|
|
@@ -29,6 +42,9 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
|
29
42
|
"data-type": "composite",
|
|
30
43
|
"data-kind": _ctx.node.attrs.kind,
|
|
31
44
|
"data-id": _ctx.node.attrs.id || void 0,
|
|
45
|
+
"data-basket": basket.value || void 0,
|
|
46
|
+
"data-kind-tone": kindTone.value ? "" : void 0,
|
|
47
|
+
"data-title-hidden": titleHidden.value ? "" : void 0,
|
|
32
48
|
style: normalizeStyle(placeholderVars.value)
|
|
33
49
|
}, {
|
|
34
50
|
default: withCtx(() => [
|
|
@@ -45,6 +61,9 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
|
45
61
|
"class",
|
|
46
62
|
"data-kind",
|
|
47
63
|
"data-id",
|
|
64
|
+
"data-basket",
|
|
65
|
+
"data-kind-tone",
|
|
66
|
+
"data-title-hidden",
|
|
48
67
|
"style"
|
|
49
68
|
]);
|
|
50
69
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CompositeView.js","names":["selected","node","_openBlock","_createBlock","_unref","_normalizeClass","_normalizeStyle","_withCtx","_createCommentVNode","_createElementVNode","_createVNode"],"sources":["../../../../src/features/composites/components/CompositeView.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { NodeViewContent, NodeViewWrapper, nodeViewProps } from '@tiptap/vue-3'\nimport { computed } from 'vue'\nimport { compositeKind } from '../kinds'\nimport { compositeKindsOf } from '../nodes'\nimport { useStoreRef } from '../../../vue/store-ref'\nimport { derivationOf } from '../derivation'\n\nconst props = defineProps(nodeViewProps)\n\nconst kind = computed(() => compositeKind(compositeKindsOf(props.editor), String(props.node.attrs.kind)))\n\n// A derived Baustein (one with a `meta.derivation`) shows collapsed to a faded preview until it is opened; the content\n// stays laid out (CSS clips it), so editing positions are unaffected. The chrome's chevron and a caret inside open it.\nconst expanded = useStoreRef(() => props.editor.storage.composite.expanded)\nconst collapsed = computed(() => {\n const id: unknown = props.node.attrs.id\n return typeof id === 'string' && id !== '' && derivationOf(props.node) !== null && !expanded.value.has(id)\n})\n\n/** `text` as a CSS string literal (for `content:`). */\nconst cssString = (text: string) => `\"${text.replace(/[\"\\\\]/g, '\\\\$&').replace(/\\n/g, '\\\\a ')}\"`\n// Placeholder of the empty title (composites.css `content: var(…)`); a nested composite sets its own.\nconst placeholderVars = computed(() => ({\n '--composite-title-placeholder': cssString(kind.value.titlePlaceholder),\n}))\n</script>\n\n<template>\n <NodeViewWrapper\n as=\"section\"\n :class=\"['composite', { 'is-collapsed': collapsed, 'is-selected rounded-md ring-1 ring-[var(--sk-primary)]': selected }]\"\n data-type=\"composite\"\n :data-kind=\"node.attrs.kind\"\n :data-id=\"node.attrs.id || undefined\"\n :style=\"placeholderVars\"\n >\n <!-- Anchor of the kind icon on the left border: it only takes the icon's place and size. The composite chrome overlay\n measures it and draws the icon as the button that opens the details popover and drags the composite. -->\n <span class=\"composite__toggle\" contenteditable=\"false\" aria-hidden=\"true\" />\n <NodeViewContent class=\"composite__content\" />\n </NodeViewWrapper>\n</template>\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"CompositeView.js","names":["selected","node","_openBlock","_createBlock","_unref","_normalizeClass","_normalizeStyle","_withCtx","_createCommentVNode","_createElementVNode","_createVNode"],"sources":["../../../../src/features/composites/components/CompositeView.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { NodeViewContent, NodeViewWrapper, nodeViewProps } from '@tiptap/vue-3'\nimport { computed } from 'vue'\nimport { basketOf, titleHiddenOf } from '../baskets'\nimport { compositeKind } from '../kinds'\nimport { compositeBasketsOf, compositeKindsOf } from '../nodes'\nimport { useStoreRef } from '../../../vue/store-ref'\nimport { derivationOf } from '../derivation'\n\nconst props = defineProps(nodeViewProps)\n\nconst kind = computed(() => compositeKind(compositeKindsOf(props.editor), String(props.node.attrs.kind)))\n\n// A derived Baustein (one with a `meta.derivation`) shows collapsed to a faded preview until it is opened; the content\n// stays laid out (CSS clips it), so editing positions are unaffected. The chrome's chevron and a caret inside open it.\nconst expanded = useStoreRef(() => props.editor.storage.composite.expanded)\nconst collapsed = computed(() => {\n const id: unknown = props.node.attrs.id\n return typeof id === 'string' && id !== '' && derivationOf(props.node) !== null && !expanded.value.has(id)\n})\n\n// Colour basket (`meta.basket`): `data-basket` carries the id, the stripe takes the basket's colour from `--sk-basket-color`.\nconst basket = computed(() => basketOf(props.node))\nconst basketColor = computed(() => compositeBasketsOf(props.editor).find(candidate => candidate.id === basket.value)?.color)\n\n// Kind tone (`CompositeKind.chrome.tone`): `data-kind-tone` marks the wrapper, the surface reads the colour from `--sk-kind-tone`.\nconst kindTone = computed(() => kind.value.chrome?.tone || undefined)\n\n// A hidden title (`meta.titleHidden`) stays hidden until a caret enters it (`revealedTitles`, see `CompositeNode`).\nconst revealedTitles = useStoreRef(() => props.editor.storage.composite.revealedTitles)\nconst titleHidden = computed(() => {\n const id: unknown = props.node.attrs.id\n return titleHiddenOf(props.node) && !(typeof id === 'string' && revealedTitles.value.has(id))\n})\n\n/** `text` as a CSS string literal (for `content:`). */\nconst cssString = (text: string) => `\"${text.replace(/[\"\\\\]/g, '\\\\$&').replace(/\\n/g, '\\\\a ')}\"`\n// Placeholder of the empty title (composites.css `content: var(…)`); a nested composite sets its own.\nconst placeholderVars = computed(() => ({\n '--composite-title-placeholder': cssString(kind.value.titlePlaceholder),\n ...(basketColor.value ? { '--sk-basket-color': basketColor.value } : {}),\n ...(kindTone.value ? { '--sk-kind-tone': kindTone.value } : {}),\n}))\n</script>\n\n<template>\n <NodeViewWrapper\n as=\"section\"\n :class=\"['composite', { 'is-collapsed': collapsed, 'is-selected rounded-md ring-1 ring-[var(--sk-primary)]': selected }]\"\n data-type=\"composite\"\n :data-kind=\"node.attrs.kind\"\n :data-id=\"node.attrs.id || undefined\"\n :data-basket=\"basket || undefined\"\n :data-kind-tone=\"kindTone ? '' : undefined\"\n :data-title-hidden=\"titleHidden ? '' : undefined\"\n :style=\"placeholderVars\"\n >\n <!-- Anchor of the kind icon on the left border: it only takes the icon's place and size. The composite chrome overlay\n measures it and draws the icon as the button that opens the details popover and drags the composite. -->\n <span class=\"composite__toggle\" contenteditable=\"false\" aria-hidden=\"true\" />\n <NodeViewContent class=\"composite__content\" />\n </NodeViewWrapper>\n</template>\n"],"mappings":";;;;;;;;;;;;EASA,MAAM,QAAQ;EAEd,MAAM,OAAO,eAAe,cAAc,iBAAiB,MAAM,MAAM,GAAG,OAAO,MAAM,KAAK,MAAM,IAAI,CAAC,CAAC;EAIxG,MAAM,WAAW,kBAAkB,MAAM,OAAO,QAAQ,UAAU,QAAQ;EAC1E,MAAM,YAAY,eAAe;GAC/B,MAAM,KAAc,MAAM,KAAK,MAAM;GACrC,OAAO,OAAO,OAAO,YAAY,OAAO,MAAM,aAAa,MAAM,IAAI,MAAM,QAAQ,CAAC,SAAS,MAAM,IAAI,EAAE;EAC3G,CAAC;EAGD,MAAM,SAAS,eAAe,SAAS,MAAM,IAAI,CAAC;EAClD,MAAM,cAAc,eAAe,mBAAmB,MAAM,MAAM,CAAC,CAAC,MAAK,cAAa,UAAU,OAAO,OAAO,KAAK,CAAC,EAAE,KAAK;EAG3H,MAAM,WAAW,eAAe,KAAK,MAAM,QAAQ,QAAQ,KAAA,CAAS;EAGpE,MAAM,iBAAiB,kBAAkB,MAAM,OAAO,QAAQ,UAAU,cAAc;EACtF,MAAM,cAAc,eAAe;GACjC,MAAM,KAAc,MAAM,KAAK,MAAM;GACrC,OAAO,cAAc,MAAM,IAAI,KAAK,EAAE,OAAO,OAAO,YAAY,eAAe,MAAM,IAAI,EAAE;EAC7F,CAAC;;EAGD,MAAM,aAAa,SAAiB,IAAI,KAAK,QAAQ,UAAU,MAAM,CAAC,CAAC,QAAQ,OAAO,MAAM,EAAE;EAE9F,MAAM,kBAAkB,gBAAgB;GACtC,iCAAiC,UAAU,KAAK,MAAM,gBAAgB;GACtE,GAAI,YAAY,QAAQ,EAAE,qBAAqB,YAAY,MAAM,IAAI,CAAC;GACtE,GAAI,SAAS,QAAQ,EAAE,kBAAkB,SAAS,MAAM,IAAI,CAAC;EAC/D,EAAE;;GAIA,OAAAE,UAAA,GAAAC,YAekBC,MAAA,eAAA,GAAA;IAdhB,IAAG;IACF,OAAKC,eAAA,CAAA,aAAA;KAAA,gBAAkC,UAAA;KAAS,0DAA4DL,KAAAA;IAAQ,CAAA,CAAA;IACrH,aAAU;IACT,aAAWC,KAAAA,KAAK,MAAM;IACtB,WAASA,KAAAA,KAAK,MAAM,MAAM,KAAA;IAC1B,eAAa,OAAA,SAAU,KAAA;IACvB,kBAAgB,SAAA,QAAQ,KAAQ,KAAA;IAChC,qBAAmB,YAAA,QAAW,KAAQ,KAAA;IACtC,OAAKK,eAAE,gBAAA,KAAe;;IAEvB,SAAAC,cAC6G;KAD7GC,mBAAA,oOAAA;KAEA,OAAA,OAAA,OAAA,KAAAC,mBAA6E,QAAA;MAAvE,OAAM;MAAoB,iBAAgB;MAAQ,eAAY;;KACpEC,YAA8CN,MAAA,eAAA,GAAA,EAA7B,OAAM,qBAAoB,CAAA"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { derivationOf } from "../derivation.js";
|
|
2
2
|
import { useUiKit } from "../../../vue/kit/use-ui-kit.js";
|
|
3
3
|
import { useEditorI18n } from "../../../vue/use-editor-i18n.js";
|
|
4
|
-
import { derivationDetailsOf, derivationMethodLabel } from "../derived-chrome.js";
|
|
4
|
+
import { derivationDetailsOf, derivationIsForeign, derivationMethodLabel } from "../derived-chrome.js";
|
|
5
5
|
import { formatDate } from "../meta-display.js";
|
|
6
6
|
import { Fragment, computed, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, normalizeClass, openBlock, toDisplayString, unref } from "vue";
|
|
7
7
|
//#region src/features/composites/components/DerivationBadge.vue
|
|
@@ -44,6 +44,7 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
|
44
44
|
const derivation = computed(() => derivationOf(props.node));
|
|
45
45
|
const details = computed(() => props.detailed ? derivationDetailsOf(props.editor, props.node) : null);
|
|
46
46
|
const method = computed(() => derivation.value ? derivationMethodLabel(t, derivation.value.method) : "");
|
|
47
|
+
const foreign = computed(() => derivation.value ? derivationIsForeign(props.editor, derivation.value) : false);
|
|
47
48
|
const created = computed(() => derivation.value?.createdAt ? formatDate(derivation.value.createdAt) : "");
|
|
48
49
|
return (_ctx, _cache) => {
|
|
49
50
|
return derivation.value && !__props.detailed ? (openBlock(), createElementBlock("div", _hoisted_1, [createVNode(unref(UIcon), {
|
|
@@ -52,6 +53,7 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
|
52
53
|
}), createElementVNode("span", _hoisted_2, toDisplayString([
|
|
53
54
|
unref(t)("composites.derivation.badge"),
|
|
54
55
|
method.value,
|
|
56
|
+
foreign.value ? unref(t)("composites.derivation.foreign") : "",
|
|
55
57
|
created.value
|
|
56
58
|
].filter(Boolean).join(" · ")), 1)])) : derivation.value && details.value ? (openBlock(), createElementBlock("div", _hoisted_3, [
|
|
57
59
|
createElementVNode("div", _hoisted_4, [
|
|
@@ -59,15 +61,22 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
|
59
61
|
name: "i-lucide-git-branch",
|
|
60
62
|
class: "size-3.5"
|
|
61
63
|
}), createTextVNode(toDisplayString(unref(t)("composites.derivation.badge")), 1)], 2),
|
|
62
|
-
details.value.
|
|
64
|
+
details.value.foreign ? (openBlock(), createElementBlock("span", {
|
|
63
65
|
key: 0,
|
|
66
|
+
class: normalizeClass([chip, "text-[var(--sk-muted)]"])
|
|
67
|
+
}, [createVNode(unref(UIcon), {
|
|
68
|
+
name: "i-lucide-file-symlink",
|
|
69
|
+
class: "size-3.5"
|
|
70
|
+
}), createTextVNode(toDisplayString(unref(t)("composites.derivation.foreign")), 1)], 2)) : createCommentVNode("v-if", true),
|
|
71
|
+
details.value.stale ? (openBlock(), createElementBlock("span", {
|
|
72
|
+
key: 1,
|
|
64
73
|
class: normalizeClass([chip, "text-[var(--sk-warning)]"])
|
|
65
74
|
}, [createVNode(unref(UIcon), {
|
|
66
75
|
name: "i-lucide-triangle-alert",
|
|
67
76
|
class: "size-3.5"
|
|
68
77
|
}), createTextVNode(toDisplayString(unref(t)("composites.derivation.stale")), 1)], 2)) : createCommentVNode("v-if", true),
|
|
69
78
|
details.value.edited ? (openBlock(), createElementBlock("span", {
|
|
70
|
-
key:
|
|
79
|
+
key: 2,
|
|
71
80
|
class: normalizeClass([chip, "text-[var(--sk-muted)]"])
|
|
72
81
|
}, [createVNode(unref(UIcon), {
|
|
73
82
|
name: "i-lucide-pencil",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DerivationBadge.js","names":["_openBlock","_createElementBlock","_createVNode","_unref","_createElementVNode","_toDisplayString","_normalizeClass","_createTextVNode","_createCommentVNode","_Fragment"],"sources":["../../../../src/features/composites/components/DerivationBadge.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { Node as ProseMirrorNode } from '@tiptap/pm/model'\nimport type { Editor } from '@tiptap/core'\nimport { computed } from 'vue'\nimport { useUiKit } from '../../../vue/kit/use-ui-kit'\nimport { useEditorI18n } from '../../../vue/use-editor-i18n'\nimport { derivationOf } from '../derivation'\nimport { derivationDetailsOf, derivationMethodLabel } from '../derived-chrome'\nimport { formatDate } from '../meta-display'\n\n/**\n * Where a derived Baustein comes from. Compact (the `derivation` field type): the „abgeleitet“ badge with method and\n * date. `detailed` (the details card): also the model, whether the source changed („Quelle geändert“), whether the body\n * was edited since it was generated („bearbeitet“) and a link to the stored raw output. The detailed variant hashes\n * the body, so it belongs only where one Baustein is shown.\n */\nconst props = defineProps<{ editor: Editor, node: ProseMirrorNode, detailed?: boolean }>()\n\nconst { Icon: UIcon } = useUiKit()\nconst { t } = useEditorI18n()\n\nconst derivation = computed(() => derivationOf(props.node))\nconst details = computed(() => props.detailed ? derivationDetailsOf(props.editor, props.node) : null)\nconst method = computed(() => derivation.value ? derivationMethodLabel(t, derivation.value.method) : '')\nconst created = computed(() => derivation.value?.createdAt ? formatDate(derivation.value.createdAt) : '')\n\nconst chip = 'inline-flex h-5 shrink-0 items-center gap-1 rounded-sm px-1.5 text-xs leading-none whitespace-nowrap'\n</script>\n\n<template>\n <div v-if=\"derivation && !detailed\" class=\"flex min-w-0 items-center gap-1.5 text-xs text-[var(--sk-muted)]\">\n <UIcon name=\"i-lucide-git-branch\" class=\"size-3.5 shrink-0\" />\n <span class=\"truncate\">{{ [t('composites.derivation.badge'), method, created].filter(Boolean).join(' · ') }}</span>\n </div>\n\n <div v-else-if=\"derivation && details\" class=\"flex flex-col gap-1.5 rounded-md p-2 text-xs ring ring-[var(--sk-border)]\">\n <div class=\"flex flex-wrap items-center gap-1\">\n <span :class=\"[chip, 'text-[var(--sk-muted)]']\">\n <UIcon name=\"i-lucide-git-branch\" class=\"size-3.5\" />{{ t('composites.derivation.badge') }}\n </span>\n <span v-if=\"details.stale\" :class=\"[chip, 'text-[var(--sk-warning)]']\">\n <UIcon name=\"i-lucide-triangle-alert\" class=\"size-3.5\" />{{ t('composites.derivation.stale') }}\n </span>\n <span v-if=\"details.edited\" :class=\"[chip, 'text-[var(--sk-muted)]']\">\n <UIcon name=\"i-lucide-pencil\" class=\"size-3.5\" />{{ t('composites.derivation.edited') }}\n </span>\n </div>\n <dl class=\"grid grid-cols-[auto_1fr] gap-x-2 gap-y-0.5\">\n <dt class=\"text-[var(--sk-muted)]\">{{ t('composites.derivation.method') }}</dt>\n <dd class=\"truncate text-[var(--sk-fg)]\">{{ method }}</dd>\n <template v-if=\"derivation.model\">\n <dt class=\"text-[var(--sk-muted)]\">{{ t('composites.derivation.model') }}</dt>\n <dd class=\"truncate text-[var(--sk-fg)]\" :title=\"derivation.model\">{{ derivation.model }}</dd>\n </template>\n <template v-if=\"created\">\n <dt class=\"text-[var(--sk-muted)]\">{{ t('composites.derivation.createdAt') }}</dt>\n <dd class=\"text-[var(--sk-fg)]\">{{ created }}</dd>\n </template>\n </dl>\n <a\n v-if=\"details.outputUrl\"\n :href=\"details.outputUrl\"\n target=\"_blank\"\n rel=\"noopener\"\n class=\"inline-flex w-fit items-center gap-1 text-[var(--sk-primary)] hover:underline\"\n >\n <UIcon name=\"i-lucide-external-link\" class=\"size-3.5\" />{{ t('composites.derivation.openOutput') }}\n </a>\n </div>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"DerivationBadge.js","names":["_openBlock","_createElementBlock","_createVNode","_unref","_createElementVNode","_toDisplayString","_normalizeClass","_createTextVNode","_createCommentVNode","_Fragment"],"sources":["../../../../src/features/composites/components/DerivationBadge.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { Node as ProseMirrorNode } from '@tiptap/pm/model'\nimport type { Editor } from '@tiptap/core'\nimport { computed } from 'vue'\nimport { useUiKit } from '../../../vue/kit/use-ui-kit'\nimport { useEditorI18n } from '../../../vue/use-editor-i18n'\nimport { derivationOf } from '../derivation'\nimport { derivationDetailsOf, derivationIsForeign, derivationMethodLabel } from '../derived-chrome'\nimport { formatDate } from '../meta-display'\n\n/**\n * Where a derived Baustein comes from. Compact (the `derivation` field type): the „abgeleitet“ badge with method and\n * date. `detailed` (the details card): also the model, whether the source changed („Quelle geändert“), whether the body\n * was edited since it was generated („bearbeitet“) and a link to the stored raw output. The detailed variant hashes\n * the body, so it belongs only where one Baustein is shown.\n */\nconst props = defineProps<{ editor: Editor, node: ProseMirrorNode, detailed?: boolean }>()\n\nconst { Icon: UIcon } = useUiKit()\nconst { t } = useEditorI18n()\n\nconst derivation = computed(() => derivationOf(props.node))\nconst details = computed(() => props.detailed ? derivationDetailsOf(props.editor, props.node) : null)\nconst method = computed(() => derivation.value ? derivationMethodLabel(t, derivation.value.method) : '')\nconst foreign = computed(() => derivation.value ? derivationIsForeign(props.editor, derivation.value) : false)\nconst created = computed(() => derivation.value?.createdAt ? formatDate(derivation.value.createdAt) : '')\n\nconst chip = 'inline-flex h-5 shrink-0 items-center gap-1 rounded-sm px-1.5 text-xs leading-none whitespace-nowrap'\n</script>\n\n<template>\n <div v-if=\"derivation && !detailed\" class=\"flex min-w-0 items-center gap-1.5 text-xs text-[var(--sk-muted)]\">\n <UIcon name=\"i-lucide-git-branch\" class=\"size-3.5 shrink-0\" />\n <span class=\"truncate\">{{ [t('composites.derivation.badge'), method, foreign ? t('composites.derivation.foreign') : '', created].filter(Boolean).join(' · ') }}</span>\n </div>\n\n <div v-else-if=\"derivation && details\" class=\"flex flex-col gap-1.5 rounded-md p-2 text-xs ring ring-[var(--sk-border)]\">\n <div class=\"flex flex-wrap items-center gap-1\">\n <span :class=\"[chip, 'text-[var(--sk-muted)]']\">\n <UIcon name=\"i-lucide-git-branch\" class=\"size-3.5\" />{{ t('composites.derivation.badge') }}\n </span>\n <span v-if=\"details.foreign\" :class=\"[chip, 'text-[var(--sk-muted)]']\">\n <UIcon name=\"i-lucide-file-symlink\" class=\"size-3.5\" />{{ t('composites.derivation.foreign') }}\n </span>\n <span v-if=\"details.stale\" :class=\"[chip, 'text-[var(--sk-warning)]']\">\n <UIcon name=\"i-lucide-triangle-alert\" class=\"size-3.5\" />{{ t('composites.derivation.stale') }}\n </span>\n <span v-if=\"details.edited\" :class=\"[chip, 'text-[var(--sk-muted)]']\">\n <UIcon name=\"i-lucide-pencil\" class=\"size-3.5\" />{{ t('composites.derivation.edited') }}\n </span>\n </div>\n <dl class=\"grid grid-cols-[auto_1fr] gap-x-2 gap-y-0.5\">\n <dt class=\"text-[var(--sk-muted)]\">{{ t('composites.derivation.method') }}</dt>\n <dd class=\"truncate text-[var(--sk-fg)]\">{{ method }}</dd>\n <template v-if=\"derivation.model\">\n <dt class=\"text-[var(--sk-muted)]\">{{ t('composites.derivation.model') }}</dt>\n <dd class=\"truncate text-[var(--sk-fg)]\" :title=\"derivation.model\">{{ derivation.model }}</dd>\n </template>\n <template v-if=\"created\">\n <dt class=\"text-[var(--sk-muted)]\">{{ t('composites.derivation.createdAt') }}</dt>\n <dd class=\"text-[var(--sk-fg)]\">{{ created }}</dd>\n </template>\n </dl>\n <a\n v-if=\"details.outputUrl\"\n :href=\"details.outputUrl\"\n target=\"_blank\"\n rel=\"noopener\"\n class=\"inline-flex w-fit items-center gap-1 text-[var(--sk-primary)] hover:underline\"\n >\n <UIcon name=\"i-lucide-external-link\" class=\"size-3.5\" />{{ t('composites.derivation.openOutput') }}\n </a>\n </div>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BA,MAAM,OAAO;;;;;;;;;EAXb,MAAM,QAAQ;EAEd,MAAM,EAAE,MAAM,UAAU,SAAS;EACjC,MAAM,EAAE,MAAM,cAAc;EAE5B,MAAM,aAAa,eAAe,aAAa,MAAM,IAAI,CAAC;EAC1D,MAAM,UAAU,eAAe,MAAM,WAAW,oBAAoB,MAAM,QAAQ,MAAM,IAAI,IAAI,IAAI;EACpG,MAAM,SAAS,eAAe,WAAW,QAAQ,sBAAsB,GAAG,WAAW,MAAM,MAAM,IAAI,EAAE;EACvG,MAAM,UAAU,eAAe,WAAW,QAAQ,oBAAoB,MAAM,QAAQ,WAAW,KAAK,IAAI,KAAK;EAC7G,MAAM,UAAU,eAAe,WAAW,OAAO,YAAY,WAAW,WAAW,MAAM,SAAS,IAAI,EAAE;;GAM3F,OAAA,WAAA,SAAU,CAAK,QAAA,YAA1BA,UAAA,GAAAC,mBAGM,OAHN,YAGM,CAFJC,YAA8DC,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AAC,YAAwDC,MAAA,KAAA,GAAA;KAAjD,MAAK;KAAyB,OAAM;IAAgB,CAAA,GAAAI,gBAAAF,gBAAAF,MAAA,CAAA,CAAC,CAAA,kCAAA,CAAA,GAAA,CAAA,CAAA,GAAA,GAAA,WAAA,KAAAK,mBAAA,QAAA,IAAA"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { findBlockById } from "../../../core/schema/block-ids.js";
|
|
2
|
+
import { useUiKit } from "../../../vue/kit/use-ui-kit.js";
|
|
3
|
+
import { useEditorI18n } from "../../../vue/use-editor-i18n.js";
|
|
4
|
+
import { compositeFocusOf } from "../focus.js";
|
|
5
|
+
import { computed, createCommentVNode, createElementBlock, createElementVNode, createVNode, defineComponent, openBlock, toDisplayString, unref } from "vue";
|
|
6
|
+
//#region src/features/composites/components/FocusChip.vue
|
|
7
|
+
const _hoisted_1 = {
|
|
8
|
+
key: 0,
|
|
9
|
+
class: "fixed bottom-4 left-1/2 z-20 flex max-w-[90vw] -translate-x-1/2 items-center gap-2 rounded-full border border-[var(--sk-border)] bg-[var(--sk-bg)] py-1 pl-3 pr-1 shadow-lg",
|
|
10
|
+
role: "status"
|
|
11
|
+
};
|
|
12
|
+
const _hoisted_2 = { class: "truncate text-sm" };
|
|
13
|
+
/**
|
|
14
|
+
* Focus mode indicator (mounted by the composites feature): while a Baustein is focused (`focusComposite`) a small chip
|
|
15
|
+
* fixed at the bottom of the surface names it and leaves focus mode.
|
|
16
|
+
*/
|
|
17
|
+
const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
18
|
+
__name: "FocusChip",
|
|
19
|
+
props: { editor: {} },
|
|
20
|
+
setup(__props) {
|
|
21
|
+
const props = __props;
|
|
22
|
+
const { Button: UButton, Icon: UIcon } = useUiKit();
|
|
23
|
+
const { t } = useEditorI18n();
|
|
24
|
+
const focused = computed(() => {
|
|
25
|
+
if (props.editor.isDestroyed) return null;
|
|
26
|
+
const id = compositeFocusOf(props.editor.state);
|
|
27
|
+
const found = id ? findBlockById(props.editor.state.doc, id) : null;
|
|
28
|
+
return found ? { title: found.node.child(0).textContent.trim() || t("composites.untitled") } : null;
|
|
29
|
+
});
|
|
30
|
+
return (_ctx, _cache) => {
|
|
31
|
+
return focused.value ? (openBlock(), createElementBlock("div", _hoisted_1, [
|
|
32
|
+
createVNode(unref(UIcon), {
|
|
33
|
+
name: "i-lucide-focus",
|
|
34
|
+
class: "size-4 shrink-0 text-[var(--sk-primary)]"
|
|
35
|
+
}),
|
|
36
|
+
createElementVNode("span", _hoisted_2, toDisplayString(unref(t)("composites.focus.chip", { title: focused.value.title })), 1),
|
|
37
|
+
createVNode(unref(UButton), {
|
|
38
|
+
size: "xs",
|
|
39
|
+
color: "neutral",
|
|
40
|
+
variant: "ghost",
|
|
41
|
+
icon: "i-lucide-x",
|
|
42
|
+
label: unref(t)("composites.focus.release"),
|
|
43
|
+
"aria-label": unref(t)("composites.focus.leave"),
|
|
44
|
+
onClick: _cache[0] || (_cache[0] = ($event) => __props.editor.commands.focusComposite(null))
|
|
45
|
+
}, null, 8, ["label", "aria-label"])
|
|
46
|
+
])) : createCommentVNode("v-if", true);
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
//#endregion
|
|
51
|
+
export { _sfc_main as default };
|
|
52
|
+
|
|
53
|
+
//# sourceMappingURL=FocusChip.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FocusChip.js","names":["_openBlock","_createElementBlock","_createVNode","_unref","_createElementVNode","_toDisplayString","_createCommentVNode"],"sources":["../../../../src/features/composites/components/FocusChip.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { Editor } from '@tiptap/vue-3'\nimport { computed } from 'vue'\nimport { findBlockById } from '../../../core/schema'\nimport { useUiKit } from '../../../vue/kit/use-ui-kit'\nimport { useEditorI18n } from '../../../vue/use-editor-i18n'\nimport { compositeFocusOf } from '../focus'\n\n/**\n * Focus mode indicator (mounted by the composites feature): while a Baustein is focused (`focusComposite`) a small chip\n * fixed at the bottom of the surface names it and leaves focus mode.\n */\nconst props = defineProps<{ editor: Editor }>()\n\nconst { Button: UButton, Icon: UIcon } = useUiKit()\nconst { t } = useEditorI18n()\n\n// The vue-3 Editor's `state` is reactive, so this follows every transaction.\nconst focused = computed(() => {\n if (props.editor.isDestroyed) return null\n const id = compositeFocusOf(props.editor.state)\n const found = id ? findBlockById(props.editor.state.doc, id) : null\n return found ? { title: found.node.child(0).textContent.trim() || t('composites.untitled') } : null\n})\n</script>\n\n<template>\n <div\n v-if=\"focused\"\n class=\"fixed bottom-4 left-1/2 z-20 flex max-w-[90vw] -translate-x-1/2 items-center gap-2 rounded-full border border-[var(--sk-border)] bg-[var(--sk-bg)] py-1 pl-3 pr-1 shadow-lg\"\n role=\"status\"\n >\n <UIcon name=\"i-lucide-focus\" class=\"size-4 shrink-0 text-[var(--sk-primary)]\" />\n <span class=\"truncate text-sm\">{{ t('composites.focus.chip', { title: focused.title }) }}</span>\n <UButton size=\"xs\" color=\"neutral\" variant=\"ghost\" icon=\"i-lucide-x\" :label=\"t('composites.focus.release')\" :aria-label=\"t('composites.focus.leave')\" @click=\"editor.commands.focusComposite(null)\" />\n </div>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;EAYA,MAAM,QAAQ;EAEd,MAAM,EAAE,QAAQ,SAAS,MAAM,UAAU,SAAS;EAClD,MAAM,EAAE,MAAM,cAAc;EAG5B,MAAM,UAAU,eAAe;GAC7B,IAAI,MAAM,OAAO,aAAa,OAAO;GACrC,MAAM,KAAK,iBAAiB,MAAM,OAAO,KAAK;GAC9C,MAAM,QAAQ,KAAK,cAAc,MAAM,OAAO,MAAM,KAAK,EAAE,IAAI;GAC/D,OAAO,QAAQ,EAAE,OAAO,MAAM,KAAK,MAAM,CAAC,CAAC,CAAC,YAAY,KAAK,KAAK,EAAE,qBAAqB,EAAE,IAAI;EACjG,CAAC;;GAKS,OAAA,QAAA,SADRA,UAAA,GAAAC,mBAQM,OARN,YAQM;IAHJC,YAAgFC,MAAA,KAAA,GAAA;KAAzE,MAAK;KAAiB,OAAM;;IACnCC,mBAAgG,QAAhG,YAAgGC,gBAA9DF,MAAA,CAAA,CAAC,CAAA,yBAAA,EAAA,OAAmC,QAAA,MAAQ,MAAK,CAAA,CAAA,GAAA,CAAA;IACnFD,YAAsMC,MAAA,OAAA,GAAA;KAA7L,MAAK;KAAK,OAAM;KAAU,SAAQ;KAAQ,MAAK;KAAc,OAAOA,MAAA,CAAA,CAAC,CAAA,0BAAA;KAA+B,cAAYA,MAAA,CAAA,CAAC,CAAA,wBAAA;KAA6B,SAAK,OAAA,OAAA,OAAA,MAAA,WAAE,QAAA,OAAO,SAAS,eAAc,IAAA"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Editor } from "@tiptap/vue-3";
|
|
2
|
+
//#region src/features/composites/components/FocusChip.vue.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* Focus mode indicator (mounted by the composites feature): while a Baustein is focused (`focusComposite`) a small chip
|
|
5
|
+
* fixed at the bottom of the surface names it and leaves focus mode.
|
|
6
|
+
*/
|
|
7
|
+
type __VLS_Props = {
|
|
8
|
+
editor: Editor;
|
|
9
|
+
};
|
|
10
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
11
|
+
declare const _default: typeof __VLS_export;
|
|
12
|
+
//#endregion
|
|
13
|
+
export { _default as default };
|
|
14
|
+
//# sourceMappingURL=FocusChip.vue.d.ts.map
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { DRAG_HANDLE_VISIBILITIES, HEADING_CONVERSION_SCOPES, KIND_ICON_VISIBILITIES, STRUCTURE_MODES, TREE_ROOTS } from "../../../settings/values.js";
|
|
2
|
+
import { SPLIT_TARGET_CHARS_MAX, clampSplitTargetChars } from "../../../settings/index.js";
|
|
2
3
|
import { useUiKit } from "../../../vue/kit/use-ui-kit.js";
|
|
3
4
|
import { useEditorSettings } from "../../../vue/settings.js";
|
|
4
5
|
import { useEditorI18n } from "../../../vue/use-editor-i18n.js";
|
|
@@ -6,7 +7,7 @@ import { STRUCTURE_MODE_KEYS } from "../structure-mode.js";
|
|
|
6
7
|
import { DRAG_HANDLE_KEYS, HEADING_SCOPE_KEYS, KIND_ICON_KEYS, optionItems } from "../editing-settings-keys.js";
|
|
7
8
|
import { TREE_ROOT_KEYS } from "../tree-root.js";
|
|
8
9
|
import _sfc_main$1 from "../../../vue/components/SettingsSection.js";
|
|
9
|
-
import { computed, createElementBlock, createElementVNode, createVNode, defineComponent, openBlock, unref, withCtx } from "vue";
|
|
10
|
+
import { computed, createElementBlock, createElementVNode, createVNode, defineComponent, openBlock, ref, unref, watch, withCtx, withKeys } from "vue";
|
|
10
11
|
//#region src/features/composites/components/SettingsEditingTab.vue
|
|
11
12
|
const _hoisted_1 = { class: "flex flex-col gap-8" };
|
|
12
13
|
const _hoisted_2 = { class: "py-3" };
|
|
@@ -20,7 +21,7 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
|
20
21
|
props: { kinds: {} },
|
|
21
22
|
setup(__props) {
|
|
22
23
|
const props = __props;
|
|
23
|
-
const { FormField: UFormField, RadioGroup: URadioGroup, Select: USelect } = useUiKit();
|
|
24
|
+
const { FormField: UFormField, Input: UInput, RadioGroup: URadioGroup, Select: USelect } = useUiKit();
|
|
24
25
|
const { t } = useEditorI18n();
|
|
25
26
|
const { settings } = useEditorSettings();
|
|
26
27
|
const scopeItems = computed(() => optionItems(HEADING_CONVERSION_SCOPES, HEADING_SCOPE_KEYS, t));
|
|
@@ -33,6 +34,15 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
|
33
34
|
icon: kind.icon,
|
|
34
35
|
value: kind.id
|
|
35
36
|
})));
|
|
37
|
+
const splitTarget = ref(String(settings.value.blocks.splitTargetChars));
|
|
38
|
+
watch(() => settings.value.blocks.splitTargetChars, (value) => {
|
|
39
|
+
splitTarget.value = String(value);
|
|
40
|
+
});
|
|
41
|
+
function commitSplitTarget() {
|
|
42
|
+
const next = clampSplitTargetChars(splitTarget.value, settings.value.blocks.splitTargetChars);
|
|
43
|
+
settings.value.blocks.splitTargetChars = next;
|
|
44
|
+
splitTarget.value = String(next);
|
|
45
|
+
}
|
|
36
46
|
return (_ctx, _cache) => {
|
|
37
47
|
return openBlock(), createElementBlock("div", _hoisted_1, [
|
|
38
48
|
createVNode(_sfc_main$1, { title: unref(t)("composites.settings.structure.title") }, {
|
|
@@ -86,9 +96,35 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
|
86
96
|
}, null, 8, ["modelValue", "items"])]),
|
|
87
97
|
_: 1
|
|
88
98
|
}, 8, ["label", "description"]),
|
|
99
|
+
createVNode(unref(UFormField), {
|
|
100
|
+
orientation: "horizontal",
|
|
101
|
+
class: "py-3",
|
|
102
|
+
label: unref(t)("settings.editing.splitTargetChars")
|
|
103
|
+
}, {
|
|
104
|
+
default: withCtx(() => [createVNode(unref(UInput), {
|
|
105
|
+
"model-value": splitTarget.value,
|
|
106
|
+
type: "number",
|
|
107
|
+
min: unref(200),
|
|
108
|
+
max: unref(SPLIT_TARGET_CHARS_MAX),
|
|
109
|
+
step: 100,
|
|
110
|
+
"aria-label": unref(t)("settings.editing.splitTargetChars"),
|
|
111
|
+
class: "w-32",
|
|
112
|
+
onBlur: commitSplitTarget,
|
|
113
|
+
onKeydown: withKeys(commitSplitTarget, ["enter"]),
|
|
114
|
+
"onUpdate:modelValue": _cache[4] || (_cache[4] = (value) => {
|
|
115
|
+
splitTarget.value = String(value);
|
|
116
|
+
})
|
|
117
|
+
}, null, 8, [
|
|
118
|
+
"model-value",
|
|
119
|
+
"min",
|
|
120
|
+
"max",
|
|
121
|
+
"aria-label"
|
|
122
|
+
])]),
|
|
123
|
+
_: 1
|
|
124
|
+
}, 8, ["label"]),
|
|
89
125
|
createElementVNode("div", _hoisted_5, [createVNode(unref(URadioGroup), {
|
|
90
126
|
modelValue: unref(settings).blocks.kindIcon,
|
|
91
|
-
"onUpdate:modelValue": _cache[
|
|
127
|
+
"onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => unref(settings).blocks.kindIcon = $event),
|
|
92
128
|
legend: unref(t)("composites.settings.kindIcon.legend"),
|
|
93
129
|
items: kindIconItems.value
|
|
94
130
|
}, null, 8, [
|
|
@@ -98,7 +134,7 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
|
98
134
|
])]),
|
|
99
135
|
createElementVNode("div", _hoisted_6, [createVNode(unref(URadioGroup), {
|
|
100
136
|
modelValue: unref(settings).blocks.dragHandle,
|
|
101
|
-
"onUpdate:modelValue": _cache[
|
|
137
|
+
"onUpdate:modelValue": _cache[6] || (_cache[6] = ($event) => unref(settings).blocks.dragHandle = $event),
|
|
102
138
|
legend: unref(t)("composites.settings.dragHandle.legend"),
|
|
103
139
|
items: dragHandleItems.value
|
|
104
140
|
}, null, 8, [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SettingsEditingTab.js","names":["_openBlock","_createElementBlock","_createVNode","SettingsSection","_unref","_withCtx","_createElementVNode"],"sources":["../../../../src/features/composites/components/SettingsEditingTab.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed } from 'vue'\nimport SettingsSection from '../../../vue/components/SettingsSection.vue'\nimport { useUiKit } from '../../../vue/kit/use-ui-kit'\nimport { useEditorSettings } from '../../../vue/settings'\nimport { useEditorI18n } from '../../../vue/use-editor-i18n'\nimport { DRAG_HANDLE_VISIBILITIES, HEADING_CONVERSION_SCOPES, KIND_ICON_VISIBILITIES, STRUCTURE_MODES, TREE_ROOTS } from '../../../settings'\nimport { DRAG_HANDLE_KEYS, HEADING_SCOPE_KEYS, KIND_ICON_KEYS, optionItems } from '../editing-settings-keys'\nimport type { CompositeKind } from '../kinds'\nimport { STRUCTURE_MODE_KEYS } from '../structure-mode'\nimport { TREE_ROOT_KEYS } from '../tree-root'\n\n/** „Bearbeiten“: Gliederung (structure mode, conversion scope), Bausteine defaults and the visibility of the block handles. */\nconst props = defineProps<{ kinds: readonly CompositeKind[] }>()\n\nconst { FormField: UFormField, RadioGroup: URadioGroup, Select: USelect } = useUiKit()\nconst { t } = useEditorI18n()\n\nconst { settings } = useEditorSettings()\n\nconst scopeItems = computed(() => optionItems(HEADING_CONVERSION_SCOPES, HEADING_SCOPE_KEYS, t))\nconst structureItems = computed(() => optionItems(STRUCTURE_MODES, STRUCTURE_MODE_KEYS, t))\nconst treeRootItems = computed(() => optionItems(TREE_ROOTS, TREE_ROOT_KEYS, t))\nconst kindIconItems = computed(() => optionItems(KIND_ICON_VISIBILITIES, KIND_ICON_KEYS, t))\nconst dragHandleItems = computed(() => optionItems(DRAG_HANDLE_VISIBILITIES, DRAG_HANDLE_KEYS, t))\n\nconst kindItems = computed(() => props.kinds.map(kind => ({ label: kind.label, icon: kind.icon, value: kind.id })))\n</script>\n\n<template>\n <div class=\"flex flex-col gap-8\">\n <SettingsSection :title=\"t('composites.settings.structure.title')\">\n <div class=\"py-3\">\n <URadioGroup v-model=\"settings.blocks.structure\" :legend=\"t('composites.settings.structure.legend')\" :items=\"structureItems\" />\n </div>\n <div class=\"py-3\">\n <URadioGroup\n v-model=\"settings.editing.headingConversionScope\"\n :legend=\"t('composites.settings.scope.legend')\"\n :items=\"scopeItems\"\n />\n </div>\n </SettingsSection>\n\n <SettingsSection :title=\"t('composites.settings.sidebar.title')\">\n <div class=\"py-3\">\n <URadioGroup v-model=\"settings.blocks.treeRoot\" :legend=\"t('composites.settings.treeRoot.legend')\" :items=\"treeRootItems\" />\n </div>\n </SettingsSection>\n\n <SettingsSection :title=\"t('composites.settings.composites.title')\">\n <UFormField\n orientation=\"horizontal\"\n class=\"py-3\"\n :label=\"t('composites.settings.defaultKind.label')\"\n :description=\"t('composites.settings.defaultKind.description')\"\n >\n <USelect v-model=\"settings.blocks.defaultKind\" :items=\"kindItems\" class=\"w-64\" />\n </UFormField>\n <div class=\"py-3\">\n <URadioGroup v-model=\"settings.blocks.kindIcon\" :legend=\"t('composites.settings.kindIcon.legend')\" :items=\"kindIconItems\" />\n </div>\n <div class=\"py-3\">\n <URadioGroup v-model=\"settings.blocks.dragHandle\" :legend=\"t('composites.settings.dragHandle.legend')\" :items=\"dragHandleItems\" />\n </div>\n </SettingsSection>\n </div>\n</template>\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"SettingsEditingTab.js","names":["_openBlock","_createElementBlock","_createVNode","SettingsSection","_unref","_withCtx","_createElementVNode","_withKeys"],"sources":["../../../../src/features/composites/components/SettingsEditingTab.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed, ref, watch } from 'vue'\nimport SettingsSection from '../../../vue/components/SettingsSection.vue'\nimport { useUiKit } from '../../../vue/kit/use-ui-kit'\nimport { useEditorSettings } from '../../../vue/settings'\nimport { useEditorI18n } from '../../../vue/use-editor-i18n'\nimport { clampSplitTargetChars, DRAG_HANDLE_VISIBILITIES, HEADING_CONVERSION_SCOPES, KIND_ICON_VISIBILITIES, SPLIT_TARGET_CHARS_MAX, SPLIT_TARGET_CHARS_MIN, STRUCTURE_MODES, TREE_ROOTS } from '../../../settings'\nimport { DRAG_HANDLE_KEYS, HEADING_SCOPE_KEYS, KIND_ICON_KEYS, optionItems } from '../editing-settings-keys'\nimport type { CompositeKind } from '../kinds'\nimport { STRUCTURE_MODE_KEYS } from '../structure-mode'\nimport { TREE_ROOT_KEYS } from '../tree-root'\n\n/** „Bearbeiten“: Gliederung (structure mode, conversion scope), Bausteine defaults and the visibility of the block handles. */\nconst props = defineProps<{ kinds: readonly CompositeKind[] }>()\n\nconst { FormField: UFormField, Input: UInput, RadioGroup: URadioGroup, Select: USelect } = useUiKit()\nconst { t } = useEditorI18n()\n\nconst { settings } = useEditorSettings()\n\nconst scopeItems = computed(() => optionItems(HEADING_CONVERSION_SCOPES, HEADING_SCOPE_KEYS, t))\nconst structureItems = computed(() => optionItems(STRUCTURE_MODES, STRUCTURE_MODE_KEYS, t))\nconst treeRootItems = computed(() => optionItems(TREE_ROOTS, TREE_ROOT_KEYS, t))\nconst kindIconItems = computed(() => optionItems(KIND_ICON_VISIBILITIES, KIND_ICON_KEYS, t))\nconst dragHandleItems = computed(() => optionItems(DRAG_HANDLE_VISIBILITIES, DRAG_HANDLE_KEYS, t))\n\nconst kindItems = computed(() => props.kinds.map(kind => ({ label: kind.label, icon: kind.icon, value: kind.id })))\n\n// The target size is edited as text and written back clamped to its range when the field is left, so a half-typed number never reaches the settings.\nconst splitTarget = ref(String(settings.value.blocks.splitTargetChars))\nwatch(() => settings.value.blocks.splitTargetChars, (value) => { splitTarget.value = String(value) })\nfunction commitSplitTarget() {\n const next = clampSplitTargetChars(splitTarget.value, settings.value.blocks.splitTargetChars)\n settings.value.blocks.splitTargetChars = next\n splitTarget.value = String(next)\n}\n</script>\n\n<template>\n <div class=\"flex flex-col gap-8\">\n <SettingsSection :title=\"t('composites.settings.structure.title')\">\n <div class=\"py-3\">\n <URadioGroup v-model=\"settings.blocks.structure\" :legend=\"t('composites.settings.structure.legend')\" :items=\"structureItems\" />\n </div>\n <div class=\"py-3\">\n <URadioGroup\n v-model=\"settings.editing.headingConversionScope\"\n :legend=\"t('composites.settings.scope.legend')\"\n :items=\"scopeItems\"\n />\n </div>\n </SettingsSection>\n\n <SettingsSection :title=\"t('composites.settings.sidebar.title')\">\n <div class=\"py-3\">\n <URadioGroup v-model=\"settings.blocks.treeRoot\" :legend=\"t('composites.settings.treeRoot.legend')\" :items=\"treeRootItems\" />\n </div>\n </SettingsSection>\n\n <SettingsSection :title=\"t('composites.settings.composites.title')\">\n <UFormField\n orientation=\"horizontal\"\n class=\"py-3\"\n :label=\"t('composites.settings.defaultKind.label')\"\n :description=\"t('composites.settings.defaultKind.description')\"\n >\n <USelect v-model=\"settings.blocks.defaultKind\" :items=\"kindItems\" class=\"w-64\" />\n </UFormField>\n <UFormField orientation=\"horizontal\" class=\"py-3\" :label=\"t('settings.editing.splitTargetChars')\">\n <UInput\n :model-value=\"splitTarget\"\n type=\"number\"\n :min=\"SPLIT_TARGET_CHARS_MIN\"\n :max=\"SPLIT_TARGET_CHARS_MAX\"\n :step=\"100\"\n :aria-label=\"t('settings.editing.splitTargetChars')\"\n class=\"w-32\"\n @blur=\"commitSplitTarget\"\n @keydown.enter=\"commitSplitTarget\"\n @update:model-value=\"(value: unknown) => { splitTarget = String(value) }\"\n />\n </UFormField>\n <div class=\"py-3\">\n <URadioGroup v-model=\"settings.blocks.kindIcon\" :legend=\"t('composites.settings.kindIcon.legend')\" :items=\"kindIconItems\" />\n </div>\n <div class=\"py-3\">\n <URadioGroup v-model=\"settings.blocks.dragHandle\" :legend=\"t('composites.settings.dragHandle.legend')\" :items=\"dragHandleItems\" />\n </div>\n </SettingsSection>\n </div>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;EAaA,MAAM,QAAQ;EAEd,MAAM,EAAE,WAAW,YAAY,OAAO,QAAQ,YAAY,aAAa,QAAQ,YAAY,SAAS;EACpG,MAAM,EAAE,MAAM,cAAc;EAE5B,MAAM,EAAE,aAAa,kBAAkB;EAEvC,MAAM,aAAa,eAAe,YAAY,2BAA2B,oBAAoB,CAAC,CAAC;EAC/F,MAAM,iBAAiB,eAAe,YAAY,iBAAiB,qBAAqB,CAAC,CAAC;EAC1F,MAAM,gBAAgB,eAAe,YAAY,YAAY,gBAAgB,CAAC,CAAC;EAC/E,MAAM,gBAAgB,eAAe,YAAY,wBAAwB,gBAAgB,CAAC,CAAC;EAC3F,MAAM,kBAAkB,eAAe,YAAY,0BAA0B,kBAAkB,CAAC,CAAC;EAEjG,MAAM,YAAY,eAAe,MAAM,MAAM,KAAI,UAAS;GAAE,OAAO,KAAK;GAAO,MAAM,KAAK;GAAM,OAAO,KAAK;EAAG,EAAE,CAAC;EAGlH,M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AA,CAAA,CAAC,CAAA,qCAAA;OAA0C,OAAO,cAAA;;;;;;MAE7GE,mBAEM,OAFN,YAEM,CADJJ,YAAkIE,MAAA,WAAA,GAAA;OAA5G,YAAAA,MAAA,QAAA,CAAQ,CAAC,OAAO;OAAhB,uBAAA,OAAA,OAAA,OAAA,MAAA,WAAA,MAAA,QAAA,CAAQ,CAAC,OAAO,aAAU;OAAG,QAAQA,MAAA,CAAA,CAAC,CAAA,uCAAA;OAA4C,OAAO,gBAAA"}
|
|
@@ -9,7 +9,8 @@ export type DerivationMethod = 'transcription' | 'pdf-text' | 'ocr' | 'descripti
|
|
|
9
9
|
export type DerivationSource = {
|
|
10
10
|
asset: string;
|
|
11
11
|
} | {
|
|
12
|
-
block: string;
|
|
12
|
+
block: string; /** Document the block lives in; absent = this document. */
|
|
13
|
+
document?: string;
|
|
13
14
|
};
|
|
14
15
|
/** `meta.derivation` of a derived Baustein. */
|
|
15
16
|
export interface Derivation {
|
|
@@ -12,6 +12,10 @@ function derivationOf(node) {
|
|
|
12
12
|
if (!from || typeof from !== "object" || typeof method !== "string") return null;
|
|
13
13
|
return value;
|
|
14
14
|
}
|
|
15
|
+
/** Whether `derivation` points at a block of another document than `documentId` (the open one; null/undefined = unknown, so any named document is another). */
|
|
16
|
+
function isForeignSource(derivation, documentId) {
|
|
17
|
+
return "block" in derivation.from && !!derivation.from.document && derivation.from.document !== documentId;
|
|
18
|
+
}
|
|
15
19
|
const ASSET_URL_PREFIX = `${EDITOR_API}/assets/`;
|
|
16
20
|
const ASSET_NAME = /^[0-9a-f-]{36}\.[a-z0-9]{1,8}$/;
|
|
17
21
|
const ASSET_DOCUMENT_ID = /^[A-Za-z0-9_-]{1,64}$/;
|
|
@@ -93,6 +97,6 @@ function bodyMarkdown(editor, composite) {
|
|
|
93
97
|
});
|
|
94
98
|
}
|
|
95
99
|
//#endregion
|
|
96
|
-
export { DERIVATION_KEY, assetRefOf, bodyMarkdown, derivationOf, derivationState, renditionsOf, sourceOf };
|
|
100
|
+
export { DERIVATION_KEY, assetRefOf, bodyMarkdown, derivationOf, derivationState, isForeignSource, renditionsOf, sourceOf };
|
|
97
101
|
|
|
98
102
|
//# sourceMappingURL=derivation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"derivation.js","names":[],"sources":["../../../src/features/composites/derivation.ts"],"sourcesContent":["// Vue-free and server-importable: where a Baustein's content comes from. A source-holding Baustein (`recording`, `paper`,\n// `book`, `figure`, `document`) carries its original as an `image|audio|video|file` block in the body; a derived\n// Baustein (transcript, full text, description, AI result) records in `meta.derivation` what it was made from.\nimport type { Editor, JSONContent } from '@tiptap/core'\n// Types only: brings in the `editor.markdown` augmentation of `@tiptap/markdown` for contexts that do not otherwise load it.\nimport type {} from '@tiptap/markdown'\nimport type { Node as PMNode } from '@tiptap/pm/model'\nimport { EDITOR_API } from '../../core/api-routes'\nimport { type CompositeKind, compositeKind } from './kinds'\nimport { COMPOSITE_CHROME_COUNT } from './nodes'\nimport { DERIVATION_KEY } from './meta-keys'\n\n/** How a derived Baustein was made; `ai:<kindId>` for a block derived from another block by the model. */\nexport type DerivationMethod = 'transcription' | 'pdf-text' | 'ocr' | 'description' | 'bibliography' | (string & {})\n\n/** What a derived Baustein was made from: an uploaded asset (by asset name) or another block (by block id). */\nexport type DerivationSource = { asset: string } | { block: string }\n\n/** `meta.derivation` of a derived Baustein. */\nexport interface Derivation {\n from: DerivationSource\n method: DerivationMethod\n model?: string\n /** ISO timestamp. */\n createdAt: string\n /** SHA-256 hex of the asset bytes / of the source block's Markdown; `''` when unknown. */\n inputHash: string\n /** SHA-256 hex of the produced body's Markdown; `''` when unknown. */\n outputHash: string\n /** Asset name of the stored raw output (text/markdown). */\n output?: string\n}\n\nexport { DERIVATION_KEY }\n\n/** The derivation of a composite (`meta.derivation` with a `from` object and a `method`); null when it has none. */\nexport function derivationOf(node: PMNode): Derivation | null {\n const meta: unknown = node.attrs.meta\n const value = meta && typeof meta === 'object' ? (meta as Record<string, unknown>)[DERIVATION_KEY] : undefined\n if (!value || typeof value !== 'object') return null\n const { from, method } = value as Record<string, unknown>\n if (!from || typeof from !== 'object' || typeof method !== 'string') return null\n return value as Derivation\n}\n\nconst ASSET_URL_PREFIX = `${EDITOR_API}/assets/`\n// Same patterns as `features/media/assets.ts`; copied because composites must not import media.\nconst ASSET_NAME = /^[0-9a-f-]{36}\\.[a-z0-9]{1,8}$/\nconst ASSET_DOCUMENT_ID = /^[A-Za-z0-9_-]{1,64}$/\n\n/** The stored asset behind an `/api/editor/assets/<documentId>/<name>` URL; null for any other `src`. */\nexport function assetRefOf(src: string): { documentId: string, name: string } | null {\n if (!src.startsWith(ASSET_URL_PREFIX)) return null\n const [documentId, name, ...rest] = src.slice(ASSET_URL_PREFIX.length).split('/')\n if (rest.length || !documentId || !name || !ASSET_DOCUMENT_ID.test(documentId) || !ASSET_NAME.test(name)) return null\n return { documentId, name }\n}\n\n/** The media block a source-holding kind keeps its original in: first body child of a type in `kind.source`. */\nexport function sourceOf(\n composite: PMNode,\n kinds: readonly CompositeKind[],\n): { node: PMNode, index: number, asset: { documentId: string, name: string } | null, hash: string | null } | null {\n if (composite.type.name !== 'composite') return null\n const types = compositeKind(kinds, String(composite.attrs.kind)).source\n if (!types) return null\n for (let index = COMPOSITE_CHROME_COUNT; index < composite.childCount; index++) {\n const node = composite.child(index)\n if (!(types as readonly string[]).includes(node.type.name)) continue\n const hash: unknown = node.attrs.hash\n return { node, index, asset: assetRefOf(String(node.attrs.src ?? '')), hash: typeof hash === 'string' && hash ? hash : null }\n }\n return null\n}\n\n/** The body children of `composite` that are derived Bausteine, with their child index. */\nexport function renditionsOf(composite: PMNode): { node: PMNode, index: number, derivation: Derivation }[] {\n const found: { node: PMNode, index: number, derivation: Derivation }[] = []\n composite.forEach((node, _offset, index) => {\n if (index < COMPOSITE_CHROME_COUNT || node.type.name !== 'composite') return\n const derivation = derivationOf(node)\n if (derivation) found.push({ node, index, derivation })\n })\n return found\n}\n\n/**\n * Whether `derived` (a Baustein with a derivation, a child of `composite`) is out of date or was edited since it was made.\n * `stale`: for an asset source, the block `sourceOf(composite, kinds)` finds has a `hash` that differs from `inputHash`; null\n * when either is unknown. A block source is null here: callers with the document compare the hash of the source block's\n * Markdown. `edited`: the body's\n * hash (computed lazily, it serialises the whole body) differs from `outputHash`; null when `outputHash` is unknown.\n */\nexport function derivationState(\n composite: PMNode,\n derived: PMNode,\n bodyHash: () => string,\n kinds: readonly CompositeKind[],\n): { stale: boolean | null, edited: boolean | null } {\n const derivation = derivationOf(derived)\n if (!derivation) return { stale: null, edited: null }\n let stale: boolean | null = null\n if ('asset' in derivation.from) {\n const hash = sourceOf(composite, kinds)?.hash\n stale = hash && derivation.inputHash ? hash !== derivation.inputHash : null\n }\n const edited = derivation.outputHash ? bodyHash() !== derivation.outputHash : null\n return { stale, edited }\n}\n\n/** Markdown of the body of `composite` (everything after title, description and tags). */\nexport function bodyMarkdown(editor: Editor, composite: PMNode): string {\n const content: JSONContent[] = []\n composite.forEach((child, _offset, index) => {\n if (index >= COMPOSITE_CHROME_COUNT) content.push(child.toJSON() as JSONContent)\n })\n return editor.markdown!.serialize({ type: 'doc', content })\n}\n"],"mappings":";;;;;;AAoCA,SAAgB,aAAa,MAAiC;CAC5D,MAAM,OAAgB,KAAK,MAAM;CACjC,MAAM,QAAQ,QAAQ,OAAO,SAAS,WAAY,KAAiC,kBAAkB,KAAA;CACrG,IAAI,CAAC,SAAS,OAAO,UAAU,UAAU,OAAO;CAChD,MAAM,EAAE,MAAM,WAAW;CACzB,IAAI,CAAC,QAAQ,OAAO,SAAS,YAAY,OAAO,WAAW,UAAU,OAAO;CAC5E,OAAO;AACT;AAEA,MAAM,mBAAmB,GAAG,WAAW;AAEvC,MAAM,aAAa;AACnB,MAAM,oBAAoB;;AAG1B,SAAgB,WAAW,KAA0D;CACnF,IAAI,CAAC,IAAI,WAAW,gBAAgB,GAAG,OAAO;CAC9C,MAAM,CAAC,YAAY,MAAM,GAAG,QAA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,WAAW,YAAY,SAAS,WAAW,YAAY;CACzE;CACA,MAAM,SAAS,WAAW,aAAa,SAAS,MAAM,WAAW,aAAa;CAC9E,OAAO;EAAE;EAAO;CAAO;AACzB;;AAGA,SAAgB,aAAa,QAAgB,WAA2B;CACtE,MAAM,UAAyB,CAAC;CAChC,UAAU,SAAS,OAAO,SAAS,UAAU;EAC3C,IAAI,SAAA,GAAiC,QAAQ,KAAK,MAAM,OAAO,CAAgB;CACjF,CAAC;CACD,OAAO,OAAO,SAAU,UAAU;EAAE,MAAM;EAAO;CAAQ,CAAC;AAC5D"}
|
|
1
|
+
{"version":3,"file":"derivation.js","names":[],"sources":["../../../src/features/composites/derivation.ts"],"sourcesContent":["// Vue-free and server-importable: where a Baustein's content comes from. A source-holding Baustein (`recording`, `paper`,\n// `book`, `figure`, `document`) carries its original as an `image|audio|video|file` block in the body; a derived\n// Baustein (transcript, full text, description, AI result) records in `meta.derivation` what it was made from.\nimport type { Editor, JSONContent } from '@tiptap/core'\n// Types only: brings in the `editor.markdown` augmentation of `@tiptap/markdown` for contexts that do not otherwise load it.\nimport type {} from '@tiptap/markdown'\nimport type { Node as PMNode } from '@tiptap/pm/model'\nimport { EDITOR_API } from '../../core/api-routes'\nimport { type CompositeKind, compositeKind } from './kinds'\nimport { COMPOSITE_CHROME_COUNT } from './nodes'\nimport { DERIVATION_KEY } from './meta-keys'\n\n/** How a derived Baustein was made; `ai:<kindId>` for a block derived from another block by the model. */\nexport type DerivationMethod = 'transcription' | 'pdf-text' | 'ocr' | 'description' | 'bibliography' | (string & {})\n\n/** What a derived Baustein was made from: an uploaded asset (by asset name) or another block (by block id). */\nexport type DerivationSource = { asset: string } | { block: string, /** Document the block lives in; absent = this document. */ document?: string }\n\n/** `meta.derivation` of a derived Baustein. */\nexport interface Derivation {\n from: DerivationSource\n method: DerivationMethod\n model?: string\n /** ISO timestamp. */\n createdAt: string\n /** SHA-256 hex of the asset bytes / of the source block's Markdown; `''` when unknown. */\n inputHash: string\n /** SHA-256 hex of the produced body's Markdown; `''` when unknown. */\n outputHash: string\n /** Asset name of the stored raw output (text/markdown). */\n output?: string\n}\n\nexport { DERIVATION_KEY }\n\n/** The derivation of a composite (`meta.derivation` with a `from` object and a `method`); null when it has none. */\nexport function derivationOf(node: PMNode): Derivation | null {\n const meta: unknown = node.attrs.meta\n const value = meta && typeof meta === 'object' ? (meta as Record<string, unknown>)[DERIVATION_KEY] : undefined\n if (!value || typeof value !== 'object') return null\n const { from, method } = value as Record<string, unknown>\n if (!from || typeof from !== 'object' || typeof method !== 'string') return null\n return value as Derivation\n}\n\n/** Whether `derivation` points at a block of another document than `documentId` (the open one; null/undefined = unknown, so any named document is another). */\nexport function isForeignSource(derivation: Derivation, documentId: string | null | undefined): boolean {\n return 'block' in derivation.from && !!derivation.from.document && derivation.from.document !== documentId\n}\n\nconst ASSET_URL_PREFIX = `${EDITOR_API}/assets/`\n// Same patterns as `features/media/assets.ts`; copied because composites must not import media.\nconst ASSET_NAME = /^[0-9a-f-]{36}\\.[a-z0-9]{1,8}$/\nconst ASSET_DOCUMENT_ID = /^[A-Za-z0-9_-]{1,64}$/\n\n/** The stored asset behind an `/api/editor/assets/<documentId>/<name>` URL; null for any other `src`. */\nexport function assetRefOf(src: string): { documentId: string, name: string } | null {\n if (!src.startsWith(ASSET_URL_PREFIX)) return null\n const [documentId, name, ...rest] = src.slice(ASSET_URL_PREFIX.length).split('/')\n if (rest.length || !documentId || !name || !ASSET_DOCUMENT_ID.test(documentId) || !ASSET_NAME.test(name)) return null\n return { documentId, name }\n}\n\n/** The media block a source-holding kind keeps its original in: first body child of a type in `kind.source`. */\nexport function sourceOf(\n composite: PMNode,\n kinds: readonly CompositeKind[],\n): { node: PMNode, index: number, asset: { documentId: string, name: string } | null, hash: string | null } | null {\n if (composite.type.name !== 'composite') return null\n const types = compositeKind(kinds, String(composite.attrs.kind)).source\n if (!types) return null\n for (let index = COMPOSITE_CHROME_COUNT; index < composite.childCount; index++) {\n const node = composite.child(index)\n if (!(types as readonly string[]).includes(node.type.name)) continue\n const hash: unknown = node.attrs.hash\n return { node, index, asset: assetRefOf(String(node.attrs.src ?? '')), hash: typeof hash === 'string' && hash ? hash : null }\n }\n return null\n}\n\n/** The body children of `composite` that are derived Bausteine, with their child index. */\nexport function renditionsOf(composite: PMNode): { node: PMNode, index: number, derivation: Derivation }[] {\n const found: { node: PMNode, index: number, derivation: Derivation }[] = []\n composite.forEach((node, _offset, index) => {\n if (index < COMPOSITE_CHROME_COUNT || node.type.name !== 'composite') return\n const derivation = derivationOf(node)\n if (derivation) found.push({ node, index, derivation })\n })\n return found\n}\n\n/**\n * Whether `derived` (a Baustein with a derivation, a child of `composite`) is out of date or was edited since it was made.\n * `stale`: for an asset source, the block `sourceOf(composite, kinds)` finds has a `hash` that differs from `inputHash`; null\n * when either is unknown. A block source is null here: callers with the document compare the hash of the source block's\n * Markdown. `edited`: the body's\n * hash (computed lazily, it serialises the whole body) differs from `outputHash`; null when `outputHash` is unknown.\n */\nexport function derivationState(\n composite: PMNode,\n derived: PMNode,\n bodyHash: () => string,\n kinds: readonly CompositeKind[],\n): { stale: boolean | null, edited: boolean | null } {\n const derivation = derivationOf(derived)\n if (!derivation) return { stale: null, edited: null }\n let stale: boolean | null = null\n if ('asset' in derivation.from) {\n const hash = sourceOf(composite, kinds)?.hash\n stale = hash && derivation.inputHash ? hash !== derivation.inputHash : null\n }\n const edited = derivation.outputHash ? bodyHash() !== derivation.outputHash : null\n return { stale, edited }\n}\n\n/** Markdown of the body of `composite` (everything after title, description and tags). */\nexport function bodyMarkdown(editor: Editor, composite: PMNode): string {\n const content: JSONContent[] = []\n composite.forEach((child, _offset, index) => {\n if (index >= COMPOSITE_CHROME_COUNT) content.push(child.toJSON() as JSONContent)\n })\n return editor.markdown!.serialize({ type: 'doc', content })\n}\n"],"mappings":";;;;;;AAoCA,SAAgB,aAAa,MAAiC;CAC5D,MAAM,OAAgB,KAAK,MAAM;CACjC,MAAM,QAAQ,QAAQ,OAAO,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