@conduction/nextcloud-vue 2.174.0 → 2.176.1

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.
Files changed (203) hide show
  1. package/dist/esm/components/CnActionDialog/CnActionDialog.vue.js +1 -1
  2. package/dist/esm/components/CnActionDialog/CnActionDialog.vue2.js +114 -11
  3. package/dist/esm/components/CnActionDialog/CnActionDialog.vue2.js.map +1 -1
  4. package/dist/esm/components/CnActionDialog/CnActionDialog.vue3.js +67 -17
  5. package/dist/esm/components/CnActionDialog/CnActionDialog.vue3.js.map +1 -1
  6. package/dist/esm/components/CnBlockListEditor/CnBlockListEditor.vue.js +9 -0
  7. package/dist/esm/components/CnBlockListEditor/CnBlockListEditor.vue.js.map +1 -0
  8. package/dist/esm/components/CnBlockListEditor/CnBlockListEditor.vue2.js +352 -0
  9. package/dist/esm/components/CnBlockListEditor/CnBlockListEditor.vue2.js.map +1 -0
  10. package/dist/esm/components/CnBlockListEditor/CnBlockListEditor.vue3.js +266 -0
  11. package/dist/esm/components/CnBlockListEditor/CnBlockListEditor.vue3.js.map +1 -0
  12. package/dist/esm/components/CnChecklistRunWidget/CnChecklistRunWidget.vue.js +1 -1
  13. package/dist/esm/components/CnChecklistRunWidget/CnChecklistRunWidget.vue2.js +323 -7
  14. package/dist/esm/components/CnChecklistRunWidget/CnChecklistRunWidget.vue2.js.map +1 -1
  15. package/dist/esm/components/CnChecklistRunWidget/CnChecklistRunWidget.vue3.js +113 -59
  16. package/dist/esm/components/CnChecklistRunWidget/CnChecklistRunWidget.vue3.js.map +1 -1
  17. package/dist/esm/components/CnChildRecordsField/CnChildRecordsField.vue.js +1 -1
  18. package/dist/esm/components/CnChildRecordsField/CnChildRecordsField.vue2.js +210 -5
  19. package/dist/esm/components/CnChildRecordsField/CnChildRecordsField.vue2.js.map +1 -1
  20. package/dist/esm/components/CnChildRecordsField/CnChildRecordsField.vue3.js +134 -46
  21. package/dist/esm/components/CnChildRecordsField/CnChildRecordsField.vue3.js.map +1 -1
  22. package/dist/esm/components/CnChoiceMatrix/CnChoiceMatrix.vue.js +9 -0
  23. package/dist/esm/components/CnChoiceMatrix/CnChoiceMatrix.vue.js.map +1 -0
  24. package/dist/esm/components/CnChoiceMatrix/CnChoiceMatrix.vue2.js +385 -0
  25. package/dist/esm/components/CnChoiceMatrix/CnChoiceMatrix.vue2.js.map +1 -0
  26. package/dist/esm/components/CnChoiceMatrix/CnChoiceMatrix.vue3.js +277 -0
  27. package/dist/esm/components/CnChoiceMatrix/CnChoiceMatrix.vue3.js.map +1 -0
  28. package/dist/esm/components/CnCountdownWidget/CnCountdownWidget.vue.js +1 -1
  29. package/dist/esm/components/CnCountdownWidget/CnCountdownWidget.vue2.js +175 -20
  30. package/dist/esm/components/CnCountdownWidget/CnCountdownWidget.vue2.js.map +1 -1
  31. package/dist/esm/components/CnCountdownWidget/CnCountdownWidget.vue3.js +30 -8
  32. package/dist/esm/components/CnCountdownWidget/CnCountdownWidget.vue3.js.map +1 -1
  33. package/dist/esm/components/CnCreateFormWidget/CnCreateFormWidget.vue.js +1 -1
  34. package/dist/esm/components/CnCreateFormWidget/CnCreateFormWidget.vue2.js +72 -6
  35. package/dist/esm/components/CnCreateFormWidget/CnCreateFormWidget.vue2.js.map +1 -1
  36. package/dist/esm/components/CnCreateFormWidget/CnCreateFormWidget.vue3.js +48 -14
  37. package/dist/esm/components/CnCreateFormWidget/CnCreateFormWidget.vue3.js.map +1 -1
  38. package/dist/esm/components/CnDataMatrix/CnDataMatrix.vue.js +1 -1
  39. package/dist/esm/components/CnDataMatrix/CnDataMatrix.vue2.js +255 -10
  40. package/dist/esm/components/CnDataMatrix/CnDataMatrix.vue2.js.map +1 -1
  41. package/dist/esm/components/CnDataMatrix/CnDataMatrix.vue3.js +70 -28
  42. package/dist/esm/components/CnDataMatrix/CnDataMatrix.vue3.js.map +1 -1
  43. package/dist/esm/components/CnDetailPage/CnDetailPage.vue2.js +55 -6
  44. package/dist/esm/components/CnDetailPage/CnDetailPage.vue2.js.map +1 -1
  45. package/dist/esm/components/CnDetailPage/CnDetailPage.vue3.js.map +1 -1
  46. package/dist/esm/components/CnDisplayScreen/CnDisplayScreen.vue.js +9 -0
  47. package/dist/esm/components/CnDisplayScreen/CnDisplayScreen.vue.js.map +1 -0
  48. package/dist/esm/components/CnDisplayScreen/CnDisplayScreen.vue2.js +175 -0
  49. package/dist/esm/components/CnDisplayScreen/CnDisplayScreen.vue2.js.map +1 -0
  50. package/dist/esm/components/CnDisplayScreen/CnDisplayScreen.vue3.js +114 -0
  51. package/dist/esm/components/CnDisplayScreen/CnDisplayScreen.vue3.js.map +1 -0
  52. package/dist/esm/components/CnDurationField/CnDurationField.vue.js +1 -1
  53. package/dist/esm/components/CnDurationField/CnDurationField.vue2.js +218 -4
  54. package/dist/esm/components/CnDurationField/CnDurationField.vue2.js.map +1 -1
  55. package/dist/esm/components/CnDurationField/CnDurationField.vue3.js +133 -44
  56. package/dist/esm/components/CnDurationField/CnDurationField.vue3.js.map +1 -1
  57. package/dist/esm/components/CnFormDialog/CnFormDialog.vue.js +1 -1
  58. package/dist/esm/components/CnFormDialog/CnFormDialog.vue2.js.map +1 -1
  59. package/dist/esm/components/CnFormDialog/CnFormDialog.vue3.js +5 -1
  60. package/dist/esm/components/CnFormDialog/CnFormDialog.vue3.js.map +1 -1
  61. package/dist/esm/components/CnGeoCaptureField/CnGeoCaptureField.vue.js +9 -0
  62. package/dist/esm/components/CnGeoCaptureField/CnGeoCaptureField.vue.js.map +1 -0
  63. package/dist/esm/components/CnGeoCaptureField/CnGeoCaptureField.vue2.js +113 -0
  64. package/dist/esm/components/CnGeoCaptureField/CnGeoCaptureField.vue2.js.map +1 -0
  65. package/dist/esm/components/CnGeoCaptureField/CnGeoCaptureField.vue3.js +43 -0
  66. package/dist/esm/components/CnGeoCaptureField/CnGeoCaptureField.vue3.js.map +1 -0
  67. package/dist/esm/components/CnIndexPage/CnIndexPage.vue2.js +40 -1
  68. package/dist/esm/components/CnIndexPage/CnIndexPage.vue2.js.map +1 -1
  69. package/dist/esm/components/CnIndexPage/CnIndexPage.vue3.js.map +1 -1
  70. package/dist/esm/components/CnMarkdownEditor/CnMarkdownEditor.vue.js +1 -1
  71. package/dist/esm/components/CnMarkdownEditor/CnMarkdownEditor.vue2.js +110 -1
  72. package/dist/esm/components/CnMarkdownEditor/CnMarkdownEditor.vue2.js.map +1 -1
  73. package/dist/esm/components/CnMarkdownEditor/CnMarkdownEditor.vue3.js +60 -18
  74. package/dist/esm/components/CnMarkdownEditor/CnMarkdownEditor.vue3.js.map +1 -1
  75. package/dist/esm/components/CnMenuTreeNode/CnMenuTreeNode.vue2.js +2 -2
  76. package/dist/esm/components/CnMenuTreeNode/CnMenuTreeNode.vue2.js.map +1 -1
  77. package/dist/esm/components/CnObjectKanban/CnObjectKanban.vue2.js +2 -2
  78. package/dist/esm/components/CnObjectKanban/CnObjectKanban.vue2.js.map +1 -1
  79. package/dist/esm/components/CnPageTreeNode/CnPageTreeNode.vue2.js +2 -2
  80. package/dist/esm/components/CnPageTreeNode/CnPageTreeNode.vue2.js.map +1 -1
  81. package/dist/esm/components/CnQrCode/CnQrCode.vue.js +9 -0
  82. package/dist/esm/components/CnQrCode/CnQrCode.vue.js.map +1 -0
  83. package/dist/esm/components/CnQrCode/CnQrCode.vue2.js +241 -0
  84. package/dist/esm/components/CnQrCode/CnQrCode.vue2.js.map +1 -0
  85. package/dist/esm/components/CnQrCode/CnQrCode.vue3.js +75 -0
  86. package/dist/esm/components/CnQrCode/CnQrCode.vue3.js.map +1 -0
  87. package/dist/esm/components/CnReadinessChecklist/CnReadinessChecklist.vue.js +1 -1
  88. package/dist/esm/components/CnReadinessChecklist/CnReadinessChecklist.vue2.js +34 -3
  89. package/dist/esm/components/CnReadinessChecklist/CnReadinessChecklist.vue2.js.map +1 -1
  90. package/dist/esm/components/CnReadinessChecklist/CnReadinessChecklist.vue3.js +81 -19
  91. package/dist/esm/components/CnReadinessChecklist/CnReadinessChecklist.vue3.js.map +1 -1
  92. package/dist/esm/components/CnRecordListWidget/CnRecordListWidget.vue.js +1 -1
  93. package/dist/esm/components/CnRecordListWidget/CnRecordListWidget.vue2.js +11 -0
  94. package/dist/esm/components/CnRecordListWidget/CnRecordListWidget.vue2.js.map +1 -1
  95. package/dist/esm/components/CnRecordListWidget/CnRecordListWidget.vue3.js +112 -88
  96. package/dist/esm/components/CnRecordListWidget/CnRecordListWidget.vue3.js.map +1 -1
  97. package/dist/esm/components/CnRevealField/CnRevealField.vue.js +9 -0
  98. package/dist/esm/components/CnRevealField/CnRevealField.vue.js.map +1 -0
  99. package/dist/esm/components/CnRevealField/CnRevealField.vue2.js +157 -0
  100. package/dist/esm/components/CnRevealField/CnRevealField.vue2.js.map +1 -0
  101. package/dist/esm/components/CnRevealField/CnRevealField.vue3.js +116 -0
  102. package/dist/esm/components/CnRevealField/CnRevealField.vue3.js.map +1 -0
  103. package/dist/esm/components/CnStorePage/CnStorePage.vue.js +1 -1
  104. package/dist/esm/components/CnStorePage/CnStorePage.vue2.js +3 -3
  105. package/dist/esm/components/CnStorePage/CnStorePage.vue2.js.map +1 -1
  106. package/dist/esm/components/CnStorePage/CnStorePage.vue3.js +5 -5
  107. package/dist/esm/components/CnStorePage/CnStorePage.vue3.js.map +1 -1
  108. package/dist/esm/components/CnStorePage/CnStorePublishDialog.vue.js +1 -1
  109. package/dist/esm/components/CnStorePage/CnStorePublishDialog.vue2.js +6 -6
  110. package/dist/esm/components/CnStorePage/CnStorePublishDialog.vue2.js.map +1 -1
  111. package/dist/esm/components/CnStorePage/CnStorePublishDialog.vue3.js +1 -1
  112. package/dist/esm/components/CnStorePage/CnStorePublishDialog.vue3.js.map +1 -1
  113. package/dist/esm/components/CnTextWidget/CnTextWidget.vue.js +1 -1
  114. package/dist/esm/components/CnTextWidget/CnTextWidget.vue2.js +43 -3
  115. package/dist/esm/components/CnTextWidget/CnTextWidget.vue2.js.map +1 -1
  116. package/dist/esm/components/CnTextWidget/CnTextWidget.vue3.js +19 -12
  117. package/dist/esm/components/CnTextWidget/CnTextWidget.vue3.js.map +1 -1
  118. package/dist/esm/components/CnTransferCard/CnTransferCard.vue.js +9 -0
  119. package/dist/esm/components/CnTransferCard/CnTransferCard.vue.js.map +1 -0
  120. package/dist/esm/components/CnTransferCard/CnTransferCard.vue2.js +87 -0
  121. package/dist/esm/components/CnTransferCard/CnTransferCard.vue2.js.map +1 -0
  122. package/dist/esm/components/CnTransferCard/CnTransferCard.vue3.js +126 -0
  123. package/dist/esm/components/CnTransferCard/CnTransferCard.vue3.js.map +1 -0
  124. package/dist/esm/components/CnTreeView/CnTreeNode.vue.js +1 -1
  125. package/dist/esm/components/CnTreeView/CnTreeNode.vue2.js +66 -1
  126. package/dist/esm/components/CnTreeView/CnTreeNode.vue2.js.map +1 -1
  127. package/dist/esm/components/CnTreeView/CnTreeNode.vue3.js +129 -29
  128. package/dist/esm/components/CnTreeView/CnTreeNode.vue3.js.map +1 -1
  129. package/dist/esm/components/CnTreeView/CnTreeView.vue.js +1 -1
  130. package/dist/esm/components/CnTreeView/CnTreeView.vue2.js +158 -6
  131. package/dist/esm/components/CnTreeView/CnTreeView.vue2.js.map +1 -1
  132. package/dist/esm/components/CnTreeView/CnTreeView.vue3.js +100 -39
  133. package/dist/esm/components/CnTreeView/CnTreeView.vue3.js.map +1 -1
  134. package/dist/esm/index.js +8 -0
  135. package/dist/esm/index.js.map +1 -1
  136. package/dist/esm/l10n/en.json.js +79 -14
  137. package/dist/esm/l10n/en.json.js.map +1 -1
  138. package/dist/esm/l10n/nl.json.js +79 -14
  139. package/dist/esm/l10n/nl.json.js.map +1 -1
  140. package/dist/esm/library-style.js +1 -1
  141. package/dist/esm/nextcloud-vue.css +1162 -523
  142. package/dist/esm/node_modules/vuedraggable/dist/vuedraggable.umd.js +2 -2
  143. package/dist/esm/utils/captureLocation.js +32 -0
  144. package/dist/esm/utils/captureLocation.js.map +1 -0
  145. package/dist/esm/utils/childRecordTotals.js +157 -0
  146. package/dist/esm/utils/childRecordTotals.js.map +1 -0
  147. package/dist/esm/utils/isoDuration.js +51 -1
  148. package/dist/esm/utils/isoDuration.js.map +1 -1
  149. package/dist/esm/utils/parentCrumb.js +86 -0
  150. package/dist/esm/utils/parentCrumb.js.map +1 -0
  151. package/dist/esm/utils/qr.js +649 -0
  152. package/dist/esm/utils/qr.js.map +1 -0
  153. package/dist/esm/utils/schema.js +3 -0
  154. package/dist/esm/utils/schema.js.map +1 -1
  155. package/dist/esm/utils/templateVariables.js +54 -0
  156. package/dist/esm/utils/templateVariables.js.map +1 -0
  157. package/dist/nextcloud-vue.cjs.js +21125 -15025
  158. package/dist/nextcloud-vue.cjs.js.map +2 -2
  159. package/dist/nextcloud-vue.css +1162 -523
  160. package/l10n/en.json +79 -14
  161. package/l10n/nl.json +79 -14
  162. package/package.json +1 -1
  163. package/src/components/CnActionDialog/CnActionDialog.vue +156 -9
  164. package/src/components/CnBlockListEditor/CnBlockListEditor.vue +615 -0
  165. package/src/components/CnBlockListEditor/index.js +9 -0
  166. package/src/components/CnChecklistRunWidget/CnChecklistRunWidget.vue +377 -10
  167. package/src/components/CnChildRecordsField/CnChildRecordsField.vue +306 -15
  168. package/src/components/CnChoiceMatrix/CnChoiceMatrix.vue +710 -0
  169. package/src/components/CnChoiceMatrix/index.js +9 -0
  170. package/src/components/CnCountdownWidget/CnCountdownWidget.vue +223 -28
  171. package/src/components/CnCreateFormWidget/CnCreateFormWidget.vue +97 -6
  172. package/src/components/CnDataMatrix/CnDataMatrix.vue +304 -17
  173. package/src/components/CnDetailPage/CnDetailPage.vue +55 -6
  174. package/src/components/CnDisplayScreen/CnDisplayScreen.vue +308 -0
  175. package/src/components/CnDisplayScreen/index.js +9 -0
  176. package/src/components/CnDurationField/CnDurationField.vue +330 -5
  177. package/src/components/CnFormDialog/CnFormDialog.vue +4 -0
  178. package/src/components/CnGeoCaptureField/CnGeoCaptureField.vue +148 -0
  179. package/src/components/CnGeoCaptureField/index.js +9 -0
  180. package/src/components/CnIndexPage/CnIndexPage.vue +40 -1
  181. package/src/components/CnMarkdownEditor/CnMarkdownEditor.vue +139 -1
  182. package/src/components/CnQrCode/CnQrCode.vue +321 -0
  183. package/src/components/CnQrCode/index.js +9 -0
  184. package/src/components/CnReadinessChecklist/CnReadinessChecklist.vue +80 -3
  185. package/src/components/CnRecordListWidget/CnRecordListWidget.vue +34 -1
  186. package/src/components/CnRevealField/CnRevealField.vue +273 -0
  187. package/src/components/CnRevealField/index.js +9 -0
  188. package/src/components/CnStorePage/CnStorePage.vue +8 -8
  189. package/src/components/CnStorePage/CnStorePublishDialog.vue +7 -7
  190. package/src/components/CnTextWidget/CnTextWidget.vue +62 -3
  191. package/src/components/CnTransferCard/CnTransferCard.vue +205 -0
  192. package/src/components/CnTransferCard/index.js +9 -0
  193. package/src/components/CnTreeView/CnTreeNode.vue +145 -2
  194. package/src/components/CnTreeView/CnTreeView.vue +210 -6
  195. package/src/components/index.js +7 -0
  196. package/src/index.js +8 -0
  197. package/src/utils/captureLocation.js +29 -0
  198. package/src/utils/childRecordTotals.js +153 -0
  199. package/src/utils/isoDuration.js +50 -0
  200. package/src/utils/parentCrumb.js +83 -0
  201. package/src/utils/qr.js +681 -0
  202. package/src/utils/schema.js +3 -0
  203. package/src/utils/templateVariables.js +51 -0
