@conduction/nextcloud-vue 2.185.1 → 2.186.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/dist/esm/components/CnCalendarWidget/CnCalendarWidget.vue.js +1 -1
  2. package/dist/esm/components/CnCalendarWidget/CnCalendarWidget2.vue.js +83 -2
  3. package/dist/esm/components/CnCalendarWidget/CnCalendarWidget2.vue.js.map +1 -1
  4. package/dist/esm/components/CnCalendarWidget/CnCalendarWidget3.vue.js +147 -104
  5. package/dist/esm/components/CnCalendarWidget/CnCalendarWidget3.vue.js.map +1 -1
  6. package/dist/esm/components/CnDashboardGrid/CnDashboardGrid.vue.js +1 -1
  7. package/dist/esm/components/CnDashboardGrid/CnDashboardGrid2.vue.js +41 -16
  8. package/dist/esm/components/CnDashboardGrid/CnDashboardGrid2.vue.js.map +1 -1
  9. package/dist/esm/components/CnDashboardGrid/CnDashboardGrid3.vue.js.map +1 -1
  10. package/dist/esm/components/CnDividerWidget/index.js +1 -0
  11. package/dist/esm/components/CnDividerWidget/index.js.map +1 -1
  12. package/dist/esm/components/CnFilesWidget/CnFilesWidget.vue.js +1 -1
  13. package/dist/esm/components/CnFilesWidget/CnFilesWidget2.vue.js +158 -5
  14. package/dist/esm/components/CnFilesWidget/CnFilesWidget2.vue.js.map +1 -1
  15. package/dist/esm/components/CnFilesWidget/CnFilesWidget3.vue.js +109 -45
  16. package/dist/esm/components/CnFilesWidget/CnFilesWidget3.vue.js.map +1 -1
  17. package/dist/esm/components/CnHeaderWidget/index.js +0 -1
  18. package/dist/esm/components/CnHeaderWidget/index.js.map +1 -1
  19. package/dist/esm/components/CnHeaderWidgetForm/CnHeaderWidgetForm.vue.js +1 -1
  20. package/dist/esm/components/CnHeaderWidgetForm/CnHeaderWidgetForm2.vue.js +17 -3
  21. package/dist/esm/components/CnHeaderWidgetForm/CnHeaderWidgetForm2.vue.js.map +1 -1
  22. package/dist/esm/components/CnHeaderWidgetForm/CnHeaderWidgetForm3.vue.js +3 -3
  23. package/dist/esm/components/CnHeaderWidgetForm/CnHeaderWidgetForm3.vue.js.map +1 -1
  24. package/dist/esm/components/CnVideoWidget/CnVideoWidget.vue.js +1 -1
  25. package/dist/esm/components/CnVideoWidget/CnVideoWidget2.vue.js +63 -1
  26. package/dist/esm/components/CnVideoWidget/CnVideoWidget2.vue.js.map +1 -1
  27. package/dist/esm/components/CnVideoWidget/CnVideoWidget3.vue.js +20 -10
  28. package/dist/esm/components/CnVideoWidget/CnVideoWidget3.vue.js.map +1 -1
  29. package/dist/esm/components/CnVideoWidgetForm/CnVideoWidgetForm.vue.js +1 -1
  30. package/dist/esm/components/CnVideoWidgetForm/CnVideoWidgetForm2.vue.js +15 -0
  31. package/dist/esm/components/CnVideoWidgetForm/CnVideoWidgetForm2.vue.js.map +1 -1
  32. package/dist/esm/components/CnVideoWidgetForm/CnVideoWidgetForm3.vue.js +17 -10
  33. package/dist/esm/components/CnVideoWidgetForm/CnVideoWidgetForm3.vue.js.map +1 -1
  34. package/dist/esm/components/CnWidgetGrid/dashboardWidgetRegistry.js +1 -0
  35. package/dist/esm/components/CnWidgetGrid/dashboardWidgetRegistry.js.map +1 -1
  36. package/dist/esm/dialogs/CnAddWidgetModal.vue.js +1 -1
  37. package/dist/esm/dialogs/CnAddWidgetModal2.vue.js +18 -4
  38. package/dist/esm/dialogs/CnAddWidgetModal2.vue.js.map +1 -1
  39. package/dist/esm/dialogs/CnAddWidgetModal3.vue.js +57 -39
  40. package/dist/esm/dialogs/CnAddWidgetModal3.vue.js.map +1 -1
  41. package/dist/esm/l10n/en.json.js +96 -1
  42. package/dist/esm/l10n/en.json.js.map +1 -1
  43. package/dist/esm/l10n/nl.json.js +96 -1
  44. package/dist/esm/l10n/nl.json.js.map +1 -1
  45. package/dist/esm/library-style.js +1 -1
  46. package/dist/esm/nextcloud-vue.css +231 -114
  47. package/dist/nextcloud-vue.cjs.js +2298 -1602
  48. package/dist/nextcloud-vue.cjs.js.map +2 -2
  49. package/dist/nextcloud-vue.css +231 -114
  50. package/l10n/en.json +96 -1
  51. package/l10n/nl.json +96 -1
  52. package/package.json +1 -1
  53. package/src/components/CnCalendarWidget/CnCalendarWidget.vue +217 -75
  54. package/src/components/CnDashboardGrid/CnDashboardGrid.md +1 -1
  55. package/src/components/CnDashboardGrid/CnDashboardGrid.vue +41 -16
  56. package/src/components/CnDividerWidget/index.js +1 -0
  57. package/src/components/CnFilesWidget/CnFilesWidget.vue +278 -5
  58. package/src/components/CnHeaderWidget/index.js +0 -1
  59. package/src/components/CnHeaderWidgetForm/CnHeaderWidgetForm.vue +20 -6
  60. package/src/components/CnVideoWidget/CnVideoWidget.vue +84 -1
  61. package/src/components/CnVideoWidgetForm/CnVideoWidgetForm.vue +19 -1
  62. package/src/components/CnWidgetGrid/dashboardWidgetRegistry.js +1 -0
  63. package/src/dialogs/CnAddWidgetModal.vue +53 -14
