@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":"CnPageTreeNode.vue2.js","sources":["../../../../src/components/CnPageTreeNode/CnPageTreeNode.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`, NOT a `v-for` in the default slot. vuedraggable@4\n\t is the Vue 3 build and it renders rows ITSELF from this slot: the\n\t Vue 2 form throws \"draggable element must have an item slot\" outright\n\t (`computeNodes` in its source) and warns that the required `itemKey`\n\t is missing. `item-key` takes the same function the `:key` used to. -->\n\t<Draggable v-model=\"tree\"\n\t\ttag=\"ul\"\n\t\tclass=\"cn-page-tree\"\n\t\t:itemKey=\"(node) => nodeKey(node.ref)\"\n\t\t:group=\"group\"\n\t\thandle=\".cn-page-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-page-tree__node\">\n\t\t\t\t<CnPageTreeRow :page=\"node.ref\"\n\t\t\t\t\t:canAddChild=\"maxDepth > 0\"\n\t\t\t\t\t@addChild=\"addChild(node)\"\n\t\t\t\t\t@rename=\"(id) => renamePage(node.ref, id)\"\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 page so a\n\t\t\t\t row can be dragged IN (to nest) or OUT (to top level). -->\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-page-tree__children\"\n\t\t\t\t\t:class=\"{ 'cn-page-tree__children--empty': !node.children.length }\"\n\t\t\t\t\t:itemKey=\"(child) => nodeKey(child.ref)\"\n\t\t\t\t\t:group=\"group\"\n\t\t\t\t\thandle=\".cn-page-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-page-tree__node\">\n\t\t\t\t\t\t\t<CnPageTreeRow :page=\"child.ref\"\n\t\t\t\t\t\t\t\t:canAddChild=\"false\"\n\t\t\t\t\t\t\t\t@rename=\"(id) => renamePage(child.ref, id)\"\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 CnPageTreeRow from './CnPageTreeRow.vue'\nimport { stripTrailingSlashes } from '../../utils/trailingSlashes.js'\n\n// Stable per-page-object render keys, independent of the mutable `id`. Keyed by\n// the page ref itself (a WeakMap, so removed pages are GC'd) so a slug rename —\n// which changes `id` in place — does NOT change the `<li>` key and therefore\n// does NOT tear down the row (which would close its inline settings panel).\nlet pageKeySeq = 0\nconst pageKeys = new WeakMap()\n\n/**\n * CnPageTreeNode — the pages editor's drag-and-drop tree (ADR-041).\n *\n * Renders the working manifest's FLAT `pages[]` (each page carrying an optional\n * `parent` id) as a two-level draggable tree: drag a row to reorder, or drag it\n * into / out of a page to nest (an index and its detail, one level deep). Each\n * row (CnPageTreeRow) edits its own fields inline + via a cog popover. Drag\n * operates on a local nested mirror (`tree`) of real page refs; after every drop\n * the mirror is FLATTENED back onto the flat `pages[]` in place — top nodes lose\n * `parent`, nested nodes get `parent = <top id>` — so `diffManifest` sees the\n * change and the manifest keeps its flat shape. Field edits mutate the real page\n * refs directly, independent of the mirror.\n */\nexport default {\n\tname: 'CnPageTreeNode',\n\n\tcomponents: { Draggable: draggable, CnPageTreeRow },\n\n\tprops: {\n\t\t/**\n\t\t * The full, flat `pages[]` array (the working manifest's). Edited in\n\t\t * place; the tree is derived from each page's `parent`.\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 (one level: index → detail). */\n\t\tmaxDepth: {\n\t\t\ttype: Number,\n\t\t\tdefault: 1,\n\t\t},\n\n\t\t/**\n\t\t * The working manifest's `menu[]`, used to re-point menu links (whose\n\t\t * `route` is a page id) when a page's slug is renamed. Optional — when\n\t\t * absent, only child `parent` references are cascaded.\n\t\t *\n\t\t * @type {Array}\n\t\t */\n\t\tmenu: {\n\t\t\ttype: Array,\n\t\t\tdefault: null,\n\t\t},\n\t},\n\n\tdata() {\n\t\treturn {\n\t\t\t// Local nested mirror of `list` (real page refs) that vuedraggable\n\t\t\t// reorders; flattened back to `list` after each drop.\n\t\t\ttree: this.buildTree(),\n\t\t\t// Shared drag group so rows move between the top list and child lists.\n\t\t\tgroup: 'cn-pages',\n\t\t\t// Guard against the `list` watcher rebuilding the tree during our own\n\t\t\t// flatten (which would discard the just-dropped arrangement).\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 page\" does exactly that — `list` IS the working\n\t\t// manifest's `pages[]`, so its reference never changes and the watcher\n\t\t// above never fired: the page was appended to the manifest and simply\n\t\t// 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 Title/Route field and rebuild the tree under the user,\n\t\t// tearing down the row whose settings panel is open.\n\t\t//\n\t\t// This component's OWN mutations all land in `flatten()`, which holds\n\t\t// `suppressRebuild` across the splice, so they do not round-trip.\n\t\t'list.length': 'rebuild',\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 render key for a page's `<li>`, tied to the page object rather\n\t\t * than its `id`. Renaming a slug mutates `id` in place; keying by `id`\n\t\t * would change the key and tear the row down, closing its open settings\n\t\t * panel. Keyed by the ref (via WeakMap) so it survives renames and tree\n\t\t * rebuilds (which reuse the same page objects).\n\t\t *\n\t\t * @param {object} ref The page object.\n\t\t * @return {string} A stable key for this page.\n\t\t */\n\t\tnodeKey(ref) {\n\t\t\tlet key = pageKeys.get(ref)\n\t\t\tif (!key) {\n\t\t\t\tkey = `cn-page-${++pageKeySeq}`\n\t\t\t\tpageKeys.set(ref, key)\n\t\t\t}\n\t\t\treturn key\n\t\t},\n\n\t\t/**\n\t\t * Build the nested mirror from the flat `list`: top-level pages (no\n\t\t * `parent`) each carry their children (`parent === id`). Pages whose\n\t\t * `parent` doesn't resolve to a top page are surfaced as top (no orphans).\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 topIds = new Set(list.filter((p) => p && !p.parent).map((p) => p.id))\n\t\t\tconst childrenByParent = {}\n\t\t\tconst top = []\n\t\t\tfor (const p of list) {\n\t\t\t\tif (!p) {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tif (p.parent && topIds.has(p.parent)) {\n\t\t\t\t\t(childrenByParent[p.parent] || (childrenByParent[p.parent] = [])).push(p)\n\t\t\t\t} else {\n\t\t\t\t\ttop.push(p)\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn top.map((ref) => ({\n\t\t\t\tref,\n\t\t\t\tchildren: (childrenByParent[ref.id] || []).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: top nodes drop `parent`,\n\t\t * nested nodes get `parent = <top id>`, preserving array order.\n\t\t *\n\t\t * @return {void}\n\t\t */\n\t\tflatten() {\n\t\t\tconst flat = []\n\t\t\tfor (const node of this.tree) {\n\t\t\t\tif (node.ref.parent) {\n\t\t\t\t\tdelete node.ref.parent\n\t\t\t\t}\n\t\t\t\tflat.push(node.ref)\n\t\t\t\tfor (const child of node.children) {\n\t\t\t\t\tchild.ref.parent = node.ref.id\n\t\t\t\t\tflat.push(child.ref)\n\t\t\t\t}\n\t\t\t}\n\t\t\tthis.suppressRebuild = true\n\t\t\t// In-place edit by design — `list` is the working manifest's pages[],\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, ...flat)\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 (that would nest two levels deep). `relatedContext.list` is\n\t\t * the destination array — anything other than the top `tree` is a child\n\t\t * list.\n\t\t *\n\t\t * @param {object} evt The vuedraggable move event.\n\t\t * @return {boolean} False to veto the move.\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 `page-N` id not already used in `list`.\n\t\t *\n\t\t * @return {string}\n\t\t */\n\t\tnextId() {\n\t\t\tconst ids = new Set(this.list.map((p) => p && p.id))\n\t\t\tlet n = this.list.length + 1\n\t\t\twhile (ids.has(`page-${n}`)) {\n\t\t\t\tn++\n\t\t\t}\n\t\t\treturn `page-${n}`\n\t\t},\n\n\t\t/**\n\t\t * Rename a page's slug (its id). Cascades the new id to child pages'\n\t\t * `parent` and to any `menu[]` links whose `route` targets the old id, so\n\t\t * nesting and navigation keep working. No-op when the new id collides with\n\t\t * another page. The page id is the vue-router route name.\n\t\t *\n\t\t * @param {object} ref The page being renamed (mutated in place).\n\t\t * @param {string} newId The sanitised new id.\n\t\t * @return {void}\n\t\t */\n\t\trenamePage(ref, newId) {\n\t\t\tconst oldId = ref.id\n\t\t\tif (!newId || newId === oldId) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif (this.list.some((p) => p && p.id === newId)) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tfor (const p of this.list) {\n\t\t\t\tif (p && p.parent === oldId) {\n\t\t\t\t\tp.parent = newId\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (Array.isArray(this.menu)) {\n\t\t\t\tconst walk = (items) => (items || []).forEach((it) => {\n\t\t\t\t\tif (!it) {\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\t\tif (it.route === oldId) {\n\t\t\t\t\t\tit.route = newId\n\t\t\t\t\t}\n\t\t\t\t\twalk(it.children)\n\t\t\t\t})\n\t\t\t\twalk(this.menu)\n\t\t\t}\n\t\t\tref.id = newId\n\t\t\tthis.flatten()\n\t\t\tthis.tree = this.buildTree()\n\t\t},\n\n\t\t/**\n\t\t * Append a detail sub-page under a top node (route built from the parent).\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 base = stripTrailingSlashes(String(node.ref.route || ''))\n\t\t\tconst ref = { id: this.nextId(), parent: node.ref.id, type: 'detail', route: `${base}/:id`, title: '', config: {} }\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 so\n\t\t * none orphan.\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-page-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-page-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/* Keep an empty child list as a visible drop target for nesting. */\n.cn-page-tree__children--empty {\n\tmin-height: 10px;\n\tmargin-top: 0;\n\tborder-left-color: transparent;\n}\n\n.cn-page-tree__node {\n\tlist-style: none;\n}\n</style>\n"],"names":["CnPageTreeRow","t"],"mappings":";;;;;AA2DA;AACA;AACA;AACA;AACA,IAAI,UAAS,GAAI,EAAA;AACjB,MAAM,WAAW,IAAI,OAAO,GAAC;;AAE7B;;AAEC;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;;AAED,aAAe;AACd,CAAA,IAAI,EAAE,gBAAgB;;CAEtB,UAAU,EAAE,EAAE,SAAS,EAAE,SAAS,iBAAEA,YAAe;;AAEnD,CAAA,KAAK,EAAE;AACN;;AAEC;AACA;;;EAGD,IAAI,EAAE;GACL,IAAI,EAAE,KAAK;GACX,QAAQ,EAAE,IAAI;GACd;;AAED;AACA,EAAA,QAAQ,EAAE;GACT,IAAI,EAAE,MAAM;AACZ,GAAA,OAAO,EAAE,CAAC;GACV;;AAED;;;;AAIC;;;EAGD,IAAI,EAAE;GACL,IAAI,EAAE,KAAK;GACX,OAAO,EAAE,IAAI;GACb;EACD;;AAED,CAAA,IAAI,GAAG;AACN,EAAA,OAAO;;AAEN;AACA,GAAA,IAAI,EAAE,IAAI,CAAC,SAAS,EAAE;;AAEtB,GAAA,KAAK,EAAE,UAAU;;;AAGjB,GAAA,eAAe,EAAE,KAAK;AACvB,GAAA;EACA;;AAED,CAAA,KAAK,EAAE;;EAEN,IAAI,EAAE;AACL,GAAA,OAAO,EAAE,SAAS;GAClB,IAAI,EAAE,KAAK;GACX;;;;;;AAMD;;;;AAIA;;;;EAIA,aAAa,EAAE,SAAS;EACxB;;AAED,CAAA,OAAO,EAAE;KACRC,SAAC;AACD;;;AAGC;;;AAGD,EAAA,OA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AACX,IAAA,MAAM,IAAI,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,EAAA;IACtC,IAAI,CAAE,KAAI,CAAC,CAAC,EAAE;KACb,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAA;AAC5B,KAAA;IACC,MAAK;IACN,MAAM,CAAA,GAAI,IAAI,CAAC,IAAI,CAAC,OAAO,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":"CnPageTreeNode.vue2.js","sources":["../../../../src/components/CnPageTreeNode/CnPageTreeNode.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`, NOT a `v-for` in the default slot. vuedraggable@4\n\t is the Vue 3 build and it renders rows ITSELF from this slot: the\n\t Vue 2 form throws \"draggable element must have an item slot\" outright\n\t (`computeNodes` in its source) and warns that the required `itemKey`\n\t is missing. `item-key` takes the same function the `:key` used to. -->\n\t<Draggable v-model=\"tree\"\n\t\ttag=\"ul\"\n\t\tclass=\"cn-page-tree\"\n\t\t:itemKey=\"(node) => nodeKey(node.ref)\"\n\t\t:group=\"group\"\n\t\thandle=\".cn-page-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-page-tree__node\">\n\t\t\t\t<CnPageTreeRow :page=\"node.ref\"\n\t\t\t\t\t:canAddChild=\"maxDepth > 0\"\n\t\t\t\t\t@addChild=\"addChild(node)\"\n\t\t\t\t\t@rename=\"(id) => renamePage(node.ref, id)\"\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 page so a\n\t\t\t\t row can be dragged IN (to nest) or OUT (to top level). -->\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-page-tree__children\"\n\t\t\t\t\t:class=\"{ 'cn-page-tree__children--empty': !node.children.length }\"\n\t\t\t\t\t:itemKey=\"(child) => nodeKey(child.ref)\"\n\t\t\t\t\t:group=\"group\"\n\t\t\t\t\thandle=\".cn-page-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-page-tree__node\">\n\t\t\t\t\t\t\t<CnPageTreeRow :page=\"child.ref\"\n\t\t\t\t\t\t\t\t:canAddChild=\"false\"\n\t\t\t\t\t\t\t\t@rename=\"(id) => renamePage(child.ref, id)\"\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 CnPageTreeRow from './CnPageTreeRow.vue'\nimport { stripTrailingSlashes } from '../../utils/trailingSlashes.js'\n\n// Stable per-page-object render keys, independent of the mutable `id`. Keyed by\n// the page ref itself (a WeakMap, so removed pages are GC'd) so a slug rename —\n// which changes `id` in place — does NOT change the `<li>` key and therefore\n// does NOT tear down the row (which would close its inline settings panel).\nlet pageKeySeq = 0\nconst pageKeys = new WeakMap()\n\n/**\n * CnPageTreeNode — the pages editor's drag-and-drop tree (ADR-041).\n *\n * Renders the working manifest's FLAT `pages[]` (each page carrying an optional\n * `parent` id) as a two-level draggable tree: drag a row to reorder, or drag it\n * into / out of a page to nest (an index and its detail, one level deep). Each\n * row (CnPageTreeRow) edits its own fields inline + via a cog popover. Drag\n * operates on a local nested mirror (`tree`) of real page refs; after every drop\n * the mirror is FLATTENED back onto the flat `pages[]` in place — top nodes lose\n * `parent`, nested nodes get `parent = <top id>` — so `diffManifest` sees the\n * change and the manifest keeps its flat shape. Field edits mutate the real page\n * refs directly, independent of the mirror.\n */\nexport default {\n\tname: 'CnPageTreeNode',\n\n\tcomponents: { Draggable: draggable, CnPageTreeRow },\n\n\tprops: {\n\t\t/**\n\t\t * The full, flat `pages[]` array (the working manifest's). Edited in\n\t\t * place; the tree is derived from each page's `parent`.\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 (one level: index → detail). */\n\t\tmaxDepth: {\n\t\t\ttype: Number,\n\t\t\tdefault: 1,\n\t\t},\n\n\t\t/**\n\t\t * The working manifest's `menu[]`, used to re-point menu links (whose\n\t\t * `route` is a page id) when a page's slug is renamed. Optional — when\n\t\t * absent, only child `parent` references are cascaded.\n\t\t *\n\t\t * @type {Array}\n\t\t */\n\t\tmenu: {\n\t\t\ttype: Array,\n\t\t\tdefault: null,\n\t\t},\n\t},\n\n\tdata() {\n\t\treturn {\n\t\t\t// Local nested mirror of `list` (real page refs) that vuedraggable\n\t\t\t// reorders; flattened back to `list` after each drop.\n\t\t\ttree: this.buildTree(),\n\t\t\t// Shared drag group so rows move between the top list and child lists.\n\t\t\tgroup: 'cn-pages',\n\t\t\t// Guard against the `list` watcher rebuilding the tree during our own\n\t\t\t// flatten (which would discard the just-dropped arrangement).\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 page\" does exactly that — `list` IS the working\n\t\t// manifest's `pages[]`, so its reference never changes and the watcher\n\t\t// above never fired: the page was appended to the manifest and simply\n\t\t// 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 Title/Route field and rebuild the tree under the user,\n\t\t// tearing down the row whose settings panel is open.\n\t\t//\n\t\t// This component's OWN mutations all land in `flatten()`, which holds\n\t\t// `suppressRebuild` across the splice, so they do not round-trip.\n\t\t'list.length': 'rebuild',\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 render key for a page's `<li>`, tied to the page object rather\n\t\t * than its `id`. Renaming a slug mutates `id` in place; keying by `id`\n\t\t * would change the key and tear the row down, closing its open settings\n\t\t * panel. Keyed by the ref (via WeakMap) so it survives renames and tree\n\t\t * rebuilds (which reuse the same page objects).\n\t\t *\n\t\t * @param {object} ref The page object.\n\t\t * @return {string} A stable key for this page.\n\t\t */\n\t\tnodeKey(ref) {\n\t\t\tlet key = pageKeys.get(ref)\n\t\t\tif (!key) {\n\t\t\t\tkey = `cn-page-${++pageKeySeq}`\n\t\t\t\tpageKeys.set(ref, key)\n\t\t\t}\n\t\t\treturn key\n\t\t},\n\n\t\t/**\n\t\t * Build the nested mirror from the flat `list`: top-level pages (no\n\t\t * `parent`) each carry their children (`parent === id`). Pages whose\n\t\t * `parent` doesn't resolve to a top page are surfaced as top (no orphans).\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 topIds = new Set(list.filter((p) => p && !p.parent).map((p) => p.id))\n\t\t\tconst childrenByParent = {}\n\t\t\tconst top = []\n\t\t\tfor (const p of list) {\n\t\t\t\tif (!p) {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tif (p.parent && topIds.has(p.parent)) {\n\t\t\t\t\t(childrenByParent[p.parent] || (childrenByParent[p.parent] = [])).push(p)\n\t\t\t\t} else {\n\t\t\t\t\ttop.push(p)\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn top.map((ref) => ({\n\t\t\t\tref,\n\t\t\t\tchildren: (childrenByParent[ref.id] || []).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: top nodes drop `parent`,\n\t\t * nested nodes get `parent = <top id>`, preserving array order.\n\t\t *\n\t\t * @return {void}\n\t\t */\n\t\tflatten() {\n\t\t\tconst flat = []\n\t\t\tfor (const node of this.tree) {\n\t\t\t\tif (node.ref.parent) {\n\t\t\t\t\tdelete node.ref.parent\n\t\t\t\t}\n\t\t\t\tflat.push(node.ref)\n\t\t\t\tfor (const child of node.children) {\n\t\t\t\t\tchild.ref.parent = node.ref.id\n\t\t\t\t\tflat.push(child.ref)\n\t\t\t\t}\n\t\t\t}\n\t\t\tthis.suppressRebuild = true\n\t\t\t// In-place edit by design — `list` is the working manifest's pages[],\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, ...flat)\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 (that would nest two levels deep). `relatedContext.list` is\n\t\t * the destination array — anything other than the top `tree` is a child\n\t\t * list.\n\t\t *\n\t\t * @param {object} evt The vuedraggable move event.\n\t\t * @return {boolean} False to veto the move.\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 `page-N` id not already used in `list`.\n\t\t *\n\t\t * @return {string}\n\t\t */\n\t\tnextId() {\n\t\t\tconst ids = new Set(this.list.map((p) => p && p.id))\n\t\t\tlet n = this.list.length + 1\n\t\t\twhile (ids.has(`page-${n}`)) {\n\t\t\t\tn++\n\t\t\t}\n\t\t\treturn `page-${n}`\n\t\t},\n\n\t\t/**\n\t\t * Rename a page's slug (its id). Cascades the new id to child pages'\n\t\t * `parent` and to any `menu[]` links whose `route` targets the old id, so\n\t\t * nesting and navigation keep working. No-op when the new id collides with\n\t\t * another page. The page id is the vue-router route name.\n\t\t *\n\t\t * @param {object} ref The page being renamed (mutated in place).\n\t\t * @param {string} newId The sanitised new id.\n\t\t * @return {void}\n\t\t */\n\t\trenamePage(ref, newId) {\n\t\t\tconst oldId = ref.id\n\t\t\tif (!newId || newId === oldId) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif (this.list.some((p) => p && p.id === newId)) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tfor (const p of this.list) {\n\t\t\t\tif (p && p.parent === oldId) {\n\t\t\t\t\tp.parent = newId\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (Array.isArray(this.menu)) {\n\t\t\t\tconst walk = (items) => (items || []).forEach((it) => {\n\t\t\t\t\tif (!it) {\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\t\tif (it.route === oldId) {\n\t\t\t\t\t\tit.route = newId\n\t\t\t\t\t}\n\t\t\t\t\twalk(it.children)\n\t\t\t\t})\n\t\t\t\twalk(this.menu)\n\t\t\t}\n\t\t\tref.id = newId\n\t\t\tthis.flatten()\n\t\t\tthis.tree = this.buildTree()\n\t\t},\n\n\t\t/**\n\t\t * Append a detail sub-page under a top node (route built from the parent).\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 base = stripTrailingSlashes(String(node.ref.route || ''))\n\t\t\tconst ref = { id: this.nextId(), parent: node.ref.id, type: 'detail', route: `${base}/:id`, title: '', config: {} }\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 so\n\t\t * none orphan.\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-page-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-page-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/* Keep an empty child list as a visible drop target for nesting. */\n.cn-page-tree__children--empty {\n\tmin-height: 10px;\n\tmargin-top: 0;\n\tborder-left-color: transparent;\n}\n\n.cn-page-tree__node {\n\tlist-style: none;\n}\n</style>\n"],"names":["draggable","CnPageTreeRow","t"],"mappings":";;;;;AA2DA;AACA;AACA;AACA;AACA,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b,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;;;;"}
@@ -0,0 +1,9 @@
1
+ import script from './CnQrCode.vue2.js';
2
+ import { render } from './CnQrCode.vue3.js';
3
+
4
+ script.render = render;
5
+ script.__scopeId = "data-v-0ddf7072";
6
+ const __sfc_main = script;
7
+
8
+ export { __sfc_main as default };
9
+ //# sourceMappingURL=CnQrCode.vue.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CnQrCode.vue.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;"}
@@ -0,0 +1,241 @@
1
+ import axios__default from '@nextcloud/axios';
2
+ import { translate } from '@nextcloud/l10n';
3
+ import { prefixUrl } from '../../utils/headers.js';
4
+ import { encodeQr } from '../../utils/qr.js';
5
+
6
+ const TICK_MS = 1000;
7
+
8
+ /**
9
+ * CnQrCode: a QR code drawn in the browser, with an optional typed code and a
10
+ * code that changes on a timer (boards LqLes "Zelf inchecken, op het bord",
11
+ * LqLlCertificaat "In je wallet", PtZaaktypeWeergave).
12
+ *
13
+ * The encoder needs no library and sends nothing to a QR service, so a one-time
14
+ * claim stays on the page. Time is counted from a deadline, not from ticks, so a
15
+ * throttled tab stays right.
16
+ *
17
+ * With `refreshUrl` the component reads `{ value, code, secondsLeft }` every
18
+ * `refreshSeconds`, sooner when `secondsLeft` runs out first. `mapResponse` turns
19
+ * another response into that shape. Without `refreshUrl` the host sets `value`
20
+ * and `code`, and hears `expired` when `refreshSeconds` has passed.
21
+ *
22
+ * ```vue
23
+ * <CnQrCode :value="checkInUrl" :code="code" label="Check in" />
24
+ * ```
25
+ *
26
+ * @event refreshed A refresh arrived, with the whole response.
27
+ * @event refresh-error A refresh failed, with the error. The last code stays and the component tries again.
28
+ * @event expired `refreshSeconds` passed without a new value, when there is no `refreshUrl`.
29
+ * @spec openspec/changes/qr-code/specs/qr-code/spec.md
30
+ */
31
+ var script = {
32
+ name: 'CnQrCode',
33
+
34
+ props: {
35
+ /** The text the code says, such as an address. Empty draws no code. */
36
+ value: { type: String, default: '' },
37
+ /** A code to type in, shown large under the image. */
38
+ code: { type: String, default: '' },
39
+ /** What the code does, for the image's accessible name, already translated. */
40
+ label: { type: String, default: '' },
41
+ /** Width and height in CSS pixels. */
42
+ size: { type: Number, default: 160 },
43
+ /** Where to read the current code. */
44
+ refreshUrl: { type: String, default: '' },
45
+ /** Seconds between reads, or until `expired` without `refreshUrl`. 0 is no timer. */
46
+ refreshSeconds: { type: Number, default: 0 },
47
+ /** Turns a response into `{ value, code, secondsLeft }`. */
48
+ mapResponse: { type: Function, default: (data) => data },
49
+ /** The countdown, already translated, with `{seconds}`. */
50
+ countdownTemplate: { type: String, default: '' },
51
+ /** Says a refresh failed, already translated. */
52
+ refreshFailedText: { type: String, default: '' },
53
+ },
54
+
55
+ emits: ['refreshed', 'refresh-error', 'expired'],
56
+
57
+ data() {
58
+ return {
59
+ currentValue: this.value,
60
+ currentCode: this.code,
61
+ secondsLeft: 0,
62
+ deadline: 0,
63
+ nextReadAt: 0,
64
+ failed: false,
65
+ reading: false,
66
+ expiredSaid: false,
67
+ timer: null,
68
+ readNumber: 0,
69
+ }
70
+ },
71
+
72
+ computed: {
73
+ /** @return {{size: number, modules: boolean[][]}|null} The symbol, or null when the value does not encode. */
74
+ symbol() {
75
+ return encodeQr(this.currentValue)
76
+ },
77
+
78
+ /** @return {string} One path for all dark modules, one segment per run. */
79
+ path() {
80
+ const parts = [];
81
+ this.symbol.modules.forEach((row, r) => {
82
+ let c = 0;
83
+ while (c < row.length) {
84
+ if (!row[c]) {
85
+ c++;
86
+ continue
87
+ }
88
+ const from = c;
89
+ while (c < row.length && row[c]) {
90
+ c++;
91
+ }
92
+ parts.push(`M${from + 4} ${r + 4}h${c - from}v1h-${c - from}z`);
93
+ }
94
+ });
95
+ return parts.join('')
96
+ },
97
+
98
+ /** @return {string} The accessible name of the image. */
99
+ imageName() {
100
+ return this.label
101
+ ? translate('nextcloud-vue', 'QR code for: {label}', { label: this.label })
102
+ : translate('nextcloud-vue', 'QR code')
103
+ },
104
+
105
+ /** @return {boolean} Whether a countdown applies. */
106
+ counting() {
107
+ return this.refreshSeconds > 0 && this.deadline > 0
108
+ },
109
+
110
+ /** @return {string} The countdown in words. */
111
+ countdownText() {
112
+ if (this.countdownTemplate) {
113
+ return this.countdownTemplate.replace('{seconds}', String(this.secondsLeft))
114
+ }
115
+ return translate('nextcloud-vue', 'Changes in {seconds} s', { seconds: String(this.secondsLeft) })
116
+ },
117
+ },
118
+
119
+ watch: {
120
+ value(next) {
121
+ this.currentValue = next;
122
+ this.restartCountdown();
123
+ },
124
+
125
+ code(next) {
126
+ this.currentCode = next;
127
+ },
128
+
129
+ refreshUrl() {
130
+ this.start();
131
+ },
132
+
133
+ refreshSeconds() {
134
+ this.start();
135
+ },
136
+ },
137
+
138
+ mounted() {
139
+ this.start();
140
+ },
141
+
142
+ beforeUnmount() {
143
+ this.stop();
144
+ this.readNumber += 1;
145
+ },
146
+
147
+ methods: {
148
+ t: translate,
149
+
150
+ /** Start the timer and, with a URL, the first read. */
151
+ start() {
152
+ this.stop();
153
+ this.readNumber += 1;
154
+ this.reading = false;
155
+ this.failed = false;
156
+ if (!(this.refreshSeconds > 0)) {
157
+ this.deadline = 0;
158
+ return
159
+ }
160
+ this.timer = setInterval(this.tick, TICK_MS);
161
+ if (this.refreshUrl) {
162
+ this.read();
163
+ } else {
164
+ this.restartCountdown();
165
+ }
166
+ },
167
+
168
+ /** Stop the timer. */
169
+ stop() {
170
+ clearInterval(this.timer);
171
+ this.timer = null;
172
+ },
173
+
174
+ /**
175
+ * Start the countdown over.
176
+ *
177
+ * @param {number} [seconds] How long it runs; `refreshSeconds` by default.
178
+ */
179
+ restartCountdown(seconds = this.refreshSeconds) {
180
+ this.deadline = Date.now() + seconds * 1000;
181
+ this.secondsLeft = seconds;
182
+ this.expiredSaid = false;
183
+ },
184
+
185
+ /** Bring the countdown up to date, and read or expire when it is time. */
186
+ tick() {
187
+ const now = Date.now();
188
+ this.secondsLeft = Math.max(0, Math.ceil((this.deadline - now) / 1000));
189
+ if (this.refreshUrl) {
190
+ if (now >= this.nextReadAt) {
191
+ this.read();
192
+ }
193
+ } else if (this.secondsLeft === 0 && !this.expiredSaid) {
194
+ this.expiredSaid = true;
195
+ this.$emit('expired');
196
+ }
197
+ },
198
+
199
+ /**
200
+ * Read the current code. On a failure the last code stays, and the next read
201
+ * comes after `refreshSeconds`. A read that a newer start overtook is dropped.
202
+ *
203
+ * @return {Promise<void>}
204
+ */
205
+ async read() {
206
+ if (this.reading) {
207
+ return
208
+ }
209
+ this.reading = true;
210
+ const number = this.readNumber;
211
+ try {
212
+ const { data } = await axios__default.get(prefixUrl(this.refreshUrl));
213
+ if (number !== this.readNumber) {
214
+ return
215
+ }
216
+ const mapped = this.mapResponse(data) ?? {};
217
+ this.currentValue = mapped.value ?? this.currentValue;
218
+ this.currentCode = mapped.code ?? this.currentCode;
219
+ this.failed = false;
220
+ const left = Number(mapped.secondsLeft ?? this.refreshSeconds);
221
+ this.restartCountdown(left);
222
+ this.nextReadAt = Date.now() + Math.min(Math.max(left, 1), this.refreshSeconds) * 1000;
223
+ this.$emit('refreshed', data);
224
+ } catch (error) {
225
+ if (number !== this.readNumber) {
226
+ return
227
+ }
228
+ this.failed = true;
229
+ this.nextReadAt = Date.now() + this.refreshSeconds * 1000;
230
+ this.$emit('refresh-error', error);
231
+ } finally {
232
+ if (number === this.readNumber) {
233
+ this.reading = false;
234
+ }
235
+ }
236
+ },
237
+ },
238
+ };
239
+
240
+ export { script as default };
241
+ //# sourceMappingURL=CnQrCode.vue2.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CnQrCode.vue2.js","sources":["../../../../src/components/CnQrCode/CnQrCode.vue"],"sourcesContent":["<!--\n - SPDX-FileCopyrightText: 2026 Conduction B.V.\n - SPDX-License-Identifier: EUPL-1.2\n-->\n<template>\n\t<div class=\"cn-qr-code\" data-testid=\"cn-qr-code\">\n\t\t<!-- A scanner needs dark on light, so the modules stay black on white in every theme. -->\n\t\t<svg v-if=\"symbol\"\n\t\t\tclass=\"cn-qr-code__image\"\n\t\t\trole=\"img\"\n\t\t\t:aria-label=\"imageName\"\n\t\t\t:viewBox=\"`0 0 ${symbol.size + 8} ${symbol.size + 8}`\"\n\t\t\t:width=\"size\"\n\t\t\t:height=\"size\"\n\t\t\tshape-rendering=\"crispEdges\"\n\t\t\tdata-testid=\"cn-qr-image\">\n\t\t\t<rect :width=\"symbol.size + 8\" :height=\"symbol.size + 8\" fill=\"#fff\" />\n\t\t\t<path :d=\"path\" fill=\"#000\" />\n\t\t</svg>\n\t\t<p v-else-if=\"currentValue\"\n\t\t\tclass=\"cn-qr-code__problem\"\n\t\t\trole=\"alert\"\n\t\t\tdata-testid=\"cn-qr-too-long\">\n\t\t\t{{ t('nextcloud-vue', 'This text is too long for a QR code.') }}\n\t\t</p>\n\n\t\t<p v-if=\"currentCode\"\n\t\t\tclass=\"cn-qr-code__code\"\n\t\t\trole=\"status\"\n\t\t\taria-live=\"polite\"\n\t\t\tdata-testid=\"cn-qr-code-text\">\n\t\t\t{{ currentCode }}\n\t\t</p>\n\n\t\t<p v-if=\"failed\"\n\t\t\tclass=\"cn-qr-code__problem\"\n\t\t\trole=\"alert\"\n\t\t\tdata-testid=\"cn-qr-failed\">\n\t\t\t{{ refreshFailedText || t('nextcloud-vue', 'This code could not be refreshed and may no longer work.') }}\n\t\t</p>\n\t\t<p v-else-if=\"counting\" class=\"cn-qr-code__countdown\" data-testid=\"cn-qr-countdown\">\n\t\t\t{{ countdownText }}\n\t\t</p>\n\n\t\t<!-- @slot default Further lines under the code. -->\n\t\t<slot />\n\t</div>\n</template>\n\n<script>\nimport axios from '@nextcloud/axios'\nimport { translate as t } from '@nextcloud/l10n'\nimport { prefixUrl } from '../../utils/headers.js'\nimport { encodeQr } from '../../utils/qr.js'\n\nconst TICK_MS = 1000\n\n/**\n * CnQrCode: a QR code drawn in the browser, with an optional typed code and a\n * code that changes on a timer (boards LqLes \"Zelf inchecken, op het bord\",\n * LqLlCertificaat \"In je wallet\", PtZaaktypeWeergave).\n *\n * The encoder needs no library and sends nothing to a QR service, so a one-time\n * claim stays on the page. Time is counted from a deadline, not from ticks, so a\n * throttled tab stays right.\n *\n * With `refreshUrl` the component reads `{ value, code, secondsLeft }` every\n * `refreshSeconds`, sooner when `secondsLeft` runs out first. `mapResponse` turns\n * another response into that shape. Without `refreshUrl` the host sets `value`\n * and `code`, and hears `expired` when `refreshSeconds` has passed.\n *\n * ```vue\n * <CnQrCode :value=\"checkInUrl\" :code=\"code\" label=\"Check in\" />\n * ```\n *\n * @event refreshed A refresh arrived, with the whole response.\n * @event refresh-error A refresh failed, with the error. The last code stays and the component tries again.\n * @event expired `refreshSeconds` passed without a new value, when there is no `refreshUrl`.\n * @spec openspec/changes/qr-code/specs/qr-code/spec.md\n */\nexport default {\n\tname: 'CnQrCode',\n\n\tprops: {\n\t\t/** The text the code says, such as an address. Empty draws no code. */\n\t\tvalue: { type: String, default: '' },\n\t\t/** A code to type in, shown large under the image. */\n\t\tcode: { type: String, default: '' },\n\t\t/** What the code does, for the image's accessible name, already translated. */\n\t\tlabel: { type: String, default: '' },\n\t\t/** Width and height in CSS pixels. */\n\t\tsize: { type: Number, default: 160 },\n\t\t/** Where to read the current code. */\n\t\trefreshUrl: { type: String, default: '' },\n\t\t/** Seconds between reads, or until `expired` without `refreshUrl`. 0 is no timer. */\n\t\trefreshSeconds: { type: Number, default: 0 },\n\t\t/** Turns a response into `{ value, code, secondsLeft }`. */\n\t\tmapResponse: { type: Function, default: (data) => data },\n\t\t/** The countdown, already translated, with `{seconds}`. */\n\t\tcountdownTemplate: { type: String, default: '' },\n\t\t/** Says a refresh failed, already translated. */\n\t\trefreshFailedText: { type: String, default: '' },\n\t},\n\n\temits: ['refreshed', 'refresh-error', 'expired'],\n\n\tdata() {\n\t\treturn {\n\t\t\tcurrentValue: this.value,\n\t\t\tcurrentCode: this.code,\n\t\t\tsecondsLeft: 0,\n\t\t\tdeadline: 0,\n\t\t\tnextReadAt: 0,\n\t\t\tfailed: false,\n\t\t\treading: false,\n\t\t\texpiredSaid: false,\n\t\t\ttimer: null,\n\t\t\treadNumber: 0,\n\t\t}\n\t},\n\n\tcomputed: {\n\t\t/** @return {{size: number, modules: boolean[][]}|null} The symbol, or null when the value does not encode. */\n\t\tsymbol() {\n\t\t\treturn encodeQr(this.currentValue)\n\t\t},\n\n\t\t/** @return {string} One path for all dark modules, one segment per run. */\n\t\tpath() {\n\t\t\tconst parts = []\n\t\t\tthis.symbol.modules.forEach((row, r) => {\n\t\t\t\tlet c = 0\n\t\t\t\twhile (c < row.length) {\n\t\t\t\t\tif (!row[c]) {\n\t\t\t\t\t\tc++\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t\tconst from = c\n\t\t\t\t\twhile (c < row.length && row[c]) {\n\t\t\t\t\t\tc++\n\t\t\t\t\t}\n\t\t\t\t\tparts.push(`M${from + 4} ${r + 4}h${c - from}v1h-${c - from}z`)\n\t\t\t\t}\n\t\t\t})\n\t\t\treturn parts.join('')\n\t\t},\n\n\t\t/** @return {string} The accessible name of the image. */\n\t\timageName() {\n\t\t\treturn this.label\n\t\t\t\t? t('nextcloud-vue', 'QR code for: {label}', { label: this.label })\n\t\t\t\t: t('nextcloud-vue', 'QR code')\n\t\t},\n\n\t\t/** @return {boolean} Whether a countdown applies. */\n\t\tcounting() {\n\t\t\treturn this.refreshSeconds > 0 && this.deadline > 0\n\t\t},\n\n\t\t/** @return {string} The countdown in words. */\n\t\tcountdownText() {\n\t\t\tif (this.countdownTemplate) {\n\t\t\t\treturn this.countdownTemplate.replace('{seconds}', String(this.secondsLeft))\n\t\t\t}\n\t\t\treturn t('nextcloud-vue', 'Changes in {seconds} s', { seconds: String(this.secondsLeft) })\n\t\t},\n\t},\n\n\twatch: {\n\t\tvalue(next) {\n\t\t\tthis.currentValue = next\n\t\t\tthis.restartCountdown()\n\t\t},\n\n\t\tcode(next) {\n\t\t\tthis.currentCode = next\n\t\t},\n\n\t\trefreshUrl() {\n\t\t\tthis.start()\n\t\t},\n\n\t\trefreshSeconds() {\n\t\t\tthis.start()\n\t\t},\n\t},\n\n\tmounted() {\n\t\tthis.start()\n\t},\n\n\tbeforeUnmount() {\n\t\tthis.stop()\n\t\tthis.readNumber += 1\n\t},\n\n\tmethods: {\n\t\tt,\n\n\t\t/** Start the timer and, with a URL, the first read. */\n\t\tstart() {\n\t\t\tthis.stop()\n\t\t\tthis.readNumber += 1\n\t\t\tthis.reading = false\n\t\t\tthis.failed = false\n\t\t\tif (!(this.refreshSeconds > 0)) {\n\t\t\t\tthis.deadline = 0\n\t\t\t\treturn\n\t\t\t}\n\t\t\tthis.timer = setInterval(this.tick, TICK_MS)\n\t\t\tif (this.refreshUrl) {\n\t\t\t\tthis.read()\n\t\t\t} else {\n\t\t\t\tthis.restartCountdown()\n\t\t\t}\n\t\t},\n\n\t\t/** Stop the timer. */\n\t\tstop() {\n\t\t\tclearInterval(this.timer)\n\t\t\tthis.timer = null\n\t\t},\n\n\t\t/**\n\t\t * Start the countdown over.\n\t\t *\n\t\t * @param {number} [seconds] How long it runs; `refreshSeconds` by default.\n\t\t */\n\t\trestartCountdown(seconds = this.refreshSeconds) {\n\t\t\tthis.deadline = Date.now() + seconds * 1000\n\t\t\tthis.secondsLeft = seconds\n\t\t\tthis.expiredSaid = false\n\t\t},\n\n\t\t/** Bring the countdown up to date, and read or expire when it is time. */\n\t\ttick() {\n\t\t\tconst now = Date.now()\n\t\t\tthis.secondsLeft = Math.max(0, Math.ceil((this.deadline - now) / 1000))\n\t\t\tif (this.refreshUrl) {\n\t\t\t\tif (now >= this.nextReadAt) {\n\t\t\t\t\tthis.read()\n\t\t\t\t}\n\t\t\t} else if (this.secondsLeft === 0 && !this.expiredSaid) {\n\t\t\t\tthis.expiredSaid = true\n\t\t\t\tthis.$emit('expired')\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Read the current code. On a failure the last code stays, and the next read\n\t\t * comes after `refreshSeconds`. A read that a newer start overtook is dropped.\n\t\t *\n\t\t * @return {Promise<void>}\n\t\t */\n\t\tasync read() {\n\t\t\tif (this.reading) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tthis.reading = true\n\t\t\tconst number = this.readNumber\n\t\t\ttry {\n\t\t\t\tconst { data } = await axios.get(prefixUrl(this.refreshUrl))\n\t\t\t\tif (number !== this.readNumber) {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tconst mapped = this.mapResponse(data) ?? {}\n\t\t\t\tthis.currentValue = mapped.value ?? this.currentValue\n\t\t\t\tthis.currentCode = mapped.code ?? this.currentCode\n\t\t\t\tthis.failed = false\n\t\t\t\tconst left = Number(mapped.secondsLeft ?? this.refreshSeconds)\n\t\t\t\tthis.restartCountdown(left)\n\t\t\t\tthis.nextReadAt = Date.now() + Math.min(Math.max(left, 1), this.refreshSeconds) * 1000\n\t\t\t\tthis.$emit('refreshed', data)\n\t\t\t} catch (error) {\n\t\t\t\tif (number !== this.readNumber) {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tthis.failed = true\n\t\t\t\tthis.nextReadAt = Date.now() + this.refreshSeconds * 1000\n\t\t\t\tthis.$emit('refresh-error', error)\n\t\t\t} finally {\n\t\t\t\tif (number === this.readNumber) {\n\t\t\t\t\tthis.reading = false\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t},\n}\n</script>\n\n<style scoped>\n.cn-qr-code {\n\talign-items: center;\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 8px;\n}\n\n.cn-qr-code__image {\n\tdisplay: block;\n\tmax-width: 100%;\n}\n\n.cn-qr-code__code {\n\tfont-family: var(--font-face-monospace, monospace);\n\tfont-size: 2em;\n\tfont-weight: bold;\n\tletter-spacing: 0.1em;\n\tmargin: 0;\n}\n\n.cn-qr-code__countdown {\n\tcolor: var(--color-text-maxcontrast);\n\tmargin: 0;\n}\n\n.cn-qr-code__problem {\n\tcolor: var(--color-error-text);\n\tmargin: 0;\n}\n</style>\n"],"names":["t","axios"],"mappings":";;;;;AAuDA,MAAM,OAAM,GAAI,KAAG;;AAEnB;;;;AAIC;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;;AAGD,aAAe;AACd,CAAA,IAAI,EAAE,UAAU;;AAEhB,CAAA,KAAK,EAAE;;AAEN,EAAA,KAAK,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,EAAC,EAAG;AACpC;EACA,IAAI,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,EAAC,EAAG;AACnC;AACA,EAAA,KAAK,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,EAAC,EAAG;AACpC;AACA,EAAA,IAAI,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,GAAE,EAAG;AACpC;AACA,EAAA,UAAU,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI;AACzC;AACA,EAAA,cAAc,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG;;EAE5C,WAAW,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,IAAI,KAAK,IAAG,EAAG;;AAExD,EAAA,iBAAiB,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI;AAChD;AACA,EAAA,iBAAiB,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI;EAChD;;AAED,CAAA,KAAK,EAAE,CAAC,WAAW,EAAE,eAAe,EAAE,SAAS,CAAC;;AAEhD,CAAA,IAAI,GAAG;AACN,EAAA,OAAO;GACN,YAAY,EAAE,IAAI,CAAC,KAA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KAAK,CAAC,eAAe,EAAE,KAAK,EAAA;AAClC,IAAA,SAAU;IACT,IAAI,MAAO,KAAI,IAAI,CAAC,UAAU,EAAE;AAC/B,KAAA,IAAI,CAAC,OAAQ,GAAE,MAAI;AACpB,KAAA;AACD,IAAA;GACA;EACD;AACF;;;;"}
@@ -0,0 +1,75 @@
1
+ import { openBlock, createElementBlock, createElementVNode, toDisplayString, createCommentVNode, renderSlot } from 'vue';
2
+
3
+ const _hoisted_1 = {
4
+ class: "cn-qr-code",
5
+ "data-testid": "cn-qr-code"
6
+ };
7
+ const _hoisted_2 = ["aria-label", "viewBox", "width", "height"];
8
+ const _hoisted_3 = ["width", "height"];
9
+ const _hoisted_4 = ["d"];
10
+ const _hoisted_5 = {
11
+ key: 1,
12
+ class: "cn-qr-code__problem",
13
+ role: "alert",
14
+ "data-testid": "cn-qr-too-long"
15
+ };
16
+ const _hoisted_6 = {
17
+ key: 2,
18
+ class: "cn-qr-code__code",
19
+ role: "status",
20
+ "aria-live": "polite",
21
+ "data-testid": "cn-qr-code-text"
22
+ };
23
+ const _hoisted_7 = {
24
+ key: 3,
25
+ class: "cn-qr-code__problem",
26
+ role: "alert",
27
+ "data-testid": "cn-qr-failed"
28
+ };
29
+ const _hoisted_8 = {
30
+ key: 4,
31
+ class: "cn-qr-code__countdown",
32
+ "data-testid": "cn-qr-countdown"
33
+ };
34
+
35
+ function render(_ctx, _cache, $props, $setup, $data, $options) {
36
+ return (openBlock(), createElementBlock("div", _hoisted_1, [
37
+ ($options.symbol)
38
+ ? (openBlock(), createElementBlock("svg", {
39
+ key: 0,
40
+ class: "cn-qr-code__image",
41
+ role: "img",
42
+ "aria-label": $options.imageName,
43
+ viewBox: `0 0 ${$options.symbol.size + 8} ${$options.symbol.size + 8}`,
44
+ width: $props.size,
45
+ height: $props.size,
46
+ "shape-rendering": "crispEdges",
47
+ "data-testid": "cn-qr-image"
48
+ }, [
49
+ createElementVNode("rect", {
50
+ width: $options.symbol.size + 8,
51
+ height: $options.symbol.size + 8,
52
+ fill: "#fff"
53
+ }, null, 8 /* PROPS */, _hoisted_3),
54
+ createElementVNode("path", {
55
+ d: $options.path,
56
+ fill: "#000"
57
+ }, null, 8 /* PROPS */, _hoisted_4)
58
+ ], 8 /* PROPS */, _hoisted_2))
59
+ : ($data.currentValue)
60
+ ? (openBlock(), createElementBlock("p", _hoisted_5, toDisplayString($options.t('nextcloud-vue', 'This text is too long for a QR code.')), 1 /* TEXT */))
61
+ : createCommentVNode("v-if", true),
62
+ ($data.currentCode)
63
+ ? (openBlock(), createElementBlock("p", _hoisted_6, toDisplayString($data.currentCode), 1 /* TEXT */))
64
+ : createCommentVNode("v-if", true),
65
+ ($data.failed)
66
+ ? (openBlock(), createElementBlock("p", _hoisted_7, toDisplayString($props.refreshFailedText || $options.t('nextcloud-vue', 'This code could not be refreshed and may no longer work.')), 1 /* TEXT */))
67
+ : ($options.counting)
68
+ ? (openBlock(), createElementBlock("p", _hoisted_8, toDisplayString($options.countdownText), 1 /* TEXT */))
69
+ : createCommentVNode("v-if", true),
70
+ renderSlot(_ctx.$slots, "default")
71
+ ]))
72
+ }
73
+
74
+ export { render };
75
+ //# sourceMappingURL=CnQrCode.vue3.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CnQrCode.vue3.js","sources":["../../../../src/components/CnQrCode/CnQrCode.vue?vue&type=template&id=0ddf7072&lang.js"],"sourcesContent":["<!--\n - SPDX-FileCopyrightText: 2026 Conduction B.V.\n - SPDX-License-Identifier: EUPL-1.2\n-->\n<template>\n\t<div class=\"cn-qr-code\" data-testid=\"cn-qr-code\">\n\t\t<!-- A scanner needs dark on light, so the modules stay black on white in every theme. -->\n\t\t<svg v-if=\"symbol\"\n\t\t\tclass=\"cn-qr-code__image\"\n\t\t\trole=\"img\"\n\t\t\t:aria-label=\"imageName\"\n\t\t\t:viewBox=\"`0 0 ${symbol.size + 8} ${symbol.size + 8}`\"\n\t\t\t:width=\"size\"\n\t\t\t:height=\"size\"\n\t\t\tshape-rendering=\"crispEdges\"\n\t\t\tdata-testid=\"cn-qr-image\">\n\t\t\t<rect :width=\"symbol.size + 8\" :height=\"symbol.size + 8\" fill=\"#fff\" />\n\t\t\t<path :d=\"path\" fill=\"#000\" />\n\t\t</svg>\n\t\t<p v-else-if=\"currentValue\"\n\t\t\tclass=\"cn-qr-code__problem\"\n\t\t\trole=\"alert\"\n\t\t\tdata-testid=\"cn-qr-too-long\">\n\t\t\t{{ t('nextcloud-vue', 'This text is too long for a QR code.') }}\n\t\t</p>\n\n\t\t<p v-if=\"currentCode\"\n\t\t\tclass=\"cn-qr-code__code\"\n\t\t\trole=\"status\"\n\t\t\taria-live=\"polite\"\n\t\t\tdata-testid=\"cn-qr-code-text\">\n\t\t\t{{ currentCode }}\n\t\t</p>\n\n\t\t<p v-if=\"failed\"\n\t\t\tclass=\"cn-qr-code__problem\"\n\t\t\trole=\"alert\"\n\t\t\tdata-testid=\"cn-qr-failed\">\n\t\t\t{{ refreshFailedText || t('nextcloud-vue', 'This code could not be refreshed and may no longer work.') }}\n\t\t</p>\n\t\t<p v-else-if=\"counting\" class=\"cn-qr-code__countdown\" data-testid=\"cn-qr-countdown\">\n\t\t\t{{ countdownText }}\n\t\t</p>\n\n\t\t<!-- @slot default Further lines under the code. -->\n\t\t<slot />\n\t</div>\n</template>\n\n<script>\nimport axios from '@nextcloud/axios'\nimport { translate as t } from '@nextcloud/l10n'\nimport { prefixUrl } from '../../utils/headers.js'\nimport { encodeQr } from '../../utils/qr.js'\n\nconst TICK_MS = 1000\n\n/**\n * CnQrCode: a QR code drawn in the browser, with an optional typed code and a\n * code that changes on a timer (boards LqLes \"Zelf inchecken, op het bord\",\n * LqLlCertificaat \"In je wallet\", PtZaaktypeWeergave).\n *\n * The encoder needs no library and sends nothing to a QR service, so a one-time\n * claim stays on the page. Time is counted from a deadline, not from ticks, so a\n * throttled tab stays right.\n *\n * With `refreshUrl` the component reads `{ value, code, secondsLeft }` every\n * `refreshSeconds`, sooner when `secondsLeft` runs out first. `mapResponse` turns\n * another response into that shape. Without `refreshUrl` the host sets `value`\n * and `code`, and hears `expired` when `refreshSeconds` has passed.\n *\n * ```vue\n * <CnQrCode :value=\"checkInUrl\" :code=\"code\" label=\"Check in\" />\n * ```\n *\n * @event refreshed A refresh arrived, with the whole response.\n * @event refresh-error A refresh failed, with the error. The last code stays and the component tries again.\n * @event expired `refreshSeconds` passed without a new value, when there is no `refreshUrl`.\n * @spec openspec/changes/qr-code/specs/qr-code/spec.md\n */\nexport default {\n\tname: 'CnQrCode',\n\n\tprops: {\n\t\t/** The text the code says, such as an address. Empty draws no code. */\n\t\tvalue: { type: String, default: '' },\n\t\t/** A code to type in, shown large under the image. */\n\t\tcode: { type: String, default: '' },\n\t\t/** What the code does, for the image's accessible name, already translated. */\n\t\tlabel: { type: String, default: '' },\n\t\t/** Width and height in CSS pixels. */\n\t\tsize: { type: Number, default: 160 },\n\t\t/** Where to read the current code. */\n\t\trefreshUrl: { type: String, default: '' },\n\t\t/** Seconds between reads, or until `expired` without `refreshUrl`. 0 is no timer. */\n\t\trefreshSeconds: { type: Number, default: 0 },\n\t\t/** Turns a response into `{ value, code, secondsLeft }`. */\n\t\tmapResponse: { type: Function, default: (data) => data },\n\t\t/** The countdown, already translated, with `{seconds}`. */\n\t\tcountdownTemplate: { type: String, default: '' },\n\t\t/** Says a refresh failed, already translated. */\n\t\trefreshFailedText: { type: String, default: '' },\n\t},\n\n\temits: ['refreshed', 'refresh-error', 'expired'],\n\n\tdata() {\n\t\treturn {\n\t\t\tcurrentValue: this.value,\n\t\t\tcurrentCode: this.code,\n\t\t\tsecondsLeft: 0,\n\t\t\tdeadline: 0,\n\t\t\tnextReadAt: 0,\n\t\t\tfailed: false,\n\t\t\treading: false,\n\t\t\texpiredSaid: false,\n\t\t\ttimer: null,\n\t\t\treadNumber: 0,\n\t\t}\n\t},\n\n\tcomputed: {\n\t\t/** @return {{size: number, modules: boolean[][]}|null} The symbol, or null when the value does not encode. */\n\t\tsymbol() {\n\t\t\treturn encodeQr(this.currentValue)\n\t\t},\n\n\t\t/** @return {string} One path for all dark modules, one segment per run. */\n\t\tpath() {\n\t\t\tconst parts = []\n\t\t\tthis.symbol.modules.forEach((row, r) => {\n\t\t\t\tlet c = 0\n\t\t\t\twhile (c < row.length) {\n\t\t\t\t\tif (!row[c]) {\n\t\t\t\t\t\tc++\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t\tconst from = c\n\t\t\t\t\twhile (c < row.length && row[c]) {\n\t\t\t\t\t\tc++\n\t\t\t\t\t}\n\t\t\t\t\tparts.push(`M${from + 4} ${r + 4}h${c - from}v1h-${c - from}z`)\n\t\t\t\t}\n\t\t\t})\n\t\t\treturn parts.join('')\n\t\t},\n\n\t\t/** @return {string} The accessible name of the image. */\n\t\timageName() {\n\t\t\treturn this.label\n\t\t\t\t? t('nextcloud-vue', 'QR code for: {label}', { label: this.label })\n\t\t\t\t: t('nextcloud-vue', 'QR code')\n\t\t},\n\n\t\t/** @return {boolean} Whether a countdown applies. */\n\t\tcounting() {\n\t\t\treturn this.refreshSeconds > 0 && this.deadline > 0\n\t\t},\n\n\t\t/** @return {string} The countdown in words. */\n\t\tcountdownText() {\n\t\t\tif (this.countdownTemplate) {\n\t\t\t\treturn this.countdownTemplate.replace('{seconds}', String(this.secondsLeft))\n\t\t\t}\n\t\t\treturn t('nextcloud-vue', 'Changes in {seconds} s', { seconds: String(this.secondsLeft) })\n\t\t},\n\t},\n\n\twatch: {\n\t\tvalue(next) {\n\t\t\tthis.currentValue = next\n\t\t\tthis.restartCountdown()\n\t\t},\n\n\t\tcode(next) {\n\t\t\tthis.currentCode = next\n\t\t},\n\n\t\trefreshUrl() {\n\t\t\tthis.start()\n\t\t},\n\n\t\trefreshSeconds() {\n\t\t\tthis.start()\n\t\t},\n\t},\n\n\tmounted() {\n\t\tthis.start()\n\t},\n\n\tbeforeUnmount() {\n\t\tthis.stop()\n\t\tthis.readNumber += 1\n\t},\n\n\tmethods: {\n\t\tt,\n\n\t\t/** Start the timer and, with a URL, the first read. */\n\t\tstart() {\n\t\t\tthis.stop()\n\t\t\tthis.readNumber += 1\n\t\t\tthis.reading = false\n\t\t\tthis.failed = false\n\t\t\tif (!(this.refreshSeconds > 0)) {\n\t\t\t\tthis.deadline = 0\n\t\t\t\treturn\n\t\t\t}\n\t\t\tthis.timer = setInterval(this.tick, TICK_MS)\n\t\t\tif (this.refreshUrl) {\n\t\t\t\tthis.read()\n\t\t\t} else {\n\t\t\t\tthis.restartCountdown()\n\t\t\t}\n\t\t},\n\n\t\t/** Stop the timer. */\n\t\tstop() {\n\t\t\tclearInterval(this.timer)\n\t\t\tthis.timer = null\n\t\t},\n\n\t\t/**\n\t\t * Start the countdown over.\n\t\t *\n\t\t * @param {number} [seconds] How long it runs; `refreshSeconds` by default.\n\t\t */\n\t\trestartCountdown(seconds = this.refreshSeconds) {\n\t\t\tthis.deadline = Date.now() + seconds * 1000\n\t\t\tthis.secondsLeft = seconds\n\t\t\tthis.expiredSaid = false\n\t\t},\n\n\t\t/** Bring the countdown up to date, and read or expire when it is time. */\n\t\ttick() {\n\t\t\tconst now = Date.now()\n\t\t\tthis.secondsLeft = Math.max(0, Math.ceil((this.deadline - now) / 1000))\n\t\t\tif (this.refreshUrl) {\n\t\t\t\tif (now >= this.nextReadAt) {\n\t\t\t\t\tthis.read()\n\t\t\t\t}\n\t\t\t} else if (this.secondsLeft === 0 && !this.expiredSaid) {\n\t\t\t\tthis.expiredSaid = true\n\t\t\t\tthis.$emit('expired')\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Read the current code. On a failure the last code stays, and the next read\n\t\t * comes after `refreshSeconds`. A read that a newer start overtook is dropped.\n\t\t *\n\t\t * @return {Promise<void>}\n\t\t */\n\t\tasync read() {\n\t\t\tif (this.reading) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tthis.reading = true\n\t\t\tconst number = this.readNumber\n\t\t\ttry {\n\t\t\t\tconst { data } = await axios.get(prefixUrl(this.refreshUrl))\n\t\t\t\tif (number !== this.readNumber) {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tconst mapped = this.mapResponse(data) ?? {}\n\t\t\t\tthis.currentValue = mapped.value ?? this.currentValue\n\t\t\t\tthis.currentCode = mapped.code ?? this.currentCode\n\t\t\t\tthis.failed = false\n\t\t\t\tconst left = Number(mapped.secondsLeft ?? this.refreshSeconds)\n\t\t\t\tthis.restartCountdown(left)\n\t\t\t\tthis.nextReadAt = Date.now() + Math.min(Math.max(left, 1), this.refreshSeconds) * 1000\n\t\t\t\tthis.$emit('refreshed', data)\n\t\t\t} catch (error) {\n\t\t\t\tif (number !== this.readNumber) {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tthis.failed = true\n\t\t\t\tthis.nextReadAt = Date.now() + this.refreshSeconds * 1000\n\t\t\t\tthis.$emit('refresh-error', error)\n\t\t\t} finally {\n\t\t\t\tif (number === this.readNumber) {\n\t\t\t\t\tthis.reading = false\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t},\n}\n</script>\n\n<style scoped>\n.cn-qr-code {\n\talign-items: center;\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 8px;\n}\n\n.cn-qr-code__image {\n\tdisplay: block;\n\tmax-width: 100%;\n}\n\n.cn-qr-code__code {\n\tfont-family: var(--font-face-monospace, monospace);\n\tfont-size: 2em;\n\tfont-weight: bold;\n\tletter-spacing: 0.1em;\n\tmargin: 0;\n}\n\n.cn-qr-code__countdown {\n\tcolor: var(--color-text-maxcontrast);\n\tmargin: 0;\n}\n\n.cn-qr-code__problem {\n\tcolor: var(--color-error-text);\n\tmargin: 0;\n}\n</style>\n"],"names":["_openBlock","_createElementBlock","_createElementVNode","_toDisplayString"],"mappings":";;;AASM,EAAA,KAAK,EAAC,YAAA;AAAA,EAAA,aAAA,EAAA,YAAA;;;;;;;AAeT,EAAA,KAAE,EAAA,qBAAA;;AAEF,EAAA,aAAW,EAAC,gBAAO;;;;AAK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A,EAAAA,eAAA,CADA,KAAW,CAAA,WAAA,CAAA,EAAA,CAAA,YAAA;;KAGN,KAAM,CAAA,MAAA;AAAd,SAAAH,SAAA,EAAA,EAAAC,kBAAA,IAAA,EAAA,YAIEE,eAAA,CAAA,MAAA,CAAA,iBAAA,IAAA,QAAA,CAAA,CAAA,CAAA,eAAA,EAAA,0DAAA,CAAA,CAAA,EAAA,CAAA,YAAA;SAEW,QAAQ,CAAA,QAAA;wBAAtBF,kBAEI,CAAA,GAAA,EAFJ,UAEI,EAAAE,eAAA,CADA,QAAG,CAAA,aAAA,CAAA,EAAA,CAAA,YAAA;;;;;;;;"}
@@ -2,7 +2,7 @@ import script from './CnReadinessChecklist.vue2.js';
2
2
  import { render } from './CnReadinessChecklist.vue3.js';
