@conduction/nextcloud-vue 2.185.0 → 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 (68) 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/CnTabsWidget/CnTabsWidget.vue.js +1 -1
  25. package/dist/esm/components/CnTabsWidget/CnTabsWidget2.vue.js +7 -0
  26. package/dist/esm/components/CnTabsWidget/CnTabsWidget2.vue.js.map +1 -1
  27. package/dist/esm/components/CnTabsWidget/CnTabsWidget3.vue.js.map +1 -1
  28. package/dist/esm/components/CnVideoWidget/CnVideoWidget.vue.js +1 -1
  29. package/dist/esm/components/CnVideoWidget/CnVideoWidget2.vue.js +63 -1
  30. package/dist/esm/components/CnVideoWidget/CnVideoWidget2.vue.js.map +1 -1
  31. package/dist/esm/components/CnVideoWidget/CnVideoWidget3.vue.js +20 -10
  32. package/dist/esm/components/CnVideoWidget/CnVideoWidget3.vue.js.map +1 -1
  33. package/dist/esm/components/CnVideoWidgetForm/CnVideoWidgetForm.vue.js +1 -1
  34. package/dist/esm/components/CnVideoWidgetForm/CnVideoWidgetForm2.vue.js +15 -0
  35. package/dist/esm/components/CnVideoWidgetForm/CnVideoWidgetForm2.vue.js.map +1 -1
  36. package/dist/esm/components/CnVideoWidgetForm/CnVideoWidgetForm3.vue.js +17 -10
  37. package/dist/esm/components/CnVideoWidgetForm/CnVideoWidgetForm3.vue.js.map +1 -1
  38. package/dist/esm/components/CnWidgetGrid/dashboardWidgetRegistry.js +1 -0
  39. package/dist/esm/components/CnWidgetGrid/dashboardWidgetRegistry.js.map +1 -1
  40. package/dist/esm/dialogs/CnAddWidgetModal.vue.js +1 -1
  41. package/dist/esm/dialogs/CnAddWidgetModal2.vue.js +18 -4
  42. package/dist/esm/dialogs/CnAddWidgetModal2.vue.js.map +1 -1
  43. package/dist/esm/dialogs/CnAddWidgetModal3.vue.js +57 -39
  44. package/dist/esm/dialogs/CnAddWidgetModal3.vue.js.map +1 -1
  45. package/dist/esm/l10n/en.json.js +96 -1
  46. package/dist/esm/l10n/en.json.js.map +1 -1
  47. package/dist/esm/l10n/nl.json.js +96 -1
  48. package/dist/esm/l10n/nl.json.js.map +1 -1
  49. package/dist/esm/library-style.js +1 -1
  50. package/dist/esm/nextcloud-vue.css +257 -140
  51. package/dist/nextcloud-vue.cjs.js +2305 -1603
  52. package/dist/nextcloud-vue.cjs.js.map +2 -2
  53. package/dist/nextcloud-vue.css +257 -140
  54. package/l10n/en.json +96 -1
  55. package/l10n/nl.json +96 -1
  56. package/package.json +1 -1
  57. package/src/components/CnCalendarWidget/CnCalendarWidget.vue +217 -75
  58. package/src/components/CnDashboardGrid/CnDashboardGrid.md +1 -1
  59. package/src/components/CnDashboardGrid/CnDashboardGrid.vue +41 -16
  60. package/src/components/CnDividerWidget/index.js +1 -0
  61. package/src/components/CnFilesWidget/CnFilesWidget.vue +278 -5
  62. package/src/components/CnHeaderWidget/index.js +0 -1
  63. package/src/components/CnHeaderWidgetForm/CnHeaderWidgetForm.vue +20 -6
  64. package/src/components/CnTabsWidget/CnTabsWidget.vue +7 -0
  65. package/src/components/CnVideoWidget/CnVideoWidget.vue +84 -1
  66. package/src/components/CnVideoWidgetForm/CnVideoWidgetForm.vue +19 -1
  67. package/src/components/CnWidgetGrid/dashboardWidgetRegistry.js +1 -0
  68. package/src/dialogs/CnAddWidgetModal.vue +53 -14