@@ -1 +1 @@
1
- {"version":3,"file":"CnFilesWidget3.vue.js","sources":["../../../../src/components/CnFilesWidget/CnFilesWidget.vue?vue&type=template&id=1626aa43&lang.js"],"sourcesContent":["<!--\n - SPDX-FileCopyrightText: 2026 Conduction B.V.\n - SPDX-License-Identifier: EUPL-1.2\n-->\n\n<template>\n\t<div\n\t\tclass=\"cn-files-widget\"\n\t\t:class=\"{ 'cn-files-widget--dragging': isDragging }\"\n\t\t@dragenter=\"onDragEnter\"\n\t\t@dragover=\"onDragOver\"\n\t\t@dragleave=\"onDragLeave\"\n\t\t@drop=\"onDrop\">\n\t\t<div class=\"cn-files-widget__toolbar\">\n\t\t\t<nav\n\t\t\t\tv-if=\"!objectBound\"\n\t\t\t\tclass=\"cn-files-widget__breadcrumb\"\n\t\t\t\t:aria-label=\"t('nextcloud-vue', 'Folder breadcrumb')\">\n\t\t\t\t<button\n\t\t\t\t\ttype=\"button\"\n\t\t\t\t\tclass=\"cn-files-widget__crumb cn-files-widget__crumb--root\"\n\t\t\t\t\t:aria-current=\"currentSubPath === '/' ? 'page' : null\"\n\t\t\t\t\t@click=\"navigateTo('/')\">\n\t\t\t\t\t{{ t('nextcloud-vue', 'Root') }}\n\t\t\t\t</button>\n\t\t\t\t<template v-for=\"(segment, index) in pathSegments\" :key=\"index\">\n\t\t\t\t\t<span\n\t\t\t\t\t\taria-hidden=\"true\"\n\t\t\t\t\t\tclass=\"cn-files-widget__separator\">/</span>\n\t\t\t\t\t<button\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\tclass=\"cn-files-widget__crumb\"\n\t\t\t\t\t\t:aria-current=\"index === pathSegments.length - 1 ? 'page' : null\"\n\t\t\t\t\t\t@click=\"navigateTo(segmentPathTo(index))\">\n\t\t\t\t\t\t{{ segment }}\n\t\t\t\t\t</button>\n\t\t\t\t</template>\n\t\t\t</nav>\n\n\t\t\t<input\n\t\t\t\tv-model=\"searchQuery\"\n\t\t\t\ttype=\"search\"\n\t\t\t\tclass=\"cn-files-widget__search\"\n\t\t\t\t:aria-label=\"t('nextcloud-vue', 'Search this folder')\"\n\t\t\t\t:placeholder=\"t('nextcloud-vue', 'Search this folder…')\">\n\n\t\t\t<button\n\t\t\t\tv-if=\"canShowUpload\"\n\t\t\t\ttype=\"button\"\n\t\t\t\tclass=\"cn-files-widget__upload\"\n\t\t\t\t@click=\"triggerUpload\">\n\t\t\t\t{{ t('nextcloud-vue', 'Upload File') }}\n\t\t\t</button>\n\t\t\t<!--\n\t\t\t\t`:ref`, not `ref`. Note `:aria-hidden=\"true\"` does NOT save this:\n\t\t\t\ta binding to a LITERAL CONSTANT is constant-folded, so the vnode\n\t\t\t\tstays fully static and the compiler hoists it to module scope.\n\t\t\t\tA hoisted vnode's ref has no owner instance, and `setRef()`'s\n\t\t\t\tnull-owner guard — along with its early `return` — is compiled\n\t\t\t\tout of production builds, so it dereferences null and throws\n\t\t\t\t`Cannot read properties of null (reading 'refs')`, aborting the\n\t\t\t\trender of the page that mounted this widget.\n\n\t\t\t\tConfirmed by instrumenting Vue's own warning to print the ref\n\t\t\t\tname: `[DEBUG ref=\"fileInput\" vnodeType=input]`. This widget is\n\t\t\t\tthe `files` integration leaf, which is how it reaches a detail\n\t\t\t\tpage. See CnFilesTab for the full account of the mechanism.\n\t\t\t-->\n\t\t\t<input\n\t\t\t\t:ref=\"fileInputRef\"\n\t\t\t\ttype=\"file\"\n\t\t\t\tmultiple\n\t\t\t\tclass=\"cn-files-widget__file-input\"\n\t\t\t\t:aria-hidden=\"true\"\n\t\t\t\ttabindex=\"-1\"\n\t\t\t\t@change=\"onFileInputChange\">\n\t\t</div>\n\n\t\t<div\n\t\t\tv-if=\"isDragging && canShowUpload\"\n\t\t\tclass=\"cn-files-widget__dropzone\"\n\t\t\taria-hidden=\"true\">\n\t\t\t{{ t('nextcloud-vue', 'Drop files to upload') }}\n\t\t</div>\n\n\t\t<div v-if=\"loading\" class=\"cn-files-widget__state\">\n\t\t\t{{ t('nextcloud-vue', 'Loading folder…') }}\n\t\t</div>\n\n\t\t<div\n\t\t\tv-else-if=\"unavailable\"\n\t\t\tclass=\"cn-files-widget__state cn-files-widget__state--unavailable\">\n\t\t\t{{ t('nextcloud-vue', 'Files is not available') }}\n\t\t</div>\n\n\t\t<div\n\t\t\tv-else-if=\"errorCode === 'no_access'\"\n\t\t\tclass=\"cn-files-widget__state cn-files-widget__state--no-access\">\n\t\t\t{{ t('nextcloud-vue', 'You don\\'t have access to this folder.') }}\n\t\t</div>\n\n\t\t<div\n\t\t\tv-else-if=\"errorCode === 'folder_not_found'\"\n\t\t\tclass=\"cn-files-widget__state cn-files-widget__state--not-found\">\n\t\t\t{{ t('nextcloud-vue', 'Folder no longer exists.') }}\n\t\t</div>\n\n\t\t<div\n\t\t\tv-else-if=\"errorCode\"\n\t\t\tclass=\"cn-files-widget__state cn-files-widget__state--error\">\n\t\t\t{{ t('nextcloud-vue', 'Failed to load folder contents.') }}\n\t\t\t<button\n\t\t\t\ttype=\"button\"\n\t\t\t\tclass=\"cn-files-widget__retry\"\n\t\t\t\t@click=\"fetchContents\">\n\t\t\t\t{{ t('nextcloud-vue', 'Retry') }}\n\t\t\t</button>\n\t\t</div>\n\n\t\t<div\n\t\t\tv-else-if=\"filteredItems.length === 0 && !searchQuery\"\n\t\t\tclass=\"cn-files-widget__state cn-files-widget__state--empty\">\n\t\t\t{{ t('nextcloud-vue', 'This folder is empty.') }}\n\t\t</div>\n\n\t\t<div\n\t\t\tv-else-if=\"filteredItems.length === 0 && searchQuery\"\n\t\t\tclass=\"cn-files-widget__state cn-files-widget__state--empty\">\n\t\t\t{{ noSearchResultsLabel }}\n\t\t</div>\n\n\t\t<ul\n\t\t\tv-else\n\t\t\tclass=\"cn-files-widget__list\"\n\t\t\t:class=\"{ 'cn-files-widget__list--grid': viewMode === 'grid' }\">\n\t\t\t<li\n\t\t\t\tv-for=\"item in filteredItems\"\n\t\t\t\t:key=\"item.fileId\"\n\t\t\t\tclass=\"cn-files-widget__row\"\n\t\t\t\t:class=\"{ 'cn-files-widget__row--folder': item.isFolder }\">\n\t\t\t\t<!-- Files are real links (new tab, copyable); folders browse in-widget. -->\n\t\t\t\t<component\n\t\t\t\t\t:is=\"item.isFolder ? 'button' : 'a'\"\n\t\t\t\t\t:type=\"item.isFolder ? 'button' : undefined\"\n\t\t\t\t\t:href=\"item.isFolder ? undefined : (fileUrl(item.fileId) || undefined)\"\n\t\t\t\t\t:target=\"item.isFolder ? undefined : '_blank'\"\n\t\t\t\t\t:rel=\"item.isFolder ? undefined : 'noopener noreferrer'\"\n\t\t\t\t\tclass=\"cn-files-widget__row-name\"\n\t\t\t\t\t@click=\"onRowClick(item, $event)\">\n\t\t\t\t\t<span aria-hidden=\"true\" class=\"cn-files-widget__row-icon\">\n\t\t\t\t\t\t<img\n\t\t\t\t\t\t\tv-if=\"showThumbnails && !item.isFolder && item.thumbnailUrl && !failedThumbs[item.fileId]\"\n\t\t\t\t\t\t\t:src=\"item.thumbnailUrl\"\n\t\t\t\t\t\t\talt=\"\"\n\t\t\t\t\t\t\tclass=\"cn-files-widget__row-thumb\"\n\t\t\t\t\t\t\tloading=\"lazy\"\n\t\t\t\t\t\t\t@error=\"onThumbError(item)\">\n\t\t\t\t\t\t<template v-else>{{ item.isFolder ? '📁' : '📄' }}</template>\n\t\t\t\t\t</span>\n\t\t\t\t\t<span class=\"cn-files-widget__row-label\">{{ item.name }}</span>\n\t\t\t\t</component>\n\t\t\t\t<span class=\"cn-files-widget__row-modified\">{{ item.modifiedAt }}</span>\n\t\t\t\t<span class=\"cn-files-widget__row-size\">{{ formatSize(item.size, item.isFolder) }}</span>\n\t\t\t\t<button\n\t\t\t\t\tv-if=\"canDeleteItem(item)\"\n\t\t\t\t\ttype=\"button\"\n\t\t\t\t\tclass=\"cn-files-widget__row-delete\"\n\t\t\t\t\t:aria-label=\"t('nextcloud-vue', 'Delete {name}', { name: item.name })\"\n\t\t\t\t\t@click=\"confirmDelete(item)\">\n\t\t\t\t\t{{ t('nextcloud-vue', 'Delete') }}\n\t\t\t\t</button>\n\t\t\t</li>\n\t\t</ul>\n\n\t\t<div v-if=\"nextCursor\" class=\"cn-files-widget__pagination\">\n\t\t\t<button\n\t\t\t\ttype=\"button\"\n\t\t\t\tclass=\"cn-files-widget__more\"\n\t\t\t\t@click=\"loadMore\">\n\t\t\t\t{{ t('nextcloud-vue', 'Load more') }}\n\t\t\t</button>\n\t\t</div>\n\n\t\t<CnFilePreview v-if=\"previewFile\" :file=\"previewFile\" @close=\"previewFile = null\" />\n\n\t\t<CnFilesWidgetDeleteDialog\n\t\t\t:open=\"confirmTarget !== null\"\n\t\t\t:fileName=\"confirmTarget ? confirmTarget.name : ''\"\n\t\t\t@update:open=\"onDeleteDialogToggle\"\n\t\t\t@confirm=\"performDelete\" />\n\t</div>\n</template>\n\n<script>\nimport { translate as t } from '@nextcloud/l10n'\nimport { generateUrl } from '@nextcloud/router'\nimport CnFilesWidgetDeleteDialog from '../../dialogs/CnFilesWidgetDeleteDialog.vue'\nimport CnFilePreview from '../CnFilePreview/CnFilePreview.vue'\nimport { useFileOpener } from '../../composables/useFileOpener.js'\nimport { stripTrailingSlashes } from '../../utils/trailingSlashes.js'\n\n/**\n * CnFilesWidget — an inline Nextcloud Files browser rendered as a dashboard\n * widget (catalog type `files`, migrated from the launchpad `files` widget).\n *\n * NC-INTEGRATION DEPENDENCY: this widget reads folder contents from a host\n * application's `/api/widgets/files/{placementId}/...` endpoints (the same\n * contract the launchpad/mydash backend served) and deep-links file rows into\n * the Nextcloud **Files** app via the canonical `/f/{fileid}` permalink. The\n * `@nextcloud/axios` + `@nextcloud/router` helpers are imported LAZILY at call\n * time so the widget code never hard-couples to a network stack at module load\n * (keeps the no-op css transform path clean and lets a host without the backing\n * endpoint mount the component without side-effects). When the backing endpoint\n * is absent the widget degrades to a localised disabled / empty state rather\n * than throwing — see the `unavailable` data flag and the `folder_not_found` /\n * `no_access` error branches.\n *\n * Every placement instance owns its own navigation stack: the sub-path resets\n * to `/` whenever the `placement` prop changes, so re-configuring the widget\n * root never leaves the user on a stale path.\n *\n * @spec openspec/changes/cn-widget-library/specs/cn-widget-library/spec.md\n */\nexport default {\n\tname: 'CnFilesWidget',\n\n\tcomponents: {\n\t\tCnFilePreview,\n\t\tCnFilesWidgetDeleteDialog,\n\t},\n\n\tprops: {\n\t\t/**\n\t\t * Persisted content blob configuring the folder + toolbar — see\n\t\t * `CnFilesWidgetForm` for the full shape (`folderPath`, `fileId`,\n\t\t * `viewMode`, `allowUpload`, `allowDelete`, …).\n\t\t */\n\t\tcontent: {\n\t\t\ttype: Object,\n\t\t\tdefault: () => ({}),\n\t\t},\n\n\t\t/** Placement entity; its `id` scopes the host Files endpoint. */\n\t\tplacement: {\n\t\t\ttype: Object,\n\t\t\tdefault: () => ({}),\n\t\t},\n\n\t\t/** Whether the dashboard shell is in admin mode. */\n\t\tisAdmin: { // eslint-disable-line vue/no-unused-properties -- the dashboard shell passes this to every widget; declared so it does not fall through to $attrs.\n\t\t\ttype: Boolean,\n\t\t\tdefault: false,\n\t\t},\n\n\t\t/** Whether the dashboard shell is in edit mode. */\n\t\tcanEdit: { // eslint-disable-line vue/no-unused-properties -- the dashboard shell passes this to every widget; declared so it does not fall through to $attrs.\n\t\t\ttype: Boolean,\n\t\t\tdefault: false,\n\t\t},\n\n\t\t/**\n\t\t * App base for the host's files-widget endpoints\n\t\t * (`{apiBase}/api/widgets/files/{placementId}/...`). Lets a consuming\n\t\t * app point the widget at its own backend (e.g. `/apps/launchpad`).\n\t\t * Defaults to `/apps/files`.\n\t\t *\n\t\t * @type {string}\n\t\t */\n\t\tapiBase: {\n\t\t\ttype: String,\n\t\t\tdefault: '/apps/files',\n\t\t},\n\n\t\t/**\n\t\t * Object-bound mode: the OpenRegister object id this widget attaches\n\t\t * files to. When `objectId` + `register` + `schema` are all set (they\n\t\t * are auto-supplied by `CnWidgetGrid`'s detail-page context merge), the\n\t\t * widget lists/uploads/deletes against the object's Nextcloud folder via\n\t\t * the OpenRegister object endpoints instead of the dashboard\n\t\t * `/api/widgets/files/...` contract. Empty (default) keeps the dashboard\n\t\t * placement behaviour unchanged.\n\t\t *\n\t\t * @type {string}\n\t\t */\n\t\tobjectId: {\n\t\t\ttype: String,\n\t\t\tdefault: '',\n\t\t},\n\n\t\t/**\n\t\t * Object-bound mode: the OpenRegister register slug of the bound object.\n\t\t * See the `objectId` prop.\n\t\t *\n\t\t * @type {string}\n\t\t */\n\t\tregister: {\n\t\t\ttype: String,\n\t\t\tdefault: '',\n\t\t},\n\n\t\t/**\n\t\t * Object-bound mode: the OpenRegister schema of the bound object. Accepts\n\t\t * either a slug string or the resolved schema object (as merged by\n\t\t * `CnWidgetGrid`); the slug is derived by the `schemaSlug` computed. See\n\t\t * the `objectId` prop.\n\t\t *\n\t\t * @type {string|object}\n\t\t */\n\t\tschema: {\n\t\t\ttype: [String, Object],\n\t\t\tdefault: '',\n\t\t},\n\n\t\t/**\n\t\t * App base for the OpenRegister object-file endpoints used in\n\t\t * object-bound mode (`{objectApiBase}/objects/{register}/{schema}/{id}/...`).\n\t\t * Defaults to `/apps/openregister/api`.\n\t\t *\n\t\t * @type {string}\n\t\t */\n\t\tobjectApiBase: {\n\t\t\ttype: String,\n\t\t\tdefault: '/apps/openregister/api',\n\t\t},\n\t},\n\n\tdata() {\n\t\treturn {\n\t\t\t/** The file shown in the in-page preview, or null. */\n\t\t\tpreviewFile: null,\n\t\t\t/**\n\t\t\t * The hidden file input, set by the template's function ref (kept off `$refs` so the ref stays dynamic — see the template).\n\t\t\t *\n\t\t\t * @type {HTMLInputElement|null}\n\t\t\t */\n\t\t\tfileInputEl: null,\n\t\t\titems: [],\n\t\t\tcurrentSubPath: '/',\n\t\t\tloading: false,\n\t\t\terrorCode: null,\n\t\t\tunavailable: false,\n\t\t\tnextCursor: null,\n\t\t\tsearchQuery: '',\n\t\t\tconfirmTarget: null,\n\t\t\t// fileId → true for thumbnails whose <img> failed to load, so the\n\t\t\t// row falls back to the generic icon instead of a broken image.\n\t\t\tfailedThumbs: {},\n\t\t\t// Whether a file drag is currently hovering the widget (drop overlay).\n\t\t\tisDragging: false,\n\t\t\t// Depth counter so nested dragenter/dragleave don't flicker the overlay.\n\t\t\tdragDepth: 0,\n\t\t}\n\t},\n\n\tcomputed: {\n\t\t/**\n\t\t * Numeric placement id used to scope the host Files endpoint.\n\t\t *\n\t\t * @return {number} the placement id, or `0` when no placement is bound.\n\t\t */\n\t\tplacementId() {\n\t\t\treturn Number(this.placement?.id || 0)\n\t\t},\n\n\t\t/**\n\t\t * The schema slug in object-bound mode. Accepts either a slug string or\n\t\t * the resolved schema object merged by `CnWidgetGrid` (in which case the\n\t\t * slug is read from `slug`/`id`/`uuid`).\n\t\t *\n\t\t * @return {string} the schema slug, or `''` when unavailable.\n\t\t */\n\t\tschemaSlug() {\n\t\t\tconst s = this.schema\n\t\t\tif (typeof s === 'string') {\n\t\t\t\treturn s\n\t\t\t}\n\t\t\treturn (s && (s.slug || s.id || s.uuid)) || ''\n\t\t},\n\n\t\t/**\n\t\t * Whether the widget runs in object-bound mode — i.e. it attaches files\n\t\t * to a specific OpenRegister object rather than a dashboard placement.\n\t\t *\n\t\t * @return {boolean} `true` when `objectId`, `register` and `schemaSlug` are all set.\n\t\t */\n\t\tobjectBound() {\n\t\t\treturn !!(this.objectId && this.register && this.schemaSlug)\n\t\t},\n\n\t\t/**\n\t\t * Stable identity key for the bound object, or `''` in dashboard mode.\n\t\t * Watched to (re)fetch when the object context first resolves (the schema\n\t\t * object arrives after the ids) or when the widget rebinds to another\n\t\t * object.\n\t\t *\n\t\t * @return {string} `register/schema/objectId`, or `''` when not object-bound.\n\t\t */\n\t\tobjectKey() {\n\t\t\treturn this.objectBound\n\t\t\t\t? `${this.register}/${this.schemaSlug}/${this.objectId}`\n\t\t\t\t: ''\n\t\t},\n\n\t\t/**\n\t\t * Whether the upload affordance is enabled by configuration. Defaults to\n\t\t * enabled in BOTH modes — a Files widget is an add-files surface — and is\n\t\t * only suppressed when a placement explicitly sets `allowUpload: false`.\n\t\t * (Object-bound mode already defaulted on, matching the object sidebar's\n\t\t * Files tab; beta extended the same default to dashboard placements.)\n\t\t *\n\t\t * @return {boolean} `true` unless `content.allowUpload` is explicitly false.\n\t\t */\n\t\tallowUpload() {\n\t\t\treturn this.content?.allowUpload !== false\n\t\t},\n\n\t\t/**\n\t\t * Whether per-row delete affordances are enabled by configuration. On by\n\t\t * default in object-bound mode (unless `content.allowDelete` is explicitly\n\t\t * false); opt-in (`content.allowDelete === true`) in dashboard mode.\n\t\t *\n\t\t * @return {boolean} `true` when deletes are allowed.\n\t\t */\n\t\tallowDelete() {\n\t\t\tif (this.objectBound) {\n\t\t\t\treturn this.content?.allowDelete !== false\n\t\t\t}\n\t\t\treturn this.content?.allowDelete === true\n\t\t},\n\n\t\t/**\n\t\t * Layout for the file listing, from `content.viewMode`. `'grid'` renders\n\t\t * the items as a tile grid; any other value (`'list'`, `'tree'`, unset)\n\t\t * renders the default list. Tree navigation is not implemented, so\n\t\t * `'tree'` falls back to the list layout.\n\t\t *\n\t\t * @return {string} `'grid'` or `'list'`.\n\t\t */\n\t\tviewMode() {\n\t\t\treturn this.content?.viewMode === 'grid' ? 'grid' : 'list'\n\t\t},\n\n\t\t/**\n\t\t * Whether file rows show a preview thumbnail (from `content.showThumbnails`).\n\t\t * Defaults to on; only an explicit `false` disables it. Files without a\n\t\t * backend-provided `thumbnailUrl` still fall back to the generic icon.\n\t\t *\n\t\t * @return {boolean} `true` unless `content.showThumbnails` is explicitly false.\n\t\t */\n\t\tshowThumbnails() {\n\t\t\treturn this.content?.showThumbnails !== false\n\t\t},\n\n\t\t/**\n\t\t * Heuristic write-permission check: an empty folder optimistically\n\t\t * surfaces the upload button (the backend re-validates), otherwise at\n\t\t * least one editable child is required.\n\t\t *\n\t\t * @return {boolean} `true` when the viewer is treated as having write access.\n\t\t */\n\t\tviewerCanWrite() {\n\t\t\tif (this.items.length === 0) {\n\t\t\t\treturn true\n\t\t\t}\n\t\t\treturn this.items.some((item) => item.canEdit === true)\n\t\t},\n\n\t\t/**\n\t\t * Whether the upload button should render.\n\t\t *\n\t\t * @return {boolean} `true` when upload is allowed, writable, and not errored.\n\t\t */\n\t\tcanShowUpload() {\n\t\t\treturn this.allowUpload && this.viewerCanWrite && !this.errorCode && !this.unavailable\n\t\t},\n\n\t\t/**\n\t\t * The current sub-path split into breadcrumb segments.\n\t\t *\n\t\t * @return {string[]} the path segments (empty at root).\n\t\t */\n\t\tpathSegments() {\n\t\t\tif (!this.currentSubPath || this.currentSubPath === '/') {\n\t\t\t\treturn []\n\t\t\t}\n\t\t\treturn this.currentSubPath\n\t\t\t\t.split('/')\n\t\t\t\t.map((segment) => segment.trim())\n\t\t\t\t.filter((segment) => segment !== '')\n\t\t},\n\n\t\t/**\n\t\t * The items filtered by the in-widget search query.\n\t\t *\n\t\t * @return {Array<object>} the matching items (all items when the query is empty).\n\t\t */\n\t\tfilteredItems() {\n\t\t\tconst query = this.searchQuery.trim().toLowerCase()\n\t\t\tif (query === '') {\n\t\t\t\treturn this.items\n\t\t\t}\n\t\t\treturn this.items.filter((item) => {\n\t\t\t\tconst name = String(item.name || '').toLowerCase()\n\t\t\t\treturn name.includes(query)\n\t\t\t})\n\t\t},\n\n\t\t/**\n\t\t * The localised \"no results\" label for the active search query.\n\t\t *\n\t\t * @return {string} the no-results message.\n\t\t */\n\t\tnoSearchResultsLabel() {\n\t\t\treturn t(\n\t\t\t\t'nextcloud-vue',\n\t\t\t\t'No files matching \\'{query}\\'',\n\t\t\t\t{ query: this.searchQuery },\n\t\t\t)\n\t\t},\n\t},\n\n\twatch: {\n\t\tplacement: {\n\t\t\timmediate: true,\n\t\t\t/**\n\t\t\t * Reset navigation state and refetch whenever the placement changes.\n\t\t\t * Dashboard mode only — object-bound mode is driven by `objectKey`.\n\t\t\t *\n\t\t\t * @return {void}\n\t\t\t */\n\t\t\thandler() {\n\t\t\t\tif (this.objectBound) {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tthis.resetListing()\n\t\t\t\tthis.fetchContents()\n\t\t\t},\n\t\t},\n\n\t\tobjectKey: {\n\t\t\timmediate: true,\n\t\t\t/**\n\t\t\t * Reset and refetch when the bound object first resolves or changes.\n\t\t\t *\n\t\t\t * @param {string} key the new object key (`''` in dashboard mode).\n\t\t\t * @return {void}\n\t\t\t */\n\t\t\thandler(key) {\n\t\t\t\tif (!key) {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tthis.resetListing()\n\t\t\t\tthis.fetchContents()\n\t\t\t},\n\t\t},\n\t},\n\n\tmethods: {\n\t\tt,\n\n\t\t/**\n\t\t * Function ref for the hidden file input; a method so the binding is\n\t\t * stable across renders and the vnode stays dynamic.\n\t\t *\n\t\t * @param {HTMLInputElement|null} el The element, or null on unmount.\n\t\t * @return {void}\n\t\t */\n\t\tfileInputRef(el) {\n\t\t\tthis.fileInputEl = el || null\n\t\t},\n\n\t\t/**\n\t\t * Reset the listing/navigation state before a (re)fetch.\n\t\t *\n\t\t * @return {void}\n\t\t */\n\t\tresetListing() {\n\t\t\tthis.currentSubPath = '/'\n\t\t\tthis.items = []\n\t\t\tthis.nextCursor = null\n\t\t\tthis.errorCode = null\n\t\t\tthis.unavailable = false\n\t\t},\n\n\t\t/**\n\t\t * Fetch (or append) one page of folder contents from the host Files\n\t\t * endpoint. Degrades gracefully: a missing endpoint flips `unavailable`,\n\t\t * a 404/403 maps to a typed `errorCode`, and no exception escapes.\n\t\t *\n\t\t * @param {boolean} [append] whether to append to the existing list (pagination).\n\t\t * @return {Promise<void>} resolves when the fetch settles.\n\t\t */\n\t\tasync fetchContents(append = false) {\n\t\t\tif (this.objectBound) {\n\t\t\t\treturn this.fetchObjectFiles()\n\t\t\t}\n\t\t\tif (this.placementId === 0) {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tthis.loading = !append\n\t\t\tthis.errorCode = null\n\t\t\tthis.unavailable = false\n\n\t\t\ttry {\n\t\t\t\tconst { default: axios } = await import('@nextcloud/axios')\n\n\t\t\t\tconst url = generateUrl(\n\t\t\t\t\t`${this.apiBase}/api/widgets/files/{placementId}/contents`,\n\t\t\t\t\t{ placementId: this.placementId },\n\t\t\t\t)\n\t\t\t\tconst params = {\n\t\t\t\t\tcurrentPath: this.currentSubPath,\n\t\t\t\t\tlimit: 50,\n\t\t\t\t}\n\t\t\t\tif (append && this.nextCursor) {\n\t\t\t\t\tparams.cursor = this.nextCursor\n\t\t\t\t}\n\n\t\t\t\tconst response = await axios.get(url, { params })\n\t\t\t\tconst data = response?.data || {}\n\t\t\t\tconst nextItems = Array.isArray(data.items) ? data.items : []\n\t\t\t\tthis.items = append ? this.items.concat(nextItems) : nextItems\n\t\t\t\tthis.nextCursor = data.nextCursor || null\n\t\t\t} catch (err) {\n\t\t\t\tconst status = err?.response?.status\n\t\t\t\tconst code = err?.response?.data?.error\n\t\t\t\tif (status === 404 || code === 'folder_not_found') {\n\t\t\t\t\tthis.errorCode = 'folder_not_found'\n\t\t\t\t} else if (status === 403 || code === 'no_access') {\n\t\t\t\t\tthis.errorCode = 'no_access'\n\t\t\t\t} else if (status === undefined) {\n\t\t\t\t\t// No HTTP response at all — the backing Files endpoint is\n\t\t\t\t\t// not installed/reachable; degrade to the disabled state.\n\t\t\t\t\tthis.unavailable = true\n\t\t\t\t} else {\n\t\t\t\t\tthis.errorCode = 'unknown_error'\n\t\t\t\t}\n\t\t\t\tif (!append) {\n\t\t\t\t\tthis.items = []\n\t\t\t\t\tthis.nextCursor = null\n\t\t\t\t}\n\t\t\t} finally {\n\t\t\t\tthis.loading = false\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Object-bound listing: fetch the bound OpenRegister object's files from\n\t\t * `{objectApiBase}/objects/{register}/{schema}/{id}/files` and map them\n\t\t * onto the widget's flat item shape (no folder navigation). Degrades the\n\t\t * same way as the dashboard fetch: 404/403 → typed `errorCode`, no HTTP\n\t\t * response → `unavailable`.\n\t\t *\n\t\t * @return {Promise<void>} resolves when the fetch settles.\n\t\t */\n\t\tasync fetchObjectFiles() {\n\t\t\tthis.loading = true\n\t\t\tthis.errorCode = null\n\t\t\tthis.unavailable = false\n\n\t\t\ttry {\n\t\t\t\tconst { default: axios } = await import('@nextcloud/axios')\n\n\t\t\t\tconst url = generateUrl(\n\t\t\t\t\t`${this.objectApiBase}/objects/{register}/{schema}/{objectId}/files`,\n\t\t\t\t\t{ register: this.register, schema: this.schemaSlug, objectId: this.objectId },\n\t\t\t\t)\n\t\t\t\tconst response = await axios.get(url)\n\t\t\t\tconst data = response?.data || {}\n\t\t\t\tconst results = Array.isArray(data)\n\t\t\t\t\t? data\n\t\t\t\t\t: (Array.isArray(data.results) ? data.results : [])\n\t\t\t\tthis.items = results.map((file) => {\n\t\t\t\t\tconst mime = file.mimeType || file.mimetype || file.type || ''\n\t\t\t\t\t// SVG: Nextcloud's rasterised /core/preview is usually\n\t\t\t\t\t// unavailable for SVG (no rsvg/imagick), so stream the raw file\n\t\t\t\t\t// from OpenRegister's authenticated per-file download endpoint\n\t\t\t\t\t// (works for the owner's un-shared uploads via the session\n\t\t\t\t\t// cookie; the widget's other calls use the same objectApiBase).\n\t\t\t\t\t// Rendered through the list's <img>, the SVG runs in the\n\t\t\t\t\t// browser's restricted image mode — inline <script> / event\n\t\t\t\t\t// handlers never execute and external refs don't load — so\n\t\t\t\t\t// untrusted SVG is shown safely without a bespoke sandbox.\n\t\t\t\t\t// Other images use the rasterised server preview; anything else\n\t\t\t\t\t// gets the generic icon (a missing preview also falls back via\n\t\t\t\t\t// the <img> @error handler).\n\t\t\t\t\tlet thumbnailUrl = null\n\t\t\t\t\tif (file.id && /^image\\/svg\\+xml$/i.test(mime)) {\n\t\t\t\t\t\tthumbnailUrl = generateUrl(`${this.objectApiBase}/files/{fileId}/download`, { fileId: file.id })\n\t\t\t\t\t} else if (file.id && /^image\\//.test(mime)) {\n\t\t\t\t\t\tthumbnailUrl = generateUrl('/core/preview?fileId={fileId}&x=256&y=256&a=1', { fileId: file.id })\n\t\t\t\t\t}\n\t\t\t\t\treturn {\n\t\t\t\t\t\tname: file.name || file.title || '',\n\t\t\t\t\t\tfileId: file.id,\n\t\t\t\t\t\tmimeType: mime,\n\t\t\t\t\t\tpath: file.path || '',\n\t\t\t\t\t\tdownloadUrl: file.id ? generateUrl(`${this.objectApiBase}/files/{fileId}/download`, { fileId: file.id }) : '',\n\t\t\t\t\t\tisFolder: false,\n\t\t\t\t\t\tsize: file.size,\n\t\t\t\t\t\tmodifiedAt: file.modified || file.updated || '',\n\t\t\t\t\t\tthumbnailUrl,\n\t\t\t\t\t\tcanEdit: true,\n\t\t\t\t\t\tcanDelete: this.allowDelete,\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t\tthis.nextCursor = null\n\t\t\t} catch (err) {\n\t\t\t\tconst status = err?.response?.status\n\t\t\t\tif (status === 404) {\n\t\t\t\t\tthis.errorCode = 'folder_not_found'\n\t\t\t\t} else if (status === 403) {\n\t\t\t\t\tthis.errorCode = 'no_access'\n\t\t\t\t} else if (status === undefined) {\n\t\t\t\t\tthis.unavailable = true\n\t\t\t\t} else {\n\t\t\t\t\tthis.errorCode = 'unknown_error'\n\t\t\t\t}\n\t\t\t\tthis.items = []\n\t\t\t\tthis.nextCursor = null\n\t\t\t} finally {\n\t\t\t\tthis.loading = false\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Load the next page when a cursor is present.\n\t\t *\n\t\t * @return {void}\n\t\t */\n\t\tloadMore() {\n\t\t\tif (this.nextCursor) {\n\t\t\t\tthis.fetchContents(true)\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Show a file in the in-page preview.\n\t\t *\n\t\t * @param {object} file The file to preview.\n\t\t */\n\t\tshowPreview(file) {\n\t\t\tthis.previewFile = file\n\t\t},\n\n\t\t/**\n\t\t * Handle a row click: a folder is browsed in place, a file opens through\n\t\t * the shared opener (Viewer, preview, browser, Files app).\n\t\t *\n\t\t * @param {object} item the clicked row.\n\t\t * @param {MouseEvent} [event] the click event.\n\t\t * @return {void}\n\t\t */\n\t\tonRowClick(item, event) {\n\t\t\tif (item.isFolder) {\n\t\t\t\tthis.onItemClick(item)\n\t\t\t\treturn\n\t\t\t}\n\t\t\t// Keep the link's own behaviour for a modified click (new tab, etc.).\n\t\t\tif (event && (event.ctrlKey || event.metaKey || event.shiftKey || event.button === 1)) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif (event) {\n\t\t\t\tevent.preventDefault()\n\t\t\t}\n\t\t\tuseFileOpener({ onPreview: this.showPreview }).open({\n\t\t\t\tid: item.fileId,\n\t\t\t\tname: item.name,\n\t\t\t\ttype: item.mimeType || item.mimetype || item.type || '',\n\t\t\t\tpath: item.path || '',\n\t\t\t\taccessUrl: item.accessUrl || '',\n\t\t\t\tdownloadUrl: item.downloadUrl || '',\n\t\t\t})\n\t\t},\n\n\t\t/**\n\t\t * Descend into a folder row.\n\t\t *\n\t\t * @param {object} item the clicked folder item.\n\t\t * @return {void}\n\t\t */\n\t\tonItemClick(item) {\n\t\t\tthis.navigateTo(this.joinPath(this.currentSubPath, item.name))\n\t\t},\n\n\t\t/**\n\t\t * Navigate to a sub-path, clearing search + pagination and refetching.\n\t\t *\n\t\t * @param {string} path the target sub-path.\n\t\t * @return {void}\n\t\t */\n\t\tnavigateTo(path) {\n\t\t\tthis.currentSubPath = path || '/'\n\t\t\tthis.searchQuery = ''\n\t\t\tthis.nextCursor = null\n\t\t\tthis.fetchContents()\n\t\t},\n\n\t\t/**\n\t\t * Build the sub-path up to (and including) a breadcrumb segment index.\n\t\t *\n\t\t * @param {number} index the segment index.\n\t\t * @return {string} the assembled sub-path.\n\t\t */\n\t\tsegmentPathTo(index) {\n\t\t\tconst segments = this.pathSegments.slice(0, index + 1)\n\t\t\treturn '/' + segments.join('/')\n\t\t},\n\n\t\t/**\n\t\t * Join a base path and a child name into a normalised sub-path.\n\t\t *\n\t\t * @param {string} base the base path.\n\t\t * @param {string} name the child name.\n\t\t * @return {string} the joined path.\n\t\t */\n\t\tjoinPath(base, name) {\n\t\t\tconst trimmedBase = stripTrailingSlashes(String(base || '/'))\n\t\t\tconst trimmedName = String(name || '').replace(/^\\/+/, '')\n\t\t\tif (trimmedBase === '' || trimmedBase === '/') {\n\t\t\t\treturn '/' + trimmedName\n\t\t\t}\n\t\t\treturn `${trimmedBase}/${trimmedName}`\n\t\t},\n\n\t\t/**\n\t\t * The Files-app permalink for a file.\n\t\t *\n\t\t * @param {number|string} fileId the Nextcloud file id.\n\t\t * @return {string} the URL, or '' without a file id.\n\t\t */\n\t\tfileUrl(fileId) {\n\t\t\tif (!fileId) {\n\t\t\t\treturn ''\n\t\t\t}\n\t\t\t// Canonical permalink: `/f/{fileid}` resolves the id to its folder\n\t\t\t// and opens the file; generateUrl adds `index.php` where needed.\n\t\t\treturn generateUrl('/f/{fileid}', { fileid: fileId })\n\t\t},\n\n\t\t/**\n\t\t * Whether a per-row delete button should render for an item.\n\t\t *\n\t\t * @param {object} item the item.\n\t\t * @return {boolean} `true` when delete is allowed and the item is deletable.\n\t\t */\n\t\tcanDeleteItem(item) {\n\t\t\treturn this.allowDelete === true && item.canDelete === true\n\t\t},\n\n\t\t/**\n\t\t * Mark an item's thumbnail as failed so the row falls back to the\n\t\t * generic icon. Fires when the preview `<img>` cannot load (e.g. the\n\t\t * preview was not generated in time).\n\t\t *\n\t\t * @param {object} item the item whose thumbnail failed.\n\t\t * @return {void}\n\t\t */\n\t\tonThumbError(item) {\n\t\t\tthis.failedThumbs[item.fileId] = true\n\t\t},\n\n\t\t/**\n\t\t * Open the delete-confirmation modal for an item.\n\t\t *\n\t\t * @param {object} item the item to delete.\n\t\t * @return {void}\n\t\t */\n\t\tconfirmDelete(item) {\n\t\t\tthis.confirmTarget = item\n\t\t},\n\n\t\t/**\n\t\t * React to the delete dialog's open-state changes. Closing it (Cancel,\n\t\t * Esc, click-outside, or the header X) clears the pending target.\n\t\t *\n\t\t * @param {boolean} open the dialog's new open state.\n\t\t * @return {void}\n\t\t */\n\t\tonDeleteDialogToggle(open) {\n\t\t\tif (!open) {\n\t\t\t\tthis.confirmTarget = null\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Delete the confirmed target via the host Files endpoint, refreshing\n\t\t * the listing on failure so the UI stays truthful.\n\t\t *\n\t\t * @return {Promise<void>} resolves when the delete settles.\n\t\t */\n\t\tasync performDelete() {\n\t\t\tconst target = this.confirmTarget\n\t\t\tif (!target) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\ttry {\n\t\t\t\tconst { default: axios } = await import('@nextcloud/axios')\n\n\t\t\t\tconst url = this.objectBound\n\t\t\t\t\t? generateUrl(\n\t\t\t\t\t\t\t`${this.objectApiBase}/objects/{register}/{schema}/{objectId}/files/{fileId}`,\n\t\t\t\t\t\t\t{ register: this.register, schema: this.schemaSlug, objectId: this.objectId, fileId: target.fileId },\n\t\t\t\t\t\t)\n\t\t\t\t\t: generateUrl(\n\t\t\t\t\t\t\t`${this.apiBase}/api/widgets/files/{placementId}/files/{fileId}`,\n\t\t\t\t\t\t\t{ placementId: this.placementId, fileId: target.fileId },\n\t\t\t\t\t\t)\n\t\t\t\tawait axios.delete(url)\n\t\t\t\tthis.items = this.items.filter((item) => item.fileId !== target.fileId)\n\t\t\t} catch {\n\t\t\t\tthis.fetchContents()\n\t\t\t} finally {\n\t\t\t\tthis.confirmTarget = null\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Trigger the hidden file input from the upload button.\n\t\t *\n\t\t * @return {void}\n\t\t */\n\t\ttriggerUpload() {\n\t\t\tif (this.fileInputEl) {\n\t\t\t\tthis.fileInputEl.click()\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Upload the chosen files to the host Files endpoint and refresh.\n\t\t *\n\t\t * @param {Event} event the file-input change event.\n\t\t * @return {Promise<void>} resolves when the upload settles.\n\t\t */\n\t\tasync onFileInputChange(event) {\n\t\t\tconst fileList = event?.target?.files\n\t\t\tawait this.uploadFiles(fileList)\n\t\t\tif (this.fileInputEl) {\n\t\t\t\tthis.fileInputEl.value = ''\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * POST a FileList (from the picker or a drag-and-drop) to the host Files\n\t\t * endpoint, then refresh the listing. No-op when there is nothing to upload\n\t\t * or upload is not permitted; never throws.\n\t\t *\n\t\t * @param {FileList|File[]|null} fileList the files to upload.\n\t\t * @return {Promise<void>} resolves when the upload settles.\n\t\t */\n\t\tasync uploadFiles(fileList) {\n\t\t\tif (!fileList || fileList.length === 0 || !this.canShowUpload) {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tconst formData = new FormData()\n\t\t\tfor (let i = 0; i < fileList.length; i++) {\n\t\t\t\tformData.append('files[]', fileList[i])\n\t\t\t}\n\n\t\t\ttry {\n\t\t\t\tconst { default: axios } = await import('@nextcloud/axios')\n\n\t\t\t\tif (this.objectBound) {\n\t\t\t\t\tconst objectUrl = generateUrl(\n\t\t\t\t\t\t`${this.objectApiBase}/objects/{register}/{schema}/{objectId}/filesMultipart`,\n\t\t\t\t\t\t{ register: this.register, schema: this.schemaSlug, objectId: this.objectId },\n\t\t\t\t\t)\n\t\t\t\t\tawait axios.post(objectUrl, formData)\n\t\t\t\t} else {\n\t\t\t\t\tconst url = generateUrl(\n\t\t\t\t\t\t`${this.apiBase}/api/widgets/files/{placementId}/upload`,\n\t\t\t\t\t\t{ placementId: this.placementId },\n\t\t\t\t\t)\n\t\t\t\t\tawait axios.post(url, formData, {\n\t\t\t\t\t\tparams: { currentPath: this.currentSubPath },\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t\tthis.fetchContents()\n\t\t\t} catch {\n\t\t\t\tthis.fetchContents()\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Track a drag entering the widget (depth-counted so nested elements don't\n\t\t * flicker the drop overlay).\n\t\t *\n\t\t * @param {DragEvent} event the dragenter event.\n\t\t * @return {void}\n\t\t */\n\t\tonDragEnter(event) {\n\t\t\tif (!this.canShowUpload || !this.hasFiles(event)) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tevent.preventDefault()\n\t\t\tthis.dragDepth++\n\t\t\tthis.isDragging = true\n\t\t},\n\n\t\t/**\n\t\t * Keep the browser from opening the dragged file and mark the drop as a copy.\n\t\t *\n\t\t * @param {DragEvent} event the dragover event.\n\t\t * @return {void}\n\t\t */\n\t\tonDragOver(event) {\n\t\t\tif (!this.canShowUpload || !this.hasFiles(event)) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tevent.preventDefault()\n\t\t\tif (event.dataTransfer) {\n\t\t\t\tevent.dataTransfer.dropEffect = 'copy'\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Track a drag leaving the widget, clearing the overlay at depth zero.\n\t\t *\n\t\t * @return {void}\n\t\t */\n\t\tonDragLeave() {\n\t\t\tif (this.dragDepth > 0) {\n\t\t\t\tthis.dragDepth--\n\t\t\t}\n\t\t\tif (this.dragDepth === 0) {\n\t\t\t\tthis.isDragging = false\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Handle a file drop — upload the dropped files into the current folder.\n\t\t *\n\t\t * @param {DragEvent} event the drop event.\n\t\t * @return {Promise<void>} resolves when the upload settles.\n\t\t */\n\t\tasync onDrop(event) {\n\t\t\tthis.dragDepth = 0\n\t\t\tthis.isDragging = false\n\t\t\tif (!this.canShowUpload || !this.hasFiles(event)) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tevent.preventDefault()\n\t\t\tawait this.uploadFiles(event.dataTransfer?.files)\n\t\t},\n\n\t\t/**\n\t\t * Whether a drag event is carrying files (vs. text / an internal drag).\n\t\t *\n\t\t * @param {DragEvent} event the drag event.\n\t\t * @return {boolean} `true` when the payload includes files.\n\t\t */\n\t\thasFiles(event) {\n\t\t\tconst types = event?.dataTransfer?.types\n\t\t\tif (!types) {\n\t\t\t\treturn false\n\t\t\t}\n\t\t\treturn Array.from(types).includes('Files')\n\t\t},\n\n\t\t/**\n\t\t * Human-format a byte count (folders render an empty size).\n\t\t *\n\t\t * @param {number} bytes the byte count.\n\t\t * @param {boolean} isFolder whether the item is a folder.\n\t\t * @return {string} the formatted size.\n\t\t */\n\t\tformatSize(bytes, isFolder) {\n\t\t\tif (isFolder) {\n\t\t\t\treturn ''\n\t\t\t}\n\t\t\tconst value = Number(bytes || 0)\n\t\t\tif (value === 0) {\n\t\t\t\treturn '0 B'\n\t\t\t}\n\t\t\tconst units = ['B', 'KB', 'MB', 'GB', 'TB']\n\t\t\tlet unitIndex = 0\n\t\t\tlet display = value\n\t\t\twhile (display >= 1024 && unitIndex < units.length - 1) {\n\t\t\t\tdisplay = display / 1024\n\t\t\t\tunitIndex++\n\t\t\t}\n\t\t\treturn `${display.toFixed(unitIndex === 0 ? 0 : 1)} ${units[unitIndex]}`\n\t\t},\n\t},\n}\n</script>\n\n<style scoped>\n.cn-files-widget {\n\tposition: relative;\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 8px;\n\theight: 100%;\n\toverflow: hidden;\n}\n\n.cn-files-widget--dragging {\n\toutline: 2px dashed var(--color-primary-element);\n\toutline-offset: -2px;\n\tborder-radius: var(--border-radius);\n}\n\n.cn-files-widget__dropzone {\n\tposition: absolute;\n\tinset: 0;\n\tz-index: 5;\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: center;\n\tpointer-events: none;\n\tbackground: var(--color-primary-element-light, rgba(0, 130, 201, 0.1));\n\tcolor: var(--color-primary-element);\n\tfont-weight: 600;\n\tborder-radius: var(--border-radius);\n}\n\n.cn-files-widget__toolbar {\n\tdisplay: flex;\n\talign-items: center;\n\tgap: 8px;\n\tflex-wrap: wrap;\n}\n\n.cn-files-widget__breadcrumb {\n\tdisplay: flex;\n\tflex-wrap: wrap;\n\talign-items: center;\n\tgap: 4px;\n\tflex: 1 1 auto;\n\tmin-width: 0;\n}\n\n.cn-files-widget__crumb {\n\tbackground: transparent;\n\tborder: none;\n\tpadding: 4px 6px;\n\tcursor: pointer;\n\tcolor: var(--color-primary-element);\n\tfont: inherit;\n}\n\n.cn-files-widget__crumb[aria-current='page'] {\n\tcolor: var(--color-main-text);\n\tcursor: default;\n}\n\n.cn-files-widget__separator {\n\tcolor: var(--color-text-maxcontrast);\n}\n\n.cn-files-widget__search {\n\tflex: 0 1 200px;\n\tpadding: 4px 8px;\n\tborder: 1px solid var(--color-border);\n\tborder-radius: var(--border-radius);\n\tbackground: var(--color-main-background);\n\tcolor: var(--color-main-text);\n}\n\n.cn-files-widget__upload {\n\tpadding: 4px 12px;\n\tborder: 1px solid var(--color-primary-element);\n\tbackground: var(--color-primary-element);\n\tcolor: var(--color-primary-element-text);\n\tborder-radius: var(--border-radius);\n\tcursor: pointer;\n}\n\n.cn-files-widget__file-input {\n\tposition: absolute;\n\twidth: 1px;\n\theight: 1px;\n\tpadding: 0;\n\tmargin: -1px;\n\toverflow: hidden;\n\tclip-path: inset(50%);\n\tborder: 0;\n}\n\n.cn-files-widget__state {\n\tpadding: 16px;\n\tcolor: var(--color-text-maxcontrast);\n\ttext-align: center;\n}\n\n.cn-files-widget__retry {\n\tdisplay: block;\n\tmargin: 8px auto 0;\n\tpadding: 4px 12px;\n\tborder: 1px solid var(--color-border);\n\tborder-radius: var(--border-radius);\n\tbackground: var(--color-background-hover);\n\tcursor: pointer;\n}\n\n.cn-files-widget__list {\n\tlist-style: none;\n\tmargin: 0;\n\tpadding: 0;\n\toverflow: auto;\n\tflex: 1 1 auto;\n}\n\n.cn-files-widget__row {\n\tdisplay: grid;\n\tgrid-template-columns: 1fr 140px 80px auto;\n\talign-items: center;\n\tgap: 8px;\n\tpadding: 4px 6px;\n\tborder-bottom: 1px solid var(--color-border);\n}\n\n.cn-files-widget__row-name {\n\tdisplay: flex;\n\talign-items: center;\n\tgap: 8px;\n\tbackground: transparent;\n\tborder: none;\n\tpadding: 0;\n\tcursor: pointer;\n\ttext-align: left;\n\tcolor: var(--color-main-text);\n\tfont: inherit;\n\ttext-decoration: none;\n\tmin-width: 0;\n}\n\n.cn-files-widget__row-icon {\n\tdisplay: inline-flex;\n\talign-items: center;\n\tjustify-content: center;\n\tflex: 0 0 auto;\n\twidth: 24px;\n\theight: 24px;\n}\n\n.cn-files-widget__row-thumb {\n\twidth: 100%;\n\theight: 100%;\n\tobject-fit: cover;\n\tborder-radius: var(--border-radius);\n\tbackground-color: var(--color-background-dark);\n}\n\n.cn-files-widget__row-label {\n\toverflow: hidden;\n\ttext-overflow: ellipsis;\n\twhite-space: nowrap;\n}\n\n.cn-files-widget__row-modified,\n.cn-files-widget__row-size {\n\tcolor: var(--color-text-maxcontrast);\n\tfont-size: 12px;\n}\n\n.cn-files-widget__row-delete {\n\tbackground: transparent;\n\tborder: 1px solid var(--color-border);\n\tborder-radius: var(--border-radius);\n\tpadding: 2px 8px;\n\tcursor: pointer;\n\tfont-size: 12px;\n\tcolor: var(--color-error);\n}\n\n/* Grid view (content.viewMode === 'grid'): lay the rows out as tiles. */\n.cn-files-widget__list--grid {\n\tdisplay: grid;\n\tgrid-template-columns: repeat(auto-fill, minmax(120px, 1fr));\n\tgap: 8px;\n\tpadding: 4px;\n\talign-content: start;\n}\n\n.cn-files-widget__list--grid .cn-files-widget__row {\n\tgrid-template-columns: 1fr;\n\tjustify-items: center;\n\ttext-align: center;\n\tgap: 4px;\n\tpadding: 10px 6px;\n\tborder: 1px solid var(--color-border);\n\tborder-radius: var(--border-radius);\n}\n\n.cn-files-widget__list--grid .cn-files-widget__row-name {\n\tflex-direction: column;\n\talign-items: center;\n\tmax-width: 100%;\n}\n\n.cn-files-widget__list--grid .cn-files-widget__row-label {\n\tmax-width: 100%;\n}\n\n.cn-files-widget__list--grid .cn-files-widget__row-icon {\n\tfont-size: 32px;\n\twidth: 56px;\n\theight: 56px;\n}\n\n/* Keep tiles compact — the modified date is list-view detail. */\n.cn-files-widget__list--grid .cn-files-widget__row-modified {\n\tdisplay: none;\n}\n\n.cn-files-widget__pagination {\n\ttext-align: center;\n\tpadding: 8px 0;\n}\n\n.cn-files-widget__more {\n\tpadding: 4px 12px;\n\tborder: 1px solid var(--color-border);\n\tborder-radius: var(--border-radius);\n\tbackground: var(--color-background-hover);\n\tcursor: pointer;\n}\n\n</style>\n"],"names":["_normalizeClass","_createElementVNode","_Fragment","_renderList","_createElementBlock","_toDisplayString","_createTextVNode","_resolveDynamicComponent","_openBlock","_createBlock","_createVNode"],"mappings":";;AAkBO,MAAA,UAAA,GAAA,EAAA,KAAG,EAAA,0BAAA;;;;;;;AAmEP,EAAA,KAAK,EAAC,2BAA2B;AACjC,EAAA,aAAW,EAAC;;;;AAIO,EAAA,KAAG,EAAA;;;;AAMtB,EAAA,KAAK,EAAC;;;;AAMN,EAAA,KAAK,EAAC;;;;AAMN,EAAA,KAAK,EAAC;;;;OAMD,EAAC;;;;AAYN,EAAA,KAAK,EAAC;;;;AAMN,EAAA,KAAK,EAAA;;;AAsBG,EAAA,aAAW,EAAC,MAAM;AAAC,EAAA,KAAK,EAAC;;;AAUzB,MAAA,WAAA,GAAA,EAAA,KAAK,EAAC,4BAAa;AAEpB,MAAA,WAAA,GAAA,EAAA,KAAK,EAAC,+BAAuB;AAC7B,MAAA,WAAA,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YAAA,IAAG,EAAA,QAAA;;AAEF,YAAA,OAAK,0CAAE,QAAA,CAAA,QAAA,IAAA,QAAA,CAAA,QAAA,CAAA,GAAA,IAAA,CAAQ,CAAA;;;;KAKG,KAAA,CAAA,WAAW;sBAA/BQ,WAAA,CAAkC,wBAAA,EAAA;;AAAA,UAAA,IAAA,EAAA,KAAA,CAAA,WAAA;AAAA,UAAA,OAAA,uCAAA,KAAA,CAAA,WAAA,GAAA,IAAA,CAAA;;;IAEnCC,WAAA;;;;;;;;;"}
1
+ {"version":3,"file":"CnFilesWidget3.vue.js","sources":["../../../../src/components/CnFilesWidget/CnFilesWidget.vue?vue&type=template&id=38d9d1a2&lang.js"],"sourcesContent":["<!--\n - SPDX-FileCopyrightText: 2026 Conduction B.V.\n - SPDX-License-Identifier: EUPL-1.2\n-->\n\n<template>\n\t<div\n\t\tclass=\"cn-files-widget\"\n\t\t:class=\"{ 'cn-files-widget--dragging': isDragging }\"\n\t\t@dragenter=\"onDragEnter\"\n\t\t@dragover=\"onDragOver\"\n\t\t@dragleave=\"onDragLeave\"\n\t\t@drop=\"onDrop\">\n\t\t<div class=\"cn-files-widget__toolbar\">\n\t\t\t<nav\n\t\t\t\tv-if=\"!objectBound\"\n\t\t\t\tclass=\"cn-files-widget__breadcrumb\"\n\t\t\t\t:aria-label=\"t('nextcloud-vue', 'Folder breadcrumb')\">\n\t\t\t\t<button\n\t\t\t\t\ttype=\"button\"\n\t\t\t\t\tclass=\"cn-files-widget__crumb cn-files-widget__crumb--root\"\n\t\t\t\t\t:aria-current=\"currentSubPath === '/' ? 'page' : null\"\n\t\t\t\t\t@click=\"navigateTo('/')\">\n\t\t\t\t\t{{ t('nextcloud-vue', 'Root') }}\n\t\t\t\t</button>\n\t\t\t\t<template v-for=\"(segment, index) in pathSegments\" :key=\"index\">\n\t\t\t\t\t<span\n\t\t\t\t\t\taria-hidden=\"true\"\n\t\t\t\t\t\tclass=\"cn-files-widget__separator\">/</span>\n\t\t\t\t\t<button\n\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\tclass=\"cn-files-widget__crumb\"\n\t\t\t\t\t\t:aria-current=\"index === pathSegments.length - 1 ? 'page' : null\"\n\t\t\t\t\t\t@click=\"navigateTo(segmentPathTo(index))\">\n\t\t\t\t\t\t{{ segment }}\n\t\t\t\t\t</button>\n\t\t\t\t</template>\n\t\t\t</nav>\n\n\t\t\t<input\n\t\t\t\tv-model=\"searchQuery\"\n\t\t\t\ttype=\"search\"\n\t\t\t\tclass=\"cn-files-widget__search\"\n\t\t\t\t:aria-label=\"t('nextcloud-vue', 'Search this folder')\"\n\t\t\t\t:placeholder=\"t('nextcloud-vue', 'Search this folder…')\">\n\n\t\t\t<button\n\t\t\t\tv-if=\"canShowUpload\"\n\t\t\t\ttype=\"button\"\n\t\t\t\tclass=\"cn-files-widget__upload\"\n\t\t\t\t@click=\"triggerUpload\">\n\t\t\t\t{{ t('nextcloud-vue', 'Upload File') }}\n\t\t\t</button>\n\t\t\t<!--\n\t\t\t\t`:ref`, not `ref`. Note `:aria-hidden=\"true\"` does NOT save this:\n\t\t\t\ta binding to a LITERAL CONSTANT is constant-folded, so the vnode\n\t\t\t\tstays fully static and the compiler hoists it to module scope.\n\t\t\t\tA hoisted vnode's ref has no owner instance, and `setRef()`'s\n\t\t\t\tnull-owner guard — along with its early `return` — is compiled\n\t\t\t\tout of production builds, so it dereferences null and throws\n\t\t\t\t`Cannot read properties of null (reading 'refs')`, aborting the\n\t\t\t\trender of the page that mounted this widget.\n\n\t\t\t\tConfirmed by instrumenting Vue's own warning to print the ref\n\t\t\t\tname: `[DEBUG ref=\"fileInput\" vnodeType=input]`. This widget is\n\t\t\t\tthe `files` integration leaf, which is how it reaches a detail\n\t\t\t\tpage. See CnFilesTab for the full account of the mechanism.\n\t\t\t-->\n\t\t\t<input\n\t\t\t\t:ref=\"fileInputRef\"\n\t\t\t\ttype=\"file\"\n\t\t\t\tmultiple\n\t\t\t\tclass=\"cn-files-widget__file-input\"\n\t\t\t\t:aria-hidden=\"true\"\n\t\t\t\ttabindex=\"-1\"\n\t\t\t\t@change=\"onFileInputChange\">\n\t\t</div>\n\n\t\t<div\n\t\t\tv-if=\"isDragging && canShowUpload\"\n\t\t\tclass=\"cn-files-widget__dropzone\"\n\t\t\taria-hidden=\"true\">\n\t\t\t{{ t('nextcloud-vue', 'Drop files to upload') }}\n\t\t</div>\n\n\t\t<div v-if=\"uploads.length > 0\" class=\"cn-files-widget__uploads\" role=\"status\">\n\t\t\t<p class=\"cn-files-widget__uploads-total\">\n\t\t\t\t{{ uploadTotalLabel }}\n\t\t\t\t<button\n\t\t\t\t\tv-if=\"!uploading\"\n\t\t\t\t\ttype=\"button\"\n\t\t\t\t\tclass=\"cn-files-widget__notice-dismiss\"\n\t\t\t\t\t@click=\"dismissUploads\">\n\t\t\t\t\t{{ t('nextcloud-vue', 'Dismiss') }}\n\t\t\t\t</button>\n\t\t\t</p>\n\t\t\t<ul class=\"cn-files-widget__uploads-list\">\n\t\t\t\t<li\n\t\t\t\t\tv-for=\"(upload, index) in uploads\"\n\t\t\t\t\t:key=\"index\"\n\t\t\t\t\tclass=\"cn-files-widget__progress-item\"\n\t\t\t\t\t:class=\"'cn-files-widget__progress-item--' + upload.status\">\n\t\t\t\t\t<span class=\"cn-files-widget__upload-name\">{{ upload.name }}</span>\n\t\t\t\t\t<span\n\t\t\t\t\t\tclass=\"cn-files-widget__upload-progress\"\n\t\t\t\t\t\trole=\"progressbar\"\n\t\t\t\t\t\t:aria-label=\"upload.name\"\n\t\t\t\t\t\taria-valuemin=\"0\"\n\t\t\t\t\t\taria-valuemax=\"100\"\n\t\t\t\t\t\t:aria-valuenow=\"uploadPercent(upload)\">\n\t\t\t\t\t\t<span class=\"cn-files-widget__upload-bar\" :style=\"{ width: uploadPercent(upload) + '%' }\" />\n\t\t\t\t\t</span>\n\t\t\t\t\t<span class=\"cn-files-widget__upload-status\">{{ uploadStatusLabel(upload) }}</span>\n\t\t\t\t</li>\n\t\t\t</ul>\n\t\t</div>\n\n\t\t<div v-if=\"deleteNotice\" class=\"cn-files-widget__notice\" role=\"alert\">\n\t\t\t<span>{{ deleteNotice }}</span>\n\t\t\t<button\n\t\t\t\ttype=\"button\"\n\t\t\t\tclass=\"cn-files-widget__notice-dismiss\"\n\t\t\t\t@click=\"deleteNotice = null\">\n\t\t\t\t{{ t('nextcloud-vue', 'Dismiss') }}\n\t\t\t</button>\n\t\t</div>\n\n\t\t<div v-if=\"loading\" class=\"cn-files-widget__state\">\n\t\t\t{{ t('nextcloud-vue', 'Loading folder…') }}\n\t\t</div>\n\n\t\t<div\n\t\t\tv-else-if=\"unavailable\"\n\t\t\tclass=\"cn-files-widget__state cn-files-widget__state--unavailable\">\n\t\t\t{{ t('nextcloud-vue', 'Files is not available') }}\n\t\t</div>\n\n\t\t<div\n\t\t\tv-else-if=\"errorCode === 'no_access'\"\n\t\t\tclass=\"cn-files-widget__state cn-files-widget__state--no-access\">\n\t\t\t{{ t('nextcloud-vue', 'You don\\'t have access to this folder.') }}\n\t\t</div>\n\n\t\t<div\n\t\t\tv-else-if=\"errorCode === 'folder_not_found'\"\n\t\t\tclass=\"cn-files-widget__state cn-files-widget__state--not-found\">\n\t\t\t{{ t('nextcloud-vue', 'Folder no longer exists.') }}\n\t\t</div>\n\n\t\t<div\n\t\t\tv-else-if=\"errorCode\"\n\t\t\tclass=\"cn-files-widget__state cn-files-widget__state--error\">\n\t\t\t{{ t('nextcloud-vue', 'Failed to load folder contents.') }}\n\t\t\t<button\n\t\t\t\ttype=\"button\"\n\t\t\t\tclass=\"cn-files-widget__retry\"\n\t\t\t\t@click=\"fetchContents\">\n\t\t\t\t{{ t('nextcloud-vue', 'Retry') }}\n\t\t\t</button>\n\t\t</div>\n\n\t\t<div\n\t\t\tv-else-if=\"filteredItems.length === 0 && !searchQuery\"\n\t\t\tclass=\"cn-files-widget__state cn-files-widget__state--empty\">\n\t\t\t{{ t('nextcloud-vue', 'This folder is empty.') }}\n\t\t</div>\n\n\t\t<div\n\t\t\tv-else-if=\"filteredItems.length === 0 && searchQuery\"\n\t\t\tclass=\"cn-files-widget__state cn-files-widget__state--empty\">\n\t\t\t{{ noSearchResultsLabel }}\n\t\t</div>\n\n\t\t<ul\n\t\t\tv-else\n\t\t\tclass=\"cn-files-widget__list\"\n\t\t\t:class=\"{ 'cn-files-widget__list--grid': viewMode === 'grid' }\">\n\t\t\t<li\n\t\t\t\tv-for=\"item in filteredItems\"\n\t\t\t\t:key=\"item.fileId\"\n\t\t\t\tclass=\"cn-files-widget__row\"\n\t\t\t\t:class=\"{ 'cn-files-widget__row--folder': item.isFolder }\">\n\t\t\t\t<!-- Files are real links (new tab, copyable); folders browse in-widget. -->\n\t\t\t\t<component\n\t\t\t\t\t:is=\"item.isFolder ? 'button' : 'a'\"\n\t\t\t\t\t:type=\"item.isFolder ? 'button' : undefined\"\n\t\t\t\t\t:href=\"item.isFolder ? undefined : (fileUrl(item.fileId) || undefined)\"\n\t\t\t\t\t:target=\"item.isFolder ? undefined : '_blank'\"\n\t\t\t\t\t:rel=\"item.isFolder ? undefined : 'noopener noreferrer'\"\n\t\t\t\t\tclass=\"cn-files-widget__row-name\"\n\t\t\t\t\t@click=\"onRowClick(item, $event)\">\n\t\t\t\t\t<span aria-hidden=\"true\" class=\"cn-files-widget__row-icon\">\n\t\t\t\t\t\t<img\n\t\t\t\t\t\t\tv-if=\"showThumbnails && !item.isFolder && item.thumbnailUrl && !failedThumbs[item.fileId]\"\n\t\t\t\t\t\t\t:src=\"item.thumbnailUrl\"\n\t\t\t\t\t\t\talt=\"\"\n\t\t\t\t\t\t\tclass=\"cn-files-widget__row-thumb\"\n\t\t\t\t\t\t\tloading=\"lazy\"\n\t\t\t\t\t\t\t@error=\"onThumbError(item)\">\n\t\t\t\t\t\t<template v-else>{{ item.isFolder ? '📁' : '📄' }}</template>\n\t\t\t\t\t</span>\n\t\t\t\t\t<span class=\"cn-files-widget__row-label\">{{ item.name }}</span>\n\t\t\t\t</component>\n\t\t\t\t<span class=\"cn-files-widget__row-modified\">{{ item.modifiedAt }}</span>\n\t\t\t\t<span class=\"cn-files-widget__row-size\">{{ formatSize(item.size, item.isFolder) }}</span>\n\t\t\t\t<button\n\t\t\t\t\tv-if=\"canDeleteItem(item)\"\n\t\t\t\t\ttype=\"button\"\n\t\t\t\t\tclass=\"cn-files-widget__row-delete\"\n\t\t\t\t\t:aria-label=\"t('nextcloud-vue', 'Delete {name}', { name: item.name })\"\n\t\t\t\t\t@click=\"confirmDelete(item)\">\n\t\t\t\t\t{{ t('nextcloud-vue', 'Delete') }}\n\t\t\t\t</button>\n\t\t\t</li>\n\t\t</ul>\n\n\t\t<div v-if=\"nextCursor\" class=\"cn-files-widget__pagination\">\n\t\t\t<button\n\t\t\t\ttype=\"button\"\n\t\t\t\tclass=\"cn-files-widget__more\"\n\t\t\t\t@click=\"loadMore\">\n\t\t\t\t{{ t('nextcloud-vue', 'Load more') }}\n\t\t\t</button>\n\t\t</div>\n\n\t\t<CnFilePreview v-if=\"previewFile\" :file=\"previewFile\" @close=\"previewFile = null\" />\n\n\t\t<CnFilesWidgetDeleteDialog\n\t\t\t:open=\"confirmTarget !== null\"\n\t\t\t:fileName=\"confirmTarget ? confirmTarget.name : ''\"\n\t\t\t@update:open=\"onDeleteDialogToggle\"\n\t\t\t@confirm=\"performDelete\" />\n\t</div>\n</template>\n\n<script>\nimport { translatePlural as n, translate as t } from '@nextcloud/l10n'\nimport { generateUrl } from '@nextcloud/router'\nimport CnFilesWidgetDeleteDialog from '../../dialogs/CnFilesWidgetDeleteDialog.vue'\nimport CnFilePreview from '../CnFilePreview/CnFilePreview.vue'\nimport { useFileOpener } from '../../composables/useFileOpener.js'\nimport { stripTrailingSlashes } from '../../utils/trailingSlashes.js'\n\n/**\n * CnFilesWidget — an inline Nextcloud Files browser rendered as a dashboard\n * widget (catalog type `files`, migrated from the launchpad `files` widget).\n *\n * NC-INTEGRATION DEPENDENCY: this widget reads folder contents from a host\n * application's `/api/widgets/files/{placementId}/...` endpoints (the same\n * contract the launchpad/mydash backend served) and deep-links file rows into\n * the Nextcloud **Files** app via the canonical `/f/{fileid}` permalink. The\n * `@nextcloud/axios` + `@nextcloud/router` helpers are imported LAZILY at call\n * time so the widget code never hard-couples to a network stack at module load\n * (keeps the no-op css transform path clean and lets a host without the backing\n * endpoint mount the component without side-effects). When the backing endpoint\n * is absent the widget degrades to a localised disabled / empty state rather\n * than throwing — see the `unavailable` data flag and the `folder_not_found` /\n * `no_access` error branches.\n *\n * Every placement instance owns its own navigation stack: the sub-path resets\n * to `/` whenever the `placement` prop changes, so re-configuring the widget\n * root never leaves the user on a stale path.\n *\n * @spec openspec/changes/cn-widget-library/specs/cn-widget-library/spec.md\n */\nexport default {\n\tname: 'CnFilesWidget',\n\n\tcomponents: {\n\t\tCnFilePreview,\n\t\tCnFilesWidgetDeleteDialog,\n\t},\n\n\tprops: {\n\t\t/**\n\t\t * Persisted content blob configuring the folder + toolbar — see\n\t\t * `CnFilesWidgetForm` for the full shape (`folderPath`, `fileId`,\n\t\t * `viewMode`, `allowUpload`, `allowDelete`, …).\n\t\t */\n\t\tcontent: {\n\t\t\ttype: Object,\n\t\t\tdefault: () => ({}),\n\t\t},\n\n\t\t/** Placement entity; its `id` scopes the host Files endpoint. */\n\t\tplacement: {\n\t\t\ttype: Object,\n\t\t\tdefault: () => ({}),\n\t\t},\n\n\t\t/** Whether the dashboard shell is in admin mode. */\n\t\tisAdmin: { // eslint-disable-line vue/no-unused-properties -- the dashboard shell passes this to every widget; declared so it does not fall through to $attrs.\n\t\t\ttype: Boolean,\n\t\t\tdefault: false,\n\t\t},\n\n\t\t/** Whether the dashboard shell is in edit mode. */\n\t\tcanEdit: { // eslint-disable-line vue/no-unused-properties -- the dashboard shell passes this to every widget; declared so it does not fall through to $attrs.\n\t\t\ttype: Boolean,\n\t\t\tdefault: false,\n\t\t},\n\n\t\t/**\n\t\t * App base for the host's files-widget endpoints\n\t\t * (`{apiBase}/api/widgets/files/{placementId}/...`). Lets a consuming\n\t\t * app point the widget at its own backend (e.g. `/apps/launchpad`).\n\t\t * Defaults to `/apps/files`.\n\t\t *\n\t\t * @type {string}\n\t\t */\n\t\tapiBase: {\n\t\t\ttype: String,\n\t\t\tdefault: '/apps/files',\n\t\t},\n\n\t\t/**\n\t\t * Object-bound mode: the OpenRegister object id this widget attaches\n\t\t * files to. When `objectId` + `register` + `schema` are all set (they\n\t\t * are auto-supplied by `CnWidgetGrid`'s detail-page context merge), the\n\t\t * widget lists/uploads/deletes against the object's Nextcloud folder via\n\t\t * the OpenRegister object endpoints instead of the dashboard\n\t\t * `/api/widgets/files/...` contract. Empty (default) keeps the dashboard\n\t\t * placement behaviour unchanged.\n\t\t *\n\t\t * @type {string}\n\t\t */\n\t\tobjectId: {\n\t\t\ttype: String,\n\t\t\tdefault: '',\n\t\t},\n\n\t\t/**\n\t\t * Object-bound mode: the OpenRegister register slug of the bound object.\n\t\t * See the `objectId` prop.\n\t\t *\n\t\t * @type {string}\n\t\t */\n\t\tregister: {\n\t\t\ttype: String,\n\t\t\tdefault: '',\n\t\t},\n\n\t\t/**\n\t\t * Object-bound mode: the OpenRegister schema of the bound object. Accepts\n\t\t * either a slug string or the resolved schema object (as merged by\n\t\t * `CnWidgetGrid`); the slug is derived by the `schemaSlug` computed. See\n\t\t * the `objectId` prop.\n\t\t *\n\t\t * @type {string|object}\n\t\t */\n\t\tschema: {\n\t\t\ttype: [String, Object],\n\t\t\tdefault: '',\n\t\t},\n\n\t\t/**\n\t\t * App base for the OpenRegister object-file endpoints used in\n\t\t * object-bound mode (`{objectApiBase}/objects/{register}/{schema}/{id}/...`).\n\t\t * Defaults to `/apps/openregister/api`.\n\t\t *\n\t\t * @type {string}\n\t\t */\n\t\tobjectApiBase: {\n\t\t\ttype: String,\n\t\t\tdefault: '/apps/openregister/api',\n\t\t},\n\t},\n\n\tdata() {\n\t\treturn {\n\t\t\t/** The file shown in the in-page preview, or null. */\n\t\t\tpreviewFile: null,\n\t\t\t/**\n\t\t\t * The hidden file input, set by the template's function ref (kept off `$refs` so the ref stays dynamic — see the template).\n\t\t\t *\n\t\t\t * @type {HTMLInputElement|null}\n\t\t\t */\n\t\t\tfileInputEl: null,\n\t\t\titems: [],\n\t\t\tcurrentSubPath: '/',\n\t\t\tloading: false,\n\t\t\terrorCode: null,\n\t\t\tunavailable: false,\n\t\t\tnextCursor: null,\n\t\t\tsearchQuery: '',\n\t\t\tconfirmTarget: null,\n\t\t\t// fileId → true for thumbnails whose <img> failed to load, so the\n\t\t\t// row falls back to the generic icon instead of a broken image.\n\t\t\tfailedThumbs: {},\n\t\t\t// Whether a file drag is currently hovering the widget (drop overlay).\n\t\t\tisDragging: false,\n\t\t\t// Depth counter so nested dragenter/dragleave don't flicker the overlay.\n\t\t\tdragDepth: 0,\n\t\t\t// The files of the current or last upload batch, each\n\t\t\t// `{ name, size, loaded, status, error }` with status `queued`,\n\t\t\t// `uploading`, `done` or `failed`.\n\t\t\tuploads: [],\n\t\t\tuploading: false,\n\t\t\t// Why the last delete was refused, shown until dismissed.\n\t\t\tdeleteNotice: null,\n\t\t}\n\t},\n\n\tcomputed: {\n\t\t/**\n\t\t * Numeric placement id used to scope the host Files endpoint.\n\t\t *\n\t\t * @return {number} the placement id, or `0` when no placement is bound.\n\t\t */\n\t\tplacementId() {\n\t\t\treturn Number(this.placement?.id || 0)\n\t\t},\n\n\t\t/**\n\t\t * The schema slug in object-bound mode. Accepts either a slug string or\n\t\t * the resolved schema object merged by `CnWidgetGrid` (in which case the\n\t\t * slug is read from `slug`/`id`/`uuid`).\n\t\t *\n\t\t * @return {string} the schema slug, or `''` when unavailable.\n\t\t */\n\t\tschemaSlug() {\n\t\t\tconst s = this.schema\n\t\t\tif (typeof s === 'string') {\n\t\t\t\treturn s\n\t\t\t}\n\t\t\treturn (s && (s.slug || s.id || s.uuid)) || ''\n\t\t},\n\n\t\t/**\n\t\t * Whether the widget runs in object-bound mode — i.e. it attaches files\n\t\t * to a specific OpenRegister object rather than a dashboard placement.\n\t\t *\n\t\t * @return {boolean} `true` when `objectId`, `register` and `schemaSlug` are all set.\n\t\t */\n\t\tobjectBound() {\n\t\t\treturn !!(this.objectId && this.register && this.schemaSlug)\n\t\t},\n\n\t\t/**\n\t\t * Stable identity key for the bound object, or `''` in dashboard mode.\n\t\t * Watched to (re)fetch when the object context first resolves (the schema\n\t\t * object arrives after the ids) or when the widget rebinds to another\n\t\t * object.\n\t\t *\n\t\t * @return {string} `register/schema/objectId`, or `''` when not object-bound.\n\t\t */\n\t\tobjectKey() {\n\t\t\treturn this.objectBound\n\t\t\t\t? `${this.register}/${this.schemaSlug}/${this.objectId}`\n\t\t\t\t: ''\n\t\t},\n\n\t\t/**\n\t\t * Whether the upload affordance is enabled by configuration. Defaults to\n\t\t * enabled in BOTH modes — a Files widget is an add-files surface — and is\n\t\t * only suppressed when a placement explicitly sets `allowUpload: false`.\n\t\t * (Object-bound mode already defaulted on, matching the object sidebar's\n\t\t * Files tab; beta extended the same default to dashboard placements.)\n\t\t *\n\t\t * @return {boolean} `true` unless `content.allowUpload` is explicitly false.\n\t\t */\n\t\tallowUpload() {\n\t\t\treturn this.content?.allowUpload !== false\n\t\t},\n\n\t\t/**\n\t\t * Whether per-row delete affordances are enabled by configuration. On by\n\t\t * default in object-bound mode (unless `content.allowDelete` is explicitly\n\t\t * false); opt-in (`content.allowDelete === true`) in dashboard mode.\n\t\t *\n\t\t * @return {boolean} `true` when deletes are allowed.\n\t\t */\n\t\tallowDelete() {\n\t\t\tif (this.objectBound) {\n\t\t\t\treturn this.content?.allowDelete !== false\n\t\t\t}\n\t\t\treturn this.content?.allowDelete === true\n\t\t},\n\n\t\t/**\n\t\t * Layout for the file listing, from `content.viewMode`. `'grid'` renders\n\t\t * the items as a tile grid; any other value (`'list'`, `'tree'`, unset)\n\t\t * renders the default list. Tree navigation is not implemented, so\n\t\t * `'tree'` falls back to the list layout.\n\t\t *\n\t\t * @return {string} `'grid'` or `'list'`.\n\t\t */\n\t\tviewMode() {\n\t\t\treturn this.content?.viewMode === 'grid' ? 'grid' : 'list'\n\t\t},\n\n\t\t/**\n\t\t * Whether file rows show a preview thumbnail (from `content.showThumbnails`).\n\t\t * Defaults to on; only an explicit `false` disables it. Files without a\n\t\t * backend-provided `thumbnailUrl` still fall back to the generic icon.\n\t\t *\n\t\t * @return {boolean} `true` unless `content.showThumbnails` is explicitly false.\n\t\t */\n\t\tshowThumbnails() {\n\t\t\t// Tree mode lists names only, whatever `showThumbnails` says.\n\t\t\tif (this.content?.viewMode === 'tree') {\n\t\t\t\treturn false\n\t\t\t}\n\t\t\treturn this.content?.showThumbnails !== false\n\t\t},\n\n\t\t/**\n\t\t * The batch line above the upload list: bytes sent of the total while\n\t\t * uploading, then how many files arrived.\n\t\t *\n\t\t * @return {string} the label.\n\t\t */\n\t\tuploadTotalLabel() {\n\t\t\tconst total = this.uploads.reduce((sum, upload) => sum + upload.size, 0)\n\t\t\tif (this.uploading) {\n\t\t\t\tconst loaded = this.uploads.reduce((sum, upload) => sum + upload.loaded, 0)\n\t\t\t\treturn t('nextcloud-vue', 'Uploading {loaded} / {total}', {\n\t\t\t\t\tloaded: this.formatSize(loaded),\n\t\t\t\t\ttotal: this.formatSize(total),\n\t\t\t\t})\n\t\t\t}\n\t\t\tconst failed = this.uploads.filter((upload) => upload.status === 'failed').length\n\t\t\tif (failed > 0) {\n\t\t\t\treturn n('nextcloud-vue', '{count} file could not be uploaded', '{count} files could not be uploaded', failed, { count: failed })\n\t\t\t}\n\t\t\treturn t('nextcloud-vue', 'Upload complete')\n\t\t},\n\n\t\t/**\n\t\t * Heuristic write-permission check: an empty folder optimistically\n\t\t * surfaces the upload button (the backend re-validates), otherwise at\n\t\t * least one editable child is required.\n\t\t *\n\t\t * @return {boolean} `true` when the viewer is treated as having write access.\n\t\t */\n\t\tviewerCanWrite() {\n\t\t\tif (this.items.length === 0) {\n\t\t\t\treturn true\n\t\t\t}\n\t\t\treturn this.items.some((item) => item.canEdit === true)\n\t\t},\n\n\t\t/**\n\t\t * Whether the upload button should render.\n\t\t *\n\t\t * @return {boolean} `true` when upload is allowed, writable, and not errored.\n\t\t */\n\t\tcanShowUpload() {\n\t\t\treturn this.allowUpload && this.viewerCanWrite && !this.errorCode && !this.unavailable\n\t\t},\n\n\t\t/**\n\t\t * The current sub-path split into breadcrumb segments.\n\t\t *\n\t\t * @return {string[]} the path segments (empty at root).\n\t\t */\n\t\tpathSegments() {\n\t\t\tif (!this.currentSubPath || this.currentSubPath === '/') {\n\t\t\t\treturn []\n\t\t\t}\n\t\t\treturn this.currentSubPath\n\t\t\t\t.split('/')\n\t\t\t\t.map((segment) => segment.trim())\n\t\t\t\t.filter((segment) => segment !== '')\n\t\t},\n\n\t\t/**\n\t\t * The items filtered by the in-widget search query.\n\t\t *\n\t\t * @return {Array<object>} the matching items (all items when the query is empty).\n\t\t */\n\t\tfilteredItems() {\n\t\t\tconst query = this.searchQuery.trim().toLowerCase()\n\t\t\tif (query === '') {\n\t\t\t\treturn this.items\n\t\t\t}\n\t\t\treturn this.items.filter((item) => {\n\t\t\t\tconst name = String(item.name || '').toLowerCase()\n\t\t\t\treturn name.includes(query)\n\t\t\t})\n\t\t},\n\n\t\t/**\n\t\t * The localised \"no results\" label for the active search query.\n\t\t *\n\t\t * @return {string} the no-results message.\n\t\t */\n\t\tnoSearchResultsLabel() {\n\t\t\treturn t(\n\t\t\t\t'nextcloud-vue',\n\t\t\t\t'No files matching \\'{query}\\'',\n\t\t\t\t{ query: this.searchQuery },\n\t\t\t)\n\t\t},\n\t},\n\n\twatch: {\n\t\tplacement: {\n\t\t\timmediate: true,\n\t\t\t/**\n\t\t\t * Reset navigation state and refetch whenever the placement changes.\n\t\t\t * Dashboard mode only — object-bound mode is driven by `objectKey`.\n\t\t\t *\n\t\t\t * @return {void}\n\t\t\t */\n\t\t\thandler() {\n\t\t\t\tif (this.objectBound) {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tthis.resetListing()\n\t\t\t\tthis.fetchContents()\n\t\t\t},\n\t\t},\n\n\t\tobjectKey: {\n\t\t\timmediate: true,\n\t\t\t/**\n\t\t\t * Reset and refetch when the bound object first resolves or changes.\n\t\t\t *\n\t\t\t * @param {string} key the new object key (`''` in dashboard mode).\n\t\t\t * @return {void}\n\t\t\t */\n\t\t\thandler(key) {\n\t\t\t\tif (!key) {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tthis.resetListing()\n\t\t\t\tthis.fetchContents()\n\t\t\t},\n\t\t},\n\t},\n\n\tmethods: {\n\t\tt,\n\n\t\t/**\n\t\t * Function ref for the hidden file input; a method so the binding is\n\t\t * stable across renders and the vnode stays dynamic.\n\t\t *\n\t\t * @param {HTMLInputElement|null} el The element, or null on unmount.\n\t\t * @return {void}\n\t\t */\n\t\tfileInputRef(el) {\n\t\t\tthis.fileInputEl = el || null\n\t\t},\n\n\t\t/**\n\t\t * Reset the listing/navigation state before a (re)fetch.\n\t\t *\n\t\t * @return {void}\n\t\t */\n\t\tresetListing() {\n\t\t\tthis.currentSubPath = '/'\n\t\t\tthis.items = []\n\t\t\tthis.nextCursor = null\n\t\t\tthis.errorCode = null\n\t\t\tthis.unavailable = false\n\t\t},\n\n\t\t/**\n\t\t * Fetch (or append) one page of folder contents from the host Files\n\t\t * endpoint. Degrades gracefully: a missing endpoint flips `unavailable`,\n\t\t * a 404/403 maps to a typed `errorCode`, and no exception escapes.\n\t\t *\n\t\t * @param {boolean} [append] whether to append to the existing list (pagination).\n\t\t * @return {Promise<void>} resolves when the fetch settles.\n\t\t */\n\t\tasync fetchContents(append = false) {\n\t\t\tif (this.objectBound) {\n\t\t\t\treturn this.fetchObjectFiles()\n\t\t\t}\n\t\t\tif (this.placementId === 0) {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tthis.loading = !append\n\t\t\tthis.errorCode = null\n\t\t\tthis.unavailable = false\n\n\t\t\ttry {\n\t\t\t\tconst { default: axios } = await import('@nextcloud/axios')\n\n\t\t\t\tconst url = generateUrl(\n\t\t\t\t\t`${this.apiBase}/api/widgets/files/{placementId}/contents`,\n\t\t\t\t\t{ placementId: this.placementId },\n\t\t\t\t)\n\t\t\t\tconst params = {\n\t\t\t\t\tcurrentPath: this.currentSubPath,\n\t\t\t\t\tlimit: 50,\n\t\t\t\t}\n\t\t\t\tif (append && this.nextCursor) {\n\t\t\t\t\tparams.cursor = this.nextCursor\n\t\t\t\t}\n\n\t\t\t\tconst response = await axios.get(url, { params })\n\t\t\t\tconst data = response?.data || {}\n\t\t\t\tconst nextItems = Array.isArray(data.items) ? data.items : []\n\t\t\t\tthis.items = append ? this.items.concat(nextItems) : nextItems\n\t\t\t\tthis.nextCursor = data.nextCursor || null\n\t\t\t} catch (err) {\n\t\t\t\tconst status = err?.response?.status\n\t\t\t\tconst code = err?.response?.data?.error\n\t\t\t\tif (status === 404 || code === 'folder_not_found') {\n\t\t\t\t\tthis.errorCode = 'folder_not_found'\n\t\t\t\t} else if (status === 403 || code === 'no_access') {\n\t\t\t\t\tthis.errorCode = 'no_access'\n\t\t\t\t} else if (status === undefined) {\n\t\t\t\t\t// No HTTP response at all — the backing Files endpoint is\n\t\t\t\t\t// not installed/reachable; degrade to the disabled state.\n\t\t\t\t\tthis.unavailable = true\n\t\t\t\t} else {\n\t\t\t\t\tthis.errorCode = 'unknown_error'\n\t\t\t\t}\n\t\t\t\tif (!append) {\n\t\t\t\t\tthis.items = []\n\t\t\t\t\tthis.nextCursor = null\n\t\t\t\t}\n\t\t\t} finally {\n\t\t\t\tthis.loading = false\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Object-bound listing: fetch the bound OpenRegister object's files from\n\t\t * `{objectApiBase}/objects/{register}/{schema}/{id}/files` and map them\n\t\t * onto the widget's flat item shape (no folder navigation). Degrades the\n\t\t * same way as the dashboard fetch: 404/403 → typed `errorCode`, no HTTP\n\t\t * response → `unavailable`.\n\t\t *\n\t\t * @return {Promise<void>} resolves when the fetch settles.\n\t\t */\n\t\tasync fetchObjectFiles() {\n\t\t\tthis.loading = true\n\t\t\tthis.errorCode = null\n\t\t\tthis.unavailable = false\n\n\t\t\ttry {\n\t\t\t\tconst { default: axios } = await import('@nextcloud/axios')\n\n\t\t\t\tconst url = generateUrl(\n\t\t\t\t\t`${this.objectApiBase}/objects/{register}/{schema}/{objectId}/files`,\n\t\t\t\t\t{ register: this.register, schema: this.schemaSlug, objectId: this.objectId },\n\t\t\t\t)\n\t\t\t\tconst response = await axios.get(url)\n\t\t\t\tconst data = response?.data || {}\n\t\t\t\tconst results = Array.isArray(data)\n\t\t\t\t\t? data\n\t\t\t\t\t: (Array.isArray(data.results) ? data.results : [])\n\t\t\t\tthis.items = results.map((file) => {\n\t\t\t\t\tconst mime = file.mimeType || file.mimetype || file.type || ''\n\t\t\t\t\t// SVG: Nextcloud's rasterised /core/preview is usually\n\t\t\t\t\t// unavailable for SVG (no rsvg/imagick), so stream the raw file\n\t\t\t\t\t// from OpenRegister's authenticated per-file download endpoint\n\t\t\t\t\t// (works for the owner's un-shared uploads via the session\n\t\t\t\t\t// cookie; the widget's other calls use the same objectApiBase).\n\t\t\t\t\t// Rendered through the list's <img>, the SVG runs in the\n\t\t\t\t\t// browser's restricted image mode — inline <script> / event\n\t\t\t\t\t// handlers never execute and external refs don't load — so\n\t\t\t\t\t// untrusted SVG is shown safely without a bespoke sandbox.\n\t\t\t\t\t// Other images use the rasterised server preview; anything else\n\t\t\t\t\t// gets the generic icon (a missing preview also falls back via\n\t\t\t\t\t// the <img> @error handler).\n\t\t\t\t\tlet thumbnailUrl = null\n\t\t\t\t\tif (file.id && /^image\\/svg\\+xml$/i.test(mime)) {\n\t\t\t\t\t\tthumbnailUrl = generateUrl(`${this.objectApiBase}/files/{fileId}/download`, { fileId: file.id })\n\t\t\t\t\t} else if (file.id && /^image\\//.test(mime)) {\n\t\t\t\t\t\tthumbnailUrl = generateUrl('/core/preview?fileId={fileId}&x=256&y=256&a=1', { fileId: file.id })\n\t\t\t\t\t}\n\t\t\t\t\treturn {\n\t\t\t\t\t\tname: file.name || file.title || '',\n\t\t\t\t\t\tfileId: file.id,\n\t\t\t\t\t\tmimeType: mime,\n\t\t\t\t\t\tpath: file.path || '',\n\t\t\t\t\t\tdownloadUrl: file.id ? generateUrl(`${this.objectApiBase}/files/{fileId}/download`, { fileId: file.id }) : '',\n\t\t\t\t\t\tisFolder: false,\n\t\t\t\t\t\tsize: file.size,\n\t\t\t\t\t\tmodifiedAt: file.modified || file.updated || '',\n\t\t\t\t\t\tthumbnailUrl,\n\t\t\t\t\t\tcanEdit: true,\n\t\t\t\t\t\tcanDelete: this.allowDelete,\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t\tthis.nextCursor = null\n\t\t\t} catch (err) {\n\t\t\t\tconst status = err?.response?.status\n\t\t\t\tif (status === 404) {\n\t\t\t\t\tthis.errorCode = 'folder_not_found'\n\t\t\t\t} else if (status === 403) {\n\t\t\t\t\tthis.errorCode = 'no_access'\n\t\t\t\t} else if (status === undefined) {\n\t\t\t\t\tthis.unavailable = true\n\t\t\t\t} else {\n\t\t\t\t\tthis.errorCode = 'unknown_error'\n\t\t\t\t}\n\t\t\t\tthis.items = []\n\t\t\t\tthis.nextCursor = null\n\t\t\t} finally {\n\t\t\t\tthis.loading = false\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Load the next page when a cursor is present.\n\t\t *\n\t\t * @return {void}\n\t\t */\n\t\tloadMore() {\n\t\t\tif (this.nextCursor) {\n\t\t\t\tthis.fetchContents(true)\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Show a file in the in-page preview.\n\t\t *\n\t\t * @param {object} file The file to preview.\n\t\t */\n\t\tshowPreview(file) {\n\t\t\tthis.previewFile = file\n\t\t},\n\n\t\t/**\n\t\t * Handle a row click: a folder is browsed in place, a file opens through\n\t\t * the shared opener (Viewer, preview, browser, Files app).\n\t\t *\n\t\t * @param {object} item the clicked row.\n\t\t * @param {MouseEvent} [event] the click event.\n\t\t * @return {void}\n\t\t */\n\t\tonRowClick(item, event) {\n\t\t\tif (item.isFolder) {\n\t\t\t\tthis.onItemClick(item)\n\t\t\t\treturn\n\t\t\t}\n\t\t\t// Keep the link's own behaviour for a modified click (new tab, etc.).\n\t\t\tif (event && (event.ctrlKey || event.metaKey || event.shiftKey || event.button === 1)) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif (event) {\n\t\t\t\tevent.preventDefault()\n\t\t\t}\n\t\t\tuseFileOpener({ onPreview: this.showPreview }).open({\n\t\t\t\tid: item.fileId,\n\t\t\t\tname: item.name,\n\t\t\t\ttype: item.mimeType || item.mimetype || item.type || '',\n\t\t\t\tpath: item.path || '',\n\t\t\t\taccessUrl: item.accessUrl || '',\n\t\t\t\tdownloadUrl: item.downloadUrl || '',\n\t\t\t})\n\t\t},\n\n\t\t/**\n\t\t * Descend into a folder row.\n\t\t *\n\t\t * @param {object} item the clicked folder item.\n\t\t * @return {void}\n\t\t */\n\t\tonItemClick(item) {\n\t\t\tthis.navigateTo(this.joinPath(this.currentSubPath, item.name))\n\t\t},\n\n\t\t/**\n\t\t * Navigate to a sub-path, clearing search + pagination and refetching.\n\t\t *\n\t\t * @param {string} path the target sub-path.\n\t\t * @return {void}\n\t\t */\n\t\tnavigateTo(path) {\n\t\t\tthis.currentSubPath = path || '/'\n\t\t\tthis.searchQuery = ''\n\t\t\tthis.nextCursor = null\n\t\t\tthis.fetchContents()\n\t\t},\n\n\t\t/**\n\t\t * Build the sub-path up to (and including) a breadcrumb segment index.\n\t\t *\n\t\t * @param {number} index the segment index.\n\t\t * @return {string} the assembled sub-path.\n\t\t */\n\t\tsegmentPathTo(index) {\n\t\t\tconst segments = this.pathSegments.slice(0, index + 1)\n\t\t\treturn '/' + segments.join('/')\n\t\t},\n\n\t\t/**\n\t\t * Join a base path and a child name into a normalised sub-path.\n\t\t *\n\t\t * @param {string} base the base path.\n\t\t * @param {string} name the child name.\n\t\t * @return {string} the joined path.\n\t\t */\n\t\tjoinPath(base, name) {\n\t\t\tconst trimmedBase = stripTrailingSlashes(String(base || '/'))\n\t\t\tconst trimmedName = String(name || '').replace(/^\\/+/, '')\n\t\t\tif (trimmedBase === '' || trimmedBase === '/') {\n\t\t\t\treturn '/' + trimmedName\n\t\t\t}\n\t\t\treturn `${trimmedBase}/${trimmedName}`\n\t\t},\n\n\t\t/**\n\t\t * The Files-app permalink for a file.\n\t\t *\n\t\t * @param {number|string} fileId the Nextcloud file id.\n\t\t * @return {string} the URL, or '' without a file id.\n\t\t */\n\t\tfileUrl(fileId) {\n\t\t\tif (!fileId) {\n\t\t\t\treturn ''\n\t\t\t}\n\t\t\t// Canonical permalink: `/f/{fileid}` resolves the id to its folder\n\t\t\t// and opens the file; generateUrl adds `index.php` where needed.\n\t\t\treturn generateUrl('/f/{fileid}', { fileid: fileId })\n\t\t},\n\n\t\t/**\n\t\t * Whether a per-row delete button should render for an item.\n\t\t *\n\t\t * @param {object} item the item.\n\t\t * @return {boolean} `true` when delete is allowed and the item is deletable.\n\t\t */\n\t\tcanDeleteItem(item) {\n\t\t\treturn this.allowDelete === true && item.canDelete === true\n\t\t},\n\n\t\t/**\n\t\t * Mark an item's thumbnail as failed so the row falls back to the\n\t\t * generic icon. Fires when the preview `<img>` cannot load (e.g. the\n\t\t * preview was not generated in time).\n\t\t *\n\t\t * @param {object} item the item whose thumbnail failed.\n\t\t * @return {void}\n\t\t */\n\t\tonThumbError(item) {\n\t\t\tthis.failedThumbs[item.fileId] = true\n\t\t},\n\n\t\t/**\n\t\t * Open the delete-confirmation modal for an item.\n\t\t *\n\t\t * @param {object} item the item to delete.\n\t\t * @return {void}\n\t\t */\n\t\tconfirmDelete(item) {\n\t\t\tthis.confirmTarget = item\n\t\t},\n\n\t\t/**\n\t\t * React to the delete dialog's open-state changes. Closing it (Cancel,\n\t\t * Esc, click-outside, or the header X) clears the pending target.\n\t\t *\n\t\t * @param {boolean} open the dialog's new open state.\n\t\t * @return {void}\n\t\t */\n\t\tonDeleteDialogToggle(open) {\n\t\t\tif (!open) {\n\t\t\t\tthis.confirmTarget = null\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Delete the confirmed target via the host Files endpoint, refreshing\n\t\t * the listing on failure so the UI stays truthful.\n\t\t *\n\t\t * @return {Promise<void>} resolves when the delete settles.\n\t\t */\n\t\tasync performDelete() {\n\t\t\tconst target = this.confirmTarget\n\t\t\tif (!target) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tthis.deleteNotice = null\n\t\t\ttry {\n\t\t\t\tconst { default: axios } = await import('@nextcloud/axios')\n\n\t\t\t\tconst url = this.objectBound\n\t\t\t\t\t? generateUrl(\n\t\t\t\t\t\t\t`${this.objectApiBase}/objects/{register}/{schema}/{objectId}/files/{fileId}`,\n\t\t\t\t\t\t\t{ register: this.register, schema: this.schemaSlug, objectId: this.objectId, fileId: target.fileId },\n\t\t\t\t\t\t)\n\t\t\t\t\t: generateUrl(\n\t\t\t\t\t\t\t`${this.apiBase}/api/widgets/files/{placementId}/files/{fileId}`,\n\t\t\t\t\t\t\t{ placementId: this.placementId, fileId: target.fileId },\n\t\t\t\t\t\t)\n\t\t\t\tawait axios.delete(url)\n\t\t\t\tthis.items = this.items.filter((item) => item.fileId !== target.fileId)\n\t\t\t} catch (err) {\n\t\t\t\tthis.deleteNotice = err?.response?.status === 403\n\t\t\t\t\t? t('nextcloud-vue', 'You no longer have permission to delete {name}.', { name: target.name })\n\t\t\t\t\t: t('nextcloud-vue', 'Could not delete {name}.', { name: target.name })\n\t\t\t\tthis.fetchContents()\n\t\t\t} finally {\n\t\t\t\tthis.confirmTarget = null\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Trigger the hidden file input from the upload button.\n\t\t *\n\t\t * @return {void}\n\t\t */\n\t\ttriggerUpload() {\n\t\t\tif (this.fileInputEl) {\n\t\t\t\tthis.fileInputEl.click()\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Upload the chosen files to the host Files endpoint and refresh.\n\t\t *\n\t\t * @param {Event} event the file-input change event.\n\t\t * @return {Promise<void>} resolves when the upload settles.\n\t\t */\n\t\tasync onFileInputChange(event) {\n\t\t\tconst fileList = event?.target?.files\n\t\t\tawait this.uploadFiles(fileList)\n\t\t\tif (this.fileInputEl) {\n\t\t\t\tthis.fileInputEl.value = ''\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * POST a FileList (from the picker or a drag-and-drop) to the host Files\n\t\t * endpoint, then refresh the listing. No-op when there is nothing to upload\n\t\t * or upload is not permitted; never throws.\n\t\t *\n\t\t * @param {FileList|File[]|null} fileList the files to upload.\n\t\t * @return {Promise<void>} resolves when the upload settles.\n\t\t */\n\t\tasync uploadFiles(fileList) {\n\t\t\tif (!fileList || fileList.length === 0 || !this.canShowUpload) {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tconst formData = new FormData()\n\t\t\tconst files = []\n\t\t\tfor (let i = 0; i < fileList.length; i++) {\n\t\t\t\tformData.append('files[]', fileList[i])\n\t\t\t\tfiles.push(fileList[i])\n\t\t\t}\n\t\t\tthis.uploads = files.map((file) => ({ name: file.name, size: Number(file.size) || 0, loaded: 0, status: 'queued', error: '' }))\n\t\t\tthis.uploading = true\n\t\t\tconst onUploadProgress = (event) => this.trackUploadProgress(event)\n\n\t\t\ttry {\n\t\t\t\tconst { default: axios } = await import('@nextcloud/axios')\n\n\t\t\t\tlet response\n\t\t\t\tif (this.objectBound) {\n\t\t\t\t\tconst objectUrl = generateUrl(\n\t\t\t\t\t\t`${this.objectApiBase}/objects/{register}/{schema}/{objectId}/filesMultipart`,\n\t\t\t\t\t\t{ register: this.register, schema: this.schemaSlug, objectId: this.objectId },\n\t\t\t\t\t)\n\t\t\t\t\tresponse = await axios.post(objectUrl, formData, { onUploadProgress })\n\t\t\t\t} else {\n\t\t\t\t\tconst url = generateUrl(\n\t\t\t\t\t\t`${this.apiBase}/api/widgets/files/{placementId}/upload`,\n\t\t\t\t\t\t{ placementId: this.placementId },\n\t\t\t\t\t)\n\t\t\t\t\tresponse = await axios.post(url, formData, {\n\t\t\t\t\t\tparams: { currentPath: this.currentSubPath },\n\t\t\t\t\t\tonUploadProgress,\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t\tthis.settleUploads(Array.isArray(response?.data?.errors) ? response.data.errors : [])\n\t\t\t\tthis.fetchContents()\n\t\t\t} catch (err) {\n\t\t\t\tconst reason = this.uploadErrorLabel(err?.response?.data?.error)\n\t\t\t\tthis.uploads = this.uploads.map((upload) => ({ ...upload, status: 'failed', error: reason }))\n\t\t\t\tthis.fetchContents()\n\t\t\t} finally {\n\t\t\t\tthis.uploading = false\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Spread the batch's sent bytes over its files in upload order: the\n\t\t * files before the byte count are done sending, the one it falls in is\n\t\t * uploading, the rest are queued.\n\t\t *\n\t\t * @param {{loaded: number, total?: number}} event axios' upload progress.\n\t\t * @return {void}\n\t\t */\n\t\ttrackUploadProgress(event) {\n\t\t\tconst size = this.uploads.reduce((sum, upload) => sum + upload.size, 0)\n\t\t\tconst total = Number(event?.total) || size\n\t\t\tconst scale = total > 0 ? size / total : 0\n\t\t\tlet remaining = Number(event?.loaded || 0) * scale\n\t\t\tthis.uploads = this.uploads.map((upload) => {\n\t\t\t\tconst loaded = Math.max(0, Math.min(upload.size, remaining))\n\t\t\t\tremaining -= upload.size\n\t\t\t\tlet status = 'queued'\n\t\t\t\tif (loaded >= upload.size && upload.size > 0) {\n\t\t\t\t\tstatus = 'done'\n\t\t\t\t} else if (loaded > 0) {\n\t\t\t\t\tstatus = 'uploading'\n\t\t\t\t}\n\t\t\t\treturn { ...upload, loaded, status }\n\t\t\t})\n\t\t},\n\n\t\t/**\n\t\t * Mark the batch finished: a file the host names in `errors`\n\t\t * (`{ name, error }`) failed with that reason, every other one arrived.\n\t\t *\n\t\t * @param {Array<{name: string, error?: string}>} errors the host's per-file errors.\n\t\t * @return {void}\n\t\t */\n\t\tsettleUploads(errors) {\n\t\t\tconst byName = new Map(errors.map((entry) => [String(entry?.name ?? ''), entry]))\n\t\t\tthis.uploads = this.uploads.map((upload) => {\n\t\t\t\tconst entry = byName.get(upload.name)\n\t\t\t\tif (entry) {\n\t\t\t\t\treturn { ...upload, status: 'failed', error: this.uploadErrorLabel(entry.error) }\n\t\t\t\t}\n\t\t\t\treturn { ...upload, loaded: upload.size, status: 'done', error: '' }\n\t\t\t})\n\t\t},\n\n\t\t/**\n\t\t * The reason shown for a file that did not upload, from the host's code.\n\t\t *\n\t\t * @param {string|undefined} code the error code (`insufficient_storage`, …).\n\t\t * @return {string} the localised reason.\n\t\t */\n\t\tuploadErrorLabel(code) {\n\t\t\tif (code === 'insufficient_storage') {\n\t\t\t\treturn t('nextcloud-vue', 'Not enough storage space')\n\t\t\t}\n\t\t\tif (code === 'no_access' || code === 'forbidden') {\n\t\t\t\treturn t('nextcloud-vue', 'You may not upload to this folder')\n\t\t\t}\n\t\t\tif (code === 'mime_type_not_allowed' || code === 'mime_not_allowed') {\n\t\t\t\treturn t('nextcloud-vue', 'This file type is not allowed here')\n\t\t\t}\n\t\t\treturn t('nextcloud-vue', 'Upload failed')\n\t\t},\n\n\t\t/**\n\t\t * The percentage of one file sent, for its progress bar.\n\t\t *\n\t\t * @param {object} upload an entry of `uploads`.\n\t\t * @return {number} 0 to 100.\n\t\t */\n\t\tuploadPercent(upload) {\n\t\t\tif (upload.status === 'done') {\n\t\t\t\treturn 100\n\t\t\t}\n\t\t\treturn upload.size > 0 ? Math.round((upload.loaded / upload.size) * 100) : 0\n\t\t},\n\n\t\t/**\n\t\t * The status text of one file in the upload list.\n\t\t *\n\t\t * @param {object} upload an entry of `uploads`.\n\t\t * @return {string} the label.\n\t\t */\n\t\tuploadStatusLabel(upload) {\n\t\t\tif (upload.status === 'failed') {\n\t\t\t\treturn upload.error\n\t\t\t}\n\t\t\tif (upload.status === 'done') {\n\t\t\t\treturn this.uploading ? t('nextcloud-vue', 'Sent') : t('nextcloud-vue', 'Uploaded')\n\t\t\t}\n\t\t\tif (upload.status === 'uploading') {\n\t\t\t\treturn t('nextcloud-vue', 'Uploading {percent}%', { percent: this.uploadPercent(upload) })\n\t\t\t}\n\t\t\treturn t('nextcloud-vue', 'Queued')\n\t\t},\n\n\t\t/**\n\t\t * Clear a finished upload list.\n\t\t *\n\t\t * @return {void}\n\t\t */\n\t\tdismissUploads() {\n\t\t\tthis.uploads = []\n\t\t},\n\n\t\t/**\n\t\t * Track a drag entering the widget (depth-counted so nested elements don't\n\t\t * flicker the drop overlay).\n\t\t *\n\t\t * @param {DragEvent} event the dragenter event.\n\t\t * @return {void}\n\t\t */\n\t\tonDragEnter(event) {\n\t\t\tif (!this.canShowUpload || !this.hasFiles(event)) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tevent.preventDefault()\n\t\t\tthis.dragDepth++\n\t\t\tthis.isDragging = true\n\t\t},\n\n\t\t/**\n\t\t * Keep the browser from opening the dragged file and mark the drop as a copy.\n\t\t *\n\t\t * @param {DragEvent} event the dragover event.\n\t\t * @return {void}\n\t\t */\n\t\tonDragOver(event) {\n\t\t\tif (!this.canShowUpload || !this.hasFiles(event)) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tevent.preventDefault()\n\t\t\tif (event.dataTransfer) {\n\t\t\t\tevent.dataTransfer.dropEffect = 'copy'\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Track a drag leaving the widget, clearing the overlay at depth zero.\n\t\t *\n\t\t * @return {void}\n\t\t */\n\t\tonDragLeave() {\n\t\t\tif (this.dragDepth > 0) {\n\t\t\t\tthis.dragDepth--\n\t\t\t}\n\t\t\tif (this.dragDepth === 0) {\n\t\t\t\tthis.isDragging = false\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Handle a file drop — upload the dropped files into the current folder.\n\t\t *\n\t\t * @param {DragEvent} event the drop event.\n\t\t * @return {Promise<void>} resolves when the upload settles.\n\t\t */\n\t\tasync onDrop(event) {\n\t\t\tthis.dragDepth = 0\n\t\t\tthis.isDragging = false\n\t\t\tif (!this.canShowUpload || !this.hasFiles(event)) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tevent.preventDefault()\n\t\t\tawait this.uploadFiles(event.dataTransfer?.files)\n\t\t},\n\n\t\t/**\n\t\t * Whether a drag event is carrying files (vs. text / an internal drag).\n\t\t *\n\t\t * @param {DragEvent} event the drag event.\n\t\t * @return {boolean} `true` when the payload includes files.\n\t\t */\n\t\thasFiles(event) {\n\t\t\tconst types = event?.dataTransfer?.types\n\t\t\tif (!types) {\n\t\t\t\treturn false\n\t\t\t}\n\t\t\treturn Array.from(types).includes('Files')\n\t\t},\n\n\t\t/**\n\t\t * Human-format a byte count (folders render an empty size).\n\t\t *\n\t\t * @param {number} bytes the byte count.\n\t\t * @param {boolean} isFolder whether the item is a folder.\n\t\t * @return {string} the formatted size.\n\t\t */\n\t\tformatSize(bytes, isFolder) {\n\t\t\tif (isFolder) {\n\t\t\t\treturn ''\n\t\t\t}\n\t\t\tconst value = Number(bytes || 0)\n\t\t\tif (value === 0) {\n\t\t\t\treturn '0 B'\n\t\t\t}\n\t\t\tconst units = ['B', 'KB', 'MB', 'GB', 'TB']\n\t\t\tlet unitIndex = 0\n\t\t\tlet display = value\n\t\t\twhile (display >= 1024 && unitIndex < units.length - 1) {\n\t\t\t\tdisplay = display / 1024\n\t\t\t\tunitIndex++\n\t\t\t}\n\t\t\treturn `${display.toFixed(unitIndex === 0 ? 0 : 1)} ${units[unitIndex]}`\n\t\t},\n\t},\n}\n</script>\n\n<style scoped>\n.cn-files-widget {\n\tposition: relative;\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 8px;\n\theight: 100%;\n\toverflow: hidden;\n}\n\n.cn-files-widget--dragging {\n\toutline: 2px dashed var(--color-primary-element);\n\toutline-offset: -2px;\n\tborder-radius: var(--border-radius);\n}\n\n.cn-files-widget__dropzone {\n\tposition: absolute;\n\tinset: 0;\n\tz-index: 5;\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: center;\n\tpointer-events: none;\n\tbackground: var(--color-primary-element-light, rgba(0, 130, 201, 0.1));\n\tcolor: var(--color-primary-element);\n\tfont-weight: 600;\n\tborder-radius: var(--border-radius);\n}\n\n.cn-files-widget__toolbar {\n\tdisplay: flex;\n\talign-items: center;\n\tgap: 8px;\n\tflex-wrap: wrap;\n}\n\n.cn-files-widget__breadcrumb {\n\tdisplay: flex;\n\tflex-wrap: wrap;\n\talign-items: center;\n\tgap: 4px;\n\tflex: 1 1 auto;\n\tmin-width: 0;\n}\n\n.cn-files-widget__crumb {\n\tbackground: transparent;\n\tborder: none;\n\tpadding: 4px 6px;\n\tcursor: pointer;\n\tcolor: var(--color-primary-element);\n\tfont: inherit;\n}\n\n.cn-files-widget__crumb[aria-current='page'] {\n\tcolor: var(--color-main-text);\n\tcursor: default;\n}\n\n.cn-files-widget__separator {\n\tcolor: var(--color-text-maxcontrast);\n}\n\n.cn-files-widget__search {\n\tflex: 0 1 200px;\n\tpadding: 4px 8px;\n\tborder: 1px solid var(--color-border);\n\tborder-radius: var(--border-radius);\n\tbackground: var(--color-main-background);\n\tcolor: var(--color-main-text);\n}\n\n.cn-files-widget__upload {\n\tpadding: 4px 12px;\n\tborder: 1px solid var(--color-primary-element);\n\tbackground: var(--color-primary-element);\n\tcolor: var(--color-primary-element-text);\n\tborder-radius: var(--border-radius);\n\tcursor: pointer;\n}\n\n.cn-files-widget__file-input {\n\tposition: absolute;\n\twidth: 1px;\n\theight: 1px;\n\tpadding: 0;\n\tmargin: -1px;\n\toverflow: hidden;\n\tclip-path: inset(50%);\n\tborder: 0;\n}\n\n.cn-files-widget__state {\n\tpadding: 16px;\n\tcolor: var(--color-text-maxcontrast);\n\ttext-align: center;\n}\n\n.cn-files-widget__retry {\n\tdisplay: block;\n\tmargin: 8px auto 0;\n\tpadding: 4px 12px;\n\tborder: 1px solid var(--color-border);\n\tborder-radius: var(--border-radius);\n\tbackground: var(--color-background-hover);\n\tcursor: pointer;\n}\n\n.cn-files-widget__list {\n\tlist-style: none;\n\tmargin: 0;\n\tpadding: 0;\n\toverflow: auto;\n\tflex: 1 1 auto;\n}\n\n.cn-files-widget__row {\n\tdisplay: grid;\n\tgrid-template-columns: 1fr 140px 80px auto;\n\talign-items: center;\n\tgap: 8px;\n\tpadding: 4px 6px;\n\tborder-bottom: 1px solid var(--color-border);\n}\n\n.cn-files-widget__row-name {\n\tdisplay: flex;\n\talign-items: center;\n\tgap: 8px;\n\tbackground: transparent;\n\tborder: none;\n\tpadding: 0;\n\tcursor: pointer;\n\ttext-align: left;\n\tcolor: var(--color-main-text);\n\tfont: inherit;\n\ttext-decoration: none;\n\tmin-width: 0;\n}\n\n.cn-files-widget__row-icon {\n\tdisplay: inline-flex;\n\talign-items: center;\n\tjustify-content: center;\n\tflex: 0 0 auto;\n\twidth: 24px;\n\theight: 24px;\n}\n\n.cn-files-widget__row-thumb {\n\twidth: 100%;\n\theight: 100%;\n\tobject-fit: cover;\n\tborder-radius: var(--border-radius);\n\tbackground-color: var(--color-background-dark);\n}\n\n.cn-files-widget__row-label {\n\toverflow: hidden;\n\ttext-overflow: ellipsis;\n\twhite-space: nowrap;\n}\n\n.cn-files-widget__row-modified,\n.cn-files-widget__row-size {\n\tcolor: var(--color-text-maxcontrast);\n\tfont-size: 12px;\n}\n\n.cn-files-widget__row-delete {\n\tbackground: transparent;\n\tborder: 1px solid var(--color-border);\n\tborder-radius: var(--border-radius);\n\tpadding: 2px 8px;\n\tcursor: pointer;\n\tfont-size: 12px;\n\tcolor: var(--color-error);\n}\n\n/* Grid view (content.viewMode === 'grid'): lay the rows out as tiles. */\n.cn-files-widget__list--grid {\n\tdisplay: grid;\n\tgrid-template-columns: repeat(auto-fill, minmax(120px, 1fr));\n\tgap: 8px;\n\tpadding: 4px;\n\talign-content: start;\n}\n\n.cn-files-widget__list--grid .cn-files-widget__row {\n\tgrid-template-columns: 1fr;\n\tjustify-items: center;\n\ttext-align: center;\n\tgap: 4px;\n\tpadding: 10px 6px;\n\tborder: 1px solid var(--color-border);\n\tborder-radius: var(--border-radius);\n}\n\n.cn-files-widget__list--grid .cn-files-widget__row-name {\n\tflex-direction: column;\n\talign-items: center;\n\tmax-width: 100%;\n}\n\n.cn-files-widget__list--grid .cn-files-widget__row-label {\n\tmax-width: 100%;\n}\n\n.cn-files-widget__list--grid .cn-files-widget__row-icon {\n\tfont-size: 32px;\n\twidth: 56px;\n\theight: 56px;\n}\n\n/* Keep tiles compact — the modified date is list-view detail. */\n.cn-files-widget__list--grid .cn-files-widget__row-modified {\n\tdisplay: none;\n}\n\n.cn-files-widget__uploads,\n.cn-files-widget__notice {\n\tmargin: 4px 0 8px;\n\tpadding: 8px 12px;\n\tborder: 1px solid var(--color-border);\n\tborder-radius: var(--border-radius);\n\tfont-size: 13px;\n}\n\n.cn-files-widget__notice {\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: space-between;\n\tgap: 8px;\n\tborder-color: var(--color-error);\n}\n\n.cn-files-widget__uploads-total {\n\tdisplay: flex;\n\tjustify-content: space-between;\n\tgap: 8px;\n\tmargin: 0 0 4px;\n\tfont-weight: 600;\n}\n\n.cn-files-widget__uploads-list {\n\tmargin: 0;\n\tpadding: 0;\n\tlist-style: none;\n}\n\n.cn-files-widget__progress-item {\n\tdisplay: grid;\n\tgrid-template-columns: minmax(0, 1fr) 80px auto;\n\talign-items: center;\n\tgap: 8px;\n\tpadding: 2px 0;\n}\n\n.cn-files-widget__upload-name {\n\toverflow: hidden;\n\ttext-overflow: ellipsis;\n\twhite-space: nowrap;\n}\n\n.cn-files-widget__upload-progress {\n\tdisplay: block;\n\theight: 6px;\n\toverflow: hidden;\n\tborder-radius: 3px;\n\tbackground: var(--color-background-dark);\n}\n\n.cn-files-widget__upload-bar {\n\tdisplay: block;\n\theight: 100%;\n\tbackground: var(--color-primary-element);\n}\n\n.cn-files-widget__progress-item--failed .cn-files-widget__upload-status {\n\tcolor: var(--color-error-text, var(--color-error));\n}\n\n.cn-files-widget__upload-status {\n\tcolor: var(--color-text-maxcontrast);\n}\n\n.cn-files-widget__notice-dismiss {\n\tpadding: 0;\n\tborder: none;\n\tbackground: transparent;\n\tcolor: inherit;\n\tfont: inherit;\n\tfont-weight: normal;\n\ttext-decoration: underline;\n\tcursor: pointer;\n}\n\n.cn-files-widget__pagination {\n\ttext-align: center;\n\tpadding: 8px 0;\n}\n\n.cn-files-widget__more {\n\tpadding: 4px 12px;\n\tborder: 1px solid var(--color-border);\n\tborder-radius: var(--border-radius);\n\tbackground: var(--color-background-hover);\n\tcursor: pointer;\n}\n\n</style>\n"],"names":["_normalizeClass","_createElementVNode","_Fragment","_renderList","_createElementBlock","_toDisplayString","_createTextVNode","_openBlock","_normalizeStyle","_resolveDynamicComponent","_createBlock","_createVNode"],"mappings":";;AAkBO,MAAA,UAAA,GAAA,EAAA,KAAG,EAAA,0BAAA;;;;;;;AAmEP,EAAA,KAAK,EAAC,2BAA2B;AACjC,EAAA,aAAW,EAAC;;;;AAIE,EAAA,KAAA,EAAA,0BAAA;AAAA,EAAA,IAAA,EAAA;;AACX,MAAA,UAAA,GAAA,EAAA,KAAK,EAAC,gCAA+B;AAUpC,MAAA,UAAA,GAAA,EAAA,KAAK,EAAC,+BAA+B;AAMjC,MAAA,WAAA,GAAA,EAAA,KAAK,EAAC,8BAAK;;AAUX,MAAA,WAAA,GAAA,EAAA,KAAK,EAAC,gCAAgC;;;AAKtB,EAAA,KAAK,EAAA,yBAAA;AAAA,EAAA,IAAA,EAAA;;;;AAUV,EAAA,KAAG,EAAA;;;;AAMtB,EAAA,KAAK,EAAC;;;;AAMN,EAAA,KAAK,EAAC;;;;AAMN,EAAA,KAAK,EAAC;;;;OAMD,EAAC;;;;AAYN,EAAA,KAAK,EAAC;;;;AAMN,EAAA,KAAK,EAAA;;;AAsBG,EAAA,aAAW,EAAC,MAAM;AAAC,EAAA,KAAK,EAAC;;;AAUzB,MAAA,WAAA,GAAA,EAAA,KAAK,EAAC,4BAAa;AAEpB,MAAA,WAAA,GAAA,EAAA,KAAK,EAAC,+BAAuB;AAC7B,MAAA,WAAA,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AAA,UAAU,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,QAAA,CAAA,CAAA,EAAA,CAAA,YAAA;AAE/D,0BAAA,CAAA,QAAA,CAAA,aAAa,CAAC,IAAI,CAAA;+DAMpB,QAAA,EAAA;;AALJ,gCAAA,IAAI,EAAC,QAAE;AACP,gCAAA,KAAE,EAAA,6BAAA;AACD,gCAAA,YAAA,EAAA,QAAA,CAAA,CAAA,CAAA,eAAA,EAAA,eAAA,EAAA,EAAA,IAAA,EAAA,IAAA,CAAA,IAAA,EAAA,CAAA;;iDAEE,QAAA,CAAA,CAAC,CAAA,eAAA,EAAA,QAAA,CAAA,CAAA,EAAA,CAAA,oBAAA,WAAA,CAAA;;;;;KAKI,KAAA,CAAA,UAAU;AAAnB,SAAAE,SAAA,EAAA,EAAAH,kBAAA,CAOI,OAPJ,WAOI,EAAA;UANLH,kBAAA,CAKS,QAAA,EAAA;AAJR,YAAA,IAAG,EAAA,QAAA;;AAEF,YAAA,OAAK,0CAAE,QAAA,CAAA,QAAA,IAAA,QAAA,CAAA,QAAA,CAAA,GAAA,IAAA,CAAQ,CAAA;;;;KAKG,KAAA,CAAA,WAAW;sBAA/BS,WAAA,CAAkC,wBAAA,EAAA;;AAAA,UAAA,IAAA,EAAA,KAAA,CAAA,WAAA;AAAA,UAAA,OAAA,uCAAA,KAAA,CAAA,WAAA,GAAA,IAAA,CAAA;;;IAEnCC,WAAA;;;;;;;;;"}
@@ -20,7 +20,6 @@ registerDashboardWidget('header', {
20
20
  backgroundImageUrl: '',
21
21
  backgroundImageFileId: null,
22
22
  backgroundColor: '',
23
- overlayMode: 'none',
24
23
  overlayColor: '',
25
24
  overlayOpacity: 0.4,
26
25
  textColor: '',
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../../src/components/CnHeaderWidget/index.js"],"sourcesContent":["/**\n * SPDX-FileCopyrightText: 2026 Conduction B.V.\n * SPDX-License-Identifier: EUPL-1.2\n *\n * CnHeaderWidget — self-registers the `header` dashboard widget type into the\n * shared dashboardWidgetRegistry at module load.\n */\n\nimport CnHeaderWidgetForm from '../CnHeaderWidgetForm/CnHeaderWidgetForm.vue'\nimport CnHeaderWidget from './CnHeaderWidget.vue'\nimport { registerDashboardWidget } from '../CnWidgetGrid/dashboardWidgetRegistry.js'\n\nregisterDashboardWidget('header', {\n\trenderer: CnHeaderWidget,\n\tform: CnHeaderWidgetForm,\n\tdefaultContent: {\n\t\ttitle: '',\n\t\tsubtitle: '',\n\t\tbackgroundImageUrl: '',\n\t\tbackgroundImageFileId: null,\n\t\tbackgroundColor: '',\n\t\toverlayMode: 'none',\n\t\toverlayColor: '',\n\t\toverlayOpacity: 0.4,\n\t\ttextColor: '',\n\t\ttextAlign: 'center',\n\t\tverticalAlign: 'middle',\n\t\theight: 'medium',\n\t\tcta: null,\n\t},\n\tdisplayName: 'Header Banner',\n\ticon: 'ViewHeadline',\n})\n\nexport { CnHeaderWidget }\nexport default CnHeaderWidget\n"],"names":["CnHeaderWidget","CnHeaderWidgetForm"],"mappings":";;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAMA,uBAAuB,CAAC,QAAQ,EAAE;AAClC,CAAC,QAAQ,EAAEA,YAAc;AACzB,CAAC,IAAI,EAAEC,UAAkB;AACzB,CAAC,cAAc,EAAE;AACjB,EAAE,KAAK,EAAE,EAAE;AACX,EAAE,QAAQ,EAAE,EAAE;AACd,EAAE,kBAAkB,EAAE,EAAE;AACxB,EAAE,qBAAqB,EAAE,IAAI;AAC7B,EAAE,eAAe,EAAE,EAAE;AACrB,EAAE,WAAW,EAAE,MAAM;AACrB,EAAE,YAAY,EAAE,EAAE;AAClB,EAAE,cAAc,EAAE,GAAG;AACrB,EAAE,SAAS,EAAE,EAAE;AACf,EAAE,SAAS,EAAE,QAAQ;AACrB,EAAE,aAAa,EAAE,QAAQ;AACzB,EAAE,MAAM,EAAE,QAAQ;AAClB,EAAE,GAAG,EAAE,IAAI;AACX,EAAE;AACF,CAAC,WAAW,EAAE,eAAe;AAC7B,CAAC,IAAI,EAAE,cAAc;AACrB,CAAC;;"}
1
+ {"version":3,"file":"index.js","sources":["../../../../src/components/CnHeaderWidget/index.js"],"sourcesContent":["/**\n * SPDX-FileCopyrightText: 2026 Conduction B.V.\n * SPDX-License-Identifier: EUPL-1.2\n *\n * CnHeaderWidget — self-registers the `header` dashboard widget type into the\n * shared dashboardWidgetRegistry at module load.\n */\n\nimport CnHeaderWidgetForm from '../CnHeaderWidgetForm/CnHeaderWidgetForm.vue'\nimport CnHeaderWidget from './CnHeaderWidget.vue'\nimport { registerDashboardWidget } from '../CnWidgetGrid/dashboardWidgetRegistry.js'\n\nregisterDashboardWidget('header', {\n\trenderer: CnHeaderWidget,\n\tform: CnHeaderWidgetForm,\n\tdefaultContent: {\n\t\ttitle: '',\n\t\tsubtitle: '',\n\t\tbackgroundImageUrl: '',\n\t\tbackgroundImageFileId: null,\n\t\tbackgroundColor: '',\n\t\toverlayColor: '',\n\t\toverlayOpacity: 0.4,\n\t\ttextColor: '',\n\t\ttextAlign: 'center',\n\t\tverticalAlign: 'middle',\n\t\theight: 'medium',\n\t\tcta: null,\n\t},\n\tdisplayName: 'Header Banner',\n\ticon: 'ViewHeadline',\n})\n\nexport { CnHeaderWidget }\nexport default CnHeaderWidget\n"],"names":["CnHeaderWidget","CnHeaderWidgetForm"],"mappings":";;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAMA,uBAAuB,CAAC,QAAQ,EAAE;AAClC,CAAC,QAAQ,EAAEA,YAAc;AACzB,CAAC,IAAI,EAAEC,UAAkB;AACzB,CAAC,cAAc,EAAE;AACjB,EAAE,KAAK,EAAE,EAAE;AACX,EAAE,QAAQ,EAAE,EAAE;AACd,EAAE,kBAAkB,EAAE,EAAE;AACxB,EAAE,qBAAqB,EAAE,IAAI;AAC7B,EAAE,eAAe,EAAE,EAAE;AACrB,EAAE,YAAY,EAAE,EAAE;AAClB,EAAE,cAAc,EAAE,GAAG;AACrB,EAAE,SAAS,EAAE,EAAE;AACf,EAAE,SAAS,EAAE,QAAQ;AACrB,EAAE,aAAa,EAAE,QAAQ;AACzB,EAAE,MAAM,EAAE,QAAQ;AAClB,EAAE,GAAG,EAAE,IAAI;AACX,EAAE;AACF,CAAC,WAAW,EAAE,eAAe;AAC7B,CAAC,IAAI,EAAE,cAAc;AACrB,CAAC;;"}
@@ -2,7 +2,7 @@ import script from './CnHeaderWidgetForm2.vue.js';
2
2
  import { render } from './CnHeaderWidgetForm3.vue.js';
3
3
 
4
4
  script.render = render;
5
- script.__scopeId = "data-v-7fccc8c4";
5
+ script.__scopeId = "data-v-4e8a127d";
6
6
  const __sfc_main = script;
7
7
 
8
8
  export { __sfc_main as default };
@@ -15,7 +15,6 @@ const DEFAULT_CONTENT = Object.freeze({
15
15
  backgroundImageUrl: '',
16
16
  backgroundImageFileId: null,
17
17
  backgroundColor: '',
18
- overlayMode: 'none',
19
18
  overlayColor: '',
20
19
  overlayOpacity: 0.4,
21
20
  textColor: '',
@@ -137,9 +136,11 @@ var script = {
137
136
  ? initial.backgroundColor
138
137
  : DEFAULT_CONTENT.backgroundColor,
139
138
 
139
+ // Empty until chosen: an unset mode is stored as no value, so the
140
+ // renderer keeps its default (`tint` over an image, else `none`).
140
141
  overlayMode: ALLOWED_OVERLAY_MODES.includes(initial.overlayMode)
141
142
  ? initial.overlayMode
142
- : DEFAULT_CONTENT.overlayMode,
143
+ : '',
143
144
 
144
145
  overlayColor: typeof initial.overlayColor === 'string'
145
146
  ? initial.overlayColor
@@ -177,6 +178,19 @@ var script = {
177
178
  },
178
179
 
179
180
  computed: {
181
+ /**
182
+ * The overlay mode the select shows and the overlay fields follow: the
183
+ * chosen one, else the renderer's default (`tint` over an image).
184
+ *
185
+ * @return {string} `none`, `tint` or `gradient-bottom`.
186
+ */
187
+ effectiveOverlayMode() {
188
+ if (this.overlayMode) {
189
+ return this.overlayMode
190
+ }
191
+ return this.backgroundImageUrl || this.backgroundImageFileId !== null || this.pendingFile ? 'tint' : 'none'
192
+ },
193
+
180
194
  /** Overlay-mode select options. */
181
195
  overlayModeOptions() {
182
196
  return [
@@ -271,7 +285,7 @@ var script = {
271
285
  backgroundImageUrl: this.backgroundImageUrl,
272
286
  backgroundImageFileId: this.backgroundImageFileId,
273
287
  backgroundColor: this.backgroundColor,
274
- overlayMode: this.overlayMode,
288
+ ...(this.overlayMode ? { overlayMode: this.overlayMode } : {}),
275
289
  overlayColor: this.overlayColor,
276
290
  overlayOpacity: this.overlayOpacity,
277
291
  textColor: this.textColor,
@@ -1 +1 @@
1
- {"version":3,"file":"CnHeaderWidgetForm2.vue.js","sources":["../../../../src/components/CnHeaderWidgetForm/CnHeaderWidgetForm.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-header-widget-form\">\n\t\t<NcTextField\n\t\t\t:modelValue=\"title\"\n\t\t\t:label=\"t('nextcloud-vue', 'Title')\"\n\t\t\t:placeholder=\"t('nextcloud-vue', 'Header title')\"\n\t\t\trequired\n\t\t\t@update:modelValue=\"updateField('title', $event)\" />\n\n\t\t<NcTextField\n\t\t\t:modelValue=\"subtitle\"\n\t\t\t:label=\"t('nextcloud-vue', 'Subtitle (optional)')\"\n\t\t\t:placeholder=\"t('nextcloud-vue', 'Optional subtitle')\"\n\t\t\t@update:modelValue=\"updateField('subtitle', $event)\" />\n\n\t\t<NcCheckboxRadioSwitch\n\t\t\t:modelValue=\"greeting\"\n\t\t\t@update:modelValue=\"updateField('greeting', $event)\">\n\t\t\t{{ t('nextcloud-vue', 'Greet the user by name instead of showing the title') }}\n\t\t</NcCheckboxRadioSwitch>\n\t\t<NcCheckboxRadioSwitch\n\t\t\t:modelValue=\"showDate\"\n\t\t\t@update:modelValue=\"updateField('showDate', $event)\">\n\t\t\t{{ t('nextcloud-vue', 'Show the date of today above the heading') }}\n\t\t</NcCheckboxRadioSwitch>\n\t\t<NcCheckboxRadioSwitch\n\t\t\t:modelValue=\"plain\"\n\t\t\t@update:modelValue=\"updateField('plain', $event)\">\n\t\t\t{{ t('nextcloud-vue', 'Plain header without a coloured background') }}\n\t\t</NcCheckboxRadioSwitch>\n\n\t\t<!-- Pick a background image. Selection does NOT upload — the file is held\n\t\t and only uploaded when the host modal calls commit() on submit, so\n\t\t re-picking or cancelling writes nothing. Uploads are the reliable\n\t\t path: external image URLs are often blocked by the Nextcloud\n\t\t Content-Security-Policy, so only the background colour would show. -->\n\t\t<div class=\"cn-header-widget-form__upload-row\">\n\t\t\t<label class=\"cn-header-widget-form__upload-label\">\n\t\t\t\t<input\n\t\t\t\t\tref=\"fileInput\"\n\t\t\t\t\ttype=\"file\"\n\t\t\t\t\taccept=\"image/*\"\n\t\t\t\t\tclass=\"cn-header-widget-form__file-input\"\n\t\t\t\t\t:disabled=\"uploading\"\n\t\t\t\t\t@change=\"handleFileSelect\">\n\t\t\t\t<span class=\"cn-header-widget-form__upload-button\">\n\t\t\t\t\t{{ pendingFile ? t('nextcloud-vue', 'Change background image') : t('nextcloud-vue', 'Choose background image') }}\n\t\t\t\t</span>\n\t\t\t</label>\n\t\t\t<NcButton\n\t\t\t\tv-if=\"pendingFile\"\n\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t:disabled=\"uploading\"\n\t\t\t\t@click=\"clearPendingFile\">\n\t\t\t\t{{ t('nextcloud-vue', 'Remove') }}\n\t\t\t</NcButton>\n\t\t</div>\n\t\t<p v-if=\"pendingFile\" class=\"cn-header-widget-form__pending\">\n\t\t\t{{ t('nextcloud-vue', 'Ready to upload on save: {name}', { name: pendingFile.name }) }}\n\t\t</p>\n\t\t<p v-if=\"uploadError\" class=\"cn-header-widget-form__error\" role=\"alert\">\n\t\t\t{{ uploadError }}\n\t\t</p>\n\n\t\t<NcTextField\n\t\t\t:modelValue=\"backgroundImageUrl\"\n\t\t\t:label=\"t('nextcloud-vue', 'Background image URL')\"\n\t\t\tplaceholder=\"https://example.com/banner.jpg\"\n\t\t\t:disabled=\"!!pendingFile\"\n\t\t\t@update:modelValue=\"updateField('backgroundImageUrl', $event)\" />\n\n\t\t<label class=\"cn-header-widget-form__color-label\">\n\t\t\t{{ t('nextcloud-vue', 'Background color') }}\n\t\t\t<CnColorPicker\n\t\t\t\t:value=\"backgroundColor\"\n\t\t\t\tclearable\n\t\t\t\t@input=\"updateField('backgroundColor', $event.hex)\"\n\t\t\t\t@clear=\"updateField('backgroundColor', '')\" />\n\t\t</label>\n\n\t\t<NcSelect\n\t\t\t:modelValue=\"overlayMode\"\n\t\t\t:options=\"overlayModeOptions\"\n\t\t\t:inputLabel=\"t('nextcloud-vue', 'Overlay mode')\"\n\t\t\t:reduce=\"(option) => option.value\"\n\t\t\tlabel=\"label\"\n\t\t\t:clearable=\"false\"\n\t\t\t@update:modelValue=\"updateField('overlayMode', $event)\" />\n\n\t\t<label v-if=\"overlayMode !== 'none'\" class=\"cn-header-widget-form__color-label\">\n\t\t\t{{ t('nextcloud-vue', 'Overlay color') }}\n\t\t\t<CnColorPicker\n\t\t\t\t:value=\"overlayColor\"\n\t\t\t\tclearable\n\t\t\t\t@input=\"updateField('overlayColor', $event.hex)\"\n\t\t\t\t@clear=\"updateField('overlayColor', '')\" />\n\t\t</label>\n\n\t\t<label v-if=\"overlayMode === 'tint'\" class=\"cn-header-widget-form__field\">\n\t\t\t<span class=\"cn-header-widget-form__label\">\n\t\t\t\t{{ t('nextcloud-vue', 'Overlay opacity') }} ({{ overlayOpacity.toFixed(2) }})\n\t\t\t</span>\n\t\t\t<input\n\t\t\t\ttype=\"range\"\n\t\t\t\tmin=\"0\"\n\t\t\t\tmax=\"1\"\n\t\t\t\tstep=\"0.05\"\n\t\t\t\t:value=\"overlayOpacity\"\n\t\t\t\tclass=\"cn-header-widget-form__range\"\n\t\t\t\t@input=\"updateField('overlayOpacity', parseFloat($event.target.value))\">\n\t\t</label>\n\n\t\t<label class=\"cn-header-widget-form__color-label\">\n\t\t\t{{ t('nextcloud-vue', 'Text color') }}\n\t\t\t<CnColorPicker\n\t\t\t\t:value=\"textColor\"\n\t\t\t\tclearable\n\t\t\t\t@input=\"updateField('textColor', $event.hex)\"\n\t\t\t\t@clear=\"updateField('textColor', '')\" />\n\t\t</label>\n\n\t\t<NcSelect\n\t\t\t:modelValue=\"textAlign\"\n\t\t\t:options=\"textAlignOptions\"\n\t\t\t:inputLabel=\"t('nextcloud-vue', 'Text alignment')\"\n\t\t\t:reduce=\"(option) => option.value\"\n\t\t\tlabel=\"label\"\n\t\t\t:clearable=\"false\"\n\t\t\t@update:modelValue=\"updateField('textAlign', $event)\" />\n\n\t\t<NcSelect\n\t\t\t:modelValue=\"verticalAlign\"\n\t\t\t:options=\"verticalAlignOptions\"\n\t\t\t:inputLabel=\"t('nextcloud-vue', 'Vertical alignment')\"\n\t\t\t:reduce=\"(option) => option.value\"\n\t\t\tlabel=\"label\"\n\t\t\t:clearable=\"false\"\n\t\t\t@update:modelValue=\"updateField('verticalAlign', $event)\" />\n\n\t\t<!-- The banner fills its dashboard grid cell, so a fixed Height preset\n\t\t no longer changes anything — resize the widget on the grid instead.\n\t\t (The `height` field is kept in the saved content for back-compat\n\t\t but is no longer surfaced as a control.) -->\n\n\t\t<fieldset class=\"cn-header-widget-form__fieldset\">\n\t\t\t<legend class=\"cn-header-widget-form__legend\">\n\t\t\t\t{{ t('nextcloud-vue', 'Call-to-action button (optional)') }}\n\t\t\t</legend>\n\n\t\t\t<NcTextField\n\t\t\t\t:modelValue=\"ctaLabel\"\n\t\t\t\t:label=\"t('nextcloud-vue', 'Button text')\"\n\t\t\t\t:placeholder=\"t('nextcloud-vue', 'Sign up')\"\n\t\t\t\t@update:modelValue=\"updateCta('label', $event)\" />\n\n\t\t\t<NcTextField\n\t\t\t\t:modelValue=\"ctaUrl\"\n\t\t\t\t:label=\"t('nextcloud-vue', 'Target URL')\"\n\t\t\t\tplaceholder=\"https://...\"\n\t\t\t\t@update:modelValue=\"updateCta('url', $event)\" />\n\n\t\t\t<NcSelect\n\t\t\t\t:modelValue=\"ctaStyle\"\n\t\t\t\t:options=\"ctaStyleOptions\"\n\t\t\t\t:inputLabel=\"t('nextcloud-vue', 'Button style')\"\n\t\t\t\t:reduce=\"(option) => option.value\"\n\t\t\t\tlabel=\"label\"\n\t\t\t\t:clearable=\"false\"\n\t\t\t\t@update:modelValue=\"updateCta('style', $event)\" />\n\t\t</fieldset>\n\t</div>\n</template>\n\n<script>\nimport { translate as t } from '@nextcloud/l10n'\nimport { NcButton, NcCheckboxRadioSwitch, NcSelect, NcTextField } from '@nextcloud/vue'\nimport CnColorPicker from '../CnColorPicker/CnColorPicker.vue'\nimport { embedAsDataUrl, extractTransportUrl, readFileAsDataUrl, warnUploadFnDeprecated } from '../../utils/widgetUpload.js'\n\nconst ALLOWED_OVERLAY_MODES = ['none', 'tint', 'gradient-bottom']\nconst ALLOWED_HEIGHTS = ['small', 'medium', 'large', 'xlarge']\nconst ALLOWED_TEXT_ALIGN = ['left', 'center', 'right']\nconst ALLOWED_VERTICAL_ALIGN = ['top', 'middle', 'bottom']\nconst ALLOWED_CTA_STYLES = ['primary', 'secondary', 'ghost']\n\nconst DEFAULT_CONTENT = Object.freeze({\n\ttitle: '',\n\tsubtitle: '',\n\tbackgroundImageUrl: '',\n\tbackgroundImageFileId: null,\n\tbackgroundColor: '',\n\toverlayMode: 'none',\n\toverlayColor: '',\n\toverlayOpacity: 0.4,\n\ttextColor: '',\n\ttextAlign: 'center',\n\tverticalAlign: 'middle',\n\theight: 'medium',\n\tcta: null,\n})\n\n/**\n * CnHeaderWidgetForm — the `CnAddWidgetModal` sub-form for creating or editing\n * a `header` widget placement (renderer: `CnHeaderWidget`).\n *\n * Controls cover every persisted field: title, subtitle, background image URL,\n * background colour, overlay mode/colour/opacity, text colour/alignment/\n * vertical alignment, height preset, and an optional call-to-action with\n * label, URL, and style. `validate()` requires `title`, requires any provided\n * `backgroundImageUrl` to be http(s), and flags a half-filled CTA (label XOR\n * url). Emits `update:content` with the assembled blob on change.\n */\nexport default {\n\tname: 'CnHeaderWidgetForm',\n\n\tcomponents: {\n\t\tNcTextField,\n\t\tNcSelect,\n\t\tNcButton,\n\t\tNcCheckboxRadioSwitch,\n\t\tCnColorPicker,\n\t},\n\n\tprops: {\n\t\t/**\n\t\t * The placement being edited, or `null` in create mode.\n\t\t *\n\t\t * @type {{content: object}|null}\n\t\t */\n\t\teditingWidget: {\n\t\t\ttype: Object,\n\t\t\tdefault: null,\n\t\t},\n\n\t\t/**\n\t\t * Initial content values — used when not editing and the parent\n\t\t * supplies registry defaults.\n\t\t *\n\t\t * @type {object}\n\t\t */\n\t\tvalue: {\n\t\t\ttype: Object,\n\t\t\tdefault: () => ({ ...DEFAULT_CONTENT }),\n\t\t},\n\n\t\t/**\n\t\t * Optional raw-file upload transport: `async (file: File) => ({ url })`.\n\t\t * Named `fileUploadFn` (not `uploadFn`) to match `CnAddWidgetModal`'s\n\t\t * File-typed sub-form transport. Called by `commit()` on submit (never on\n\t\t * file selection) with the raw picked `File`; the returned hosted URL is\n\t\t * stored as `backgroundImageUrl`. When omitted, the file is embedded as a\n\t\t * data URL on commit instead (same-origin, so it isn't blocked by the CSP\n\t\t * the way external http(s) URLs are) — but only when the raw file is ≤ 1 MB\n\t\t * (~1.37 MB once base64-encoded and stored) so a huge inline blob can't\n\t\t * freeze the tab. Wire a transport for anything larger.\n\t\t *\n\t\t * @type {((file: File) => Promise<{ url: string }>)|null}\n\t\t */\n\t\tfileUploadFn: {\n\t\t\ttype: Function,\n\t\t\tdefault: null,\n\t\t},\n\n\t\t/**\n\t\t * Legacy base64 upload transport, superseded by `fileUploadFn`.\n\t\t *\n\t\t * @deprecated Use `fileUploadFn` instead. Legacy base64 transport\n\t\t * `async (dataUrl: string) => ({ url })`, kept for backward compatibility.\n\t\t * When `fileUploadFn` is not set but this is, `commit()` reads the file to\n\t\t * a data URL and hands that to this function (emitting a one-time\n\t\t * console.warn). `fileUploadFn` takes precedence when both are provided.\n\t\t *\n\t\t * @type {((dataUrl: string) => Promise<{ url: string }>)|null}\n\t\t */\n\t\tuploadFn: {\n\t\t\ttype: Function,\n\t\t\tdefault: null,\n\t\t},\n\t},\n\n\temits: [\n\t\t/**\n\t\t * Emitted with the assembled content blob on every field change.\n\t\t *\n\t\t * @event update:content\n\t\t * @type {object}\n\t\t */\n\t\t'update:content',\n\t],\n\n\tdata() {\n\t\tconst initial = (this.editingWidget && this.editingWidget.content) || this.value || {}\n\t\tconst cta = (initial.cta && typeof initial.cta === 'object') ? initial.cta : null\n\t\treturn {\n\t\t\ttitle: typeof initial.title === 'string' ? initial.title : DEFAULT_CONTENT.title,\n\t\t\tsubtitle: typeof initial.subtitle === 'string' ? initial.subtitle : DEFAULT_CONTENT.subtitle,\n\t\t\tgreeting: initial.greeting === true || initial.greeting === 'full' || initial.greeting === 'first',\n\t\t\t// `\"full\"` (whole display name) is a manifest choice; kept as written.\n\t\t\tgreetingMode: initial.greeting === 'full' ? 'full' : true,\n\t\t\tshowDate: initial.showDate === true,\n\t\t\tplain: initial.plain === true,\n\t\t\tbackgroundImageUrl: typeof initial.backgroundImageUrl === 'string'\n\t\t\t\t? initial.backgroundImageUrl\n\t\t\t\t: DEFAULT_CONTENT.backgroundImageUrl,\n\n\t\t\tbackgroundImageFileId: (typeof initial.backgroundImageFileId === 'number')\n\t\t\t\t? initial.backgroundImageFileId\n\t\t\t\t: DEFAULT_CONTENT.backgroundImageFileId,\n\n\t\t\tbackgroundColor: typeof initial.backgroundColor === 'string'\n\t\t\t\t? initial.backgroundColor\n\t\t\t\t: DEFAULT_CONTENT.backgroundColor,\n\n\t\t\toverlayMode: ALLOWED_OVERLAY_MODES.includes(initial.overlayMode)\n\t\t\t\t? initial.overlayMode\n\t\t\t\t: DEFAULT_CONTENT.overlayMode,\n\n\t\t\toverlayColor: typeof initial.overlayColor === 'string'\n\t\t\t\t? initial.overlayColor\n\t\t\t\t: DEFAULT_CONTENT.overlayColor,\n\n\t\t\toverlayOpacity: typeof initial.overlayOpacity === 'number'\n\t\t\t\t? initial.overlayOpacity\n\t\t\t\t: DEFAULT_CONTENT.overlayOpacity,\n\n\t\t\ttextColor: typeof initial.textColor === 'string'\n\t\t\t\t? initial.textColor\n\t\t\t\t: DEFAULT_CONTENT.textColor,\n\n\t\t\ttextAlign: ALLOWED_TEXT_ALIGN.includes(initial.textAlign)\n\t\t\t\t? initial.textAlign\n\t\t\t\t: DEFAULT_CONTENT.textAlign,\n\n\t\t\tverticalAlign: ALLOWED_VERTICAL_ALIGN.includes(initial.verticalAlign)\n\t\t\t\t? initial.verticalAlign\n\t\t\t\t: DEFAULT_CONTENT.verticalAlign,\n\n\t\t\theight: ALLOWED_HEIGHTS.includes(initial.height)\n\t\t\t\t? initial.height\n\t\t\t\t: DEFAULT_CONTENT.height,\n\n\t\t\tctaLabel: cta && typeof cta.label === 'string' ? cta.label : '',\n\t\t\tctaUrl: cta && typeof cta.url === 'string' ? cta.url : '',\n\t\t\tctaStyle: (cta && ALLOWED_CTA_STYLES.includes(cta.style)) ? cta.style : 'primary',\n\t\t\tuploading: false,\n\t\t\tuploadError: '',\n\t\t\t// The picked-but-not-yet-uploaded file. Upload is deferred to commit()\n\t\t\t// so nothing is written on selection.\n\t\t\tpendingFile: null,\n\t\t}\n\t},\n\n\tcomputed: {\n\t\t/** Overlay-mode select options. */\n\t\toverlayModeOptions() {\n\t\t\treturn [\n\t\t\t\t{ value: 'none', label: t('nextcloud-vue', 'None') },\n\t\t\t\t{ value: 'tint', label: t('nextcloud-vue', 'Tinted overlay') },\n\t\t\t\t{ value: 'gradient-bottom', label: t('nextcloud-vue', 'Gradient bottom') },\n\t\t\t]\n\t\t},\n\n\t\t/** Text-alignment select options. */\n\t\ttextAlignOptions() {\n\t\t\treturn [\n\t\t\t\t{ value: 'left', label: t('nextcloud-vue', 'Left') },\n\t\t\t\t{ value: 'center', label: t('nextcloud-vue', 'Center') },\n\t\t\t\t{ value: 'right', label: t('nextcloud-vue', 'Right') },\n\t\t\t]\n\t\t},\n\n\t\t/** Vertical-alignment select options. */\n\t\tverticalAlignOptions() {\n\t\t\treturn [\n\t\t\t\t{ value: 'top', label: t('nextcloud-vue', 'Top') },\n\t\t\t\t{ value: 'middle', label: t('nextcloud-vue', 'Middle') },\n\t\t\t\t{ value: 'bottom', label: t('nextcloud-vue', 'Bottom') },\n\t\t\t]\n\t\t},\n\n\t\t/** Height-preset select options. */\n\t\theightOptions() {\n\t\t\treturn [\n\t\t\t\t{ value: 'small', label: t('nextcloud-vue', 'Small (120px)') },\n\t\t\t\t{ value: 'medium', label: t('nextcloud-vue', 'Medium (200px)') },\n\t\t\t\t{ value: 'large', label: t('nextcloud-vue', 'Large (320px)') },\n\t\t\t\t{ value: 'xlarge', label: t('nextcloud-vue', 'Extra large (480px)') },\n\t\t\t]\n\t\t},\n\n\t\t/** CTA-style select options. */\n\t\tctaStyleOptions() {\n\t\t\treturn [\n\t\t\t\t{ value: 'primary', label: t('nextcloud-vue', 'Primary') },\n\t\t\t\t{ value: 'secondary', label: t('nextcloud-vue', 'Secondary') },\n\t\t\t\t{ value: 'ghost', label: t('nextcloud-vue', 'Ghost') },\n\t\t\t]\n\t\t},\n\n\t\t/** The assembled CTA object, or null when both fields are empty. */\n\t\tctaPayload() {\n\t\t\tconst label = typeof this.ctaLabel === 'string' ? this.ctaLabel.trim() : ''\n\t\t\tconst url = typeof this.ctaUrl === 'string' ? this.ctaUrl.trim() : ''\n\t\t\tif (label === '' && url === '') {\n\t\t\t\treturn null\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tlabel,\n\t\t\t\turl,\n\t\t\t\tstyle: this.ctaStyle,\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * The greeting keys, written only when they are on, so a header that\n\t\t * never used them keeps the content blob it always had.\n\t\t *\n\t\t * @return {object}\n\t\t * @spec openspec/changes/workplace-dashboard-primitives/specs/workplace-dashboard-primitives/spec.md#requirement-greeting-header\n\t\t */\n\t\tgreetingContent() {\n\t\t\tconst content = {}\n\t\t\tif (this.greeting) {\n\t\t\t\tcontent.greeting = this.greetingMode\n\t\t\t}\n\t\t\tif (this.showDate) {\n\t\t\t\tcontent.showDate = true\n\t\t\t}\n\t\t\tif (this.plain) {\n\t\t\t\tcontent.plain = true\n\t\t\t}\n\t\t\treturn content\n\t\t},\n\n\t\t/**\n\t\t * The full content blob assembled from the current field values.\n\t\t *\n\t\t * @spec openspec/changes/workplace-dashboard-primitives/specs/workplace-dashboard-primitives/spec.md#requirement-greeting-header\n\t\t */\n\t\tassembledContent() {\n\t\t\treturn {\n\t\t\t\t...this.greetingContent,\n\t\t\t\ttitle: this.title,\n\t\t\t\tsubtitle: this.subtitle,\n\t\t\t\tbackgroundImageUrl: this.backgroundImageUrl,\n\t\t\t\tbackgroundImageFileId: this.backgroundImageFileId,\n\t\t\t\tbackgroundColor: this.backgroundColor,\n\t\t\t\toverlayMode: this.overlayMode,\n\t\t\t\toverlayColor: this.overlayColor,\n\t\t\t\toverlayOpacity: this.overlayOpacity,\n\t\t\t\ttextColor: this.textColor,\n\t\t\t\ttextAlign: this.textAlign,\n\t\t\t\tverticalAlign: this.verticalAlign,\n\t\t\t\theight: this.height,\n\t\t\t\tcta: this.ctaPayload,\n\t\t\t}\n\t\t},\n\t},\n\n\tmethods: {\n\t\tt,\n\n\t\t/**\n\t\t * Set a top-level field and re-emit the assembled payload.\n\t\t *\n\t\t * @param {string} field one of the top-level content keys.\n\t\t * @param {unknown} value the new value.\n\t\t * @return {void}\n\t\t */\n\t\tupdateField(field, value) {\n\t\t\tthis[field] = value\n\t\t\tthis.$emit('update:content', this.assembledContent)\n\t\t},\n\n\t\t/**\n\t\t * Hold the picked file for a deferred upload. Does NOT upload — that\n\t\t * happens in commit() when the host modal submits, so re-picking or\n\t\t * cancelling writes nothing.\n\t\t *\n\t\t * @param {Event} event the file-input change event.\n\t\t * @return {void}\n\t\t *\n\t\t * @spec openspec/changes/cn-widget-library/specs/cn-widget-library/spec.md\n\t\t */\n\t\thandleFileSelect(event) {\n\t\t\tconst file = event.target.files && event.target.files[0]\n\t\t\tif (!file) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tthis.uploadError = ''\n\t\t\tthis.pendingFile = file\n\t\t\tthis.resetFileInput()\n\t\t},\n\n\t\t/**\n\t\t * Upload the pending file (if any) and store it as backgroundImageUrl.\n\t\t * Called by the host modal on submit. A no-op when no file is pending, so\n\t\t * editing without changing the image keeps the existing value.\n\t\t *\n\t\t * @return {Promise<void>} resolves once the URL is set.\n\t\t * @throws {Error} when the upload fails, so the modal can block submit.\n\t\t *\n\t\t * @spec openspec/changes/cn-widget-library/specs/cn-widget-library/spec.md\n\t\t */\n\t\tasync commit() {\n\t\t\tif (this.pendingFile === null) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tthis.uploadError = ''\n\t\t\tthis.uploading = true\n\t\t\ttry {\n\t\t\t\tlet resolvedUrl\n\t\t\t\tif (typeof this.fileUploadFn === 'function') {\n\t\t\t\t\tresolvedUrl = extractTransportUrl(await this.fileUploadFn(this.pendingFile))\n\t\t\t\t} else if (typeof this.uploadFn === 'function') {\n\t\t\t\t\t// Deprecated path: the legacy uploadFn expects a base64 data URL.\n\t\t\t\t\twarnUploadFnDeprecated('CnHeaderWidgetForm')\n\t\t\t\t\tconst dataUrl = await readFileAsDataUrl(this.pendingFile)\n\t\t\t\t\tresolvedUrl = extractTransportUrl(await this.uploadFn(dataUrl))\n\t\t\t\t} else {\n\t\t\t\t\tresolvedUrl = await embedAsDataUrl(this.pendingFile)\n\t\t\t\t}\n\t\t\t\tthis.pendingFile = null\n\t\t\t\tthis.updateField('backgroundImageUrl', resolvedUrl)\n\t\t\t} catch (err) {\n\t\t\t\tthis.uploadError = (err && err.message) || t('nextcloud-vue', 'Failed to upload image')\n\t\t\t\t// eslint-disable-next-line no-console\n\t\t\t\tconsole.error('Header image upload failed:', err)\n\t\t\t\tthrow err\n\t\t\t} finally {\n\t\t\t\tthis.uploading = false\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Discard the pending file, re-enabling the URL field. Called by the\n\t\t * Remove button.\n\t\t *\n\t\t * @return {void}\n\t\t *\n\t\t * @spec openspec/changes/cn-widget-library/specs/cn-widget-library/spec.md\n\t\t */\n\t\tclearPendingFile() {\n\t\t\tthis.pendingFile = null\n\t\t\tthis.uploadError = ''\n\t\t\tthis.resetFileInput()\n\t\t},\n\n\t\t/**\n\t\t * Clear the native file input so re-selecting the same file re-fires.\n\t\t *\n\t\t * @return {void}\n\t\t */\n\t\tresetFileInput() {\n\t\t\tif (this.$refs.fileInput) {\n\t\t\t\tthis.$refs.fileInput.value = ''\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Set a CTA sub-field (label, url, style) and re-emit.\n\t\t *\n\t\t * @param {string} field one of: label, url, style.\n\t\t * @param {string} value the new value.\n\t\t * @return {void}\n\t\t */\n\t\tupdateCta(field, value) {\n\t\t\tif (field === 'label') {\n\t\t\t\tthis.ctaLabel = value\n\t\t\t} else if (field === 'url') {\n\t\t\t\tthis.ctaUrl = value\n\t\t\t} else if (field === 'style') {\n\t\t\t\tthis.ctaStyle = value\n\t\t\t}\n\t\t\tthis.$emit('update:content', this.assembledContent)\n\t\t},\n\n\t\t/**\n\t\t * Validate the form; an empty array means valid. Requires a title,\n\t\t * an http(s) background image URL when provided, and a complete CTA\n\t\t * when either CTA field is filled.\n\t\t *\n\t\t * @return {string[]} the validation errors.\n\t\t * @spec openspec/changes/workplace-dashboard-primitives/specs/workplace-dashboard-primitives/spec.md#requirement-greeting-header\n\t\t */\n\t\tvalidate() {\n\t\t\tconst errors = []\n\t\t\t// A greeting is the heading, so a greeting header needs no title.\n\t\t\tif (!this.greeting && (typeof this.title !== 'string' || this.title.trim() === '')) {\n\t\t\t\terrors.push(t('nextcloud-vue', 'Title is required'))\n\t\t\t}\n\t\t\tif (typeof this.backgroundImageUrl === 'string'\n\t\t\t\t&& this.backgroundImageUrl.trim() !== ''\n\t\t\t\t&& /^(https?:\\/\\/|data:|blob:|\\/)/i.test(this.backgroundImageUrl.trim()) === false) {\n\t\t\t\terrors.push(t('nextcloud-vue', 'Background image must be a URL or an uploaded image'))\n\t\t\t}\n\t\t\tconst labelEmpty = typeof this.ctaLabel !== 'string' || this.ctaLabel.trim() === ''\n\t\t\tconst urlEmpty = typeof this.ctaUrl !== 'string' || this.ctaUrl.trim() === ''\n\t\t\tif (labelEmpty !== urlEmpty) {\n\t\t\t\terrors.push(t('nextcloud-vue', 'Call-to-action requires both label and URL'))\n\t\t\t}\n\t\t\treturn errors\n\t\t},\n\t},\n}\n</script>\n\n<style scoped>\n.cn-header-widget-form {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 12px;\n}\n\n.cn-header-widget-form__field {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 4px;\n\tfont-size: 14px;\n}\n\n.cn-header-widget-form__label {\n\tfont-weight: 500;\n}\n\n.cn-header-widget-form__color-label {\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: space-between;\n\tgap: 12px;\n\tfont-size: 14px;\n}\n\n.cn-header-widget-form__upload-row {\n\tdisplay: flex;\n\talign-items: center;\n\tgap: 8px;\n}\n\n.cn-header-widget-form__upload-label {\n\tdisplay: inline-flex;\n\tcursor: pointer;\n}\n\n.cn-header-widget-form__pending {\n\tmargin: 0;\n\tfont-size: 12px;\n\tcolor: var(--color-text-maxcontrast);\n}\n\n.cn-header-widget-form__file-input {\n\tdisplay: none;\n}\n\n.cn-header-widget-form__upload-button {\n\tpadding: 8px 12px;\n\tborder: 1px solid var(--color-border);\n\tborder-radius: var(--border-radius);\n\tbackground-color: var(--color-background-hover);\n\tfont-size: 14px;\n}\n\n.cn-header-widget-form__upload-label:hover .cn-header-widget-form__upload-button {\n\tbackground-color: var(--color-background-dark);\n}\n\n.cn-header-widget-form__error {\n\tmargin: 0;\n\tfont-size: 12px;\n\tcolor: var(--color-error);\n}\n\n.cn-header-widget-form__color {\n\twidth: 48px;\n\theight: 32px;\n\tpadding: 0;\n\tborder: 1px solid var(--color-border);\n\tborder-radius: var(--border-radius);\n\tcursor: pointer;\n\tbackground: transparent;\n}\n\n.cn-header-widget-form__range {\n\twidth: 100%;\n}\n\n.cn-header-widget-form__fieldset {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 8px;\n\tborder: 1px solid var(--color-border);\n\tborder-radius: var(--border-radius);\n\tpadding: 12px;\n}\n\n.cn-header-widget-form__legend {\n\tfont-size: 13px;\n\tfont-weight: 600;\n\tpadding: 0 4px;\n}\n</style>\n"],"names":["CnColorPicker","t"],"mappings":";;;;;AAwLA,MAAM,qBAAoB,GAAI,CAAC,MAAM,EAAE,MAAM,EAAE,iBAAiB;AAChE,MAAM,eAAc,GAAI,CAAC,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ;AAC7D,MAAM,kBAAiB,GAAI,CAAC,MAAM,EAAE,QAAQ,EAAE,OAAO;AACrD,MAAM,yBAAyB,CAAC,KAAK,EAAE,QAAQ,EAAE,QAAQ;AACzD,MAAM,kBAAiB,GAAI,CAAC,SAAS,EAAE,WAAW,EAAE,OAAO;;AAE3D,MAAM,eAAc,GAAI,MAAM,CAAC,MAAM,CAAC;AACrC,CAAA,KAAK,EAAE,EAAE;CACT,QAAQ,EAAE,EAAE;AACZ,CAAA,kBAAkB,EAAE,EAAE;CACtB,qBAAqB,EAAE,IAAI;AAC3B,CAAA,eAAe,EAAE,EAAE;AACnB,CAAA,WAAW,EAAE,MAAM;AACnB,CAAA,YAAY,EAAE,EAAE;AAChB,CAAA,cAAc,EAAE,GAAG;CACnB,SAAS,EAAE,EAAE;AACb,CAAA,SAAS,EAAE,QAAQ;CACnB,aAAa,EAAE,QAAQ;AACvB,CAAA,MAAM,EAAE,QAAQ;AAChB,CAAA,GAAG,EAAE,IAAI;AACV,CAAC;;AAED;AACC;;AAEA;AACA;AACA;AACA;AACA;AACA;;;AAGD,aAAe;CACd,IAAI,EAAE,oBAAoB;;CAE1B,UAAU,EAAE;EACX,WAAW;AACX,E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,GAAA,IAAI,CAAC,IAAI,CAAC,QAAO,KAAM,OAAO,IAAI,CAAC,KAAI,KAAM,QAAO,IAAK,IAAI,CAAC,KAAK,CAAC,IAAI,EAAC,KAAM,EAAE,CAAC,EAAE;IACnF,MAAM,CAAC,IAAI,CAACA,SAAC,CAAC,eAAe,EAAE,mBAAmB,CAAC;AACpD,GAAA;AACA,GAAA,IAAI,OAAO,IAAI,CAAC,kBAAiB,KAAM;AACtC,OAAG,IAAI,CAAC,kBAAkB,CAAC,IAAI,EAAC,KAAM;AACtC,OAAG,gCAAgC,CAAC,IAAI,CAAC,IAAI,CAAC,kBAAkB,CAAC,IAAI,EAAE,CAAA,KAAM,KAAK,EAAE;AACpF,IAAA,MAAM,CAAC,IAAI,CAACA,SAAC,CAAC,eAAe,EAAE,qDAAqD,CAAC;AACtF,GAAA;AACA,GAAA,MAAM,aAAa,OAAO,IAAI,CAAC,QAAO,KAAM,QAAO,IAAK,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAC,KAAM;AACjF,GAAA,MAAM,QAAO,GAAI,OAAO,IAAI,CAAC,WAAW,QAAO,IAAK,IAAI,CAAC,MAAM,CAAC,IAAI,EAAC,KAAM;GAC3E,IAAI,eAAe,QAAQ,EAAE;AAC5B,IAAA,MAAM,CAAC,IAAI,CAACA,SAAC,CAAC,eAAe,EAAE,4CAA4C,CAAC;AAC7E,GAAA;GACA,OAAO;EACR,CAAC;EACD;AACF;;"}
1
+ {"version":3,"file":"CnHeaderWidgetForm2.vue.js","sources":["../../../../src/components/CnHeaderWidgetForm/CnHeaderWidgetForm.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-header-widget-form\">\n\t\t<NcTextField\n\t\t\t:modelValue=\"title\"\n\t\t\t:label=\"t('nextcloud-vue', 'Title')\"\n\t\t\t:placeholder=\"t('nextcloud-vue', 'Header title')\"\n\t\t\trequired\n\t\t\t@update:modelValue=\"updateField('title', $event)\" />\n\n\t\t<NcTextField\n\t\t\t:modelValue=\"subtitle\"\n\t\t\t:label=\"t('nextcloud-vue', 'Subtitle (optional)')\"\n\t\t\t:placeholder=\"t('nextcloud-vue', 'Optional subtitle')\"\n\t\t\t@update:modelValue=\"updateField('subtitle', $event)\" />\n\n\t\t<NcCheckboxRadioSwitch\n\t\t\t:modelValue=\"greeting\"\n\t\t\t@update:modelValue=\"updateField('greeting', $event)\">\n\t\t\t{{ t('nextcloud-vue', 'Greet the user by name instead of showing the title') }}\n\t\t</NcCheckboxRadioSwitch>\n\t\t<NcCheckboxRadioSwitch\n\t\t\t:modelValue=\"showDate\"\n\t\t\t@update:modelValue=\"updateField('showDate', $event)\">\n\t\t\t{{ t('nextcloud-vue', 'Show the date of today above the heading') }}\n\t\t</NcCheckboxRadioSwitch>\n\t\t<NcCheckboxRadioSwitch\n\t\t\t:modelValue=\"plain\"\n\t\t\t@update:modelValue=\"updateField('plain', $event)\">\n\t\t\t{{ t('nextcloud-vue', 'Plain header without a coloured background') }}\n\t\t</NcCheckboxRadioSwitch>\n\n\t\t<!-- Pick a background image. Selection does NOT upload — the file is held\n\t\t and only uploaded when the host modal calls commit() on submit, so\n\t\t re-picking or cancelling writes nothing. Uploads are the reliable\n\t\t path: external image URLs are often blocked by the Nextcloud\n\t\t Content-Security-Policy, so only the background colour would show. -->\n\t\t<div class=\"cn-header-widget-form__upload-row\">\n\t\t\t<label class=\"cn-header-widget-form__upload-label\">\n\t\t\t\t<input\n\t\t\t\t\tref=\"fileInput\"\n\t\t\t\t\ttype=\"file\"\n\t\t\t\t\taccept=\"image/*\"\n\t\t\t\t\tclass=\"cn-header-widget-form__file-input\"\n\t\t\t\t\t:disabled=\"uploading\"\n\t\t\t\t\t@change=\"handleFileSelect\">\n\t\t\t\t<span class=\"cn-header-widget-form__upload-button\">\n\t\t\t\t\t{{ pendingFile ? t('nextcloud-vue', 'Change background image') : t('nextcloud-vue', 'Choose background image') }}\n\t\t\t\t</span>\n\t\t\t</label>\n\t\t\t<NcButton\n\t\t\t\tv-if=\"pendingFile\"\n\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t:disabled=\"uploading\"\n\t\t\t\t@click=\"clearPendingFile\">\n\t\t\t\t{{ t('nextcloud-vue', 'Remove') }}\n\t\t\t</NcButton>\n\t\t</div>\n\t\t<p v-if=\"pendingFile\" class=\"cn-header-widget-form__pending\">\n\t\t\t{{ t('nextcloud-vue', 'Ready to upload on save: {name}', { name: pendingFile.name }) }}\n\t\t</p>\n\t\t<p v-if=\"uploadError\" class=\"cn-header-widget-form__error\" role=\"alert\">\n\t\t\t{{ uploadError }}\n\t\t</p>\n\n\t\t<NcTextField\n\t\t\t:modelValue=\"backgroundImageUrl\"\n\t\t\t:label=\"t('nextcloud-vue', 'Background image URL')\"\n\t\t\tplaceholder=\"https://example.com/banner.jpg\"\n\t\t\t:disabled=\"!!pendingFile\"\n\t\t\t@update:modelValue=\"updateField('backgroundImageUrl', $event)\" />\n\n\t\t<label class=\"cn-header-widget-form__color-label\">\n\t\t\t{{ t('nextcloud-vue', 'Background color') }}\n\t\t\t<CnColorPicker\n\t\t\t\t:value=\"backgroundColor\"\n\t\t\t\tclearable\n\t\t\t\t@input=\"updateField('backgroundColor', $event.hex)\"\n\t\t\t\t@clear=\"updateField('backgroundColor', '')\" />\n\t\t</label>\n\n\t\t<NcSelect\n\t\t\t:modelValue=\"effectiveOverlayMode\"\n\t\t\t:options=\"overlayModeOptions\"\n\t\t\t:inputLabel=\"t('nextcloud-vue', 'Overlay mode')\"\n\t\t\t:reduce=\"(option) => option.value\"\n\t\t\tlabel=\"label\"\n\t\t\t:clearable=\"false\"\n\t\t\t@update:modelValue=\"updateField('overlayMode', $event)\" />\n\n\t\t<label v-if=\"effectiveOverlayMode !== 'none'\" class=\"cn-header-widget-form__color-label\">\n\t\t\t{{ t('nextcloud-vue', 'Overlay color') }}\n\t\t\t<CnColorPicker\n\t\t\t\t:value=\"overlayColor\"\n\t\t\t\tclearable\n\t\t\t\t@input=\"updateField('overlayColor', $event.hex)\"\n\t\t\t\t@clear=\"updateField('overlayColor', '')\" />\n\t\t</label>\n\n\t\t<label v-if=\"effectiveOverlayMode === 'tint'\" class=\"cn-header-widget-form__field\">\n\t\t\t<span class=\"cn-header-widget-form__label\">\n\t\t\t\t{{ t('nextcloud-vue', 'Overlay opacity') }} ({{ overlayOpacity.toFixed(2) }})\n\t\t\t</span>\n\t\t\t<input\n\t\t\t\ttype=\"range\"\n\t\t\t\tmin=\"0\"\n\t\t\t\tmax=\"1\"\n\t\t\t\tstep=\"0.05\"\n\t\t\t\t:value=\"overlayOpacity\"\n\t\t\t\tclass=\"cn-header-widget-form__range\"\n\t\t\t\t@input=\"updateField('overlayOpacity', parseFloat($event.target.value))\">\n\t\t</label>\n\n\t\t<label class=\"cn-header-widget-form__color-label\">\n\t\t\t{{ t('nextcloud-vue', 'Text color') }}\n\t\t\t<CnColorPicker\n\t\t\t\t:value=\"textColor\"\n\t\t\t\tclearable\n\t\t\t\t@input=\"updateField('textColor', $event.hex)\"\n\t\t\t\t@clear=\"updateField('textColor', '')\" />\n\t\t</label>\n\n\t\t<NcSelect\n\t\t\t:modelValue=\"textAlign\"\n\t\t\t:options=\"textAlignOptions\"\n\t\t\t:inputLabel=\"t('nextcloud-vue', 'Text alignment')\"\n\t\t\t:reduce=\"(option) => option.value\"\n\t\t\tlabel=\"label\"\n\t\t\t:clearable=\"false\"\n\t\t\t@update:modelValue=\"updateField('textAlign', $event)\" />\n\n\t\t<NcSelect\n\t\t\t:modelValue=\"verticalAlign\"\n\t\t\t:options=\"verticalAlignOptions\"\n\t\t\t:inputLabel=\"t('nextcloud-vue', 'Vertical alignment')\"\n\t\t\t:reduce=\"(option) => option.value\"\n\t\t\tlabel=\"label\"\n\t\t\t:clearable=\"false\"\n\t\t\t@update:modelValue=\"updateField('verticalAlign', $event)\" />\n\n\t\t<!-- The banner fills its dashboard grid cell, so a fixed Height preset\n\t\t no longer changes anything — resize the widget on the grid instead.\n\t\t (The `height` field is kept in the saved content for back-compat\n\t\t but is no longer surfaced as a control.) -->\n\n\t\t<fieldset class=\"cn-header-widget-form__fieldset\">\n\t\t\t<legend class=\"cn-header-widget-form__legend\">\n\t\t\t\t{{ t('nextcloud-vue', 'Call-to-action button (optional)') }}\n\t\t\t</legend>\n\n\t\t\t<NcTextField\n\t\t\t\t:modelValue=\"ctaLabel\"\n\t\t\t\t:label=\"t('nextcloud-vue', 'Button text')\"\n\t\t\t\t:placeholder=\"t('nextcloud-vue', 'Sign up')\"\n\t\t\t\t@update:modelValue=\"updateCta('label', $event)\" />\n\n\t\t\t<NcTextField\n\t\t\t\t:modelValue=\"ctaUrl\"\n\t\t\t\t:label=\"t('nextcloud-vue', 'Target URL')\"\n\t\t\t\tplaceholder=\"https://...\"\n\t\t\t\t@update:modelValue=\"updateCta('url', $event)\" />\n\n\t\t\t<NcSelect\n\t\t\t\t:modelValue=\"ctaStyle\"\n\t\t\t\t:options=\"ctaStyleOptions\"\n\t\t\t\t:inputLabel=\"t('nextcloud-vue', 'Button style')\"\n\t\t\t\t:reduce=\"(option) => option.value\"\n\t\t\t\tlabel=\"label\"\n\t\t\t\t:clearable=\"false\"\n\t\t\t\t@update:modelValue=\"updateCta('style', $event)\" />\n\t\t</fieldset>\n\t</div>\n</template>\n\n<script>\nimport { translate as t } from '@nextcloud/l10n'\nimport { NcButton, NcCheckboxRadioSwitch, NcSelect, NcTextField } from '@nextcloud/vue'\nimport CnColorPicker from '../CnColorPicker/CnColorPicker.vue'\nimport { embedAsDataUrl, extractTransportUrl, readFileAsDataUrl, warnUploadFnDeprecated } from '../../utils/widgetUpload.js'\n\nconst ALLOWED_OVERLAY_MODES = ['none', 'tint', 'gradient-bottom']\nconst ALLOWED_HEIGHTS = ['small', 'medium', 'large', 'xlarge']\nconst ALLOWED_TEXT_ALIGN = ['left', 'center', 'right']\nconst ALLOWED_VERTICAL_ALIGN = ['top', 'middle', 'bottom']\nconst ALLOWED_CTA_STYLES = ['primary', 'secondary', 'ghost']\n\nconst DEFAULT_CONTENT = Object.freeze({\n\ttitle: '',\n\tsubtitle: '',\n\tbackgroundImageUrl: '',\n\tbackgroundImageFileId: null,\n\tbackgroundColor: '',\n\toverlayColor: '',\n\toverlayOpacity: 0.4,\n\ttextColor: '',\n\ttextAlign: 'center',\n\tverticalAlign: 'middle',\n\theight: 'medium',\n\tcta: null,\n})\n\n/**\n * CnHeaderWidgetForm — the `CnAddWidgetModal` sub-form for creating or editing\n * a `header` widget placement (renderer: `CnHeaderWidget`).\n *\n * Controls cover every persisted field: title, subtitle, background image URL,\n * background colour, overlay mode/colour/opacity, text colour/alignment/\n * vertical alignment, height preset, and an optional call-to-action with\n * label, URL, and style. `validate()` requires `title`, requires any provided\n * `backgroundImageUrl` to be http(s), and flags a half-filled CTA (label XOR\n * url). Emits `update:content` with the assembled blob on change.\n */\nexport default {\n\tname: 'CnHeaderWidgetForm',\n\n\tcomponents: {\n\t\tNcTextField,\n\t\tNcSelect,\n\t\tNcButton,\n\t\tNcCheckboxRadioSwitch,\n\t\tCnColorPicker,\n\t},\n\n\tprops: {\n\t\t/**\n\t\t * The placement being edited, or `null` in create mode.\n\t\t *\n\t\t * @type {{content: object}|null}\n\t\t */\n\t\teditingWidget: {\n\t\t\ttype: Object,\n\t\t\tdefault: null,\n\t\t},\n\n\t\t/**\n\t\t * Initial content values — used when not editing and the parent\n\t\t * supplies registry defaults.\n\t\t *\n\t\t * @type {object}\n\t\t */\n\t\tvalue: {\n\t\t\ttype: Object,\n\t\t\tdefault: () => ({ ...DEFAULT_CONTENT }),\n\t\t},\n\n\t\t/**\n\t\t * Optional raw-file upload transport: `async (file: File) => ({ url })`.\n\t\t * Named `fileUploadFn` (not `uploadFn`) to match `CnAddWidgetModal`'s\n\t\t * File-typed sub-form transport. Called by `commit()` on submit (never on\n\t\t * file selection) with the raw picked `File`; the returned hosted URL is\n\t\t * stored as `backgroundImageUrl`. When omitted, the file is embedded as a\n\t\t * data URL on commit instead (same-origin, so it isn't blocked by the CSP\n\t\t * the way external http(s) URLs are) — but only when the raw file is ≤ 1 MB\n\t\t * (~1.37 MB once base64-encoded and stored) so a huge inline blob can't\n\t\t * freeze the tab. Wire a transport for anything larger.\n\t\t *\n\t\t * @type {((file: File) => Promise<{ url: string }>)|null}\n\t\t */\n\t\tfileUploadFn: {\n\t\t\ttype: Function,\n\t\t\tdefault: null,\n\t\t},\n\n\t\t/**\n\t\t * Legacy base64 upload transport, superseded by `fileUploadFn`.\n\t\t *\n\t\t * @deprecated Use `fileUploadFn` instead. Legacy base64 transport\n\t\t * `async (dataUrl: string) => ({ url })`, kept for backward compatibility.\n\t\t * When `fileUploadFn` is not set but this is, `commit()` reads the file to\n\t\t * a data URL and hands that to this function (emitting a one-time\n\t\t * console.warn). `fileUploadFn` takes precedence when both are provided.\n\t\t *\n\t\t * @type {((dataUrl: string) => Promise<{ url: string }>)|null}\n\t\t */\n\t\tuploadFn: {\n\t\t\ttype: Function,\n\t\t\tdefault: null,\n\t\t},\n\t},\n\n\temits: [\n\t\t/**\n\t\t * Emitted with the assembled content blob on every field change.\n\t\t *\n\t\t * @event update:content\n\t\t * @type {object}\n\t\t */\n\t\t'update:content',\n\t],\n\n\tdata() {\n\t\tconst initial = (this.editingWidget && this.editingWidget.content) || this.value || {}\n\t\tconst cta = (initial.cta && typeof initial.cta === 'object') ? initial.cta : null\n\t\treturn {\n\t\t\ttitle: typeof initial.title === 'string' ? initial.title : DEFAULT_CONTENT.title,\n\t\t\tsubtitle: typeof initial.subtitle === 'string' ? initial.subtitle : DEFAULT_CONTENT.subtitle,\n\t\t\tgreeting: initial.greeting === true || initial.greeting === 'full' || initial.greeting === 'first',\n\t\t\t// `\"full\"` (whole display name) is a manifest choice; kept as written.\n\t\t\tgreetingMode: initial.greeting === 'full' ? 'full' : true,\n\t\t\tshowDate: initial.showDate === true,\n\t\t\tplain: initial.plain === true,\n\t\t\tbackgroundImageUrl: typeof initial.backgroundImageUrl === 'string'\n\t\t\t\t? initial.backgroundImageUrl\n\t\t\t\t: DEFAULT_CONTENT.backgroundImageUrl,\n\n\t\t\tbackgroundImageFileId: (typeof initial.backgroundImageFileId === 'number')\n\t\t\t\t? initial.backgroundImageFileId\n\t\t\t\t: DEFAULT_CONTENT.backgroundImageFileId,\n\n\t\t\tbackgroundColor: typeof initial.backgroundColor === 'string'\n\t\t\t\t? initial.backgroundColor\n\t\t\t\t: DEFAULT_CONTENT.backgroundColor,\n\n\t\t\t// Empty until chosen: an unset mode is stored as no value, so the\n\t\t\t// renderer keeps its default (`tint` over an image, else `none`).\n\t\t\toverlayMode: ALLOWED_OVERLAY_MODES.includes(initial.overlayMode)\n\t\t\t\t? initial.overlayMode\n\t\t\t\t: '',\n\n\t\t\toverlayColor: typeof initial.overlayColor === 'string'\n\t\t\t\t? initial.overlayColor\n\t\t\t\t: DEFAULT_CONTENT.overlayColor,\n\n\t\t\toverlayOpacity: typeof initial.overlayOpacity === 'number'\n\t\t\t\t? initial.overlayOpacity\n\t\t\t\t: DEFAULT_CONTENT.overlayOpacity,\n\n\t\t\ttextColor: typeof initial.textColor === 'string'\n\t\t\t\t? initial.textColor\n\t\t\t\t: DEFAULT_CONTENT.textColor,\n\n\t\t\ttextAlign: ALLOWED_TEXT_ALIGN.includes(initial.textAlign)\n\t\t\t\t? initial.textAlign\n\t\t\t\t: DEFAULT_CONTENT.textAlign,\n\n\t\t\tverticalAlign: ALLOWED_VERTICAL_ALIGN.includes(initial.verticalAlign)\n\t\t\t\t? initial.verticalAlign\n\t\t\t\t: DEFAULT_CONTENT.verticalAlign,\n\n\t\t\theight: ALLOWED_HEIGHTS.includes(initial.height)\n\t\t\t\t? initial.height\n\t\t\t\t: DEFAULT_CONTENT.height,\n\n\t\t\tctaLabel: cta && typeof cta.label === 'string' ? cta.label : '',\n\t\t\tctaUrl: cta && typeof cta.url === 'string' ? cta.url : '',\n\t\t\tctaStyle: (cta && ALLOWED_CTA_STYLES.includes(cta.style)) ? cta.style : 'primary',\n\t\t\tuploading: false,\n\t\t\tuploadError: '',\n\t\t\t// The picked-but-not-yet-uploaded file. Upload is deferred to commit()\n\t\t\t// so nothing is written on selection.\n\t\t\tpendingFile: null,\n\t\t}\n\t},\n\n\tcomputed: {\n\t\t/**\n\t\t * The overlay mode the select shows and the overlay fields follow: the\n\t\t * chosen one, else the renderer's default (`tint` over an image).\n\t\t *\n\t\t * @return {string} `none`, `tint` or `gradient-bottom`.\n\t\t */\n\t\teffectiveOverlayMode() {\n\t\t\tif (this.overlayMode) {\n\t\t\t\treturn this.overlayMode\n\t\t\t}\n\t\t\treturn this.backgroundImageUrl || this.backgroundImageFileId !== null || this.pendingFile ? 'tint' : 'none'\n\t\t},\n\n\t\t/** Overlay-mode select options. */\n\t\toverlayModeOptions() {\n\t\t\treturn [\n\t\t\t\t{ value: 'none', label: t('nextcloud-vue', 'None') },\n\t\t\t\t{ value: 'tint', label: t('nextcloud-vue', 'Tinted overlay') },\n\t\t\t\t{ value: 'gradient-bottom', label: t('nextcloud-vue', 'Gradient bottom') },\n\t\t\t]\n\t\t},\n\n\t\t/** Text-alignment select options. */\n\t\ttextAlignOptions() {\n\t\t\treturn [\n\t\t\t\t{ value: 'left', label: t('nextcloud-vue', 'Left') },\n\t\t\t\t{ value: 'center', label: t('nextcloud-vue', 'Center') },\n\t\t\t\t{ value: 'right', label: t('nextcloud-vue', 'Right') },\n\t\t\t]\n\t\t},\n\n\t\t/** Vertical-alignment select options. */\n\t\tverticalAlignOptions() {\n\t\t\treturn [\n\t\t\t\t{ value: 'top', label: t('nextcloud-vue', 'Top') },\n\t\t\t\t{ value: 'middle', label: t('nextcloud-vue', 'Middle') },\n\t\t\t\t{ value: 'bottom', label: t('nextcloud-vue', 'Bottom') },\n\t\t\t]\n\t\t},\n\n\t\t/** Height-preset select options. */\n\t\theightOptions() {\n\t\t\treturn [\n\t\t\t\t{ value: 'small', label: t('nextcloud-vue', 'Small (120px)') },\n\t\t\t\t{ value: 'medium', label: t('nextcloud-vue', 'Medium (200px)') },\n\t\t\t\t{ value: 'large', label: t('nextcloud-vue', 'Large (320px)') },\n\t\t\t\t{ value: 'xlarge', label: t('nextcloud-vue', 'Extra large (480px)') },\n\t\t\t]\n\t\t},\n\n\t\t/** CTA-style select options. */\n\t\tctaStyleOptions() {\n\t\t\treturn [\n\t\t\t\t{ value: 'primary', label: t('nextcloud-vue', 'Primary') },\n\t\t\t\t{ value: 'secondary', label: t('nextcloud-vue', 'Secondary') },\n\t\t\t\t{ value: 'ghost', label: t('nextcloud-vue', 'Ghost') },\n\t\t\t]\n\t\t},\n\n\t\t/** The assembled CTA object, or null when both fields are empty. */\n\t\tctaPayload() {\n\t\t\tconst label = typeof this.ctaLabel === 'string' ? this.ctaLabel.trim() : ''\n\t\t\tconst url = typeof this.ctaUrl === 'string' ? this.ctaUrl.trim() : ''\n\t\t\tif (label === '' && url === '') {\n\t\t\t\treturn null\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tlabel,\n\t\t\t\turl,\n\t\t\t\tstyle: this.ctaStyle,\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * The greeting keys, written only when they are on, so a header that\n\t\t * never used them keeps the content blob it always had.\n\t\t *\n\t\t * @return {object}\n\t\t * @spec openspec/changes/workplace-dashboard-primitives/specs/workplace-dashboard-primitives/spec.md#requirement-greeting-header\n\t\t */\n\t\tgreetingContent() {\n\t\t\tconst content = {}\n\t\t\tif (this.greeting) {\n\t\t\t\tcontent.greeting = this.greetingMode\n\t\t\t}\n\t\t\tif (this.showDate) {\n\t\t\t\tcontent.showDate = true\n\t\t\t}\n\t\t\tif (this.plain) {\n\t\t\t\tcontent.plain = true\n\t\t\t}\n\t\t\treturn content\n\t\t},\n\n\t\t/**\n\t\t * The full content blob assembled from the current field values.\n\t\t *\n\t\t * @spec openspec/changes/workplace-dashboard-primitives/specs/workplace-dashboard-primitives/spec.md#requirement-greeting-header\n\t\t */\n\t\tassembledContent() {\n\t\t\treturn {\n\t\t\t\t...this.greetingContent,\n\t\t\t\ttitle: this.title,\n\t\t\t\tsubtitle: this.subtitle,\n\t\t\t\tbackgroundImageUrl: this.backgroundImageUrl,\n\t\t\t\tbackgroundImageFileId: this.backgroundImageFileId,\n\t\t\t\tbackgroundColor: this.backgroundColor,\n\t\t\t\t...(this.overlayMode ? { overlayMode: this.overlayMode } : {}),\n\t\t\t\toverlayColor: this.overlayColor,\n\t\t\t\toverlayOpacity: this.overlayOpacity,\n\t\t\t\ttextColor: this.textColor,\n\t\t\t\ttextAlign: this.textAlign,\n\t\t\t\tverticalAlign: this.verticalAlign,\n\t\t\t\theight: this.height,\n\t\t\t\tcta: this.ctaPayload,\n\t\t\t}\n\t\t},\n\t},\n\n\tmethods: {\n\t\tt,\n\n\t\t/**\n\t\t * Set a top-level field and re-emit the assembled payload.\n\t\t *\n\t\t * @param {string} field one of the top-level content keys.\n\t\t * @param {unknown} value the new value.\n\t\t * @return {void}\n\t\t */\n\t\tupdateField(field, value) {\n\t\t\tthis[field] = value\n\t\t\tthis.$emit('update:content', this.assembledContent)\n\t\t},\n\n\t\t/**\n\t\t * Hold the picked file for a deferred upload. Does NOT upload — that\n\t\t * happens in commit() when the host modal submits, so re-picking or\n\t\t * cancelling writes nothing.\n\t\t *\n\t\t * @param {Event} event the file-input change event.\n\t\t * @return {void}\n\t\t *\n\t\t * @spec openspec/changes/cn-widget-library/specs/cn-widget-library/spec.md\n\t\t */\n\t\thandleFileSelect(event) {\n\t\t\tconst file = event.target.files && event.target.files[0]\n\t\t\tif (!file) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tthis.uploadError = ''\n\t\t\tthis.pendingFile = file\n\t\t\tthis.resetFileInput()\n\t\t},\n\n\t\t/**\n\t\t * Upload the pending file (if any) and store it as backgroundImageUrl.\n\t\t * Called by the host modal on submit. A no-op when no file is pending, so\n\t\t * editing without changing the image keeps the existing value.\n\t\t *\n\t\t * @return {Promise<void>} resolves once the URL is set.\n\t\t * @throws {Error} when the upload fails, so the modal can block submit.\n\t\t *\n\t\t * @spec openspec/changes/cn-widget-library/specs/cn-widget-library/spec.md\n\t\t */\n\t\tasync commit() {\n\t\t\tif (this.pendingFile === null) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tthis.uploadError = ''\n\t\t\tthis.uploading = true\n\t\t\ttry {\n\t\t\t\tlet resolvedUrl\n\t\t\t\tif (typeof this.fileUploadFn === 'function') {\n\t\t\t\t\tresolvedUrl = extractTransportUrl(await this.fileUploadFn(this.pendingFile))\n\t\t\t\t} else if (typeof this.uploadFn === 'function') {\n\t\t\t\t\t// Deprecated path: the legacy uploadFn expects a base64 data URL.\n\t\t\t\t\twarnUploadFnDeprecated('CnHeaderWidgetForm')\n\t\t\t\t\tconst dataUrl = await readFileAsDataUrl(this.pendingFile)\n\t\t\t\t\tresolvedUrl = extractTransportUrl(await this.uploadFn(dataUrl))\n\t\t\t\t} else {\n\t\t\t\t\tresolvedUrl = await embedAsDataUrl(this.pendingFile)\n\t\t\t\t}\n\t\t\t\tthis.pendingFile = null\n\t\t\t\tthis.updateField('backgroundImageUrl', resolvedUrl)\n\t\t\t} catch (err) {\n\t\t\t\tthis.uploadError = (err && err.message) || t('nextcloud-vue', 'Failed to upload image')\n\t\t\t\t// eslint-disable-next-line no-console\n\t\t\t\tconsole.error('Header image upload failed:', err)\n\t\t\t\tthrow err\n\t\t\t} finally {\n\t\t\t\tthis.uploading = false\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Discard the pending file, re-enabling the URL field. Called by the\n\t\t * Remove button.\n\t\t *\n\t\t * @return {void}\n\t\t *\n\t\t * @spec openspec/changes/cn-widget-library/specs/cn-widget-library/spec.md\n\t\t */\n\t\tclearPendingFile() {\n\t\t\tthis.pendingFile = null\n\t\t\tthis.uploadError = ''\n\t\t\tthis.resetFileInput()\n\t\t},\n\n\t\t/**\n\t\t * Clear the native file input so re-selecting the same file re-fires.\n\t\t *\n\t\t * @return {void}\n\t\t */\n\t\tresetFileInput() {\n\t\t\tif (this.$refs.fileInput) {\n\t\t\t\tthis.$refs.fileInput.value = ''\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Set a CTA sub-field (label, url, style) and re-emit.\n\t\t *\n\t\t * @param {string} field one of: label, url, style.\n\t\t * @param {string} value the new value.\n\t\t * @return {void}\n\t\t */\n\t\tupdateCta(field, value) {\n\t\t\tif (field === 'label') {\n\t\t\t\tthis.ctaLabel = value\n\t\t\t} else if (field === 'url') {\n\t\t\t\tthis.ctaUrl = value\n\t\t\t} else if (field === 'style') {\n\t\t\t\tthis.ctaStyle = value\n\t\t\t}\n\t\t\tthis.$emit('update:content', this.assembledContent)\n\t\t},\n\n\t\t/**\n\t\t * Validate the form; an empty array means valid. Requires a title,\n\t\t * an http(s) background image URL when provided, and a complete CTA\n\t\t * when either CTA field is filled.\n\t\t *\n\t\t * @return {string[]} the validation errors.\n\t\t * @spec openspec/changes/workplace-dashboard-primitives/specs/workplace-dashboard-primitives/spec.md#requirement-greeting-header\n\t\t */\n\t\tvalidate() {\n\t\t\tconst errors = []\n\t\t\t// A greeting is the heading, so a greeting header needs no title.\n\t\t\tif (!this.greeting && (typeof this.title !== 'string' || this.title.trim() === '')) {\n\t\t\t\terrors.push(t('nextcloud-vue', 'Title is required'))\n\t\t\t}\n\t\t\tif (typeof this.backgroundImageUrl === 'string'\n\t\t\t\t&& this.backgroundImageUrl.trim() !== ''\n\t\t\t\t&& /^(https?:\\/\\/|data:|blob:|\\/)/i.test(this.backgroundImageUrl.trim()) === false) {\n\t\t\t\terrors.push(t('nextcloud-vue', 'Background image must be a URL or an uploaded image'))\n\t\t\t}\n\t\t\tconst labelEmpty = typeof this.ctaLabel !== 'string' || this.ctaLabel.trim() === ''\n\t\t\tconst urlEmpty = typeof this.ctaUrl !== 'string' || this.ctaUrl.trim() === ''\n\t\t\tif (labelEmpty !== urlEmpty) {\n\t\t\t\terrors.push(t('nextcloud-vue', 'Call-to-action requires both label and URL'))\n\t\t\t}\n\t\t\treturn errors\n\t\t},\n\t},\n}\n</script>\n\n<style scoped>\n.cn-header-widget-form {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 12px;\n}\n\n.cn-header-widget-form__field {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 4px;\n\tfont-size: 14px;\n}\n\n.cn-header-widget-form__label {\n\tfont-weight: 500;\n}\n\n.cn-header-widget-form__color-label {\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: space-between;\n\tgap: 12px;\n\tfont-size: 14px;\n}\n\n.cn-header-widget-form__upload-row {\n\tdisplay: flex;\n\talign-items: center;\n\tgap: 8px;\n}\n\n.cn-header-widget-form__upload-label {\n\tdisplay: inline-flex;\n\tcursor: pointer;\n}\n\n.cn-header-widget-form__pending {\n\tmargin: 0;\n\tfont-size: 12px;\n\tcolor: var(--color-text-maxcontrast);\n}\n\n.cn-header-widget-form__file-input {\n\tdisplay: none;\n}\n\n.cn-header-widget-form__upload-button {\n\tpadding: 8px 12px;\n\tborder: 1px solid var(--color-border);\n\tborder-radius: var(--border-radius);\n\tbackground-color: var(--color-background-hover);\n\tfont-size: 14px;\n}\n\n.cn-header-widget-form__upload-label:hover .cn-header-widget-form__upload-button {\n\tbackground-color: var(--color-background-dark);\n}\n\n.cn-header-widget-form__error {\n\tmargin: 0;\n\tfont-size: 12px;\n\tcolor: var(--color-error);\n}\n\n.cn-header-widget-form__color {\n\twidth: 48px;\n\theight: 32px;\n\tpadding: 0;\n\tborder: 1px solid var(--color-border);\n\tborder-radius: var(--border-radius);\n\tcursor: pointer;\n\tbackground: transparent;\n}\n\n.cn-header-widget-form__range {\n\twidth: 100%;\n}\n\n.cn-header-widget-form__fieldset {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 8px;\n\tborder: 1px solid var(--color-border);\n\tborder-radius: var(--border-radius);\n\tpadding: 12px;\n}\n\n.cn-header-widget-form__legend {\n\tfont-size: 13px;\n\tfont-weight: 600;\n\tpadding: 0 4px;\n}\n</style>\n"],"names":["CnCol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AAI,KAAM,QAAO,IAAK,IAAI,CAAC,KAAK,CAAC,IAAI,EAAC,KAAM,EAAE,CAAC,EAAE;IACnF,MAAM,CAAC,IAAI,CAACA,SAAC,CAAC,eAAe,EAAE,mBAAmB,CAAC;AACpD,GAAA;AACA,GAAA,IAAI,OAAO,IAAI,CAAC,kBAAiB,KAAM;AACtC,OAAG,IAAI,CAAC,kBAAkB,CAAC,IAAI,EAAC,KAAM;AACtC,OAAG,gCAAgC,CAAC,IAAI,CAAC,IAAI,CAAC,kBAAkB,CAAC,IAAI,EAAE,CAAA,KAAM,KAAK,EAAE;AACpF,IAAA,MAAM,CAAC,IAAI,CAACA,SAAC,CAAC,eAAe,EAAE,qDAAqD,CAAC;AACtF,GAAA;AACA,GAAA,MAAM,aAAa,OAAO,IAAI,CAAC,QAAO,KAAM,QAAO,IAAK,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAC,KAAM;AACjF,GAAA,MAAM,QAAO,GAAI,OAAO,IAAI,CAAC,WAAW,QAAO,IAAK,IAAI,CAAC,MAAM,CAAC,IAAI,EAAC,KAAM;GAC3E,IAAI,eAAe,QAAQ,EAAE;AAC5B,IAAA,MAAM,CAAC,IAAI,CAACA,SAAC,CAAC,eAAe,EAAE,4CAA4C,CAAC;AAC7E,GAAA;GACA,OAAO;EACR,CAAC;EACD;AACF;;"}
@@ -126,7 +126,7 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
126
126
  }, null, 8 /* PROPS */, ["value"])
127
127
  ]),
128
128
  createVNode(_component_NcSelect, {
129
- modelValue: $data.overlayMode,
129
+ modelValue: $options.effectiveOverlayMode,
130
130
  options: $options.overlayModeOptions,
131
131
  inputLabel: $options.t('nextcloud-vue', 'Overlay mode'),
132
132
  reduce: (option) => option.value,
@@ -134,7 +134,7 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
134
134
  clearable: false,
135
135
  "onUpdate:modelValue": _cache[9] || (_cache[9] = $event => ($options.updateField('overlayMode', $event)))
136
136
  }, null, 8 /* PROPS */, ["modelValue", "options", "inputLabel", "reduce"]),
137
- ($data.overlayMode !== 'none')
137
+ ($options.effectiveOverlayMode !== 'none')
138
138
  ? (openBlock(), createElementBlock("label", _hoisted_9, [
139
139
  createTextVNode(toDisplayString($options.t('nextcloud-vue', 'Overlay color')) + " ", 1 /* TEXT */),
140
140
  createVNode(_component_CnColorPicker, {
@@ -145,7 +145,7 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
145
145
  }, null, 8 /* PROPS */, ["value"])
146
146
  ]))
147
147
  : createCommentVNode("v-if", true),
148
- ($data.overlayMode === 'tint')
148
+ ($options.effectiveOverlayMode === 'tint')
149
149
  ? (openBlock(), createElementBlock("label", _hoisted_10, [
150
150
  createElementVNode("span", _hoisted_11, toDisplayString($options.t('nextcloud-vue', 'Overlay opacity')) + " (" + toDisplayString($data.overlayOpacity.toFixed(2)) + ") ", 1 /* TEXT */),
151
151
  createElementVNode("input", {