3
3
 
4
4
  script.render = render;
5
- script.__scopeId = "data-v-4b98b96e";
5
+ script.__scopeId = "data-v-658954c7";
6
6
  const __sfc_main = script;
7
7
 
8
8
  export { __sfc_main as default };
@@ -1,9 +1,10 @@
1
1
  import axios__default from '@nextcloud/axios';
2
2
  import { translate } from '@nextcloud/l10n';
3
3
  import { generateUrl } from '@nextcloud/router';
4
- import { NcLoadingIcon, NcNoteCard } from '@nextcloud/vue';
4
+ import { NcButton, NcLoadingIcon, NcNoteCard } from '@nextcloud/vue';
5
5
  import innerHeading from '../../mixins/innerHeading.js';
6
6
  import { readPath } from '../../utils/readPath.js';
7
+ import __sfc_main from '../CnStatusBadge/CnStatusBadge.vue.js';
7
8
 
8
9
  /**
9
10
  * The fields an item is read from by default.
@@ -25,6 +26,10 @@ const DEFAULT_FIELDS = Object.freeze({
25
26
  * CnReadinessChecklist: a list of things an instance needs, each with its
26
27
  * state in words (met, open, unknown), an explanation and a link to the
27
28
  * screen that fixes it. Reported, never gated: nothing here blocks the app.
29
+ * A host that does gate a step on the list adds `summary`, `verdict` and
30
+ * `confirmLabel`: the count, the verdict in words, and a button that stays off
31
+ * until every item is met (board DqZaakDocumenten "Volledigheid van de
32
+ * aanvraag").
28
33
  *
29
34
  * Items come from `items`, or are read from an app endpoint (`source`, an app
30
35
  * path resolved with `generateUrl`, the list at `itemsPath`) and re-read when
@@ -37,7 +42,7 @@ const DEFAULT_FIELDS = Object.freeze({
37
42
  var script = {
38
43
  name: 'CnReadinessChecklist',
39
44
 
40
- components: { NcLoadingIcon, NcNoteCard },
45
+ components: { CnStatusBadge: __sfc_main, NcButton, NcLoadingIcon, NcNoteCard },
41
46
 
42
47
  mixins: [innerHeading],
43
48
 
@@ -67,9 +72,17 @@ var script = {
67
72
  errorText: { type: String, default: '' },
68
73
  /** Said before the unmet items marked `blocking` ("Cannot run until this is installed:"). */