@@ -1 +1 @@
1
- {"version":3,"file":"CnVideoWidget2.vue.js","sources":["../../../../src/components/CnVideoWidget/CnVideoWidget.vue"],"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-video-widget\"\n\t\t:style=\"wrapperStyle\">\n\t\t<div v-if=\"!hasSource\" class=\"cn-video-widget__placeholder\">\n\t\t\t<VideoIcon :size=\"48\" :fillColor=\"placeholderColor\" />\n\t\t\t<span class=\"cn-video-widget__placeholder-label\">{{ t('nextcloud-vue', 'No video URL configured') }}</span>\n\t\t</div>\n\t\t<div v-else-if=\"hasError\" class=\"cn-video-widget__placeholder\">\n\t\t\t<VideoIcon :size=\"48\" :fillColor=\"placeholderColor\" />\n\t\t\t<span class=\"cn-video-widget__placeholder-label\">{{ errorMessage }}</span>\n\t\t</div>\n\t\t<div\n\t\t\tv-else\n\t\t\tclass=\"cn-video-widget__media\"\n\t\t\t:style=\"mediaStyle\">\n\t\t\t<iframe\n\t\t\t\tv-if=\"isIframeSource\"\n\t\t\t\tclass=\"cn-video-widget__iframe\"\n\t\t\t\t:src=\"embedUrl\"\n\t\t\t\tsandbox=\"allow-scripts allow-same-origin allow-presentation\"\n\t\t\t\treferrerpolicy=\"strict-origin-when-cross-origin\"\n\t\t\t\tallowfullscreen\n\t\t\t\tframeborder=\"0\" />\n\t\t\t<video\n\t\t\t\tv-else-if=\"isFileSource\"\n\t\t\t\tclass=\"cn-video-widget__video\"\n\t\t\t\t:src=\"fileStreamingUrl\"\n\t\t\t\t:poster=\"posterUrl || null\"\n\t\t\t\t:autoplay=\"effectiveAutoplay\"\n\t\t\t\t:muted=\"effectiveMuted\"\n\t\t\t\t:loop=\"loop\"\n\t\t\t\t:controls=\"controls\"\n\t\t\t\t@error=\"onVideoError\" />\n\t\t</div>\n\t</div>\n</template>\n\n<script>\nimport { translate as t } from '@nextcloud/l10n'\nimport VideoIcon from 'vue-material-design-icons/Video.vue'\n\nconst VALID_SOURCE_TYPES = ['youtube', 'vimeo', 'peertube', 'nc-file']\nconst VALID_ASPECT_RATIOS = ['16:9', '4:3', '1:1', '9:16']\nconst DEFAULT_ASPECT_RATIO = '16:9'\n\n/**\n * CnVideoWidget renders an embedded video inside a dashboard cell. It\n * dispatches on `content.sourceType` to one of three render branches:\n *\n * - `youtube` / `vimeo` / `peertube` → sandboxed `<iframe>` whose `src` is\n * the canonical embed URL stored in `content.videoUrl`.\n * - `nc-file` → HTML5 `<video>` whose `src` is `content.fileStreamingUrl`\n * (resolved upstream).\n * - anything else / missing source / render error → a centered placeholder.\n *\n * Autoplay forces muted=true because browsers block autoplay of unmuted media.\n * Aspect ratio uses the CSS `aspect-ratio` property; `16:9`, `4:3`, `1:1`, and\n * `9:16` are supported and unknown values fall back to `16:9`.\n *\n * The iframe sets `referrerpolicy=\"strict-origin-when-cross-origin\"` because\n * Nextcloud's own default security headers send `Referrer-Policy: no-referrer`\n * — without an explicit override the iframe inherits that and YouTube's\n * player rejects the request with \"Error 153: Video player configuration\n * error\" (it requires a referrer to validate the embed).\n *\n * @spec openspec/changes/cn-widget-library/specs/cn-widget-library/spec.md\n */\nexport default {\n\tname: 'CnVideoWidget',\n\n\tcomponents: {\n\t\tVideoIcon,\n\t},\n\n\tprops: {\n\t\t/**\n\t\t * Persisted content blob `{sourceType, videoUrl, fileId,\n\t\t * fileStreamingUrl, autoplay, muted, loop, controls, aspectRatio,\n\t\t * posterUrl, error}`. `videoUrl` is the canonical embed URL;\n\t\t * `error` (when set) triggers the error placeholder.\n\t\t *\n\t\t * @type {object}\n\t\t */\n\t\tcontent: {\n\t\t\ttype: Object,\n\t\t\tdefault: () => ({}),\n\t\t},\n\n\t\t/* eslint-disable vue/no-unused-properties -- part of the widget contract: CnContainerChild and the dashboard pages bind :placement on every widget, so declaring it keeps it out of $attrs */\n\t\t/** The placement record (reserved — kept to match the renderer contract). */\n\t\tplacement: {\n\t\t\ttype: Object,\n\t\t\tdefault: null,\n\t\t},\n\t\t/* eslint-enable vue/no-unused-properties */\n\t},\n\n\tdata() {\n\t\treturn {\n\t\t\t// Set when the HTML5 <video> fires an error so subsequent renders\n\t\t\t// show the error placeholder rather than a broken element.\n\t\t\tvideoLoadFailed: false,\n\t\t}\n\t},\n\n\tcomputed: {\n\t\t/**\n\t\t * The validated source type, or `null` when unrecognised.\n\t\t *\n\t\t * @return {string|null} one of the supported source types.\n\t\t */\n\t\tsourceType() {\n\t\t\tconst raw = this.content && this.content.sourceType\n\t\t\treturn VALID_SOURCE_TYPES.includes(raw) ? raw : null\n\t\t},\n\n\t\t/**\n\t\t * The canonical embed URL string.\n\t\t *\n\t\t * @return {string} the embed URL, or `''`.\n\t\t */\n\t\tvideoUrl() {\n\t\t\tconst value = this.content && this.content.videoUrl\n\t\t\treturn typeof value === 'string' ? value : ''\n\t\t},\n\n\t\t/**\n\t\t * The resolved streaming URL for `nc-file` sources.\n\t\t *\n\t\t * @return {string} the streaming URL, or `''`.\n\t\t */\n\t\tfileStreamingUrl() {\n\t\t\tconst value = this.content && this.content.fileStreamingUrl\n\t\t\treturn typeof value === 'string' ? value : ''\n\t\t},\n\n\t\t/**\n\t\t * The Nextcloud file id for `nc-file` sources.\n\t\t *\n\t\t * @return {number|null} the file id, or `null`.\n\t\t */\n\t\tfileId() {\n\t\t\tconst value = this.content && this.content.fileId\n\t\t\treturn typeof value === 'number' && Number.isFinite(value) ? value : null\n\t\t},\n\n\t\t/**\n\t\t * Whether autoplay is requested.\n\t\t *\n\t\t * @return {boolean} the autoplay flag.\n\t\t */\n\t\tautoplay() {\n\t\t\treturn Boolean(this.content && this.content.autoplay)\n\t\t},\n\n\t\t/**\n\t\t * Whether the video is muted (defaults to true).\n\t\t *\n\t\t * @return {boolean} the muted flag.\n\t\t */\n\t\tmuted() {\n\t\t\tif (this.content && typeof this.content.muted === 'boolean') {\n\t\t\t\treturn this.content.muted\n\t\t\t}\n\t\t\treturn true\n\t\t},\n\n\t\t/**\n\t\t * Whether the video loops.\n\t\t *\n\t\t * @return {boolean} the loop flag.\n\t\t */\n\t\tloop() {\n\t\t\treturn Boolean(this.content && this.content.loop)\n\t\t},\n\n\t\t/**\n\t\t * Whether native controls are shown (defaults to true).\n\t\t *\n\t\t * @return {boolean} the controls flag.\n\t\t */\n\t\tcontrols() {\n\t\t\tif (this.content && typeof this.content.controls === 'boolean') {\n\t\t\t\treturn this.content.controls\n\t\t\t}\n\t\t\treturn true\n\t\t},\n\n\t\t/**\n\t\t * The validated aspect ratio (defaults to `16:9`).\n\t\t *\n\t\t * @return {string} one of the supported aspect ratios.\n\t\t */\n\t\taspectRatio() {\n\t\t\tconst raw = this.content && this.content.aspectRatio\n\t\t\tif (typeof raw === 'string' && VALID_ASPECT_RATIOS.includes(raw)) {\n\t\t\t\treturn raw\n\t\t\t}\n\t\t\treturn DEFAULT_ASPECT_RATIO\n\t\t},\n\n\t\t/**\n\t\t * The poster image URL for HTML5 video.\n\t\t *\n\t\t * @return {string} the poster URL, or `''`.\n\t\t */\n\t\tposterUrl() {\n\t\t\tconst value = this.content && this.content.posterUrl\n\t\t\treturn typeof value === 'string' && value.trim() !== '' ? value : ''\n\t\t},\n\n\t\t/**\n\t\t * Effective muted value — autoplay forces muted=true (browsers block\n\t\t * autoplay of unmuted media).\n\t\t *\n\t\t * @return {boolean} the muted value passed to the media element.\n\t\t */\n\t\teffectiveMuted() {\n\t\t\treturn this.autoplay ? true : this.muted\n\t\t},\n\n\t\t/**\n\t\t * Effective autoplay value — never autoplay when no source resolved.\n\t\t *\n\t\t * @return {boolean} the autoplay value passed to the media element.\n\t\t */\n\t\teffectiveAutoplay() {\n\t\t\treturn this.autoplay && this.hasSource\n\t\t},\n\n\t\t/**\n\t\t * Whether a usable source is configured.\n\t\t *\n\t\t * @return {boolean} true when the widget has something to render.\n\t\t */\n\t\thasSource() {\n\t\t\tif (this.sourceType === null) {\n\t\t\t\treturn false\n\t\t\t}\n\t\t\tif (this.sourceType === 'nc-file') {\n\t\t\t\treturn this.fileId !== null\n\t\t\t}\n\t\t\treturn this.videoUrl.trim() !== ''\n\t\t},\n\n\t\t/**\n\t\t * Whether the current source renders in an iframe.\n\t\t *\n\t\t * @return {boolean} true for youtube/vimeo/peertube.\n\t\t */\n\t\tisIframeSource() {\n\t\t\treturn ['youtube', 'vimeo', 'peertube'].includes(this.sourceType)\n\t\t},\n\n\t\t/**\n\t\t * Whether the current source renders in an HTML5 video element.\n\t\t *\n\t\t * @return {boolean} true for nc-file.\n\t\t */\n\t\tisFileSource() {\n\t\t\treturn this.sourceType === 'nc-file'\n\t\t},\n\n\t\t/**\n\t\t * Whether the widget is in an error state.\n\t\t *\n\t\t * @return {boolean} true when an error placeholder should show.\n\t\t */\n\t\thasError() {\n\t\t\tif (this.content && typeof this.content.error === 'string' && this.content.error.trim() !== '') {\n\t\t\t\treturn true\n\t\t\t}\n\t\t\tif (this.isFileSource && this.fileId !== null && this.fileStreamingUrl === '') {\n\t\t\t\treturn true\n\t\t\t}\n\t\t\treturn this.videoLoadFailed\n\t\t},\n\n\t\t/**\n\t\t * The localised error message for the error placeholder.\n\t\t *\n\t\t * @return {string} the error message.\n\t\t */\n\t\terrorMessage() {\n\t\t\tconst raw = this.content && this.content.error\n\t\t\tif (typeof raw === 'string' && raw.trim() !== '') {\n\t\t\t\treturn raw\n\t\t\t}\n\t\t\tif (this.isFileSource && this.fileId !== null && this.fileStreamingUrl === '') {\n\t\t\t\treturn t('nextcloud-vue', 'Video not accessible')\n\t\t\t}\n\t\t\tif (this.videoLoadFailed) {\n\t\t\t\treturn t('nextcloud-vue', 'Video failed to load')\n\t\t\t}\n\t\t\treturn t('nextcloud-vue', 'Invalid video URL or domain not allowed.')\n\t\t},\n\n\t\t/**\n\t\t * The iframe `src` with playback query params appended.\n\t\t *\n\t\t * @return {string} the iframe URL, or `''`.\n\t\t */\n\t\tembedUrl() {\n\t\t\tif (!this.isIframeSource || this.videoUrl === '') {\n\t\t\t\treturn ''\n\t\t\t}\n\t\t\tconst params = []\n\t\t\tif (this.autoplay) {\n\t\t\t\tparams.push('autoplay=1')\n\t\t\t\tparams.push('mute=1')\n\t\t\t} else if (this.muted) {\n\t\t\t\tparams.push('mute=1')\n\t\t\t}\n\t\t\tif (this.loop) {\n\t\t\t\tparams.push('loop=1')\n\t\t\t}\n\t\t\tif (params.length === 0) {\n\t\t\t\treturn this.videoUrl\n\t\t\t}\n\t\t\tconst separator = this.videoUrl.includes('?') ? '&' : '?'\n\t\t\treturn this.videoUrl + separator + params.join('&')\n\t\t},\n\n\t\t/**\n\t\t * The placeholder icon colour (a theme variable).\n\t\t *\n\t\t * @return {string} the CSS colour.\n\t\t */\n\t\tplaceholderColor() {\n\t\t\treturn 'var(--color-text-maxcontrast)'\n\t\t},\n\n\t\t/**\n\t\t * Inline style for the widget wrapper.\n\t\t *\n\t\t * @return {object} the wrapper style.\n\t\t */\n\t\twrapperStyle() {\n\t\t\treturn {\n\t\t\t\twidth: '100%',\n\t\t\t\theight: '100%',\n\t\t\t\toverflow: 'hidden',\n\t\t\t\tposition: 'relative',\n\t\t\t\tdisplay: 'flex',\n\t\t\t\t'align-items': 'center',\n\t\t\t\t'justify-content': 'center',\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Inline style for the media wrapper, enforcing the aspect ratio.\n\t\t *\n\t\t * @return {object} the media style.\n\t\t */\n\t\tmediaStyle() {\n\t\t\tconst [w, h] = this.aspectRatio.split(':')\n\t\t\treturn {\n\t\t\t\twidth: '100%',\n\t\t\t\t'max-width': '100%',\n\t\t\t\t'aspect-ratio': `${w} / ${h}`,\n\t\t\t\tdisplay: 'flex',\n\t\t\t\t'align-items': 'center',\n\t\t\t\t'justify-content': 'center',\n\t\t\t\tbackground: 'var(--color-background-dark)',\n\t\t\t}\n\t\t},\n\t},\n\n\twatch: {\n\t\t// Re-arm the failure flag when the source changes so a previously\n\t\t// failed file does not permanently lock the cell.\n\t\tfileStreamingUrl() {\n\t\t\tthis.videoLoadFailed = false\n\t\t},\n\n\t\tvideoUrl() {\n\t\t\tthis.videoLoadFailed = false\n\t\t},\n\t},\n\n\tmethods: {\n\t\t/**\n\t\t * HTML5 `<video>` error handler — swaps to the error placeholder. The\n\t\t * event is swallowed so no exception bubbles into the grid layer.\n\t\t *\n\t\t * @return {void}\n\t\t */\n\t\tonVideoError() {\n\t\t\tthis.videoLoadFailed = true\n\t\t},\n\t},\n}\n</script>\n\n<style scoped>\n.cn-video-widget {\n\twidth: 100%;\n\theight: 100%;\n\toverflow: hidden;\n}\n\n.cn-video-widget__media {\n\tposition: relative;\n}\n\n.cn-video-widget__iframe,\n.cn-video-widget__video {\n\twidth: 100%;\n\theight: 100%;\n\tborder: 0;\n\tdisplay: block;\n\tbackground: var(--color-background-dark);\n}\n\n.cn-video-widget__placeholder {\n\twidth: 100%;\n\theight: 100%;\n\tdisplay: flex;\n\tflex-direction: column;\n\talign-items: center;\n\tjustify-content: center;\n\tgap: 8px;\n\tcolor: var(--color-text-maxcontrast);\n\tpadding: 16px;\n\ttext-align: center;\n}\n\n.cn-video-widget__placeholder-label {\n\tfont-size: 13px;\n}\n</style>\n"],"names":["VideoIcon","t"],"mappings":";;;AA+CA,MAAM,kBAAiB,GAAI,CAAC,SAAS,EAAE,OAAO,EAAE,UAAU,EAAE,SAAS;AACrE,MAAM,mBAAkB,GAAI,CAAC,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM;AACzD,MAAM,oBAAmB,GAAI;;AAE7B;;;AAGC;;;AAGA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;;;AAIA;AACA;;AAED,aAAe;AACd,CAAA,IAAI,EAAE,eAAe;;CAErB,UAAU,EAAE;AACX,aAAAA,KAAS;EACT;;AAED,CAAA,KAAK,EAAE;AACN;;;;AAIC;AACA;;;AAGD,EAAA,OAAO,EAAE;GACR,IAAI,EAAE,MAAM;AACZ,GAAA,OAAO,EAAE,OAAO,EAAE,CAAC;GACnB;;AAED;AACA;EACA,SAAS,EAAE;GACV,IAAI,EAAE,MAAM;GACZ,OAAO,EAAE,IAAI;GACb;AACD;EACA;;AAED,CAAA,IAAI,GAAG;AACN,EAAA,OAAO;;;AAGN,GAAA,eAAe,EAAE,KAAK;AACvB;CACD,CAAC;;AAED,CAAA,QAAQ,EAAE;AACT;;AAEC;;;EAGD,UAAU,GAAG;AACZ,GAAA,MAAM,MAAM,IAAI,CAAC,OAAM,IAAK,IAAI,CAAC,OAAO,CAAC;GACzC,OAAO,kBAAkB,CAAC,QAAQ,CAAC,GAAG,CAAA,GAAI,MAAM;EACjD,CAAC;;AAED;;AAEC;AACA;;EAED,QAAQ,GAAG;AACV,GAA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K,EAAE;;AAEN;AACA,EAAA,gBAAgB,GAAG;GAClB,IAAI,CAAC,kBAAkB;EACxB,CAAC;;EAED,QAAQ,GAAG;GACV,IAAI,CAAC,kBAAkB;EACxB,CAAC;EACD;;AAED,CAAA,OAAO,EAAE;AACR;;;AAGC;;;AAGD,EAAA,YAAY,GAAG;GACd,IAAI,CAAC,eAAc,GAAI;EACxB,CAAC;EACD;AACF;;"}
1
+ {"version":3,"file":"CnVideoWidget2.vue.js","sources":["../../../../src/components/CnVideoWidget/CnVideoWidget.vue"],"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-video-widget\"\n\t\t:style=\"wrapperStyle\">\n\t\t<div v-if=\"!hasSource\" class=\"cn-video-widget__placeholder\">\n\t\t\t<VideoIcon :size=\"48\" :fillColor=\"placeholderColor\" />\n\t\t\t<span class=\"cn-video-widget__placeholder-label\">{{ t('nextcloud-vue', 'No video URL configured') }}</span>\n\t\t\t<span class=\"cn-video-widget__placeholder-help\">{{ t('nextcloud-vue', 'Edit the widget to add a video') }}</span>\n\t\t\t<button\n\t\t\t\tv-if=\"canEdit\"\n\t\t\t\ttype=\"button\"\n\t\t\t\tclass=\"cn-video-widget__configure\"\n\t\t\t\t@click=\"$emit('edit')\">\n\t\t\t\t{{ t('nextcloud-vue', 'Configure now') }}\n\t\t\t</button>\n\t\t</div>\n\t\t<div v-else-if=\"hasError\" class=\"cn-video-widget__placeholder\">\n\t\t\t<VideoIcon :size=\"48\" :fillColor=\"placeholderColor\" />\n\t\t\t<span class=\"cn-video-widget__placeholder-label\">{{ errorMessage }}</span>\n\t\t</div>\n\t\t<div\n\t\t\tv-else\n\t\t\tclass=\"cn-video-widget__media\"\n\t\t\t:style=\"mediaStyle\">\n\t\t\t<iframe\n\t\t\t\tv-if=\"isIframeSource\"\n\t\t\t\tclass=\"cn-video-widget__iframe\"\n\t\t\t\t:src=\"embedUrl\"\n\t\t\t\tsandbox=\"allow-scripts allow-same-origin allow-presentation\"\n\t\t\t\treferrerpolicy=\"strict-origin-when-cross-origin\"\n\t\t\t\tallowfullscreen\n\t\t\t\tframeborder=\"0\" />\n\t\t\t<video\n\t\t\t\tv-else-if=\"isFileSource\"\n\t\t\t\tclass=\"cn-video-widget__video\"\n\t\t\t\t:src=\"fileStreamingUrl\"\n\t\t\t\t:poster=\"posterUrl || null\"\n\t\t\t\t:autoplay=\"effectiveAutoplay\"\n\t\t\t\t:muted=\"effectiveMuted\"\n\t\t\t\t:loop=\"loop\"\n\t\t\t\t:controls=\"controls\"\n\t\t\t\t@error=\"onVideoError\" />\n\t\t</div>\n\t</div>\n</template>\n\n<script>\nimport { translate as t } from '@nextcloud/l10n'\nimport VideoIcon from 'vue-material-design-icons/Video.vue'\n\nconst VALID_SOURCE_TYPES = ['youtube', 'vimeo', 'peertube', 'nc-file']\nconst VALID_ASPECT_RATIOS = ['16:9', '4:3', '1:1', '9:16']\nconst DEFAULT_ASPECT_RATIO = '16:9'\n\n/**\n * CnVideoWidget renders an embedded video inside a dashboard cell. It\n * dispatches on `content.sourceType` to one of three render branches:\n *\n * - `youtube` / `vimeo` / `peertube` → sandboxed `<iframe>` whose `src` is\n * the canonical embed URL stored in `content.videoUrl`.\n * - `nc-file` → HTML5 `<video>` whose `src` is `content.fileStreamingUrl`\n * (resolved upstream).\n * - anything else / missing source / render error → a centered placeholder.\n *\n * Autoplay forces muted=true because browsers block autoplay of unmuted media.\n * Aspect ratio uses the CSS `aspect-ratio` property; `16:9`, `4:3`, `1:1`, and\n * `9:16` are supported and unknown values fall back to `16:9`.\n *\n * The iframe sets `referrerpolicy=\"strict-origin-when-cross-origin\"` because\n * Nextcloud's own default security headers send `Referrer-Policy: no-referrer`\n * — without an explicit override the iframe inherits that and YouTube's\n * player rejects the request with \"Error 153: Video player configuration\n * error\" (it requires a referrer to validate the embed).\n *\n * @spec openspec/changes/cn-widget-library/specs/cn-widget-library/spec.md\n */\nexport default {\n\tname: 'CnVideoWidget',\n\n\tcomponents: {\n\t\tVideoIcon,\n\t},\n\n\tprops: {\n\t\t/**\n\t\t * Persisted content blob `{sourceType, videoUrl, fileId,\n\t\t * fileStreamingUrl, autoplay, muted, loop, controls, aspectRatio,\n\t\t * posterUrl, error}`. `videoUrl` is the canonical embed URL;\n\t\t * `error` (when set) triggers the error placeholder.\n\t\t *\n\t\t * @type {object}\n\t\t */\n\t\tcontent: {\n\t\t\ttype: Object,\n\t\t\tdefault: () => ({}),\n\t\t},\n\n\t\t/**\n\t\t * Whether the viewer may edit this placement (the host's edit mode).\n\t\t * The empty state then offers \"Configure now\", which emits `edit`.\n\t\t *\n\t\t * @type {boolean}\n\t\t */\n\t\tcanEdit: {\n\t\t\ttype: Boolean,\n\t\t\tdefault: false,\n\t\t},\n\n\t\t/* eslint-disable vue/no-unused-properties -- part of the widget contract: CnContainerChild and the dashboard pages bind :placement on every widget, so declaring it keeps it out of $attrs */\n\t\t/** The placement record (reserved — kept to match the renderer contract). */\n\t\tplacement: {\n\t\t\ttype: Object,\n\t\t\tdefault: null,\n\t\t},\n\t\t/* eslint-enable vue/no-unused-properties */\n\t},\n\n\temits: [\n\t\t/**\n\t\t * \"Configure now\" was chosen in the empty state, so the host can open\n\t\t * the widget settings.\n\t\t *\n\t\t * @event edit\n\t\t */\n\t\t'edit',\n\t],\n\n\tdata() {\n\t\treturn {\n\t\t\t// Set when the HTML5 <video> fires an error so subsequent renders\n\t\t\t// show the error placeholder rather than a broken element.\n\t\t\tvideoLoadFailed: false,\n\t\t\t// The widget's own size, so a portrait ratio in a landscape cell\n\t\t\t// is fitted by its height instead of overflowing it.\n\t\t\tbox: { width: 0, height: 0 },\n\t\t}\n\t},\n\n\tcomputed: {\n\t\t/**\n\t\t * The validated source type, or `null` when unrecognised.\n\t\t *\n\t\t * @return {string|null} one of the supported source types.\n\t\t */\n\t\tsourceType() {\n\t\t\tconst raw = this.content && this.content.sourceType\n\t\t\treturn VALID_SOURCE_TYPES.includes(raw) ? raw : null\n\t\t},\n\n\t\t/**\n\t\t * The canonical embed URL string.\n\t\t *\n\t\t * @return {string} the embed URL, or `''`.\n\t\t */\n\t\tvideoUrl() {\n\t\t\tconst value = this.content && this.content.videoUrl\n\t\t\treturn typeof value === 'string' ? value : ''\n\t\t},\n\n\t\t/**\n\t\t * The resolved streaming URL for `nc-file` sources.\n\t\t *\n\t\t * @return {string} the streaming URL, or `''`.\n\t\t */\n\t\tfileStreamingUrl() {\n\t\t\tconst value = this.content && this.content.fileStreamingUrl\n\t\t\treturn typeof value === 'string' ? value : ''\n\t\t},\n\n\t\t/**\n\t\t * The Nextcloud file id for `nc-file` sources.\n\t\t *\n\t\t * @return {number|null} the file id, or `null`.\n\t\t */\n\t\tfileId() {\n\t\t\tconst value = this.content && this.content.fileId\n\t\t\treturn typeof value === 'number' && Number.isFinite(value) ? value : null\n\t\t},\n\n\t\t/**\n\t\t * Whether autoplay is requested.\n\t\t *\n\t\t * @return {boolean} the autoplay flag.\n\t\t */\n\t\tautoplay() {\n\t\t\treturn Boolean(this.content && this.content.autoplay)\n\t\t},\n\n\t\t/**\n\t\t * Whether the video is muted (defaults to true).\n\t\t *\n\t\t * @return {boolean} the muted flag.\n\t\t */\n\t\tmuted() {\n\t\t\tif (this.content && typeof this.content.muted === 'boolean') {\n\t\t\t\treturn this.content.muted\n\t\t\t}\n\t\t\treturn true\n\t\t},\n\n\t\t/**\n\t\t * Whether the video loops.\n\t\t *\n\t\t * @return {boolean} the loop flag.\n\t\t */\n\t\tloop() {\n\t\t\treturn Boolean(this.content && this.content.loop)\n\t\t},\n\n\t\t/**\n\t\t * Whether native controls are shown (defaults to true).\n\t\t *\n\t\t * @return {boolean} the controls flag.\n\t\t */\n\t\tcontrols() {\n\t\t\tif (this.content && typeof this.content.controls === 'boolean') {\n\t\t\t\treturn this.content.controls\n\t\t\t}\n\t\t\treturn true\n\t\t},\n\n\t\t/**\n\t\t * The validated aspect ratio (defaults to `16:9`).\n\t\t *\n\t\t * @return {string} one of the supported aspect ratios.\n\t\t */\n\t\taspectRatio() {\n\t\t\tconst raw = this.content && this.content.aspectRatio\n\t\t\tif (typeof raw === 'string' && VALID_ASPECT_RATIOS.includes(raw)) {\n\t\t\t\treturn raw\n\t\t\t}\n\t\t\treturn DEFAULT_ASPECT_RATIO\n\t\t},\n\n\t\t/**\n\t\t * The poster image URL for HTML5 video.\n\t\t *\n\t\t * @return {string} the poster URL, or `''`.\n\t\t */\n\t\tposterUrl() {\n\t\t\tconst value = this.content && this.content.posterUrl\n\t\t\treturn typeof value === 'string' && value.trim() !== '' ? value : ''\n\t\t},\n\n\t\t/**\n\t\t * Effective muted value — autoplay forces muted=true (browsers block\n\t\t * autoplay of unmuted media).\n\t\t *\n\t\t * @return {boolean} the muted value passed to the media element.\n\t\t */\n\t\teffectiveMuted() {\n\t\t\treturn this.autoplay ? true : this.muted\n\t\t},\n\n\t\t/**\n\t\t * Effective autoplay value — never autoplay when no source resolved.\n\t\t *\n\t\t * @return {boolean} the autoplay value passed to the media element.\n\t\t */\n\t\teffectiveAutoplay() {\n\t\t\treturn this.autoplay && this.hasSource\n\t\t},\n\n\t\t/**\n\t\t * Whether a usable source is configured.\n\t\t *\n\t\t * @return {boolean} true when the widget has something to render.\n\t\t */\n\t\thasSource() {\n\t\t\tif (this.sourceType === null) {\n\t\t\t\treturn false\n\t\t\t}\n\t\t\tif (this.sourceType === 'nc-file') {\n\t\t\t\treturn this.fileId !== null\n\t\t\t}\n\t\t\treturn this.videoUrl.trim() !== ''\n\t\t},\n\n\t\t/**\n\t\t * Whether the current source renders in an iframe.\n\t\t *\n\t\t * @return {boolean} true for youtube/vimeo/peertube.\n\t\t */\n\t\tisIframeSource() {\n\t\t\treturn ['youtube', 'vimeo', 'peertube'].includes(this.sourceType)\n\t\t},\n\n\t\t/**\n\t\t * Whether the current source renders in an HTML5 video element.\n\t\t *\n\t\t * @return {boolean} true for nc-file.\n\t\t */\n\t\tisFileSource() {\n\t\t\treturn this.sourceType === 'nc-file'\n\t\t},\n\n\t\t/**\n\t\t * Whether the widget is in an error state.\n\t\t *\n\t\t * @return {boolean} true when an error placeholder should show.\n\t\t */\n\t\thasError() {\n\t\t\tif (this.content && typeof this.content.error === 'string' && this.content.error.trim() !== '') {\n\t\t\t\treturn true\n\t\t\t}\n\t\t\tif (this.isFileSource && this.fileId !== null && this.fileStreamingUrl === '') {\n\t\t\t\treturn true\n\t\t\t}\n\t\t\treturn this.videoLoadFailed\n\t\t},\n\n\t\t/**\n\t\t * The localised error message for the error placeholder.\n\t\t *\n\t\t * @return {string} the error message.\n\t\t */\n\t\terrorMessage() {\n\t\t\tconst raw = this.content && this.content.error\n\t\t\tif (typeof raw === 'string' && raw.trim() !== '') {\n\t\t\t\treturn raw\n\t\t\t}\n\t\t\tif (this.isFileSource && this.fileId !== null && this.fileStreamingUrl === '') {\n\t\t\t\treturn t('nextcloud-vue', 'Video not accessible')\n\t\t\t}\n\t\t\tif (this.videoLoadFailed) {\n\t\t\t\treturn t('nextcloud-vue', 'Video failed to load')\n\t\t\t}\n\t\t\treturn t('nextcloud-vue', 'Invalid video URL or domain not allowed.')\n\t\t},\n\n\t\t/**\n\t\t * The iframe `src` with playback query params appended.\n\t\t *\n\t\t * @return {string} the iframe URL, or `''`.\n\t\t */\n\t\tembedUrl() {\n\t\t\tif (!this.isIframeSource || this.videoUrl === '') {\n\t\t\t\treturn ''\n\t\t\t}\n\t\t\tconst params = []\n\t\t\tif (this.autoplay) {\n\t\t\t\tparams.push('autoplay=1')\n\t\t\t\tparams.push('mute=1')\n\t\t\t} else if (this.muted) {\n\t\t\t\tparams.push('mute=1')\n\t\t\t}\n\t\t\tif (this.loop) {\n\t\t\t\tparams.push('loop=1')\n\t\t\t\t// YouTube loops a single video only as a one-item playlist.\n\t\t\t\tconst id = this.sourceType === 'youtube' ? this.youtubeVideoId : ''\n\t\t\t\tif (id) {\n\t\t\t\t\tparams.push(`playlist=${encodeURIComponent(id)}`)\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (params.length === 0) {\n\t\t\t\treturn this.videoUrl\n\t\t\t}\n\t\t\tconst separator = this.videoUrl.includes('?') ? '&' : '?'\n\t\t\treturn this.videoUrl + separator + params.join('&')\n\t\t},\n\n\t\t/**\n\t\t * The video id in a canonical YouTube embed URL (`/embed/<id>`).\n\t\t *\n\t\t * @return {string} the id, or `''`.\n\t\t */\n\t\tyoutubeVideoId() {\n\t\t\tconst match = this.videoUrl.match(/\\/embed\\/([^/?#&]+)/)\n\t\t\treturn match ? decodeURIComponent(match[1]) : ''\n\t\t},\n\n\t\t/**\n\t\t * The placeholder icon colour (a theme variable).\n\t\t *\n\t\t * @return {string} the CSS colour.\n\t\t */\n\t\tplaceholderColor() {\n\t\t\treturn 'var(--color-text-maxcontrast)'\n\t\t},\n\n\t\t/**\n\t\t * Inline style for the widget wrapper.\n\t\t *\n\t\t * @return {object} the wrapper style.\n\t\t */\n\t\twrapperStyle() {\n\t\t\treturn {\n\t\t\t\twidth: '100%',\n\t\t\t\theight: '100%',\n\t\t\t\toverflow: 'hidden',\n\t\t\t\tposition: 'relative',\n\t\t\t\tdisplay: 'flex',\n\t\t\t\t'align-items': 'center',\n\t\t\t\t'justify-content': 'center',\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Inline style for the media wrapper, enforcing the aspect ratio.\n\t\t *\n\t\t * @return {object} the media style.\n\t\t */\n\t\tmediaStyle() {\n\t\t\tconst [w, h] = this.aspectRatio.split(':')\n\t\t\tconst ratio = Number(w) / Number(h)\n\t\t\t// A cell wider than the ratio fits the video by its height.\n\t\t\tconst { width, height } = this.box\n\t\t\tconst fitsByHeight = height > 0 && width / height > ratio\n\t\t\treturn {\n\t\t\t\twidth: fitsByHeight ? `${Math.floor(height * ratio)}px` : '100%',\n\t\t\t\t'max-width': '100%',\n\t\t\t\t'aspect-ratio': `${w} / ${h}`,\n\t\t\t\tdisplay: 'flex',\n\t\t\t\t'align-items': 'center',\n\t\t\t\t'justify-content': 'center',\n\t\t\t\tbackground: 'var(--color-background-dark)',\n\t\t\t}\n\t\t},\n\t},\n\n\twatch: {\n\t\t// Re-arm the failure flag when the source changes so a previously\n\t\t// failed file does not permanently lock the cell.\n\t\tfileStreamingUrl() {\n\t\t\tthis.videoLoadFailed = false\n\t\t},\n\n\t\tvideoUrl() {\n\t\t\tthis.videoLoadFailed = false\n\t\t},\n\t},\n\n\tmounted() {\n\t\tif (typeof ResizeObserver === 'undefined') {\n\t\t\treturn\n\t\t}\n\t\tthis.resizeObserver = new ResizeObserver((entries) => {\n\t\t\tconst rect = entries[0] && entries[0].contentRect\n\t\t\tif (rect) {\n\t\t\t\tthis.box = { width: rect.width, height: rect.height }\n\t\t\t}\n\t\t})\n\t\tthis.resizeObserver.observe(this.$el)\n\t},\n\n\tbeforeUnmount() {\n\t\tif (this.resizeObserver) {\n\t\t\tthis.resizeObserver.disconnect()\n\t\t}\n\t},\n\n\tmethods: {\n\t\t/**\n\t\t * HTML5 `<video>` error handler — swaps to the error placeholder. The\n\t\t * event is swallowed so no exception bubbles into the grid layer.\n\t\t *\n\t\t * @return {void}\n\t\t */\n\t\tonVideoError() {\n\t\t\tthis.videoLoadFailed = true\n\t\t},\n\t},\n}\n</script>\n\n<style scoped>\n.cn-video-widget {\n\twidth: 100%;\n\theight: 100%;\n\toverflow: hidden;\n}\n\n.cn-video-widget__media {\n\tposition: relative;\n}\n\n.cn-video-widget__iframe,\n.cn-video-widget__video {\n\twidth: 100%;\n\theight: 100%;\n\tborder: 0;\n\tdisplay: block;\n\tbackground: var(--color-background-dark);\n}\n\n.cn-video-widget__placeholder {\n\twidth: 100%;\n\theight: 100%;\n\tdisplay: flex;\n\tflex-direction: column;\n\talign-items: center;\n\tjustify-content: center;\n\tgap: 8px;\n\tcolor: var(--color-text-maxcontrast);\n\tpadding: 16px;\n\ttext-align: center;\n}\n\n.cn-video-widget__placeholder-label {\n\tfont-size: 13px;\n}\n\n.cn-video-widget__placeholder-help {\n\tfont-size: 12px;\n}\n\n.cn-video-widget__configure {\n\tpadding: 4px 12px;\n\tborder: 1px solid var(--color-border);\n\tborder-radius: var(--border-radius);\n\tbackground: transparent;\n\tcolor: var(--color-main-text);\n\tcursor: pointer;\n}\n</style>\n"],"names":["VideoIcon","t"],"mappings":";;;AAuDA,MAAM,kBAAiB,GAAI,CAAC,SAAS,EAAE,OAAO,EAAE,UAAU,EAAE,SAAS;AACrE,MAAM,mBAAkB,GAAI,CAAC,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM;AACzD,MAAM,oBAAmB,GAAI;;AAE7B;;;AAGC;;;AAGA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;;;AAIA;AACA;;AAED,aAAe;AACd,CAAA,IAAI,EAAE,eAAe;;CAErB,UAAU,EAAE;AACX,aAAAA,KAAS;EACT;;AAED,CAAA,KAAK,EAAE;AACN;;;;AAIC;AACA;;;AAGD,EAAA,OAAO,EAAE;GACR,IAAI,EAAE,MAAM;AACZ,GAAA,OAAO,EAAE,OAAO,EAAE,CAAC;GACnB;;AAED;;;AAGC;AACA;;AAED,EAAA,OAAO,EAAE;GACR,IAAI,EAAE,OAAO;GACb,OAAO,EAAE,KAAK;GACd;;AAED;AACA;EACA,SAAS,EAAE;GACV,IAAI,EAAE,MAAM;GACZ,OAAO,EAAE,IAAI;GACb;AACD;EACA;;AAED,CAAA,KAAK,EAAE;AACN;;AAEC;AACA;;;AAGD,EAAA,MAAM;EACN;;AAED,CAAA,IAAI,GAAG;AACN,EAAA,OAAO;;;AAGN,GAAA,eAAe,EAAE,KAAK;;AAEtB;GACA,GAAG,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,GAAG;AAC7B;CACD,CAAC;;AAED,CAAA,QAAQ,EAAE;AACT;;AAEC;;;EAGD,UAAU,GAAG;AACZ,GAAA,MAAM,MAAM,IAAI,CAAC,OAAM,IAAK,IAAI,CAAC,OAAO,CAAC;GACzC,OAAO,kBAAkB,CAA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,IAAI,CAAC,MAAM,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,MAAK;AACnD,GAAA;EACD,CAAC;AACD,EAAA,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG;CACrC,CAAC;;AAED,CAAA,aAAa,GAAG;EACf,IAAI,IAAI,CAAC,cAAc,EAAE;AACxB,GAAA,IAAI,CAAC,cAAc,CAAC,UAAU;AAC/B,EAAA;CACD,CAAC;;AAED,CAAA,OAAO,EAAE;AACR;;;AAGC;;;AAGD,EAAA,YAAY,GAAG;GACd,IAAI,CAAC,eAAc,GAAI;EACxB,CAAC;EACD;AACF;;"}
@@ -5,13 +5,14 @@ const _hoisted_1 = {
5
5
  class: "cn-video-widget__placeholder"
6
6
  };
7
7
  const _hoisted_2 = { class: "cn-video-widget__placeholder-label" };
8
- const _hoisted_3 = {
8
+ const _hoisted_3 = { class: "cn-video-widget__placeholder-help" };
9
+ const _hoisted_4 = {
9
10
  key: 1,
10
11
  class: "cn-video-widget__placeholder"
11
12
  };
12
- const _hoisted_4 = { class: "cn-video-widget__placeholder-label" };
13
- const _hoisted_5 = ["src"];
14
- const _hoisted_6 = ["src", "poster", "autoplay", "muted", "loop", "controls"];
13
+ const _hoisted_5 = { class: "cn-video-widget__placeholder-label" };
14
+ const _hoisted_6 = ["src"];
15
+ const _hoisted_7 = ["src", "poster", "autoplay", "muted", "loop", "controls"];
15
16
 
16
17
  function render(_ctx, _cache, $props, $setup, $data, $options) {
17
18
  const _component_VideoIcon = resolveComponent("VideoIcon");
@@ -26,15 +27,24 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
26
27
  size: 48,
27
28
  fillColor: $options.placeholderColor
28
29
  }, null, 8 /* PROPS */, ["fillColor"]),