@@ -1 +1 @@
1
- {"version":3,"file":"CnMarkdownEditor.vue3.js","sources":["../../../../src/components/CnMarkdownEditor/CnMarkdownEditor.vue?vue&type=template&id=697543a0&lang.js"],"sourcesContent":["<template>\n\t<div class=\"cn-markdown-editor\" data-testid=\"cn-markdown-editor\" :class=\"modeClass\">\n\t\t<!-- Toolbar with formatting shortcuts (textarea modes only; WYSIWYG has its own). -->\n\t\t<div v-if=\"!hideToolbar && mode !== 'wysiwyg'\" class=\"cn-markdown-editor__toolbar\" role=\"toolbar\">\n\t\t\t<button v-for=\"tool in toolbar\"\n\t\t\t\t:key=\"tool.id\"\n\t\t\t\ttype=\"button\"\n\t\t\t\tclass=\"cn-markdown-editor__tool\"\n\t\t\t\t:title=\"tool.tooltip || tool.label\"\n\t\t\t\t:data-testid=\"'tool-' + tool.id\"\n\t\t\t\t@click=\"invokeTool(tool)\">\n\t\t\t\t<span>{{ tool.label }}</span>\n\t\t\t</button>\n\t\t\t<span class=\"cn-markdown-editor__spacer\" />\n\t\t\t<button v-if=\"!hideModeSwitch\"\n\t\t\t\ttype=\"button\"\n\t\t\t\tclass=\"cn-markdown-editor__tool cn-markdown-editor__mode-switch\"\n\t\t\t\t:title=\"modeSwitchTooltip\"\n\t\t\t\tdata-testid=\"mode-switch\"\n\t\t\t\t@click=\"cycleMode\">\n\t\t\t\t{{ currentModeLabel }}\n\t\t\t</button>\n\t\t</div>\n\n\t\t<!-- Pane layout: edit / preview / split (textarea + rendered preview). -->\n\t\t<div v-if=\"mode !== 'wysiwyg'\" class=\"cn-markdown-editor__panes\" :data-mode=\"mode\">\n\t\t\t<textarea v-if=\"mode !== 'preview'\"\n\t\t\t\tref=\"textarea\"\n\t\t\t\tclass=\"cn-markdown-editor__textarea\"\n\t\t\t\t:value=\"localValue\"\n\t\t\t\t:placeholder=\"placeholder\"\n\t\t\t\t:rows=\"rows\"\n\t\t\t\t:disabled=\"disabled\"\n\t\t\t\t:aria-label=\"ariaLabel\"\n\t\t\t\tdata-testid=\"cn-markdown-textarea\"\n\t\t\t\t@input=\"onInput\"\n\t\t\t\t@keydown=\"onKeydown\" />\n\t\t\t<div v-if=\"mode !== 'edit'\"\n\t\t\t\tclass=\"cn-markdown-editor__preview\"\n\t\t\t\tdata-testid=\"cn-markdown-preview\"\n\t\t\t\tv-html=\"renderedHtml\" /><!-- eslint-disable-line vue/no-v-html -- renderedHtml comes from cnRenderMarkdown(), which sanitises through DOMPurify -->\n\t\t</div>\n\n\t\t<!-- WYSIWYG mode: lazily-instantiated Toast UI editor. The editor is\n\t\t driven imperatively against `toastHost` rather than through a Vue\n\t\t wrapper component — `@toast-ui/vue-editor` is Vue-2 only, so the\n\t\t Vue-3 line uses the framework-agnostic `@toast-ui/editor` API. -->\n\t\t<div v-else class=\"cn-markdown-editor__wysiwyg\" data-testid=\"cn-markdown-wysiwyg\">\n\t\t\t<div v-show=\"toastEditorReady\" ref=\"toastHost\" />\n\t\t\t<p v-if=\"!toastEditorReady\" class=\"cn-markdown-editor__hint\">\n\t\t\t\t{{ t('nextcloud-vue', 'Loading editor…') }}\n\t\t\t</p>\n\t\t</div>\n\n\t\t<!-- Hint row. -->\n\t\t<small v-if=\"hint\" class=\"cn-markdown-editor__hint\">{{ hint }}</small>\n\t</div>\n</template>\n\n<script>\nimport { translate as t } from '@nextcloud/l10n'\nimport { cnRenderMarkdown } from '../../composables/cnRenderMarkdown.js'\nimport { guardedToastUiEditorClass } from '../../utils/toastUiRawHtmlGuard.js'\nimport { toastUiSanitizer } from '../../utils/toastUiSanitizer.js'\n\n/**\n * Default formatting toolbar — Markdown insertions that wrap a\n * selection or insert a placeholder.\n *\n * @type {Array<{id:string,label:string,prefix:string,suffix?:string,placeholder?:string}>}\n */\nconst DEFAULT_TOOLBAR = Object.freeze([\n\t{ id: 'bold', label: 'B', prefix: '**', suffix: '**', placeholder: 'bold', tooltip: 'Bold (Ctrl+B)' },\n\t{ id: 'italic', label: 'I', prefix: '_', suffix: '_', placeholder: 'italic', tooltip: 'Italic (Ctrl+I)' },\n\t{ id: 'h1', label: 'H1', prefix: '# ', suffix: '', placeholder: 'Heading', tooltip: 'Heading 1', linePrefix: true },\n\t{ id: 'h2', label: 'H2', prefix: '## ', suffix: '', placeholder: 'Heading', tooltip: 'Heading 2', linePrefix: true },\n\t{ id: 'link', label: '🔗', prefix: '[', suffix: '](https://)', placeholder: 'link text', tooltip: 'Link' },\n\t{ id: 'code', label: '`</>`', prefix: '`', suffix: '`', placeholder: 'code', tooltip: 'Inline code' },\n\t{ id: 'list', label: '•', prefix: '- ', suffix: '', placeholder: 'item', tooltip: 'List', linePrefix: true },\n\t{ id: 'quote', label: '“”', prefix: '> ', suffix: '', placeholder: 'quote', tooltip: 'Quote', linePrefix: true },\n])\n\nconst MODES = ['edit', 'split', 'preview', 'wysiwyg']\n\n/**\n * Matches a list item at the start of a line: leading indentation, a bullet\n * (`-`/`*`/`+`) or ordered marker (`1.`/`1)`), the whitespace after it, then the\n * item body. Drives the smart Enter / Tab list handling. Only the markers\n * CommonMark actually renders as lists are recognised (no `a.`/`A)` alpha\n * markers — Markdown renders those as plain text).\n *\n * @type {RegExp}\n */\nconst LIST_ITEM_RE = /^([ \\t]*)([-*+]|\\d+[.)])([ \\t]+)(.*)$/\n\n/** One indent step for nesting list items (a tab; textarea uses `tab-size: 2`). */\nconst LIST_INDENT = '\\t'\n\n/**\n * The marker that continues a list after `marker`: unordered bullets repeat;\n * numeric markers increment (`1.`→`2.`, `1)`→`2)`) keeping the `.`/`)` delimiter.\n *\n * @param {string} marker The current line's list marker (e.g. `-`, `1.`).\n * @return {string} The next item's marker.\n */\nfunction nextListMarker(marker) {\n\tconst ordered = marker.match(/^(\\d+)([.)])$/)\n\tif (!ordered) {\n\t\treturn marker\n\t}\n\treturn `${parseInt(ordered[1], 10) + 1}${ordered[2]}`\n}\n\n/**\n * Read off the run of wrap markers sitting against one edge of the selection,\n * innermost first. `**_` to the left of the caret yields `['_', '**']`.\n *\n * `markers` must be ordered longest-first so `**` is never read as two `*`.\n *\n * @param {string} text The text on that side of the selection.\n * @param {string[]} markers Known wrap delimiters, longest first.\n * @param {boolean} fromEnd Scan backwards from the end (the text BEFORE the\n * selection) rather than forwards from the start (the text AFTER it).\n * @return {string[]} The markers found, innermost first.\n */\nfunction peelMarkers(text, markers, fromEnd) {\n\tconst found = []\n\tlet rest = text\n\tconst nextMarker = () => markers.find((m) => m !== '' && (fromEnd ? rest.endsWith(m) : rest.startsWith(m)))\n\tfor (let hit = nextMarker(); hit; hit = nextMarker()) {\n\t\tfound.push(hit)\n\t\trest = fromEnd ? rest.slice(0, rest.length - hit.length) : rest.slice(hit.length)\n\t}\n\treturn found\n}\n\n/**\n * Default Toast UI WYSIWYG toolbar layout — used only in `mode: 'wysiwyg'`.\n *\n * @type {Array<Array<string>>}\n */\nconst DEFAULT_WYSIWYG_TOOLBAR = Object.freeze([\n\t['heading', 'bold', 'italic', 'strike'],\n\t['hr', 'quote'],\n\t['ul', 'ol', 'task', 'indent', 'outdent'],\n\t['table', 'image', 'link'],\n\t['code', 'codeblock'],\n])\n\n/**\n * CnMarkdownEditor — Markdown editor with a textarea + live HTML\n * preview, a formatting toolbar, and four layout modes (edit /\n * split / preview / wysiwyg).\n *\n * The default path is a `<textarea>` + `cnRenderMarkdown` preview.\n * Setting `mode: 'wysiwyg'` opts into a rich Toast UI WYSIWYG editor\n * that is **lazily loaded** only when that mode is active — the\n * textarea modes carry no editor dependency. The `v-model` contract\n * is identical across all modes (`value` in, `input` out).\n *\n * ```vue\n * <CnMarkdownEditor v-model=\"article\" placeholder=\"Write your article …\" />\n * <CnMarkdownEditor v-model=\"article\" mode=\"wysiwyg\" />\n * ```\n *\n * Toolbar buttons either wrap the current selection or insert a\n * placeholder (`bold` / `italic` / `link` / `code`) OR prefix the\n * current line (`h1` / `h2` / `list` / `quote`). The `toolbar`\n * prop lets consumers replace the default set.\n */\nexport default {\n\tname: 'CnMarkdownEditor',\n\tprops: {\n\t\t/**\n\t\t * Markdown source (v-model).\n\t\t *\n\t\t * @type {string}\n\t\t */\n\t\tvalue: { type: String, default: '' },\n\t\t/**\n\t\t * Markdown source, Vue 3's own v-model prop.\n\t\t *\n\t\t * ⚠️ WITHOUT THIS, `v-model` ON THIS COMPONENT DOES NOTHING. Vue 3\n\t\t * compiles `v-model=\"x\"` to `:modelValue` + `@update:modelValue`, so a\n\t\t * component that only declares `value`/`input` never receives the prop\n\t\t * and its emit is never heard — silently, with no warning, looking\n\t\t * exactly like a component that works.\n\t\t *\n\t\t * `value` is kept as the public name (consumers depend on it) and both\n\t\t * are accepted. `undefined` rather than `''` as the default is what\n\t\t * distinguishes \"not passed\" from \"passed as empty\".\n\t\t *\n\t\t * @type {string}\n\t\t */\n\t\tmodelValue: { type: String, default: undefined },\n\t\t/**\n\t\t * Layout mode. `edit` shows only the textarea, `preview`\n\t\t * shows only the rendered HTML, `split` shows both\n\t\t * side-by-side.\n\t\t *\n\t\t * @type {'edit'|'split'|'preview'}\n\t\t */\n\t\tmode: {\n\t\t\ttype: String,\n\t\t\tdefault: 'split',\n\t\t\tvalidator: (v) => MODES.includes(v),\n\t\t},\n\n\t\t/** Placeholder for the textarea. */\n\t\tplaceholder: { type: String, default: 'Write Markdown…' },\n\t\t/** Aria-label for the textarea. */\n\t\tariaLabel: { type: String, default: 'Markdown editor input' },\n\t\t/** Minimum textarea rows. */\n\t\trows: { type: Number, default: 10 },\n\t\t/** Disable the textarea (still renders the preview). */\n\t\tdisabled: { type: Boolean, default: false },\n\t\t/** Hide the formatting toolbar entirely. */\n\t\thideToolbar: { type: Boolean, default: false },\n\t\t/** Hide the mode-switch button on the toolbar. */\n\t\thideModeSwitch: { type: Boolean, default: false },\n\t\t/** Mode-switch tooltip. */\n\t\tmodeSwitchTooltip: { type: String, default: 'Cycle layout (edit / split / preview)' },\n\t\t/**\n\t\t * Custom toolbar entries. Each entry: `{id, label, prefix,\n\t\t * suffix?, placeholder?, tooltip?, linePrefix?}`. When\n\t\t * `linePrefix: true` the prefix is inserted at the start\n\t\t * of the current line instead of wrapping the selection.\n\t\t *\n\t\t * @type {Array<object>}\n\t\t */\n\t\ttoolbar: { type: Array, default: () => DEFAULT_TOOLBAR.slice() },\n\t\t/** Optional helper text rendered under the editor. */\n\t\thint: { type: String, default: '' },\n\t\t/**\n\t\t * WYSIWYG mode only: Toast UI toolbar layout (array of button groups).\n\t\t * Ignored in the textarea modes.\n\t\t *\n\t\t * @type {Array<Array<string>>}\n\t\t */\n\t\twysiwygToolbar: { type: Array, default: () => DEFAULT_WYSIWYG_TOOLBAR.map((g) => g.slice()) },\n\t\t/** WYSIWYG mode only: editor height (any CSS length). */\n\t\twysiwygHeight: { type: String, default: '300px' },\n\t},\n\n\t// Declaring the emitted events is not cosmetic under Vue 3: an UNdeclared\n\t// event name also stays in `$attrs` and falls through to the root element,\n\t// so the NATIVE `input` event the `<textarea>` bubbles up is re-emitted by\n\t// the component as its own `input` — after the component's own\n\t// `$emit('input', value)` — and listeners receive the raw InputEvent\n\t// instead of the string.\n\temits: ['input', 'update:modelValue', 'update:mode'],\n\tdata() {\n\t\treturn {\n\t\t\tlocalValue: (this.modelValue !== undefined ? this.modelValue : this.value),\n\t\t\t// Whether the lazily-created Toast UI editor instance is live\n\t\t\t// (WYSIWYG mode only). Drives the loading hint.\n\t\t\ttoastEditorReady: false,\n\t\t}\n\t},\n\n\tcomputed: {\n\t\t/**\n\t\t * BEM modifier for the current layout mode.\n\t\t *\n\t\t * @return {string} The class.\n\t\t */\n\t\tmodeClass() {\n\t\t\treturn `cn-markdown-editor--${this.mode}`\n\t\t},\n\n\t\t/**\n\t\t * Every wrap delimiter the active toolbar can produce, longest first.\n\t\t * Toggling has to recognise the OTHER tools' markers, not just its own,\n\t\t * or alternating bold and italic stacks instead of toggling.\n\t\t *\n\t\t * @return {string[]} The delimiters, longest first.\n\t\t */\n\t\twrapMarkers() {\n\t\t\tconst out = new Set()\n\t\t\tfor (const tool of this.toolbar) {\n\t\t\t\tif (tool.linePrefix || !tool.suffix) {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tout.add(tool.prefix)\n\t\t\t\tout.add(tool.suffix)\n\t\t\t}\n\t\t\treturn [...out].sort((a, b) => b.length - a.length)\n\t\t},\n\n\t\t/**\n\t\t * The value the consumer actually bound, whichever prop they used.\n\t\t *\n\t\t * @return {string} The markdown source.\n\t\t */\n\t\tboundValue() {\n\t\t\treturn this.modelValue !== undefined ? this.modelValue : this.value\n\t\t},\n\n\t\t/**\n\t\t * Rendered HTML for the preview pane. Uses\n\t\t * `cnRenderMarkdown` so the output goes through the lib's\n\t\t * sanitised pipeline.\n\t\t *\n\t\t * @return {string} The rendered HTML.\n\t\t */\n\t\trenderedHtml() {\n\t\t\treturn cnRenderMarkdown(this.localValue || '')\n\t\t},\n\n\t\t/**\n\t\t * Label for the mode-switch button (shows the NEXT mode).\n\t\t *\n\t\t * @return {string} The label.\n\t\t */\n\t\tcurrentModeLabel() {\n\t\t\treturn `▦ ${this.mode}`\n\t\t},\n\n\t\t/**\n\t\t * Toast UI editor options (WYSIWYG mode) — the configured toolbar plus\n\t\t * fixed WYSIWYG defaults.\n\t\t *\n\t\t * @return {object} The Toast UI options object.\n\t\t */\n\t\twysiwygOptions() {\n\t\t\treturn {\n\t\t\t\tminHeight: '200px',\n\t\t\t\tlanguage: 'en-US',\n\t\t\t\thideModeSwitch: true,\n\t\t\t\ttoolbarItems: this.wysiwygToolbar,\n\t\t\t\tinitialEditType: 'wysiwyg',\n\t\t\t}\n\t\t},\n\t},\n\n\twatch: {\n\t\t// Both spellings watched, because either may be the one the consumer\n\t\t// bound. `boundValue` collapses them so the body is written once.\n\t\tmodelValue() {\n\t\t\tthis.onBoundValueChange(this.boundValue)\n\t\t},\n\n\t\tvalue() {\n\t\t\tthis.onBoundValueChange(this.boundValue)\n\t\t},\n\n\t\tmode(next) {\n\t\t\tif (next === 'wysiwyg') {\n\t\t\t\tthis.loadWysiwyg()\n\t\t\t}\n\t\t},\n\t},\n\n\tmounted() {\n\t\tif (this.mode === 'wysiwyg') {\n\t\t\tthis.loadWysiwyg()\n\t\t}\n\t},\n\n\tbeforeUnmount() {\n\t\t// The editor is created imperatively, so Vue will not tear it down.\n\t\tif (this.toastEditor && typeof this.toastEditor.destroy === 'function') {\n\t\t\tthis.toastEditor.destroy()\n\t\t}\n\t\tthis.toastEditor = null\n\t},\n\n\tmethods: {\n\t\tt,\n\t\t/**\n\t\t * Lazily import and instantiate the Toast UI editor (and its CSS) the\n\t\t * first time WYSIWYG mode is entered. Keeps the ~200 KB editor out of\n\t\t * the default textarea path.\n\t\t *\n\t\t * Uses the framework-agnostic `@toast-ui/editor` constructor rather\n\t\t * than a Vue wrapper: `@toast-ui/vue-editor` is published for Vue 2\n\t\t * only and has no Vue-3 build. The instance is held as a plain (NON\n\t\t * reactive) instance property — putting a third-party class instance\n\t\t * in `data()` would wrap it in Vue 3's reactive proxy and break its\n\t\t * internal identity checks.\n\t\t *\n\t\t * @return {Promise<void>}\n\t\t */\n\t\tasync loadWysiwyg() {\n\t\t\tif (this.toastEditor) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\ttry {\n\t\t\t\tconst [{ default: Editor }] = await Promise.all([\n\t\t\t\t\timport('@toast-ui/editor'),\n\t\t\t\t\timport('@toast-ui/editor/dist/toastui-editor.css'),\n\t\t\t\t])\n\t\t\t\tawait this.$nextTick()\n\t\t\t\tconst el = this.$refs.toastHost\n\t\t\t\tif (!el) {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\t// customHTMLSanitizer does not reach Toast UI's raw HTML\n\t\t\t\t// converters, paste or setHTML; the guarded class routes those\n\t\t\t\t// through DOMPurify 3 as well (see utils/toastUiRawHtmlGuard.js).\n\t\t\t\tconst GuardedEditor = guardedToastUiEditorClass(Editor)\n\t\t\t\tthis.toastEditor = new GuardedEditor({\n\t\t\t\t\tel,\n\t\t\t\t\t...this.wysiwygOptions,\n\t\t\t\t\tinitialValue: this.localValue,\n\t\t\t\t\tpreviewStyle: 'tab',\n\t\t\t\t\theight: this.wysiwygHeight,\n\t\t\t\t\tevents: { change: this.onWysiwygChange },\n\t\t\t\t\t// Replaces the DOMPurify 2.3.3 copy that @toast-ui/editor\n\t\t\t\t\t// inlines into its own bundle (unmaintained since 2023, so\n\t\t\t\t\t// no npm-level fix exists). Same sanitising contract, run\n\t\t\t\t\t// by the maintained DOMPurify 3.x — see the module docs.\n\t\t\t\t\t// Set last so a consumer cannot drop it via wysiwygOptions.\n\t\t\t\t\tcustomHTMLSanitizer: toastUiSanitizer,\n\t\t\t\t})\n\t\t\t\tthis.toastEditorReady = true\n\t\t\t} catch (e) {\n\t\t\t\t// eslint-disable-next-line no-console -- diagnostic for a failure this code already degrades from\n\t\t\t\tconsole.error('CnMarkdownEditor: failed to load the WYSIWYG editor', e)\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Toast UI change handler — read the current markdown and emit it via\n\t\t * v-model.\n\t\t *\n\t\t * @return {void}\n\t\t */\n\t\tonWysiwygChange() {\n\t\t\tif (!this.toastEditor || typeof this.toastEditor.getMarkdown !== 'function') {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst markdown = this.toastEditor.getMarkdown()\n\t\t\tthis.localValue = markdown\n\t\t\t/**\n\t\t\t * @event input v-model emit.\n\t\t\t * @type {string}\n\t\t\t */\n\t\t\tthis.emitValue(markdown)\n\t\t},\n\n\t\t/**\n\t\t * Adopt a value pushed in from outside.\n\t\t *\n\t\t * @param {string} next The new markdown.\n\t\t * @return {void}\n\t\t */\n\t\tonBoundValueChange(next) {\n\t\t\tif (next === this.localValue) {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tthis.localValue = next\n\t\t\t// The imperative editor holds its own copy of the document, so an\n\t\t\t// external v-model change has to be pushed into it. Guarded on the\n\t\t\t// current markdown so we don't clobber the caret while the user is\n\t\t\t// typing (our own change handler round-trips here).\n\t\t\tif (this.toastEditor && this.toastEditor.getMarkdown() !== next) {\n\t\t\t\tthis.toastEditor.setMarkdown(next || '')\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Tell the consumer the value changed, in both v-model dialects.\n\t\t *\n\t\t * BOTH are emitted, always. A consumer on `@input` and a consumer on\n\t\t * `v-model` are the same consumer as far as this component knows, and\n\t\t * emitting only one silently breaks half of them.\n\t\t *\n\t\t * @param {string} next The new markdown.\n\t\t * @return {void}\n\t\t */\n\t\temitValue(next) {\n\t\t\t/**\n\t\t\t * @event input The value changed. Vue 2's v-model dialect, kept for\n\t\t\t * existing consumers.\n\t\t\t * @type {unknown}\n\t\t\t */\n\t\t\tthis.$emit('input', next)\n\t\t\t/**\n\t\t\t * @event update:modelValue The value changed. Vue 3's v-model\n\t\t\t * dialect — what a plain `v-model` listens for.\n\t\t\t * @type {unknown}\n\t\t\t */\n\t\t\tthis.$emit('update:modelValue', next)\n\t\t},\n\n\t\t/**\n\t\t * Textarea input handler — pushes the new value upward via\n\t\t * v-model.\n\t\t *\n\t\t * @param {InputEvent} event The input event.\n\t\t * @return {void}\n\t\t */\n\t\tonInput(event) {\n\t\t\tthis.localValue = event.target.value\n\t\t\t/**\n\t\t\t * @event input v-model emit.\n\t\t\t * @type {string}\n\t\t\t */\n\t\t\tthis.emitValue(this.localValue)\n\t\t},\n\n\t\t/**\n\t\t * Keyboard handler. Ctrl/Cmd+B / Ctrl/Cmd+I trigger bold / italic;\n\t\t * Enter continues (or exits) a list; Tab / Shift+Tab indent / dedent a\n\t\t * list item. Anything else falls through to the textarea default.\n\t\t *\n\t\t * @param {KeyboardEvent} event The keydown event.\n\t\t * @return {void}\n\t\t */\n\t\tonKeydown(event) {\n\t\t\tconst ta = this.$refs.textarea\n\t\t\tif (!ta) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif (event.ctrlKey || event.metaKey) {\n\t\t\t\tlet toolId = null\n\t\t\t\tif (event.key === 'b' || event.key === 'B') {\n\t\t\t\t\ttoolId = 'bold'\n\t\t\t\t} else if (event.key === 'i' || event.key === 'I') {\n\t\t\t\t\ttoolId = 'italic'\n\t\t\t\t}\n\t\t\t\tif (!toolId) {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tconst tool = this.toolbar.find((t) => t.id === toolId)\n\t\t\t\tif (!tool) {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tevent.preventDefault()\n\t\t\t\tthis.invokeTool(tool)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif (event.altKey) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif (event.key === 'Enter' && !event.shiftKey) {\n\t\t\t\tthis.handleListEnter(event, ta)\n\t\t\t} else if (event.key === 'Tab') {\n\t\t\t\tthis.handleListTab(event, ta)\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Smart Enter inside a list: continue with the next marker (incrementing\n\t\t * ordered / alpha markers), or — when the current item is empty — break\n\t\t * out of the list, leaving a blank line so the user types normally. No-op\n\t\t * (default newline) unless the caret is in a list item's body.\n\t\t *\n\t\t * @param {KeyboardEvent} event The keydown event.\n\t\t * @param {HTMLTextAreaElement} ta The textarea element.\n\t\t * @return {void}\n\t\t */\n\t\thandleListEnter(event, ta) {\n\t\t\tconst value = this.localValue\n\t\t\tconst selStart = ta.selectionStart\n\t\t\tif (selStart !== ta.selectionEnd) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst lineStart = value.slice(0, selStart).lastIndexOf('\\n') + 1\n\t\t\tconst nl = value.indexOf('\\n', selStart)\n\t\t\tconst lineEnd = nl === -1 ? value.length : nl\n\t\t\tconst m = value.slice(lineStart, lineEnd).match(LIST_ITEM_RE)\n\t\t\tif (!m) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst [, indent, marker, gap, content] = m\n\t\t\t// Only act once the caret is past the marker (in the item body).\n\t\t\tif (selStart < lineStart + indent.length + marker.length + gap.length) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tevent.preventDefault()\n\t\t\tif (content.trim() === '') {\n\t\t\t\t// Empty item → exit the list: drop the marker, leave a blank line.\n\t\t\t\tconst next = `${value.slice(0, lineStart)}${value.slice(lineEnd)}`\n\t\t\t\tthis.applyTextChange(next, lineStart, lineStart)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst insertion = `\\n${indent}${nextListMarker(marker)}${gap}`\n\t\t\tconst next = `${value.slice(0, selStart)}${insertion}${value.slice(selStart)}`\n\t\t\tconst caret = selStart + insertion.length\n\t\t\tthis.applyTextChange(next, caret, caret)\n\t\t},\n\n\t\t/**\n\t\t * Smart Tab inside a list: Tab indents the current line (or every line\n\t\t * spanned by the selection) by one level; Shift+Tab dedents it. Only\n\t\t * hijacks Tab when the caret's line is a list item, so Tab still moves\n\t\t * focus in plain text.\n\t\t *\n\t\t * @param {KeyboardEvent} event The keydown event.\n\t\t * @param {HTMLTextAreaElement} ta The textarea element.\n\t\t * @return {void}\n\t\t */\n\t\thandleListTab(event, ta) {\n\t\t\tconst value = this.localValue\n\t\t\tconst selStart = ta.selectionStart\n\t\t\tconst selEnd = ta.selectionEnd\n\t\t\tconst firstLineStart = value.slice(0, selStart).lastIndexOf('\\n') + 1\n\t\t\tconst firstNl = value.indexOf('\\n', firstLineStart)\n\t\t\tconst firstLineEnd = firstNl === -1 ? value.length : firstNl\n\t\t\tif (!LIST_ITEM_RE.test(value.slice(firstLineStart, firstLineEnd))) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tevent.preventDefault()\n\t\t\tconst endRef = selEnd > selStart ? selEnd - 1 : selEnd\n\t\t\tconst lastNl = value.indexOf('\\n', endRef)\n\t\t\tconst blockEnd = lastNl === -1 ? value.length : lastNl\n\t\t\tconst lines = value.slice(firstLineStart, blockEnd).split('\\n')\n\t\t\tlet firstDelta = 0\n\t\t\tlet newLines\n\t\t\tif (event.shiftKey) {\n\t\t\t\tnewLines = lines.map((ln, i) => {\n\t\t\t\t\tlet strip = 0\n\t\t\t\t\tif (ln.startsWith('\\t')) {\n\t\t\t\t\t\tstrip = 1\n\t\t\t\t\t} else {\n\t\t\t\t\t\twhile (strip < 2 && ln[strip] === ' ') {\n\t\t\t\t\t\t\tstrip++\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif (i === 0) {\n\t\t\t\t\t\tfirstDelta = -strip\n\t\t\t\t\t}\n\t\t\t\t\treturn ln.slice(strip)\n\t\t\t\t})\n\t\t\t} else {\n\t\t\t\tnewLines = lines.map((ln) => `${LIST_INDENT}${ln}`)\n\t\t\t\tfirstDelta = LIST_INDENT.length\n\t\t\t}\n\t\t\tconst newBlock = newLines.join('\\n')\n\t\t\tconst next = `${value.slice(0, firstLineStart)}${newBlock}${value.slice(blockEnd)}`\n\t\t\tif (selStart === selEnd) {\n\t\t\t\tconst caret = Math.max(firstLineStart, selStart + firstDelta)\n\t\t\t\tthis.applyTextChange(next, caret, caret)\n\t\t\t} else {\n\t\t\t\tthis.applyTextChange(next, firstLineStart, firstLineStart + newBlock.length)\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Commit a programmatic edit: update the model, emit `input`, then\n\t\t * restore focus + selection on the next tick.\n\t\t *\n\t\t * @param {string} next The new textarea value.\n\t\t * @param {number} selStart The caret/selection start to restore.\n\t\t * @param {number} selEnd The selection end to restore.\n\t\t * @return {void}\n\t\t */\n\t\tapplyTextChange(next, selStart, selEnd) {\n\t\t\tthis.localValue = next\n\t\t\tthis.emitValue(next)\n\t\t\tthis.$nextTick(() => {\n\t\t\t\tconst ta = this.$refs.textarea\n\t\t\t\tif (!ta) {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tta.focus()\n\t\t\t\tta.setSelectionRange(selStart, selEnd)\n\t\t\t})\n\t\t},\n\n\t\t/**\n\t\t * Cycle the layout mode `edit → split → preview → edit`.\n\t\t *\n\t\t * @return {void}\n\t\t */\n\t\tcycleMode() {\n\t\t\tconst idx = MODES.indexOf(this.mode)\n\t\t\tconst next = MODES[(idx + 1) % MODES.length]\n\t\t\t/**\n\t\t\t * @event update:mode v-model:mode emit so consumers can bind the layout mode.\n\t\t\t * @type {'edit'|'split'|'preview'}\n\t\t\t */\n\t\t\tthis.$emit('update:mode', next)\n\t\t},\n\n\t\t/**\n\t\t * Apply a toolbar action — either prefix the current line\n\t\t * (`linePrefix: true`) or wrap the current selection.\n\t\t *\n\t\t * @param {object} tool The toolbar entry.\n\t\t * @return {void}\n\t\t */\n\t\tinvokeTool(tool) {\n\t\t\tconst ta = this.$refs.textarea\n\t\t\tif (!ta) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst before = this.localValue.slice(0, ta.selectionStart)\n\t\t\tconst selected = this.localValue.slice(ta.selectionStart, ta.selectionEnd)\n\t\t\tconst after = this.localValue.slice(ta.selectionEnd)\n\n\t\t\tlet nextValue\n\t\t\tlet nextSelStart\n\t\t\tlet nextSelEnd\n\t\t\tif (tool.linePrefix) {\n\t\t\t\t// Line-prefix mode (headings, list, quote): toggle/replace the\n\t\t\t\t// marker on the current line rather than stacking it. Operates on\n\t\t\t\t// the whole line under the caret, ignoring any selection.\n\t\t\t\tconst lineStart = before.lastIndexOf('\\n') + 1\n\t\t\t\tconst afterNl = after.indexOf('\\n')\n\t\t\t\tconst lineEnd = afterNl === -1 ? this.localValue.length : ta.selectionEnd + afterNl\n\t\t\t\tconst head = this.localValue.slice(0, lineStart)\n\t\t\t\tconst line = this.localValue.slice(lineStart, lineEnd)\n\t\t\t\tconst tail = this.localValue.slice(lineEnd)\n\n\t\t\t\t// Strip an existing recognised marker (heading #…, list -/*, quote >)\n\t\t\t\t// so switching one for another REPLACES it (e.g. `# ` → `## `, never\n\t\t\t\t// `## #`); re-applying the same marker toggles it off.\n\t\t\t\tconst existing = (line.match(/^(#{1,6} |[-*] |> )/) || [''])[0]\n\t\t\t\tconst body = line.slice(existing.length)\n\t\t\t\tconst newLine = existing === tool.prefix ? body : `${tool.prefix}${body}`\n\n\t\t\t\tnextValue = `${head}${newLine}${tail}`\n\t\t\t\t// Keep the caret/selection in the body, shifted by the marker delta.\n\t\t\t\tconst delta = newLine.length - line.length\n\t\t\t\tconst min = lineStart\n\t\t\t\tconst max = lineStart + newLine.length\n\t\t\t\tnextSelStart = Math.min(Math.max(ta.selectionStart + delta, min), max)\n\t\t\t\tnextSelEnd = Math.min(Math.max(ta.selectionEnd + delta, min), max)\n\t\t\t} else {\n\t\t\t\t// Wrap mode (bold/italic/link/code): toggle. If the selection is\n\t\t\t\t// already wrapped in this tool's delimiters — either they're part\n\t\t\t\t// of the selection, or they sit around it — strip them; otherwise\n\t\t\t\t// add them. Stops `**`/`_` from stacking on repeat presses.\n\t\t\t\tconst p = tool.prefix\n\t\t\t\tconst s = tool.suffix || ''\n\t\t\t\tconst wrappedInside = selected.length >= p.length + s.length\n\t\t\t\t\t&& selected.startsWith(p)\n\t\t\t\t\t&& selected.endsWith(s)\n\n\t\t\t\t// Not just the delimiters immediately against the selection: read\n\t\t\t\t// the whole run on each side, so this tool's pair is still found\n\t\t\t\t// with another tool's nested inside it. Toggling bold on\n\t\t\t\t// `**_text_**` has to see the `**` through the `_`, or alternating\n\t\t\t\t// bold and italic stacks markers forever instead of toggling.\n\t\t\t\tconst markers = this.wrapMarkers\n\t\t\t\tconst leftRun = s === '' ? [] : peelMarkers(before, markers, true)\n\t\t\t\tconst rightRun = s === '' ? [] : peelMarkers(after, markers, false)\n\t\t\t\t// Same depth on both sides: that is what makes them a pair.\n\t\t\t\tconst depth = leftRun.findIndex((m, i) => m === p && rightRun[i] === s)\n\n\t\t\t\tif (wrappedInside) {\n\t\t\t\t\tconst inner = selected.slice(p.length, selected.length - s.length)\n\t\t\t\t\tnextValue = `${before}${inner}${after}`\n\t\t\t\t\tnextSelStart = before.length\n\t\t\t\t\tnextSelEnd = nextSelStart + inner.length\n\t\t\t\t} else if (depth !== -1) {\n\t\t\t\t\t// Selection is the inner text; drop this tool's pair and leave\n\t\t\t\t\t// every marker nested inside it where it is.\n\t\t\t\t\tconst pStart = before.length\n\t\t\t\t\t\t- leftRun.slice(0, depth).reduce((n, m) => n + m.length, 0)\n\t\t\t\t\t\t- p.length\n\t\t\t\t\tconst sStart = rightRun.slice(0, depth).reduce((n, m) => n + m.length, 0)\n\t\t\t\t\tnextValue = before.slice(0, pStart)\n\t\t\t\t\t\t+ before.slice(pStart + p.length)\n\t\t\t\t\t\t+ selected\n\t\t\t\t\t\t+ after.slice(0, sStart)\n\t\t\t\t\t\t+ after.slice(sStart + s.length)\n\t\t\t\t\tnextSelStart = before.length - p.length\n\t\t\t\t\tnextSelEnd = nextSelStart + selected.length\n\t\t\t\t} else {\n\t\t\t\t\tconst inner = selected || tool.placeholder || ''\n\t\t\t\t\tconst insertion = `${p}${inner}${s}`\n\t\t\t\t\tnextValue = `${before}${insertion}${after}`\n\t\t\t\t\tnextSelStart = before.length + p.length\n\t\t\t\t\tnextSelEnd = nextSelStart + inner.length\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tthis.localValue = nextValue\n\t\t\tthis.emitValue(nextValue)\n\t\t\tthis.$nextTick(() => {\n\t\t\t\tta.focus()\n\t\t\t\tta.setSelectionRange(nextSelStart, nextSelEnd)\n\t\t\t})\n\t\t},\n\n\t\t/**\n\t\t * Programmatic insert helper — exposed publicly so parents\n\t\t * can drop content at the caret (e.g. from a file-picker\n\t\t * callback inserting a `![alt](url)` reference).\n\t\t *\n\t\t * @param {string} text The text to insert at the caret.\n\t\t * @return {void}\n\t\t */\n\t\tinsertAtCaret(text) {\n\t\t\tconst ta = this.$refs.textarea\n\t\t\tif (!ta) {\n\t\t\t\tthis.localValue += text\n\t\t\t\tthis.emitValue(this.localValue)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst before = this.localValue.slice(0, ta.selectionStart)\n\t\t\tconst after = this.localValue.slice(ta.selectionEnd)\n\t\t\tconst next = `${before}${text}${after}`\n\t\t\tconst caret = before.length + text.length\n\t\t\tthis.localValue = next\n\t\t\tthis.emitValue(next)\n\t\t\tthis.$nextTick(() => {\n\t\t\t\tta.focus()\n\t\t\t\tta.setSelectionRange(caret, caret)\n\t\t\t})\n\t\t},\n\t},\n}\n</script>\n\n<style scoped>\n.cn-markdown-editor {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 8px;\n\tborder: 1px solid var(--color-border);\n\tborder-radius: var(--border-radius);\n\tbackground: var(--color-main-background);\n\toverflow: hidden;\n}\n\n.cn-markdown-editor__toolbar {\n\tdisplay: flex;\n\tgap: 4px;\n\tpadding: 6px;\n\tborder-bottom: 1px solid var(--color-border);\n\tbackground: var(--color-background-hover);\n}\n\n.cn-markdown-editor__tool {\n\tbackground: var(--color-main-background);\n\tborder: 1px solid var(--color-border);\n\tborder-radius: var(--border-radius);\n\tpadding: 4px 8px;\n\tcursor: pointer;\n\tfont-family: monospace;\n\tmin-width: 28px;\n}\n\n.cn-markdown-editor__tool:hover {\n\tbackground: var(--color-background-darker, var(--color-background-hover));\n}\n\n.cn-markdown-editor__spacer {\n\tflex: 1 1 auto;\n}\n\n.cn-markdown-editor__panes {\n\tdisplay: grid;\n\tgrid-template-columns: 1fr;\n\tmin-height: 200px;\n}\n\n.cn-markdown-editor__panes[data-mode=\"split\"] {\n\tgrid-template-columns: 1fr 1fr;\n}\n\n.cn-markdown-editor__textarea {\n\tborder: none;\n\toutline: none;\n\tpadding: 10px 12px;\n\tfont-family: monospace;\n\tfont-size: 0.95em;\n\tresize: vertical;\n\twidth: 100%;\n\tbackground: var(--color-main-background);\n\tcolor: var(--color-main-text);\n\t/* Nested list indents are single tabs (see LIST_INDENT); render them\n\t compactly rather than the 8-char browser default. */\n\ttab-size: 2;\n\t-moz-tab-size: 2;\n}\n\n.cn-markdown-editor__preview {\n\tpadding: 10px 14px;\n\tborder-left: 1px solid var(--color-border);\n\tbackground: var(--color-main-background);\n\toverflow-y: auto;\n\tmin-height: 200px;\n}\n\n.cn-markdown-editor__panes[data-mode=\"preview\"] .cn-markdown-editor__preview {\n\tborder-left: none;\n}\n\n.cn-markdown-editor__hint {\n\tcolor: var(--color-text-maxcontrast);\n\tpadding: 0 10px 8px;\n}\n\n/* WYSIWYG (Toast UI) mode — themed with Nextcloud CSS variables. */\n.cn-markdown-editor__wysiwyg {\n\twidth: 100%;\n}\n\n.cn-markdown-editor__wysiwyg :deep(.toastui-editor-defaultUI) {\n\tfont-family: var(--font-face) !important;\n\tbackground-color: var(--color-main-background) !important;\n\tborder: none !important;\n}\n\n.cn-markdown-editor__wysiwyg :deep(.toastui-editor-toolbar) {\n\tbackground-color: var(--color-background-hover) !important;\n\tborder-bottom: 1px solid var(--color-border-dark) !important;\n}\n\n.cn-markdown-editor__wysiwyg :deep(.toastui-editor-toolbar-icons button) {\n\tcolor: var(--color-main-text) !important;\n\tbackground-color: transparent !important;\n\tborder: none !important;\n}\n\n.cn-markdown-editor__wysiwyg :deep(.toastui-editor-toolbar-icons button:hover) {\n\tbackground-color: var(--color-background-dark) !important;\n}\n\n.cn-markdown-editor__wysiwyg :deep(.toastui-editor-contents),\n.cn-markdown-editor__wysiwyg :deep(.ProseMirror) {\n\tcolor: var(--color-main-text) !important;\n\tbackground-color: var(--color-main-background) !important;\n\tfont-family: var(--font-face) !important;\n}\n</style>\n"],"names":["_createElementBlock","_normalizeClass","_openBlock","_Fragment","_renderList","_createElementVNode","_toDisplayString","_withDirectives"],"mappings":";;;;AAGiD,EAAA,KAAK,EAAC,6BAA4B;AAAE,EAAA,IAAI,EAAC,SAAS;;;;;;;;;AA4CrF,EAAA,KAAK,EAAC,6BAA8B;AAAA,EAAA,aAAW,EAAC,qBAAqB;;AACjD,MAAA,UAAA,GAAA,EAAA,GAAG,EAAC;;;AACP,EAAA,KAAK,EAAC,0BAA0B;;;;AAM1C,EAAA,KAAK,EAAC,0BAA0B;;;;uBAtDpDA,kBAuDK,CAAA,KAAA,EAAA;IAvDA,KAAK,EAAAC,cAAA,CAAA,CAAC,oBAAqB,EAAyC,QAAS,CAAA,SAAA,CAAA,CAAA;AAAlD,IAAA,aAAW,EAAC,oBAAmB;;AAElD,IAAA,CAAA,CAAA,MAAA,CAAA,WAAU,IAAK;AAA3B,SAAAC,SAAA,EAAA,EAAAF,kBAAA,CAmBK,OAnBL,UAmBK,EAAA;4BAlBJA,kBAQQ,CAAAG,QAAA,EAAA,IAAA,EAAAC,UAAA,CARe,MAAO,CAAA,OAAA,EAAA,CAAf,IAAG,KAAA;iCAAlBJ,kBAQQ,CAAA,QAAA,EAAA;cAPN,GAAG,EAAE,IAAI,CAAC,EAAE;AACb,cAAA,IAAI,EAAC,QAAO;AACZ,cAAA,KAAK,EAAC,0BAAyB;AAC9B,cAAA,KAAK,EAAE,IAAI,CAAC,OAAM,IAAK,IAAI,CAAC,KAAK;cACjC,aAAW,EAAA,OAAA,GAAY,IAAI,CAAC,EAAE;cAC9B,OAAK,EAAA,MAAA,KAAE,QAAU,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AAA,IAAA,CAAA,CAAA,CAAA;;;WACT,MAAG,CAAA,IAAA,KAAA,MAAA;4BAAdA,kBAGyB,CAAA,KAAA,EAAA;;AAFxB,gBAAA,KAAK,EAAC,6BAA4B;AAClC,gBAAA,aAAW,EAAC,qBAAoB;AAChC,gBAAA,SAAoB,EAAZ,QAAY,CAAA,YAAA;;;;AAOtB,SAAAE,SAAA,EAAA,EAAAF,kBAAA,CAKK,OALL,UAKK,EAAA;AAJJ,UAAAO,cAAA,CAAAF,kBAAA,CAAgD,OAAhD,UAAgD,EAAA,IAAA,EAAA,GAAA,kBAAA,EAAA;oBAAnC,KAAgB,CAAA,gBAAA,CAAA;;YACnB,KAAgB,CAAA,gBAAA;4BAA1BL,kBAEG,CAAA,GAAA,EAFH,UAEG,EAAAM,eAAA,CADC,QAAC,CAAA,CAAA,CAAA,eAAA,EAAA,iBAAA,CAAA,CAAA,EAAA,CAAA,YAAA;;;KAKO,MAAI,CAAA,IAAA;sBAAjBN,kBAAqE,CAAA,OAAA,EAArE,WAAqE,EAAAM,eAAA,CAAd,MAAK,CAAA,IAAA,CAAA,EAAA,CAAA,YAAA;;;;;;;"}
1
+ {"version":3,"file":"CnMarkdownEditor.vue3.js","sources":["../../../../src/components/CnMarkdownEditor/CnMarkdownEditor.vue?vue&type=template&id=8f860382&lang.js"],"sourcesContent":["<template>\n\t<div class=\"cn-markdown-editor\" data-testid=\"cn-markdown-editor\" :class=\"modeClass\">\n\t\t<!-- Toolbar with formatting shortcuts (textarea modes only; WYSIWYG has its own). -->\n\t\t<div v-if=\"!hideToolbar && mode !== 'wysiwyg'\" class=\"cn-markdown-editor__toolbar\" role=\"toolbar\">\n\t\t\t<button v-for=\"tool in toolbar\"\n\t\t\t\t:key=\"tool.id\"\n\t\t\t\ttype=\"button\"\n\t\t\t\tclass=\"cn-markdown-editor__tool\"\n\t\t\t\t:title=\"tool.tooltip || tool.label\"\n\t\t\t\t:data-testid=\"'tool-' + tool.id\"\n\t\t\t\t@click=\"invokeTool(tool)\">\n\t\t\t\t<span>{{ tool.label }}</span>\n\t\t\t</button>\n\t\t\t<span class=\"cn-markdown-editor__spacer\" />\n\t\t\t<button v-if=\"!hideModeSwitch\"\n\t\t\t\ttype=\"button\"\n\t\t\t\tclass=\"cn-markdown-editor__tool cn-markdown-editor__mode-switch\"\n\t\t\t\t:title=\"modeSwitchTooltip\"\n\t\t\t\tdata-testid=\"mode-switch\"\n\t\t\t\t@click=\"cycleMode\">\n\t\t\t\t{{ currentModeLabel }}\n\t\t\t</button>\n\t\t</div>\n\n\t\t<div v-if=\"variableList.length > 0 && !disabled && mode !== 'preview'\" class=\"cn-markdown-editor__variables\" data-testid=\"cn-markdown-variables\">\n\t\t\t<NcActions :menuName=\"insertVariableLabel\" :forceName=\"true\">\n\t\t\t\t<NcActionButton v-for=\"variable in variableList\"\n\t\t\t\t\t:key=\"variable.name\"\n\t\t\t\t\t:description=\"variable.description || `{${variable.name}}`\"\n\t\t\t\t\t:data-testid=\"'variable-' + variable.name\"\n\t\t\t\t\t@click=\"insertVariable(variable.name)\">\n\t\t\t\t\t{{ variable.label }}\n\t\t\t\t</NcActionButton>\n\t\t\t</NcActions>\n\t\t</div>\n\n\t\t<!-- Pane layout: edit / preview / split (textarea + rendered preview). -->\n\t\t<div v-if=\"mode !== 'wysiwyg'\" class=\"cn-markdown-editor__panes\" :data-mode=\"mode\">\n\t\t\t<textarea v-if=\"mode !== 'preview'\"\n\t\t\t\tref=\"textarea\"\n\t\t\t\tclass=\"cn-markdown-editor__textarea\"\n\t\t\t\t:value=\"localValue\"\n\t\t\t\t:placeholder=\"placeholder\"\n\t\t\t\t:rows=\"rows\"\n\t\t\t\t:disabled=\"disabled\"\n\t\t\t\t:aria-label=\"ariaLabel\"\n\t\t\t\tdata-testid=\"cn-markdown-textarea\"\n\t\t\t\t@input=\"onInput\"\n\t\t\t\t@keydown=\"onKeydown\" />\n\t\t\t<div v-if=\"mode !== 'edit'\"\n\t\t\t\tclass=\"cn-markdown-editor__preview\"\n\t\t\t\tdata-testid=\"cn-markdown-preview\"\n\t\t\t\tv-html=\"renderedHtml\" /><!-- eslint-disable-line vue/no-v-html -- renderedHtml comes from cnRenderMarkdown(), which sanitises through DOMPurify -->\n\t\t</div>\n\n\t\t<!-- WYSIWYG mode: lazily-instantiated Toast UI editor. The editor is\n\t\t driven imperatively against `toastHost` rather than through a Vue\n\t\t wrapper component — `@toast-ui/vue-editor` is Vue-2 only, so the\n\t\t Vue-3 line uses the framework-agnostic `@toast-ui/editor` API. -->\n\t\t<div v-else class=\"cn-markdown-editor__wysiwyg\" data-testid=\"cn-markdown-wysiwyg\">\n\t\t\t<div v-show=\"toastEditorReady\" ref=\"toastHost\" />\n\t\t\t<p v-if=\"!toastEditorReady\" class=\"cn-markdown-editor__hint\">\n\t\t\t\t{{ t('nextcloud-vue', 'Loading editor…') }}\n\t\t\t</p>\n\t\t</div>\n\n\t\t<p v-if=\"unknownVariables.length > 0\"\n\t\t\tclass=\"cn-markdown-editor__error\"\n\t\t\trole=\"alert\"\n\t\t\tdata-testid=\"cn-markdown-unknown-variables\">\n\t\t\t{{ unknownVariableMessage }}\n\t\t</p>\n\n\t\t<!-- Hint row. -->\n\t\t<small v-if=\"hint\" class=\"cn-markdown-editor__hint\">{{ hint }}</small>\n\t</div>\n</template>\n\n<script>\nimport { translate as t } from '@nextcloud/l10n'\nimport { NcActionButton, NcActions } from '@nextcloud/vue'\nimport { cnRenderMarkdown } from '../../composables/cnRenderMarkdown.js'\nimport { unknownTemplateVariables } from '../../utils/templateVariables.js'\nimport { guardedToastUiEditorClass } from '../../utils/toastUiRawHtmlGuard.js'\nimport { toastUiSanitizer } from '../../utils/toastUiSanitizer.js'\n\n/**\n * Default formatting toolbar — Markdown insertions that wrap a\n * selection or insert a placeholder.\n *\n * @type {Array<{id:string,label:string,prefix:string,suffix?:string,placeholder?:string}>}\n */\nconst DEFAULT_TOOLBAR = Object.freeze([\n\t{ id: 'bold', label: 'B', prefix: '**', suffix: '**', placeholder: 'bold', tooltip: 'Bold (Ctrl+B)' },\n\t{ id: 'italic', label: 'I', prefix: '_', suffix: '_', placeholder: 'italic', tooltip: 'Italic (Ctrl+I)' },\n\t{ id: 'h1', label: 'H1', prefix: '# ', suffix: '', placeholder: 'Heading', tooltip: 'Heading 1', linePrefix: true },\n\t{ id: 'h2', label: 'H2', prefix: '## ', suffix: '', placeholder: 'Heading', tooltip: 'Heading 2', linePrefix: true },\n\t{ id: 'link', label: '🔗', prefix: '[', suffix: '](https://)', placeholder: 'link text', tooltip: 'Link' },\n\t{ id: 'code', label: '`</>`', prefix: '`', suffix: '`', placeholder: 'code', tooltip: 'Inline code' },\n\t{ id: 'list', label: '•', prefix: '- ', suffix: '', placeholder: 'item', tooltip: 'List', linePrefix: true },\n\t{ id: 'quote', label: '“”', prefix: '> ', suffix: '', placeholder: 'quote', tooltip: 'Quote', linePrefix: true },\n])\n\nconst MODES = ['edit', 'split', 'preview', 'wysiwyg']\n\n/**\n * Matches a list item at the start of a line: leading indentation, a bullet\n * (`-`/`*`/`+`) or ordered marker (`1.`/`1)`), the whitespace after it, then the\n * item body. Drives the smart Enter / Tab list handling. Only the markers\n * CommonMark actually renders as lists are recognised (no `a.`/`A)` alpha\n * markers — Markdown renders those as plain text).\n *\n * @type {RegExp}\n */\nconst LIST_ITEM_RE = /^([ \\t]*)([-*+]|\\d+[.)])([ \\t]+)(.*)$/\n\n/** One indent step for nesting list items (a tab; textarea uses `tab-size: 2`). */\nconst LIST_INDENT = '\\t'\n\n/**\n * The marker that continues a list after `marker`: unordered bullets repeat;\n * numeric markers increment (`1.`→`2.`, `1)`→`2)`) keeping the `.`/`)` delimiter.\n *\n * @param {string} marker The current line's list marker (e.g. `-`, `1.`).\n * @return {string} The next item's marker.\n */\nfunction nextListMarker(marker) {\n\tconst ordered = marker.match(/^(\\d+)([.)])$/)\n\tif (!ordered) {\n\t\treturn marker\n\t}\n\treturn `${parseInt(ordered[1], 10) + 1}${ordered[2]}`\n}\n\n/**\n * Read off the run of wrap markers sitting against one edge of the selection,\n * innermost first. `**_` to the left of the caret yields `['_', '**']`.\n *\n * `markers` must be ordered longest-first so `**` is never read as two `*`.\n *\n * @param {string} text The text on that side of the selection.\n * @param {string[]} markers Known wrap delimiters, longest first.\n * @param {boolean} fromEnd Scan backwards from the end (the text BEFORE the\n * selection) rather than forwards from the start (the text AFTER it).\n * @return {string[]} The markers found, innermost first.\n */\nfunction peelMarkers(text, markers, fromEnd) {\n\tconst found = []\n\tlet rest = text\n\tconst nextMarker = () => markers.find((m) => m !== '' && (fromEnd ? rest.endsWith(m) : rest.startsWith(m)))\n\tfor (let hit = nextMarker(); hit; hit = nextMarker()) {\n\t\tfound.push(hit)\n\t\trest = fromEnd ? rest.slice(0, rest.length - hit.length) : rest.slice(hit.length)\n\t}\n\treturn found\n}\n\n/**\n * Default Toast UI WYSIWYG toolbar layout — used only in `mode: 'wysiwyg'`.\n *\n * @type {Array<Array<string>>}\n */\nconst DEFAULT_WYSIWYG_TOOLBAR = Object.freeze([\n\t['heading', 'bold', 'italic', 'strike'],\n\t['hr', 'quote'],\n\t['ul', 'ol', 'task', 'indent', 'outdent'],\n\t['table', 'image', 'link'],\n\t['code', 'codeblock'],\n])\n\n/**\n * CnMarkdownEditor — Markdown editor with a textarea + live HTML\n * preview, a formatting toolbar, and four layout modes (edit /\n * split / preview / wysiwyg).\n *\n * The default path is a `<textarea>` + `cnRenderMarkdown` preview.\n * Setting `mode: 'wysiwyg'` opts into a rich Toast UI WYSIWYG editor\n * that is **lazily loaded** only when that mode is active — the\n * textarea modes carry no editor dependency. The `v-model` contract\n * is identical across all modes (`value` in, `input` out).\n *\n * With `variables`, a menu inserts `{name}` at the caret and the editor\n * names every `{…}` in the text that is not allowed, under the editor and\n * through the `unknown-variables` event, so a host can refuse to save.\n *\n * ```vue\n * <CnMarkdownEditor v-model=\"article\" placeholder=\"Write your article …\" />\n * <CnMarkdownEditor v-model=\"article\" mode=\"wysiwyg\" />\n * ```\n *\n * Toolbar buttons either wrap the current selection or insert a\n * placeholder (`bold` / `italic` / `link` / `code`) OR prefix the\n * current line (`h1` / `h2` / `list` / `quote`). The `toolbar`\n * prop lets consumers replace the default set.\n */\nexport default {\n\tname: 'CnMarkdownEditor',\n\n\tcomponents: { NcActionButton, NcActions },\n\tprops: {\n\t\t/**\n\t\t * Markdown source (v-model).\n\t\t *\n\t\t * @type {string}\n\t\t */\n\t\tvalue: { type: String, default: '' },\n\t\t/**\n\t\t * Markdown source, Vue 3's own v-model prop.\n\t\t *\n\t\t * ⚠️ WITHOUT THIS, `v-model` ON THIS COMPONENT DOES NOTHING. Vue 3\n\t\t * compiles `v-model=\"x\"` to `:modelValue` + `@update:modelValue`, so a\n\t\t * component that only declares `value`/`input` never receives the prop\n\t\t * and its emit is never heard — silently, with no warning, looking\n\t\t * exactly like a component that works.\n\t\t *\n\t\t * `value` is kept as the public name (consumers depend on it) and both\n\t\t * are accepted. `undefined` rather than `''` as the default is what\n\t\t * distinguishes \"not passed\" from \"passed as empty\".\n\t\t *\n\t\t * @type {string}\n\t\t */\n\t\tmodelValue: { type: String, default: undefined },\n\t\t/**\n\t\t * Layout mode. `edit` shows only the textarea, `preview`\n\t\t * shows only the rendered HTML, `split` shows both\n\t\t * side-by-side.\n\t\t *\n\t\t * @type {'edit'|'split'|'preview'}\n\t\t */\n\t\tmode: {\n\t\t\ttype: String,\n\t\t\tdefault: 'split',\n\t\t\tvalidator: (v) => MODES.includes(v),\n\t\t},\n\n\t\t/** Placeholder for the textarea. */\n\t\tplaceholder: { type: String, default: 'Write Markdown…' },\n\t\t/** Aria-label for the textarea. */\n\t\tariaLabel: { type: String, default: 'Markdown editor input' },\n\t\t/** Minimum textarea rows. */\n\t\trows: { type: Number, default: 10 },\n\t\t/** Disable the textarea (still renders the preview). */\n\t\tdisabled: { type: Boolean, default: false },\n\t\t/** Hide the formatting toolbar entirely. */\n\t\thideToolbar: { type: Boolean, default: false },\n\t\t/** Hide the mode-switch button on the toolbar. */\n\t\thideModeSwitch: { type: Boolean, default: false },\n\t\t/** Mode-switch tooltip. */\n\t\tmodeSwitchTooltip: { type: String, default: 'Cycle layout (edit / split / preview)' },\n\t\t/**\n\t\t * Custom toolbar entries. Each entry: `{id, label, prefix,\n\t\t * suffix?, placeholder?, tooltip?, linePrefix?}`. When\n\t\t * `linePrefix: true` the prefix is inserted at the start\n\t\t * of the current line instead of wrapping the selection.\n\t\t *\n\t\t * @type {Array<object>}\n\t\t */\n\t\ttoolbar: { type: Array, default: () => DEFAULT_TOOLBAR.slice() },\n\t\t/** Optional helper text rendered under the editor. */\n\t\thint: { type: String, default: '' },\n\t\t/**\n\t\t * Variables the text may use, written as `{name}`: names, or\n\t\t * `{ name, label?, description? }`. Given, the editor offers an insert\n\t\t * menu and names every `{…}` in the text that is not one of them. A\n\t\t * dotted variable (`case.number`) is allowed under a listed `case`.\n\t\t */\n\t\tvariables: { type: Array, default: () => [] },\n\t\t/**\n\t\t * The message for unknown variables; `{names}` becomes the list.\n\t\t * Defaults to \"Unknown variable: {names}.\".\n\t\t */\n\t\tunknownVariableText: { type: String, default: '' },\n\t\t/** The name of the insert menu. Defaults to \"Insert variable\". */\n\t\tinsertVariableText: { type: String, default: '' },\n\t\t/**\n\t\t * WYSIWYG mode only: Toast UI toolbar layout (array of button groups).\n\t\t * Ignored in the textarea modes.\n\t\t *\n\t\t * @type {Array<Array<string>>}\n\t\t */\n\t\twysiwygToolbar: { type: Array, default: () => DEFAULT_WYSIWYG_TOOLBAR.map((g) => g.slice()) },\n\t\t/** WYSIWYG mode only: editor height (any CSS length). */\n\t\twysiwygHeight: { type: String, default: '300px' },\n\t},\n\n\t// Declaring the emitted events is not cosmetic under Vue 3: an UNdeclared\n\t// event name also stays in `$attrs` and falls through to the root element,\n\t// so the NATIVE `input` event the `<textarea>` bubbles up is re-emitted by\n\t// the component as its own `input` — after the component's own\n\t// `$emit('input', value)` — and listeners receive the raw InputEvent\n\t// instead of the string.\n\temits: ['input', 'update:modelValue', 'update:mode', 'unknown-variables'],\n\tdata() {\n\t\treturn {\n\t\t\tlocalValue: (this.modelValue !== undefined ? this.modelValue : this.value),\n\t\t\t// Whether the lazily-created Toast UI editor instance is live\n\t\t\t// (WYSIWYG mode only). Drives the loading hint.\n\t\t\ttoastEditorReady: false,\n\t\t}\n\t},\n\n\tcomputed: {\n\t\t/**\n\t\t * The allowed variables as `{ name, label, description }`.\n\t\t *\n\t\t * @return {Array<{name: string, label: string, description: string}>} The variables.\n\t\t * @spec openspec/changes/markdown-editor-variables/tasks.md#task-1\n\t\t */\n\t\tvariableList() {\n\t\t\tconst list = Array.isArray(this.variables) ? this.variables : []\n\t\t\treturn list\n\t\t\t\t.map((v) => (typeof v === 'string' ? { name: v } : v))\n\t\t\t\t.filter((v) => v && typeof v.name === 'string' && v.name !== '')\n\t\t\t\t.map((v) => ({ name: v.name, label: v.label || v.name, description: v.description || '' }))\n\t\t},\n\n\t\t/**\n\t\t * The variables in the text that are not allowed, each once, in order.\n\t\t * Empty when no `variables` are given, so the check is off.\n\t\t *\n\t\t * @return {string[]} The unknown variable names.\n\t\t * @spec openspec/changes/markdown-editor-variables/tasks.md#task-2\n\t\t */\n\t\tunknownVariables() {\n\t\t\tif (this.variableList.length === 0) {\n\t\t\t\treturn []\n\t\t\t}\n\t\t\treturn unknownTemplateVariables(this.localValue, this.variableList.map((v) => v.name))\n\t\t},\n\n\t\t/**\n\t\t * The message under the editor for the unknown variables.\n\t\t *\n\t\t * @return {string} The message.\n\t\t * @spec openspec/changes/markdown-editor-variables/tasks.md#task-2\n\t\t */\n\t\tunknownVariableMessage() {\n\t\t\tconst names = this.unknownVariables.map((name) => `{${name}}`).join(', ')\n\t\t\tif (this.unknownVariableText) {\n\t\t\t\treturn this.unknownVariableText.split('{names}').join(names)\n\t\t\t}\n\t\t\treturn this.unknownVariables.length === 1\n\t\t\t\t? t('nextcloud-vue', 'Unknown variable: {names}.', { names }, undefined, { escape: false })\n\t\t\t\t: t('nextcloud-vue', 'Unknown variables: {names}.', { names }, undefined, { escape: false })\n\t\t},\n\n\t\t/**\n\t\t * The name of the insert menu.\n\t\t *\n\t\t * @return {string} The name.\n\t\t */\n\t\tinsertVariableLabel() {\n\t\t\treturn this.insertVariableText || t('nextcloud-vue', 'Insert variable')\n\t\t},\n\n\t\t/**\n\t\t * BEM modifier for the current layout mode.\n\t\t *\n\t\t * @return {string} The class.\n\t\t */\n\t\tmodeClass() {\n\t\t\treturn `cn-markdown-editor--${this.mode}`\n\t\t},\n\n\t\t/**\n\t\t * Every wrap delimiter the active toolbar can produce, longest first.\n\t\t * Toggling has to recognise the OTHER tools' markers, not just its own,\n\t\t * or alternating bold and italic stacks instead of toggling.\n\t\t *\n\t\t * @return {string[]} The delimiters, longest first.\n\t\t */\n\t\twrapMarkers() {\n\t\t\tconst out = new Set()\n\t\t\tfor (const tool of this.toolbar) {\n\t\t\t\tif (tool.linePrefix || !tool.suffix) {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tout.add(tool.prefix)\n\t\t\t\tout.add(tool.suffix)\n\t\t\t}\n\t\t\treturn [...out].sort((a, b) => b.length - a.length)\n\t\t},\n\n\t\t/**\n\t\t * The value the consumer actually bound, whichever prop they used.\n\t\t *\n\t\t * @return {string} The markdown source.\n\t\t */\n\t\tboundValue() {\n\t\t\treturn this.modelValue !== undefined ? this.modelValue : this.value\n\t\t},\n\n\t\t/**\n\t\t * Rendered HTML for the preview pane. Uses\n\t\t * `cnRenderMarkdown` so the output goes through the lib's\n\t\t * sanitised pipeline.\n\t\t *\n\t\t * @return {string} The rendered HTML.\n\t\t */\n\t\trenderedHtml() {\n\t\t\treturn cnRenderMarkdown(this.localValue || '')\n\t\t},\n\n\t\t/**\n\t\t * Label for the mode-switch button (shows the NEXT mode).\n\t\t *\n\t\t * @return {string} The label.\n\t\t */\n\t\tcurrentModeLabel() {\n\t\t\treturn `▦ ${this.mode}`\n\t\t},\n\n\t\t/**\n\t\t * Toast UI editor options (WYSIWYG mode) — the configured toolbar plus\n\t\t * fixed WYSIWYG defaults.\n\t\t *\n\t\t * @return {object} The Toast UI options object.\n\t\t */\n\t\twysiwygOptions() {\n\t\t\treturn {\n\t\t\t\tminHeight: '200px',\n\t\t\t\tlanguage: 'en-US',\n\t\t\t\thideModeSwitch: true,\n\t\t\t\ttoolbarItems: this.wysiwygToolbar,\n\t\t\t\tinitialEditType: 'wysiwyg',\n\t\t\t}\n\t\t},\n\t},\n\n\twatch: {\n\t\tunknownVariables: {\n\t\t\timmediate: true,\n\t\t\thandler(next, previous) {\n\t\t\t\tif (previous === undefined && next.length === 0) {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tif (previous && previous.join('\\n') === next.join('\\n')) {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\t/**\n\t\t\t\t * @event unknown-variables The unknown variables in the text changed;\n\t\t\t\t * empty when every variable is known again.\n\t\t\t\t * @type {string[]}\n\t\t\t\t */\n\t\t\t\tthis.$emit('unknown-variables', next)\n\t\t\t},\n\t\t},\n\n\t\t// Both spellings watched, because either may be the one the consumer\n\t\t// bound. `boundValue` collapses them so the body is written once.\n\t\tmodelValue() {\n\t\t\tthis.onBoundValueChange(this.boundValue)\n\t\t},\n\n\t\tvalue() {\n\t\t\tthis.onBoundValueChange(this.boundValue)\n\t\t},\n\n\t\tmode(next) {\n\t\t\tif (next === 'wysiwyg') {\n\t\t\t\tthis.loadWysiwyg()\n\t\t\t}\n\t\t},\n\t},\n\n\tmounted() {\n\t\tif (this.mode === 'wysiwyg') {\n\t\t\tthis.loadWysiwyg()\n\t\t}\n\t},\n\n\tbeforeUnmount() {\n\t\t// The editor is created imperatively, so Vue will not tear it down.\n\t\tif (this.toastEditor && typeof this.toastEditor.destroy === 'function') {\n\t\t\tthis.toastEditor.destroy()\n\t\t}\n\t\tthis.toastEditor = null\n\t},\n\n\tmethods: {\n\t\tt,\n\t\t/**\n\t\t * Lazily import and instantiate the Toast UI editor (and its CSS) the\n\t\t * first time WYSIWYG mode is entered. Keeps the ~200 KB editor out of\n\t\t * the default textarea path.\n\t\t *\n\t\t * Uses the framework-agnostic `@toast-ui/editor` constructor rather\n\t\t * than a Vue wrapper: `@toast-ui/vue-editor` is published for Vue 2\n\t\t * only and has no Vue-3 build. The instance is held as a plain (NON\n\t\t * reactive) instance property — putting a third-party class instance\n\t\t * in `data()` would wrap it in Vue 3's reactive proxy and break its\n\t\t * internal identity checks.\n\t\t *\n\t\t * @return {Promise<void>}\n\t\t */\n\t\tasync loadWysiwyg() {\n\t\t\tif (this.toastEditor) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\ttry {\n\t\t\t\tconst [{ default: Editor }] = await Promise.all([\n\t\t\t\t\timport('@toast-ui/editor'),\n\t\t\t\t\timport('@toast-ui/editor/dist/toastui-editor.css'),\n\t\t\t\t])\n\t\t\t\tawait this.$nextTick()\n\t\t\t\tconst el = this.$refs.toastHost\n\t\t\t\tif (!el) {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\t// customHTMLSanitizer does not reach Toast UI's raw HTML\n\t\t\t\t// converters, paste or setHTML; the guarded class routes those\n\t\t\t\t// through DOMPurify 3 as well (see utils/toastUiRawHtmlGuard.js).\n\t\t\t\tconst GuardedEditor = guardedToastUiEditorClass(Editor)\n\t\t\t\tthis.toastEditor = new GuardedEditor({\n\t\t\t\t\tel,\n\t\t\t\t\t...this.wysiwygOptions,\n\t\t\t\t\tinitialValue: this.localValue,\n\t\t\t\t\tpreviewStyle: 'tab',\n\t\t\t\t\theight: this.wysiwygHeight,\n\t\t\t\t\tevents: { change: this.onWysiwygChange },\n\t\t\t\t\t// Replaces the DOMPurify 2.3.3 copy that @toast-ui/editor\n\t\t\t\t\t// inlines into its own bundle (unmaintained since 2023, so\n\t\t\t\t\t// no npm-level fix exists). Same sanitising contract, run\n\t\t\t\t\t// by the maintained DOMPurify 3.x — see the module docs.\n\t\t\t\t\t// Set last so a consumer cannot drop it via wysiwygOptions.\n\t\t\t\t\tcustomHTMLSanitizer: toastUiSanitizer,\n\t\t\t\t})\n\t\t\t\tthis.toastEditorReady = true\n\t\t\t} catch (e) {\n\t\t\t\t// eslint-disable-next-line no-console -- diagnostic for a failure this code already degrades from\n\t\t\t\tconsole.error('CnMarkdownEditor: failed to load the WYSIWYG editor', e)\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Toast UI change handler — read the current markdown and emit it via\n\t\t * v-model.\n\t\t *\n\t\t * @return {void}\n\t\t */\n\t\tonWysiwygChange() {\n\t\t\tif (!this.toastEditor || typeof this.toastEditor.getMarkdown !== 'function') {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst markdown = this.toastEditor.getMarkdown()\n\t\t\tthis.localValue = markdown\n\t\t\t/**\n\t\t\t * @event input v-model emit.\n\t\t\t * @type {string}\n\t\t\t */\n\t\t\tthis.emitValue(markdown)\n\t\t},\n\n\t\t/**\n\t\t * Adopt a value pushed in from outside.\n\t\t *\n\t\t * @param {string} next The new markdown.\n\t\t * @return {void}\n\t\t */\n\t\tonBoundValueChange(next) {\n\t\t\tif (next === this.localValue) {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tthis.localValue = next\n\t\t\t// The imperative editor holds its own copy of the document, so an\n\t\t\t// external v-model change has to be pushed into it. Guarded on the\n\t\t\t// current markdown so we don't clobber the caret while the user is\n\t\t\t// typing (our own change handler round-trips here).\n\t\t\tif (this.toastEditor && this.toastEditor.getMarkdown() !== next) {\n\t\t\t\tthis.toastEditor.setMarkdown(next || '')\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Tell the consumer the value changed, in both v-model dialects.\n\t\t *\n\t\t * BOTH are emitted, always. A consumer on `@input` and a consumer on\n\t\t * `v-model` are the same consumer as far as this component knows, and\n\t\t * emitting only one silently breaks half of them.\n\t\t *\n\t\t * @param {string} next The new markdown.\n\t\t * @return {void}\n\t\t */\n\t\temitValue(next) {\n\t\t\t/**\n\t\t\t * @event input The value changed. Vue 2's v-model dialect, kept for\n\t\t\t * existing consumers.\n\t\t\t * @type {unknown}\n\t\t\t */\n\t\t\tthis.$emit('input', next)\n\t\t\t/**\n\t\t\t * @event update:modelValue The value changed. Vue 3's v-model\n\t\t\t * dialect — what a plain `v-model` listens for.\n\t\t\t * @type {unknown}\n\t\t\t */\n\t\t\tthis.$emit('update:modelValue', next)\n\t\t},\n\n\t\t/**\n\t\t * Textarea input handler — pushes the new value upward via\n\t\t * v-model.\n\t\t *\n\t\t * @param {InputEvent} event The input event.\n\t\t * @return {void}\n\t\t */\n\t\tonInput(event) {\n\t\t\tthis.localValue = event.target.value\n\t\t\t/**\n\t\t\t * @event input v-model emit.\n\t\t\t * @type {string}\n\t\t\t */\n\t\t\tthis.emitValue(this.localValue)\n\t\t},\n\n\t\t/**\n\t\t * Keyboard handler. Ctrl/Cmd+B / Ctrl/Cmd+I trigger bold / italic;\n\t\t * Enter continues (or exits) a list; Tab / Shift+Tab indent / dedent a\n\t\t * list item. Anything else falls through to the textarea default.\n\t\t *\n\t\t * @param {KeyboardEvent} event The keydown event.\n\t\t * @return {void}\n\t\t */\n\t\tonKeydown(event) {\n\t\t\tconst ta = this.$refs.textarea\n\t\t\tif (!ta) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif (event.ctrlKey || event.metaKey) {\n\t\t\t\tlet toolId = null\n\t\t\t\tif (event.key === 'b' || event.key === 'B') {\n\t\t\t\t\ttoolId = 'bold'\n\t\t\t\t} else if (event.key === 'i' || event.key === 'I') {\n\t\t\t\t\ttoolId = 'italic'\n\t\t\t\t}\n\t\t\t\tif (!toolId) {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tconst tool = this.toolbar.find((t) => t.id === toolId)\n\t\t\t\tif (!tool) {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tevent.preventDefault()\n\t\t\t\tthis.invokeTool(tool)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif (event.altKey) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif (event.key === 'Enter' && !event.shiftKey) {\n\t\t\t\tthis.handleListEnter(event, ta)\n\t\t\t} else if (event.key === 'Tab') {\n\t\t\t\tthis.handleListTab(event, ta)\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Smart Enter inside a list: continue with the next marker (incrementing\n\t\t * ordered / alpha markers), or — when the current item is empty — break\n\t\t * out of the list, leaving a blank line so the user types normally. No-op\n\t\t * (default newline) unless the caret is in a list item's body.\n\t\t *\n\t\t * @param {KeyboardEvent} event The keydown event.\n\t\t * @param {HTMLTextAreaElement} ta The textarea element.\n\t\t * @return {void}\n\t\t */\n\t\thandleListEnter(event, ta) {\n\t\t\tconst value = this.localValue\n\t\t\tconst selStart = ta.selectionStart\n\t\t\tif (selStart !== ta.selectionEnd) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst lineStart = value.slice(0, selStart).lastIndexOf('\\n') + 1\n\t\t\tconst nl = value.indexOf('\\n', selStart)\n\t\t\tconst lineEnd = nl === -1 ? value.length : nl\n\t\t\tconst m = value.slice(lineStart, lineEnd).match(LIST_ITEM_RE)\n\t\t\tif (!m) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst [, indent, marker, gap, content] = m\n\t\t\t// Only act once the caret is past the marker (in the item body).\n\t\t\tif (selStart < lineStart + indent.length + marker.length + gap.length) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tevent.preventDefault()\n\t\t\tif (content.trim() === '') {\n\t\t\t\t// Empty item → exit the list: drop the marker, leave a blank line.\n\t\t\t\tconst next = `${value.slice(0, lineStart)}${value.slice(lineEnd)}`\n\t\t\t\tthis.applyTextChange(next, lineStart, lineStart)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst insertion = `\\n${indent}${nextListMarker(marker)}${gap}`\n\t\t\tconst next = `${value.slice(0, selStart)}${insertion}${value.slice(selStart)}`\n\t\t\tconst caret = selStart + insertion.length\n\t\t\tthis.applyTextChange(next, caret, caret)\n\t\t},\n\n\t\t/**\n\t\t * Smart Tab inside a list: Tab indents the current line (or every line\n\t\t * spanned by the selection) by one level; Shift+Tab dedents it. Only\n\t\t * hijacks Tab when the caret's line is a list item, so Tab still moves\n\t\t * focus in plain text.\n\t\t *\n\t\t * @param {KeyboardEvent} event The keydown event.\n\t\t * @param {HTMLTextAreaElement} ta The textarea element.\n\t\t * @return {void}\n\t\t */\n\t\thandleListTab(event, ta) {\n\t\t\tconst value = this.localValue\n\t\t\tconst selStart = ta.selectionStart\n\t\t\tconst selEnd = ta.selectionEnd\n\t\t\tconst firstLineStart = value.slice(0, selStart).lastIndexOf('\\n') + 1\n\t\t\tconst firstNl = value.indexOf('\\n', firstLineStart)\n\t\t\tconst firstLineEnd = firstNl === -1 ? value.length : firstNl\n\t\t\tif (!LIST_ITEM_RE.test(value.slice(firstLineStart, firstLineEnd))) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tevent.preventDefault()\n\t\t\tconst endRef = selEnd > selStart ? selEnd - 1 : selEnd\n\t\t\tconst lastNl = value.indexOf('\\n', endRef)\n\t\t\tconst blockEnd = lastNl === -1 ? value.length : lastNl\n\t\t\tconst lines = value.slice(firstLineStart, blockEnd).split('\\n')\n\t\t\tlet firstDelta = 0\n\t\t\tlet newLines\n\t\t\tif (event.shiftKey) {\n\t\t\t\tnewLines = lines.map((ln, i) => {\n\t\t\t\t\tlet strip = 0\n\t\t\t\t\tif (ln.startsWith('\\t')) {\n\t\t\t\t\t\tstrip = 1\n\t\t\t\t\t} else {\n\t\t\t\t\t\twhile (strip < 2 && ln[strip] === ' ') {\n\t\t\t\t\t\t\tstrip++\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif (i === 0) {\n\t\t\t\t\t\tfirstDelta = -strip\n\t\t\t\t\t}\n\t\t\t\t\treturn ln.slice(strip)\n\t\t\t\t})\n\t\t\t} else {\n\t\t\t\tnewLines = lines.map((ln) => `${LIST_INDENT}${ln}`)\n\t\t\t\tfirstDelta = LIST_INDENT.length\n\t\t\t}\n\t\t\tconst newBlock = newLines.join('\\n')\n\t\t\tconst next = `${value.slice(0, firstLineStart)}${newBlock}${value.slice(blockEnd)}`\n\t\t\tif (selStart === selEnd) {\n\t\t\t\tconst caret = Math.max(firstLineStart, selStart + firstDelta)\n\t\t\t\tthis.applyTextChange(next, caret, caret)\n\t\t\t} else {\n\t\t\t\tthis.applyTextChange(next, firstLineStart, firstLineStart + newBlock.length)\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Commit a programmatic edit: update the model, emit `input`, then\n\t\t * restore focus + selection on the next tick.\n\t\t *\n\t\t * @param {string} next The new textarea value.\n\t\t * @param {number} selStart The caret/selection start to restore.\n\t\t * @param {number} selEnd The selection end to restore.\n\t\t * @return {void}\n\t\t */\n\t\tapplyTextChange(next, selStart, selEnd) {\n\t\t\tthis.localValue = next\n\t\t\tthis.emitValue(next)\n\t\t\tthis.$nextTick(() => {\n\t\t\t\tconst ta = this.$refs.textarea\n\t\t\t\tif (!ta) {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tta.focus()\n\t\t\t\tta.setSelectionRange(selStart, selEnd)\n\t\t\t})\n\t\t},\n\n\t\t/**\n\t\t * Cycle the layout mode `edit → split → preview → edit`.\n\t\t *\n\t\t * @return {void}\n\t\t */\n\t\tcycleMode() {\n\t\t\tconst idx = MODES.indexOf(this.mode)\n\t\t\tconst next = MODES[(idx + 1) % MODES.length]\n\t\t\t/**\n\t\t\t * @event update:mode v-model:mode emit so consumers can bind the layout mode.\n\t\t\t * @type {'edit'|'split'|'preview'}\n\t\t\t */\n\t\t\tthis.$emit('update:mode', next)\n\t\t},\n\n\t\t/**\n\t\t * Apply a toolbar action — either prefix the current line\n\t\t * (`linePrefix: true`) or wrap the current selection.\n\t\t *\n\t\t * @param {object} tool The toolbar entry.\n\t\t * @return {void}\n\t\t */\n\t\tinvokeTool(tool) {\n\t\t\tconst ta = this.$refs.textarea\n\t\t\tif (!ta) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst before = this.localValue.slice(0, ta.selectionStart)\n\t\t\tconst selected = this.localValue.slice(ta.selectionStart, ta.selectionEnd)\n\t\t\tconst after = this.localValue.slice(ta.selectionEnd)\n\n\t\t\tlet nextValue\n\t\t\tlet nextSelStart\n\t\t\tlet nextSelEnd\n\t\t\tif (tool.linePrefix) {\n\t\t\t\t// Line-prefix mode (headings, list, quote): toggle/replace the\n\t\t\t\t// marker on the current line rather than stacking it. Operates on\n\t\t\t\t// the whole line under the caret, ignoring any selection.\n\t\t\t\tconst lineStart = before.lastIndexOf('\\n') + 1\n\t\t\t\tconst afterNl = after.indexOf('\\n')\n\t\t\t\tconst lineEnd = afterNl === -1 ? this.localValue.length : ta.selectionEnd + afterNl\n\t\t\t\tconst head = this.localValue.slice(0, lineStart)\n\t\t\t\tconst line = this.localValue.slice(lineStart, lineEnd)\n\t\t\t\tconst tail = this.localValue.slice(lineEnd)\n\n\t\t\t\t// Strip an existing recognised marker (heading #…, list -/*, quote >)\n\t\t\t\t// so switching one for another REPLACES it (e.g. `# ` → `## `, never\n\t\t\t\t// `## #`); re-applying the same marker toggles it off.\n\t\t\t\tconst existing = (line.match(/^(#{1,6} |[-*] |> )/) || [''])[0]\n\t\t\t\tconst body = line.slice(existing.length)\n\t\t\t\tconst newLine = existing === tool.prefix ? body : `${tool.prefix}${body}`\n\n\t\t\t\tnextValue = `${head}${newLine}${tail}`\n\t\t\t\t// Keep the caret/selection in the body, shifted by the marker delta.\n\t\t\t\tconst delta = newLine.length - line.length\n\t\t\t\tconst min = lineStart\n\t\t\t\tconst max = lineStart + newLine.length\n\t\t\t\tnextSelStart = Math.min(Math.max(ta.selectionStart + delta, min), max)\n\t\t\t\tnextSelEnd = Math.min(Math.max(ta.selectionEnd + delta, min), max)\n\t\t\t} else {\n\t\t\t\t// Wrap mode (bold/italic/link/code): toggle. If the selection is\n\t\t\t\t// already wrapped in this tool's delimiters — either they're part\n\t\t\t\t// of the selection, or they sit around it — strip them; otherwise\n\t\t\t\t// add them. Stops `**`/`_` from stacking on repeat presses.\n\t\t\t\tconst p = tool.prefix\n\t\t\t\tconst s = tool.suffix || ''\n\t\t\t\tconst wrappedInside = selected.length >= p.length + s.length\n\t\t\t\t\t&& selected.startsWith(p)\n\t\t\t\t\t&& selected.endsWith(s)\n\n\t\t\t\t// Not just the delimiters immediately against the selection: read\n\t\t\t\t// the whole run on each side, so this tool's pair is still found\n\t\t\t\t// with another tool's nested inside it. Toggling bold on\n\t\t\t\t// `**_text_**` has to see the `**` through the `_`, or alternating\n\t\t\t\t// bold and italic stacks markers forever instead of toggling.\n\t\t\t\tconst markers = this.wrapMarkers\n\t\t\t\tconst leftRun = s === '' ? [] : peelMarkers(before, markers, true)\n\t\t\t\tconst rightRun = s === '' ? [] : peelMarkers(after, markers, false)\n\t\t\t\t// Same depth on both sides: that is what makes them a pair.\n\t\t\t\tconst depth = leftRun.findIndex((m, i) => m === p && rightRun[i] === s)\n\n\t\t\t\tif (wrappedInside) {\n\t\t\t\t\tconst inner = selected.slice(p.length, selected.length - s.length)\n\t\t\t\t\tnextValue = `${before}${inner}${after}`\n\t\t\t\t\tnextSelStart = before.length\n\t\t\t\t\tnextSelEnd = nextSelStart + inner.length\n\t\t\t\t} else if (depth !== -1) {\n\t\t\t\t\t// Selection is the inner text; drop this tool's pair and leave\n\t\t\t\t\t// every marker nested inside it where it is.\n\t\t\t\t\tconst pStart = before.length\n\t\t\t\t\t\t- leftRun.slice(0, depth).reduce((n, m) => n + m.length, 0)\n\t\t\t\t\t\t- p.length\n\t\t\t\t\tconst sStart = rightRun.slice(0, depth).reduce((n, m) => n + m.length, 0)\n\t\t\t\t\tnextValue = before.slice(0, pStart)\n\t\t\t\t\t\t+ before.slice(pStart + p.length)\n\t\t\t\t\t\t+ selected\n\t\t\t\t\t\t+ after.slice(0, sStart)\n\t\t\t\t\t\t+ after.slice(sStart + s.length)\n\t\t\t\t\tnextSelStart = before.length - p.length\n\t\t\t\t\tnextSelEnd = nextSelStart + selected.length\n\t\t\t\t} else {\n\t\t\t\t\tconst inner = selected || tool.placeholder || ''\n\t\t\t\t\tconst insertion = `${p}${inner}${s}`\n\t\t\t\t\tnextValue = `${before}${insertion}${after}`\n\t\t\t\t\tnextSelStart = before.length + p.length\n\t\t\t\t\tnextSelEnd = nextSelStart + inner.length\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tthis.localValue = nextValue\n\t\t\tthis.emitValue(nextValue)\n\t\t\tthis.$nextTick(() => {\n\t\t\t\tta.focus()\n\t\t\t\tta.setSelectionRange(nextSelStart, nextSelEnd)\n\t\t\t})\n\t\t},\n\n\t\t/**\n\t\t * Insert `{name}` at the caret.\n\t\t *\n\t\t * @param {string} name The variable name.\n\t\t * @return {void}\n\t\t * @spec openspec/changes/markdown-editor-variables/tasks.md#task-1\n\t\t */\n\t\tinsertVariable(name) {\n\t\t\tconst token = `{${name}}`\n\t\t\tif (this.mode === 'wysiwyg' && this.toastEditor) {\n\t\t\t\tthis.toastEditor.insertText(token)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tthis.insertAtCaret(token)\n\t\t},\n\n\t\t/**\n\t\t * Programmatic insert helper — exposed publicly so parents\n\t\t * can drop content at the caret (e.g. from a file-picker\n\t\t * callback inserting a `![alt](url)` reference).\n\t\t *\n\t\t * @param {string} text The text to insert at the caret.\n\t\t * @return {void}\n\t\t */\n\t\tinsertAtCaret(text) {\n\t\t\tconst ta = this.$refs.textarea\n\t\t\tif (!ta) {\n\t\t\t\tthis.localValue += text\n\t\t\t\tthis.emitValue(this.localValue)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst before = this.localValue.slice(0, ta.selectionStart)\n\t\t\tconst after = this.localValue.slice(ta.selectionEnd)\n\t\t\tconst next = `${before}${text}${after}`\n\t\t\tconst caret = before.length + text.length\n\t\t\tthis.localValue = next\n\t\t\tthis.emitValue(next)\n\t\t\tthis.$nextTick(() => {\n\t\t\t\tta.focus()\n\t\t\t\tta.setSelectionRange(caret, caret)\n\t\t\t})\n\t\t},\n\t},\n}\n</script>\n\n<style scoped>\n.cn-markdown-editor {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 8px;\n\tborder: 1px solid var(--color-border);\n\tborder-radius: var(--border-radius);\n\tbackground: var(--color-main-background);\n\toverflow: hidden;\n}\n\n.cn-markdown-editor__toolbar {\n\tdisplay: flex;\n\tgap: 4px;\n\tpadding: 6px;\n\tborder-bottom: 1px solid var(--color-border);\n\tbackground: var(--color-background-hover);\n}\n\n.cn-markdown-editor__tool {\n\tbackground: var(--color-main-background);\n\tborder: 1px solid var(--color-border);\n\tborder-radius: var(--border-radius);\n\tpadding: 4px 8px;\n\tcursor: pointer;\n\tfont-family: monospace;\n\tmin-width: 28px;\n}\n\n.cn-markdown-editor__tool:hover {\n\tbackground: var(--color-background-darker, var(--color-background-hover));\n}\n\n.cn-markdown-editor__spacer {\n\tflex: 1 1 auto;\n}\n\n.cn-markdown-editor__panes {\n\tdisplay: grid;\n\tgrid-template-columns: 1fr;\n\tmin-height: 200px;\n}\n\n.cn-markdown-editor__panes[data-mode=\"split\"] {\n\tgrid-template-columns: 1fr 1fr;\n}\n\n.cn-markdown-editor__textarea {\n\tborder: none;\n\toutline: none;\n\tpadding: 10px 12px;\n\tfont-family: monospace;\n\tfont-size: 0.95em;\n\tresize: vertical;\n\twidth: 100%;\n\tbackground: var(--color-main-background);\n\tcolor: var(--color-main-text);\n\t/* Nested list indents are single tabs (see LIST_INDENT); render them\n\t compactly rather than the 8-char browser default. */\n\ttab-size: 2;\n\t-moz-tab-size: 2;\n}\n\n.cn-markdown-editor__preview {\n\tpadding: 10px 14px;\n\tborder-left: 1px solid var(--color-border);\n\tbackground: var(--color-main-background);\n\toverflow-y: auto;\n\tmin-height: 200px;\n}\n\n.cn-markdown-editor__panes[data-mode=\"preview\"] .cn-markdown-editor__preview {\n\tborder-left: none;\n}\n\n.cn-markdown-editor__variables {\n\tdisplay: flex;\n\tjustify-content: flex-end;\n}\n\n.cn-markdown-editor__error {\n\tmargin: 0;\n\tcolor: var(--color-error-text, var(--color-error));\n}\n\n.cn-markdown-editor__hint {\n\tcolor: var(--color-text-maxcontrast);\n\tpadding: 0 10px 8px;\n}\n\n/* WYSIWYG (Toast UI) mode — themed with Nextcloud CSS variables. */\n.cn-markdown-editor__wysiwyg {\n\twidth: 100%;\n}\n\n.cn-markdown-editor__wysiwyg :deep(.toastui-editor-defaultUI) {\n\tfont-family: var(--font-face) !important;\n\tbackground-color: var(--color-main-background) !important;\n\tborder: none !important;\n}\n\n.cn-markdown-editor__wysiwyg :deep(.toastui-editor-toolbar) {\n\tbackground-color: var(--color-background-hover) !important;\n\tborder-bottom: 1px solid var(--color-border-dark) !important;\n}\n\n.cn-markdown-editor__wysiwyg :deep(.toastui-editor-toolbar-icons button) {\n\tcolor: var(--color-main-text) !important;\n\tbackground-color: transparent !important;\n\tborder: none !important;\n}\n\n.cn-markdown-editor__wysiwyg :deep(.toastui-editor-toolbar-icons button:hover) {\n\tbackground-color: var(--color-background-dark) !important;\n}\n\n.cn-markdown-editor__wysiwyg :deep(.toastui-editor-contents),\n.cn-markdown-editor__wysiwyg :deep(.ProseMirror) {\n\tcolor: var(--color-main-text) !important;\n\tbackground-color: var(--color-main-background) !important;\n\tfont-family: var(--font-face) !important;\n}\n</style>\n"],"names":["_createElementBlock","_normalizeClass","_openBlock","_Fragment","_renderList","_createElementVNode","_toDisplayString","_createVNode","_createBlock","_createTextVNode","_withDirectives"],"mappings":";;;;AAGiD,EAAA,KAAK,EAAC,6BAA4B;AAAE,EAAA,IAAI,EAAC,SAAS;;;;;;AAqB1B,EAAA,KAAK,EAAC;AAAgC,EAAA,aAAW,EAAC,uBAAuB;;;;;;;AAmCpI,EAAA,KAAK,EAAC,6BAA8B;AAAA,EAAA,aAAW,EAAC,qBAAqB;;AACjD,MAAA,UAAA,GAAA,EAAA,GAAG,EAAC;;;AACP,EAAA,KAAK,EAAC,0BAA0B;;;;AAM5D,EAAA,KAAK,EAAC,2BAA0B;AAChC,EAAA,IAAI,EAAC,OAAM;AACX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
1
  import { translate } from '@nextcloud/l10n';
2
- import draggable from '../../node_modules/vuedraggable/dist/vuedraggable.umd.js';
2
+ import Draggable from '../../node_modules/vuedraggable/dist/vuedraggable.umd.js';
3
3
  import __sfc_main from './CnMenuTreeRow.vue.js';
4
4
 
5
5
  /**
@@ -23,7 +23,7 @@ import __sfc_main from './CnMenuTreeRow.vue.js';
23
23
  var script = {
24
24
  name: 'CnMenuTreeNode',
25
25
 
26
- components: { Draggable: draggable, CnMenuTreeRow: __sfc_main },
26
+ components: { Draggable: Draggable, CnMenuTreeRow: __sfc_main },
27
27
 
28
28
  props: {
29
29
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"CnMenuTreeNode.vue2.js","sources":["../../../../src/components/CnMenuTreeNode/CnMenuTreeNode.vue"],"sourcesContent":["<!--\n - SPDX-FileCopyrightText: 2026 Conduction B.V.\n - SPDX-License-Identifier: EUPL-1.2\n-->\n\n<template>\n\t<!-- `#item` + `item-key`: see the same note on CnPageTreeNode. vuedraggable@4\n\t renders the rows itself from this slot; a `v-for` in the default slot\n\t throws \"draggable element must have an item slot\". -->\n\t<Draggable v-model=\"tree\"\n\t\ttag=\"ul\"\n\t\tclass=\"cn-menu-tree\"\n\t\t:itemKey=\"keyOf\"\n\t\t:group=\"group\"\n\t\thandle=\".cn-menu-tree__handle\"\n\t\t:move=\"onMove\"\n\t\t@end=\"flatten\">\n\t\t<template #item=\"{ element: node }\">\n\t\t\t<li class=\"cn-menu-tree__node\">\n\t\t\t\t<CnMenuTreeRow :item=\"node.ref\"\n\t\t\t\t\t:pages=\"pages\"\n\t\t\t\t\t:canAddChild=\"maxDepth > 0\"\n\t\t\t\t\t@addChild=\"addChild(node)\"\n\t\t\t\t\t@remove=\"removeNode(node, null)\" />\n\n\t\t\t\t<!-- One level of children: a drop target on every top item. -->\n\t\t\t\t<Draggable v-if=\"maxDepth > 0\"\n\t\t\t\t\tv-model=\"node.children\"\n\t\t\t\t\ttag=\"ul\"\n\t\t\t\t\tclass=\"cn-menu-tree__children\"\n\t\t\t\t\t:class=\"{ 'cn-menu-tree__children--empty': !node.children.length }\"\n\t\t\t\t\t:itemKey=\"keyOf\"\n\t\t\t\t\t:group=\"group\"\n\t\t\t\t\thandle=\".cn-menu-tree__handle\"\n\t\t\t\t\t:move=\"onMove\"\n\t\t\t\t\t@end=\"flatten\">\n\t\t\t\t\t<template #item=\"{ element: child }\">\n\t\t\t\t\t\t<li class=\"cn-menu-tree__node\">\n\t\t\t\t\t\t\t<CnMenuTreeRow :item=\"child.ref\"\n\t\t\t\t\t\t\t\t:pages=\"pages\"\n\t\t\t\t\t\t\t\t:canAddChild=\"false\"\n\t\t\t\t\t\t\t\t@remove=\"removeNode(child, node)\" />\n\t\t\t\t\t\t</li>\n\t\t\t\t\t</template>\n\t\t\t\t</Draggable>\n\t\t\t</li>\n\t\t</template>\n\t</Draggable>\n</template>\n\n<script>\nimport { translate as t } from '@nextcloud/l10n'\nimport draggable from 'vuedraggable'\nimport CnMenuTreeRow from './CnMenuTreeRow.vue'\n\n/**\n * CnMenuTreeNode — the menu editor's drag-and-drop tree (ADR-041).\n *\n * Renders the working manifest's `menu[]` (nested via each item's `children[]`)\n * as a two-level draggable tree: drag a row to reorder, or into / out of an item\n * to nest (one level — CnAppNav supports one). Each row (CnMenuTreeRow) edits its\n * icon / label / target page inline + Delete via a cog. Drag operates on a local\n * mirror (`tree`) of real item refs; after each drop the mirror is FLATTENED back\n * onto `menu[]` in place — `order` renumbered to match the visual order, the\n * top-level `section` marker set/cleared, and each item's `children[]` rebuilt —\n * so `diffManifest` sees the change. Field edits mutate the real refs directly.\n *\n * The top level is scoped by `section`, matched EXACTLY: the main-menu editor\n * shows `main` items, the settings-menu editor shows `section: \"settings\"`\n * items, and neither ever claims the other's — or an `integrations` entry,\n * which has no editor here at all and must survive both untouched. Flatten\n * preserves every section it does not own.\n */\nexport default {\n\tname: 'CnMenuTreeNode',\n\n\tcomponents: { Draggable: draggable, CnMenuTreeRow },\n\n\tprops: {\n\t\t/**\n\t\t * The working manifest's `menu[]` (top-level items; children live in each\n\t\t * item's `children[]`). Edited in place.\n\t\t *\n\t\t * @type {Array}\n\t\t */\n\t\tlist: {\n\t\t\ttype: Array,\n\t\t\trequired: true,\n\t\t},\n\n\t\t/** Maximum nesting depth that may gain children (CnAppNav supports one level). */\n\t\tmaxDepth: {\n\t\t\ttype: Number,\n\t\t\tdefault: 1,\n\t\t},\n\n\t\t/**\n\t\t * Selectable target pages as `{ value: routeName, label }` options,\n\t\t * forwarded to every row's Page picker.\n\t\t *\n\t\t * @type {Array<{value: string, label: string}>}\n\t\t */\n\t\tpages: {\n\t\t\ttype: Array,\n\t\t\tdefault: () => [],\n\t\t},\n\n\t\t/**\n\t\t * Which nav section this editor scopes to at the top level. An editor\n\t\t * shows — and on flatten rewrites — ONLY entries whose section matches\n\t\t * exactly; every other section is preserved untouched. `null` and\n\t\t * `\"main\"` both mean the main menu.\n\t\t *\n\t\t * @type {'main'|'settings'|'integrations'|null}\n\t\t */\n\t\tsection: {\n\t\t\ttype: String,\n\t\t\tdefault: null,\n\t\t\tvalidator: (v) => v === null || ['main', 'settings', 'integrations'].includes(v),\n\t\t},\n\t},\n\n\tdata() {\n\t\treturn {\n\t\t\t// Local nested mirror of the section's items (real refs); flattened\n\t\t\t// back to `list` after each drop.\n\t\t\ttree: this.buildTree(),\n\t\t\t// Per-section drag group (main + settings editors never inter-drag).\n\t\t\tgroup: 'cn-menu-' + (this.section || 'main'),\n\t\t\t// Guard against the watcher rebuilding mid-flatten.\n\t\t\tsuppressRebuild: false,\n\t\t}\n\t},\n\n\twatch: {\n\t\t// The prop's IDENTITY, for a host that swaps the array wholesale.\n\t\tlist: {\n\t\t\thandler: 'rebuild',\n\t\t\tdeep: false,\n\t\t},\n\n\t\t// ...and its LENGTH, for a host that pushes or splices in place. The\n\t\t// modal's \"Add menu item\" does exactly that — `list` IS the working\n\t\t// manifest's `menu[]`, so its reference never changes and the watcher\n\t\t// above never fired: the item was appended and never appeared.\n\t\t//\n\t\t// Length rather than `deep: true`, which would fire on every keystroke\n\t\t// in a row's field and rebuild the tree under the user. This\n\t\t// component's own mutations land in `flatten()`, which holds\n\t\t// `suppressRebuild` across the splice.\n\t\t'list.length': 'rebuild',\n\t\t// Bypasses `rebuild()`'s suppressRebuild guard deliberately: a section\n\t\t// switch is never concurrent with this component's own flatten() write\n\t\t// (that guard exists only for the list/list.length watchers above), and\n\t\t// the new section's tree must always be rebuilt regardless of the flag.\n\t\tsection() {\n\t\t\tthis.tree = this.buildTree()\n\t\t},\n\t},\n\n\tmethods: {\n\t\tt,\n\t\t/**\n\t\t * Re-seed the local tree from `list`, unless our own `flatten()` is\n\t\t * mid-write.\n\t\t *\n\t\t * @return {void}\n\t\t */\n\t\trebuild() {\n\t\t\tif (this.suppressRebuild) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tthis.tree = this.buildTree()\n\t\t},\n\n\t\t/**\n\t\t * Stable-ish v-for key for a node.\n\t\t *\n\t\t * @param {object} node The tree node.\n\t\t * @return {string}\n\t\t */\n\t\tkeyOf(node) {\n\t\t\treturn (node.ref && node.ref.id) || String(node._k || (node._k = Math.random()))\n\t\t},\n\n\t\t/**\n\t\t * The section this editor owns, normalised — an absent `section` prop\n\t\t * means the main menu.\n\t\t *\n\t\t * @return {string} 'main' | 'settings' | 'integrations'\n\t\t */\n\t\twantSection() {\n\t\t\treturn this.section || 'main'\n\t\t},\n\n\t\t/**\n\t\t * An entry's section, normalised the same way.\n\t\t *\n\t\t * This pair replaced a binary `(it.section === 'settings') === wantSettings`\n\t\t * test, which was correct only while exactly two sections existed. Once\n\t\t * `section: \"integrations\"` was added (ADR-110), an integrations entry\n\t\t * answered `false` to \"is settings\", so the MAIN editor claimed it — and\n\t\t * `flatten()` `delete`s the section marker on everything the main editor\n\t\t * claims. Opening the main-menu editor and saving would have quietly\n\t\t * converted every cross-app link back into a nav entry, undoing the\n\t\t * contract with no error and no diff the author asked for. Matching the\n\t\t * section exactly means an editor owns its own section and nothing else.\n\t\t *\n\t\t * @param {object} item The menu entry.\n\t\t * @return {string} The entry's normalised section.\n\t\t */\n\t\tsectionOf(item) {\n\t\t\treturn (item && item.section) || 'main'\n\t\t},\n\n\t\t/**\n\t\t * Order comparator: numeric `order` ascending, array index as tiebreak.\n\t\t *\n\t\t * @param {Array} arr The array being sorted (for index tiebreak).\n\t\t * @return {(a: object, b: object) => number} The comparator.\n\t\t */\n\t\tbyOrder(arr) {\n\t\t\treturn (a, b) => {\n\t\t\t\tconst oa = typeof a.order === 'number' ? a.order : arr.indexOf(a)\n\t\t\t\tconst ob = typeof b.order === 'number' ? b.order : arr.indexOf(b)\n\t\t\t\treturn oa - ob\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Build the nested mirror from `list`, scoped to this section and ordered.\n\t\t *\n\t\t * @return {Array<{ref: object, children: Array}>}\n\t\t */\n\t\tbuildTree() {\n\t\t\tconst list = Array.isArray(this.list) ? this.list : []\n\t\t\tconst want = this.wantSection()\n\t\t\tconst top = list\n\t\t\t\t.filter((it) => it && this.sectionOf(it) === want)\n\t\t\t\t.slice()\n\t\t\t\t.sort(this.byOrder(list))\n\t\t\treturn top.map((ref) => {\n\t\t\t\tconst kids = Array.isArray(ref.children) ? ref.children.slice().sort(this.byOrder(ref.children)) : []\n\t\t\t\treturn { ref, children: kids.map((c) => ({ ref: c, children: [] })) }\n\t\t\t})\n\t\t},\n\n\t\t/**\n\t\t * Flatten the mirror back onto `list` in place: renumber `order`, set/clear\n\t\t * the top-level `section` marker, rebuild each item's `children[]`, and\n\t\t * preserve the other section's items.\n\t\t *\n\t\t * @return {void}\n\t\t */\n\t\tflatten() {\n\t\t\tconst want = this.wantSection()\n\t\t\tconst others = this.list.filter((it) => it && this.sectionOf(it) !== want)\n\t\t\tconst mine = this.tree.map((node, i) => {\n\t\t\t\tconst ref = node.ref\n\t\t\t\tref.order = (i + 1) * 10\n\t\t\t\tif (want === 'main') {\n\t\t\t\t\tdelete ref.section\n\t\t\t\t} else {\n\t\t\t\t\tref.section = want\n\t\t\t\t}\n\t\t\t\tif (node.children.length) {\n\t\t\t\t\tref.children = node.children.map((cn, j) => {\n\t\t\t\t\t\tcn.ref.order = (j + 1) * 10\n\t\t\t\t\t\tdelete cn.ref.section\n\t\t\t\t\t\treturn cn.ref\n\t\t\t\t\t})\n\t\t\t\t} else {\n\t\t\t\t\tdelete ref.children\n\t\t\t\t}\n\t\t\t\treturn ref\n\t\t\t})\n\t\t\tconst next = want === 'main' ? [...mine, ...others] : [...others, ...mine]\n\t\t\tthis.suppressRebuild = true\n\t\t\t// In-place edit by design — `list` is the working manifest's menu[],\n\t\t\t// mutated by reference so diffManifest captures the reorder/nesting.\n\t\t\t// eslint-disable-next-line vue/no-mutating-props\n\t\t\tthis.list.splice(0, this.list.length, ...next)\n\t\t\tthis.$nextTick(() => {\n\t\t\t\tthis.suppressRebuild = false\n\t\t\t})\n\t\t},\n\n\t\t/**\n\t\t * vuedraggable guard: forbid dropping a node that HAS children into a\n\t\t * child list (would nest two levels deep).\n\t\t *\n\t\t * @param {object} evt The vuedraggable move event.\n\t\t * @return {boolean} False to veto.\n\t\t */\n\t\tonMove(evt) {\n\t\t\tconst dragged = evt.draggedContext && evt.draggedContext.element\n\t\t\tconst target = evt.relatedContext && evt.relatedContext.list\n\t\t\tconst intoChild = target && target !== this.tree\n\t\t\tif (intoChild && dragged && Array.isArray(dragged.children) && dragged.children.length) {\n\t\t\t\treturn false\n\t\t\t}\n\t\t\treturn true\n\t\t},\n\n\t\t/**\n\t\t * Generate a unique `menu-N` id not already used at any level of `list`.\n\t\t *\n\t\t * @return {string}\n\t\t */\n\t\tnextId() {\n\t\t\tconst ids = new Set()\n\t\t\tconst walk = (arr) => (arr || []).forEach((it) => {\n\t\t\t\tif (it) {\n\t\t\t\t\tids.add(it.id)\n\t\t\t\t\twalk(it.children)\n\t\t\t\t}\n\t\t\t})\n\t\t\twalk(this.list)\n\t\t\tlet n = ids.size + 1\n\t\t\twhile (ids.has(`menu-${n}`)) {\n\t\t\t\tn++\n\t\t\t}\n\t\t\treturn `menu-${n}`\n\t\t},\n\n\t\t/**\n\t\t * Append a blank child under a top node.\n\t\t *\n\t\t * @param {object} node The parent tree node.\n\t\t * @return {void}\n\t\t */\n\t\taddChild(node) {\n\t\t\tconst ref = { id: this.nextId(), label: '', icon: '', route: '' }\n\t\t\tnode.children.push({ ref, children: [] })\n\t\t\tthis.flatten()\n\t\t},\n\n\t\t/**\n\t\t * Remove a node. A removed top node's children are lifted to top level.\n\t\t *\n\t\t * @param {object} node The node to remove.\n\t\t * @param {object|null} parent The parent node, or null for a top node.\n\t\t * @return {void}\n\t\t */\n\t\tremoveNode(node, parent) {\n\t\t\tif (parent) {\n\t\t\t\tconst i = parent.children.indexOf(node)\n\t\t\t\tif (i !== -1) {\n\t\t\t\t\tparent.children.splice(i, 1)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tconst i = this.tree.indexOf(node)\n\t\t\t\tif (i !== -1) {\n\t\t\t\t\tthis.tree.splice(i, 1, ...node.children)\n\t\t\t\t}\n\t\t\t}\n\t\t\tthis.flatten()\n\t\t},\n\t},\n}\n</script>\n\n<style scoped>\n.cn-menu-tree {\n\tlist-style: none;\n\tmargin: 0;\n\tpadding: 0;\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 4px;\n}\n\n.cn-menu-tree__children {\n\tlist-style: none;\n\tmargin: 4px 0 0 28px;\n\tpadding: 0 0 0 8px;\n\tborder-left: 2px solid var(--color-border);\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 4px;\n}\n\n.cn-menu-tree__children--empty {\n\tmin-height: 10px;\n\tmargin-top: 0;\n\tborder-left-color: transparent;\n}\n\n.cn-menu-tree__node {\n\tlist-style: none;\n}\n</style>\n"],"names":["CnMenuTreeRow","t"],"mappings":";;;;AAuDA;;AAEC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAED,aAAe;AACd,CAAA,IAA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,CAAC,IAAI,EAAA;IAChC,IAAI,CAAE,KAAI,CAAC,CAAC,EAAE;AACb,KAAA,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,GAAG,IAAI,CAAC,QAAQ,EAAA;AACxC,KAAA;AACD,IAAA;GACA,IAAI,CAAC,OAAO,GAAC;GACb;EACD;AACF;;;;"}
1
+ {"version":3,"file":"CnMenuTreeNode.vue2.js","sources":["../../../../src/components/CnMenuTreeNode/CnMenuTreeNode.vue"],"sourcesContent":["<!--\n - SPDX-FileCopyrightText: 2026 Conduction B.V.\n - SPDX-License-Identifier: EUPL-1.2\n-->\n\n<template>\n\t<!-- `#item` + `item-key`: see the same note on CnPageTreeNode. vuedraggable@4\n\t renders the rows itself from this slot; a `v-for` in the default slot\n\t throws \"draggable element must have an item slot\". -->\n\t<Draggable v-model=\"tree\"\n\t\ttag=\"ul\"\n\t\tclass=\"cn-menu-tree\"\n\t\t:itemKey=\"keyOf\"\n\t\t:group=\"group\"\n\t\thandle=\".cn-menu-tree__handle\"\n\t\t:move=\"onMove\"\n\t\t@end=\"flatten\">\n\t\t<template #item=\"{ element: node }\">\n\t\t\t<li class=\"cn-menu-tree__node\">\n\t\t\t\t<CnMenuTreeRow :item=\"node.ref\"\n\t\t\t\t\t:pages=\"pages\"\n\t\t\t\t\t:canAddChild=\"maxDepth > 0\"\n\t\t\t\t\t@addChild=\"addChild(node)\"\n\t\t\t\t\t@remove=\"removeNode(node, null)\" />\n\n\t\t\t\t<!-- One level of children: a drop target on every top item. -->\n\t\t\t\t<Draggable v-if=\"maxDepth > 0\"\n\t\t\t\t\tv-model=\"node.children\"\n\t\t\t\t\ttag=\"ul\"\n\t\t\t\t\tclass=\"cn-menu-tree__children\"\n\t\t\t\t\t:class=\"{ 'cn-menu-tree__children--empty': !node.children.length }\"\n\t\t\t\t\t:itemKey=\"keyOf\"\n\t\t\t\t\t:group=\"group\"\n\t\t\t\t\thandle=\".cn-menu-tree__handle\"\n\t\t\t\t\t:move=\"onMove\"\n\t\t\t\t\t@end=\"flatten\">\n\t\t\t\t\t<template #item=\"{ element: child }\">\n\t\t\t\t\t\t<li class=\"cn-menu-tree__node\">\n\t\t\t\t\t\t\t<CnMenuTreeRow :item=\"child.ref\"\n\t\t\t\t\t\t\t\t:pages=\"pages\"\n\t\t\t\t\t\t\t\t:canAddChild=\"false\"\n\t\t\t\t\t\t\t\t@remove=\"removeNode(child, node)\" />\n\t\t\t\t\t\t</li>\n\t\t\t\t\t</template>\n\t\t\t\t</Draggable>\n\t\t\t</li>\n\t\t</template>\n\t</Draggable>\n</template>\n\n<script>\nimport { translate as t } from '@nextcloud/l10n'\nimport draggable from 'vuedraggable'\nimport CnMenuTreeRow from './CnMenuTreeRow.vue'\n\n/**\n * CnMenuTreeNode — the menu editor's drag-and-drop tree (ADR-041).\n *\n * Renders the working manifest's `menu[]` (nested via each item's `children[]`)\n * as a two-level draggable tree: drag a row to reorder, or into / out of an item\n * to nest (one level — CnAppNav supports one). Each row (CnMenuTreeRow) edits its\n * icon / label / target page inline + Delete via a cog. Drag operates on a local\n * mirror (`tree`) of real item refs; after each drop the mirror is FLATTENED back\n * onto `menu[]` in place — `order` renumbered to match the visual order, the\n * top-level `section` marker set/cleared, and each item's `children[]` rebuilt —\n * so `diffManifest` sees the change. Field edits mutate the real refs directly.\n *\n * The top level is scoped by `section`, matched EXACTLY: the main-menu editor\n * shows `main` items, the settings-menu editor shows `section: \"settings\"`\n * items, and neither ever claims the other's — or an `integrations` entry,\n * which has no editor here at all and must survive both untouched. Flatten\n * preserves every section it does not own.\n */\nexport default {\n\tname: 'CnMenuTreeNode',\n\n\tcomponents: { Draggable: draggable, CnMenuTreeRow },\n\n\tprops: {\n\t\t/**\n\t\t * The working manifest's `menu[]` (top-level items; children live in each\n\t\t * item's `children[]`). Edited in place.\n\t\t *\n\t\t * @type {Array}\n\t\t */\n\t\tlist: {\n\t\t\ttype: Array,\n\t\t\trequired: true,\n\t\t},\n\n\t\t/** Maximum nesting depth that may gain children (CnAppNav supports one level). */\n\t\tmaxDepth: {\n\t\t\ttype: Number,\n\t\t\tdefault: 1,\n\t\t},\n\n\t\t/**\n\t\t * Selectable target pages as `{ value: routeName, label }` options,\n\t\t * forwarded to every row's Page picker.\n\t\t *\n\t\t * @type {Array<{value: string, label: string}>}\n\t\t */\n\t\tpages: {\n\t\t\ttype: Array,\n\t\t\tdefault: () => [],\n\t\t},\n\n\t\t/**\n\t\t * Which nav section this editor scopes to at the top level. An editor\n\t\t * shows — and on flatten rewrites — ONLY entries whose section matches\n\t\t * exactly; every other section is preserved untouched. `null` and\n\t\t * `\"main\"` both mean the main menu.\n\t\t *\n\t\t * @type {'main'|'settings'|'integrations'|null}\n\t\t */\n\t\tsection: {\n\t\t\ttype: String,\n\t\t\tdefault: null,\n\t\t\tvalidator: (v) => v === null || ['main', 'settings', 'integrations'].includes(v),\n\t\t},\n\t},\n\n\tdata() {\n\t\treturn {\n\t\t\t// Local nested mirror of the section's items (real refs); flattened\n\t\t\t// back to `list` after each drop.\n\t\t\ttree: this.buildTree(),\n\t\t\t// Per-section drag group (main + settings editors never inter-drag).\n\t\t\tgroup: 'cn-menu-' + (this.section || 'main'),\n\t\t\t// Guard against the watcher rebuilding mid-flatten.\n\t\t\tsuppressRebuild: false,\n\t\t}\n\t},\n\n\twatch: {\n\t\t// The prop's IDENTITY, for a host that swaps the array wholesale.\n\t\tlist: {\n\t\t\thandler: 'rebuild',\n\t\t\tdeep: false,\n\t\t},\n\n\t\t// ...and its LENGTH, for a host that pushes or splices in place. The\n\t\t// modal's \"Add menu item\" does exactly that — `list` IS the working\n\t\t// manifest's `menu[]`, so its reference never changes and the watcher\n\t\t// above never fired: the item was appended and never appeared.\n\t\t//\n\t\t// Length rather than `deep: true`, which would fire on every keystroke\n\t\t// in a row's field and rebuild the tree under the user. This\n\t\t// component's own mutations land in `flatten()`, which holds\n\t\t// `suppressRebuild` across the splice.\n\t\t'list.length': 'rebuild',\n\t\t// Bypasses `rebuild()`'s suppressRebuild guard deliberately: a section\n\t\t// switch is never concurrent with this component's own flatten() write\n\t\t// (that guard exists only for the list/list.length watchers above), and\n\t\t// the new section's tree must always be rebuilt regardless of the flag.\n\t\tsection() {\n\t\t\tthis.tree = this.buildTree()\n\t\t},\n\t},\n\n\tmethods: {\n\t\tt,\n\t\t/**\n\t\t * Re-seed the local tree from `list`, unless our own `flatten()` is\n\t\t * mid-write.\n\t\t *\n\t\t * @return {void}\n\t\t */\n\t\trebuild() {\n\t\t\tif (this.suppressRebuild) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tthis.tree = this.buildTree()\n\t\t},\n\n\t\t/**\n\t\t * Stable-ish v-for key for a node.\n\t\t *\n\t\t * @param {object} node The tree node.\n\t\t * @return {string}\n\t\t */\n\t\tkeyOf(node) {\n\t\t\treturn (node.ref && node.ref.id) || String(node._k || (node._k = Math.random()))\n\t\t},\n\n\t\t/**\n\t\t * The section this editor owns, normalised — an absent `section` prop\n\t\t * means the main menu.\n\t\t *\n\t\t * @return {string} 'main' | 'settings' | 'integrations'\n\t\t */\n\t\twantSection() {\n\t\t\treturn this.section || 'main'\n\t\t},\n\n\t\t/**\n\t\t * An entry's section, normalised the same way.\n\t\t *\n\t\t * This pair replaced a binary `(it.section === 'settings') === wantSettings`\n\t\t * test, which was correct only while exactly two sections existed. Once\n\t\t * `section: \"integrations\"` was added (ADR-110), an integrations entry\n\t\t * answered `false` to \"is settings\", so the MAIN editor claimed it — and\n\t\t * `flatten()` `delete`s the section marker on everything the main editor\n\t\t * claims. Opening the main-menu editor and saving would have quietly\n\t\t * converted every cross-app link back into a nav entry, undoing the\n\t\t * contract with no error and no diff the author asked for. Matching the\n\t\t * section exactly means an editor owns its own section and nothing else.\n\t\t *\n\t\t * @param {object} item The menu entry.\n\t\t * @return {string} The entry's normalised section.\n\t\t */\n\t\tsectionOf(item) {\n\t\t\treturn (item && item.section) || 'main'\n\t\t},\n\n\t\t/**\n\t\t * Order comparator: numeric `order` ascending, array index as tiebreak.\n\t\t *\n\t\t * @param {Array} arr The array being sorted (for index tiebreak).\n\t\t * @return {(a: object, b: object) => number} The comparator.\n\t\t */\n\t\tbyOrder(arr) {\n\t\t\treturn (a, b) => {\n\t\t\t\tconst oa = typeof a.order === 'number' ? a.order : arr.indexOf(a)\n\t\t\t\tconst ob = typeof b.order === 'number' ? b.order : arr.indexOf(b)\n\t\t\t\treturn oa - ob\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Build the nested mirror from `list`, scoped to this section and ordered.\n\t\t *\n\t\t * @return {Array<{ref: object, children: Array}>}\n\t\t */\n\t\tbuildTree() {\n\t\t\tconst list = Array.isArray(this.list) ? this.list : []\n\t\t\tconst want = this.wantSection()\n\t\t\tconst top = list\n\t\t\t\t.filter((it) => it && this.sectionOf(it) === want)\n\t\t\t\t.slice()\n\t\t\t\t.sort(this.byOrder(list))\n\t\t\treturn top.map((ref) => {\n\t\t\t\tconst kids = Array.isArray(ref.children) ? ref.children.slice().sort(this.byOrder(ref.children)) : []\n\t\t\t\treturn { ref, children: kids.map((c) => ({ ref: c, children: [] })) }\n\t\t\t})\n\t\t},\n\n\t\t/**\n\t\t * Flatten the mirror back onto `list` in place: renumber `order`, set/clear\n\t\t * the top-level `section` marker, rebuild each item's `children[]`, and\n\t\t * preserve the other section's items.\n\t\t *\n\t\t * @return {void}\n\t\t */\n\t\tflatten() {\n\t\t\tconst want = this.wantSection()\n\t\t\tconst others = this.list.filter((it) => it && this.sectionOf(it) !== want)\n\t\t\tconst mine = this.tree.map((node, i) => {\n\t\t\t\tconst ref = node.ref\n\t\t\t\tref.order = (i + 1) * 10\n\t\t\t\tif (want === 'main') {\n\t\t\t\t\tdelete ref.section\n\t\t\t\t} else {\n\t\t\t\t\tref.section = want\n\t\t\t\t}\n\t\t\t\tif (node.children.length) {\n\t\t\t\t\tref.children = node.children.map((cn, j) => {\n\t\t\t\t\t\tcn.ref.order = (j + 1) * 10\n\t\t\t\t\t\tdelete cn.ref.section\n\t\t\t\t\t\treturn cn.ref\n\t\t\t\t\t})\n\t\t\t\t} else {\n\t\t\t\t\tdelete ref.children\n\t\t\t\t}\n\t\t\t\treturn ref\n\t\t\t})\n\t\t\tconst next = want === 'main' ? [...mine, ...others] : [...others, ...mine]\n\t\t\tthis.suppressRebuild = true\n\t\t\t// In-place edit by design — `list` is the working manifest's menu[],\n\t\t\t// mutated by reference so diffManifest captures the reorder/nesting.\n\t\t\t// eslint-disable-next-line vue/no-mutating-props\n\t\t\tthis.list.splice(0, this.list.length, ...next)\n\t\t\tthis.$nextTick(() => {\n\t\t\t\tthis.suppressRebuild = false\n\t\t\t})\n\t\t},\n\n\t\t/**\n\t\t * vuedraggable guard: forbid dropping a node that HAS children into a\n\t\t * child list (would nest two levels deep).\n\t\t *\n\t\t * @param {object} evt The vuedraggable move event.\n\t\t * @return {boolean} False to veto.\n\t\t */\n\t\tonMove(evt) {\n\t\t\tconst dragged = evt.draggedContext && evt.draggedContext.element\n\t\t\tconst target = evt.relatedContext && evt.relatedContext.list\n\t\t\tconst intoChild = target && target !== this.tree\n\t\t\tif (intoChild && dragged && Array.isArray(dragged.children) && dragged.children.length) {\n\t\t\t\treturn false\n\t\t\t}\n\t\t\treturn true\n\t\t},\n\n\t\t/**\n\t\t * Generate a unique `menu-N` id not already used at any level of `list`.\n\t\t *\n\t\t * @return {string}\n\t\t */\n\t\tnextId() {\n\t\t\tconst ids = new Set()\n\t\t\tconst walk = (arr) => (arr || []).forEach((it) => {\n\t\t\t\tif (it) {\n\t\t\t\t\tids.add(it.id)\n\t\t\t\t\twalk(it.children)\n\t\t\t\t}\n\t\t\t})\n\t\t\twalk(this.list)\n\t\t\tlet n = ids.size + 1\n\t\t\twhile (ids.has(`menu-${n}`)) {\n\t\t\t\tn++\n\t\t\t}\n\t\t\treturn `menu-${n}`\n\t\t},\n\n\t\t/**\n\t\t * Append a blank child under a top node.\n\t\t *\n\t\t * @param {object} node The parent tree node.\n\t\t * @return {void}\n\t\t */\n\t\taddChild(node) {\n\t\t\tconst ref = { id: this.nextId(), label: '', icon: '', route: '' }\n\t\t\tnode.children.push({ ref, children: [] })\n\t\t\tthis.flatten()\n\t\t},\n\n\t\t/**\n\t\t * Remove a node. A removed top node's children are lifted to top level.\n\t\t *\n\t\t * @param {object} node The node to remove.\n\t\t * @param {object|null} parent The parent node, or null for a top node.\n\t\t * @return {void}\n\t\t */\n\t\tremoveNode(node, parent) {\n\t\t\tif (parent) {\n\t\t\t\tconst i = parent.children.indexOf(node)\n\t\t\t\tif (i !== -1) {\n\t\t\t\t\tparent.children.splice(i, 1)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tconst i = this.tree.indexOf(node)\n\t\t\t\tif (i !== -1) {\n\t\t\t\t\tthis.tree.splice(i, 1, ...node.children)\n\t\t\t\t}\n\t\t\t}\n\t\t\tthis.flatten()\n\t\t},\n\t},\n}\n</script>\n\n<style scoped>\n.cn-menu-tree {\n\tlist-style: none;\n\tmargin: 0;\n\tpadding: 0;\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 4px;\n}\n\n.cn-menu-tree__children {\n\tlist-style: none;\n\tmargin: 4px 0 0 28px;\n\tpadding: 0 0 0 8px;\n\tborder-left: 2px solid var(--color-border);\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 4px;\n}\n\n.cn-menu-tree__children--empty {\n\tmin-height: 10px;\n\tmargin-top: 0;\n\tborder-left-color: transparent;\n}\n\n.cn-menu-tree__node {\n\tlist-style: none;\n}\n</style>\n"],"names":["draggable","CnMenuTreeRow","t"],"mappings":";;;;AAuDA;;AAEC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAGA;;AAED,aAAe;AACd,CAAA,IAAI,EAAE,gBAAgB;;CAEtB,UAAU,EAAE,EAAE,SAAS,EAAEA,SAAS,iBAAEC,YAAe;;AAEnD,CAAA,KAAK,EAAE;AACN;AACC;AACA;AACA;;;EAGD,IAAI,EAAE;GACL,IAAI,EA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,EAAA;AACxC,KAAA;AACD,IAAA;GACA,IAAI,CAAC,OAAO,GAAC;GACb;EACD;AACF;;;;"}
@@ -1,6 +1,6 @@
1
1
  import { translate } from '@nextcloud/l10n';
2
2
  import { NcButton, NcLoadingIcon } from '@nextcloud/vue';
3
- import draggable from '../../node_modules/vuedraggable/dist/vuedraggable.umd.js';
3
+ import Draggable from '../../node_modules/vuedraggable/dist/vuedraggable.umd.js';
4
4
  import ViewColumn from 'vue-material-design-icons/ViewColumn.vue';
5
5
  import __sfc_main from '../CnEmptyContent/CnEmptyContent.vue.js';
6
6
  import { normalizeLook } from '../../composables/useLook.js';
@@ -62,7 +62,7 @@ var script = {
62
62
  name: 'CnObjectKanban',
63
63
 
64
64
  components: {
65
- Draggable: draggable,
65
+ Draggable: Draggable,
66
66
  NcButton,
67
67
  NcLoadingIcon,
68
68
  CnEmptyContent: __sfc_main,
@@ -1 +1 @@
1
- {"version":3,"file":"CnObjectKanban.vue2.js","sources":["../../../../src/components/CnObjectKanban/CnObjectKanban.vue"],"sourcesContent":["<!--\n - SPDX-FileCopyrightText: 2026 Conduction B.V.\n - SPDX-License-Identifier: EUPL-1.2\n-->\n\n<template>\n\t<div class=\"cn-object-kanban\">\n\t\t<div v-if=\"loading\" class=\"cn-object-kanban__loading\">\n\t\t\t<NcLoadingIcon :size=\"32\" />\n\t\t</div>\n\n\t\t<div v-else-if=\"localColumns.length === 0\" class=\"cn-object-kanban__empty\">\n\t\t\t<!-- @slot empty Custom empty state shown when there are no columns to render. -->\n\t\t\t<slot name=\"empty\">\n\t\t\t\t<CnEmptyContent :name=\"emptyText\">\n\t\t\t\t\t<template #icon>\n\t\t\t\t\t\t<ViewColumn :size=\"64\" />\n\t\t\t\t\t</template>\n\t\t\t\t</CnEmptyContent>\n\t\t\t</slot>\n\t\t</div>\n\n\t\t<div v-else class=\"cn-object-kanban__board\" :class=\"{ 'cn-object-kanban__board--board': isBoardLook }\">\n\t\t\t<div\n\t\t\t\tv-for=\"column in localColumns\"\n\t\t\t\t:key=\"columnKey(column.value)\"\n\t\t\t\tclass=\"cn-object-kanban__column\">\n\t\t\t\t<div class=\"cn-object-kanban__column-header\">\n\t\t\t\t\t<!-- @slot column-header Override a column's header. -->\n\t\t\t\t\t<!-- @binding {object} column The column ({ value, cards, total, limit, offset }). -->\n\t\t\t\t\t<slot name=\"column-header\" :column=\"column\">\n\t\t\t\t\t\t<span class=\"cn-object-kanban__column-title\">{{ columnLabel(column) }}</span>\n\t\t\t\t\t\t<span class=\"cn-object-kanban__column-count\">{{ column.total }}</span>\n\t\t\t\t\t</slot>\n\t\t\t\t</div>\n\n\t\t\t\t<!-- `#item` + `item-key`: vuedraggable@4 (the Vue 3 build)\n\t\t\t\t renders the cards itself from this slot. A `v-for` in the\n\t\t\t\t default slot throws \"draggable element must have an item\n\t\t\t\t slot\" the moment the column paints. -->\n\t\t\t\t<Draggable\n\t\t\t\t\t:list=\"column.cards\"\n\t\t\t\t\ttag=\"div\"\n\t\t\t\t\tclass=\"cn-object-kanban__column-cards\"\n\t\t\t\t\t:itemKey=\"cardKey\"\n\t\t\t\t\tgroup=\"cn-object-kanban-cards\"\n\t\t\t\t\t:data-column-value=\"columnKey(column.value)\"\n\t\t\t\t\t@start=\"onDragStart(column)\"\n\t\t\t\t\t@change=\"onColumnChange($event, column)\">\n\t\t\t\t\t<template #item=\"{ element: card }\">\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tclass=\"cn-object-kanban__card\"\n\t\t\t\t\t\t\t:class=\"{\n\t\t\t\t\t\t\t\t'cn-object-kanban__card--pending': isPending(card),\n\t\t\t\t\t\t\t\t'cn-object-kanban__card--overdue': dueState(card) === 'overdue',\n\t\t\t\t\t\t\t\t'cn-object-kanban__card--soon': dueState(card) === 'soon',\n\t\t\t\t\t\t\t}\">\n\t\t\t\t\t\t\t<!-- @slot card Fully replace the default card rendering. -->\n\t\t\t\t\t\t\t<!-- @binding {object} object The card's object. -->\n\t\t\t\t\t\t\t<!-- @binding {object} column The column the card currently sits in. -->\n\t\t\t\t\t\t\t<!-- @binding {string|null} dueState The card's due state under `dueRule`: `overdue`, `soon`, `ok`, or null without a rule. -->\n\t\t\t\t\t\t\t<slot\n\t\t\t\t\t\t\t\tname=\"card\"\n\t\t\t\t\t\t\t\t:object=\"card\"\n\t\t\t\t\t\t\t\t:column=\"column\"\n\t\t\t\t\t\t\t\t:dueState=\"dueState(card)\">\n\t\t\t\t\t\t\t\t<span\n\t\t\t\t\t\t\t\t\tv-if=\"dueLabel(card)\"\n\t\t\t\t\t\t\t\t\tclass=\"cn-object-kanban__due\"\n\t\t\t\t\t\t\t\t\t:class=\"`cn-object-kanban__due--${dueState(card)}`\"\n\t\t\t\t\t\t\t\t\tdata-testid=\"cn-kanban-due\">\n\t\t\t\t\t\t\t\t\t{{ dueLabel(card) }}\n\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t<div class=\"cn-object-kanban__card-title\" @click=\"onCardClick(card)\">\n\t\t\t\t\t\t\t\t\t{{ cardTitle(card) }}\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t<div v-if=\"cardFields.length\" class=\"cn-object-kanban__card-fields\">\n\t\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\t\tv-for=\"field in cardFields\"\n\t\t\t\t\t\t\t\t\t\t:key=\"field\"\n\t\t\t\t\t\t\t\t\t\tclass=\"cn-object-kanban__card-field\">\n\t\t\t\t\t\t\t\t\t\t<CnCellRenderer\n\t\t\t\t\t\t\t\t\t\t\t:value=\"card[field]\"\n\t\t\t\t\t\t\t\t\t\t\t:property=\"schemaProperty(field)\"\n\t\t\t\t\t\t\t\t\t\t\t:truncate=\"40\" />\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t</slot>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</template>\n\t\t\t\t</Draggable>\n\n\t\t\t\t<div v-if=\"hasMore(column)\" class=\"cn-object-kanban__load-more\">\n\t\t\t\t\t<NcButton :disabled=\"isColumnLoading(column)\" @click=\"onLoadMore(column)\">\n\t\t\t\t\t\t<template v-if=\"isColumnLoading(column)\" #icon>\n\t\t\t\t\t\t\t<NcLoadingIcon :size=\"16\" />\n\t\t\t\t\t\t</template>\n\t\t\t\t\t\t{{ loadMoreLabel }}\n\t\t\t\t\t</NcButton>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</div>\n\t</div>\n</template>\n\n<script>\nimport { translate as t } from '@nextcloud/l10n'\nimport { NcButton, NcLoadingIcon } from '@nextcloud/vue'\nimport draggable from 'vuedraggable'\nimport ViewColumn from 'vue-material-design-icons/ViewColumn.vue'\nimport CnEmptyContent from '../CnEmptyContent/CnEmptyContent.vue'\nimport { normalizeLook } from '../../composables/useLook.js'\nimport { dueStateForRow } from '../../utils/dueRule.js'\nimport { CnCellRenderer } from '../CnCellRenderer/index.js'\n\n/**\n * CnObjectKanban — Kanban board over a schema property's distinct values.\n *\n * Renders one column per distinct value of `groupByField` and paginates each\n * column's cards independently (\"load more\", never a whole column at once).\n * Column values/order come from (in precedence order) an explicit\n * `columnOrder`, the `groupByField` schema property's `enum`, or values\n * discovered from `objects` — mirroring OpenRegister's\n * `ViewPresentationService::deriveColumnValues()`.\n *\n * Two rendering modes:\n * - **Pre-built columns** — pass `columns` (the shape returned by\n * `GET /api/views/{id}/kanban`: `[{ value, cards, total, limit, offset }]`);\n * the host owns pagination and re-fetches on `load-more`.\n * - **Flat objects** — pass `objects` + `groupByField` (and optionally\n * `columnOrder`/`schema`); the component derives and paginates columns\n * locally.\n *\n * Dragging a card to another column does NOT write anything itself — there is\n * deliberately no bespoke \"move card\" endpoint (REQ-VIEW-KANBAN-03). The move\n * is applied optimistically to the local board and the component emits\n * `move`; the host performs the actual object PATCH/PUT through the existing\n * guarded write path and reports back:\n * - On success, nothing further is required (the optimistic move already\n * reflects it) — optionally call `resolveMove(id)` to clear the pending\n * visual state sooner.\n * - On a rejected (e.g. illegal lifecycle transition) write, call\n * `rejectMove(id, reason)` — the card snaps back to its origin column and\n * `move-rejected` fires with the reason for the host to surface.\n *\n * ```vue\n * <CnObjectKanban\n * :objects=\"objects\"\n * group-by-field=\"status\"\n * :column-order=\"['todo', 'doing', 'done']\"\n * :card-fields=\"['title', 'assignee']\"\n * :schema=\"schema\"\n * ref=\"kanban\"\n * @move=\"onMove\"\n * @load-more=\"fetchMoreCards\" />\n * ```\n * ```js\n * async onMove({ object, groupByField, fromValue, toValue }) {\n * try {\n * await patchObject(object.id, { [groupByField]: toValue })\n * } catch (e) {\n * this.$refs.kanban.rejectMove(object.id, e.message)\n * }\n * }\n * ```\n */\nexport default {\n\tname: 'CnObjectKanban',\n\n\tcomponents: {\n\t\tDraggable: draggable,\n\t\tNcButton,\n\t\tNcLoadingIcon,\n\t\tCnEmptyContent,\n\t\tViewColumn,\n\t\tCnCellRenderer,\n\t},\n\n\tinject: {\n\t\t/** The look the app is drawn in; the board look takes the board column tokens. */\n\t\tcnLook: { default: 'nextcloud' },\n\t},\n\n\tprops: {\n\t\t/**\n\t\t * Flat objects to derive columns from (ignored when `columns` is set).\n\t\t *\n\t\t * @type {Array<object>}\n\t\t */\n\t\tobjects: {\n\t\t\ttype: Array,\n\t\t\tdefault: () => [],\n\t\t},\n\n\t\t/**\n\t\t * Pre-built columns, e.g. the response of `GET /api/views/{id}/kanban`.\n\t\t *\n\t\t * @type {Array<{value: string|number, cards: Array<object>, total: number, limit: number, offset: number}>|null}\n\t\t */\n\t\tcolumns: {\n\t\t\ttype: Array,\n\t\t\tdefault: null,\n\t\t},\n\n\t\t/** The schema property whose distinct values become columns. */\n\t\tgroupByField: {\n\t\t\ttype: String,\n\t\t\trequired: true,\n\t\t},\n\n\t\t/** Explicit column order. Takes precedence over the schema's enum order. */\n\t\tcolumnOrder: {\n\t\t\ttype: Array,\n\t\t\tdefault: null,\n\t\t},\n\n\t\t/** Object fields rendered on each card (in order). */\n\t\tcardFields: {\n\t\t\ttype: Array,\n\t\t\tdefault: () => [],\n\t\t},\n\n\t\t/** Schema definition, used to resolve enum column order and card field types. */\n\t\tschema: {\n\t\t\ttype: Object,\n\t\t\tdefault: null,\n\t\t},\n\n\t\t/** Overall loading state (initial board fetch). */\n\t\tloading: {\n\t\t\ttype: Boolean,\n\t\t\tdefault: false,\n\t\t},\n\n\t\t/** Column values currently loading more cards (drives the per-column spinner). */\n\t\tloadingColumns: {\n\t\t\ttype: Array,\n\t\t\tdefault: () => [],\n\t\t},\n\n\t\t/** Cards shown per column before \"load more\", in local (`objects`-driven) mode. */\n\t\tpageSize: {\n\t\t\ttype: Number,\n\t\t\tdefault: 20,\n\t\t},\n\n\t\t/** Object property used as each card's identity. */\n\t\trowKey: {\n\t\t\ttype: String,\n\t\t\tdefault: 'id',\n\t\t},\n\n\t\t/**\n\t\t * Marks late cards: `{ field, soonDays? }`. `field` is the dot-path to\n\t\t * a card's due date. A date before today gets an error edge and the\n\t\t * label \"Overdue\"; a date within `soonDays` (default 3) gets \"Due\n\t\t * soon\" in the warning colour. `null` (the default) marks nothing.\n\t\t *\n\t\t * The same rule shape the table's date cell uses, so a list and its\n\t\t * board agree on what late means.\n\t\t *\n\t\t * @type {{field: string, soonDays?: number}|null}\n\t\t */\n\t\tdueRule: {\n\t\t\ttype: Object,\n\t\t\tdefault: null,\n\t\t},\n\t},\n\n\temits: ['card-click', 'load-more', 'move', 'move-rejected'],\n\n\tdata() {\n\t\treturn {\n\t\t\tlocalColumns: [],\n\t\t\t// column.value -> full unpaginated card list, local mode only.\n\t\t\tfullCardsByColumn: {},\n\t\t\t// Suppressed while a move is pending so the prop-driven rebuild\n\t\t\t// doesn't clobber the optimistic UI before the host's data catches up.\n\t\t\tsuppressRebuild: false,\n\t\t\t// objectId -> { fromValue, toValue, card, originIndex }\n\t\t\tpendingMoves: {},\n\t\t\tdragOriginValue: null,\n\t\t\t// The day late marking measures from.\n\t\t\ttoday: new Date(),\n\t\t}\n\t},\n\n\tcomputed: {\n\t\t/** @return {boolean} Whether the app takes the board look. */\n\t\tisBoardLook() {\n\t\t\treturn normalizeLook(this.cnLook) === 'board'\n\t\t},\n\n\t\temptyText() {\n\t\t\treturn t('nextcloud-vue', 'No columns to show')\n\t\t},\n\n\t\tloadMoreLabel() {\n\t\t\treturn t('nextcloud-vue', 'Load more')\n\t\t},\n\t},\n\n\twatch: {\n\t\tobjects: {\n\t\t\thandler() {\n\t\t\t\tif (!this.suppressRebuild) {\n\t\t\t\t\tthis.rebuild()\n\t\t\t\t}\n\t\t\t},\n\n\t\t\tdeep: false,\n\t\t},\n\n\t\tcolumns: {\n\t\t\thandler() {\n\t\t\t\tif (!this.suppressRebuild) {\n\t\t\t\t\tthis.rebuild()\n\t\t\t\t}\n\t\t\t},\n\n\t\t\tdeep: false,\n\t\t},\n\n\t\tgroupByField() {\n\t\t\tthis.rebuild()\n\t\t},\n\n\t\tcolumnOrder: {\n\t\t\thandler() {\n\t\t\t\tthis.rebuild()\n\t\t\t},\n\n\t\t\tdeep: true,\n\t\t},\n\t},\n\n\tcreated() {\n\t\tthis.rebuild()\n\t},\n\n\tmethods: {\n\t\tt,\n\n\t\t/**\n\t\t * A card's due state under `dueRule`.\n\t\t *\n\t\t * @param {object} card The card's row.\n\t\t * @return {'overdue'|'soon'|'ok'|null} The state, or null when no rule applies.\n\t\t * @spec openspec/changes/detail-action-model-and-case-surfaces/specs/detail-action-model/spec.md#requirement-late-marking-on-board-cards\n\t\t */\n\t\tdueState(card) {\n\t\t\treturn dueStateForRow(card, this.dueRule, this.today)\n\t\t},\n\n\t\t/**\n\t\t * The words a late card carries. Colour alone would not reach a reader\n\t\t * who cannot see it, or cannot tell red from amber.\n\t\t *\n\t\t * @param {object} card The card's row.\n\t\t * @return {string} \"Overdue\", \"Due soon\", or '' for a card that is fine.\n\t\t * @spec openspec/changes/detail-action-model-and-case-surfaces/specs/detail-action-model/spec.md#requirement-late-marking-on-board-cards\n\t\t */\n\t\tdueLabel(card) {\n\t\t\tconst state = this.dueState(card)\n\t\t\tif (state === 'overdue') {\n\t\t\t\treturn t('nextcloud-vue', 'Overdue')\n\t\t\t}\n\t\t\treturn state === 'soon' ? t('nextcloud-vue', 'Due soon') : ''\n\t\t},\n\n\t\t/**\n\t\t * Rebuild `localColumns` from either the `columns` prop (backend-paginated\n\t\t * mode) or `objects` + `groupByField` (locally-derived mode).\n\t\t *\n\t\t * @return {void}\n\t\t */\n\t\trebuild() {\n\t\t\tif (Array.isArray(this.columns)) {\n\t\t\t\tthis.localColumns = this.columns.map((column) => ({\n\t\t\t\t\tvalue: column.value,\n\t\t\t\t\tcards: Array.isArray(column.cards) ? [...column.cards] : [],\n\t\t\t\t\ttotal: typeof column.total === 'number' ? column.total : (column.cards || []).length,\n\t\t\t\t\tlimit: column.limit,\n\t\t\t\t\toffset: column.offset,\n\t\t\t\t}))\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tconst values = this.deriveColumnValues()\n\t\t\tconst fullByColumn = {}\n\t\t\tthis.localColumns = values.map((value) => {\n\t\t\t\tconst fullCards = this.objects.filter((object) => object && object[this.groupByField] === value)\n\t\t\t\tfullByColumn[this.columnKey(value)] = fullCards\n\t\t\t\treturn {\n\t\t\t\t\tvalue,\n\t\t\t\t\tcards: fullCards.slice(0, this.pageSize),\n\t\t\t\t\ttotal: fullCards.length,\n\t\t\t\t\tlimit: this.pageSize,\n\t\t\t\t\toffset: 0,\n\t\t\t\t}\n\t\t\t})\n\t\t\tthis.fullCardsByColumn = fullByColumn\n\t\t},\n\n\t\t/**\n\t\t * Derive the ordered column values: `columnOrder` > schema enum order >\n\t\t * distinct values observed in `objects`. Mirrors\n\t\t * `ViewPresentationService::deriveColumnValues()`.\n\t\t *\n\t\t * @return {Array<unknown>}\n\t\t */\n\t\tderiveColumnValues() {\n\t\t\tif (Array.isArray(this.columnOrder) && this.columnOrder.length > 0) {\n\t\t\t\treturn [...this.columnOrder]\n\t\t\t}\n\n\t\t\tconst enumValues = this.schema?.properties?.[this.groupByField]?.enum\n\t\t\tif (Array.isArray(enumValues) && enumValues.length > 0) {\n\t\t\t\treturn [...enumValues]\n\t\t\t}\n\n\t\t\treturn this.discoverDistinctValues()\n\t\t},\n\n\t\t/**\n\t\t * Distinct `groupByField` values observed in `objects`, in first-seen order.\n\t\t *\n\t\t * @return {Array<unknown>}\n\t\t */\n\t\tdiscoverDistinctValues() {\n\t\t\tconst seen = new Set()\n\t\t\tconst values = []\n\t\t\tfor (const object of this.objects) {\n\t\t\t\tconst value = object?.[this.groupByField]\n\t\t\t\tif (value !== undefined && value !== null && !seen.has(value)) {\n\t\t\t\t\tseen.add(value)\n\t\t\t\t\tvalues.push(value)\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn values\n\t\t},\n\n\t\t/**\n\t\t * Stable string key for a column value (used as a `:key` and as the\n\t\t * `fullCardsByColumn` index — object/array values are unlikely but guarded).\n\t\t *\n\t\t * @param {unknown} value The column value.\n\t\t * @return {string}\n\t\t */\n\t\tcolumnKey(value) {\n\t\t\treturn typeof value === 'string' || typeof value === 'number' ? String(value) : JSON.stringify(value)\n\t\t},\n\n\t\t/**\n\t\t * The card's identity, per `rowKey`.\n\t\t *\n\t\t * @param {object} card The card object.\n\t\t * @return {unknown}\n\t\t */\n\t\tcardKey(card) {\n\t\t\treturn card?.[this.rowKey]\n\t\t},\n\n\t\t/**\n\t\t * Display label for a column: its schema `oneOf[].title` when the\n\t\t * property declares per-value titles, otherwise the raw value.\n\t\t *\n\t\t * @param {object} column The column.\n\t\t * @return {string}\n\t\t */\n\t\tcolumnLabel(column) {\n\t\t\tconst oneOf = this.schema?.properties?.[this.groupByField]?.oneOf\n\t\t\tif (Array.isArray(oneOf)) {\n\t\t\t\tconst match = oneOf.find((entry) => entry?.const === column.value)\n\t\t\t\tif (match?.title) {\n\t\t\t\t\treturn match.title\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn String(column.value)\n\t\t},\n\n\t\t/**\n\t\t * Best-effort card title: the schema's configured name field, else\n\t\t * `title`/`name`/the row key.\n\t\t *\n\t\t * @param {object} card The card object.\n\t\t * @return {string}\n\t\t */\n\t\tcardTitle(card) {\n\t\t\tconst nameField = this.schema?.configuration?.objectNameField\n\t\t\tif (nameField && card[nameField]) {\n\t\t\t\treturn String(card[nameField])\n\t\t\t}\n\t\t\treturn String(card.title || card.name || card[this.rowKey] || '—')\n\t\t},\n\n\t\t/**\n\t\t * The schema property definition for a card field, if known.\n\t\t *\n\t\t * @param {string} field The field name.\n\t\t * @return {object|undefined}\n\t\t */\n\t\tschemaProperty(field) {\n\t\t\treturn this.schema?.properties?.[field]\n\t\t},\n\n\t\t/**\n\t\t * Whether a column has more cards to load: backend-paginated mode compares\n\t\t * `cards.length` to `total`; local mode compares to the full filtered set.\n\t\t *\n\t\t * @param {object} column The column.\n\t\t * @return {boolean}\n\t\t */\n\t\thasMore(column) {\n\t\t\tif (Array.isArray(this.columns)) {\n\t\t\t\treturn column.cards.length < column.total\n\t\t\t}\n\t\t\tconst full = this.fullCardsByColumn[this.columnKey(column.value)] || []\n\t\t\treturn column.cards.length < full.length\n\t\t},\n\n\t\t/**\n\t\t * Whether a column's \"load more\" is in flight.\n\t\t *\n\t\t * @param {object} column The column.\n\t\t * @return {boolean}\n\t\t */\n\t\tisColumnLoading(column) {\n\t\t\treturn this.loadingColumns.includes(column.value)\n\t\t},\n\n\t\t/**\n\t\t * Whether a card has an unresolved optimistic move.\n\t\t *\n\t\t * @param {object} card The card object.\n\t\t * @return {boolean}\n\t\t */\n\t\tisPending(card) {\n\t\t\treturn Object.hasOwn(this.pendingMoves, this.cardKey(card))\n\t\t},\n\n\t\t/**\n\t\t * Handle a column's \"load more\" click: local mode reveals the next page\n\t\t * from the already-fetched full set; backend-paginated mode only emits —\n\t\t * the host fetches the next page and passes updated `columns`.\n\t\t *\n\t\t * @param {object} column The column.\n\t\t * @return {void}\n\t\t */\n\t\tonLoadMore(column) {\n\t\t\tif (!Array.isArray(this.columns)) {\n\t\t\t\tconst full = this.fullCardsByColumn[this.columnKey(column.value)] || []\n\t\t\t\tcolumn.cards = full.slice(0, column.cards.length + this.pageSize)\n\t\t\t}\n\t\t\t/**\n\t\t\t * @event load-more Emitted when a column's \"load more\" is clicked.\n\t\t\t * @type {{ value: unknown, offset: number }}\n\t\t\t */\n\t\t\tthis.$emit('load-more', { value: column.value, offset: column.cards.length })\n\t\t},\n\n\t\t/**\n\t\t * Card click (ignored while the card is mid-drag).\n\t\t *\n\t\t * @param {object} card The card object.\n\t\t * @return {void}\n\t\t */\n\t\tonCardClick(card) {\n\t\t\t/**\n\t\t\t * @event card-click Emitted when a card is clicked (not dragged).\n\t\t\t * @type {object} The card's object.\n\t\t\t */\n\t\t\tthis.$emit('card-click', card)\n\t\t},\n\n\t\t/**\n\t\t * vuedraggable `@start` — remember which column a drag began in, since\n\t\t * `@change` on the destination column doesn't know the source.\n\t\t *\n\t\t * @param {object} column The column the drag started in.\n\t\t * @return {void}\n\t\t */\n\t\tonDragStart(column) {\n\t\t\tthis.dragOriginValue = column.value\n\t\t},\n\n\t\t/**\n\t\t * vuedraggable `@change` on a column's card list. Only the destination\n\t\t * column's `added` event carries the dropped object; a same-column\n\t\t * reorder (`moved`) or the source column's `removed` are no-ops here.\n\t\t *\n\t\t * @param {object} evt vuedraggable's change event.\n\t\t * @param {object} column The column the event fired on.\n\t\t * @return {void}\n\t\t */\n\t\tonColumnChange(evt, column) {\n\t\t\tif (!evt.added) {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tconst card = evt.added.element\n\t\t\tconst fromValue = this.dragOriginValue\n\t\t\tconst toValue = column.value\n\t\t\tthis.dragOriginValue = null\n\n\t\t\tif (fromValue === toValue) {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tthis.commitMove(card, fromValue, toValue, evt.added.newIndex)\n\t\t},\n\n\t\t/**\n\t\t * Record the pending move and emit it for the host to persist. The card\n\t\t * has already been moved optimistically by vuedraggable's v-model splice.\n\t\t *\n\t\t * @param {object} card The moved object.\n\t\t * @param {unknown} fromValue The origin column's value.\n\t\t * @param {unknown} toValue The destination column's value.\n\t\t * @param {number} originIndex The index the card is currently at in the destination column (used only for logging/debugging).\n\t\t * @return {void}\n\t\t */\n\t\tcommitMove(card, fromValue, toValue, originIndex) {\n\t\t\tconst id = this.cardKey(card)\n\t\t\tthis.suppressRebuild = true\n\t\t\tthis.pendingMoves = {\n\t\t\t\t...this.pendingMoves,\n\t\t\t\t[id]: { fromValue, toValue, card, originIndex },\n\t\t\t}\n\n\t\t\t/**\n\t\t\t * @event move Emitted after a card is optimistically moved to another\n\t\t\t * column. The host performs the actual object write through the\n\t\t\t * existing guarded PATCH/PUT endpoint and calls `resolveMove`/\n\t\t\t * `rejectMove` on this component to confirm or roll back.\n\t\t\t * @type {{ object: object, groupByField: string, fromValue: unknown, toValue: unknown }}\n\t\t\t */\n\t\t\tthis.$emit('move', {\n\t\t\t\tobject: card,\n\t\t\t\tgroupByField: this.groupByField,\n\t\t\t\tfromValue,\n\t\t\t\ttoValue,\n\t\t\t})\n\t\t},\n\n\t\t/**\n\t\t * Confirm a pending move succeeded — clears its pending visual state.\n\t\t * The card already sits in the destination column (optimistic UI); no\n\t\t * further mutation is needed.\n\t\t *\n\t\t * @param {unknown} objectId The moved object's `rowKey` value.\n\t\t * @return {void}\n\t\t * @public\n\t\t */\n\t\tresolveMove(objectId) {\n\t\t\tthis.clearPending(objectId)\n\t\t},\n\n\t\t/**\n\t\t * Roll back a rejected move: the card returns to its origin column and\n\t\t * `move-rejected` fires with the server's reason.\n\t\t *\n\t\t * @param {unknown} objectId The moved object's `rowKey` value.\n\t\t * @param {string} [reason] The rejection reason (e.g. an illegal lifecycle\n\t\t * transition message) to surface to the user.\n\t\t * @return {void}\n\t\t * @public\n\t\t */\n\t\trejectMove(objectId, reason) {\n\t\t\tconst pending = this.pendingMoves[objectId]\n\t\t\tif (!pending) {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tconst toColumn = this.localColumns.find((c) => c.value === pending.toValue)\n\t\t\tconst fromColumn = this.localColumns.find((c) => c.value === pending.fromValue)\n\n\t\t\tif (toColumn) {\n\t\t\t\tconst idx = toColumn.cards.findIndex((c) => this.cardKey(c) === objectId)\n\t\t\t\tif (idx !== -1) {\n\t\t\t\t\ttoColumn.cards.splice(idx, 1)\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (fromColumn) {\n\t\t\t\tfromColumn.cards.push(pending.card)\n\t\t\t}\n\n\t\t\tthis.clearPending(objectId)\n\n\t\t\t/**\n\t\t\t * @event move-rejected Emitted after `rejectMove()` rolls a card back\n\t\t\t * to its origin column.\n\t\t\t * @type {{ object: object, fromValue: unknown, toValue: unknown, reason: (string|undefined) }}\n\t\t\t */\n\t\t\tthis.$emit('move-rejected', {\n\t\t\t\tobject: pending.card,\n\t\t\t\tfromValue: pending.fromValue,\n\t\t\t\ttoValue: pending.toValue,\n\t\t\t\treason,\n\t\t\t})\n\t\t},\n\n\t\t/**\n\t\t * Remove a move from the pending map and, once none remain, allow\n\t\t * prop-driven rebuilds again.\n\t\t *\n\t\t * @param {unknown} objectId The moved object's `rowKey` value.\n\t\t * @return {void}\n\t\t */\n\t\tclearPending(objectId) {\n\t\t\tconst { [objectId]: _removed, ...rest } = this.pendingMoves\n\t\t\tthis.pendingMoves = rest\n\t\t\tif (Object.keys(rest).length === 0) {\n\t\t\t\tthis.suppressRebuild = false\n\t\t\t}\n\t\t},\n\t},\n}\n</script>\n\n<style scoped>\n.cn-object-kanban__loading,\n.cn-object-kanban__empty {\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: center;\n\tpadding: 40px;\n}\n\n.cn-object-kanban__board {\n\tdisplay: flex;\n\tgap: 16px;\n\toverflow-x: auto;\n\tpadding-bottom: 8px;\n}\n\n.cn-object-kanban__column {\n\tdisplay: flex;\n\tflex-direction: column;\n\tflex: 0 0 280px;\n\tmin-width: 280px;\n\tbackground: var(--color-background-dark);\n\tborder-radius: var(--border-radius-large, 10px);\n\tpadding: 8px;\n}\n\n.cn-object-kanban__column-header {\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: space-between;\n\tpadding: 8px;\n\tfont-weight: 600;\n}\n\n.cn-object-kanban__column-count {\n\tcolor: var(--color-text-maxcontrast);\n\tfont-weight: 400;\n}\n\n.cn-object-kanban__column-cards {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 8px;\n\tmin-height: 40px;\n}\n\n.cn-object-kanban__card {\n\tbackground: var(--color-main-background);\n\tborder: 1px solid var(--color-border);\n\tborder-radius: var(--border-radius, 8px);\n\tpadding: 10px;\n\tcursor: grab;\n\ttransition: opacity 0.15s ease;\n}\n\n.cn-object-kanban__card--pending {\n\topacity: 0.6;\n}\n\n/* A late card. The label carries the meaning; the edge helps a sighted\n reader find it. An inset shadow, so the card keeps its size. */\n.cn-object-kanban__card--overdue {\n\tborder-color: var(--color-error);\n\tbox-shadow: inset 3px 0 0 var(--color-error);\n}\n\n.cn-object-kanban__due {\n\tdisplay: block;\n\tfont-size: 0.85em;\n\tfont-weight: 700;\n}\n\n.cn-object-kanban__due--overdue {\n\tcolor: var(--color-error-text, var(--color-error));\n}\n\n.cn-object-kanban__due--soon {\n\tcolor: var(--color-warning-text, var(--color-main-text));\n\tfont-weight: 600;\n}\n\n.cn-object-kanban__card-title {\n\tfont-weight: 500;\n\tcursor: pointer;\n}\n\n.cn-object-kanban__card-fields {\n\tmargin-top: 6px;\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 2px;\n\tfont-size: 13px;\n\tcolor: var(--color-text-maxcontrast);\n}\n\n.cn-object-kanban__load-more {\n\tdisplay: flex;\n\tjustify-content: center;\n\tpadding-top: 8px;\n}\n\n/* Board look (screens-kanban-parity): the same column tokens as CnBoardView. */\n.cn-object-kanban__board--board {\n\tgap: 16px;\n}\n\n.cn-object-kanban__board--board .cn-object-kanban__column {\n\tflex: 1 0 240px;\n\tmin-width: 240px;\n\tpadding: 12px;\n\tborder-radius: 12px;\n}\n\n.cn-object-kanban__board--board .cn-object-kanban__card {\n\tpadding: 14px;\n\tborder-radius: 10px;\n}\n</style>\n"],"names":["CnEmptyContent","CnCellRenderer","t"],"mappings":";;;;;;;;;AAmHA;AACC;AACA;AACA;AACA;;AAEA;;;AAGA;AACA;;AAEA;;;AAGA;AACA;AACA;AACA;AACA;;AAEA;AACA;;;AAGA;;;;AAIA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;;;;;;;;;AASA;;AAED,aAAe;AACd,CAAA,IAAI,EAAE,gBAAgB;;CAEtB,UAAU,EAAE;AACX,EAAA,SAAS,EAAE,SAAS;AACpB,EAAA,QAAQ;EACR,aAAa;AACb,kBAAAA,UAAc;EACd,UAAU;AACV,kBAAAC,YAAc;EACd;;AAED,CAAA,MAAM,EAAE;AACP;EACA,MAAM,EAAE,EAAE,OAAO,EAAE,WAAU,EAAG;EAChC;;AAED,CAAA,KAAK,EAAE;AACN;;AAEC;AACA;;AAED,EAAA,OAAO,EAAE;GACR,IAAI,EAAE,KAAK;AACX,GAAA,OAAO,EAAE,MAAM,EAAE;GACjB;;AAED;AACC;AACA;;;AAGD,EAAA,OAAO,EAAE;GACR,IAAI,EAAE,KAAK;GACX,OAAO,EAAE,IAAI;GACb;;;EAGD,YAAY,EAAE;GACb,IAAI,EAAE,MAAM;GACZ,QAAQ,EAAE,IAAI;GACd;;AAED;EACA,WAAW,EAAE;GACZ,IAAI,EAAE,KAAK;GACX,OAAO,EAAE,IAAI;GACb;;AAED;EACA,UAAU,EAAE;GACX,IAAI,EAAE,KAAK;AACX,GAAA,OAAO,EAAE,MAAM,EAAE;GACjB;;AAED;AACA,EAAA,MAAM,EAAE;GACP,IAAI,EAAE,MAAM;GACZ,OAAO,EAAE,IAAI;GACb;;AAED;AACA,EAAA,OAAO,EAAE;GACR,IAAI,EAAE,OAAO;GACb,OAAO,EAAE,KAAK;GACd;;AAED;AACA,EAAA,cAAc,EAAE;GACf,IAAI,EAAE,KAAK;AACX,GAAA,OAAO,EAAE,MAAM,EAAE;GACjB;;AAED;AACA,E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I,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,UAAU,OAAO,CAAC,SAAS,EAAA;;GAE9E,IAAI,QAAQ,EAAE;AACb,IAAA,MAAM,GAAI,GAAE,QAAQ,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,OAAO,CAAC,CAAC,CAAE,KAAI,QAAQ,EAAA;IACxE,IAAI,GAAE,KAAM,CAAC,CAAC,EAAE;KACf,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,EAAA;AAC7B,KAAA;AACD,IAAA;AACA,GAAA,IAAI,UAAU,EAAE;AACf,IAAA,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAA;AACnC,IAAA;;GAEA,IAAI,CAAC,YAAY,CAAC,QAAQ,EAAA;;AAE1B;;AAEC;AACA;;GAED,IAAI,CAAC,KAAK,CAAC,eAAe,EAAE;AAC3B,IAAA,MAAM,EAAE,OAAO,CAAC,IAAI;IACpB,SAAS,EAAE,OAAO,CAAC,SAAS;IAC5B,OAAO,EAAE,OAAO,CAAC,OAAO;AACxB,IAAA,MAAM;IACN,EAAA;GACD;;AAED;;;AAGC;;;;EAID,YAAY,CAAC,QAAQ,EAAE;GACtB,MAAM,EAAE,CAAC,QAAQ,GAAG,QAAQ,EAAE,GAAG,IAAK,EAAA,GAAI,IAAI,CAAC,aAAW;AAC1D,GAAA,IAAI,CAAC,eAAe,KAAG;AACvB,GAAA,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,MAAO,KAAI,CAAC,EAAE;IACnC,IAAI,CAAC,kBAAkB,MAAI;AAC5B,IAAA;GACA;EACD;AACF;;;;"}
1
+ {"version":3,"file":"CnObjectKanban.vue2.js","sources":["../../../../src/components/CnObjectKanban/CnObjectKanban.vue"],"sourcesContent":["<!--\n - SPDX-FileCopyrightText: 2026 Conduction B.V.\n - SPDX-License-Identifier: EUPL-1.2\n-->\n\n<template>\n\t<div class=\"cn-object-kanban\">\n\t\t<div v-if=\"loading\" class=\"cn-object-kanban__loading\">\n\t\t\t<NcLoadingIcon :size=\"32\" />\n\t\t</div>\n\n\t\t<div v-else-if=\"localColumns.length === 0\" class=\"cn-object-kanban__empty\">\n\t\t\t<!-- @slot empty Custom empty state shown when there are no columns to render. -->\n\t\t\t<slot name=\"empty\">\n\t\t\t\t<CnEmptyContent :name=\"emptyText\">\n\t\t\t\t\t<template #icon>\n\t\t\t\t\t\t<ViewColumn :size=\"64\" />\n\t\t\t\t\t</template>\n\t\t\t\t</CnEmptyContent>\n\t\t\t</slot>\n\t\t</div>\n\n\t\t<div v-else class=\"cn-object-kanban__board\" :class=\"{ 'cn-object-kanban__board--board': isBoardLook }\">\n\t\t\t<div\n\t\t\t\tv-for=\"column in localColumns\"\n\t\t\t\t:key=\"columnKey(column.value)\"\n\t\t\t\tclass=\"cn-object-kanban__column\">\n\t\t\t\t<div class=\"cn-object-kanban__column-header\">\n\t\t\t\t\t<!-- @slot column-header Override a column's header. -->\n\t\t\t\t\t<!-- @binding {object} column The column ({ value, cards, total, limit, offset }). -->\n\t\t\t\t\t<slot name=\"column-header\" :column=\"column\">\n\t\t\t\t\t\t<span class=\"cn-object-kanban__column-title\">{{ columnLabel(column) }}</span>\n\t\t\t\t\t\t<span class=\"cn-object-kanban__column-count\">{{ column.total }}</span>\n\t\t\t\t\t</slot>\n\t\t\t\t</div>\n\n\t\t\t\t<!-- `#item` + `item-key`: vuedraggable@4 (the Vue 3 build)\n\t\t\t\t renders the cards itself from this slot. A `v-for` in the\n\t\t\t\t default slot throws \"draggable element must have an item\n\t\t\t\t slot\" the moment the column paints. -->\n\t\t\t\t<Draggable\n\t\t\t\t\t:list=\"column.cards\"\n\t\t\t\t\ttag=\"div\"\n\t\t\t\t\tclass=\"cn-object-kanban__column-cards\"\n\t\t\t\t\t:itemKey=\"cardKey\"\n\t\t\t\t\tgroup=\"cn-object-kanban-cards\"\n\t\t\t\t\t:data-column-value=\"columnKey(column.value)\"\n\t\t\t\t\t@start=\"onDragStart(column)\"\n\t\t\t\t\t@change=\"onColumnChange($event, column)\">\n\t\t\t\t\t<template #item=\"{ element: card }\">\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tclass=\"cn-object-kanban__card\"\n\t\t\t\t\t\t\t:class=\"{\n\t\t\t\t\t\t\t\t'cn-object-kanban__card--pending': isPending(card),\n\t\t\t\t\t\t\t\t'cn-object-kanban__card--overdue': dueState(card) === 'overdue',\n\t\t\t\t\t\t\t\t'cn-object-kanban__card--soon': dueState(card) === 'soon',\n\t\t\t\t\t\t\t}\">\n\t\t\t\t\t\t\t<!-- @slot card Fully replace the default card rendering. -->\n\t\t\t\t\t\t\t<!-- @binding {object} object The card's object. -->\n\t\t\t\t\t\t\t<!-- @binding {object} column The column the card currently sits in. -->\n\t\t\t\t\t\t\t<!-- @binding {string|null} dueState The card's due state under `dueRule`: `overdue`, `soon`, `ok`, or null without a rule. -->\n\t\t\t\t\t\t\t<slot\n\t\t\t\t\t\t\t\tname=\"card\"\n\t\t\t\t\t\t\t\t:object=\"card\"\n\t\t\t\t\t\t\t\t:column=\"column\"\n\t\t\t\t\t\t\t\t:dueState=\"dueState(card)\">\n\t\t\t\t\t\t\t\t<span\n\t\t\t\t\t\t\t\t\tv-if=\"dueLabel(card)\"\n\t\t\t\t\t\t\t\t\tclass=\"cn-object-kanban__due\"\n\t\t\t\t\t\t\t\t\t:class=\"`cn-object-kanban__due--${dueState(card)}`\"\n\t\t\t\t\t\t\t\t\tdata-testid=\"cn-kanban-due\">\n\t\t\t\t\t\t\t\t\t{{ dueLabel(card) }}\n\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t<div class=\"cn-object-kanban__card-title\" @click=\"onCardClick(card)\">\n\t\t\t\t\t\t\t\t\t{{ cardTitle(card) }}\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t<div v-if=\"cardFields.length\" class=\"cn-object-kanban__card-fields\">\n\t\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\t\tv-for=\"field in cardFields\"\n\t\t\t\t\t\t\t\t\t\t:key=\"field\"\n\t\t\t\t\t\t\t\t\t\tclass=\"cn-object-kanban__card-field\">\n\t\t\t\t\t\t\t\t\t\t<CnCellRenderer\n\t\t\t\t\t\t\t\t\t\t\t:value=\"card[field]\"\n\t\t\t\t\t\t\t\t\t\t\t:property=\"schemaProperty(field)\"\n\t\t\t\t\t\t\t\t\t\t\t:truncate=\"40\" />\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t</slot>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</template>\n\t\t\t\t</Draggable>\n\n\t\t\t\t<div v-if=\"hasMore(column)\" class=\"cn-object-kanban__load-more\">\n\t\t\t\t\t<NcButton :disabled=\"isColumnLoading(column)\" @click=\"onLoadMore(column)\">\n\t\t\t\t\t\t<template v-if=\"isColumnLoading(column)\" #icon>\n\t\t\t\t\t\t\t<NcLoadingIcon :size=\"16\" />\n\t\t\t\t\t\t</template>\n\t\t\t\t\t\t{{ loadMoreLabel }}\n\t\t\t\t\t</NcButton>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</div>\n\t</div>\n</template>\n\n<script>\nimport { translate as t } from '@nextcloud/l10n'\nimport { NcButton, NcLoadingIcon } from '@nextcloud/vue'\nimport draggable from 'vuedraggable'\nimport ViewColumn from 'vue-material-design-icons/ViewColumn.vue'\nimport CnEmptyContent from '../CnEmptyContent/CnEmptyContent.vue'\nimport { normalizeLook } from '../../composables/useLook.js'\nimport { dueStateForRow } from '../../utils/dueRule.js'\nimport { CnCellRenderer } from '../CnCellRenderer/index.js'\n\n/**\n * CnObjectKanban — Kanban board over a schema property's distinct values.\n *\n * Renders one column per distinct value of `groupByField` and paginates each\n * column's cards independently (\"load more\", never a whole column at once).\n * Column values/order come from (in precedence order) an explicit\n * `columnOrder`, the `groupByField` schema property's `enum`, or values\n * discovered from `objects` — mirroring OpenRegister's\n * `ViewPresentationService::deriveColumnValues()`.\n *\n * Two rendering modes:\n * - **Pre-built columns** — pass `columns` (the shape returned by\n * `GET /api/views/{id}/kanban`: `[{ value, cards, total, limit, offset }]`);\n * the host owns pagination and re-fetches on `load-more`.\n * - **Flat objects** — pass `objects` + `groupByField` (and optionally\n * `columnOrder`/`schema`); the component derives and paginates columns\n * locally.\n *\n * Dragging a card to another column does NOT write anything itself — there is\n * deliberately no bespoke \"move card\" endpoint (REQ-VIEW-KANBAN-03). The move\n * is applied optimistically to the local board and the component emits\n * `move`; the host performs the actual object PATCH/PUT through the existing\n * guarded write path and reports back:\n * - On success, nothing further is required (the optimistic move already\n * reflects it) — optionally call `resolveMove(id)` to clear the pending\n * visual state sooner.\n * - On a rejected (e.g. illegal lifecycle transition) write, call\n * `rejectMove(id, reason)` — the card snaps back to its origin column and\n * `move-rejected` fires with the reason for the host to surface.\n *\n * ```vue\n * <CnObjectKanban\n * :objects=\"objects\"\n * group-by-field=\"status\"\n * :column-order=\"['todo', 'doing', 'done']\"\n * :card-fields=\"['title', 'assignee']\"\n * :schema=\"schema\"\n * ref=\"kanban\"\n * @move=\"onMove\"\n * @load-more=\"fetchMoreCards\" />\n * ```\n * ```js\n * async onMove({ object, groupByField, fromValue, toValue }) {\n * try {\n * await patchObject(object.id, { [groupByField]: toValue })\n * } catch (e) {\n * this.$refs.kanban.rejectMove(object.id, e.message)\n * }\n * }\n * ```\n */\nexport default {\n\tname: 'CnObjectKanban',\n\n\tcomponents: {\n\t\tDraggable: draggable,\n\t\tNcButton,\n\t\tNcLoadingIcon,\n\t\tCnEmptyContent,\n\t\tViewColumn,\n\t\tCnCellRenderer,\n\t},\n\n\tinject: {\n\t\t/** The look the app is drawn in; the board look takes the board column tokens. */\n\t\tcnLook: { default: 'nextcloud' },\n\t},\n\n\tprops: {\n\t\t/**\n\t\t * Flat objects to derive columns from (ignored when `columns` is set).\n\t\t *\n\t\t * @type {Array<object>}\n\t\t */\n\t\tobjects: {\n\t\t\ttype: Array,\n\t\t\tdefault: () => [],\n\t\t},\n\n\t\t/**\n\t\t * Pre-built columns, e.g. the response of `GET /api/views/{id}/kanban`.\n\t\t *\n\t\t * @type {Array<{value: string|number, cards: Array<object>, total: number, limit: number, offset: number}>|null}\n\t\t */\n\t\tcolumns: {\n\t\t\ttype: Array,\n\t\t\tdefault: null,\n\t\t},\n\n\t\t/** The schema property whose distinct values become columns. */\n\t\tgroupByField: {\n\t\t\ttype: String,\n\t\t\trequired: true,\n\t\t},\n\n\t\t/** Explicit column order. Takes precedence over the schema's enum order. */\n\t\tcolumnOrder: {\n\t\t\ttype: Array,\n\t\t\tdefault: null,\n\t\t},\n\n\t\t/** Object fields rendered on each card (in order). */\n\t\tcardFields: {\n\t\t\ttype: Array,\n\t\t\tdefault: () => [],\n\t\t},\n\n\t\t/** Schema definition, used to resolve enum column order and card field types. */\n\t\tschema: {\n\t\t\ttype: Object,\n\t\t\tdefault: null,\n\t\t},\n\n\t\t/** Overall loading state (initial board fetch). */\n\t\tloading: {\n\t\t\ttype: Boolean,\n\t\t\tdefault: false,\n\t\t},\n\n\t\t/** Column values currently loading more cards (drives the per-column spinner). */\n\t\tloadingColumns: {\n\t\t\ttype: Array,\n\t\t\tdefault: () => [],\n\t\t},\n\n\t\t/** Cards shown per column before \"load more\", in local (`objects`-driven) mode. */\n\t\tpageSize: {\n\t\t\ttype: Number,\n\t\t\tdefault: 20,\n\t\t},\n\n\t\t/** Object property used as each card's identity. */\n\t\trowKey: {\n\t\t\ttype: String,\n\t\t\tdefault: 'id',\n\t\t},\n\n\t\t/**\n\t\t * Marks late cards: `{ field, soonDays? }`. `field` is the dot-path to\n\t\t * a card's due date. A date before today gets an error edge and the\n\t\t * label \"Overdue\"; a date within `soonDays` (default 3) gets \"Due\n\t\t * soon\" in the warning colour. `null` (the default) marks nothing.\n\t\t *\n\t\t * The same rule shape the table's date cell uses, so a list and its\n\t\t * board agree on what late means.\n\t\t *\n\t\t * @type {{field: string, soonDays?: number}|null}\n\t\t */\n\t\tdueRule: {\n\t\t\ttype: Object,\n\t\t\tdefault: null,\n\t\t},\n\t},\n\n\temits: ['card-click', 'load-more', 'move', 'move-rejected'],\n\n\tdata() {\n\t\treturn {\n\t\t\tlocalColumns: [],\n\t\t\t// column.value -> full unpaginated card list, local mode only.\n\t\t\tfullCardsByColumn: {},\n\t\t\t// Suppressed while a move is pending so the prop-driven rebuild\n\t\t\t// doesn't clobber the optimistic UI before the host's data catches up.\n\t\t\tsuppressRebuild: false,\n\t\t\t// objectId -> { fromValue, toValue, card, originIndex }\n\t\t\tpendingMoves: {},\n\t\t\tdragOriginValue: null,\n\t\t\t// The day late marking measures from.\n\t\t\ttoday: new Date(),\n\t\t}\n\t},\n\n\tcomputed: {\n\t\t/** @return {boolean} Whether the app takes the board look. */\n\t\tisBoardLook() {\n\t\t\treturn normalizeLook(this.cnLook) === 'board'\n\t\t},\n\n\t\temptyText() {\n\t\t\treturn t('nextcloud-vue', 'No columns to show')\n\t\t},\n\n\t\tloadMoreLabel() {\n\t\t\treturn t('nextcloud-vue', 'Load more')\n\t\t},\n\t},\n\n\twatch: {\n\t\tobjects: {\n\t\t\thandler() {\n\t\t\t\tif (!this.suppressRebuild) {\n\t\t\t\t\tthis.rebuild()\n\t\t\t\t}\n\t\t\t},\n\n\t\t\tdeep: false,\n\t\t},\n\n\t\tcolumns: {\n\t\t\thandler() {\n\t\t\t\tif (!this.suppressRebuild) {\n\t\t\t\t\tthis.rebuild()\n\t\t\t\t}\n\t\t\t},\n\n\t\t\tdeep: false,\n\t\t},\n\n\t\tgroupByField() {\n\t\t\tthis.rebuild()\n\t\t},\n\n\t\tcolumnOrder: {\n\t\t\thandler() {\n\t\t\t\tthis.rebuild()\n\t\t\t},\n\n\t\t\tdeep: true,\n\t\t},\n\t},\n\n\tcreated() {\n\t\tthis.rebuild()\n\t},\n\n\tmethods: {\n\t\tt,\n\n\t\t/**\n\t\t * A card's due state under `dueRule`.\n\t\t *\n\t\t * @param {object} card The card's row.\n\t\t * @return {'overdue'|'soon'|'ok'|null} The state, or null when no rule applies.\n\t\t * @spec openspec/changes/detail-action-model-and-case-surfaces/specs/detail-action-model/spec.md#requirement-late-marking-on-board-cards\n\t\t */\n\t\tdueState(card) {\n\t\t\treturn dueStateForRow(card, this.dueRule, this.today)\n\t\t},\n\n\t\t/**\n\t\t * The words a late card carries. Colour alone would not reach a reader\n\t\t * who cannot see it, or cannot tell red from amber.\n\t\t *\n\t\t * @param {object} card The card's row.\n\t\t * @return {string} \"Overdue\", \"Due soon\", or '' for a card that is fine.\n\t\t * @spec openspec/changes/detail-action-model-and-case-surfaces/specs/detail-action-model/spec.md#requirement-late-marking-on-board-cards\n\t\t */\n\t\tdueLabel(card) {\n\t\t\tconst state = this.dueState(card)\n\t\t\tif (state === 'overdue') {\n\t\t\t\treturn t('nextcloud-vue', 'Overdue')\n\t\t\t}\n\t\t\treturn state === 'soon' ? t('nextcloud-vue', 'Due soon') : ''\n\t\t},\n\n\t\t/**\n\t\t * Rebuild `localColumns` from either the `columns` prop (backend-paginated\n\t\t * mode) or `objects` + `groupByField` (locally-derived mode).\n\t\t *\n\t\t * @return {void}\n\t\t */\n\t\trebuild() {\n\t\t\tif (Array.isArray(this.columns)) {\n\t\t\t\tthis.localColumns = this.columns.map((column) => ({\n\t\t\t\t\tvalue: column.value,\n\t\t\t\t\tcards: Array.isArray(column.cards) ? [...column.cards] : [],\n\t\t\t\t\ttotal: typeof column.total === 'number' ? column.total : (column.cards || []).length,\n\t\t\t\t\tlimit: column.limit,\n\t\t\t\t\toffset: column.offset,\n\t\t\t\t}))\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tconst values = this.deriveColumnValues()\n\t\t\tconst fullByColumn = {}\n\t\t\tthis.localColumns = values.map((value) => {\n\t\t\t\tconst fullCards = this.objects.filter((object) => object && object[this.groupByField] === value)\n\t\t\t\tfullByColumn[this.columnKey(value)] = fullCards\n\t\t\t\treturn {\n\t\t\t\t\tvalue,\n\t\t\t\t\tcards: fullCards.slice(0, this.pageSize),\n\t\t\t\t\ttotal: fullCards.length,\n\t\t\t\t\tlimit: this.pageSize,\n\t\t\t\t\toffset: 0,\n\t\t\t\t}\n\t\t\t})\n\t\t\tthis.fullCardsByColumn = fullByColumn\n\t\t},\n\n\t\t/**\n\t\t * Derive the ordered column values: `columnOrder` > schema enum order >\n\t\t * distinct values observed in `objects`. Mirrors\n\t\t * `ViewPresentationService::deriveColumnValues()`.\n\t\t *\n\t\t * @return {Array<unknown>}\n\t\t */\n\t\tderiveColumnValues() {\n\t\t\tif (Array.isArray(this.columnOrder) && this.columnOrder.length > 0) {\n\t\t\t\treturn [...this.columnOrder]\n\t\t\t}\n\n\t\t\tconst enumValues = this.schema?.properties?.[this.groupByField]?.enum\n\t\t\tif (Array.isArray(enumValues) && enumValues.length > 0) {\n\t\t\t\treturn [...enumValues]\n\t\t\t}\n\n\t\t\treturn this.discoverDistinctValues()\n\t\t},\n\n\t\t/**\n\t\t * Distinct `groupByField` values observed in `objects`, in first-seen order.\n\t\t *\n\t\t * @return {Array<unknown>}\n\t\t */\n\t\tdiscoverDistinctValues() {\n\t\t\tconst seen = new Set()\n\t\t\tconst values = []\n\t\t\tfor (const object of this.objects) {\n\t\t\t\tconst value = object?.[this.groupByField]\n\t\t\t\tif (value !== undefined && value !== null && !seen.has(value)) {\n\t\t\t\t\tseen.add(value)\n\t\t\t\t\tvalues.push(value)\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn values\n\t\t},\n\n\t\t/**\n\t\t * Stable string key for a column value (used as a `:key` and as the\n\t\t * `fullCardsByColumn` index — object/array values are unlikely but guarded).\n\t\t *\n\t\t * @param {unknown} value The column value.\n\t\t * @return {string}\n\t\t */\n\t\tcolumnKey(value) {\n\t\t\treturn typeof value === 'string' || typeof value === 'number' ? String(value) : JSON.stringify(value)\n\t\t},\n\n\t\t/**\n\t\t * The card's identity, per `rowKey`.\n\t\t *\n\t\t * @param {object} card The card object.\n\t\t * @return {unknown}\n\t\t */\n\t\tcardKey(card) {\n\t\t\treturn card?.[this.rowKey]\n\t\t},\n\n\t\t/**\n\t\t * Display label for a column: its schema `oneOf[].title` when the\n\t\t * property declares per-value titles, otherwise the raw value.\n\t\t *\n\t\t * @param {object} column The column.\n\t\t * @return {string}\n\t\t */\n\t\tcolumnLabel(column) {\n\t\t\tconst oneOf = this.schema?.properties?.[this.groupByField]?.oneOf\n\t\t\tif (Array.isArray(oneOf)) {\n\t\t\t\tconst match = oneOf.find((entry) => entry?.const === column.value)\n\t\t\t\tif (match?.title) {\n\t\t\t\t\treturn match.title\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn String(column.value)\n\t\t},\n\n\t\t/**\n\t\t * Best-effort card title: the schema's configured name field, else\n\t\t * `title`/`name`/the row key.\n\t\t *\n\t\t * @param {object} card The card object.\n\t\t * @return {string}\n\t\t */\n\t\tcardTitle(card) {\n\t\t\tconst nameField = this.schema?.configuration?.objectNameField\n\t\t\tif (nameField && card[nameField]) {\n\t\t\t\treturn String(card[nameField])\n\t\t\t}\n\t\t\treturn String(card.title || card.name || card[this.rowKey] || '—')\n\t\t},\n\n\t\t/**\n\t\t * The schema property definition for a card field, if known.\n\t\t *\n\t\t * @param {string} field The field name.\n\t\t * @return {object|undefined}\n\t\t */\n\t\tschemaProperty(field) {\n\t\t\treturn this.schema?.properties?.[field]\n\t\t},\n\n\t\t/**\n\t\t * Whether a column has more cards to load: backend-paginated mode compares\n\t\t * `cards.length` to `total`; local mode compares to the full filtered set.\n\t\t *\n\t\t * @param {object} column The column.\n\t\t * @return {boolean}\n\t\t */\n\t\thasMore(column) {\n\t\t\tif (Array.isArray(this.columns)) {\n\t\t\t\treturn column.cards.length < column.total\n\t\t\t}\n\t\t\tconst full = this.fullCardsByColumn[this.columnKey(column.value)] || []\n\t\t\treturn column.cards.length < full.length\n\t\t},\n\n\t\t/**\n\t\t * Whether a column's \"load more\" is in flight.\n\t\t *\n\t\t * @param {object} column The column.\n\t\t * @return {boolean}\n\t\t */\n\t\tisColumnLoading(column) {\n\t\t\treturn this.loadingColumns.includes(column.value)\n\t\t},\n\n\t\t/**\n\t\t * Whether a card has an unresolved optimistic move.\n\t\t *\n\t\t * @param {object} card The card object.\n\t\t * @return {boolean}\n\t\t */\n\t\tisPending(card) {\n\t\t\treturn Object.hasOwn(this.pendingMoves, this.cardKey(card))\n\t\t},\n\n\t\t/**\n\t\t * Handle a column's \"load more\" click: local mode reveals the next page\n\t\t * from the already-fetched full set; backend-paginated mode only emits —\n\t\t * the host fetches the next page and passes updated `columns`.\n\t\t *\n\t\t * @param {object} column The column.\n\t\t * @return {void}\n\t\t */\n\t\tonLoadMore(column) {\n\t\t\tif (!Array.isArray(this.columns)) {\n\t\t\t\tconst full = this.fullCardsByColumn[this.columnKey(column.value)] || []\n\t\t\t\tcolumn.cards = full.slice(0, column.cards.length + this.pageSize)\n\t\t\t}\n\t\t\t/**\n\t\t\t * @event load-more Emitted when a column's \"load more\" is clicked.\n\t\t\t * @type {{ value: unknown, offset: number }}\n\t\t\t */\n\t\t\tthis.$emit('load-more', { value: column.value, offset: column.cards.length })\n\t\t},\n\n\t\t/**\n\t\t * Card click (ignored while the card is mid-drag).\n\t\t *\n\t\t * @param {object} card The card object.\n\t\t * @return {void}\n\t\t */\n\t\tonCardClick(card) {\n\t\t\t/**\n\t\t\t * @event card-click Emitted when a card is clicked (not dragged).\n\t\t\t * @type {object} The card's object.\n\t\t\t */\n\t\t\tthis.$emit('card-click', card)\n\t\t},\n\n\t\t/**\n\t\t * vuedraggable `@start` — remember which column a drag began in, since\n\t\t * `@change` on the destination column doesn't know the source.\n\t\t *\n\t\t * @param {object} column The column the drag started in.\n\t\t * @return {void}\n\t\t */\n\t\tonDragStart(column) {\n\t\t\tthis.dragOriginValue = column.value\n\t\t},\n\n\t\t/**\n\t\t * vuedraggable `@change` on a column's card list. Only the destination\n\t\t * column's `added` event carries the dropped object; a same-column\n\t\t * reorder (`moved`) or the source column's `removed` are no-ops here.\n\t\t *\n\t\t * @param {object} evt vuedraggable's change event.\n\t\t * @param {object} column The column the event fired on.\n\t\t * @return {void}\n\t\t */\n\t\tonColumnChange(evt, column) {\n\t\t\tif (!evt.added) {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tconst card = evt.added.element\n\t\t\tconst fromValue = this.dragOriginValue\n\t\t\tconst toValue = column.value\n\t\t\tthis.dragOriginValue = null\n\n\t\t\tif (fromValue === toValue) {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tthis.commitMove(card, fromValue, toValue, evt.added.newIndex)\n\t\t},\n\n\t\t/**\n\t\t * Record the pending move and emit it for the host to persist. The card\n\t\t * has already been moved optimistically by vuedraggable's v-model splice.\n\t\t *\n\t\t * @param {object} card The moved object.\n\t\t * @param {unknown} fromValue The origin column's value.\n\t\t * @param {unknown} toValue The destination column's value.\n\t\t * @param {number} originIndex The index the card is currently at in the destination column (used only for logging/debugging).\n\t\t * @return {void}\n\t\t */\n\t\tcommitMove(card, fromValue, toValue, originIndex) {\n\t\t\tconst id = this.cardKey(card)\n\t\t\tthis.suppressRebuild = true\n\t\t\tthis.pendingMoves = {\n\t\t\t\t...this.pendingMoves,\n\t\t\t\t[id]: { fromValue, toValue, card, originIndex },\n\t\t\t}\n\n\t\t\t/**\n\t\t\t * @event move Emitted after a card is optimistically moved to another\n\t\t\t * column. The host performs the actual object write through the\n\t\t\t * existing guarded PATCH/PUT endpoint and calls `resolveMove`/\n\t\t\t * `rejectMove` on this component to confirm or roll back.\n\t\t\t * @type {{ object: object, groupByField: string, fromValue: unknown, toValue: unknown }}\n\t\t\t */\n\t\t\tthis.$emit('move', {\n\t\t\t\tobject: card,\n\t\t\t\tgroupByField: this.groupByField,\n\t\t\t\tfromValue,\n\t\t\t\ttoValue,\n\t\t\t})\n\t\t},\n\n\t\t/**\n\t\t * Confirm a pending move succeeded — clears its pending visual state.\n\t\t * The card already sits in the destination column (optimistic UI); no\n\t\t * further mutation is needed.\n\t\t *\n\t\t * @param {unknown} objectId The moved object's `rowKey` value.\n\t\t * @return {void}\n\t\t * @public\n\t\t */\n\t\tresolveMove(objectId) {\n\t\t\tthis.clearPending(objectId)\n\t\t},\n\n\t\t/**\n\t\t * Roll back a rejected move: the card returns to its origin column and\n\t\t * `move-rejected` fires with the server's reason.\n\t\t *\n\t\t * @param {unknown} objectId The moved object's `rowKey` value.\n\t\t * @param {string} [reason] The rejection reason (e.g. an illegal lifecycle\n\t\t * transition message) to surface to the user.\n\t\t * @return {void}\n\t\t * @public\n\t\t */\n\t\trejectMove(objectId, reason) {\n\t\t\tconst pending = this.pendingMoves[objectId]\n\t\t\tif (!pending) {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tconst toColumn = this.localColumns.find((c) => c.value === pending.toValue)\n\t\t\tconst fromColumn = this.localColumns.find((c) => c.value === pending.fromValue)\n\n\t\t\tif (toColumn) {\n\t\t\t\tconst idx = toColumn.cards.findIndex((c) => this.cardKey(c) === objectId)\n\t\t\t\tif (idx !== -1) {\n\t\t\t\t\ttoColumn.cards.splice(idx, 1)\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (fromColumn) {\n\t\t\t\tfromColumn.cards.push(pending.card)\n\t\t\t}\n\n\t\t\tthis.clearPending(objectId)\n\n\t\t\t/**\n\t\t\t * @event move-rejected Emitted after `rejectMove()` rolls a card back\n\t\t\t * to its origin column.\n\t\t\t * @type {{ object: object, fromValue: unknown, toValue: unknown, reason: (string|undefined) }}\n\t\t\t */\n\t\t\tthis.$emit('move-rejected', {\n\t\t\t\tobject: pending.card,\n\t\t\t\tfromValue: pending.fromValue,\n\t\t\t\ttoValue: pending.toValue,\n\t\t\t\treason,\n\t\t\t})\n\t\t},\n\n\t\t/**\n\t\t * Remove a move from the pending map and, once none remain, allow\n\t\t * prop-driven rebuilds again.\n\t\t *\n\t\t * @param {unknown} objectId The moved object's `rowKey` value.\n\t\t * @return {void}\n\t\t */\n\t\tclearPending(objectId) {\n\t\t\tconst { [objectId]: _removed, ...rest } = this.pendingMoves\n\t\t\tthis.pendingMoves = rest\n\t\t\tif (Object.keys(rest).length === 0) {\n\t\t\t\tthis.suppressRebuild = false\n\t\t\t}\n\t\t},\n\t},\n}\n</script>\n\n<style scoped>\n.cn-object-kanban__loading,\n.cn-object-kanban__empty {\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: center;\n\tpadding: 40px;\n}\n\n.cn-object-kanban__board {\n\tdisplay: flex;\n\tgap: 16px;\n\toverflow-x: auto;\n\tpadding-bottom: 8px;\n}\n\n.cn-object-kanban__column {\n\tdisplay: flex;\n\tflex-direction: column;\n\tflex: 0 0 280px;\n\tmin-width: 280px;\n\tbackground: var(--color-background-dark);\n\tborder-radius: var(--border-radius-large, 10px);\n\tpadding: 8px;\n}\n\n.cn-object-kanban__column-header {\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: space-between;\n\tpadding: 8px;\n\tfont-weight: 600;\n}\n\n.cn-object-kanban__column-count {\n\tcolor: var(--color-text-maxcontrast);\n\tfont-weight: 400;\n}\n\n.cn-object-kanban__column-cards {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 8px;\n\tmin-height: 40px;\n}\n\n.cn-object-kanban__card {\n\tbackground: var(--color-main-background);\n\tborder: 1px solid var(--color-border);\n\tborder-radius: var(--border-radius, 8px);\n\tpadding: 10px;\n\tcursor: grab;\n\ttransition: opacity 0.15s ease;\n}\n\n.cn-object-kanban__card--pending {\n\topacity: 0.6;\n}\n\n/* A late card. The label carries the meaning; the edge helps a sighted\n reader find it. An inset shadow, so the card keeps its size. */\n.cn-object-kanban__card--overdue {\n\tborder-color: var(--color-error);\n\tbox-shadow: inset 3px 0 0 var(--color-error);\n}\n\n.cn-object-kanban__due {\n\tdisplay: block;\n\tfont-size: 0.85em;\n\tfont-weight: 700;\n}\n\n.cn-object-kanban__due--overdue {\n\tcolor: var(--color-error-text, var(--color-error));\n}\n\n.cn-object-kanban__due--soon {\n\tcolor: var(--color-warning-text, var(--color-main-text));\n\tfont-weight: 600;\n}\n\n.cn-object-kanban__card-title {\n\tfont-weight: 500;\n\tcursor: pointer;\n}\n\n.cn-object-kanban__card-fields {\n\tmargin-top: 6px;\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 2px;\n\tfont-size: 13px;\n\tcolor: var(--color-text-maxcontrast);\n}\n\n.cn-object-kanban__load-more {\n\tdisplay: flex;\n\tjustify-content: center;\n\tpadding-top: 8px;\n}\n\n/* Board look (screens-kanban-parity): the same column tokens as CnBoardView. */\n.cn-object-kanban__board--board {\n\tgap: 16px;\n}\n\n.cn-object-kanban__board--board .cn-object-kanban__column {\n\tflex: 1 0 240px;\n\tmin-width: 240px;\n\tpadding: 12px;\n\tborder-radius: 12px;\n}\n\n.cn-object-kanban__board--board .cn-object-kanban__card {\n\tpadding: 14px;\n\tborder-radius: 10px;\n}\n</style>\n"],"names":["draggable","CnEmptyContent","CnCellRenderer","t"],"mappings":";;;;;;;;;AAmHA;AACC;AACA;AACA;AACA;;AAEA;;;AAGA;AACA;;AAEA;;;AAGA;AACA;AACA;AACA;AACA;;AAEA;AACA;;;AAGA;;;;AAIA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;AAEA;;;;;;;;;AASA;;AAED,aAAe;AACd,CAAA,IAAI,EAAE,gBAAgB;;CAEtB,UAAU,EAAE;AACX,EAAA,SAAS,EAAEA,SAAS;AACpB,EAAA,QAAQ;EACR,aAAa;AACb,kBAAAC,UAAc;EACd,UAAU;AACV,kBAAAC,YAAc;EACd;;AAED,CAAA,MAAM,EAAE;AACP;EACA,MAAM,EAAE,EAAE,OAAO,EAAE,WAAU,EAAG;EAChC;;AAED,CAAA,KAAK,EAAE;AACN;;AAEC;AACA;;AAED,EAAA,OAAO,EAAE;GACR,IAAI,EAAE,KAAK;AACX,GAAA,OAAO,EAAE,MAAM,EAAE;GACjB;;AAED;AACC;AACA;;;AAGD,EAAA,OAAO,EAAE;GACR,IAAI,EAAE,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AAO,EAAE,OAAO,CAAC,OAAO;AACxB,IAAA,MAAM;IACN,EAAA;GACD;;AAED;;;AAGC;;;;EAID,YAAY,CAAC,QAAQ,EAAE;GACtB,MAAM,EAAE,CAAC,QAAQ,GAAG,QAAQ,EAAE,GAAG,IAAK,EAAA,GAAI,IAAI,CAAC,aAAW;AAC1D,GAAA,IAAI,CAAC,eAAe,KAAG;AACvB,GAAA,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,MAAO,KAAI,CAAC,EAAE;IACnC,IAAI,CAAC,kBAAkB,MAAI;AAC5B,IAAA;GACA;EACD;AACF;;;;"}
@@ -1,5 +1,5 @@
1
1
  import { translate } from '@nextcloud/l10n';
2
- import draggable from '../../node_modules/vuedraggable/dist/vuedraggable.umd.js';
2
+ import Draggable from '../../node_modules/vuedraggable/dist/vuedraggable.umd.js';
3
3
  import __sfc_main from './CnPageTreeRow.vue.js';
4
4
  import { stripTrailingSlashes } from '../../utils/trailingSlashes.js';
5
5
 
@@ -26,7 +26,7 @@ const pageKeys = new WeakMap();
26
26
  var script = {
27
27
  name: 'CnPageTreeNode',
28
28
 
29
- components: { Draggable: draggable, CnPageTreeRow: __sfc_main },
29
+ components: { Draggable: Draggable, CnPageTreeRow: __sfc_main },
30
30
 
31
31
  props: {
32
32
  /**