69
74
  blockingText: { type: String, default: '' },
75
+ /** The count above the list, a template with `{met}`, `{open}` and `{total}`. */
76
+ summary: { type: String, default: '' },
77
+ /** The verdict beside the count: `{ met, unmet }`. */
78
+ verdict: { type: Object, default: null },
79
+ /** A line under the list. */
80
+ note: { type: String, default: '' },
81
+ /** Label of a button under the list that stays off until every item is met; emits `confirm`. */
82
+ confirmLabel: { type: String, default: '' },
70
83
  },
71
84
 
72
- emits: ['loaded'],
85
+ emits: ['loaded', 'confirm'],
73
86
 
74
87
  data() {
75
88
  return {
@@ -100,6 +113,24 @@ var script = {
100
113
  })
101
114
  },
102
115
 
116
+ /** @return {boolean} Whether there are items and each is met. */
117
+ allMet() {
118
+ return this.shownItems.length > 0 && this.shownItems.every((item) => item.met === true)
119
+ },
120
+
121
+ /** @return {string} The `summary` with its counts filled in. */
122
+ summaryText() {
123
+ const total = this.shownItems.length;
124
+ const met = this.shownItems.filter((item) => item.met === true).length;
125
+ const counts = { met, open: total - met, total };
126
+ return this.text(this.summary).replace(/\{(met|open|total)\}/g, (match, key) => String(counts[key]))
127
+ },
128
+
129
+ /** @return {string} The verdict in words, '' when none is declared for this state. */
130
+ verdictText() {
131
+ return this.text(this.verdict?.[this.allMet ? 'met' : 'unmet'] ?? '')
132
+ },
133
+
103
134
  /** @return {Array<object>} The unmet blocking items. */
104
135
  blockingItems() {
105
136
  return this.shownItems.filter((item) => item.blocking && item.met !== true)