29
- createElementVNode("span", _hoisted_2, toDisplayString(_ctx.t('nextcloud-vue', 'No video URL configured')), 1 /* TEXT */)
30
+ createElementVNode("span", _hoisted_2, toDisplayString(_ctx.t('nextcloud-vue', 'No video URL configured')), 1 /* TEXT */),
31
+ createElementVNode("span", _hoisted_3, toDisplayString(_ctx.t('nextcloud-vue', 'Edit the widget to add a video')), 1 /* TEXT */),
32
+ ($props.canEdit)
33
+ ? (openBlock(), createElementBlock("button", {
34
+ key: 0,
35
+ type: "button",
36
+ class: "cn-video-widget__configure",
37
+ onClick: _cache[0] || (_cache[0] = $event => (_ctx.$emit('edit')))
38
+ }, toDisplayString(_ctx.t('nextcloud-vue', 'Configure now')), 1 /* TEXT */))
39
+ : createCommentVNode("v-if", true)
30
40
  ]))
31
41
  : ($options.hasError)
32
- ? (openBlock(), createElementBlock("div", _hoisted_3, [
42
+ ? (openBlock(), createElementBlock("div", _hoisted_4, [
33
43
  createVNode(_component_VideoIcon, {
34
44
  size: 48,
35
45
  fillColor: $options.placeholderColor
36
46
  }, null, 8 /* PROPS */, ["fillColor"]),
37
- createElementVNode("span", _hoisted_4, toDisplayString($options.errorMessage), 1 /* TEXT */)
47
+ createElementVNode("span", _hoisted_5, toDisplayString($options.errorMessage), 1 /* TEXT */)
38
48
  ]))
39
49
  : (openBlock(), createElementBlock("div", {
40
50
  key: 2,
@@ -50,7 +60,7 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
50
60
  referrerpolicy: "strict-origin-when-cross-origin",
51
61
  allowfullscreen: "",
52
62
  frameborder: "0"
53
- }, null, 8 /* PROPS */, _hoisted_5))
63
+ }, null, 8 /* PROPS */, _hoisted_6))
54
64
  : ($options.isFileSource)
55
65
  ? (openBlock(), createElementBlock("video", {
56
66
  key: 1,
@@ -61,8 +71,8 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
61
71
  muted: $options.effectiveMuted,
62
72
  loop: $options.loop,
63
73
  controls: $options.controls,
64
- onError: _cache[0] || (_cache[0] = (...args) => ($options.onVideoError && $options.onVideoError(...args)))
65
- }, null, 40 /* PROPS, NEED_HYDRATION */, _hoisted_6))
74
+ onError: _cache[1] || (_cache[1] = (...args) => ($options.onVideoError && $options.onVideoError(...args)))
75
+ }, null, 40 /* PROPS, NEED_HYDRATION */, _hoisted_7))
66
76
  : createCommentVNode("v-if", true)
67
77
  ], 4 /* STYLE */))
68
78
  ], 4 /* STYLE */))
@@ -1 +1 @@
1
- {"version":3,"file":"CnVideoWidget3.vue.js","sources":["../../../../src/components/CnVideoWidget/CnVideoWidget.vue?vue&type=template&id=7569b1b5&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-video-widget\"\n\t\t:style=\"wrapperStyle\">\n\t\t<div v-if=\"!hasSource\" class=\"cn-video-widget__placeholder\">\n\t\t\t<VideoIcon :size=\"48\" :fillColor=\"placeholderColor\" />\n\t\t\t<span class=\"cn-video-widget__placeholder-label\">{{ t('nextcloud-vue', 'No video URL configured') }}</span>\n\t\t</div>\n\t\t<div v-else-if=\"hasError\" class=\"cn-video-widget__placeholder\">\n\t\t\t<VideoIcon :size=\"48\" :fillColor=\"placeholderColor\" />\n\t\t\t<span class=\"cn-video-widget__placeholder-label\">{{ errorMessage }}</span>\n\t\t</div>\n\t\t<div\n\t\t\tv-else\n\t\t\tclass=\"cn-video-widget__media\"\n\t\t\t:style=\"mediaStyle\">\n\t\t\t<iframe\n\t\t\t\tv-if=\"isIframeSource\"\n\t\t\t\tclass=\"cn-video-widget__iframe\"\n\t\t\t\t:src=\"embedUrl\"\n\t\t\t\tsandbox=\"allow-scripts allow-same-origin allow-presentation\"\n\t\t\t\treferrerpolicy=\"strict-origin-when-cross-origin\"\n\t\t\t\tallowfullscreen\n\t\t\t\tframeborder=\"0\" />\n\t\t\t<video\n\t\t\t\tv-else-if=\"isFileSource\"\n\t\t\t\tclass=\"cn-video-widget__video\"\n\t\t\t\t:src=\"fileStreamingUrl\"\n\t\t\t\t:poster=\"posterUrl || null\"\n\t\t\t\t:autoplay=\"effectiveAutoplay\"\n\t\t\t\t:muted=\"effectiveMuted\"\n\t\t\t\t:loop=\"loop\"\n\t\t\t\t:controls=\"controls\"\n\t\t\t\t@error=\"onVideoError\" />\n\t\t</div>\n\t</div>\n</template>\n\n<script>\nimport { translate as t } from '@nextcloud/l10n'\nimport VideoIcon from 'vue-material-design-icons/Video.vue'\n\nconst VALID_SOURCE_TYPES = ['youtube', 'vimeo', 'peertube', 'nc-file']\nconst VALID_ASPECT_RATIOS = ['16:9', '4:3', '1:1', '9:16']\nconst DEFAULT_ASPECT_RATIO = '16:9'\n\n/**\n * CnVideoWidget renders an embedded video inside a dashboard cell. It\n * dispatches on `content.sourceType` to one of three render branches:\n *\n * - `youtube` / `vimeo` / `peertube` → sandboxed `<iframe>` whose `src` is\n * the canonical embed URL stored in `content.videoUrl`.\n * - `nc-file` → HTML5 `<video>` whose `src` is `content.fileStreamingUrl`\n * (resolved upstream).\n * - anything else / missing source / render error → a centered placeholder.\n *\n * Autoplay forces muted=true because browsers block autoplay of unmuted media.\n * Aspect ratio uses the CSS `aspect-ratio` property; `16:9`, `4:3`, `1:1`, and\n * `9:16` are supported and unknown values fall back to `16:9`.\n *\n * The iframe sets `referrerpolicy=\"strict-origin-when-cross-origin\"` because\n * Nextcloud's own default security headers send `Referrer-Policy: no-referrer`\n * — without an explicit override the iframe inherits that and YouTube's\n * player rejects the request with \"Error 153: Video player configuration\n * error\" (it requires a referrer to validate the embed).\n *\n * @spec openspec/changes/cn-widget-library/specs/cn-widget-library/spec.md\n */\nexport default {\n\tname: 'CnVideoWidget',\n\n\tcomponents: {\n\t\tVideoIcon,\n\t},\n\n\tprops: {\n\t\t/**\n\t\t * Persisted content blob `{sourceType, videoUrl, fileId,\n\t\t * fileStreamingUrl, autoplay, muted, loop, controls, aspectRatio,\n\t\t * posterUrl, error}`. `videoUrl` is the canonical embed URL;\n\t\t * `error` (when set) triggers the error placeholder.\n\t\t *\n\t\t * @type {object}\n\t\t */\n\t\tcontent: {\n\t\t\ttype: Object,\n\t\t\tdefault: () => ({}),\n\t\t},\n\n\t\t/* eslint-disable vue/no-unused-properties -- part of the widget contract: CnContainerChild and the dashboard pages bind :placement on every widget, so declaring it keeps it out of $attrs */\n\t\t/** The placement record (reserved — kept to match the renderer contract). */\n\t\tplacement: {\n\t\t\ttype: Object,\n\t\t\tdefault: null,\n\t\t},\n\t\t/* eslint-enable vue/no-unused-properties */\n\t},\n\n\tdata() {\n\t\treturn {\n\t\t\t// Set when the HTML5 <video> fires an error so subsequent renders\n\t\t\t// show the error placeholder rather than a broken element.\n\t\t\tvideoLoadFailed: false,\n\t\t}\n\t},\n\n\tcomputed: {\n\t\t/**\n\t\t * The validated source type, or `null` when unrecognised.\n\t\t *\n\t\t * @return {string|null} one of the supported source types.\n\t\t */\n\t\tsourceType() {\n\t\t\tconst raw = this.content && this.content.sourceType\n\t\t\treturn VALID_SOURCE_TYPES.includes(raw) ? raw : null\n\t\t},\n\n\t\t/**\n\t\t * The canonical embed URL string.\n\t\t *\n\t\t * @return {string} the embed URL, or `''`.\n\t\t */\n\t\tvideoUrl() {\n\t\t\tconst value = this.content && this.content.videoUrl\n\t\t\treturn typeof value === 'string' ? value : ''\n\t\t},\n\n\t\t/**\n\t\t * The resolved streaming URL for `nc-file` sources.\n\t\t *\n\t\t * @return {string} the streaming URL, or `''`.\n\t\t */\n\t\tfileStreamingUrl() {\n\t\t\tconst value = this.content && this.content.fileStreamingUrl\n\t\t\treturn typeof value === 'string' ? value : ''\n\t\t},\n\n\t\t/**\n\t\t * The Nextcloud file id for `nc-file` sources.\n\t\t *\n\t\t * @return {number|null} the file id, or `null`.\n\t\t */\n\t\tfileId() {\n\t\t\tconst value = this.content && this.content.fileId\n\t\t\treturn typeof value === 'number' && Number.isFinite(value) ? value : null\n\t\t},\n\n\t\t/**\n\t\t * Whether autoplay is requested.\n\t\t *\n\t\t * @return {boolean} the autoplay flag.\n\t\t */\n\t\tautoplay() {\n\t\t\treturn Boolean(this.content && this.content.autoplay)\n\t\t},\n\n\t\t/**\n\t\t * Whether the video is muted (defaults to true).\n\t\t *\n\t\t * @return {boolean} the muted flag.\n\t\t */\n\t\tmuted() {\n\t\t\tif (this.content && typeof this.content.muted === 'boolean') {\n\t\t\t\treturn this.content.muted\n\t\t\t}\n\t\t\treturn true\n\t\t},\n\n\t\t/**\n\t\t * Whether the video loops.\n\t\t *\n\t\t * @return {boolean} the loop flag.\n\t\t */\n\t\tloop() {\n\t\t\treturn Boolean(this.content && this.content.loop)\n\t\t},\n\n\t\t/**\n\t\t * Whether native controls are shown (defaults to true).\n\t\t *\n\t\t * @return {boolean} the controls flag.\n\t\t */\n\t\tcontrols() {\n\t\t\tif (this.content && typeof this.content.controls === 'boolean') {\n\t\t\t\treturn this.content.controls\n\t\t\t}\n\t\t\treturn true\n\t\t},\n\n\t\t/**\n\t\t * The validated aspect ratio (defaults to `16:9`).\n\t\t *\n\t\t * @return {string} one of the supported aspect ratios.\n\t\t */\n\t\taspectRatio() {\n\t\t\tconst raw = this.content && this.content.aspectRatio\n\t\t\tif (typeof raw === 'string' && VALID_ASPECT_RATIOS.includes(raw)) {\n\t\t\t\treturn raw\n\t\t\t}\n\t\t\treturn DEFAULT_ASPECT_RATIO\n\t\t},\n\n\t\t/**\n\t\t * The poster image URL for HTML5 video.\n\t\t *\n\t\t * @return {string} the poster URL, or `''`.\n\t\t */\n\t\tposterUrl() {\n\t\t\tconst value = this.content && this.content.posterUrl\n\t\t\treturn typeof value === 'string' && value.trim() !== '' ? value : ''\n\t\t},\n\n\t\t/**\n\t\t * Effective muted value — autoplay forces muted=true (browsers block\n\t\t * autoplay of unmuted media).\n\t\t *\n\t\t * @return {boolean} the muted value passed to the media element.\n\t\t */\n\t\teffectiveMuted() {\n\t\t\treturn this.autoplay ? true : this.muted\n\t\t},\n\n\t\t/**\n\t\t * Effective autoplay value — never autoplay when no source resolved.\n\t\t *\n\t\t * @return {boolean} the autoplay value passed to the media element.\n\t\t */\n\t\teffectiveAutoplay() {\n\t\t\treturn this.autoplay && this.hasSource\n\t\t},\n\n\t\t/**\n\t\t * Whether a usable source is configured.\n\t\t *\n\t\t * @return {boolean} true when the widget has something to render.\n\t\t */\n\t\thasSource() {\n\t\t\tif (this.sourceType === null) {\n\t\t\t\treturn false\n\t\t\t}\n\t\t\tif (this.sourceType === 'nc-file') {\n\t\t\t\treturn this.fileId !== null\n\t\t\t}\n\t\t\treturn this.videoUrl.trim() !== ''\n\t\t},\n\n\t\t/**\n\t\t * Whether the current source renders in an iframe.\n\t\t *\n\t\t * @return {boolean} true for youtube/vimeo/peertube.\n\t\t */\n\t\tisIframeSource() {\n\t\t\treturn ['youtube', 'vimeo', 'peertube'].includes(this.sourceType)\n\t\t},\n\n\t\t/**\n\t\t * Whether the current source renders in an HTML5 video element.\n\t\t *\n\t\t * @return {boolean} true for nc-file.\n\t\t */\n\t\tisFileSource() {\n\t\t\treturn this.sourceType === 'nc-file'\n\t\t},\n\n\t\t/**\n\t\t * Whether the widget is in an error state.\n\t\t *\n\t\t * @return {boolean} true when an error placeholder should show.\n\t\t */\n\t\thasError() {\n\t\t\tif (this.content && typeof this.content.error === 'string' && this.content.error.trim() !== '') {\n\t\t\t\treturn true\n\t\t\t}\n\t\t\tif (this.isFileSource && this.fileId !== null && this.fileStreamingUrl === '') {\n\t\t\t\treturn true\n\t\t\t}\n\t\t\treturn this.videoLoadFailed\n\t\t},\n\n\t\t/**\n\t\t * The localised error message for the error placeholder.\n\t\t *\n\t\t * @return {string} the error message.\n\t\t */\n\t\terrorMessage() {\n\t\t\tconst raw = this.content && this.content.error\n\t\t\tif (typeof raw === 'string' && raw.trim() !== '') {\n\t\t\t\treturn raw\n\t\t\t}\n\t\t\tif (this.isFileSource && this.fileId !== null && this.fileStreamingUrl === '') {\n\t\t\t\treturn t('nextcloud-vue', 'Video not accessible')\n\t\t\t}\n\t\t\tif (this.videoLoadFailed) {\n\t\t\t\treturn t('nextcloud-vue', 'Video failed to load')\n\t\t\t}\n\t\t\treturn t('nextcloud-vue', 'Invalid video URL or domain not allowed.')\n\t\t},\n\n\t\t/**\n\t\t * The iframe `src` with playback query params appended.\n\t\t *\n\t\t * @return {string} the iframe URL, or `''`.\n\t\t */\n\t\tembedUrl() {\n\t\t\tif (!this.isIframeSource || this.videoUrl === '') {\n\t\t\t\treturn ''\n\t\t\t}\n\t\t\tconst params = []\n\t\t\tif (this.autoplay) {\n\t\t\t\tparams.push('autoplay=1')\n\t\t\t\tparams.push('mute=1')\n\t\t\t} else if (this.muted) {\n\t\t\t\tparams.push('mute=1')\n\t\t\t}\n\t\t\tif (this.loop) {\n\t\t\t\tparams.push('loop=1')\n\t\t\t}\n\t\t\tif (params.length === 0) {\n\t\t\t\treturn this.videoUrl\n\t\t\t}\n\t\t\tconst separator = this.videoUrl.includes('?') ? '&' : '?'\n\t\t\treturn this.videoUrl + separator + params.join('&')\n\t\t},\n\n\t\t/**\n\t\t * The placeholder icon colour (a theme variable).\n\t\t *\n\t\t * @return {string} the CSS colour.\n\t\t */\n\t\tplaceholderColor() {\n\t\t\treturn 'var(--color-text-maxcontrast)'\n\t\t},\n\n\t\t/**\n\t\t * Inline style for the widget wrapper.\n\t\t *\n\t\t * @return {object} the wrapper style.\n\t\t */\n\t\twrapperStyle() {\n\t\t\treturn {\n\t\t\t\twidth: '100%',\n\t\t\t\theight: '100%',\n\t\t\t\toverflow: 'hidden',\n\t\t\t\tposition: 'relative',\n\t\t\t\tdisplay: 'flex',\n\t\t\t\t'align-items': 'center',\n\t\t\t\t'justify-content': 'center',\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Inline style for the media wrapper, enforcing the aspect ratio.\n\t\t *\n\t\t * @return {object} the media style.\n\t\t */\n\t\tmediaStyle() {\n\t\t\tconst [w, h] = this.aspectRatio.split(':')\n\t\t\treturn {\n\t\t\t\twidth: '100%',\n\t\t\t\t'max-width': '100%',\n\t\t\t\t'aspect-ratio': `${w} / ${h}`,\n\t\t\t\tdisplay: 'flex',\n\t\t\t\t'align-items': 'center',\n\t\t\t\t'justify-content': 'center',\n\t\t\t\tbackground: 'var(--color-background-dark)',\n\t\t\t}\n\t\t},\n\t},\n\n\twatch: {\n\t\t// Re-arm the failure flag when the source changes so a previously\n\t\t// failed file does not permanently lock the cell.\n\t\tfileStreamingUrl() {\n\t\t\tthis.videoLoadFailed = false\n\t\t},\n\n\t\tvideoUrl() {\n\t\t\tthis.videoLoadFailed = false\n\t\t},\n\t},\n\n\tmethods: {\n\t\t/**\n\t\t * HTML5 `<video>` error handler — swaps to the error placeholder. The\n\t\t * event is swallowed so no exception bubbles into the grid layer.\n\t\t *\n\t\t * @return {void}\n\t\t */\n\t\tonVideoError() {\n\t\t\tthis.videoLoadFailed = true\n\t\t},\n\t},\n}\n</script>\n\n<style scoped>\n.cn-video-widget {\n\twidth: 100%;\n\theight: 100%;\n\toverflow: hidden;\n}\n\n.cn-video-widget__media {\n\tposition: relative;\n}\n\n.cn-video-widget__iframe,\n.cn-video-widget__video {\n\twidth: 100%;\n\theight: 100%;\n\tborder: 0;\n\tdisplay: block;\n\tbackground: var(--color-background-dark);\n}\n\n.cn-video-widget__placeholder {\n\twidth: 100%;\n\theight: 100%;\n\tdisplay: flex;\n\tflex-direction: column;\n\talign-items: center;\n\tjustify-content: center;\n\tgap: 8px;\n\tcolor: var(--color-text-maxcontrast);\n\tpadding: 16px;\n\ttext-align: center;\n}\n\n.cn-video-widget__placeholder-label {\n\tfont-size: 13px;\n}\n</style>\n"],"names":["_createVNode","_createElementVNode","_toDisplayString","_createElementBlock"],"mappings":";;;;AAcyB,EAAA,KAAK,EAAC;;AAExB,MAAA,UAAA,GAAA,EAAA,KAAA,EAAA,oCAAA;;;AAEC,EAAA,KAAA,EAAA;;AAEC,MAAA,UAAA,GAAA,EAAA,KAAK,EAAC,oCAAO;;;;;;;;AARpB,IAAA,KAAK,EAAA,iBAAA;AACJ,IAAA,KAAK,iBAAE,QAAA,CAAA,YAAY;;MACR,QAAA,CAAA,SAAS;yCAGlB,iBAAA,EAAA;UAFFA,WAAA,CAAsD,oBAAA,EAAA;AAA1C,YAAA,IAAI,EAAE,EAAE;AAAG,YAAA,SAAS,EAAE,QAAA,CAAA;;UAClCC,kBAAA,CAAI,MAAA,EAAJ,UAAI,EAAAC,eAAA,CAAA,IAAA,CAAA,CAAA,CAAA,eAAA,EAAA,yBAAA,CAAA,CAAA,EAAA,CAAA;;SAEC,QAAA,CAAA,QAAA;2CAGA,iBAAA,EAAA;YAFLF,WAAA,CAA6B,oBAAA,EAAA;AAAjB,cAAA,IAAI,EAAE,EAAE;AAAG,cAAA,SAAM,EAAA,QAAA,CAAA;;YAC7BC,kBAAA,CAAmB,MAAA,EAAnB,UAAmB,EAAAC,eAAA,CAAA,QAAA,CAAA,YAAA,CAAA,EAAA,CAAA;;wBAElBC,kBAAA;;AAEA,YAAA,KAAI,EAAC,wBAAS;AACd,YAAA,KAAK,iBAAE,QAAA,CAAA,UAAU;;aAEX,QAAA,CAAA,cAAQ;iDAMG,QAAA,EAAA;;AALjB,kBAAA,KAAK,EAAC,yBAAW;AAChB,kBAAA,GAAG,EAAA,QAAA,CAAA,QAAA;AACJ,kBAAA,OAAO,EAAC,oDAAe;AACvB,kBAAA,cAAc,EAAC,iCAAc;AAC7B,kBAAA,eAAe,EAAf,EAAe;AACf,kBAAA,WAAW,EAAC;;iBAED,QAAA,CAAA,YAAW;;;AACtB,oBAAA,KAAK,EAAC,wBAAK;AACV,oBAAA,GAAG,EAAE,QAAA,CAAA,gBAAa;AAClB,oBAAA,MAAM,EAAE,QAAA,CAAA,SAAS,IAAA,IAAA;AACjB,oBAAA,QAAE,EAAA,QAAA,CAAA,iBAAA;AACF,oBAAA,KAAC,EAAA,QAAA,CAAA,cAAA;;;;;;;;;;"}
1
+ {"version":3,"file":"CnVideoWidget3.vue.js","sources":["../../../../src/components/CnVideoWidget/CnVideoWidget.vue?vue&type=template&id=e01017fa&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-video-widget\"\n\t\t:style=\"wrapperStyle\">\n\t\t<div v-if=\"!hasSource\" class=\"cn-video-widget__placeholder\">\n\t\t\t<VideoIcon :size=\"48\" :fillColor=\"placeholderColor\" />\n\t\t\t<span class=\"cn-video-widget__placeholder-label\">{{ t('nextcloud-vue', 'No video URL configured') }}</span>\n\t\t\t<span class=\"cn-video-widget__placeholder-help\">{{ t('nextcloud-vue', 'Edit the widget to add a video') }}</span>\n\t\t\t<button\n\t\t\t\tv-if=\"canEdit\"\n\t\t\t\ttype=\"button\"\n\t\t\t\tclass=\"cn-video-widget__configure\"\n\t\t\t\t@click=\"$emit('edit')\">\n\t\t\t\t{{ t('nextcloud-vue', 'Configure now') }}\n\t\t\t</button>\n\t\t</div>\n\t\t<div v-else-if=\"hasError\" class=\"cn-video-widget__placeholder\">\n\t\t\t<VideoIcon :size=\"48\" :fillColor=\"placeholderColor\" />\n\t\t\t<span class=\"cn-video-widget__placeholder-label\">{{ errorMessage }}</span>\n\t\t</div>\n\t\t<div\n\t\t\tv-else\n\t\t\tclass=\"cn-video-widget__media\"\n\t\t\t:style=\"mediaStyle\">\n\t\t\t<iframe\n\t\t\t\tv-if=\"isIframeSource\"\n\t\t\t\tclass=\"cn-video-widget__iframe\"\n\t\t\t\t:src=\"embedUrl\"\n\t\t\t\tsandbox=\"allow-scripts allow-same-origin allow-presentation\"\n\t\t\t\treferrerpolicy=\"strict-origin-when-cross-origin\"\n\t\t\t\tallowfullscreen\n\t\t\t\tframeborder=\"0\" />\n\t\t\t<video\n\t\t\t\tv-else-if=\"isFileSource\"\n\t\t\t\tclass=\"cn-video-widget__video\"\n\t\t\t\t:src=\"fileStreamingUrl\"\n\t\t\t\t:poster=\"posterUrl || null\"\n\t\t\t\t:autoplay=\"effectiveAutoplay\"\n\t\t\t\t:muted=\"effectiveMuted\"\n\t\t\t\t:loop=\"loop\"\n\t\t\t\t:controls=\"controls\"\n\t\t\t\t@error=\"onVideoError\" />\n\t\t</div>\n\t</div>\n</template>\n\n<script>\nimport { translate as t } from '@nextcloud/l10n'\nimport VideoIcon from 'vue-material-design-icons/Video.vue'\n\nconst VALID_SOURCE_TYPES = ['youtube', 'vimeo', 'peertube', 'nc-file']\nconst VALID_ASPECT_RATIOS = ['16:9', '4:3', '1:1', '9:16']\nconst DEFAULT_ASPECT_RATIO = '16:9'\n\n/**\n * CnVideoWidget renders an embedded video inside a dashboard cell. It\n * dispatches on `content.sourceType` to one of three render branches:\n *\n * - `youtube` / `vimeo` / `peertube` → sandboxed `<iframe>` whose `src` is\n * the canonical embed URL stored in `content.videoUrl`.\n * - `nc-file` → HTML5 `<video>` whose `src` is `content.fileStreamingUrl`\n * (resolved upstream).\n * - anything else / missing source / render error → a centered placeholder.\n *\n * Autoplay forces muted=true because browsers block autoplay of unmuted media.\n * Aspect ratio uses the CSS `aspect-ratio` property; `16:9`, `4:3`, `1:1`, and\n * `9:16` are supported and unknown values fall back to `16:9`.\n *\n * The iframe sets `referrerpolicy=\"strict-origin-when-cross-origin\"` because\n * Nextcloud's own default security headers send `Referrer-Policy: no-referrer`\n * — without an explicit override the iframe inherits that and YouTube's\n * player rejects the request with \"Error 153: Video player configuration\n * error\" (it requires a referrer to validate the embed).\n *\n * @spec openspec/changes/cn-widget-library/specs/cn-widget-library/spec.md\n */\nexport default {\n\tname: 'CnVideoWidget',\n\n\tcomponents: {\n\t\tVideoIcon,\n\t},\n\n\tprops: {\n\t\t/**\n\t\t * Persisted content blob `{sourceType, videoUrl, fileId,\n\t\t * fileStreamingUrl, autoplay, muted, loop, controls, aspectRatio,\n\t\t * posterUrl, error}`. `videoUrl` is the canonical embed URL;\n\t\t * `error` (when set) triggers the error placeholder.\n\t\t *\n\t\t * @type {object}\n\t\t */\n\t\tcontent: {\n\t\t\ttype: Object,\n\t\t\tdefault: () => ({}),\n\t\t},\n\n\t\t/**\n\t\t * Whether the viewer may edit this placement (the host's edit mode).\n\t\t * The empty state then offers \"Configure now\", which emits `edit`.\n\t\t *\n\t\t * @type {boolean}\n\t\t */\n\t\tcanEdit: {\n\t\t\ttype: Boolean,\n\t\t\tdefault: false,\n\t\t},\n\n\t\t/* eslint-disable vue/no-unused-properties -- part of the widget contract: CnContainerChild and the dashboard pages bind :placement on every widget, so declaring it keeps it out of $attrs */\n\t\t/** The placement record (reserved — kept to match the renderer contract). */\n\t\tplacement: {\n\t\t\ttype: Object,\n\t\t\tdefault: null,\n\t\t},\n\t\t/* eslint-enable vue/no-unused-properties */\n\t},\n\n\temits: [\n\t\t/**\n\t\t * \"Configure now\" was chosen in the empty state, so the host can open\n\t\t * the widget settings.\n\t\t *\n\t\t * @event edit\n\t\t */\n\t\t'edit',\n\t],\n\n\tdata() {\n\t\treturn {\n\t\t\t// Set when the HTML5 <video> fires an error so subsequent renders\n\t\t\t// show the error placeholder rather than a broken element.\n\t\t\tvideoLoadFailed: false,\n\t\t\t// The widget's own size, so a portrait ratio in a landscape cell\n\t\t\t// is fitted by its height instead of overflowing it.\n\t\t\tbox: { width: 0, height: 0 },\n\t\t}\n\t},\n\n\tcomputed: {\n\t\t/**\n\t\t * The validated source type, or `null` when unrecognised.\n\t\t *\n\t\t * @return {string|null} one of the supported source types.\n\t\t */\n\t\tsourceType() {\n\t\t\tconst raw = this.content && this.content.sourceType\n\t\t\treturn VALID_SOURCE_TYPES.includes(raw) ? raw : null\n\t\t},\n\n\t\t/**\n\t\t * The canonical embed URL string.\n\t\t *\n\t\t * @return {string} the embed URL, or `''`.\n\t\t */\n\t\tvideoUrl() {\n\t\t\tconst value = this.content && this.content.videoUrl\n\t\t\treturn typeof value === 'string' ? value : ''\n\t\t},\n\n\t\t/**\n\t\t * The resolved streaming URL for `nc-file` sources.\n\t\t *\n\t\t * @return {string} the streaming URL, or `''`.\n\t\t */\n\t\tfileStreamingUrl() {\n\t\t\tconst value = this.content && this.content.fileStreamingUrl\n\t\t\treturn typeof value === 'string' ? value : ''\n\t\t},\n\n\t\t/**\n\t\t * The Nextcloud file id for `nc-file` sources.\n\t\t *\n\t\t * @return {number|null} the file id, or `null`.\n\t\t */\n\t\tfileId() {\n\t\t\tconst value = this.content && this.content.fileId\n\t\t\treturn typeof value === 'number' && Number.isFinite(value) ? value : null\n\t\t},\n\n\t\t/**\n\t\t * Whether autoplay is requested.\n\t\t *\n\t\t * @return {boolean} the autoplay flag.\n\t\t */\n\t\tautoplay() {\n\t\t\treturn Boolean(this.content && this.content.autoplay)\n\t\t},\n\n\t\t/**\n\t\t * Whether the video is muted (defaults to true).\n\t\t *\n\t\t * @return {boolean} the muted flag.\n\t\t */\n\t\tmuted() {\n\t\t\tif (this.content && typeof this.content.muted === 'boolean') {\n\t\t\t\treturn this.content.muted\n\t\t\t}\n\t\t\treturn true\n\t\t},\n\n\t\t/**\n\t\t * Whether the video loops.\n\t\t *\n\t\t * @return {boolean} the loop flag.\n\t\t */\n\t\tloop() {\n\t\t\treturn Boolean(this.content && this.content.loop)\n\t\t},\n\n\t\t/**\n\t\t * Whether native controls are shown (defaults to true).\n\t\t *\n\t\t * @return {boolean} the controls flag.\n\t\t */\n\t\tcontrols() {\n\t\t\tif (this.content && typeof this.content.controls === 'boolean') {\n\t\t\t\treturn this.content.controls\n\t\t\t}\n\t\t\treturn true\n\t\t},\n\n\t\t/**\n\t\t * The validated aspect ratio (defaults to `16:9`).\n\t\t *\n\t\t * @return {string} one of the supported aspect ratios.\n\t\t */\n\t\taspectRatio() {\n\t\t\tconst raw = this.content && this.content.aspectRatio\n\t\t\tif (typeof raw === 'string' && VALID_ASPECT_RATIOS.includes(raw)) {\n\t\t\t\treturn raw\n\t\t\t}\n\t\t\treturn DEFAULT_ASPECT_RATIO\n\t\t},\n\n\t\t/**\n\t\t * The poster image URL for HTML5 video.\n\t\t *\n\t\t * @return {string} the poster URL, or `''`.\n\t\t */\n\t\tposterUrl() {\n\t\t\tconst value = this.content && this.content.posterUrl\n\t\t\treturn typeof value === 'string' && value.trim() !== '' ? value : ''\n\t\t},\n\n\t\t/**\n\t\t * Effective muted value — autoplay forces muted=true (browsers block\n\t\t * autoplay of unmuted media).\n\t\t *\n\t\t * @return {boolean} the muted value passed to the media element.\n\t\t */\n\t\teffectiveMuted() {\n\t\t\treturn this.autoplay ? true : this.muted\n\t\t},\n\n\t\t/**\n\t\t * Effective autoplay value — never autoplay when no source resolved.\n\t\t *\n\t\t * @return {boolean} the autoplay value passed to the media element.\n\t\t */\n\t\teffectiveAutoplay() {\n\t\t\treturn this.autoplay && this.hasSource\n\t\t},\n\n\t\t/**\n\t\t * Whether a usable source is configured.\n\t\t *\n\t\t * @return {boolean} true when the widget has something to render.\n\t\t */\n\t\thasSource() {\n\t\t\tif (this.sourceType === null) {\n\t\t\t\treturn false\n\t\t\t}\n\t\t\tif (this.sourceType === 'nc-file') {\n\t\t\t\treturn this.fileId !== null\n\t\t\t}\n\t\t\treturn this.videoUrl.trim() !== ''\n\t\t},\n\n\t\t/**\n\t\t * Whether the current source renders in an iframe.\n\t\t *\n\t\t * @return {boolean} true for youtube/vimeo/peertube.\n\t\t */\n\t\tisIframeSource() {\n\t\t\treturn ['youtube', 'vimeo', 'peertube'].includes(this.sourceType)\n\t\t},\n\n\t\t/**\n\t\t * Whether the current source renders in an HTML5 video element.\n\t\t *\n\t\t * @return {boolean} true for nc-file.\n\t\t */\n\t\tisFileSource() {\n\t\t\treturn this.sourceType === 'nc-file'\n\t\t},\n\n\t\t/**\n\t\t * Whether the widget is in an error state.\n\t\t *\n\t\t * @return {boolean} true when an error placeholder should show.\n\t\t */\n\t\thasError() {\n\t\t\tif (this.content && typeof this.content.error === 'string' && this.content.error.trim() !== '') {\n\t\t\t\treturn true\n\t\t\t}\n\t\t\tif (this.isFileSource && this.fileId !== null && this.fileStreamingUrl === '') {\n\t\t\t\treturn true\n\t\t\t}\n\t\t\treturn this.videoLoadFailed\n\t\t},\n\n\t\t/**\n\t\t * The localised error message for the error placeholder.\n\t\t *\n\t\t * @return {string} the error message.\n\t\t */\n\t\terrorMessage() {\n\t\t\tconst raw = this.content && this.content.error\n\t\t\tif (typeof raw === 'string' && raw.trim() !== '') {\n\t\t\t\treturn raw\n\t\t\t}\n\t\t\tif (this.isFileSource && this.fileId !== null && this.fileStreamingUrl === '') {\n\t\t\t\treturn t('nextcloud-vue', 'Video not accessible')\n\t\t\t}\n\t\t\tif (this.videoLoadFailed) {\n\t\t\t\treturn t('nextcloud-vue', 'Video failed to load')\n\t\t\t}\n\t\t\treturn t('nextcloud-vue', 'Invalid video URL or domain not allowed.')\n\t\t},\n\n\t\t/**\n\t\t * The iframe `src` with playback query params appended.\n\t\t *\n\t\t * @return {string} the iframe URL, or `''`.\n\t\t */\n\t\tembedUrl() {\n\t\t\tif (!this.isIframeSource || this.videoUrl === '') {\n\t\t\t\treturn ''\n\t\t\t}\n\t\t\tconst params = []\n\t\t\tif (this.autoplay) {\n\t\t\t\tparams.push('autoplay=1')\n\t\t\t\tparams.push('mute=1')\n\t\t\t} else if (this.muted) {\n\t\t\t\tparams.push('mute=1')\n\t\t\t}\n\t\t\tif (this.loop) {\n\t\t\t\tparams.push('loop=1')\n\t\t\t\t// YouTube loops a single video only as a one-item playlist.\n\t\t\t\tconst id = this.sourceType === 'youtube' ? this.youtubeVideoId : ''\n\t\t\t\tif (id) {\n\t\t\t\t\tparams.push(`playlist=${encodeURIComponent(id)}`)\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (params.length === 0) {\n\t\t\t\treturn this.videoUrl\n\t\t\t}\n\t\t\tconst separator = this.videoUrl.includes('?') ? '&' : '?'\n\t\t\treturn this.videoUrl + separator + params.join('&')\n\t\t},\n\n\t\t/**\n\t\t * The video id in a canonical YouTube embed URL (`/embed/<id>`).\n\t\t *\n\t\t * @return {string} the id, or `''`.\n\t\t */\n\t\tyoutubeVideoId() {\n\t\t\tconst match = this.videoUrl.match(/\\/embed\\/([^/?#&]+)/)\n\t\t\treturn match ? decodeURIComponent(match[1]) : ''\n\t\t},\n\n\t\t/**\n\t\t * The placeholder icon colour (a theme variable).\n\t\t *\n\t\t * @return {string} the CSS colour.\n\t\t */\n\t\tplaceholderColor() {\n\t\t\treturn 'var(--color-text-maxcontrast)'\n\t\t},\n\n\t\t/**\n\t\t * Inline style for the widget wrapper.\n\t\t *\n\t\t * @return {object} the wrapper style.\n\t\t */\n\t\twrapperStyle() {\n\t\t\treturn {\n\t\t\t\twidth: '100%',\n\t\t\t\theight: '100%',\n\t\t\t\toverflow: 'hidden',\n\t\t\t\tposition: 'relative',\n\t\t\t\tdisplay: 'flex',\n\t\t\t\t'align-items': 'center',\n\t\t\t\t'justify-content': 'center',\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Inline style for the media wrapper, enforcing the aspect ratio.\n\t\t *\n\t\t * @return {object} the media style.\n\t\t */\n\t\tmediaStyle() {\n\t\t\tconst [w, h] = this.aspectRatio.split(':')\n\t\t\tconst ratio = Number(w) / Number(h)\n\t\t\t// A cell wider than the ratio fits the video by its height.\n\t\t\tconst { width, height } = this.box\n\t\t\tconst fitsByHeight = height > 0 && width / height > ratio\n\t\t\treturn {\n\t\t\t\twidth: fitsByHeight ? `${Math.floor(height * ratio)}px` : '100%',\n\t\t\t\t'max-width': '100%',\n\t\t\t\t'aspect-ratio': `${w} / ${h}`,\n\t\t\t\tdisplay: 'flex',\n\t\t\t\t'align-items': 'center',\n\t\t\t\t'justify-content': 'center',\n\t\t\t\tbackground: 'var(--color-background-dark)',\n\t\t\t}\n\t\t},\n\t},\n\n\twatch: {\n\t\t// Re-arm the failure flag when the source changes so a previously\n\t\t// failed file does not permanently lock the cell.\n\t\tfileStreamingUrl() {\n\t\t\tthis.videoLoadFailed = false\n\t\t},\n\n\t\tvideoUrl() {\n\t\t\tthis.videoLoadFailed = false\n\t\t},\n\t},\n\n\tmounted() {\n\t\tif (typeof ResizeObserver === 'undefined') {\n\t\t\treturn\n\t\t}\n\t\tthis.resizeObserver = new ResizeObserver((entries) => {\n\t\t\tconst rect = entries[0] && entries[0].contentRect\n\t\t\tif (rect) {\n\t\t\t\tthis.box = { width: rect.width, height: rect.height }\n\t\t\t}\n\t\t})\n\t\tthis.resizeObserver.observe(this.$el)\n\t},\n\n\tbeforeUnmount() {\n\t\tif (this.resizeObserver) {\n\t\t\tthis.resizeObserver.disconnect()\n\t\t}\n\t},\n\n\tmethods: {\n\t\t/**\n\t\t * HTML5 `<video>` error handler — swaps to the error placeholder. The\n\t\t * event is swallowed so no exception bubbles into the grid layer.\n\t\t *\n\t\t * @return {void}\n\t\t */\n\t\tonVideoError() {\n\t\t\tthis.videoLoadFailed = true\n\t\t},\n\t},\n}\n</script>\n\n<style scoped>\n.cn-video-widget {\n\twidth: 100%;\n\theight: 100%;\n\toverflow: hidden;\n}\n\n.cn-video-widget__media {\n\tposition: relative;\n}\n\n.cn-video-widget__iframe,\n.cn-video-widget__video {\n\twidth: 100%;\n\theight: 100%;\n\tborder: 0;\n\tdisplay: block;\n\tbackground: var(--color-background-dark);\n}\n\n.cn-video-widget__placeholder {\n\twidth: 100%;\n\theight: 100%;\n\tdisplay: flex;\n\tflex-direction: column;\n\talign-items: center;\n\tjustify-content: center;\n\tgap: 8px;\n\tcolor: var(--color-text-maxcontrast);\n\tpadding: 16px;\n\ttext-align: center;\n}\n\n.cn-video-widget__placeholder-label {\n\tfont-size: 13px;\n}\n\n.cn-video-widget__placeholder-help {\n\tfont-size: 12px;\n}\n\n.cn-video-widget__configure {\n\tpadding: 4px 12px;\n\tborder: 1px solid var(--color-border);\n\tborder-radius: var(--border-radius);\n\tbackground: transparent;\n\tcolor: var(--color-main-text);\n\tcursor: pointer;\n}\n</style>\n"],"names":["_createElementVNode","_toDisplayString","_createElementBlock","_createVNode"],"mappings":";;;;AAciB,EAAA,KAAA,EAAA;;AAER,MAAA,UAAA,GAAA,EAAA,KAAK,EAAC,oCAAsB;AAC5B,MAAA,UAAA,GAAA,EAAA,KAAK,EAAC,mCAAW;;;AASlB,EAAA,KAAA,EAAA;;AAEC,MAAA,UAAA,GAAA,EAAA,KAAK,EAAC,oCAAO;;;;;;;;SAhB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c;AAC7B,kBAAA,eAAe,EAAf,EAAe;AACf,kBAAA,WAAW,EAAC;;iBAED,QAAA,CAAA,YAAW;;;AACtB,oBAAA,KAAK,EAAC,wBAAK;AACV,oBAAA,GAAG,EAAE,QAAA,CAAA,gBAAa;AAClB,oBAAA,MAAM,EAAE,QAAA,CAAA,SAAS,IAAA,IAAA;AACjB,oBAAA,QAAE,EAAA,QAAA,CAAA,iBAAA;AACF,oBAAA,KAAC,EAAA,QAAA,CAAA,cAAA;;;;;;;;;;"}
@@ -2,7 +2,7 @@ import script from './CnVideoWidgetForm2.vue.js';
2
2
  import { render } from './CnVideoWidgetForm3.vue.js';
3
3
 
4
4
  script.render = render;
5
- script.__scopeId = "data-v-64939729";
5
+ script.__scopeId = "data-v-629b8baa";
6
6
  const __sfc_main = script;
7
7
 
8
8
  export { __sfc_main as default };
@@ -47,6 +47,17 @@ var script = {
47
47
  type: Object,
48
48
  default: () => ({ ...DEFAULT_CONTENT }),
49
49
  },
50
+
51
+ /**
52
+ * An error the host found for the current URL (its server-side parse,
53
+ * say). Shown under the URL field in place of the form's own message,
54
+ * and returned by `validate()`, so the dialog cannot save. Empty when
55
+ * the host has no objection.
56
+ */
57
+ urlError: {
58
+ type: String,
59
+ default: '',
60
+ },
50
61
  },
51
62
 
52
63
  emits: [
@@ -228,6 +239,10 @@ var script = {
228
239
  errors.push(translate('nextcloud-vue', 'Video URL is required'));
229
240
  return errors
230
241
  }
242
+ if (this.urlError) {
243
+ errors.push(this.urlError);
244
+ return errors
245
+ }
231
246
  if (this.detectedSource === null) {
232
247
  errors.push(translate('nextcloud-vue', 'Invalid video URL or domain not allowed.'));
233
248
  return errors
@@ -1 +1 @@
1
- {"version":3,"file":"CnVideoWidgetForm2.vue.js","sources":["../../../../src/components/CnVideoWidgetForm/CnVideoWidgetForm.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-video-form\">\n\t\t<NcTextField\n\t\t\t:modelValue=\"videoUrl\"\n\t\t\t:label=\"t('nextcloud-vue', 'Video URL')\"\n\t\t\tplaceholder=\"https://www.youtube.com/watch?v=...\"\n\t\t\trequired\n\t\t\t@update:modelValue=\"onUrlInput\" />\n\n\t\t<div v-if=\"detectedSource\" class=\"cn-video-form__hint\">\n\t\t\t{{ detectedSourceLabel }}\n\t\t</div>\n\t\t<div v-else-if=\"hasUrl\" class=\"cn-video-form__error\" role=\"alert\">\n\t\t\t{{ t('nextcloud-vue', 'Invalid video URL or domain not allowed.') }}\n\t\t</div>\n\n\t\t<NcTextField\n\t\t\tv-if=\"sourceType === 'nc-file'\"\n\t\t\t:modelValue=\"String(fileId || '')\"\n\t\t\t:label=\"t('nextcloud-vue', 'Nextcloud File ID')\"\n\t\t\tplaceholder=\"12345\"\n\t\t\t@update:modelValue=\"onFileIdInput\" />\n\n\t\t<NcSelect\n\t\t\t:modelValue=\"aspectRatio\"\n\t\t\t:options=\"aspectRatioOptions\"\n\t\t\t:inputLabel=\"t('nextcloud-vue', 'Aspect Ratio')\"\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('aspectRatio', $event)\" />\n\n\t\t<NcCheckboxRadioSwitch\n\t\t\t:modelValue=\"autoplay\"\n\t\t\t@update:modelValue=\"onAutoplayToggle\">\n\t\t\t{{ t('nextcloud-vue', 'Autoplay') }}\n\t\t</NcCheckboxRadioSwitch>\n\t\t<div v-if=\"autoplay\" class=\"cn-video-form__hint\">\n\t\t\t{{ t('nextcloud-vue', 'Autoplay requires muting') }}\n\t\t</div>\n\n\t\t<NcCheckboxRadioSwitch\n\t\t\t:modelValue=\"muted\"\n\t\t\t:disabled=\"autoplay\"\n\t\t\t@update:modelValue=\"updateField('muted', $event)\">\n\t\t\t{{ t('nextcloud-vue', 'Muted') }}\n\t\t</NcCheckboxRadioSwitch>\n\n\t\t<NcCheckboxRadioSwitch\n\t\t\t:modelValue=\"loop\"\n\t\t\t@update:modelValue=\"updateField('loop', $event)\">\n\t\t\t{{ t('nextcloud-vue', 'Loop') }}\n\t\t</NcCheckboxRadioSwitch>\n\n\t\t<NcCheckboxRadioSwitch\n\t\t\t:modelValue=\"controls\"\n\t\t\t@update:modelValue=\"updateField('controls', $event)\">\n\t\t\t{{ t('nextcloud-vue', 'Show controls') }}\n\t\t</NcCheckboxRadioSwitch>\n\n\t\t<NcTextField\n\t\t\t:modelValue=\"posterUrl\"\n\t\t\t:label=\"t('nextcloud-vue', 'Poster Image URL (optional)')\"\n\t\t\tplaceholder=\"https://example.com/poster.jpg\"\n\t\t\t@update:modelValue=\"updateField('posterUrl', $event)\" />\n\t</div>\n</template>\n\n<script>\nimport { translate as t } from '@nextcloud/l10n'\nimport { NcCheckboxRadioSwitch, NcSelect, NcTextField } from '@nextcloud/vue'\nimport { detectVideoSource, normalizeEmbedUrl } from '../CnVideoWidget/videoUrlParser.js'\n\nconst VALID_ASPECT_RATIOS = ['16:9', '4:3', '1:1', '9:16']\n\nconst DEFAULT_CONTENT = Object.freeze({\n\tsourceType: null,\n\tvideoUrl: '',\n\tfileId: null,\n\tautoplay: false,\n\tmuted: true,\n\tloop: false,\n\tcontrols: true,\n\taspectRatio: '16:9',\n\tposterUrl: '',\n})\n\n/**\n * CnVideoWidgetForm — sub-form mounted inside the add-widget modal when the\n * user is creating or editing a `video` placement.\n *\n * Detects the platform (YouTube, Vimeo, PeerTube, Nextcloud Files) from the\n * URL and pre-computes the canonical embed URL. `validate()` returns errors\n * when the URL is empty or does not parse to a known source.\n *\n * @spec openspec/changes/cn-widget-library/specs/cn-widget-library/spec.md\n */\nexport default {\n\tname: 'CnVideoWidgetForm',\n\n\tcomponents: {\n\t\tNcTextField,\n\t\tNcSelect,\n\t\tNcCheckboxRadioSwitch,\n\t},\n\n\tprops: {\n\t\t/** The placement being edited, or `null` in create mode. */\n\t\teditingWidget: {\n\t\t\ttype: Object,\n\t\t\tdefault: null,\n\t\t},\n\n\t\t/** Initial content values (registry defaults when not editing). */\n\t\tvalue: {\n\t\t\ttype: Object,\n\t\t\tdefault: () => ({ ...DEFAULT_CONTENT }),\n\t\t},\n\t},\n\n\temits: [\n\t\t/**\n\t\t * Emitted on every change with the assembled content payload.\n\t\t *\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\treturn {\n\t\t\tvideoUrl: typeof initial.videoUrl === 'string' ? initial.videoUrl : DEFAULT_CONTENT.videoUrl,\n\t\t\tsourceType: typeof initial.sourceType === 'string' ? initial.sourceType : DEFAULT_CONTENT.sourceType,\n\t\t\tfileId: typeof initial.fileId === 'number' ? initial.fileId : DEFAULT_CONTENT.fileId,\n\t\t\tautoplay: typeof initial.autoplay === 'boolean' ? initial.autoplay : DEFAULT_CONTENT.autoplay,\n\t\t\tmuted: typeof initial.muted === 'boolean' ? initial.muted : DEFAULT_CONTENT.muted,\n\t\t\tloop: typeof initial.loop === 'boolean' ? initial.loop : DEFAULT_CONTENT.loop,\n\t\t\tcontrols: typeof initial.controls === 'boolean' ? initial.controls : DEFAULT_CONTENT.controls,\n\t\t\taspectRatio: VALID_ASPECT_RATIOS.includes(initial.aspectRatio)\n\t\t\t\t? initial.aspectRatio\n\t\t\t\t: DEFAULT_CONTENT.aspectRatio,\n\n\t\t\tposterUrl: typeof initial.posterUrl === 'string' ? initial.posterUrl : DEFAULT_CONTENT.posterUrl,\n\t\t}\n\t},\n\n\tcomputed: {\n\t\t/**\n\t\t * Whether a non-empty URL has been entered.\n\t\t *\n\t\t * @return {boolean} true when `videoUrl` is non-empty.\n\t\t */\n\t\thasUrl() {\n\t\t\treturn typeof this.videoUrl === 'string' && this.videoUrl.trim() !== ''\n\t\t},\n\n\t\t/**\n\t\t * The detected source type for the current URL.\n\t\t *\n\t\t * @return {string|null} the detected source, or `null`.\n\t\t */\n\t\tdetectedSource() {\n\t\t\tif (!this.hasUrl) {\n\t\t\t\treturn null\n\t\t\t}\n\t\t\treturn detectVideoSource(this.videoUrl)\n\t\t},\n\n\t\t/**\n\t\t * The localised \"Detected: X\" hint label.\n\t\t *\n\t\t * @return {string} the detection hint.\n\t\t */\n\t\tdetectedSourceLabel() {\n\t\t\tswitch (this.detectedSource) {\n\t\t\t\tcase 'youtube':\n\t\t\t\t\treturn t('nextcloud-vue', 'Detected: YouTube')\n\t\t\t\tcase 'vimeo':\n\t\t\t\t\treturn t('nextcloud-vue', 'Detected: Vimeo')\n\t\t\t\tcase 'peertube':\n\t\t\t\t\treturn t('nextcloud-vue', 'Detected: PeerTube')\n\t\t\t\tcase 'nc-file':\n\t\t\t\t\treturn t('nextcloud-vue', 'Detected: Nextcloud File')\n\t\t\t\tdefault:\n\t\t\t\t\treturn ''\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * The aspect-ratio dropdown options.\n\t\t *\n\t\t * @return {Array<{value: string, label: string}>} the options.\n\t\t */\n\t\taspectRatioOptions() {\n\t\t\treturn [\n\t\t\t\t{ value: '16:9', label: '16:9' },\n\t\t\t\t{ value: '4:3', label: '4:3' },\n\t\t\t\t{ value: '1:1', label: '1:1' },\n\t\t\t\t{ value: '9:16', label: '9:16' },\n\t\t\t]\n\t\t},\n\n\t\t/**\n\t\t * The assembled `content` payload emitted to the parent.\n\t\t *\n\t\t * @return {object} the content blob.\n\t\t */\n\t\tassembledContent() {\n\t\t\treturn {\n\t\t\t\tsourceType: this.sourceType,\n\t\t\t\tvideoUrl: this.normalizedVideoUrl,\n\t\t\t\tfileId: this.fileId,\n\t\t\t\tautoplay: this.autoplay,\n\t\t\t\t// Autoplay forces muted.\n\t\t\t\tmuted: this.autoplay ? true : this.muted,\n\t\t\t\tloop: this.loop,\n\t\t\t\tcontrols: this.controls,\n\t\t\t\taspectRatio: this.aspectRatio,\n\t\t\t\tposterUrl: this.posterUrl,\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * The canonical embed URL emitted upward (raw for nc-file inputs).\n\t\t *\n\t\t * @return {string} the embed URL.\n\t\t */\n\t\tnormalizedVideoUrl() {\n\t\t\tif (!this.detectedSource || this.detectedSource === 'nc-file') {\n\t\t\t\treturn this.videoUrl\n\t\t\t}\n\t\t\treturn normalizeEmbedUrl(this.videoUrl, this.detectedSource) || this.videoUrl\n\t\t},\n\t},\n\n\tmethods: {\n\t\t/**\n\t\t * Set a field and emit `update:content`.\n\t\t *\n\t\t * @param {string} field the field name.\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 * URL change handler — drives source-type detection and emits.\n\t\t *\n\t\t * @param {string} value the new URL.\n\t\t * @return {void}\n\t\t */\n\t\tonUrlInput(value) {\n\t\t\tthis.videoUrl = value\n\t\t\tconst detected = detectVideoSource(value)\n\t\t\tthis.sourceType = detected\n\t\t\tthis.$emit('update:content', this.assembledContent)\n\t\t},\n\n\t\t/**\n\t\t * File-id change handler for `nc-file` sources.\n\t\t *\n\t\t * @param {string} value the raw input value.\n\t\t * @return {void}\n\t\t */\n\t\tonFileIdInput(value) {\n\t\t\tconst parsed = parseInt(String(value).trim(), 10)\n\t\t\tthis.fileId = Number.isFinite(parsed) ? parsed : null\n\t\t\tthis.$emit('update:content', this.assembledContent)\n\t\t},\n\n\t\t/**\n\t\t * Autoplay toggle handler — coerces muted=true while autoplay is on.\n\t\t *\n\t\t * @param {boolean} checked the autoplay checkbox value.\n\t\t * @return {void}\n\t\t */\n\t\tonAutoplayToggle(checked) {\n\t\t\tthis.autoplay = checked\n\t\t\tif (checked) {\n\t\t\t\tthis.muted = true\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. Requires a URL plus a recognised source.\n\t\t *\n\t\t * @return {string[]} the validation errors (empty when valid).\n\t\t */\n\t\tvalidate() {\n\t\t\tconst errors = []\n\t\t\tif (!this.hasUrl) {\n\t\t\t\terrors.push(t('nextcloud-vue', 'Video URL is required'))\n\t\t\t\treturn errors\n\t\t\t}\n\t\t\tif (this.detectedSource === null) {\n\t\t\t\terrors.push(t('nextcloud-vue', 'Invalid video URL or domain not allowed.'))\n\t\t\t\treturn errors\n\t\t\t}\n\t\t\tif (this.detectedSource === 'nc-file' && this.fileId === null) {\n\t\t\t\terrors.push(t('nextcloud-vue', 'Nextcloud file ID is required'))\n\t\t\t}\n\t\t\treturn errors\n\t\t},\n\t},\n}\n</script>\n\n<style scoped>\n.cn-video-form {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 12px;\n}\n\n.cn-video-form__hint {\n\tfont-size: 12px;\n\tcolor: var(--color-text-maxcontrast);\n}\n\n.cn-video-form__error {\n\tcolor: var(--color-error);\n\tfont-size: 13px;\n}\n</style>\n"],"names":["t"],"mappings":";;;;AA8EA,MAAM,mBAAkB,GAAI,CAAC,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM;;AAEzD,MAAM,eAAc,GAAI,MAAM,CAAC,MAAM,CAAC;AACrC,CAAA,UAAU,EAAE,IAAI;CAChB,QAAQ,EAAE,EAAE;CACZ,MAAM,EAAE,IAAI;AACZ,CAAA,QAAQ,EAAE,KAAK;CACf,KAAK,EAAE,IAAI;CACX,IAAI,EAAE,KAAK;CACX,QAAQ,EAAE,IAAI;AACd,CAAA,WAAW,EAAE,MAAM;CACnB,SAAS,EAAE,EAAE;AACd,CAAC;;AAED;AACC;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAED,aAAe;CACd,IAAI,EAAE,mBAAmB;;CAEzB,UAAU,EAAE;EACX,WAAW;AACX,EAAA,QAAQ;AACR,EAAA,qBAAqB;EACrB;;AAED,CAAA,KAAK,EAAE;;AAEN,EAAA,aAAa,EAAE;GACd,IAAI,EAAE,MAAM;GACZ,OAAO,EAAE,IAAI;GACb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,MAAM,SAAS,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,EAAE,EAAE;GAChD,IAAI,CAAC,MAAK,GAAI,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAA,GAAI,SAAS;GACjD,IAAI,CAAC,KAAK,CAAC,gBAAgB,EAAE,IAAI,CAAC,gBAAgB;EACnD,CAAC;;AAED;;AAEC;;;;EAID,gBAAgB,CAAC,OAAO,EAAE;AACzB,GAAA,IAAI,CAAC,WAAW;GAChB,IAAI,OAAO,EAAE;AACZ,IAAA,IAAI,CAAC,KAAI,GAAI;AACd,GAAA;GACA,IAAI,CAAC,KAAK,CAAC,gBAAgB,EAAE,IAAI,CAAC,gBAAgB;EACnD,CAAC;;AAED;;AAEC;;;EAGD,QAAQ,GAAG;GACV,MAAM,MAAK,GAAI;AACf,GAAA,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE;IACjB,MAAM,CAAC,IAAI,CAACA,SAAC,CAAC,eAAe,EAAE,uBAAuB,CAAC;IACvD,OAAO;AACR,GAAA;AACA,GAAA,IAAI,IAAI,CAAC,cAAa,KAAM,IAAI,EAAE;AACjC,IAAA,MAAM,CAAC,IAAI,CAACA,SAAC,CAAC,eAAe,EAAE,0CAA0C,CAAC;IAC1E,OAAO;AACR,GAAA;GACA,IAAI,IAAI,CAAC,cAAa,KAAM,SAAQ,IAAK,IAAI,CAAC,MAAK,KAAM,IAAI,EAAE;IAC9D,MAAM,CAAC,IAAI,CAACA,SAAC,CAAC,eAAe,EAAE,+BAA+B,CAAC;AAChE,GAAA;GACA,OAAO;EACR,CAAC;EACD;AACF;;"}
1
+ {"version":3,"file":"CnVideoWidgetForm2.vue.js","sources":["../../../../src/components/CnVideoWidgetForm/CnVideoWidgetForm.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-video-form\">\n\t\t<NcTextField\n\t\t\t:modelValue=\"videoUrl\"\n\t\t\t:label=\"t('nextcloud-vue', 'Video URL')\"\n\t\t\tplaceholder=\"https://www.youtube.com/watch?v=...\"\n\t\t\trequired\n\t\t\t@update:modelValue=\"onUrlInput\" />\n\n\t\t<div v-if=\"urlError && hasUrl\" class=\"cn-video-form__error\" role=\"alert\">\n\t\t\t{{ urlError }}\n\t\t</div>\n\t\t<div v-else-if=\"detectedSource\" class=\"cn-video-form__hint\">\n\t\t\t{{ detectedSourceLabel }}\n\t\t</div>\n\t\t<div v-else-if=\"hasUrl\" class=\"cn-video-form__error\" role=\"alert\">\n\t\t\t{{ t('nextcloud-vue', 'Invalid video URL or domain not allowed.') }}\n\t\t</div>\n\n\t\t<NcTextField\n\t\t\tv-if=\"sourceType === 'nc-file'\"\n\t\t\t:modelValue=\"String(fileId || '')\"\n\t\t\t:label=\"t('nextcloud-vue', 'Nextcloud File ID')\"\n\t\t\tplaceholder=\"12345\"\n\t\t\t@update:modelValue=\"onFileIdInput\" />\n\n\t\t<NcSelect\n\t\t\t:modelValue=\"aspectRatio\"\n\t\t\t:options=\"aspectRatioOptions\"\n\t\t\t:inputLabel=\"t('nextcloud-vue', 'Aspect Ratio')\"\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('aspectRatio', $event)\" />\n\n\t\t<NcCheckboxRadioSwitch\n\t\t\t:modelValue=\"autoplay\"\n\t\t\t@update:modelValue=\"onAutoplayToggle\">\n\t\t\t{{ t('nextcloud-vue', 'Autoplay') }}\n\t\t</NcCheckboxRadioSwitch>\n\t\t<div v-if=\"autoplay\" class=\"cn-video-form__hint\">\n\t\t\t{{ t('nextcloud-vue', 'Autoplay requires muting') }}\n\t\t</div>\n\n\t\t<NcCheckboxRadioSwitch\n\t\t\t:modelValue=\"muted\"\n\t\t\t:disabled=\"autoplay\"\n\t\t\t@update:modelValue=\"updateField('muted', $event)\">\n\t\t\t{{ t('nextcloud-vue', 'Muted') }}\n\t\t</NcCheckboxRadioSwitch>\n\n\t\t<NcCheckboxRadioSwitch\n\t\t\t:modelValue=\"loop\"\n\t\t\t@update:modelValue=\"updateField('loop', $event)\">\n\t\t\t{{ t('nextcloud-vue', 'Loop') }}\n\t\t</NcCheckboxRadioSwitch>\n\n\t\t<NcCheckboxRadioSwitch\n\t\t\t:modelValue=\"controls\"\n\t\t\t@update:modelValue=\"updateField('controls', $event)\">\n\t\t\t{{ t('nextcloud-vue', 'Show controls') }}\n\t\t</NcCheckboxRadioSwitch>\n\n\t\t<NcTextField\n\t\t\t:modelValue=\"posterUrl\"\n\t\t\t:label=\"t('nextcloud-vue', 'Poster Image URL (optional)')\"\n\t\t\tplaceholder=\"https://example.com/poster.jpg\"\n\t\t\t@update:modelValue=\"updateField('posterUrl', $event)\" />\n\t</div>\n</template>\n\n<script>\nimport { translate as t } from '@nextcloud/l10n'\nimport { NcCheckboxRadioSwitch, NcSelect, NcTextField } from '@nextcloud/vue'\nimport { detectVideoSource, normalizeEmbedUrl } from '../CnVideoWidget/videoUrlParser.js'\n\nconst VALID_ASPECT_RATIOS = ['16:9', '4:3', '1:1', '9:16']\n\nconst DEFAULT_CONTENT = Object.freeze({\n\tsourceType: null,\n\tvideoUrl: '',\n\tfileId: null,\n\tautoplay: false,\n\tmuted: true,\n\tloop: false,\n\tcontrols: true,\n\taspectRatio: '16:9',\n\tposterUrl: '',\n})\n\n/**\n * CnVideoWidgetForm — sub-form mounted inside the add-widget modal when the\n * user is creating or editing a `video` placement.\n *\n * Detects the platform (YouTube, Vimeo, PeerTube, Nextcloud Files) from the\n * URL and pre-computes the canonical embed URL. `validate()` returns errors\n * when the URL is empty or does not parse to a known source.\n *\n * @spec openspec/changes/cn-widget-library/specs/cn-widget-library/spec.md\n */\nexport default {\n\tname: 'CnVideoWidgetForm',\n\n\tcomponents: {\n\t\tNcTextField,\n\t\tNcSelect,\n\t\tNcCheckboxRadioSwitch,\n\t},\n\n\tprops: {\n\t\t/** The placement being edited, or `null` in create mode. */\n\t\teditingWidget: {\n\t\t\ttype: Object,\n\t\t\tdefault: null,\n\t\t},\n\n\t\t/** Initial content values (registry defaults when not editing). */\n\t\tvalue: {\n\t\t\ttype: Object,\n\t\t\tdefault: () => ({ ...DEFAULT_CONTENT }),\n\t\t},\n\n\t\t/**\n\t\t * An error the host found for the current URL (its server-side parse,\n\t\t * say). Shown under the URL field in place of the form's own message,\n\t\t * and returned by `validate()`, so the dialog cannot save. Empty when\n\t\t * the host has no objection.\n\t\t */\n\t\turlError: {\n\t\t\ttype: String,\n\t\t\tdefault: '',\n\t\t},\n\t},\n\n\temits: [\n\t\t/**\n\t\t * Emitted on every change with the assembled content payload.\n\t\t *\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\treturn {\n\t\t\tvideoUrl: typeof initial.videoUrl === 'string' ? initial.videoUrl : DEFAULT_CONTENT.videoUrl,\n\t\t\tsourceType: typeof initial.sourceType === 'string' ? initial.sourceType : DEFAULT_CONTENT.sourceType,\n\t\t\tfileId: typeof initial.fileId === 'number' ? initial.fileId : DEFAULT_CONTENT.fileId,\n\t\t\tautoplay: typeof initial.autoplay === 'boolean' ? initial.autoplay : DEFAULT_CONTENT.autoplay,\n\t\t\tmuted: typeof initial.muted === 'boolean' ? initial.muted : DEFAULT_CONTENT.muted,\n\t\t\tloop: typeof initial.loop === 'boolean' ? initial.loop : DEFAULT_CONTENT.loop,\n\t\t\tcontrols: typeof initial.controls === 'boolean' ? initial.controls : DEFAULT_CONTENT.controls,\n\t\t\taspectRatio: VALID_ASPECT_RATIOS.includes(initial.aspectRatio)\n\t\t\t\t? initial.aspectRatio\n\t\t\t\t: DEFAULT_CONTENT.aspectRatio,\n\n\t\t\tposterUrl: typeof initial.posterUrl === 'string' ? initial.posterUrl : DEFAULT_CONTENT.posterUrl,\n\t\t}\n\t},\n\n\tcomputed: {\n\t\t/**\n\t\t * Whether a non-empty URL has been entered.\n\t\t *\n\t\t * @return {boolean} true when `videoUrl` is non-empty.\n\t\t */\n\t\thasUrl() {\n\t\t\treturn typeof this.videoUrl === 'string' && this.videoUrl.trim() !== ''\n\t\t},\n\n\t\t/**\n\t\t * The detected source type for the current URL.\n\t\t *\n\t\t * @return {string|null} the detected source, or `null`.\n\t\t */\n\t\tdetectedSource() {\n\t\t\tif (!this.hasUrl) {\n\t\t\t\treturn null\n\t\t\t}\n\t\t\treturn detectVideoSource(this.videoUrl)\n\t\t},\n\n\t\t/**\n\t\t * The localised \"Detected: X\" hint label.\n\t\t *\n\t\t * @return {string} the detection hint.\n\t\t */\n\t\tdetectedSourceLabel() {\n\t\t\tswitch (this.detectedSource) {\n\t\t\t\tcase 'youtube':\n\t\t\t\t\treturn t('nextcloud-vue', 'Detected: YouTube')\n\t\t\t\tcase 'vimeo':\n\t\t\t\t\treturn t('nextcloud-vue', 'Detected: Vimeo')\n\t\t\t\tcase 'peertube':\n\t\t\t\t\treturn t('nextcloud-vue', 'Detected: PeerTube')\n\t\t\t\tcase 'nc-file':\n\t\t\t\t\treturn t('nextcloud-vue', 'Detected: Nextcloud File')\n\t\t\t\tdefault:\n\t\t\t\t\treturn ''\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * The aspect-ratio dropdown options.\n\t\t *\n\t\t * @return {Array<{value: string, label: string}>} the options.\n\t\t */\n\t\taspectRatioOptions() {\n\t\t\treturn [\n\t\t\t\t{ value: '16:9', label: '16:9' },\n\t\t\t\t{ value: '4:3', label: '4:3' },\n\t\t\t\t{ value: '1:1', label: '1:1' },\n\t\t\t\t{ value: '9:16', label: '9:16' },\n\t\t\t]\n\t\t},\n\n\t\t/**\n\t\t * The assembled `content` payload emitted to the parent.\n\t\t *\n\t\t * @return {object} the content blob.\n\t\t */\n\t\tassembledContent() {\n\t\t\treturn {\n\t\t\t\tsourceType: this.sourceType,\n\t\t\t\tvideoUrl: this.normalizedVideoUrl,\n\t\t\t\tfileId: this.fileId,\n\t\t\t\tautoplay: this.autoplay,\n\t\t\t\t// Autoplay forces muted.\n\t\t\t\tmuted: this.autoplay ? true : this.muted,\n\t\t\t\tloop: this.loop,\n\t\t\t\tcontrols: this.controls,\n\t\t\t\taspectRatio: this.aspectRatio,\n\t\t\t\tposterUrl: this.posterUrl,\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * The canonical embed URL emitted upward (raw for nc-file inputs).\n\t\t *\n\t\t * @return {string} the embed URL.\n\t\t */\n\t\tnormalizedVideoUrl() {\n\t\t\tif (!this.detectedSource || this.detectedSource === 'nc-file') {\n\t\t\t\treturn this.videoUrl\n\t\t\t}\n\t\t\treturn normalizeEmbedUrl(this.videoUrl, this.detectedSource) || this.videoUrl\n\t\t},\n\t},\n\n\tmethods: {\n\t\t/**\n\t\t * Set a field and emit `update:content`.\n\t\t *\n\t\t * @param {string} field the field name.\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 * URL change handler — drives source-type detection and emits.\n\t\t *\n\t\t * @param {string} value the new URL.\n\t\t * @return {void}\n\t\t */\n\t\tonUrlInput(value) {\n\t\t\tthis.videoUrl = value\n\t\t\tconst detected = detectVideoSource(value)\n\t\t\tthis.sourceType = detected\n\t\t\tthis.$emit('update:content', this.assembledContent)\n\t\t},\n\n\t\t/**\n\t\t * File-id change handler for `nc-file` sources.\n\t\t *\n\t\t * @param {string} value the raw input value.\n\t\t * @return {void}\n\t\t */\n\t\tonFileIdInput(value) {\n\t\t\tconst parsed = parseInt(String(value).trim(), 10)\n\t\t\tthis.fileId = Number.isFinite(parsed) ? parsed : null\n\t\t\tthis.$emit('update:content', this.assembledContent)\n\t\t},\n\n\t\t/**\n\t\t * Autoplay toggle handler — coerces muted=true while autoplay is on.\n\t\t *\n\t\t * @param {boolean} checked the autoplay checkbox value.\n\t\t * @return {void}\n\t\t */\n\t\tonAutoplayToggle(checked) {\n\t\t\tthis.autoplay = checked\n\t\t\tif (checked) {\n\t\t\t\tthis.muted = true\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. Requires a URL plus a recognised source.\n\t\t *\n\t\t * @return {string[]} the validation errors (empty when valid).\n\t\t */\n\t\tvalidate() {\n\t\t\tconst errors = []\n\t\t\tif (!this.hasUrl) {\n\t\t\t\terrors.push(t('nextcloud-vue', 'Video URL is required'))\n\t\t\t\treturn errors\n\t\t\t}\n\t\t\tif (this.urlError) {\n\t\t\t\terrors.push(this.urlError)\n\t\t\t\treturn errors\n\t\t\t}\n\t\t\tif (this.detectedSource === null) {\n\t\t\t\terrors.push(t('nextcloud-vue', 'Invalid video URL or domain not allowed.'))\n\t\t\t\treturn errors\n\t\t\t}\n\t\t\tif (this.detectedSource === 'nc-file' && this.fileId === null) {\n\t\t\t\terrors.push(t('nextcloud-vue', 'Nextcloud file ID is required'))\n\t\t\t}\n\t\t\treturn errors\n\t\t},\n\t},\n}\n</script>\n\n<style scoped>\n.cn-video-form {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 12px;\n}\n\n.cn-video-form__hint {\n\tfont-size: 12px;\n\tcolor: var(--color-text-maxcontrast);\n}\n\n.cn-video-form__error {\n\tcolor: var(--color-error);\n\tfont-size: 13px;\n}\n</style>\n"],"names":["t"],"mappings":";;;;AAiFA,MAAM,mBAAkB,GAAI,CAAC,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM;;AAEzD,MAAM,eAAc,GAAI,MAAM,CAAC,MAAM,CAAC;AACrC,CAAA,UAAU,EAAE,IAAI;CAChB,QAAQ,EAAE,EAAE;CACZ,MAAM,EAAE,IAAI;AACZ,CAAA,QAAQ,EAAE,KAAK;CACf,KAAK,EAAE,IAAI;CACX,IAAI,EAAE,KAAK;CACX,QAAQ,EAAE,I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AAE;AACjC,IAAA,MAAM,CAAC,IAAI,CAACA,SAAC,CAAC,eAAe,EAAE,0CAA0C,CAAC;IAC1E,OAAO;AACR,GAAA;GACA,IAAI,IAAI,CAAC,cAAa,KAAM,SAAQ,IAAK,IAAI,CAAC,MAAK,KAAM,IAAI,EAAE;IAC9D,MAAM,CAAC,IAAI,CAACA,SAAC,CAAC,eAAe,EAAE,+BAA+B,CAAC;AAChE,GAAA;GACA,OAAO;EACR,CAAC;EACD;AACF;;"}
@@ -3,15 +3,20 @@ import { resolveComponent, openBlock, createElementBlock, createVNode, toDisplay
3
3
  const _hoisted_1 = { class: "cn-video-form" };
4
4
  const _hoisted_2 = {
5
5
  key: 0,
6
- class: "cn-video-form__hint"
6
+ class: "cn-video-form__error",
7
+ role: "alert"
7
8
  };
8
9
  const _hoisted_3 = {
9
10
  key: 1,
11
+ class: "cn-video-form__hint"
12
+ };
13
+ const _hoisted_4 = {
14
+ key: 2,
10
15
  class: "cn-video-form__error",
11
16
  role: "alert"
12
17
  };
13
- const _hoisted_4 = {
14
- key: 3,
18
+ const _hoisted_5 = {
19
+ key: 4,
15
20
  class: "cn-video-form__hint"
16
21
  };
17
22
 
@@ -28,14 +33,16 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
28
33
  required: "",
29
34
  "onUpdate:modelValue": $options.onUrlInput
30
35
  }, null, 8 /* PROPS */, ["modelValue", "label", "onUpdate:modelValue"]),
31
- ($options.detectedSource)
32
- ? (openBlock(), createElementBlock("div", _hoisted_2, toDisplayString($options.detectedSourceLabel), 1 /* TEXT */))
33
- : ($options.hasUrl)
34
- ? (openBlock(), createElementBlock("div", _hoisted_3, toDisplayString(_ctx.t('nextcloud-vue', 'Invalid video URL or domain not allowed.')), 1 /* TEXT */))
35
- : createCommentVNode("v-if", true),
36
+ ($props.urlError && $options.hasUrl)
37
+ ? (openBlock(), createElementBlock("div", _hoisted_2, toDisplayString($props.urlError), 1 /* TEXT */))
38
+ : ($options.detectedSource)
39
+ ? (openBlock(), createElementBlock("div", _hoisted_3, toDisplayString($options.detectedSourceLabel), 1 /* TEXT */))
40
+ : ($options.hasUrl)
41
+ ? (openBlock(), createElementBlock("div", _hoisted_4, toDisplayString(_ctx.t('nextcloud-vue', 'Invalid video URL or domain not allowed.')), 1 /* TEXT */))
42
+ : createCommentVNode("v-if", true),
36
43
  ($data.sourceType === 'nc-file')
37
44
  ? (openBlock(), createBlock(_component_NcTextField, {
38
- key: 2,
45
+ key: 3,
39
46
  modelValue: String($data.fileId || ''),
40
47
  label: _ctx.t('nextcloud-vue', 'Nextcloud File ID'),
41
48
  placeholder: "12345",
@@ -61,7 +68,7 @@ function render(_ctx, _cache, $props, $setup, $data, $options) {
61
68
  _: 1 /* STABLE */
62
69
  }, 8 /* PROPS */, ["modelValue", "onUpdate:modelValue"]),
63
70
  ($data.autoplay)
64
- ? (openBlock(), createElementBlock("div", _hoisted_4, toDisplayString(_ctx.t('nextcloud-vue', 'Autoplay requires muting')), 1 /* TEXT */))
71
+ ? (openBlock(), createElementBlock("div", _hoisted_5, toDisplayString(_ctx.t('nextcloud-vue', 'Autoplay requires muting')), 1 /* TEXT */))
65
72
  : createCommentVNode("v-if", true),
66
73
  createVNode(_component_NcCheckboxRadioSwitch, {
67
74
  modelValue: $data.muted,
@@ -1 +1 @@
1
- {"version":3,"file":"CnVideoWidgetForm3.vue.js","sources":["../../../../src/components/CnVideoWidgetForm/CnVideoWidgetForm.vue?vue&type=template&id=64939729&lang.js"],"sourcesContent":["<!--\n - SPDX-FileCopyrightText: 2026 Conduction B.V.\n - SPDX-License-Identifier: EUPL-1.2\n-->\n\n<template>\n\t<div class=\"cn-video-form\">\n\t\t<NcTextField\n\t\t\t:modelValue=\"videoUrl\"\n\t\t\t:label=\"t('nextcloud-vue', 'Video URL')\"\n\t\t\tplaceholder=\"https://www.youtube.com/watch?v=...\"\n\t\t\trequired\n\t\t\t@update:modelValue=\"onUrlInput\" />\n\n\t\t<div v-if=\"detectedSource\" class=\"cn-video-form__hint\">\n\t\t\t{{ detectedSourceLabel }}\n\t\t</div>\n\t\t<div v-else-if=\"hasUrl\" class=\"cn-video-form__error\" role=\"alert\">\n\t\t\t{{ t('nextcloud-vue', 'Invalid video URL or domain not allowed.') }}\n\t\t</div>\n\n\t\t<NcTextField\n\t\t\tv-if=\"sourceType === 'nc-file'\"\n\t\t\t:modelValue=\"String(fileId || '')\"\n\t\t\t:label=\"t('nextcloud-vue', 'Nextcloud File ID')\"\n\t\t\tplaceholder=\"12345\"\n\t\t\t@update:modelValue=\"onFileIdInput\" />\n\n\t\t<NcSelect\n\t\t\t:modelValue=\"aspectRatio\"\n\t\t\t:options=\"aspectRatioOptions\"\n\t\t\t:inputLabel=\"t('nextcloud-vue', 'Aspect Ratio')\"\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('aspectRatio', $event)\" />\n\n\t\t<NcCheckboxRadioSwitch\n\t\t\t:modelValue=\"autoplay\"\n\t\t\t@update:modelValue=\"onAutoplayToggle\">\n\t\t\t{{ t('nextcloud-vue', 'Autoplay') }}\n\t\t</NcCheckboxRadioSwitch>\n\t\t<div v-if=\"autoplay\" class=\"cn-video-form__hint\">\n\t\t\t{{ t('nextcloud-vue', 'Autoplay requires muting') }}\n\t\t</div>\n\n\t\t<NcCheckboxRadioSwitch\n\t\t\t:modelValue=\"muted\"\n\t\t\t:disabled=\"autoplay\"\n\t\t\t@update:modelValue=\"updateField('muted', $event)\">\n\t\t\t{{ t('nextcloud-vue', 'Muted') }}\n\t\t</NcCheckboxRadioSwitch>\n\n\t\t<NcCheckboxRadioSwitch\n\t\t\t:modelValue=\"loop\"\n\t\t\t@update:modelValue=\"updateField('loop', $event)\">\n\t\t\t{{ t('nextcloud-vue', 'Loop') }}\n\t\t</NcCheckboxRadioSwitch>\n\n\t\t<NcCheckboxRadioSwitch\n\t\t\t:modelValue=\"controls\"\n\t\t\t@update:modelValue=\"updateField('controls', $event)\">\n\t\t\t{{ t('nextcloud-vue', 'Show controls') }}\n\t\t</NcCheckboxRadioSwitch>\n\n\t\t<NcTextField\n\t\t\t:modelValue=\"posterUrl\"\n\t\t\t:label=\"t('nextcloud-vue', 'Poster Image URL (optional)')\"\n\t\t\tplaceholder=\"https://example.com/poster.jpg\"\n\t\t\t@update:modelValue=\"updateField('posterUrl', $event)\" />\n\t</div>\n</template>\n\n<script>\nimport { translate as t } from '@nextcloud/l10n'\nimport { NcCheckboxRadioSwitch, NcSelect, NcTextField } from '@nextcloud/vue'\nimport { detectVideoSource, normalizeEmbedUrl } from '../CnVideoWidget/videoUrlParser.js'\n\nconst VALID_ASPECT_RATIOS = ['16:9', '4:3', '1:1', '9:16']\n\nconst DEFAULT_CONTENT = Object.freeze({\n\tsourceType: null,\n\tvideoUrl: '',\n\tfileId: null,\n\tautoplay: false,\n\tmuted: true,\n\tloop: false,\n\tcontrols: true,\n\taspectRatio: '16:9',\n\tposterUrl: '',\n})\n\n/**\n * CnVideoWidgetForm — sub-form mounted inside the add-widget modal when the\n * user is creating or editing a `video` placement.\n *\n * Detects the platform (YouTube, Vimeo, PeerTube, Nextcloud Files) from the\n * URL and pre-computes the canonical embed URL. `validate()` returns errors\n * when the URL is empty or does not parse to a known source.\n *\n * @spec openspec/changes/cn-widget-library/specs/cn-widget-library/spec.md\n */\nexport default {\n\tname: 'CnVideoWidgetForm',\n\n\tcomponents: {\n\t\tNcTextField,\n\t\tNcSelect,\n\t\tNcCheckboxRadioSwitch,\n\t},\n\n\tprops: {\n\t\t/** The placement being edited, or `null` in create mode. */\n\t\teditingWidget: {\n\t\t\ttype: Object,\n\t\t\tdefault: null,\n\t\t},\n\n\t\t/** Initial content values (registry defaults when not editing). */\n\t\tvalue: {\n\t\t\ttype: Object,\n\t\t\tdefault: () => ({ ...DEFAULT_CONTENT }),\n\t\t},\n\t},\n\n\temits: [\n\t\t/**\n\t\t * Emitted on every change with the assembled content payload.\n\t\t *\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\treturn {\n\t\t\tvideoUrl: typeof initial.videoUrl === 'string' ? initial.videoUrl : DEFAULT_CONTENT.videoUrl,\n\t\t\tsourceType: typeof initial.sourceType === 'string' ? initial.sourceType : DEFAULT_CONTENT.sourceType,\n\t\t\tfileId: typeof initial.fileId === 'number' ? initial.fileId : DEFAULT_CONTENT.fileId,\n\t\t\tautoplay: typeof initial.autoplay === 'boolean' ? initial.autoplay : DEFAULT_CONTENT.autoplay,\n\t\t\tmuted: typeof initial.muted === 'boolean' ? initial.muted : DEFAULT_CONTENT.muted,\n\t\t\tloop: typeof initial.loop === 'boolean' ? initial.loop : DEFAULT_CONTENT.loop,\n\t\t\tcontrols: typeof initial.controls === 'boolean' ? initial.controls : DEFAULT_CONTENT.controls,\n\t\t\taspectRatio: VALID_ASPECT_RATIOS.includes(initial.aspectRatio)\n\t\t\t\t? initial.aspectRatio\n\t\t\t\t: DEFAULT_CONTENT.aspectRatio,\n\n\t\t\tposterUrl: typeof initial.posterUrl === 'string' ? initial.posterUrl : DEFAULT_CONTENT.posterUrl,\n\t\t}\n\t},\n\n\tcomputed: {\n\t\t/**\n\t\t * Whether a non-empty URL has been entered.\n\t\t *\n\t\t * @return {boolean} true when `videoUrl` is non-empty.\n\t\t */\n\t\thasUrl() {\n\t\t\treturn typeof this.videoUrl === 'string' && this.videoUrl.trim() !== ''\n\t\t},\n\n\t\t/**\n\t\t * The detected source type for the current URL.\n\t\t *\n\t\t * @return {string|null} the detected source, or `null`.\n\t\t */\n\t\tdetectedSource() {\n\t\t\tif (!this.hasUrl) {\n\t\t\t\treturn null\n\t\t\t}\n\t\t\treturn detectVideoSource(this.videoUrl)\n\t\t},\n\n\t\t/**\n\t\t * The localised \"Detected: X\" hint label.\n\t\t *\n\t\t * @return {string} the detection hint.\n\t\t */\n\t\tdetectedSourceLabel() {\n\t\t\tswitch (this.detectedSource) {\n\t\t\t\tcase 'youtube':\n\t\t\t\t\treturn t('nextcloud-vue', 'Detected: YouTube')\n\t\t\t\tcase 'vimeo':\n\t\t\t\t\treturn t('nextcloud-vue', 'Detected: Vimeo')\n\t\t\t\tcase 'peertube':\n\t\t\t\t\treturn t('nextcloud-vue', 'Detected: PeerTube')\n\t\t\t\tcase 'nc-file':\n\t\t\t\t\treturn t('nextcloud-vue', 'Detected: Nextcloud File')\n\t\t\t\tdefault:\n\t\t\t\t\treturn ''\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * The aspect-ratio dropdown options.\n\t\t *\n\t\t * @return {Array<{value: string, label: string}>} the options.\n\t\t */\n\t\taspectRatioOptions() {\n\t\t\treturn [\n\t\t\t\t{ value: '16:9', label: '16:9' },\n\t\t\t\t{ value: '4:3', label: '4:3' },\n\t\t\t\t{ value: '1:1', label: '1:1' },\n\t\t\t\t{ value: '9:16', label: '9:16' },\n\t\t\t]\n\t\t},\n\n\t\t/**\n\t\t * The assembled `content` payload emitted to the parent.\n\t\t *\n\t\t * @return {object} the content blob.\n\t\t */\n\t\tassembledContent() {\n\t\t\treturn {\n\t\t\t\tsourceType: this.sourceType,\n\t\t\t\tvideoUrl: this.normalizedVideoUrl,\n\t\t\t\tfileId: this.fileId,\n\t\t\t\tautoplay: this.autoplay,\n\t\t\t\t// Autoplay forces muted.\n\t\t\t\tmuted: this.autoplay ? true : this.muted,\n\t\t\t\tloop: this.loop,\n\t\t\t\tcontrols: this.controls,\n\t\t\t\taspectRatio: this.aspectRatio,\n\t\t\t\tposterUrl: this.posterUrl,\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * The canonical embed URL emitted upward (raw for nc-file inputs).\n\t\t *\n\t\t * @return {string} the embed URL.\n\t\t */\n\t\tnormalizedVideoUrl() {\n\t\t\tif (!this.detectedSource || this.detectedSource === 'nc-file') {\n\t\t\t\treturn this.videoUrl\n\t\t\t}\n\t\t\treturn normalizeEmbedUrl(this.videoUrl, this.detectedSource) || this.videoUrl\n\t\t},\n\t},\n\n\tmethods: {\n\t\t/**\n\t\t * Set a field and emit `update:content`.\n\t\t *\n\t\t * @param {string} field the field name.\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 * URL change handler — drives source-type detection and emits.\n\t\t *\n\t\t * @param {string} value the new URL.\n\t\t * @return {void}\n\t\t */\n\t\tonUrlInput(value) {\n\t\t\tthis.videoUrl = value\n\t\t\tconst detected = detectVideoSource(value)\n\t\t\tthis.sourceType = detected\n\t\t\tthis.$emit('update:content', this.assembledContent)\n\t\t},\n\n\t\t/**\n\t\t * File-id change handler for `nc-file` sources.\n\t\t *\n\t\t * @param {string} value the raw input value.\n\t\t * @return {void}\n\t\t */\n\t\tonFileIdInput(value) {\n\t\t\tconst parsed = parseInt(String(value).trim(), 10)\n\t\t\tthis.fileId = Number.isFinite(parsed) ? parsed : null\n\t\t\tthis.$emit('update:content', this.assembledContent)\n\t\t},\n\n\t\t/**\n\t\t * Autoplay toggle handler — coerces muted=true while autoplay is on.\n\t\t *\n\t\t * @param {boolean} checked the autoplay checkbox value.\n\t\t * @return {void}\n\t\t */\n\t\tonAutoplayToggle(checked) {\n\t\t\tthis.autoplay = checked\n\t\t\tif (checked) {\n\t\t\t\tthis.muted = true\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. Requires a URL plus a recognised source.\n\t\t *\n\t\t * @return {string[]} the validation errors (empty when valid).\n\t\t */\n\t\tvalidate() {\n\t\t\tconst errors = []\n\t\t\tif (!this.hasUrl) {\n\t\t\t\terrors.push(t('nextcloud-vue', 'Video URL is required'))\n\t\t\t\treturn errors\n\t\t\t}\n\t\t\tif (this.detectedSource === null) {\n\t\t\t\terrors.push(t('nextcloud-vue', 'Invalid video URL or domain not allowed.'))\n\t\t\t\treturn errors\n\t\t\t}\n\t\t\tif (this.detectedSource === 'nc-file' && this.fileId === null) {\n\t\t\t\terrors.push(t('nextcloud-vue', 'Nextcloud file ID is required'))\n\t\t\t}\n\t\t\treturn errors\n\t\t},\n\t},\n}\n</script>\n\n<style scoped>\n.cn-video-form {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 12px;\n}\n\n.cn-video-form__hint {\n\tfont-size: 12px;\n\tcolor: var(--color-text-maxcontrast);\n}\n\n.cn-video-form__error {\n\tcolor: var(--color-error);\n\tfont-size: 13px;\n}\n</style>\n"],"names":["_openBlock","_createElementBlock","_createVNode","_toDisplayString","_createBlock"],"mappings":";;AAWM,MAAA,UAAA,GAAA,EAAA,KAAI,EAAA,eAAA;;;AAQH,EAAA,KAAA,EAAA;;;;AAGmB,EAAA,KAAK,EAAC,sBAAC;AAAA,EAAA,IAAA,EAAA;;;;AAyBZ,EAAA,KAAA,EAAA;;;;;;;;AApClB,EAAA,QAAAA,SAAA,EAAA,EAAAC,kBAAA,QAAA;IACAC,WAAA,CAKkC,sBAAA,EAAA;;AAHjC,MAAA,KAAK,EAAE,IAAA,CAAA,CAAC,CAAA,eAAA,EAAA,WAAA,CAAA;AACT,MAAA,WAAW,EAAC,qCAAY;AACxB,MAAA,QAAI,EAAJ,EAAI;AACH,MAAA,qBAAiB,EAAE,QAAA,CAAA;;KAEhB,QAAA,CAAA,cAAA;sBAALD,kBAAA,CAEM,KAAA,EAFN,UAEM,EAAAE,eAAA;SACU,QAAA,CAAA,MAAM;2CAEhB,KAAA,YAAA,EAAAA,eAAA,CADF,IAAA,CAAA,CAAC,CAAA,eAAA,EAAA,0CAAA,CAAA,CAAA,EAAA,CAAA,YAAA;;;sBAGJC,WAAA,CAKqC,sBAAA,EAAA;;UAHpC,UAAM,EAAA,MAAA,CAAA,KAAA,CAAA,MAAA,IAAA,EAAA,CAAA;AACN,UAAA,KAAK,EAAE,IAAA,CAAA,CAAC,CAAA,eAAA,E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AAA,WAAC,CAAA,MAAA,EAAA,MAAA,CAAA,CAAA;;uBACrB,MAAgC;wCAA7B,IAAA,CAAA,CAAC,CAAA,eAAA,EAAA,MAAA,CAAA,CAAA,EAAA,CAAA;;;;gBAOmB,gCAAA,EAAA;AAHtB,MAAA,UAAS,EAAA,KAAA,CAAA,QAAA;MACT,qBAAiB,EAAA,MAAA,CAAA,CAAA,CAAA,KAAA,MAAA,CAAA,CAAA,CAAA,GAAA,MAAA,KAAE,QAAA,CAAA,WAAE,CAAA,UAAA,EAAA,MAAA,CAAA,CAAA;;uBACtB,MAAyC;wCAAtC,IAAA,CAAA,CAAC,CAAA,eAAA,EAAA,eAAA,CAAA,CAAA,EAAA,CAAA;;;;IAGLA,WAAA;;;;;;;;;"}
1
+ {"version":3,"file":"CnVideoWidgetForm3.vue.js","sources":["../../../../src/components/CnVideoWidgetForm/CnVideoWidgetForm.vue?vue&type=template&id=629b8baa&lang.js"],"sourcesContent":["<!--\n - SPDX-FileCopyrightText: 2026 Conduction B.V.\n - SPDX-License-Identifier: EUPL-1.2\n-->\n\n<template>\n\t<div class=\"cn-video-form\">\n\t\t<NcTextField\n\t\t\t:modelValue=\"videoUrl\"\n\t\t\t:label=\"t('nextcloud-vue', 'Video URL')\"\n\t\t\tplaceholder=\"https://www.youtube.com/watch?v=...\"\n\t\t\trequired\n\t\t\t@update:modelValue=\"onUrlInput\" />\n\n\t\t<div v-if=\"urlError && hasUrl\" class=\"cn-video-form__error\" role=\"alert\">\n\t\t\t{{ urlError }}\n\t\t</div>\n\t\t<div v-else-if=\"detectedSource\" class=\"cn-video-form__hint\">\n\t\t\t{{ detectedSourceLabel }}\n\t\t</div>\n\t\t<div v-else-if=\"hasUrl\" class=\"cn-video-form__error\" role=\"alert\">\n\t\t\t{{ t('nextcloud-vue', 'Invalid video URL or domain not allowed.') }}\n\t\t</div>\n\n\t\t<NcTextField\n\t\t\tv-if=\"sourceType === 'nc-file'\"\n\t\t\t:modelValue=\"String(fileId || '')\"\n\t\t\t:label=\"t('nextcloud-vue', 'Nextcloud File ID')\"\n\t\t\tplaceholder=\"12345\"\n\t\t\t@update:modelValue=\"onFileIdInput\" />\n\n\t\t<NcSelect\n\t\t\t:modelValue=\"aspectRatio\"\n\t\t\t:options=\"aspectRatioOptions\"\n\t\t\t:inputLabel=\"t('nextcloud-vue', 'Aspect Ratio')\"\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('aspectRatio', $event)\" />\n\n\t\t<NcCheckboxRadioSwitch\n\t\t\t:modelValue=\"autoplay\"\n\t\t\t@update:modelValue=\"onAutoplayToggle\">\n\t\t\t{{ t('nextcloud-vue', 'Autoplay') }}\n\t\t</NcCheckboxRadioSwitch>\n\t\t<div v-if=\"autoplay\" class=\"cn-video-form__hint\">\n\t\t\t{{ t('nextcloud-vue', 'Autoplay requires muting') }}\n\t\t</div>\n\n\t\t<NcCheckboxRadioSwitch\n\t\t\t:modelValue=\"muted\"\n\t\t\t:disabled=\"autoplay\"\n\t\t\t@update:modelValue=\"updateField('muted', $event)\">\n\t\t\t{{ t('nextcloud-vue', 'Muted') }}\n\t\t</NcCheckboxRadioSwitch>\n\n\t\t<NcCheckboxRadioSwitch\n\t\t\t:modelValue=\"loop\"\n\t\t\t@update:modelValue=\"updateField('loop', $event)\">\n\t\t\t{{ t('nextcloud-vue', 'Loop') }}\n\t\t</NcCheckboxRadioSwitch>\n\n\t\t<NcCheckboxRadioSwitch\n\t\t\t:modelValue=\"controls\"\n\t\t\t@update:modelValue=\"updateField('controls', $event)\">\n\t\t\t{{ t('nextcloud-vue', 'Show controls') }}\n\t\t</NcCheckboxRadioSwitch>\n\n\t\t<NcTextField\n\t\t\t:modelValue=\"posterUrl\"\n\t\t\t:label=\"t('nextcloud-vue', 'Poster Image URL (optional)')\"\n\t\t\tplaceholder=\"https://example.com/poster.jpg\"\n\t\t\t@update:modelValue=\"updateField('posterUrl', $event)\" />\n\t</div>\n</template>\n\n<script>\nimport { translate as t } from '@nextcloud/l10n'\nimport { NcCheckboxRadioSwitch, NcSelect, NcTextField } from '@nextcloud/vue'\nimport { detectVideoSource, normalizeEmbedUrl } from '../CnVideoWidget/videoUrlParser.js'\n\nconst VALID_ASPECT_RATIOS = ['16:9', '4:3', '1:1', '9:16']\n\nconst DEFAULT_CONTENT = Object.freeze({\n\tsourceType: null,\n\tvideoUrl: '',\n\tfileId: null,\n\tautoplay: false,\n\tmuted: true,\n\tloop: false,\n\tcontrols: true,\n\taspectRatio: '16:9',\n\tposterUrl: '',\n})\n\n/**\n * CnVideoWidgetForm — sub-form mounted inside the add-widget modal when the\n * user is creating or editing a `video` placement.\n *\n * Detects the platform (YouTube, Vimeo, PeerTube, Nextcloud Files) from the\n * URL and pre-computes the canonical embed URL. `validate()` returns errors\n * when the URL is empty or does not parse to a known source.\n *\n * @spec openspec/changes/cn-widget-library/specs/cn-widget-library/spec.md\n */\nexport default {\n\tname: 'CnVideoWidgetForm',\n\n\tcomponents: {\n\t\tNcTextField,\n\t\tNcSelect,\n\t\tNcCheckboxRadioSwitch,\n\t},\n\n\tprops: {\n\t\t/** The placement being edited, or `null` in create mode. */\n\t\teditingWidget: {\n\t\t\ttype: Object,\n\t\t\tdefault: null,\n\t\t},\n\n\t\t/** Initial content values (registry defaults when not editing). */\n\t\tvalue: {\n\t\t\ttype: Object,\n\t\t\tdefault: () => ({ ...DEFAULT_CONTENT }),\n\t\t},\n\n\t\t/**\n\t\t * An error the host found for the current URL (its server-side parse,\n\t\t * say). Shown under the URL field in place of the form's own message,\n\t\t * and returned by `validate()`, so the dialog cannot save. Empty when\n\t\t * the host has no objection.\n\t\t */\n\t\turlError: {\n\t\t\ttype: String,\n\t\t\tdefault: '',\n\t\t},\n\t},\n\n\temits: [\n\t\t/**\n\t\t * Emitted on every change with the assembled content payload.\n\t\t *\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\treturn {\n\t\t\tvideoUrl: typeof initial.videoUrl === 'string' ? initial.videoUrl : DEFAULT_CONTENT.videoUrl,\n\t\t\tsourceType: typeof initial.sourceType === 'string' ? initial.sourceType : DEFAULT_CONTENT.sourceType,\n\t\t\tfileId: typeof initial.fileId === 'number' ? initial.fileId : DEFAULT_CONTENT.fileId,\n\t\t\tautoplay: typeof initial.autoplay === 'boolean' ? initial.autoplay : DEFAULT_CONTENT.autoplay,\n\t\t\tmuted: typeof initial.muted === 'boolean' ? initial.muted : DEFAULT_CONTENT.muted,\n\t\t\tloop: typeof initial.loop === 'boolean' ? initial.loop : DEFAULT_CONTENT.loop,\n\t\t\tcontrols: typeof initial.controls === 'boolean' ? initial.controls : DEFAULT_CONTENT.controls,\n\t\t\taspectRatio: VALID_ASPECT_RATIOS.includes(initial.aspectRatio)\n\t\t\t\t? initial.aspectRatio\n\t\t\t\t: DEFAULT_CONTENT.aspectRatio,\n\n\t\t\tposterUrl: typeof initial.posterUrl === 'string' ? initial.posterUrl : DEFAULT_CONTENT.posterUrl,\n\t\t}\n\t},\n\n\tcomputed: {\n\t\t/**\n\t\t * Whether a non-empty URL has been entered.\n\t\t *\n\t\t * @return {boolean} true when `videoUrl` is non-empty.\n\t\t */\n\t\thasUrl() {\n\t\t\treturn typeof this.videoUrl === 'string' && this.videoUrl.trim() !== ''\n\t\t},\n\n\t\t/**\n\t\t * The detected source type for the current URL.\n\t\t *\n\t\t * @return {string|null} the detected source, or `null`.\n\t\t */\n\t\tdetectedSource() {\n\t\t\tif (!this.hasUrl) {\n\t\t\t\treturn null\n\t\t\t}\n\t\t\treturn detectVideoSource(this.videoUrl)\n\t\t},\n\n\t\t/**\n\t\t * The localised \"Detected: X\" hint label.\n\t\t *\n\t\t * @return {string} the detection hint.\n\t\t */\n\t\tdetectedSourceLabel() {\n\t\t\tswitch (this.detectedSource) {\n\t\t\t\tcase 'youtube':\n\t\t\t\t\treturn t('nextcloud-vue', 'Detected: YouTube')\n\t\t\t\tcase 'vimeo':\n\t\t\t\t\treturn t('nextcloud-vue', 'Detected: Vimeo')\n\t\t\t\tcase 'peertube':\n\t\t\t\t\treturn t('nextcloud-vue', 'Detected: PeerTube')\n\t\t\t\tcase 'nc-file':\n\t\t\t\t\treturn t('nextcloud-vue', 'Detected: Nextcloud File')\n\t\t\t\tdefault:\n\t\t\t\t\treturn ''\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * The aspect-ratio dropdown options.\n\t\t *\n\t\t * @return {Array<{value: string, label: string}>} the options.\n\t\t */\n\t\taspectRatioOptions() {\n\t\t\treturn [\n\t\t\t\t{ value: '16:9', label: '16:9' },\n\t\t\t\t{ value: '4:3', label: '4:3' },\n\t\t\t\t{ value: '1:1', label: '1:1' },\n\t\t\t\t{ value: '9:16', label: '9:16' },\n\t\t\t]\n\t\t},\n\n\t\t/**\n\t\t * The assembled `content` payload emitted to the parent.\n\t\t *\n\t\t * @return {object} the content blob.\n\t\t */\n\t\tassembledContent() {\n\t\t\treturn {\n\t\t\t\tsourceType: this.sourceType,\n\t\t\t\tvideoUrl: this.normalizedVideoUrl,\n\t\t\t\tfileId: this.fileId,\n\t\t\t\tautoplay: this.autoplay,\n\t\t\t\t// Autoplay forces muted.\n\t\t\t\tmuted: this.autoplay ? true : this.muted,\n\t\t\t\tloop: this.loop,\n\t\t\t\tcontrols: this.controls,\n\t\t\t\taspectRatio: this.aspectRatio,\n\t\t\t\tposterUrl: this.posterUrl,\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * The canonical embed URL emitted upward (raw for nc-file inputs).\n\t\t *\n\t\t * @return {string} the embed URL.\n\t\t */\n\t\tnormalizedVideoUrl() {\n\t\t\tif (!this.detectedSource || this.detectedSource === 'nc-file') {\n\t\t\t\treturn this.videoUrl\n\t\t\t}\n\t\t\treturn normalizeEmbedUrl(this.videoUrl, this.detectedSource) || this.videoUrl\n\t\t},\n\t},\n\n\tmethods: {\n\t\t/**\n\t\t * Set a field and emit `update:content`.\n\t\t *\n\t\t * @param {string} field the field name.\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 * URL change handler — drives source-type detection and emits.\n\t\t *\n\t\t * @param {string} value the new URL.\n\t\t * @return {void}\n\t\t */\n\t\tonUrlInput(value) {\n\t\t\tthis.videoUrl = value\n\t\t\tconst detected = detectVideoSource(value)\n\t\t\tthis.sourceType = detected\n\t\t\tthis.$emit('update:content', this.assembledContent)\n\t\t},\n\n\t\t/**\n\t\t * File-id change handler for `nc-file` sources.\n\t\t *\n\t\t * @param {string} value the raw input value.\n\t\t * @return {void}\n\t\t */\n\t\tonFileIdInput(value) {\n\t\t\tconst parsed = parseInt(String(value).trim(), 10)\n\t\t\tthis.fileId = Number.isFinite(parsed) ? parsed : null\n\t\t\tthis.$emit('update:content', this.assembledContent)\n\t\t},\n\n\t\t/**\n\t\t * Autoplay toggle handler — coerces muted=true while autoplay is on.\n\t\t *\n\t\t * @param {boolean} checked the autoplay checkbox value.\n\t\t * @return {void}\n\t\t */\n\t\tonAutoplayToggle(checked) {\n\t\t\tthis.autoplay = checked\n\t\t\tif (checked) {\n\t\t\t\tthis.muted = true\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. Requires a URL plus a recognised source.\n\t\t *\n\t\t * @return {string[]} the validation errors (empty when valid).\n\t\t */\n\t\tvalidate() {\n\t\t\tconst errors = []\n\t\t\tif (!this.hasUrl) {\n\t\t\t\terrors.push(t('nextcloud-vue', 'Video URL is required'))\n\t\t\t\treturn errors\n\t\t\t}\n\t\t\tif (this.urlError) {\n\t\t\t\terrors.push(this.urlError)\n\t\t\t\treturn errors\n\t\t\t}\n\t\t\tif (this.detectedSource === null) {\n\t\t\t\terrors.push(t('nextcloud-vue', 'Invalid video URL or domain not allowed.'))\n\t\t\t\treturn errors\n\t\t\t}\n\t\t\tif (this.detectedSource === 'nc-file' && this.fileId === null) {\n\t\t\t\terrors.push(t('nextcloud-vue', 'Nextcloud file ID is required'))\n\t\t\t}\n\t\t\treturn errors\n\t\t},\n\t},\n}\n</script>\n\n<style scoped>\n.cn-video-form {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 12px;\n}\n\n.cn-video-form__hint {\n\tfont-size: 12px;\n\tcolor: var(--color-text-maxcontrast);\n}\n\n.cn-video-form__error {\n\tcolor: var(--color-error);\n\tfont-size: 13px;\n}\n</style>\n"],"names":["_openBlock","_createElementBlock","_createVNode","_toDisplayString","_createBlock"],"mappings":";;AAWM,MAAA,UAAA,GAAA,EAAA,KAAI,EAAA,eAAA;;;AAQH,EAAA,KAAA,EAAA,sBAAA;AAAA,EAAA,IAAA,EAAA;;;;AAGA,EAAA,KAAA,EAAA;;;;AAGmB,EAAA,KAAK,EAAC,sBAAC;AAAA,EAAA,IAAA,EAAA;;;;AAyBZ,EAAA,KAAA,EAAA;;;;;;;;AAvClB,EAAA,QAAAA,SAAA,EAAA,EAAAC,kBAAA,QAAA;IACAC,WAAA,CAKkC,sBAAA,EAAA;;AAHjC,MAAA,KAAK,EAAE,IAAA,CAAA,CAAC,CAAA,eAAA,EAAA,WAAA,CAAA;AACT,MAAA,WAAU,EAAE,qCAAC;AACb,MAAA,QAAI,EAAJ,EAAI;AACH,MAAA,qBAAiB,EAAE,QAAA,CAAA;;AAEhB,IAAA,CAAA,MAAA,CAAA,QAAA,IAAA,QAAA,CAAA,MAAA;sBAALD,kBAAA,CAEM,KAAA,EAFN,UAEM,EAAAE,eAAA,CADH,MAAA,CAAA,QAAS,CAAA,EAAA,CAAA,YAAA;SAEP,QAAA,CAAA,cAAA;wBAALF,kBAAA,CAEM,KAAA,EAFN,UAEM,EAAAE,eAAA;WACU,QAAA,CAAA,MAAM;6CAEhB,KAAA,YAAA,EAAAA,eAAA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A9B,IAAA,CAAA,CAAC,CAAA,eAAA,EAAA,OAAA,CAAA,CAAA,EAAA,CAAA;;;;gBAOmB,gCAAA,EAAA;AAHtB,MAAA,UAAU,EAAE,KAAA,CAAA,IAAI;MAChB,qBAAiB,EAAA,MAAA,CAAA,CAAA,CAAA,KAAA,MAAA,CAAA,CAAA,CAAA,GAAA,MAAA,KAAE,QAAA,CAAA,WAAC,CAAA,MAAA,EAAA,MAAA,CAAA,CAAA;;uBACrB,MAAgC;wCAA7B,IAAA,CAAA,CAAC,CAAA,eAAA,EAAA,MAAA,CAAA,CAAA,EAAA,CAAA;;;;gBAOmB,gCAAA,EAAA;AAHtB,MAAA,UAAS,EAAA,KAAA,CAAA,QAAA;MACT,qBAAiB,EAAA,MAAA,CAAA,CAAA,CAAA,KAAA,MAAA,CAAA,CAAA,CAAA,GAAA,MAAA,KAAE,QAAA,CAAA,WAAE,CAAA,UAAA,EAAA,MAAA,CAAA,CAAA;;uBACtB,MAAyC;wCAAtC,IAAA,CAAA,CAAC,CAAA,eAAA,EAAA,eAAA,CAAA,CAAA,EAAA,CAAA;;;;IAGLA,WAAA;;;;;;;;;"}
@@ -37,6 +37,7 @@
37
37
  * @property {object} defaultContent Initial `content` payload seeded into new placements.
38
38
  * @property {string} displayName Human-readable type name shown in the type picker.
39
39
  * @property {string} icon Material Design icon name used in the type picker.
40
+ * @property {number} [minHeight] The fewest grid rows a placement of this type may take, below the grid's own minimum (a divider: 1). A host copies it onto the layout item as `minHeight`.
40
41
  * @property {string[]} [surfaces] Surfaces this type may be added on (e.g. `['app-dashboard']`, `['detail-page']`). Omitted means the default dashboard surfaces. A detail-only widget (like `data`) sets `['detail-page']` so it never appears in the dashboard Add-widget picker.
41
42
  * @property {boolean} [public] Whether a PUBLIC host (an anonymous visitor at a public origin, such as the portal) may mount this widget. Default `false`, and `registerDashboardWidget()` records it: a widget author opts in deliberately. A non-boolean value is refused.
42
43
  * @property {{graphql?: string[]}} [requires] Soft runtime-source hint for cross-app widgets — names the sibling-app schemas the widget reads. NEVER a `manifest.dependencies` entry.
@@ -1 +1 @@
1
- {"version":3,"file":"dashboardWidgetRegistry.js","sources":["../../../../src/components/CnWidgetGrid/dashboardWidgetRegistry.js"],"sourcesContent":["/**\n * SPDX-FileCopyrightText: 2026 Conduction B.V.\n * SPDX-License-Identifier: EUPL-1.2\n *\n * dashboardWidgetRegistry — the shared, mutable single source of truth for the\n * dashboard widget catalog (cn-widget-library, design D1).\n *\n * This registry is intentionally SEPARATE from `BUILT_IN_WIDGETS` (the v2\n * manifest widget set in `builtInWidgets.js`). The two systems compose at the\n * `CnWidgetGrid` resolution boundary — `BUILT_IN_WIDGETS` → this registry →\n * consumer `cnRegistry` inject (override wins last) — but their cores stay\n * independent: `BUILT_IN_WIDGETS` keys are object-detail widgets that need a\n * loaded OpenRegister object, whereas catalog widgets are content/config-driven.\n *\n * Each entry maps a widget `type` string (the value persisted in a placement)\n * to a `{renderer, form, defaultContent, displayName, icon, requires?}`\n * descriptor. The catalog widgets self-register into this registry at import\n * time via `registerDashboardWidget()` (each widget capability owns its own\n * registration; this module ships EMPTY and gains entries as widgets land —\n * Wave 0 has none yet). The `CnAddWidgetModal` consults `listWidgetTypes()` /\n * `getWidgetTypeEntry()` to render the type picker and the per-type sub-form.\n *\n * Registration policy (design D2): last-registration-wins. Registering an\n * existing `type` overwrites the prior entry and emits a development\n * `console.warn` naming the overwritten type so accidental double-registration\n * is visible. Consumer `cnRegistry` overrides still win over this registry at\n * `CnWidgetGrid` resolution time, so an app never has to mutate this shared\n * object to skin a single widget.\n *\n * @spec openspec/changes/cn-widget-library/specs/cn-widget-library/spec.md\n */\n\n/**\n * @typedef {object} DashboardWidgetEntry\n * @property {object} renderer Vue component reference for the dashboard grid (may be a lazy/async component definition).\n * @property {object|null} form Vue component reference for the `CnAddWidgetModal` sub-form, or `null`/`undefined` for a renderer-only type (excluded from the picker).\n * @property {object} defaultContent Initial `content` payload seeded into new placements.\n * @property {string} displayName Human-readable type name shown in the type picker.\n * @property {string} icon Material Design icon name used in the type picker.\n * @property {string[]} [surfaces] Surfaces this type may be added on (e.g. `['app-dashboard']`, `['detail-page']`). Omitted means the default dashboard surfaces. A detail-only widget (like `data`) sets `['detail-page']` so it never appears in the dashboard Add-widget picker.\n * @property {boolean} [public] Whether a PUBLIC host (an anonymous visitor at a public origin, such as the portal) may mount this widget. Default `false`, and `registerDashboardWidget()` records it: a widget author opts in deliberately. A non-boolean value is refused.\n * @property {{graphql?: string[]}} [requires] Soft runtime-source hint for cross-app widgets — names the sibling-app schemas the widget reads. NEVER a `manifest.dependencies` entry.\n */\n\n/**\n * The shared dashboard widget registry. A mutable object map keyed by widget\n * `type` string. Catalog widgets self-register into it; consumer apps may\n * extend or override it via {@link registerDashboardWidget}.\n *\n * @type {Record<string, DashboardWidgetEntry>}\n */\nexport const dashboardWidgetRegistry = {}\n\n/**\n * Register (or override) a widget type in the shared registry.\n *\n * Last-registration-wins (design D2): registering an existing `type`\n * overwrites the prior entry. When an override occurs and `NODE_ENV` is not\n * `'production'`, a `console.warn` naming the overwritten type is emitted so\n * accidental double-registration surfaces in development.\n *\n * @param {string} type the widget type key (the persisted placement type).\n * @param {DashboardWidgetEntry} entry the descriptor to register.\n * @return {void}\n */\nexport function registerDashboardWidget(type, entry) {\n\tif (typeof type !== 'string' || type === '') {\n\t\treturn\n\t}\n\t// Default closed: an anonymous visitor may only ever see a widget whose\n\t// author said so. Refuse, rather than coerce, a value that is not a boolean:\n\t// \"yes\" must not quietly become true, or false.\n\tif (entry && entry.public !== undefined && typeof entry.public !== 'boolean') {\n\t\tthrow new TypeError(`[dashboardWidgetRegistry] widget type \"${type}\": \\`public\\` must be a boolean, got ${typeof entry.public}.`)\n\t}\n\tif (entry && entry.public === undefined) {\n\t\tif (Object.isExtensible(entry)) {\n\t\t\tentry.public = false\n\t\t} else {\n\t\t\tentry = { ...entry, public: false }\n\t\t}\n\t}\n\tconst isOverride = Object.hasOwn(dashboardWidgetRegistry, type)\n\t// Read through `globalThis` rather than a bare `process`: this module is\n\t// bundled for the browser, where `process` is simply absent, and the\n\t// optional chain states that as plainly as the old `typeof` guard did.\n\tconst env = globalThis.process?.env\n\tif (isOverride && env && env.NODE_ENV !== 'production') {\n\t\t// eslint-disable-next-line no-console\n\t\tconsole.warn(`[dashboardWidgetRegistry] widget type \"${type}\" is already registered — overriding the previous entry (last-registration-wins).`)\n\t}\n\tdashboardWidgetRegistry[type] = entry\n}\n\n/**\n * List every registered widget type that has a usable form component. The\n * `CnAddWidgetModal` type picker calls this; renderer-only types (entries with\n * a null/undefined `form`) are excluded so the user is never offered a type\n * they cannot configure.\n *\n * @param {string} [surface] Optional surface key to filter by (default\n * `'app-dashboard'`). Entries whose `surfaces` excludes it are dropped, so a\n * detail-only type (e.g. `data`) never appears in the dashboard picker. Pass\n * the matching surface to list detail-page types.\n * @return {string[]} the registered type keys whose entry has a non-null form.\n */\nexport function listWidgetTypes(surface = 'app-dashboard') {\n\treturn Object.keys(dashboardWidgetRegistry).filter((type) => dashboardWidgetRegistry[type]\n\t\t&& dashboardWidgetRegistry[type].form !== null\n\t\t&& dashboardWidgetRegistry[type].form !== undefined\n\t\t&& widgetTypeAllowsSurface(dashboardWidgetRegistry[type], surface))\n}\n\n/**\n * List the widget types a USER may add to their own dashboard.\n *\n * 🔴 IT IS AN OPT-IN, AND THAT IS THE WHOLE POINT. `listWidgetTypes()` answers\n * what an administrator may put on a page for everybody, which is a much\n * larger set: an admin configures a widget once, with the register and schema\n * in front of them, and a user picking from the same list would be offered\n * types that need configuration they cannot supply and cannot be told about.\n * So a type is offerable to a user only when its registry entry says\n * `userAddable: true`.\n *\n * @param {string} [surface] The surface key, as {@link listWidgetTypes} uses it.\n * @return {string[]} The type keys a user may add themselves.\n */\nexport function listUserAddableWidgetTypes(surface = 'app-dashboard') {\n\treturn listWidgetTypes(surface).filter((type) => dashboardWidgetRegistry[type]?.userAddable === true)\n}\n\n/**\n * The presets a manifest offers a user, from `config.userWidgets[]`.\n *\n * A preset is a widget an app has already configured, offered under a name a\n * user recognises: \"one of my saved views\", \"my tasks\". It exists because the\n * registry types a user may add are deliberately few, and the two lists a user\n * actually wants are both `object-list` widgets that need a query the app\n * knows and the user does not.\n *\n * An entry with no `id` or no `kind` is dropped rather than offered: a preset\n * nobody can identify cannot be added, and one with no kind has nothing to\n * render.\n *\n * @param {object|null} config The page config.\n * @return {Array<{ id: string, kind: string, label: string, widget: object }>} The offerable presets.\n */\nexport function userWidgetPresets(config) {\n\tconst declared = config?.userWidgets\n\tif (!Array.isArray(declared)) {\n\t\treturn []\n\t}\n\n\tconst presets = []\n\tfor (const entry of declared) {\n\t\tconst id = String(entry?.id ?? '').trim()\n\t\tconst kind = String(entry?.kind ?? '').trim()\n\t\tif (id === '' || kind === '') {\n\t\t\tcontinue\n\t\t}\n\n\t\tpresets.push({\n\t\t\tid,\n\t\t\tkind,\n\t\t\tlabel: String(entry?.label ?? id),\n\t\t\t// The widget definition the app configured, copied so a caller\n\t\t\t// adding one twice does not hand the grid the same object twice.\n\t\t\twidget: { ...(entry?.widget || {}) },\n\t\t})\n\t}\n\n\treturn presets\n}\n\n/**\n * Whether a widget type may be mounted by a public host. False for an unknown\n * type: the decision and the lookup are one thing.\n *\n * @param {string} type the widget type key.\n * @return {boolean} true only for a registered entry with `public: true`.\n */\nexport function isPublicWidgetType(type) {\n\tconst entry = dashboardWidgetRegistry[type]\n\treturn Boolean(entry) && entry.public === true\n}\n\n/**\n * Look up a widget type entry; returns `null` when the type is unknown so the\n * caller can fall back gracefully.\n *\n * @param {string} type the widget type key.\n * @return {DashboardWidgetEntry|null} the registry entry or `null`.\n */\nexport function getWidgetTypeEntry(type) {\n\treturn dashboardWidgetRegistry[type] || null\n}\n\n/**\n * Whether a registry entry is offerable on a given surface. An entry with no\n * `surfaces` is offerable everywhere; otherwise the surface must be listed.\n *\n * @param {DashboardWidgetEntry} entry the registry entry.\n * @param {string} surface the surface key (e.g. `'app-dashboard'`, `'detail-page'`).\n * @return {boolean} true when the entry may be added on that surface.\n */\nexport function widgetTypeAllowsSurface(entry, surface) {\n\tif (!entry) {\n\t\treturn false\n\t}\n\tif (!Array.isArray(entry.surfaces) || entry.surfaces.length === 0) {\n\t\treturn true\n\t}\n\treturn entry.surfaces.includes(surface)\n}\n\n/**\n * Return a fresh copy of the `defaultContent` blob for a registered type, or\n * `{}` for unknown types so the caller never has to null-check. A shallow copy\n * is returned so a caller mutating the result does not pollute the registry\n * defaults or another caller's content.\n *\n * @param {string} type the widget type key.\n * @return {object} a fresh copy of the type's `defaultContent`.\n */\nexport function getDefaultContent(type) {\n\tconst entry = dashboardWidgetRegistry[type]\n\tif (!entry) {\n\t\treturn {}\n\t}\n\treturn { ...entry.defaultContent }\n}\n"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,uBAAuB,GAAG;;AAEvC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,uBAAuB,CAAC,IAAI,EAAE,KAAK,EAAE;AACrD,CAAC,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,KAAK,EAAE,EAAE;AAC9C,EAAE;AACF,CAAC;AACD;AACA;AACA;AACA,CAAC,IAAI,KAAK,IAAI,KAAK,CAAC,MAAM,KAAK,SAAS,IAAI,OAAO,KAAK,CAAC,MAAM,KAAK,SAAS,EAAE;AAC/E,EAAE,MAAM,IAAI,SAAS,CAAC,CAAC,uCAAuC,EAAE,IAAI,CAAC,qCAAqC,EAAE,OAAO,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;AAClI,CAAC;AACD,CAAC,IAAI,KAAK,IAA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,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,KAAK,CAAC,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE;AACpE,EAAE,OAAO;AACT,CAAC;AACD,CAAC,OAAO,KAAK,CAAC,QAAQ,CAAC,QAAQ,CAAC,OAAO;AACvC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,iBAAiB,CAAC,IAAI,EAAE;AACxC,CAAC,MAAM,KAAK,GAAG,uBAAuB,CAAC,IAAI;AAC3C,CAAC,IAAI,CAAC,KAAK,EAAE;AACb,EAAE,OAAO;AACT,CAAC;AACD,CAAC,OAAO,EAAE,GAAG,KAAK,CAAC,cAAc;AACjC;;"}
1
+ {"version":3,"file":"dashboardWidgetRegistry.js","sources":["../../../../src/components/CnWidgetGrid/dashboardWidgetRegistry.js"],"sourcesContent":["/**\n * SPDX-FileCopyrightText: 2026 Conduction B.V.\n * SPDX-License-Identifier: EUPL-1.2\n *\n * dashboardWidgetRegistry — the shared, mutable single source of truth for the\n * dashboard widget catalog (cn-widget-library, design D1).\n *\n * This registry is intentionally SEPARATE from `BUILT_IN_WIDGETS` (the v2\n * manifest widget set in `builtInWidgets.js`). The two systems compose at the\n * `CnWidgetGrid` resolution boundary — `BUILT_IN_WIDGETS` → this registry →\n * consumer `cnRegistry` inject (override wins last) — but their cores stay\n * independent: `BUILT_IN_WIDGETS` keys are object-detail widgets that need a\n * loaded OpenRegister object, whereas catalog widgets are content/config-driven.\n *\n * Each entry maps a widget `type` string (the value persisted in a placement)\n * to a `{renderer, form, defaultContent, displayName, icon, requires?}`\n * descriptor. The catalog widgets self-register into this registry at import\n * time via `registerDashboardWidget()` (each widget capability owns its own\n * registration; this module ships EMPTY and gains entries as widgets land —\n * Wave 0 has none yet). The `CnAddWidgetModal` consults `listWidgetTypes()` /\n * `getWidgetTypeEntry()` to render the type picker and the per-type sub-form.\n *\n * Registration policy (design D2): last-registration-wins. Registering an\n * existing `type` overwrites the prior entry and emits a development\n * `console.warn` naming the overwritten type so accidental double-registration\n * is visible. Consumer `cnRegistry` overrides still win over this registry at\n * `CnWidgetGrid` resolution time, so an app never has to mutate this shared\n * object to skin a single widget.\n *\n * @spec openspec/changes/cn-widget-library/specs/cn-widget-library/spec.md\n */\n\n/**\n * @typedef {object} DashboardWidgetEntry\n * @property {object} renderer Vue component reference for the dashboard grid (may be a lazy/async component definition).\n * @property {object|null} form Vue component reference for the `CnAddWidgetModal` sub-form, or `null`/`undefined` for a renderer-only type (excluded from the picker).\n * @property {object} defaultContent Initial `content` payload seeded into new placements.\n * @property {string} displayName Human-readable type name shown in the type picker.\n * @property {string} icon Material Design icon name used in the type picker.\n * @property {number} [minHeight] The fewest grid rows a placement of this type may take, below the grid's own minimum (a divider: 1). A host copies it onto the layout item as `minHeight`.\n * @property {string[]} [surfaces] Surfaces this type may be added on (e.g. `['app-dashboard']`, `['detail-page']`). Omitted means the default dashboard surfaces. A detail-only widget (like `data`) sets `['detail-page']` so it never appears in the dashboard Add-widget picker.\n * @property {boolean} [public] Whether a PUBLIC host (an anonymous visitor at a public origin, such as the portal) may mount this widget. Default `false`, and `registerDashboardWidget()` records it: a widget author opts in deliberately. A non-boolean value is refused.\n * @property {{graphql?: string[]}} [requires] Soft runtime-source hint for cross-app widgets — names the sibling-app schemas the widget reads. NEVER a `manifest.dependencies` entry.\n */\n\n/**\n * The shared dashboard widget registry. A mutable object map keyed by widget\n * `type` string. Catalog widgets self-register into it; consumer apps may\n * extend or override it via {@link registerDashboardWidget}.\n *\n * @type {Record<string, DashboardWidgetEntry>}\n */\nexport const dashboardWidgetRegistry = {}\n\n/**\n * Register (or override) a widget type in the shared registry.\n *\n * Last-registration-wins (design D2): registering an existing `type`\n * overwrites the prior entry. When an override occurs and `NODE_ENV` is not\n * `'production'`, a `console.warn` naming the overwritten type is emitted so\n * accidental double-registration surfaces in development.\n *\n * @param {string} type the widget type key (the persisted placement type).\n * @param {DashboardWidgetEntry} entry the descriptor to register.\n * @return {void}\n */\nexport function registerDashboardWidget(type, entry) {\n\tif (typeof type !== 'string' || type === '') {\n\t\treturn\n\t}\n\t// Default closed: an anonymous visitor may only ever see a widget whose\n\t// author said so. Refuse, rather than coerce, a value that is not a boolean:\n\t// \"yes\" must not quietly become true, or false.\n\tif (entry && entry.public !== undefined && typeof entry.public !== 'boolean') {\n\t\tthrow new TypeError(`[dashboardWidgetRegistry] widget type \"${type}\": \\`public\\` must be a boolean, got ${typeof entry.public}.`)\n\t}\n\tif (entry && entry.public === undefined) {\n\t\tif (Object.isExtensible(entry)) {\n\t\t\tentry.public = false\n\t\t} else {\n\t\t\tentry = { ...entry, public: false }\n\t\t}\n\t}\n\tconst isOverride = Object.hasOwn(dashboardWidgetRegistry, type)\n\t// Read through `globalThis` rather than a bare `process`: this module is\n\t// bundled for the browser, where `process` is simply absent, and the\n\t// optional chain states that as plainly as the old `typeof` guard did.\n\tconst env = globalThis.process?.env\n\tif (isOverride && env && env.NODE_ENV !== 'production') {\n\t\t// eslint-disable-next-line no-console\n\t\tconsole.warn(`[dashboardWidgetRegistry] widget type \"${type}\" is already registered — overriding the previous entry (last-registration-wins).`)\n\t}\n\tdashboardWidgetRegistry[type] = entry\n}\n\n/**\n * List every registered widget type that has a usable form component. The\n * `CnAddWidgetModal` type picker calls this; renderer-only types (entries with\n * a null/undefined `form`) are excluded so the user is never offered a type\n * they cannot configure.\n *\n * @param {string} [surface] Optional surface key to filter by (default\n * `'app-dashboard'`). Entries whose `surfaces` excludes it are dropped, so a\n * detail-only type (e.g. `data`) never appears in the dashboard picker. Pass\n * the matching surface to list detail-page types.\n * @return {string[]} the registered type keys whose entry has a non-null form.\n */\nexport function listWidgetTypes(surface = 'app-dashboard') {\n\treturn Object.keys(dashboardWidgetRegistry).filter((type) => dashboardWidgetRegistry[type]\n\t\t&& dashboardWidgetRegistry[type].form !== null\n\t\t&& dashboardWidgetRegistry[type].form !== undefined\n\t\t&& widgetTypeAllowsSurface(dashboardWidgetRegistry[type], surface))\n}\n\n/**\n * List the widget types a USER may add to their own dashboard.\n *\n * 🔴 IT IS AN OPT-IN, AND THAT IS THE WHOLE POINT. `listWidgetTypes()` answers\n * what an administrator may put on a page for everybody, which is a much\n * larger set: an admin configures a widget once, with the register and schema\n * in front of them, and a user picking from the same list would be offered\n * types that need configuration they cannot supply and cannot be told about.\n * So a type is offerable to a user only when its registry entry says\n * `userAddable: true`.\n *\n * @param {string} [surface] The surface key, as {@link listWidgetTypes} uses it.\n * @return {string[]} The type keys a user may add themselves.\n */\nexport function listUserAddableWidgetTypes(surface = 'app-dashboard') {\n\treturn listWidgetTypes(surface).filter((type) => dashboardWidgetRegistry[type]?.userAddable === true)\n}\n\n/**\n * The presets a manifest offers a user, from `config.userWidgets[]`.\n *\n * A preset is a widget an app has already configured, offered under a name a\n * user recognises: \"one of my saved views\", \"my tasks\". It exists because the\n * registry types a user may add are deliberately few, and the two lists a user\n * actually wants are both `object-list` widgets that need a query the app\n * knows and the user does not.\n *\n * An entry with no `id` or no `kind` is dropped rather than offered: a preset\n * nobody can identify cannot be added, and one with no kind has nothing to\n * render.\n *\n * @param {object|null} config The page config.\n * @return {Array<{ id: string, kind: string, label: string, widget: object }>} The offerable presets.\n */\nexport function userWidgetPresets(config) {\n\tconst declared = config?.userWidgets\n\tif (!Array.isArray(declared)) {\n\t\treturn []\n\t}\n\n\tconst presets = []\n\tfor (const entry of declared) {\n\t\tconst id = String(entry?.id ?? '').trim()\n\t\tconst kind = String(entry?.kind ?? '').trim()\n\t\tif (id === '' || kind === '') {\n\t\t\tcontinue\n\t\t}\n\n\t\tpresets.push({\n\t\t\tid,\n\t\t\tkind,\n\t\t\tlabel: String(entry?.label ?? id),\n\t\t\t// The widget definition the app configured, copied so a caller\n\t\t\t// adding one twice does not hand the grid the same object twice.\n\t\t\twidget: { ...(entry?.widget || {}) },\n\t\t})\n\t}\n\n\treturn presets\n}\n\n/**\n * Whether a widget type may be mounted by a public host. False for an unknown\n * type: the decision and the lookup are one thing.\n *\n * @param {string} type the widget type key.\n * @return {boolean} true only for a registered entry with `public: true`.\n */\nexport function isPublicWidgetType(type) {\n\tconst entry = dashboardWidgetRegistry[type]\n\treturn Boolean(entry) && entry.public === true\n}\n\n/**\n * Look up a widget type entry; returns `null` when the type is unknown so the\n * caller can fall back gracefully.\n *\n * @param {string} type the widget type key.\n * @return {DashboardWidgetEntry|null} the registry entry or `null`.\n */\nexport function getWidgetTypeEntry(type) {\n\treturn dashboardWidgetRegistry[type] || null\n}\n\n/**\n * Whether a registry entry is offerable on a given surface. An entry with no\n * `surfaces` is offerable everywhere; otherwise the surface must be listed.\n *\n * @param {DashboardWidgetEntry} entry the registry entry.\n * @param {string} surface the surface key (e.g. `'app-dashboard'`, `'detail-page'`).\n * @return {boolean} true when the entry may be added on that surface.\n */\nexport function widgetTypeAllowsSurface(entry, surface) {\n\tif (!entry) {\n\t\treturn false\n\t}\n\tif (!Array.isArray(entry.surfaces) || entry.surfaces.length === 0) {\n\t\treturn true\n\t}\n\treturn entry.surfaces.includes(surface)\n}\n\n/**\n * Return a fresh copy of the `defaultContent` blob for a registered type, or\n * `{}` for unknown types so the caller never has to null-check. A shallow copy\n * is returned so a caller mutating the result does not pollute the registry\n * defaults or another caller's content.\n *\n * @param {string} type the widget type key.\n * @return {object} a fresh copy of the type's `defaultContent`.\n */\nexport function getDefaultContent(type) {\n\tconst entry = dashboardWidgetRegistry[type]\n\tif (!entry) {\n\t\treturn {}\n\t}\n\treturn { ...entry.defaultContent }\n}\n"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,uBAA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GAAG,IAAI;AACP,GAAG,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,KAAK,IAAI,EAAE,CAAC;AACpC;AACA;AACA,GAAG,MAAM,EAAE,EAAE,IAAI,KAAK,EAAE,MAAM,IAAI,EAAE,CAAC,EAAE;AACvC,GAAG;AACH,CAAC;;AAED,CAAC,OAAO;AACR;;AAcA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,kBAAkB,CAAC,IAAI,EAAE;AACzC,CAAC,OAAO,uBAAuB,CAAC,IAAI,CAAC,IAAI;AACzC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,uBAAuB,CAAC,KAAK,EAAE,OAAO,EAAE;AACxD,CAAC,IAAI,CAAC,KAAK,EAAE;AACb,EAAE,OAAO;AACT,CAAC;AACD,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,KAAK,CAAC,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE;AACpE,EAAE,OAAO;AACT,CAAC;AACD,CAAC,OAAO,KAAK,CAAC,QAAQ,CAAC,QAAQ,CAAC,OAAO;AACvC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,iBAAiB,CAAC,IAAI,EAAE;AACxC,CAAC,MAAM,KAAK,GAAG,uBAAuB,CAAC,IAAI;AAC3C,CAAC,IAAI,CAAC,KAAK,EAAE;AACb,EAAE,OAAO;AACT,CAAC;AACD,CAAC,OAAO,EAAE,GAAG,KAAK,CAAC,cAAc;AACjC;;"}
@@ -2,7 +2,7 @@ import script from './CnAddWidgetModal2.vue.js';
2
2
  import { render } from './CnAddWidgetModal3.vue.js';
3
3
 
4
4
  script.render = render;
5
- script.__scopeId = "data-v-057fc07c";
5
+ script.__scopeId = "data-v-626d5ba2";
6
6
  const __sfc_main = script;
7
7
 
8
8
  export { __sfc_main as default };