@conduction/nextcloud-vue 2.185.1 → 2.186.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/components/CnCalendarWidget/CnCalendarWidget.vue.js +1 -1
- package/dist/esm/components/CnCalendarWidget/CnCalendarWidget2.vue.js +83 -2
- package/dist/esm/components/CnCalendarWidget/CnCalendarWidget2.vue.js.map +1 -1
- package/dist/esm/components/CnCalendarWidget/CnCalendarWidget3.vue.js +147 -104
- package/dist/esm/components/CnCalendarWidget/CnCalendarWidget3.vue.js.map +1 -1
- package/dist/esm/components/CnChartWidget/CnChartWidget.vue.js +1 -1
- package/dist/esm/components/CnChartWidget/CnChartWidget2.vue.js +58 -0
- package/dist/esm/components/CnChartWidget/CnChartWidget2.vue.js.map +1 -1
- package/dist/esm/components/CnChartWidget/CnChartWidget3.vue.js +2 -2
- package/dist/esm/components/CnChartWidget/CnChartWidget3.vue.js.map +1 -1
- package/dist/esm/components/CnDashboardGrid/CnDashboardGrid.vue.js +1 -1
- package/dist/esm/components/CnDashboardGrid/CnDashboardGrid2.vue.js +41 -16
- package/dist/esm/components/CnDashboardGrid/CnDashboardGrid2.vue.js.map +1 -1
- package/dist/esm/components/CnDashboardGrid/CnDashboardGrid3.vue.js.map +1 -1
- package/dist/esm/components/CnDividerWidget/index.js +1 -0
- package/dist/esm/components/CnDividerWidget/index.js.map +1 -1
- package/dist/esm/components/CnFilesWidget/CnFilesWidget.vue.js +1 -1
- package/dist/esm/components/CnFilesWidget/CnFilesWidget2.vue.js +158 -5
- package/dist/esm/components/CnFilesWidget/CnFilesWidget2.vue.js.map +1 -1
- package/dist/esm/components/CnFilesWidget/CnFilesWidget3.vue.js +109 -45
- package/dist/esm/components/CnFilesWidget/CnFilesWidget3.vue.js.map +1 -1
- package/dist/esm/components/CnHeaderWidget/index.js +0 -1
- package/dist/esm/components/CnHeaderWidget/index.js.map +1 -1
- package/dist/esm/components/CnHeaderWidgetForm/CnHeaderWidgetForm.vue.js +1 -1
- package/dist/esm/components/CnHeaderWidgetForm/CnHeaderWidgetForm2.vue.js +17 -3
- package/dist/esm/components/CnHeaderWidgetForm/CnHeaderWidgetForm2.vue.js.map +1 -1
- package/dist/esm/components/CnHeaderWidgetForm/CnHeaderWidgetForm3.vue.js +3 -3
- package/dist/esm/components/CnHeaderWidgetForm/CnHeaderWidgetForm3.vue.js.map +1 -1
- package/dist/esm/components/CnVideoWidget/CnVideoWidget.vue.js +1 -1
- package/dist/esm/components/CnVideoWidget/CnVideoWidget2.vue.js +63 -1
- package/dist/esm/components/CnVideoWidget/CnVideoWidget2.vue.js.map +1 -1
- package/dist/esm/components/CnVideoWidget/CnVideoWidget3.vue.js +20 -10
- package/dist/esm/components/CnVideoWidget/CnVideoWidget3.vue.js.map +1 -1
- package/dist/esm/components/CnVideoWidgetForm/CnVideoWidgetForm.vue.js +1 -1
- package/dist/esm/components/CnVideoWidgetForm/CnVideoWidgetForm2.vue.js +15 -0
- package/dist/esm/components/CnVideoWidgetForm/CnVideoWidgetForm2.vue.js.map +1 -1
- package/dist/esm/components/CnVideoWidgetForm/CnVideoWidgetForm3.vue.js +17 -10
- package/dist/esm/components/CnVideoWidgetForm/CnVideoWidgetForm3.vue.js.map +1 -1
- package/dist/esm/components/CnWidgetGrid/dashboardWidgetRegistry.js +1 -0
- package/dist/esm/components/CnWidgetGrid/dashboardWidgetRegistry.js.map +1 -1
- package/dist/esm/dialogs/CnAddWidgetModal.vue.js +1 -1
- package/dist/esm/dialogs/CnAddWidgetModal2.vue.js +18 -4
- package/dist/esm/dialogs/CnAddWidgetModal2.vue.js.map +1 -1
- package/dist/esm/dialogs/CnAddWidgetModal3.vue.js +57 -39
- package/dist/esm/dialogs/CnAddWidgetModal3.vue.js.map +1 -1
- package/dist/esm/l10n/en.json.js +96 -1
- package/dist/esm/l10n/en.json.js.map +1 -1
- package/dist/esm/l10n/nl.json.js +96 -1
- package/dist/esm/l10n/nl.json.js.map +1 -1
- package/dist/esm/library-style.js +1 -1
- package/dist/esm/nextcloud-vue.css +309 -192
- package/dist/nextcloud-vue.cjs.js +2359 -1605
- package/dist/nextcloud-vue.cjs.js.map +2 -2
- package/dist/nextcloud-vue.css +309 -192
- package/l10n/en.json +96 -1
- package/l10n/nl.json +96 -1
- package/package.json +1 -1
- package/src/components/CnCalendarWidget/CnCalendarWidget.vue +217 -75
- package/src/components/CnChartWidget/CnChartWidget.vue +60 -2
- package/src/components/CnDashboardGrid/CnDashboardGrid.md +1 -1
- package/src/components/CnDashboardGrid/CnDashboardGrid.vue +41 -16
- package/src/components/CnDividerWidget/index.js +1 -0
- package/src/components/CnFilesWidget/CnFilesWidget.vue +278 -5
- package/src/components/CnHeaderWidget/index.js +0 -1
- package/src/components/CnHeaderWidgetForm/CnHeaderWidgetForm.vue +20 -6
- package/src/components/CnVideoWidget/CnVideoWidget.vue +84 -1
- package/src/components/CnVideoWidgetForm/CnVideoWidgetForm.vue +19 -1
- package/src/components/CnWidgetGrid/dashboardWidgetRegistry.js +1 -0
- package/src/dialogs/CnAddWidgetModal.vue +53 -14
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CnDashboardGrid3.vue.js","sources":["../../../../src/components/CnDashboardGrid/CnDashboardGrid.vue?vue&type=template&id=e21b7108&lang.js"],"sourcesContent":["<!--\n CnDashboardGrid — GridStack-powered drag-and-drop dashboard grid.\n\n Renders widgets in a configurable grid layout. Supports drag, resize,\n and dynamic item addition/removal. Emits layout changes for persistence.\n\n Accessibility: every grid item is an ARIA `group` with an accessible name\n and — in edit mode — a tab stop, so the pointer-only GridStack drag/resize\n gestures have a full keyboard equivalent (WCAG 2.1 SC 2.1.1). Keyboard\n moves are routed through `GridStack.update()`, i.e. the exact same engine\n call drag/resize ends in, so collision handling, persistence and the\n `layout-change` emission are byte-identical between the two input modes.\n-->\n<template>\n\t<div ref=\"gridContainer\"\n\t\tclass=\"cn-dashboard-grid\"\n\t\t:class=\"{ 'cn-dashboard-grid--side-column': sideColumnStyle !== null, 'cn-dashboard-grid--weighted': columnBounds !== null, 'cn-dashboard-grid--fill': filling }\"\n\t\t:style=\"sideColumnStyle\">\n\t\t<!--\n\t\t\tKeyboard instructions, referenced by every grid item through\n\t\t\t`aria-describedby`. Rendered once (not per item) so a screen\n\t\t\treader user hears the key map on the first item they land on\n\t\t\twithout it being duplicated N times in the accessibility tree.\n\t\t-->\n\t\t<p\n\t\t\tv-if=\"keyboardActive\"\n\t\t\t:id=\"keyboardHelpDomId\"\n\t\t\tclass=\"cn-dashboard-grid__sr-only\">\n\t\t\t{{ keyboardHelpText }}\n\t\t</p>\n\n\t\t<div class=\"grid-stack\" :style=\"fillGridStyle\">\n\t\t\t<div\n\t\t\t\tv-for=\"item in itemsInRowOrder\"\n\t\t\t\t:key=\"resolveItemKey(item)\"\n\t\t\t\tclass=\"grid-stack-item\"\n\t\t\t\t:class=\"{ 'cn-dashboard-grid__item--fit': sizeToContentAttr(item) !== undefined, 'cn-dashboard-grid__item--same-height': sharesRowHeight(item) }\"\n\t\t\t\trole=\"group\"\n\t\t\t\t:aria-label=\"resolveItemLabel(item, layout.indexOf(item))\"\n\t\t\t\t:aria-describedby=\"itemDescribedBy\"\n\t\t\t\t:tabindex=\"itemTabindex\"\n\t\t\t\t:gs-id=\"item.id\"\n\t\t\t\t:gs-x=\"item.gridX\"\n\t\t\t\t:gs-y=\"scaledRow(item.gridY)\"\n\t\t\t\t:gs-w=\"item.gridWidth\"\n\t\t\t\t:gs-h=\"scaledRow(item.gridHeight)\"\n\t\t\t\t:gs-min-w=\"minWidth\"\n\t\t\t\t:gs-min-h=\"minRows(item)\"\n\t\t\t\t:gs-size-to-content=\"sizeToContentAttr(item)\"\n\t\t\t\t:data-cn-track=\"item.track === 'main' || item.track === 'side' ? item.track : undefined\"\n\t\t\t\t:data-cn-weighted=\"weightStyle(item) ? '' : undefined\"\n\t\t\t\t:data-cn-widget-id=\"item.widgetId || undefined\"\n\t\t\t\t:gs-locked=\"item.clear === true && !editable ? 'true' : undefined\"\n\t\t\t\t:style=\"itemStyle(item)\"\n\t\t\t\t@keydown=\"onItemKeydown($event, item)\">\n\t\t\t\t<div class=\"grid-stack-item-content\">\n\t\t\t\t\t<slot name=\"widget\" :item=\"item\">\n\t\t\t\t\t\t<!-- Default: render nothing; CnDashboardPage provides content -->\n\t\t\t\t\t</slot>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</div>\n\n\t\t<!--\n\t\t\tPolite live region for keyboard move/resize feedback. A sighted\n\t\t\tuser sees the widget slide; a screen-reader user needs the new\n\t\t\tcoordinates spoken, otherwise the arrow keys are silent.\n\t\t-->\n\t\t<p\n\t\t\tclass=\"cn-dashboard-grid__sr-only\"\n\t\t\trole=\"status\"\n\t\t\taria-live=\"polite\"\n\t\t\taria-atomic=\"true\">\n\t\t\t{{ announcement }}\n\t\t</p>\n\t</div>\n</template>\n\n<script>\nimport { translate as t } from '@nextcloud/l10n'\nimport { GridStack } from 'gridstack'\nimport { toRaw } from 'vue'\nimport { planClearRows, planGrowth, planSameHeights } from '../../utils/gridStack.js'\n// `gridstack` is a peerDependency (see package.json), not bundled — this\n// component's JS and the consumer's GridStack stylesheet MUST come from the\n// exact same installed copy, because GridStack's JS writes layout state\n// (e.g. the `--gs-column-width` CSS custom property) that only its OWN\n// matching CSS reads. Baking a copy of `gridstack/dist/gridstack.min.css`\n// into this library's build (as a previous version did) freezes it at\n// nc-vue's build-time version, which can silently drift from whatever the\n// consumer's peer-installed copy actually is — the exact mismatch that once\n// made every grid item render at 0px width. So nc-vue ships NO GridStack\n// CSS of its own: the consumer MUST install `gridstack` themselves and\n// import `gridstack/dist/gridstack.min.css` (or their preferred GridStack\n// stylesheet) from that same copy.\n\n/**\n * Monotonic counter backing the per-instance DOM ids (the shared\n * `aria-describedby` help text). Module-level so two grids on one page\n * never collide — the same pattern CnCommandPalette uses.\n */\nlet domIdCounter = 0\n\n/**\n * Pixel offset applied to the grid item's top-left corner when synthesising\n * the `contextmenu` coordinates for a keyboard activation. Nudging the anchor\n * inside the item keeps consumer menus (which position at `clientX/clientY`)\n * visually attached to the widget instead of straddling its border.\n */\nconst MENU_ANCHOR_OFFSET = 8\n\n/**\n * How many GridStack rows a layout row is drawn as on a grid with\n * size-to-content cells (`wantsRowSplit`): 80px rows become 1px rows, so a\n * cell sized to its content ends less than 1px under it. On 4px rows each\n * stacked card could end up to 4px low, and the rounding added up down a\n * column (r33 DqHandhaving \"De overtreding\" y +6).\n *\n * @spec openspec/changes/fit-cells-on-4px-rows/specs/fit-cells-on-4px-rows/spec.md#requirement-a-size-to-content-cell-ends-within-4px-of-its-content\n */\nconst ROW_SPLIT = 80\n\n/**\n * Whether a layout holds a size-to-content cell (`sizeToContent` true or a\n * positive row maximum).\n *\n * @param {Array<object>} layout The layout items.\n * @return {boolean} True when one does.\n */\nfunction hasFitCell(layout) {\n\treturn Array.isArray(layout) && layout.some((item) => item\n\t\t&& (item.sizeToContent === true || (Number.isFinite(item.sizeToContent) && item.sizeToContent > 0)))\n}\n\n/**\n * The row tracks of a grid that fills its height (`fillHeight`): `auto` for\n * a row whose items all set `fitRows`, or that no item covers, and an equal\n * share of the free height (`minmax(0, 1fr)`) for every other row.\n *\n * @spec openspec/changes/lpvandaag-start-page/specs/lpvandaag-start-page/spec.md#requirement-a-dashboard-can-fill-the-height-below-the-top-bar\n * @param {Array<object>} layout The layout items.\n * @return {string[]} One track per layout row.\n */\nexport function fillRowTracks(layout) {\n\tconst items = Array.isArray(layout) ? layout.filter(Boolean) : []\n\tconst top = (item) => (Number.isFinite(item.gridY) ? item.gridY : 0)\n\tconst height = (item) => (Number.isFinite(item.gridHeight) ? item.gridHeight : 1)\n\tconst rows = items.reduce((max, item) => Math.max(max, top(item) + height(item)), 0)\n\tconst tracks = []\n\tfor (let row = 0; row < rows; row++) {\n\t\tconst covering = items.filter((item) => row >= top(item) && row < top(item) + height(item))\n\t\tconst fits = covering.every((item) => item.fitRows === true)\n\t\ttracks.push(fits ? 'auto' : 'minmax(0, 1fr)')\n\t}\n\treturn tracks\n}\n\n/**\n * CnDashboardGrid — Low-level grid layout engine powered by GridStack.\n *\n * Manages the drag-and-drop grid, syncs positions, and emits layout\n * changes. Does NOT handle widget rendering — that's done by the parent\n * via the `#widget` scoped slot.\n *\n * ```vue\n * <CnDashboardGrid\n * :layout=\"placements\"\n * :editable=\"isEditing\"\n * @layout-change=\"onLayoutChange\">\n * <template #widget=\"{ item }\">\n * <MyWidget :config=\"item\" />\n * </template>\n * </CnDashboardGrid>\n * ```\n *\n * ### Keyboard operation\n *\n * With `keyboardRepositioning` on (the default) and `editable` true, each\n * grid item is a tab stop. With an item focused:\n *\n * | Key | Action |\n * | --- | ------ |\n * | `ArrowLeft` / `ArrowRight` | move one column left / right |\n * | `ArrowUp` / `ArrowDown` | move one row up / down |\n * | `Shift` + `ArrowLeft` / `ArrowRight` | shrink / grow width by one column |\n * | `Shift` + `ArrowUp` / `ArrowDown` | shrink / grow height by one row |\n * | `Home` / `End` | jump to the first / last column of the current row |\n * | `Enter` / `Space` | activate the item — see `item-activate` |\n *\n * Keys are only honoured when the grid item itself holds focus, so\n * interactive content rendered inside the `#widget` slot keeps its own\n * key handling untouched.\n */\nexport default {\n\tname: 'CnDashboardGrid',\n\n\tprops: {\n\t\t/** Array of layout items: { id, gridX, gridY, gridWidth, gridHeight, ...extra } */\n\t\tlayout: {\n\t\t\ttype: Array,\n\t\t\trequired: true,\n\t\t},\n\n\t\t/** Whether drag and resize are enabled */\n\t\teditable: {\n\t\t\ttype: Boolean,\n\t\t\tdefault: false,\n\t\t},\n\n\t\t/** Number of grid columns */\n\t\tcolumns: {\n\t\t\ttype: Number,\n\t\t\tdefault: 12,\n\t\t},\n\n\t\t/** Cell height in pixels */\n\t\tcellHeight: {\n\t\t\ttype: Number,\n\t\t\tdefault: 80,\n\t\t},\n\n\t\t/** Grid margin in pixels */\n\t\tmargin: {\n\t\t\ttype: Number,\n\t\t\tdefault: 12,\n\t\t},\n\n\t\t/**\n\t\t * Margin under each item in pixels, in place of `margin` on that side\n\t\t * only; null keeps `margin` on every side.\n\t\t */\n\t\tmarginBottom: {\n\t\t\ttype: Number,\n\t\t\tdefault: null,\n\t\t},\n\n\t\t/** Minimum widget width in grid units */\n\t\tminWidth: {\n\t\t\ttype: Number,\n\t\t\tdefault: 2,\n\t\t},\n\n\t\t/** Minimum widget height in grid units */\n\t\tminHeight: {\n\t\t\ttype: Number,\n\t\t\tdefault: 2,\n\t\t},\n\n\t\t/**\n\t\t * GridStack v12 responsive `columnOpts` bag (breakpoints + reflow\n\t\t * layout). When set, the grid reflows column count across screen sizes.\n\t\t * Build it with `getDashboardColumnOpts()`. Default `null` = fixed\n\t\t * `columns`, no responsive reflow (backwards-compatible).\n\t\t *\n\t\t * @type {object|null}\n\t\t */\n\t\tcolumnOpts: {\n\t\t\ttype: Object,\n\t\t\tdefault: null,\n\t\t},\n\n\t\t/**\n\t\t * When set, `cellHeight` is mirrored into this CSS custom property on\n\t\t * the document root at init (e.g. `'--app-cell-height'`), so app CSS can\n\t\t * align to the grid geometry. Default `null` = no CSS var written.\n\t\t *\n\t\t * @type {string|null}\n\t\t */\n\t\tcellHeightCssVar: {\n\t\t\ttype: String,\n\t\t\tdefault: null,\n\t\t},\n\n\t\t/**\n\t\t * Optional `(item) => string|number` to derive each item's render key.\n\t\t * Use it to force a re-render when an item changes in a way its `id`\n\t\t * doesn't capture (e.g. style edits — return `${item.id}:${item.updatedAt}`).\n\t\t * Default `null` = key on `item.id`.\n\t\t *\n\t\t * @type {((item: object) => (string|number))|null}\n\t\t */\n\t\titemKey: {\n\t\t\ttype: Function,\n\t\t\tdefault: null,\n\t\t},\n\n\t\t/**\n\t\t * Whether grid items are keyboard-operable: focusable in edit mode and\n\t\t * repositionable/resizable with the arrow keys (WCAG 2.1 SC 2.1.1 —\n\t\t * the keyboard equivalent of the pointer-only GridStack drag). Turning\n\t\t * it off leaves the items non-focusable and drag-only. Default `true`.\n\t\t */\n\t\tkeyboardRepositioning: {\n\t\t\ttype: Boolean,\n\t\t\tdefault: true,\n\t\t},\n\n\t\t/**\n\t\t * Optional `(item, index) => string` returning the accessible name for\n\t\t * a grid item. Use it when the layout items don't carry a human-readable\n\t\t * field (the built-in fallback walks `title` → `name` → `label` →\n\t\t * `widgetTitle` → `widgetId`, then a positional \"Widget N\"). The returned\n\t\t * string is used verbatim — no coordinates are appended.\n\t\t *\n\t\t * @type {((item: object, index: number) => string)|null}\n\t\t */\n\t\titemLabel: {\n\t\t\ttype: Function,\n\t\t\tdefault: null,\n\t\t},\n\n\t\t/**\n\t\t * Whether a keyboard activation (`Enter` / `Space` on a focused grid\n\t\t * item) also dispatches a bubbling `contextmenu` event from inside the\n\t\t * item, so consumers that open a per-widget menu on right-click get the\n\t\t * keyboard path for free — mirroring what browsers do for the `Menu`\n\t\t * key. Set `false` to rely purely on the `item-activate` event.\n\t\t * Default `true`.\n\t\t */\n\t\tactivateOpensContextMenu: {\n\t\t\ttype: Boolean,\n\t\t\tdefault: true,\n\t\t},\n\n\t\t/**\n\t\t * GridStack's `float`. True (the default) keeps every item on the row\n\t\t * it was placed on, with empty rows above it if need be. False packs\n\t\t * items upward, so a size-to-content cell that shrinks, or a widget\n\t\t * that is not shown, closes its gap instead of leaving a band.\n\t\t *\n\t\t * @spec openspec/changes/zuiddrecht-pixel-gaps-3/specs/zuiddrecht-pixel-gaps-3/spec.md#requirement-a-dashboard-closes-the-gap-a-shrinking-or-hidden-widget-leaves\n\t\t */\n\t\tfloat: {\n\t\t\ttype: Boolean,\n\t\t\tdefault: true,\n\t\t},\n\n\t\t/**\n\t\t * A side column of a fixed width: `{ width, from? }`. The layout items\n\t\t * that say which track they are on (`track: \"main\"` or `\"side\"`) are\n\t\t * drawn on two scales: from column `from` (8 by default) on at `width`\n\t\t * px (the card, not counting the item margins), the columns before it\n\t\t * sharing the rest, so the side cards keep their width on any screen\n\t\t * (DqMijnWerk). Items without a track keep the twelve shares, so a row\n\t\t * of four tiles stays four equal tiles. Only on the full twelve-column\n\t\t * grid and not while editing; GridStack keeps the twelve columns\n\t\t * underneath.\n\t\t *\n\t\t * @spec openspec/changes/dashboard-side-column-width/specs/dashboard-side-column-width/spec.md#requirement-a-dashboard-can-draw-its-side-column-at-a-fixed-width\n\t\t */\n\t\tsideColumn: {\n\t\t\ttype: Object,\n\t\t\tdefault: null,\n\t\t},\n\n\t\t/**\n\t\t * Weights for groups of the twelve columns: `[{ span, weight }]`, the\n\t\t * spans adding up to 12. Each group takes its weight's share of the\n\t\t * width, split evenly over its columns, so three groups of four can be\n\t\t * drawn 332 / 415 / 332 (PqWerkplekKlant in a call). Items on a\n\t\t * `sideColumn` track keep that column. Only on the full twelve-column\n\t\t * grid and not while editing; GridStack keeps the twelve columns\n\t\t * underneath.\n\t\t *\n\t\t * @spec openspec/changes/dashboard-column-weights/specs/dashboard-column-weights/spec.md#requirement-a-dashboard-can-weigh-its-column-groups\n\t\t */\n\t\tcolumnWeights: {\n\t\t\ttype: Array,\n\t\t\tdefault: null,\n\t\t},\n\n\t\t/**\n\t\t * Fill the height the host gives the grid instead of growing with\n\t\t * the content: in view mode the layout rows divide the grid's own\n\t\t * height, so the page around it does not scroll. A row whose items\n\t\t * all set `fitRows: true` takes the height of its content; every\n\t\t * other row takes an equal share of what is left. A widget that is\n\t\t * taller than its share scrolls inside its own cell. The host gives\n\t\t * the grid a definite height (a flex child with `min-height: 0`, say).\n\t\t * Edit mode, and a grid narrower than `fillMinWidth`, keep the\n\t\t * GridStack grid of `cellHeight` rows.\n\t\t *\n\t\t * @spec openspec/changes/lpvandaag-start-page/specs/lpvandaag-start-page/spec.md#requirement-a-dashboard-can-fill-the-height-below-the-top-bar\n\t\t */\n\t\tfillHeight: {\n\t\t\ttype: Boolean,\n\t\t\tdefault: false,\n\t\t},\n\n\t\t/**\n\t\t * The narrowest grid, in pixels, that `fillHeight` still fills.\n\t\t * Narrower, the cards take their `cellHeight` rows (and GridStack's\n\t\t * `columnOpts` reflow) and the page scrolls.\n\t\t *\n\t\t * @spec openspec/changes/lpvandaag-start-page/specs/lpvandaag-start-page/spec.md#requirement-a-dashboard-can-fill-the-height-below-the-top-bar\n\t\t */\n\t\tfillMinWidth: {\n\t\t\ttype: Number,\n\t\t\tdefault: 960,\n\t\t},\n\t},\n\n\temits: [\n\t\t/**\n\t\t * Fired whenever the grid geometry changed — by drag, by resize, or by\n\t\t * a keyboard nudge. Payload is the full `layout` array with the moved\n\t\t * items' `gridX`/`gridY`/`gridWidth`/`gridHeight` updated.\n\t\t */\n\t\t'layout-change',\n\t\t/**\n\t\t * Fired when the user activates a focused grid item with `Enter` or\n\t\t * `Space`. Payload `{ item, element, clientX, clientY }` — the layout\n\t\t * item, its DOM element, and viewport coordinates anchored to the\n\t\t * item's top-left corner so a consumer menu can position itself the\n\t\t * same way it does for a right-click.\n\t\t */\n\t\t'item-activate',\n\t],\n\n\tdata() {\n\t\treturn {\n\t\t\tgrid: null,\n\t\t\tcontentObserver: null,\n\t\t\t/** True while the grid moves an item to where the layout put it. */\n\t\t\tapplyingLayout: false,\n\t\t\tdomId: `cn-dashboard-grid-${++domIdCounter}`,\n\t\t\t/** Text currently held in the polite live region. */\n\t\t\tannouncement: '',\n\t\t\t/**\n\t\t\t * Whether a `columnOpts` breakpoint is currently in force. Mirrored\n\t\t\t * from the engine by `syncInteractivity` because `isReflowed()` reads\n\t\t\t * `grid.getColumn()` imperatively, and a computed cannot re-evaluate\n\t\t\t * on that.\n\t\t\t */\n\t\t\treflowed: false,\n\t\t\t/**\n\t\t\t * How many GridStack rows one layout row is drawn as: 1, or\n\t\t\t * ROW_SPLIT while `wantsRowSplit` holds. Set before the first render,\n\t\t\t * since GridStack reads the items' places from their attributes,\n\t\t\t * and again when the grid is rebuilt.\n\t\t\t */\n\t\t\trowSplit: (!this.editable && !this.float && hasFitCell(this.layout)) ? ROW_SPLIT : 1,\n\t\t\t/** The grid's width in pixels, measured for `fillHeight`. */\n\t\t\tcontainerWidth: 0,\n\t\t\tsizeObserver: null,\n\t\t}\n\t},\n\n\tcomputed: {\n\t\t/**\n\t\t * The CSS variables that draw the side column at its width, or null\n\t\t * when the grid keeps its twelve shares.\n\t\t *\n\t\t * @return {object|null}\n\t\t */\n\t\t/**\n\t\t * The left edge of each of the twelve columns and the right edge of\n\t\t * the last, as fractions of the grid's width, from `columnWeights`;\n\t\t * null when the grid keeps its twelve shares.\n\t\t *\n\t\t * @spec openspec/changes/dashboard-column-weights/specs/dashboard-column-weights/spec.md#requirement-a-dashboard-can-weigh-its-column-groups\n\t\t * @return {number[]|null}\n\t\t */\n\t\tcolumnBounds() {\n\t\t\tconst groups = this.columnWeights\n\t\t\tif (this.editable || !Array.isArray(groups) || groups.length === 0) {\n\t\t\t\treturn null\n\t\t\t}\n\t\t\tconst perColumn = []\n\t\t\tfor (const group of groups) {\n\t\t\t\tconst span = Number(group?.span)\n\t\t\t\tconst weight = Number(group?.weight)\n\t\t\t\tif (!Number.isInteger(span) || span < 1 || !Number.isFinite(weight) || weight <= 0) {\n\t\t\t\t\treturn null\n\t\t\t\t}\n\t\t\t\tfor (let i = 0; i < span; i++) {\n\t\t\t\t\tperColumn.push(weight / span)\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (perColumn.length !== 12) {\n\t\t\t\treturn null\n\t\t\t}\n\t\t\tconst total = perColumn.reduce((sum, w) => sum + w, 0)\n\t\t\tconst bounds = [0]\n\t\t\tfor (const w of perColumn) {\n\t\t\t\tbounds.push(bounds[bounds.length - 1] + w / total)\n\t\t\t}\n\t\t\treturn bounds\n\t\t},\n\n\t\tsideColumnStyle() {\n\t\t\tconst width = Number(this.sideColumn?.width)\n\t\t\tif (this.editable || !Number.isFinite(width) || width <= 0) {\n\t\t\t\treturn null\n\t\t\t}\n\t\t\tconst from = Math.floor(Number(this.sideColumn?.from ?? 8))\n\t\t\tconst split = Number.isFinite(from) && from > 0 && from < 12 ? from : 8\n\t\t\treturn {\n\t\t\t\t'--cn-side-width': `${width}px`,\n\t\t\t\t'--cn-side-from': String(split),\n\t\t\t\t'--cn-side-span': String(12 - split),\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Whether the grid fills its height now (`fillHeight`): in view mode,\n\t\t * on a grid at least `fillMinWidth` wide.\n\t\t *\n\t\t * @spec openspec/changes/lpvandaag-start-page/specs/lpvandaag-start-page/spec.md#requirement-a-dashboard-can-fill-the-height-below-the-top-bar\n\t\t * @return {boolean}\n\t\t */\n\t\tfilling() {\n\t\t\treturn this.fillHeight && !this.editable && this.containerWidth >= this.fillMinWidth\n\t\t},\n\n\t\t/**\n\t\t * The inline style of the grid element while it fills its height.\n\t\t *\n\t\t * @spec openspec/changes/lpvandaag-start-page/specs/lpvandaag-start-page/spec.md#requirement-a-dashboard-can-fill-the-height-below-the-top-bar\n\t\t * @return {object|null}\n\t\t */\n\t\tfillGridStyle() {\n\t\t\tif (!this.filling) {\n\t\t\t\treturn null\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tgridTemplateColumns: `repeat(${this.columns}, minmax(0, 1fr))`,\n\t\t\t\tgridTemplateRows: fillRowTracks(this.layout).join(' '),\n\t\t\t\t'--cn-fill-margin': `${this.margin}px`,\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * The layout's items top to bottom, then left to right: the order the\n\t\t * items are in the page, so GridStack places them in that order.\n\t\t *\n\t\t * GridStack sizes a size-to-content cell while it adds the items, one\n\t\t * at a time, and an item it adds onto a cell that has already grown\n\t\t * moves itself below whatever it then collides with. In the layout's\n\t\t * own order a card declared after the lists (pipelinq's full-width\n\t\t * \"client in focus\" card) was added last, so when the banner above\n\t\t * it grew it skipped past the stat tiles AND the lists and landed at\n\t\t * the bottom. Added top to bottom, every card lands under the one\n\t\t * above it. It is also the order a screen reader and the Tab key\n\t\t * follow. An item without a row or column sorts after the items\n\t\t * that have one, in the layout's order.\n\t\t *\n\t\t * @spec openspec/changes/dashboard-growth-keeps-order/specs/dashboard-grid/spec.md#requirement-a-growing-cell-keeps-the-order-of-the-cards-under-it\n\t\t * @return {Array<object>} The items in row order.\n\t\t */\n\t\titemsInRowOrder() {\n\t\t\tconst items = Array.isArray(this.layout) ? [...this.layout] : []\n\t\t\tconst at = (value) => (Number.isFinite(value) ? value : Number.MAX_SAFE_INTEGER)\n\t\t\treturn items.sort((a, b) => (at(a.gridY) - at(b.gridY)) || (at(a.gridX) - at(b.gridX)))\n\t\t},\n\n\t\t/**\n\t\t * Whether the grid draws each layout row as ROW_SPLIT finer rows. A\n\t\t * size-to-content cell can only be a whole number of rows tall, so on\n\t\t * 80px rows it kept up to a row of empty space under its content and\n\t\t * a packing grid (`float: false`) could not close it (pipelinq and\n\t\t * dossiq Mijn werk, decidiq Mijn acties). Split into 4px rows the\n\t\t * cell ends within 4px of its content and the widgets below move up.\n\t\t *\n\t\t * Only in view mode, only on a packing grid with a size-to-content\n\t\t * cell: every other grid is built exactly as before. Item positions\n\t\t * and sizes scale with the rows, so every widget keeps its pixel\n\t\t * place and size until a cell shrinks; the layout itself, what edit\n\t\t * mode shows and what `layout-change` reports, stays in layout rows.\n\t\t *\n\t\t * @spec openspec/changes/dashboard-fit-cells-close-up/specs/dashboard-grid/spec.md#requirement-a-size-to-content-cell-ends-at-its-content\n\t\t * @return {boolean} True to split the rows.\n\t\t */\n\t\twantsRowSplit() {\n\t\t\treturn !this.editable && !this.float && hasFitCell(this.layout)\n\t\t},\n\n\t\t/**\n\t\t * @return {boolean} Whether the keyboard lane is live — items are\n\t\t * focusable and the arrow keys reposition. Requires the opt-in prop,\n\t\t * edit mode (a read-only dashboard has nothing to move, so adding N tab\n\t\t * stops there would be pure noise), and a grid that is not reflowed,\n\t\t * which is where a move cannot be kept and so must not be offered.\n\t\t */\n\t\tkeyboardActive() {\n\t\t\treturn this.keyboardRepositioning && this.editable && !this.reflowed\n\t\t},\n\n\t\t/**\n\t\t * @return {number|null} `0` when grid items should be tab stops,\n\t\t * otherwise `null` so the attribute is omitted entirely.\n\t\t */\n\t\titemTabindex() {\n\t\t\treturn this.keyboardActive ? 0 : null\n\t\t},\n\n\t\t/**\n\t\t * @return {string} DOM id of the shared keyboard-instructions element.\n\t\t */\n\t\tkeyboardHelpDomId() {\n\t\t\treturn `${this.domId}-keyboard-help`\n\t\t},\n\n\t\t/**\n\t\t * @return {string|null} `aria-describedby` target for each grid item —\n\t\t * the instructions element while the keyboard lane is live, `null`\n\t\t * otherwise (a dangling id reference is an axe violation).\n\t\t */\n\t\titemDescribedBy() {\n\t\t\treturn this.keyboardActive ? this.keyboardHelpDomId : null\n\t\t},\n\n\t\t/**\n\t\t * @return {string} The spoken key map for the keyboard lane.\n\t\t */\n\t\tkeyboardHelpText() {\n\t\t\treturn t(\n\t\t\t\t'nextcloud-vue',\n\t\t\t\t'Use the arrow keys to move this widget one cell. Hold Shift and use the arrow keys to resize it. Press Home or End to jump to the first or last column. Press Enter to open the widget menu.',\n\t\t\t)\n\t\t},\n\n\t\t/**\n\t\t * @return {number} The column count currently in force. With responsive\n\t\t * `columnOpts` GridStack reflows to fewer columns on small screens, so\n\t\t * clamping must read the live value rather than the `columns` prop.\n\t\t */\n\t\teffectiveColumns() {\n\t\t\tif (this.grid && typeof this.grid.getColumn === 'function') {\n\t\t\t\tconst live = this.grid.getColumn()\n\t\t\t\tif (Number.isFinite(live) && live > 0) {\n\t\t\t\t\treturn live\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn this.columns\n\t\t},\n\t},\n\n\twatch: {\n\t\teditable() {\n\t\t\tthis.syncInteractivity()\n\t\t},\n\n\t\tfilling(fills) {\n\t\t\tif (fills) {\n\t\t\t\tthis.disconnectContentObserver()\n\t\t\t\tif (this.grid) {\n\t\t\t\t\tthis.grid.destroy(false)\n\t\t\t\t\tthis.grid = null\n\t\t\t\t}\n\t\t\t\treturn\n\t\t\t}\n\t\t\tthis.$nextTick(() => {\n\t\t\t\tif (this.grid || !this.$refs.gridContainer) {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tthis.applyItemAttributes()\n\t\t\t\tthis.initGrid()\n\t\t\t\tthis.observeContentSizes()\n\t\t\t})\n\t\t},\n\n\t\twantsRowSplit(wants) {\n\t\t\tif (this.grid && (wants ? ROW_SPLIT : 1) !== this.rowSplit) {\n\t\t\t\tthis.rebuildGrid()\n\t\t\t}\n\t\t},\n\n\t\tlayout: {\n\t\t\tdeep: true,\n\t\t\thandler(newLayout) {\n\t\t\t\tif (this.grid) {\n\t\t\t\t\tthis.syncGridItems(newLayout)\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t},\n\n\tmounted() {\n\t\tthis.observeContainerWidth()\n\t\tif (this.filling) {\n\t\t\treturn\n\t\t}\n\t\tthis.initGrid()\n\t\tthis.$nextTick(() => this.observeContentSizes())\n\t},\n\n\tbeforeUnmount() {\n\t\tif (this.sizeObserver) {\n\t\t\tthis.sizeObserver.disconnect()\n\t\t\tthis.sizeObserver = null\n\t\t}\n\t\tthis.disconnectContentObserver()\n\t\tif (this.grid) {\n\t\t\tthis.grid.destroy(false)\n\t\t}\n\t},\n\n\tmethods: {\n\t\t/**\n\t\t * Derive the v-for render key for a layout item, honouring the optional\n\t\t * `itemKey` prop and falling back to `item.id`.\n\t\t *\n\t\t * @param {object} item the layout item.\n\t\t * @return {string|number} the render key.\n\t\t */\n\t\tresolveItemKey(item) {\n\t\t\treturn this.itemKey ? this.itemKey(item) : item.id\n\t\t},\n\n\t\t/**\n\t\t * The `gs-size-to-content` attribute for a layout item, or `undefined` to\n\t\t * leave the item on its authored `gridHeight`.\n\t\t *\n\t\t * A widget that decides AT RUNTIME it has nothing to show — a banner whose\n\t\t * condition is false, a list that came back empty — still costs its whole\n\t\t * authored row, because the row is reserved from the layout before the\n\t\t * component renders and the engine positions items absolutely, so no CSS\n\t\t * can reclaim it. `sizeToContent` hands the row's height to the content, so\n\t\t * an empty widget collapses and the grid closes up behind it.\n\t\t *\n\t\t * Opt-in per item: it makes `gridHeight` advisory for that widget, which is\n\t\t * wrong for anything with a deliberate size (a map, a chart) and right for\n\t\t * anything whose height is whatever it turned out to have.\n\t\t *\n\t\t * @param {object} item the layout item.\n\t\t * @return {string|undefined} `'true'`, a row maximum as a string, or undefined.\n\t\t */\n\t\tsizeToContentAttr(item) {\n\t\t\tconst v = item && item.sizeToContent\n\t\t\tif (v === true) {\n\t\t\t\treturn 'true'\n\t\t\t}\n\t\t\t// A number is GridStack's \"size to content, but never taller than N rows\" (a maximum).\n\t\t\tif (Number.isFinite(v) && v > 0) {\n\t\t\t\treturn String(v * this.rowSplit)\n\t\t\t}\n\t\t\treturn undefined\n\t\t},\n\n\t\t/**\n\t\t * A layout row coordinate or height in GridStack rows (`rowSplit`).\n\t\t *\n\t\t * @spec openspec/changes/dashboard-fit-cells-close-up/specs/dashboard-grid/spec.md#requirement-a-size-to-content-cell-ends-at-its-content\n\t\t * @param {number|undefined} value The value in layout rows.\n\t\t * @return {number|undefined} The value in grid rows, or undefined when none is set.\n\t\t */\n\t\tscaledRow(value) {\n\t\t\treturn Number.isFinite(value) ? value * this.rowSplit : undefined\n\t\t},\n\n\t\t/**\n\t\t * The smallest height an item may take, in grid rows: `minHeight`\n\t\t * layout rows, except for a size-to-content cell on split rows, which\n\t\t * may shrink to its content down to one grid row. The minimum is for\n\t\t * resizing by hand, and that only happens on whole rows in edit mode.\n\t\t *\n\t\t * @spec openspec/changes/dashboard-fit-cells-close-up/specs/dashboard-grid/spec.md#requirement-a-size-to-content-cell-ends-at-its-content\n\t\t * @param {object} item The layout item.\n\t\t * @return {number} The minimum height in grid rows.\n\t\t */\n\t\tminRows(item) {\n\t\t\tif (this.rowSplit !== 1 && this.sizeToContentAttr(item) !== undefined) {\n\t\t\t\treturn 1\n\t\t\t}\n\t\t\treturn this.minHeight * this.rowSplit\n\t\t},\n\n\t\t/**\n\t\t * Build the grid again with the row split `wantsRowSplit` asks for, as\n\t\t * edit mode turns on or off: the items go back to their layout places in\n\t\t * the new rows, and the size-to-content cells are measured again.\n\t\t *\n\t\t * @spec openspec/changes/dashboard-fit-cells-close-up/specs/dashboard-grid/spec.md#requirement-a-size-to-content-cell-ends-at-its-content\n\t\t * @return {void}\n\t\t */\n\t\trebuildGrid() {\n\t\t\tthis.disconnectContentObserver()\n\t\t\tthis.grid.destroy(false)\n\t\t\tthis.grid = null\n\t\t\tthis.rowSplit = this.wantsRowSplit ? ROW_SPLIT : 1\n\t\t\tthis.$nextTick(() => {\n\t\t\t\tif (!this.$refs.gridContainer) {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\t// GridStack wrote its own places onto the items; put the layout's back.\n\t\t\t\tthis.applyItemAttributes()\n\t\t\t\tthis.initGrid()\n\t\t\t\tthis.observeContentSizes()\n\t\t\t})\n\t\t},\n\n\t\t/**\n\t\t * Build the accessible name for a grid item. A custom `itemLabel` wins\n\t\t * outright; otherwise the first human-readable field on the item is used\n\t\t * and, while the keyboard lane is live, the current grid coordinates are\n\t\t * appended — without them a screen-reader user tabbing through an edit-mode\n\t\t * dashboard has no way to tell where anything sits.\n\t\t *\n\t\t * @param {object} item the layout item.\n\t\t * @param {number} index the item's index in `layout`, used for the\n\t\t * last-resort positional name.\n\t\t * @return {string} the accessible name.\n\t\t */\n\t\t/**\n\t\t * Write every item's place and size onto its element as the `gs-*`\n\t\t * attributes GridStack reads when it starts, in the current row split.\n\t\t *\n\t\t * @return {void}\n\t\t */\n\t\tapplyItemAttributes() {\n\t\t\tfor (const item of this.layout) {\n\t\t\t\tconst el = this.$refs.gridContainer.querySelector(`[gs-id=\"${item.id}\"]`)\n\t\t\t\tif (!el) {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tfor (const [name, value] of [['gs-x', item.gridX], ['gs-w', item.gridWidth], ['gs-y', this.scaledRow(item.gridY)], ['gs-h', this.scaledRow(item.gridHeight)], ['gs-min-h', this.minRows(item)], ['gs-size-to-content', this.sizeToContentAttr(item)]]) {\n\t\t\t\t\tif (value === undefined || value === null) {\n\t\t\t\t\t\tel.removeAttribute(name)\n\t\t\t\t\t} else {\n\t\t\t\t\t\tel.setAttribute(name, String(value))\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Follow the grid's width, which decides whether `fillHeight` fills.\n\t\t *\n\t\t * @spec openspec/changes/lpvandaag-start-page/specs/lpvandaag-start-page/spec.md#requirement-a-dashboard-can-fill-the-height-below-the-top-bar\n\t\t * @return {void}\n\t\t */\n\t\tobserveContainerWidth() {\n\t\t\tconst container = this.$refs.gridContainer\n\t\t\tif (!this.fillHeight || !container) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tthis.containerWidth = container.clientWidth\n\t\t\tif (typeof ResizeObserver === 'undefined') {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tthis.sizeObserver = new ResizeObserver(() => {\n\t\t\t\tthis.containerWidth = container.clientWidth\n\t\t\t})\n\t\t\tthis.sizeObserver.observe(container)\n\t\t},\n\n\t\t/**\n\t\t * The inline style that places an item on the filled grid.\n\t\t *\n\t\t * @spec openspec/changes/lpvandaag-start-page/specs/lpvandaag-start-page/spec.md#requirement-a-dashboard-can-fill-the-height-below-the-top-bar\n\t\t * @param {object} item The layout item.\n\t\t * @return {object}\n\t\t */\n\t\tfillItemStyle(item) {\n\t\t\tconst x = Number.isFinite(item.gridX) ? item.gridX : 0\n\t\t\tconst y = Number.isFinite(item.gridY) ? item.gridY : 0\n\t\t\tconst w = Number.isFinite(item.gridWidth) ? item.gridWidth : this.minWidth\n\t\t\tconst h = Number.isFinite(item.gridHeight) ? item.gridHeight : this.minHeight\n\t\t\treturn {\n\t\t\t\tgridColumn: `${x + 1} / span ${w}`,\n\t\t\t\tgridRow: `${y + 1} / span ${h}`,\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * The left and width fractions of an item on weighted columns, or\n\t\t * null when the grid keeps its twelve shares or the item is on a\n\t\t * side-column track.\n\t\t *\n\t\t * @spec openspec/changes/dashboard-column-weights/specs/dashboard-column-weights/spec.md#requirement-a-dashboard-can-weigh-its-column-groups\n\t\t * @param {object} item The layout item.\n\t\t * @return {object|null}\n\t\t */\n\t\tweightStyle(item) {\n\t\t\tconst bounds = this.columnBounds\n\t\t\tif (bounds === null || (this.sideColumnStyle !== null && (item.track === 'main' || item.track === 'side'))) {\n\t\t\t\treturn null\n\t\t\t}\n\t\t\tconst x = Math.min(Math.max(Number.isFinite(item.gridX) ? item.gridX : 0, 0), 12)\n\t\t\tconst w = Number.isFinite(item.gridWidth) ? item.gridWidth : this.minWidth\n\t\t\tconst end = Math.min(Math.max(x + w, x), 12)\n\t\t\treturn {\n\t\t\t\t'--cn-weight-left': String(bounds[x]),\n\t\t\t\t'--cn-weight-width': String(bounds[end] - bounds[x]),\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * The inline style of an item: its place on a filled grid, or its\n\t\t * place on weighted columns.\n\t\t *\n\t\t * @param {object} item The layout item.\n\t\t * @return {object|undefined}\n\t\t */\n\t\titemStyle(item) {\n\t\t\tif (this.filling) {\n\t\t\t\treturn this.fillItemStyle(item)\n\t\t\t}\n\t\t\treturn this.weightStyle(item) || undefined\n\t\t},\n\n\t\tresolveItemLabel(item, index) {\n\t\t\tif (this.itemLabel) {\n\t\t\t\treturn String(this.itemLabel(item, index) ?? '')\n\t\t\t}\n\n\t\t\tconst base = item.title\n\t\t\t\t|| item.name\n\t\t\t\t|| item.label\n\t\t\t\t|| item.widgetTitle\n\t\t\t\t|| item.widgetId\n\t\t\t\t|| t('nextcloud-vue', 'Widget {number}', { number: index + 1 })\n\n\t\t\tif (!this.keyboardActive) {\n\t\t\t\treturn String(base)\n\t\t\t}\n\n\t\t\t// Report the rectangle exactly as the reactive `layout` prop states\n\t\t\t// it — unclamped, so the spoken coordinates always match the\n\t\t\t// rendered `gs-*` attributes — and read from the prop (not the\n\t\t\t// GridStack node) so the name re-renders when a move round-trips\n\t\t\t// back through `layout-change`; engine-node mutations are invisible\n\t\t\t// to Vue's reactivity.\n\t\t\tconst rect = {\n\t\t\t\tx: Number.isFinite(item.gridX) ? item.gridX : 0,\n\t\t\t\ty: Number.isFinite(item.gridY) ? item.gridY : 0,\n\t\t\t\tw: Number.isFinite(item.gridWidth) ? item.gridWidth : this.minWidth,\n\t\t\t\th: Number.isFinite(item.gridHeight) ? item.gridHeight : this.minHeight,\n\t\t\t}\n\t\t\treturn t(\n\t\t\t\t'nextcloud-vue',\n\t\t\t\t'{label}, column {column} of {columns}, row {row}, {width} columns wide, {height} rows tall',\n\t\t\t\t{\n\t\t\t\t\tlabel: String(base),\n\t\t\t\t\tcolumn: rect.x + 1,\n\t\t\t\t\tcolumns: this.effectiveColumns,\n\t\t\t\t\trow: rect.y + 1,\n\t\t\t\t\twidth: rect.w,\n\t\t\t\t\theight: rect.h,\n\t\t\t\t},\n\t\t\t)\n\t\t},\n\n\t\t/**\n\t\t * Build the GridStack grid on the rendered items, install the growth\n\t\t * wrapper (`keepOrderOnGrowth`) and listen for its changes.\n\t\t *\n\t\t * @spec openspec/changes/dashboard-growth-keeps-order/specs/dashboard-grid/spec.md#requirement-a-growing-cell-keeps-the-order-of-the-cards-under-it\n\t\t * @return {void}\n\t\t */\n\t\tinitGrid() {\n\t\t\tif (this.cellHeightCssVar && typeof document !== 'undefined' && document.documentElement) {\n\t\t\t\tdocument.documentElement.style.setProperty(this.cellHeightCssVar, `${this.cellHeight}px`)\n\t\t\t}\n\t\t\tconst el = this.$refs.gridContainer.querySelector('.grid-stack')\n\t\t\tthis.grid = GridStack.init({\n\t\t\t\tcolumn: this.columns,\n\t\t\t\tcellHeight: this.cellHeight / this.rowSplit,\n\t\t\t\tmargin: this.margin,\n\t\t\t\t...(this.marginBottom !== null ? { marginBottom: this.marginBottom } : {}),\n\t\t\t\tfloat: this.float,\n\t\t\t\tanimate: true,\n\t\t\t\tdisableDrag: !this.editable,\n\t\t\t\tdisableResize: !this.editable,\n\t\t\t\tremovable: false,\n\t\t\t\t...(this.columnOpts ? { columnOpts: this.columnOpts } : {}),\n\t\t\t}, el)\n\t\t\tthis.keepOrderOnGrowth()\n\t\t\tthis.matchRowHeights()\n\t\t\tthis.placeClearRows()\n\n\t\t\tthis.grid.on('change', (_event, items) => {\n\t\t\t\tthis.handleGridChange(items)\n\t\t\t})\n\n\t\t\t// A grid that mounts already narrow is reflowed before anyone touches\n\t\t\t// it, so the handles have to be judged here and not only on a later\n\t\t\t// change.\n\t\t\tthis.syncInteractivity()\n\t\t},\n\n\t\t/**\n\t\t * Let a size-to-content cell that grows push the cards under it down in\n\t\t * their order. GridStack resolves that collision itself, but not in\n\t\t * order: when pipelinq's banner grew from two rows to three, the\n\t\t * full-width card under the stat tiles landed below the lists, also\n\t\t * with `float: false`. Every grow after the grid is built, whether\n\t\t * GridStack measures it on resize or this grid's content observer asks\n\t\t * for it, now first moves the cards the growth reaches down by the\n\t\t * growth (`planGrowth`), bottom-most first, and only then grows the\n\t\t * cell, so GridStack has no collision left to resolve. The wrapper is\n\t\t * installed after `GridStack.init` has already measured the cells on\n\t\t * load; the order on load comes from adding the items in row order\n\t\t * (`itemsInRowOrder`). A cell that shrinks is left to GridStack as\n\t\t * before.\n\t\t *\n\t\t * The grid is read raw: through Vue's proxy `engine.nodes` holds proxies\n\t\t * while `el.gridstackNode` is the plain node, so the growing cell would\n\t\t * not be recognised among the nodes and would be moved down by its own\n\t\t * growth. Moving a cell makes GridStack measure it again, so a cell the\n\t\t * wrapper is already growing goes straight to GridStack.\n\t\t *\n\t\t * @spec openspec/changes/dashboard-growth-keeps-order/specs/dashboard-grid/spec.md#requirement-a-growing-cell-keeps-the-order-of-the-cards-under-it\n\t\t * @return {void}\n\t\t */\n\t\tkeepOrderOnGrowth() {\n\t\t\tconst grid = toRaw(this.grid)\n\t\t\tif (!grid || typeof grid.resizeToContent !== 'function' || typeof grid.update !== 'function') {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst resize = grid.resizeToContent.bind(grid)\n\t\t\tconst growing = new Set()\n\t\t\tgrid.resizeToContent = (el) => {\n\t\t\t\tif (this.pendingSizes) {\n\t\t\t\t\tif (!this.pendingSizes.includes(el)) {\n\t\t\t\t\t\tthis.pendingSizes.push(el)\n\t\t\t\t\t}\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tthis.matchRowHeights()\n\t\t\t\tthis.resizeKeepingOrder(grid, resize, growing, el)\n\t\t\t\tif (growing.size === 0) {\n\t\t\t\t\tthis.placeClearRows()\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * One `resizeToContent` with the cards under a growing cell moved down\n\t\t * first (`keepOrderOnGrowth`).\n\t\t *\n\t\t * @param {object} grid The raw GridStack.\n\t\t * @param {function(HTMLElement): void} resize GridStack's own resizeToContent.\n\t\t * @param {Set<HTMLElement>} growing The cells being grown now.\n\t\t * @param {HTMLElement} el The cell.\n\t\t * @return {void}\n\t\t */\n\t\tresizeKeepingOrder(grid, resize, growing, el) {\n\t\t\tif (growing.has(el)) {\n\t\t\t\tresize(el)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst node = el && el.gridstackNode\n\t\t\tconst nodes = grid.engine && Array.isArray(grid.engine.nodes) ? grid.engine.nodes : null\n\t\t\tconst rows = node && nodes ? this.contentRows(el, node) : null\n\t\t\tconst plan = rows ? planGrowth(nodes, node, rows) : []\n\t\t\tif (plan.length === 0) {\n\t\t\t\tresize(el)\n\t\t\t\treturn\n\t\t\t}\n\t\t\t// Inside a batch the moves are not packed until the cell has grown.\n\t\t\tconst batching = Boolean(grid.engine.batchMode)\n\t\t\tgrowing.add(el)\n\t\t\ttry {\n\t\t\t\tif (!batching) {\n\t\t\t\t\tgrid.batchUpdate()\n\t\t\t\t}\n\t\t\t\tfor (const step of plan) {\n\t\t\t\t\tgrid.update(step.node.el, { y: step.y })\n\t\t\t\t}\n\t\t\t\tresize(el)\n\t\t\t\tif (!batching) {\n\t\t\t\t\tgrid.batchUpdate(false)\n\t\t\t\t}\n\t\t\t} finally {\n\t\t\t\tgrowing.delete(el)\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Whether a layout item takes part in its row's shared height\n\t\t * (`sameHeight`). A size-to-content card stretches to the tallest; a card\n\t\t * of fixed height is not stretched but counts as the height to reach.\n\t\t *\n\t\t * @spec openspec/changes/dashboard-row-same-height/specs/dashboard-grid/spec.md\n\t\t * @param {object} item The layout item.\n\t\t * @return {boolean} True when it does.\n\t\t */\n\t\tsharesRowHeight(item) {\n\t\t\treturn item?.sameHeight === true\n\t\t},\n\n\t\t/**\n\t\t * Stretch the shorter `sameHeight` cards of each layout row to the\n\t\t * tallest of them (`planSameHeights`), with a min-height on the widget\n\t\t * the cell measures, so GridStack sizes the cells alike and the next row\n\t\t * starts level, as the boards draw a row of cards (DqProcesanalyse).\n\t\t * Each pass measures the content again without the stretch, so a row\n\t\t * shrinks with its content. Edit mode and a reflowed (stacked) grid keep\n\t\t * every card at its own height.\n\t\t *\n\t\t * @spec openspec/changes/dashboard-row-same-height/specs/dashboard-grid/spec.md\n\t\t * @return {void}\n\t\t */\n\t\tmatchRowHeights() {\n\t\t\tconst container = this.$el && typeof this.$el.querySelectorAll === 'function' ? this.$el : null\n\t\t\tif (!container || this.matchingRowHeights) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst byId = new Map(this.layout.map((item) => [String(item.id), item]))\n\t\t\tconst cards = []\n\t\t\tfor (const cell of container.querySelectorAll('.grid-stack-item.cn-dashboard-grid__item--same-height')) {\n\t\t\t\tconst item = byId.get(String(cell.getAttribute('gs-id')))\n\t\t\t\tconst child = cell.querySelector('.grid-stack-item-content')?.firstElementChild\n\t\t\t\tif (item && child) {\n\t\t\t\t\tcards.push({ child, row: item.gridY ?? 0, fit: this.sizeToContentAttr(item) !== undefined })\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (cards.length === 0) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tthis.matchingRowHeights = true\n\t\t\ttry {\n\t\t\t\tfor (const card of cards) {\n\t\t\t\t\tif (card.fit) {\n\t\t\t\t\t\tcard.child.style.minHeight = ''\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (this.editable || this.reflowed) {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tconst heights = planSameHeights(cards.map((card) => ({ row: card.row, height: card.child.getBoundingClientRect().height })))\n\t\t\t\tcards.forEach((card, index) => {\n\t\t\t\t\tif (card.fit && heights[index] !== null) {\n\t\t\t\t\t\tcard.child.style.minHeight = `${heights[index]}px`\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t} finally {\n\t\t\t\tthis.matchingRowHeights = false\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Put every `clear` layout item below the cards of the earlier rows\n\t\t * (`planClearRows`), in one batch. Runs after the grid is built and after\n\t\t * each cell is measured to its content; a move made here that measures a\n\t\t * cell again does not start another round.\n\t\t *\n\t\t * @spec openspec/changes/dashboard-clear-row/specs/dashboard-grid/spec.md\n\t\t * @return {void}\n\t\t */\n\t\tplaceClearRows() {\n\t\t\tconst grid = this.grid ? toRaw(this.grid) : null\n\t\t\tif (this.placingClearRows || !grid || !grid.engine || !Array.isArray(grid.engine.nodes) || typeof grid.update !== 'function') {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst byId = new Map(this.layout.map((item) => [String(item.id), item]))\n\t\t\tconst nodes = grid.engine.nodes.map((n) => {\n\t\t\t\tconst item = byId.get(String(n.id))\n\t\t\t\treturn Object.assign(Object.create(null), { node: n, x: n.x, y: n.y, w: n.w, h: n.h, row: item ? this.scaledRow(item.gridY ?? 0) : 0, clear: !this.editable && item?.clear === true })\n\t\t\t})\n\t\t\tconst plan = planClearRows(nodes)\n\t\t\tif (plan.length === 0) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst batching = Boolean(grid.engine.batchMode)\n\t\t\tthis.placingClearRows = true\n\t\t\ttry {\n\t\t\t\tif (!batching && typeof grid.batchUpdate === 'function') {\n\t\t\t\t\tgrid.batchUpdate()\n\t\t\t\t}\n\t\t\t\tfor (const step of plan) {\n\t\t\t\t\tgrid.update(step.node.node.el, { y: step.y })\n\t\t\t\t}\n\t\t\t\tif (!batching && typeof grid.batchUpdate === 'function') {\n\t\t\t\t\tgrid.batchUpdate(false)\n\t\t\t\t}\n\t\t\t} finally {\n\t\t\t\tthis.placingClearRows = false\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * The rows a size-to-content cell needs for its content, measured the\n\t\t * way GridStack's `resizeToContent` measures it (the content's first\n\t\t * child, plus the cell's own padding), within its size-to-content row\n\t\t * maximum and its minimum and maximum height.\n\t\t *\n\t\t * @spec openspec/changes/dashboard-growth-keeps-order/specs/dashboard-grid/spec.md#requirement-a-growing-cell-keeps-the-order-of-the-cards-under-it\n\t\t * @param {HTMLElement} el The cell.\n\t\t * @param {object} node Its GridStack node.\n\t\t * @return {number|null} The rows, or null when it cannot be measured.\n\t\t */\n\t\tcontentRows(el, node) {\n\t\t\tconst cell = this.grid.getCellHeight(true)\n\t\t\tconst item = el.querySelector('.grid-stack-item-content')\n\t\t\tconst child = item && item.firstElementChild\n\t\t\tif (!el.clientHeight || !cell || !child || !Number.isFinite(node.h)) {\n\t\t\t\treturn null\n\t\t\t}\n\t\t\tconst padding = el.clientHeight - item.clientHeight\n\t\t\tconst itemHeight = node.h * cell - padding\n\t\t\tconst wanted = child.getBoundingClientRect().height || itemHeight\n\t\t\tlet rows = Math.ceil((node.h * cell + wanted - itemHeight) / cell)\n\t\t\tif (Number.isInteger(node.sizeToContent) && rows > node.sizeToContent) {\n\t\t\t\trows = node.sizeToContent\n\t\t\t}\n\t\t\tif (node.minH && rows < node.minH) {\n\t\t\t\trows = node.minH\n\t\t\t} else if (node.maxH && rows > node.maxH) {\n\t\t\t\trows = node.maxH\n\t\t\t}\n\t\t\treturn rows\n\t\t},\n\n\t\t/**\n\t\t * Keep both editing lanes in step with whether an edit could actually be\n\t\t * kept: the pointer's handles, and — through `reflowed` feeding\n\t\t * `keyboardActive` — the tab stops, the help text and the arrow keys.\n\t\t *\n\t\t * A reflowed grid drops every `change` it receives, for the reason\n\t\t * `handleGridChange` gives. Leaving either lane live there offers an edit\n\t\t * that silently snaps back, which is the same class of surprise as\n\t\t * persisting the reflow — pointed the other way, and harder to explain\n\t\t * because the author did everything right. It is worse on the keyboard,\n\t\t * where the move is also announced as done. The affordance has to say what\n\t\t * the grid will do at this width, not what edit mode does at the authored\n\t\t * one.\n\t\t *\n\t\t * @return {void}\n\t\t */\n\t\tsyncInteractivity() {\n\t\t\t// Ahead of the engine guard: the keyboard lane reads this whether or\n\t\t\t// not the engine can be enabled.\n\t\t\tthis.reflowed = this.isReflowed()\n\t\t\tif (!this.grid || typeof this.grid.enable !== 'function') {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif (this.editable && !this.reflowed) {\n\t\t\t\tthis.grid.enable()\n\t\t\t} else {\n\t\t\t\tthis.grid.disable()\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Whether the grid is currently rescaled to a column count other than the\n\t\t * authored one, i.e. a `columnOpts` breakpoint is in force.\n\t\t *\n\t\t * The authored count is `columnOpts.columnMax` when there is one, not the\n\t\t * `columns` prop: GridStack widens to `columnMax` above the top breakpoint,\n\t\t * so a consumer whose two disagree is at its widest, not reflowed.\n\t\t *\n\t\t * @return {boolean} True while a responsive reflow is active.\n\t\t */\n\t\tisReflowed() {\n\t\t\tif (!this.grid || typeof this.grid.getColumn !== 'function') {\n\t\t\t\treturn false\n\t\t\t}\n\t\t\tconst authored = Number.isFinite(this.columnOpts?.columnMax) ? this.columnOpts.columnMax : this.columns\n\t\t\tconst live = this.grid.getColumn()\n\t\t\treturn Number.isFinite(live) && live > 0 && live !== authored\n\t\t},\n\n\t\thandleGridChange(items) {\n\t\t\t// The rescale that crossed a breakpoint arrives here as a `change`, so\n\t\t\t// this is also where the handles are re-judged in both directions:\n\t\t\t// switched off as the grid narrows, and back on as it widens.\n\t\t\tthis.syncInteractivity()\n\n\t\t\tif (this.applyingLayout) {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// GridStack fires `change` for its own responsive rescale too, and at a\n\t\t\t// 12 → 1 breakpoint every item reads `gridX: 0, gridWidth: 1`. Emitting\n\t\t\t// that has the host persist the reflow AS the authored layout, which\n\t\t\t// widening back does not undo. A move made while reflowed is the same\n\t\t\t// rescaled geometry, so it is dropped for the same reason.\n\t\t\tif (this.isReflowed()) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\t// A grid on split rows is a view-mode grid: what changes in it is\n\t\t\t// packing and size-to-content measuring, never a user's\n\t\t\t// arrangement, and it is not reported as one.\n\t\t\tif (this.rowSplit !== 1) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif (!items || items.length === 0) {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tconst updated = this.layout.map((item) => {\n\t\t\t\tconst gridItem = items.find((gi) => String(gi.id) === String(item.id))\n\t\t\t\tif (gridItem) {\n\t\t\t\t\treturn {\n\t\t\t\t\t\t...item,\n\t\t\t\t\t\tgridX: gridItem.x,\n\t\t\t\t\t\tgridY: gridItem.y,\n\t\t\t\t\t\tgridWidth: gridItem.w,\n\t\t\t\t\t\tgridHeight: gridItem.h,\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn item\n\t\t\t})\n\n\t\t\tthis.$emit('layout-change', updated)\n\t\t},\n\n\t\t/**\n\t\t * Keydown handler bound to every grid item.\n\t\t *\n\t\t * Only reacts when the grid item element itself is the event target:\n\t\t * a button, input or menu rendered inside the `#widget` slot must keep\n\t\t * its own arrow/Enter semantics, and a grid that swallowed them would\n\t\t * be a worse a11y regression than the one this handler fixes.\n\t\t *\n\t\t * @param {KeyboardEvent} event the keydown event.\n\t\t * @param {object} item the layout item the key was pressed on.\n\t\t * @return {void}\n\t\t */\n\t\tonItemKeydown(event, item) {\n\t\t\tif (!this.keyboardRepositioning) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif (event.target !== event.currentTarget) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif (event.altKey || event.ctrlKey || event.metaKey) {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tif (event.key === 'Enter' || event.key === ' ' || event.key === 'Spacebar') {\n\t\t\t\tevent.preventDefault()\n\t\t\t\tthis.activateItem(item, event.currentTarget)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// Repositioning only, and only where it can be kept — an item that\n\t\t\t// still holds focus from before a reflow keeps its Enter, but its\n\t\t\t// arrow keys stop moving something that would snap back.\n\t\t\tif (!this.keyboardActive) {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tconst handled = this.applyKey(event.key, event.shiftKey, item)\n\t\t\tif (handled) {\n\t\t\t\t// Arrows would otherwise scroll the dashboard out from under\n\t\t\t\t// the widget the user is moving.\n\t\t\t\tevent.preventDefault()\n\t\t\t\tevent.stopPropagation()\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Translate one repositioning key into a geometry change.\n\t\t *\n\t\t * @param {string} key the `KeyboardEvent.key` value.\n\t\t * @param {boolean} shift whether Shift was held (resize instead of move).\n\t\t * @param {object} item the layout item being operated on.\n\t\t * @return {boolean} `true` when the key belongs to the grid and the\n\t\t * default action must be suppressed.\n\t\t */\n\t\tapplyKey(key, shift, item) {\n\t\t\tconst rect = this.currentRect(item)\n\n\t\t\tswitch (key) {\n\t\t\t\tcase 'ArrowLeft':\n\t\t\t\t\treturn shift\n\t\t\t\t\t\t? this.applyGeometry(item, { w: rect.w - 1 }, 'resize')\n\t\t\t\t\t\t: this.applyGeometry(item, { x: rect.x - 1 }, 'move')\n\t\t\t\tcase 'ArrowRight':\n\t\t\t\t\treturn shift\n\t\t\t\t\t\t? this.applyGeometry(item, { w: rect.w + 1 }, 'resize')\n\t\t\t\t\t\t: this.applyGeometry(item, { x: rect.x + 1 }, 'move')\n\t\t\t\tcase 'ArrowUp':\n\t\t\t\t\treturn shift\n\t\t\t\t\t\t? this.applyGeometry(item, { h: rect.h - 1 }, 'resize')\n\t\t\t\t\t\t: this.applyGeometry(item, { y: rect.y - 1 }, 'move')\n\t\t\t\tcase 'ArrowDown':\n\t\t\t\t\treturn shift\n\t\t\t\t\t\t? this.applyGeometry(item, { h: rect.h + 1 }, 'resize')\n\t\t\t\t\t\t: this.applyGeometry(item, { y: rect.y + 1 }, 'move')\n\t\t\t\tcase 'Home':\n\t\t\t\t\treturn this.applyGeometry(item, { x: 0 }, 'move')\n\t\t\t\tcase 'End':\n\t\t\t\t\treturn this.applyGeometry(item, { x: this.effectiveColumns - rect.w }, 'move')\n\t\t\t\tdefault:\n\t\t\t\t\treturn false\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Read an item's live rectangle. The GridStack node is preferred over\n\t\t * the `layout` prop because a drag that has not yet round-tripped\n\t\t * through the consumer's persistence leaves the prop momentarily stale,\n\t\t * and a keyboard nudge must continue from where the widget actually is.\n\t\t *\n\t\t * @param {object} item the layout item.\n\t\t * @return {{x: number, y: number, w: number, h: number}} the rectangle\n\t\t * in grid units.\n\t\t */\n\t\tcurrentRect(item) {\n\t\t\tconst node = this.gridNode(item.id)\n\t\t\tif (node && Number.isFinite(node.x) && Number.isFinite(node.y)) {\n\t\t\t\treturn {\n\t\t\t\t\tx: node.x,\n\t\t\t\t\ty: node.y,\n\t\t\t\t\tw: Number.isFinite(node.w) ? node.w : this.minWidth,\n\t\t\t\t\th: Number.isFinite(node.h) ? node.h : this.minHeight,\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tx: Number.isFinite(item.gridX) ? item.gridX : 0,\n\t\t\t\ty: Number.isFinite(item.gridY) ? item.gridY : 0,\n\t\t\t\tw: Number.isFinite(item.gridWidth) ? item.gridWidth : this.minWidth,\n\t\t\t\th: Number.isFinite(item.gridHeight) ? item.gridHeight : this.minHeight,\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Clamp a candidate rectangle to the grid's bounds and the configured\n\t\t * minimum widget size, so a held-down arrow key parks the widget at the\n\t\t * edge instead of pushing it into negative coordinates.\n\t\t *\n\t\t * @param {{x: number, y: number, w: number, h: number}} rect the candidate.\n\t\t * @return {{x: number, y: number, w: number, h: number}} the clamped rectangle.\n\t\t */\n\t\tclampRect(rect) {\n\t\t\tconst cols = this.effectiveColumns\n\t\t\tconst w = Math.min(Math.max(rect.w, this.minWidth), cols)\n\t\t\tconst h = Math.max(rect.h, this.minHeight)\n\t\t\treturn {\n\t\t\t\tx: Math.min(Math.max(rect.x, 0), Math.max(cols - w, 0)),\n\t\t\t\ty: Math.max(rect.y, 0),\n\t\t\t\tw,\n\t\t\t\th,\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Apply a partial geometry change to an item.\n\t\t *\n\t\t * The change is pushed through `GridStack.update()` — the very call the\n\t\t * drag/resize handlers end in — so collision resolution, the `change`\n\t\t * event and therefore the `layout-change` emission and the consumer's\n\t\t * persistence are identical for keyboard and pointer. There is\n\t\t * deliberately no second, direct-to-`layout` update path.\n\t\t *\n\t\t * @param {object} item the layout item to move or resize.\n\t\t * @param {{x?: number, y?: number, w?: number, h?: number}} patch the\n\t\t * requested change, merged over the item's current rectangle.\n\t\t * @param {'move'|'resize'} kind which announcement to speak.\n\t\t * @return {boolean} `true` when the key was consumed — including when\n\t\t * the widget was already at the edge, because the arrow still belongs\n\t\t * to the grid and must not scroll the page.\n\t\t */\n\t\tapplyGeometry(item, patch, kind) {\n\t\t\tconst el = this.itemElement(item.id)\n\t\t\tif (!el || !this.grid || typeof this.grid.update !== 'function') {\n\t\t\t\treturn false\n\t\t\t}\n\n\t\t\tconst current = this.currentRect(item)\n\t\t\tconst next = this.clampRect({ ...current, ...patch })\n\n\t\t\tif (next.x === current.x && next.y === current.y\n\t\t\t\t&& next.w === current.w && next.h === current.h) {\n\t\t\t\tthis.announce(t('nextcloud-vue', '{label} cannot move further in that direction', {\n\t\t\t\t\tlabel: this.announcementLabel(item),\n\t\t\t\t}))\n\t\t\t\treturn true\n\t\t\t}\n\n\t\t\tthis.grid.update(el, next)\n\n\t\t\tthis.announce(kind === 'resize'\n\t\t\t\t? t('nextcloud-vue', '{label} resized to {width} columns by {height} rows', {\n\t\t\t\t\t\tlabel: this.announcementLabel(item),\n\t\t\t\t\t\twidth: next.w,\n\t\t\t\t\t\theight: next.h,\n\t\t\t\t\t})\n\t\t\t\t: t('nextcloud-vue', '{label} moved to column {column}, row {row}', {\n\t\t\t\t\t\tlabel: this.announcementLabel(item),\n\t\t\t\t\t\tcolumn: next.x + 1,\n\t\t\t\t\t\trow: next.y + 1,\n\t\t\t\t\t}))\n\n\t\t\treturn true\n\t\t},\n\n\t\t/**\n\t\t * The short, coordinate-free name used inside live-region sentences —\n\t\t * the full `aria-label` already carries the coordinates and repeating\n\t\t * them would make every announcement unlistenable.\n\t\t *\n\t\t * @param {object} item the layout item.\n\t\t * @return {string} the short name.\n\t\t */\n\t\tannouncementLabel(item) {\n\t\t\treturn String(item.title\n\t\t\t\t|| item.name\n\t\t\t\t|| item.label\n\t\t\t\t|| item.widgetTitle\n\t\t\t\t|| item.widgetId\n\t\t\t\t|| t('nextcloud-vue', 'Widget'))\n\t\t},\n\n\t\t/**\n\t\t * Push text into the polite live region. The region is cleared first so\n\t\t * two identical consecutive announcements (e.g. two failed nudges at the\n\t\t * grid edge) are both spoken — assistive tech ignores a re-render that\n\t\t * leaves the text unchanged.\n\t\t *\n\t\t * @param {string} text the message to announce.\n\t\t * @return {void}\n\t\t */\n\t\tannounce(text) {\n\t\t\tthis.announcement = ''\n\t\t\tthis.$nextTick(() => {\n\t\t\t\tthis.announcement = text\n\t\t\t})\n\t\t},\n\n\t\t/**\n\t\t * Handle `Enter` / `Space` on a focused grid item: tell the consumer via\n\t\t * `item-activate`, and — unless opted out — synthesise the `contextmenu`\n\t\t * event a right-click would have produced, anchored to the item, so\n\t\t * pointer-only widget menus become keyboard-reachable without the\n\t\t * consumer wiring anything new. The synthetic event is dispatched from\n\t\t * inside the item's content so it bubbles through the slot's own root\n\t\t * element (where such handlers live) and on up.\n\t\t *\n\t\t * @param {object} item the layout item being activated.\n\t\t * @param {HTMLElement} el the grid item element.\n\t\t * @return {void}\n\t\t */\n\t\tactivateItem(item, el) {\n\t\t\tconst rect = typeof el.getBoundingClientRect === 'function'\n\t\t\t\t? el.getBoundingClientRect()\n\t\t\t\t: { left: 0, top: 0 }\n\t\t\tconst clientX = Math.round((rect.left || 0) + MENU_ANCHOR_OFFSET)\n\t\t\tconst clientY = Math.round((rect.top || 0) + MENU_ANCHOR_OFFSET)\n\n\t\t\tthis.$emit('item-activate', { item, element: el, clientX, clientY })\n\n\t\t\tif (this.activateOpensContextMenu) {\n\t\t\t\tthis.dispatchContextMenu(el, clientX, clientY)\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Dispatch a bubbling, cancelable `contextmenu` MouseEvent from inside a\n\t\t * grid item.\n\t\t *\n\t\t * @param {HTMLElement} el the grid item element.\n\t\t * @param {number} clientX viewport x for the menu anchor.\n\t\t * @param {number} clientY viewport y for the menu anchor.\n\t\t * @return {void}\n\t\t */\n\t\tdispatchContextMenu(el, clientX, clientY) {\n\t\t\tif (typeof MouseEvent !== 'function') {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst content = el.querySelector('.grid-stack-item-content')\n\t\t\tconst target = (content && content.firstElementChild) || content || el\n\t\t\ttarget.dispatchEvent(new MouseEvent('contextmenu', {\n\t\t\t\tbubbles: true,\n\t\t\t\tcancelable: true,\n\t\t\t\tclientX,\n\t\t\t\tclientY,\n\t\t\t\tbutton: 2,\n\t\t\t}))\n\t\t},\n\n\t\t/**\n\t\t * Look up a grid item's DOM element by its layout id.\n\t\t *\n\t\t * @param {string|number} id the layout item id.\n\t\t * @return {HTMLElement|null} the element, or `null` when not rendered.\n\t\t */\n\t\titemElement(id) {\n\t\t\tconst container = this.$refs.gridContainer\n\t\t\tif (!container) {\n\t\t\t\treturn null\n\t\t\t}\n\t\t\treturn container.querySelector(`[gs-id=\"${id}\"]`)\n\t\t},\n\n\t\t/**\n\t\t * Look up the GridStack engine node backing a layout item.\n\t\t *\n\t\t * @param {string|number} id the layout item id.\n\t\t * @return {object|null} the node, or `null` when GridStack isn't tracking it.\n\t\t */\n\t\t/**\n\t\t * Re-measure a `sizeToContent` item when its content changes height.\n\t\t * GridStack watches only the grid element, so a widget that loaded its data\n\t\t * in `mounted()` keeps the height its empty state had.\n\t\t *\n\t\t * @return {void}\n\t\t */\n\t\tobserveContentSizes() {\n\t\t\tthis.disconnectContentObserver()\n\t\t\tif (typeof ResizeObserver === 'undefined' || !this.$refs.gridContainer) {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tthis.contentObserver = new ResizeObserver((entries) => {\n\t\t\t\tconst cells = new Set()\n\t\t\t\tfor (const entry of entries) {\n\t\t\t\t\tconst cell = entry.target.closest('.grid-stack-item')\n\t\t\t\t\tif (cell) {\n\t\t\t\t\t\tcells.add(cell)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (cells.size === 0) {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\t// A frame later, not inline: `resizeToContent` resizes the cell the\n\t\t\t\t// observed child sits in, and a child that stretches to its parent\n\t\t\t\t// grows with it. Resizing from inside the callback makes that the\n\t\t\t\t// classic ResizeObserver loop (\"undelivered notifications\"); deferred,\n\t\t\t\t// it is an ordinary second pass that settles.\n\t\t\t\trequestAnimationFrame(() => {\n\t\t\t\t\tif (!this.contentObserver || !this.grid || typeof this.grid.resizeToContent !== 'function') {\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\t\tfor (const cell of cells) {\n\t\t\t\t\t\tthis.grid.resizeToContent(cell)\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t})\n\n\t\t\tconst cells = this.$refs.gridContainer.querySelectorAll('.grid-stack-item[gs-size-to-content]')\n\t\t\tfor (const cell of cells) {\n\t\t\t\tconst measured = cell.querySelector('.grid-stack-item-content')?.firstElementChild\n\t\t\t\tif (measured) {\n\t\t\t\t\tthis.contentObserver.observe(measured)\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Drop the content observer, on unmount or before rebuilding it.\n\t\t *\n\t\t * @return {void}\n\t\t */\n\t\tdisconnectContentObserver() {\n\t\t\tif (this.contentObserver) {\n\t\t\t\tthis.contentObserver.disconnect()\n\t\t\t\tthis.contentObserver = null\n\t\t\t}\n\t\t},\n\n\t\tgridNode(id) {\n\t\t\tconst nodes = this.grid && this.grid.engine && this.grid.engine.nodes\n\t\t\tif (!Array.isArray(nodes)) {\n\t\t\t\treturn null\n\t\t\t}\n\t\t\treturn nodes.find((n) => String(n.id) === String(id)) || null\n\t\t},\n\n\t\t/**\n\t\t * Make the cards a layout change brings in GridStack widgets, in the\n\t\t * order given (row order), and size the size-to-content ones only once\n\t\t * all are placed, in the same order. GridStack sizes such a cell the\n\t\t * moment it is added, and a card added after it onto a cell that has\n\t\t * grown pushes that cell below itself: the in-call tile row on\n\t\t * PqWerkplekKlant ended under every column card.\n\t\t *\n\t\t * @spec openspec/changes/dashboard-layout-swap-keeps-order/specs/dashboard-grid/spec.md#requirement-cards-a-layout-change-adds-keep-their-authored-order\n\t\t * @param {Array<HTMLElement>} els The new cells, top to bottom.\n\t\t * @return {void}\n\t\t */\n\t\taddWidgetsInOrder(els) {\n\t\t\tif (els.length === 0) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst grid = toRaw(this.grid)\n\t\t\tconst queued = []\n\t\t\tthis.pendingSizes = queued\n\t\t\ttry {\n\t\t\t\tfor (const el of els) {\n\t\t\t\t\tgrid.makeWidget(el)\n\t\t\t\t}\n\t\t\t} finally {\n\t\t\t\tthis.pendingSizes = null\n\t\t\t}\n\t\t\tfor (const el of queued) {\n\t\t\t\tgrid.resizeToContent(el)\n\t\t\t}\n\t\t},\n\n\t\tsyncGridItems(newLayout) {\n\t\t\t// Add new items, and re-adopt items whose backing DOM element was\n\t\t\t// replaced. When a consumer's `itemKey` changes for an unchanged\n\t\t\t// `id` (e.g. a style edit — the documented use of `itemKey`), Vue\n\t\t\t// swaps the element. GridStack keeps tracking the old, now-detached\n\t\t\t// element, leaving the new one unmanaged (no positioning/sizing) —\n\t\t\t// so re-register it against the new element. New items are added\n\t\t\t// together, top to bottom (`addWidgetsInOrder`).\n\t\t\tthis.$nextTick(() => {\n\t\t\t\tif (!this.grid || !this.$refs.gridContainer) {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tconst added = []\n\t\t\t\tfor (const item of this.itemsInRowOrder) {\n\t\t\t\t\tconst el = this.$refs.gridContainer.querySelector(`[gs-id=\"${item.id}\"]`)\n\t\t\t\t\tif (!el) {\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t\tconst node = this.grid.engine.nodes.find((n) => String(n.id) === String(item.id))\n\t\t\t\t\tif (!node) {\n\t\t\t\t\t\tadded.push(el)\n\t\t\t\t\t} else if (node.el === el) {\n\t\t\t\t\t\t// The layout MOVED an item the grid already tracks: the\n\t\t\t\t\t\t// page re-compacts its display layout when a widget's\n\t\t\t\t\t\t// condition hides it, and the item below was given a new\n\t\t\t\t\t\t// gridY that never reached GridStack, so a band stayed\n\t\t\t\t\t\t// where the hidden widget had been. A drag reports the\n\t\t\t\t\t\t// grid's own position back, which matches and does\n\t\t\t\t\t\t// nothing here.\n\t\t\t\t\t\tconst x = item.gridX ?? node.x\n\t\t\t\t\t\tconst y = Number.isFinite(item.gridY) ? item.gridY * this.rowSplit : node.y\n\t\t\t\t\t\tif (x !== node.x || y !== node.y) {\n\t\t\t\t\t\t\t// The layout said where it goes; GridStack's `change`\n\t\t\t\t\t\t\t// for it is not a user's arrangement and is not\n\t\t\t\t\t\t\t// reported back (it would write the display-only\n\t\t\t\t\t\t\t// compaction into the authored layout).\n\t\t\t\t\t\t\tthis.applyingLayout = true\n\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\tthis.grid.update(el, { x, y })\n\t\t\t\t\t\t\t} finally {\n\t\t\t\t\t\t\t\tthis.applyingLayout = false\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// Drop the stale node without touching its detached DOM,\n\t\t\t\t\t\t// then adopt the new element so GridStack sizes/places it.\n\t\t\t\t\t\tthis.grid.removeWidget(node.el, false, false)\n\t\t\t\t\t\tthis.grid.makeWidget(el)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tthis.addWidgetsInOrder(added)\n\t\t\t})\n\n\t\t\t// Remove items no longer in layout\n\t\t\tconst ids = newLayout.map((i) => String(i.id))\n\t\t\tconst toRemove = this.grid.engine.nodes.filter((n) => !ids.includes(String(n.id)))\n\t\t\tfor (const node of toRemove) {\n\t\t\t\tconst el = this.$refs.gridContainer.querySelector(`[gs-id=\"${node.id}\"]`)\n\t\t\t\tif (el) {\n\t\t\t\t\tthis.grid.removeWidget(el, false)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Elements were added or replaced, so the observer's are stale.\n\t\t\tthis.$nextTick(() => this.observeContentSizes())\n\t\t},\n\t},\n}\n</script>\n\n<style scoped>\n.cn-dashboard-grid {\n\twidth: 100%;\n\tmin-height: 200px;\n}\n\n.grid-stack {\n\tbackground: transparent;\n}\n\n/* `fillHeight`: the layout rows divide the grid's height (CSS grid instead of\n GridStack's absolute rows). GridStack may have left its inline places on the\n items, hence !important. Each cell scrolls what does not fit in it. */\n.cn-dashboard-grid--fill {\n\theight: 100%;\n\tmin-height: 0;\n}\n\n.cn-dashboard-grid--fill > .grid-stack {\n\tdisplay: grid;\n\theight: 100% !important;\n\tmin-height: 0 !important;\n}\n\n.cn-dashboard-grid--fill > .grid-stack > .grid-stack-item {\n\tposition: relative !important;\n\tinset: auto !important;\n\twidth: auto !important;\n\theight: auto !important;\n\tmin-width: 0;\n\tmin-height: 0;\n\tbox-sizing: border-box;\n\tpadding: var(--cn-fill-margin, 0);\n}\n\n.cn-dashboard-grid--fill > .grid-stack > .grid-stack-item > .grid-stack-item-content {\n\tposition: relative !important;\n\tinset: auto !important;\n\theight: 100%;\n\toverflow: hidden auto;\n}\n\n/* `sideColumn`: an item on a track has its left edge and width follow its\n column on two scales, the columns before `--cn-side-from` sharing what the side column\n leaves, the columns after it sharing the side column's fixed width (the\n card plus its two item margins). GridStack writes `--gs-x` and `--gs-w` on\n every item and its own left and width inline, hence !important. */\n.cn-dashboard-grid--side-column > .grid-stack.gs-12:not(.grid-stack-rtl) > .grid-stack-item[data-cn-track] {\n\t--cn-side-cell: calc(var(--cn-side-width) + var(--gs-item-margin-left, 0px) + var(--gs-item-margin-right, 0px));\n\t--cn-main-col: calc((100% - var(--cn-side-cell)) / var(--cn-side-from));\n\t--cn-side-col: calc(var(--cn-side-cell) / var(--cn-side-span));\n\t/* stylelint-disable-next-line csstools/use-logical -- GridStack places a left-to-right item by `left`. */\n\tleft: calc(min(var(--gs-x), var(--cn-side-from)) * var(--cn-main-col) + max(var(--gs-x) - var(--cn-side-from), 0) * var(--cn-side-col)) !important;\n\twidth: calc((min(var(--gs-x) + var(--gs-w), var(--cn-side-from)) - min(var(--gs-x), var(--cn-side-from))) * var(--cn-main-col) + (max(var(--gs-x) + var(--gs-w) - var(--cn-side-from), 0) - max(var(--gs-x) - var(--cn-side-from), 0)) * var(--cn-side-col)) !important;\n}\n\n/* `columnWeights`: an item's left edge and width follow the weighted columns\n it spans, as fractions of the grid. GridStack writes its own left and width\n inline, hence !important. */\n.cn-dashboard-grid--weighted > .grid-stack.gs-12:not(.grid-stack-rtl) > .grid-stack-item[data-cn-weighted] {\n\t/* stylelint-disable-next-line csstools/use-logical -- GridStack places a left-to-right item by `left`. */\n\tleft: calc(var(--cn-weight-left) * 100%) !important;\n\twidth: calc(var(--cn-weight-width) * 100%) !important;\n}\n\n/* Screen-reader-only text: the keyboard key map and the live region. Kept in\n the layout (not `display: none`) so assistive tech still reads it. */\n.cn-dashboard-grid__sr-only {\n\tposition: absolute;\n\twidth: 1px;\n\theight: 1px;\n\tpadding: 0;\n\tmargin: -1px;\n\toverflow: hidden;\n\tclip-path: inset(50%);\n\twhite-space: nowrap;\n\tborder: 0;\n}\n\n/* Grid items become tab stops in edit mode — give them a visible focus ring\n that satisfies WCAG 2.1 SC 2.4.7 without relying on the widget's own\n styling. `outline-offset` keeps the ring outside the rounded card. */\n.grid-stack-item:focus-visible {\n\toutline: 2px solid var(--color-primary-element, #0082c9);\n\toutline-offset: 2px;\n\tborder-radius: var(--border-radius-container-large, 16px);\n}\n\n/* A stretched `sameHeight` card keeps its content at the top, as the boards\n draw a row of cards, not centred in the extra height. `.grid-stack-item`\n outranks the dashboard page's centring of a fitted card, which is as\n strong and loads later (DqProcesanalyse stat tiles).\n @spec openspec/changes/same-height-fit-card-content-top/specs/dashboard-grid/spec.md#requirement-a-stretched-fitted-card-keeps-its-content-at-the-top */\n.cn-dashboard-grid__item--same-height.grid-stack-item > :deep(.grid-stack-item-content > * > .cn-widget-wrapper__content) {\n\tjustify-content: flex-start;\n}\n\n/* A size-to-content cell (`sizeToContent`) is measured by GridStack from the\n content's first child, and a widget wrapper there filled the cell\n (`height: 100%`), so the measure returned the cell's own height and the\n cell never shrank: \"Waiting for me\" stayed a tall card around one row. In\n such a cell the child takes its own height. A cell without the key keeps\n the filling child. */\n.cn-dashboard-grid__item--fit > :deep(.grid-stack-item-content > *) {\n\theight: auto;\n}\n\n:deep(.grid-stack-item-content) {\n\tbackground: var(--color-main-background);\n\tborder: none;\n\tbox-shadow: none;\n\toverflow: hidden;\n}\n\n:deep(.grid-stack-item-content:has(.cn-widget-wrapper--borderless)) {\n\tbackground: transparent;\n}\n\n:deep(.grid-stack-placeholder > .placeholder-content) {\n\tbackground: var(--color-primary-element-light);\n\tborder: 2px dashed var(--color-primary-element);\n\tborder-radius: var(--border-radius-large);\n}\n</style>\n"],"names":["_createElementBlock","_createElementVNode","_Fragment","_renderList","_normalizeClass","_normalizeStyle","_renderSlot"],"mappings":";;;;AAoEG,MAAA,UAAA,GAAA,EAAA,KAAA,EAAA,yBAAA;;;;;;;;;uBAzCAA,kBAAA;AAAG,IAAA,GAAG,EAAC,eAAe;AACtB,IAAA,KAAI,kBAAC,mBAAgB,EAAA,EAAA,gCAAA,EACnB,wBAAA,KAAA,IAAA,EAAA,6BAAA,EAAA,QAAA,CAAA,YAAA,sCAAA,QAAA,CAAA,OAAA,EAAA,CAAA,CAAA;;;KASI,QAAA,CAAA,cAAc;yCAIjB,GAAA,EAAA;;AAHF,UAAA,EAAE,EAAE,QAAA,CAAA,iBAAiB;eACjB,EAAC;2BACH,QAAA,CAAA,gBAAa,CAAA,EAAA,CAAA,oBAAA,UAAA,CAAA;;IAGfC,kBAAA,CA8BC,KAAA,EAAA;AA9BE,MAAA,KAAK,EAAC,YAAY;AAAA,MAAA,KAAA,iBAAA,QAAA,CAAA,aAAA;;wBACrBD,kBAAA,CA4BKE,QAAA,EAAA,IAAA,EAAAC,UAAA,CA3BU,QAAA,CAAA,eAAI,EAAA,CAAZ,IAAI,KAAA;6BADXH,kBAAA,CA4BK,KAAA,EAAA;UA1BJ,GAAG,EAAE,QAAA,CAAA,cAAc,CAAC,IAAG,CAAA;UACxB,KAAK,EAAAI,cAAA,CAAA,CAAC,iBAAiB,EAAA,EAAA,8BAAA,EACmB,QAAA,CAAA,iBAAiB,CAAC,IAAG,CAAA,KAAO,SAAS,EAAA,sCAAA,EAAQ,QAAA,CAAA,eAAA,CAAA,IAAA,CAAA,EAAA,CAAA,CAAA;AACvF,UAAA,IAAI,EAAC,OAAO;UACX,YAAU,EAAE,yBAAgB,CAAC,IAAI,EAAC,MAAA,CAAA,MAAO,CAAC,OAAG,CAAA,IAAA,CAAA,CAAA;AAC7C,UAAA,kBAAgB,EAAE,QAAA,CAAA,eAAc;AAChC,UAAA,QAAQ,EAAE,QAAA,CAAA,YAAY;UACtB,OAAK,EAAE,IAAI,CAAC,EAAE;UACd,MAAI,EAAE,IAAI,CAAC,KAAK;AAChB,UAAA,MAAI,EAAE,QAAA,CAAA,SAAS,CAAC,IAAI,CAAC,KAAK,CAAA;gBACtB,EAAE,IAAI,CAAC,SAAS;AACpB,UAAA,MAAI,EAAE,QAAA,CAAA,SAAA,CAAA,IAAA,CAAA,UAAA,CAAA;AACN,UAAA,UAAI,EAAA,MAAA,CAAA,QAAA;UACJ,UAAG,EAAA,QAAA,CAAA,OAAA,CAAA,IAAA,CAAA;UACH,oBAAE,EAAA,QAAA,CAAA,iBAAA,CAAA,IAAA,CAAA;;AAEF,UAAA,kBAAA,EAAA,QAAA,CAAA,WAAA,CAAA,IAAA,SAAA,SAAA;AACA,UAAA,mBAAiB,EAAE,IAAI,CAAC,QAAQ,IAAI,SAAS;AAC7C,UAAA,WAAS,EAAC,IAAK,CAAC,KAAK,KAAA,IAAA,IAAA,CAAc,MAAA,CAAA,QAAQ,YAAY,SAAI;UAC3D,KAAK,EAAAC,cAAA,CAAE,QAAA,CAAA,SAAS,KAAK,CAAA,CAAA;AACtB,UAAA,SAAA,EAAA,MAAA,KAAA,QAAA,CAAA,aAAA,CAAA,MAAA,EAAA,IAAA,CAAA;;AACD,UAAAJ,kBAAA,CAIO,OAJP,UAIO,EAAA;YAHLK,UAAA,CAEO,IAAA,CAAA,MAAA,EAAA,QAAA,EAAA,EAFc,IAAI,EAAE,IAAI,EAAA;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"CnDashboardGrid3.vue.js","sources":["../../../../src/components/CnDashboardGrid/CnDashboardGrid.vue?vue&type=template&id=2a81b4c1&lang.js"],"sourcesContent":["<!--\n CnDashboardGrid — GridStack-powered drag-and-drop dashboard grid.\n\n Renders widgets in a configurable grid layout. Supports drag, resize,\n and dynamic item addition/removal. Emits layout changes for persistence.\n\n Accessibility: every grid item is an ARIA `group` with an accessible name\n and — in edit mode — a tab stop, so the pointer-only GridStack drag/resize\n gestures have a full keyboard equivalent (WCAG 2.1 SC 2.1.1). Keyboard\n moves are routed through `GridStack.update()`, i.e. the exact same engine\n call drag/resize ends in, so collision handling, persistence and the\n `layout-change` emission are byte-identical between the two input modes.\n-->\n<template>\n\t<div ref=\"gridContainer\"\n\t\tclass=\"cn-dashboard-grid\"\n\t\t:class=\"{ 'cn-dashboard-grid--side-column': sideColumnStyle !== null, 'cn-dashboard-grid--weighted': columnBounds !== null, 'cn-dashboard-grid--fill': filling }\"\n\t\t:style=\"sideColumnStyle\">\n\t\t<!--\n\t\t\tKeyboard instructions, referenced by every grid item through\n\t\t\t`aria-describedby`. Rendered once (not per item) so a screen\n\t\t\treader user hears the key map on the first item they land on\n\t\t\twithout it being duplicated N times in the accessibility tree.\n\t\t-->\n\t\t<p\n\t\t\tv-if=\"keyboardActive\"\n\t\t\t:id=\"keyboardHelpDomId\"\n\t\t\tclass=\"cn-dashboard-grid__sr-only\">\n\t\t\t{{ keyboardHelpText }}\n\t\t</p>\n\n\t\t<div class=\"grid-stack\" :style=\"fillGridStyle\">\n\t\t\t<div\n\t\t\t\tv-for=\"item in itemsInRowOrder\"\n\t\t\t\t:key=\"resolveItemKey(item)\"\n\t\t\t\tclass=\"grid-stack-item\"\n\t\t\t\t:class=\"{ 'cn-dashboard-grid__item--fit': sizeToContentAttr(item) !== undefined, 'cn-dashboard-grid__item--same-height': sharesRowHeight(item) }\"\n\t\t\t\trole=\"group\"\n\t\t\t\t:aria-label=\"resolveItemLabel(item, layout.indexOf(item))\"\n\t\t\t\t:aria-describedby=\"itemDescribedBy\"\n\t\t\t\t:tabindex=\"itemTabindex\"\n\t\t\t\t:gs-id=\"item.id\"\n\t\t\t\t:gs-x=\"item.gridX\"\n\t\t\t\t:gs-y=\"scaledRow(item.gridY)\"\n\t\t\t\t:gs-w=\"item.gridWidth\"\n\t\t\t\t:gs-h=\"scaledRow(item.gridHeight)\"\n\t\t\t\t:gs-min-w=\"minWidth\"\n\t\t\t\t:gs-min-h=\"minRows(item)\"\n\t\t\t\t:gs-size-to-content=\"sizeToContentAttr(item)\"\n\t\t\t\t:data-cn-track=\"item.track === 'main' || item.track === 'side' ? item.track : undefined\"\n\t\t\t\t:data-cn-weighted=\"weightStyle(item) ? '' : undefined\"\n\t\t\t\t:data-cn-widget-id=\"item.widgetId || undefined\"\n\t\t\t\t:gs-locked=\"item.clear === true && !editable ? 'true' : undefined\"\n\t\t\t\t:style=\"itemStyle(item)\"\n\t\t\t\t@keydown=\"onItemKeydown($event, item)\">\n\t\t\t\t<div class=\"grid-stack-item-content\">\n\t\t\t\t\t<slot name=\"widget\" :item=\"item\">\n\t\t\t\t\t\t<!-- Default: render nothing; CnDashboardPage provides content -->\n\t\t\t\t\t</slot>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</div>\n\n\t\t<!--\n\t\t\tPolite live region for keyboard move/resize feedback. A sighted\n\t\t\tuser sees the widget slide; a screen-reader user needs the new\n\t\t\tcoordinates spoken, otherwise the arrow keys are silent.\n\t\t-->\n\t\t<p\n\t\t\tclass=\"cn-dashboard-grid__sr-only\"\n\t\t\trole=\"status\"\n\t\t\taria-live=\"polite\"\n\t\t\taria-atomic=\"true\">\n\t\t\t{{ announcement }}\n\t\t</p>\n\t</div>\n</template>\n\n<script>\nimport { translate as t } from '@nextcloud/l10n'\nimport { GridStack } from 'gridstack'\nimport { toRaw } from 'vue'\nimport { planClearRows, planGrowth, planSameHeights } from '../../utils/gridStack.js'\n// `gridstack` is a peerDependency (see package.json), not bundled — this\n// component's JS and the consumer's GridStack stylesheet MUST come from the\n// exact same installed copy, because GridStack's JS writes layout state\n// (e.g. the `--gs-column-width` CSS custom property) that only its OWN\n// matching CSS reads. Baking a copy of `gridstack/dist/gridstack.min.css`\n// into this library's build (as a previous version did) freezes it at\n// nc-vue's build-time version, which can silently drift from whatever the\n// consumer's peer-installed copy actually is — the exact mismatch that once\n// made every grid item render at 0px width. So nc-vue ships NO GridStack\n// CSS of its own: the consumer MUST install `gridstack` themselves and\n// import `gridstack/dist/gridstack.min.css` (or their preferred GridStack\n// stylesheet) from that same copy.\n\n/**\n * Monotonic counter backing the per-instance DOM ids (the shared\n * `aria-describedby` help text). Module-level so two grids on one page\n * never collide — the same pattern CnCommandPalette uses.\n */\nlet domIdCounter = 0\n\n/**\n * Pixel offset applied to the grid item's top-left corner when synthesising\n * the `contextmenu` coordinates for a keyboard activation. Nudging the anchor\n * inside the item keeps consumer menus (which position at `clientX/clientY`)\n * visually attached to the widget instead of straddling its border.\n */\nconst MENU_ANCHOR_OFFSET = 8\n\n/**\n * How many GridStack rows a layout row is drawn as on a grid with\n * size-to-content cells (`wantsRowSplit`): 80px rows become 1px rows, so a\n * cell sized to its content ends less than 1px under it. On 4px rows each\n * stacked card could end up to 4px low, and the rounding added up down a\n * column (r33 DqHandhaving \"De overtreding\" y +6).\n *\n * @spec openspec/changes/fit-cells-on-4px-rows/specs/fit-cells-on-4px-rows/spec.md#requirement-a-size-to-content-cell-ends-within-4px-of-its-content\n */\nconst ROW_SPLIT = 80\n\n/**\n * Whether a layout holds a size-to-content cell (`sizeToContent` true or a\n * positive row maximum).\n *\n * @param {Array<object>} layout The layout items.\n * @return {boolean} True when one does.\n */\nfunction hasFitCell(layout) {\n\treturn Array.isArray(layout) && layout.some((item) => item\n\t\t&& (item.sizeToContent === true || (Number.isFinite(item.sizeToContent) && item.sizeToContent > 0)))\n}\n\n/**\n * The row tracks of a grid that fills its height (`fillHeight`): `auto` for\n * a row whose items all set `fitRows`, or that no item covers, and an equal\n * share of the free height (`minmax(0, 1fr)`) for every other row.\n *\n * @spec openspec/changes/lpvandaag-start-page/specs/lpvandaag-start-page/spec.md#requirement-a-dashboard-can-fill-the-height-below-the-top-bar\n * @param {Array<object>} layout The layout items.\n * @return {string[]} One track per layout row.\n */\nexport function fillRowTracks(layout) {\n\tconst items = Array.isArray(layout) ? layout.filter(Boolean) : []\n\tconst top = (item) => (Number.isFinite(item.gridY) ? item.gridY : 0)\n\tconst height = (item) => (Number.isFinite(item.gridHeight) ? item.gridHeight : 1)\n\tconst rows = items.reduce((max, item) => Math.max(max, top(item) + height(item)), 0)\n\tconst tracks = []\n\tfor (let row = 0; row < rows; row++) {\n\t\tconst covering = items.filter((item) => row >= top(item) && row < top(item) + height(item))\n\t\tconst fits = covering.every((item) => item.fitRows === true)\n\t\ttracks.push(fits ? 'auto' : 'minmax(0, 1fr)')\n\t}\n\treturn tracks\n}\n\n/**\n * CnDashboardGrid — Low-level grid layout engine powered by GridStack.\n *\n * Manages the drag-and-drop grid, syncs positions, and emits layout\n * changes. Does NOT handle widget rendering — that's done by the parent\n * via the `#widget` scoped slot.\n *\n * ```vue\n * <CnDashboardGrid\n * :layout=\"placements\"\n * :editable=\"isEditing\"\n * @layout-change=\"onLayoutChange\">\n * <template #widget=\"{ item }\">\n * <MyWidget :config=\"item\" />\n * </template>\n * </CnDashboardGrid>\n * ```\n *\n * ### Keyboard operation\n *\n * With `keyboardRepositioning` on (the default) and `editable` true, each\n * grid item is a tab stop. With an item focused:\n *\n * | Key | Action |\n * | --- | ------ |\n * | `ArrowLeft` / `ArrowRight` | move one column left / right |\n * | `ArrowUp` / `ArrowDown` | move one row up / down |\n * | `Shift` + `ArrowLeft` / `ArrowRight` | shrink / grow width by one column |\n * | `Shift` + `ArrowUp` / `ArrowDown` | shrink / grow height by one row |\n * | `Home` / `End` | jump to the first / last column of the current row |\n * | `Enter` / `Space` | activate the item — see `item-activate` |\n *\n * Keys are only honoured when the grid item itself holds focus, so\n * interactive content rendered inside the `#widget` slot keeps its own\n * key handling untouched.\n */\nexport default {\n\tname: 'CnDashboardGrid',\n\n\tprops: {\n\t\t/** Array of layout items: { id, gridX, gridY, gridWidth, gridHeight, minHeight?, ...extra }. An item's `minHeight` (layout rows) replaces the grid's own for that item. */\n\t\tlayout: {\n\t\t\ttype: Array,\n\t\t\trequired: true,\n\t\t},\n\n\t\t/** Whether drag and resize are enabled */\n\t\teditable: {\n\t\t\ttype: Boolean,\n\t\t\tdefault: false,\n\t\t},\n\n\t\t/** Number of grid columns */\n\t\tcolumns: {\n\t\t\ttype: Number,\n\t\t\tdefault: 12,\n\t\t},\n\n\t\t/** Cell height in pixels */\n\t\tcellHeight: {\n\t\t\ttype: Number,\n\t\t\tdefault: 80,\n\t\t},\n\n\t\t/** Grid margin in pixels */\n\t\tmargin: {\n\t\t\ttype: Number,\n\t\t\tdefault: 12,\n\t\t},\n\n\t\t/**\n\t\t * Margin under each item in pixels, in place of `margin` on that side\n\t\t * only; null keeps `margin` on every side.\n\t\t */\n\t\tmarginBottom: {\n\t\t\ttype: Number,\n\t\t\tdefault: null,\n\t\t},\n\n\t\t/** Minimum widget width in grid units */\n\t\tminWidth: {\n\t\t\ttype: Number,\n\t\t\tdefault: 2,\n\t\t},\n\n\t\t/** Minimum widget height in grid units */\n\t\tminHeight: {\n\t\t\ttype: Number,\n\t\t\tdefault: 2,\n\t\t},\n\n\t\t/**\n\t\t * GridStack v12 responsive `columnOpts` bag (breakpoints + reflow\n\t\t * layout). When set, the grid reflows column count across screen sizes.\n\t\t * Build it with `getDashboardColumnOpts()`. Default `null` = fixed\n\t\t * `columns`, no responsive reflow (backwards-compatible).\n\t\t *\n\t\t * @type {object|null}\n\t\t */\n\t\tcolumnOpts: {\n\t\t\ttype: Object,\n\t\t\tdefault: null,\n\t\t},\n\n\t\t/**\n\t\t * When set, `cellHeight` is mirrored into this CSS custom property on\n\t\t * the document root at init (e.g. `'--app-cell-height'`), so app CSS can\n\t\t * align to the grid geometry. Default `null` = no CSS var written.\n\t\t *\n\t\t * @type {string|null}\n\t\t */\n\t\tcellHeightCssVar: {\n\t\t\ttype: String,\n\t\t\tdefault: null,\n\t\t},\n\n\t\t/**\n\t\t * Optional `(item) => string|number` to derive each item's render key.\n\t\t * Use it to force a re-render when an item changes in a way its `id`\n\t\t * doesn't capture (e.g. style edits — return `${item.id}:${item.updatedAt}`).\n\t\t * Default `null` = key on `item.id`.\n\t\t *\n\t\t * @type {((item: object) => (string|number))|null}\n\t\t */\n\t\titemKey: {\n\t\t\ttype: Function,\n\t\t\tdefault: null,\n\t\t},\n\n\t\t/**\n\t\t * Whether grid items are keyboard-operable: focusable in edit mode and\n\t\t * repositionable/resizable with the arrow keys (WCAG 2.1 SC 2.1.1 —\n\t\t * the keyboard equivalent of the pointer-only GridStack drag). Turning\n\t\t * it off leaves the items non-focusable and drag-only. Default `true`.\n\t\t */\n\t\tkeyboardRepositioning: {\n\t\t\ttype: Boolean,\n\t\t\tdefault: true,\n\t\t},\n\n\t\t/**\n\t\t * Optional `(item, index) => string` returning the accessible name for\n\t\t * a grid item. Use it when the layout items don't carry a human-readable\n\t\t * field (the built-in fallback walks `title` → `name` → `label` →\n\t\t * `widgetTitle` → `widgetId`, then a positional \"Widget N\"). The returned\n\t\t * string is used verbatim — no coordinates are appended.\n\t\t *\n\t\t * @type {((item: object, index: number) => string)|null}\n\t\t */\n\t\titemLabel: {\n\t\t\ttype: Function,\n\t\t\tdefault: null,\n\t\t},\n\n\t\t/**\n\t\t * Whether a keyboard activation (`Enter` / `Space` on a focused grid\n\t\t * item) also dispatches a bubbling `contextmenu` event from inside the\n\t\t * item, so consumers that open a per-widget menu on right-click get the\n\t\t * keyboard path for free — mirroring what browsers do for the `Menu`\n\t\t * key. Set `false` to rely purely on the `item-activate` event.\n\t\t * Default `true`.\n\t\t */\n\t\tactivateOpensContextMenu: {\n\t\t\ttype: Boolean,\n\t\t\tdefault: true,\n\t\t},\n\n\t\t/**\n\t\t * GridStack's `float`. True (the default) keeps every item on the row\n\t\t * it was placed on, with empty rows above it if need be. False packs\n\t\t * items upward, so a size-to-content cell that shrinks, or a widget\n\t\t * that is not shown, closes its gap instead of leaving a band.\n\t\t *\n\t\t * @spec openspec/changes/zuiddrecht-pixel-gaps-3/specs/zuiddrecht-pixel-gaps-3/spec.md#requirement-a-dashboard-closes-the-gap-a-shrinking-or-hidden-widget-leaves\n\t\t */\n\t\tfloat: {\n\t\t\ttype: Boolean,\n\t\t\tdefault: true,\n\t\t},\n\n\t\t/**\n\t\t * A side column of a fixed width: `{ width, from? }`. The layout items\n\t\t * that say which track they are on (`track: \"main\"` or `\"side\"`) are\n\t\t * drawn on two scales: from column `from` (8 by default) on at `width`\n\t\t * px (the card, not counting the item margins), the columns before it\n\t\t * sharing the rest, so the side cards keep their width on any screen\n\t\t * (DqMijnWerk). Items without a track keep the twelve shares, so a row\n\t\t * of four tiles stays four equal tiles. Only on the full twelve-column\n\t\t * grid and not while editing; GridStack keeps the twelve columns\n\t\t * underneath.\n\t\t *\n\t\t * @spec openspec/changes/dashboard-side-column-width/specs/dashboard-side-column-width/spec.md#requirement-a-dashboard-can-draw-its-side-column-at-a-fixed-width\n\t\t */\n\t\tsideColumn: {\n\t\t\ttype: Object,\n\t\t\tdefault: null,\n\t\t},\n\n\t\t/**\n\t\t * Weights for groups of the twelve columns: `[{ span, weight }]`, the\n\t\t * spans adding up to 12. Each group takes its weight's share of the\n\t\t * width, split evenly over its columns, so three groups of four can be\n\t\t * drawn 332 / 415 / 332 (PqWerkplekKlant in a call). Items on a\n\t\t * `sideColumn` track keep that column. Only on the full twelve-column\n\t\t * grid and not while editing; GridStack keeps the twelve columns\n\t\t * underneath.\n\t\t *\n\t\t * @spec openspec/changes/dashboard-column-weights/specs/dashboard-column-weights/spec.md#requirement-a-dashboard-can-weigh-its-column-groups\n\t\t */\n\t\tcolumnWeights: {\n\t\t\ttype: Array,\n\t\t\tdefault: null,\n\t\t},\n\n\t\t/**\n\t\t * Fill the height the host gives the grid instead of growing with\n\t\t * the content: in view mode the layout rows divide the grid's own\n\t\t * height, so the page around it does not scroll. A row whose items\n\t\t * all set `fitRows: true` takes the height of its content; every\n\t\t * other row takes an equal share of what is left. A widget that is\n\t\t * taller than its share scrolls inside its own cell. The host gives\n\t\t * the grid a definite height (a flex child with `min-height: 0`, say).\n\t\t * Edit mode, and a grid narrower than `fillMinWidth`, keep the\n\t\t * GridStack grid of `cellHeight` rows.\n\t\t *\n\t\t * @spec openspec/changes/lpvandaag-start-page/specs/lpvandaag-start-page/spec.md#requirement-a-dashboard-can-fill-the-height-below-the-top-bar\n\t\t */\n\t\tfillHeight: {\n\t\t\ttype: Boolean,\n\t\t\tdefault: false,\n\t\t},\n\n\t\t/**\n\t\t * The narrowest grid, in pixels, that `fillHeight` still fills.\n\t\t * Narrower, the cards take their `cellHeight` rows (and GridStack's\n\t\t * `columnOpts` reflow) and the page scrolls.\n\t\t *\n\t\t * @spec openspec/changes/lpvandaag-start-page/specs/lpvandaag-start-page/spec.md#requirement-a-dashboard-can-fill-the-height-below-the-top-bar\n\t\t */\n\t\tfillMinWidth: {\n\t\t\ttype: Number,\n\t\t\tdefault: 960,\n\t\t},\n\t},\n\n\temits: [\n\t\t/**\n\t\t * Fired whenever the grid geometry changed — by drag, by resize, or by\n\t\t * a keyboard nudge. Payload is the full `layout` array with the moved\n\t\t * items' `gridX`/`gridY`/`gridWidth`/`gridHeight` updated.\n\t\t */\n\t\t'layout-change',\n\t\t/**\n\t\t * Fired when the user activates a focused grid item with `Enter` or\n\t\t * `Space`. Payload `{ item, element, clientX, clientY }` — the layout\n\t\t * item, its DOM element, and viewport coordinates anchored to the\n\t\t * item's top-left corner so a consumer menu can position itself the\n\t\t * same way it does for a right-click.\n\t\t */\n\t\t'item-activate',\n\t],\n\n\tdata() {\n\t\treturn {\n\t\t\tgrid: null,\n\t\t\tcontentObserver: null,\n\t\t\t/** True while the grid moves an item to where the layout put it. */\n\t\t\tapplyingLayout: false,\n\t\t\tdomId: `cn-dashboard-grid-${++domIdCounter}`,\n\t\t\t/** Text currently held in the polite live region. */\n\t\t\tannouncement: '',\n\t\t\t/**\n\t\t\t * Whether a `columnOpts` breakpoint is currently in force. Mirrored\n\t\t\t * from the engine by `syncInteractivity` because `isReflowed()` reads\n\t\t\t * `grid.getColumn()` imperatively, and a computed cannot re-evaluate\n\t\t\t * on that.\n\t\t\t */\n\t\t\treflowed: false,\n\t\t\t/**\n\t\t\t * How many GridStack rows one layout row is drawn as: 1, or\n\t\t\t * ROW_SPLIT while `wantsRowSplit` holds. Set before the first render,\n\t\t\t * since GridStack reads the items' places from their attributes,\n\t\t\t * and again when the grid is rebuilt.\n\t\t\t */\n\t\t\trowSplit: (!this.editable && !this.float && hasFitCell(this.layout)) ? ROW_SPLIT : 1,\n\t\t\t/** The grid's width in pixels, measured for `fillHeight`. */\n\t\t\tcontainerWidth: 0,\n\t\t\tsizeObserver: null,\n\t\t}\n\t},\n\n\tcomputed: {\n\t\t/**\n\t\t * The CSS variables that draw the side column at its width, or null\n\t\t * when the grid keeps its twelve shares.\n\t\t *\n\t\t * @return {object|null}\n\t\t */\n\t\t/**\n\t\t * The left edge of each of the twelve columns and the right edge of\n\t\t * the last, as fractions of the grid's width, from `columnWeights`;\n\t\t * null when the grid keeps its twelve shares.\n\t\t *\n\t\t * @spec openspec/changes/dashboard-column-weights/specs/dashboard-column-weights/spec.md#requirement-a-dashboard-can-weigh-its-column-groups\n\t\t * @return {number[]|null}\n\t\t */\n\t\tcolumnBounds() {\n\t\t\tconst groups = this.columnWeights\n\t\t\tif (this.editable || !Array.isArray(groups) || groups.length === 0) {\n\t\t\t\treturn null\n\t\t\t}\n\t\t\tconst perColumn = []\n\t\t\tfor (const group of groups) {\n\t\t\t\tconst span = Number(group?.span)\n\t\t\t\tconst weight = Number(group?.weight)\n\t\t\t\tif (!Number.isInteger(span) || span < 1 || !Number.isFinite(weight) || weight <= 0) {\n\t\t\t\t\treturn null\n\t\t\t\t}\n\t\t\t\tfor (let i = 0; i < span; i++) {\n\t\t\t\t\tperColumn.push(weight / span)\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (perColumn.length !== 12) {\n\t\t\t\treturn null\n\t\t\t}\n\t\t\tconst total = perColumn.reduce((sum, w) => sum + w, 0)\n\t\t\tconst bounds = [0]\n\t\t\tfor (const w of perColumn) {\n\t\t\t\tbounds.push(bounds[bounds.length - 1] + w / total)\n\t\t\t}\n\t\t\treturn bounds\n\t\t},\n\n\t\tsideColumnStyle() {\n\t\t\tconst width = Number(this.sideColumn?.width)\n\t\t\tif (this.editable || !Number.isFinite(width) || width <= 0) {\n\t\t\t\treturn null\n\t\t\t}\n\t\t\tconst from = Math.floor(Number(this.sideColumn?.from ?? 8))\n\t\t\tconst split = Number.isFinite(from) && from > 0 && from < 12 ? from : 8\n\t\t\treturn {\n\t\t\t\t'--cn-side-width': `${width}px`,\n\t\t\t\t'--cn-side-from': String(split),\n\t\t\t\t'--cn-side-span': String(12 - split),\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Whether the grid fills its height now (`fillHeight`): in view mode,\n\t\t * on a grid at least `fillMinWidth` wide.\n\t\t *\n\t\t * @spec openspec/changes/lpvandaag-start-page/specs/lpvandaag-start-page/spec.md#requirement-a-dashboard-can-fill-the-height-below-the-top-bar\n\t\t * @return {boolean}\n\t\t */\n\t\tfilling() {\n\t\t\treturn this.fillHeight && !this.editable && this.containerWidth >= this.fillMinWidth\n\t\t},\n\n\t\t/**\n\t\t * The inline style of the grid element while it fills its height.\n\t\t *\n\t\t * @spec openspec/changes/lpvandaag-start-page/specs/lpvandaag-start-page/spec.md#requirement-a-dashboard-can-fill-the-height-below-the-top-bar\n\t\t * @return {object|null}\n\t\t */\n\t\tfillGridStyle() {\n\t\t\tif (!this.filling) {\n\t\t\t\treturn null\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tgridTemplateColumns: `repeat(${this.columns}, minmax(0, 1fr))`,\n\t\t\t\tgridTemplateRows: fillRowTracks(this.layout).join(' '),\n\t\t\t\t'--cn-fill-margin': `${this.margin}px`,\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * The layout's items top to bottom, then left to right: the order the\n\t\t * items are in the page, so GridStack places them in that order.\n\t\t *\n\t\t * GridStack sizes a size-to-content cell while it adds the items, one\n\t\t * at a time, and an item it adds onto a cell that has already grown\n\t\t * moves itself below whatever it then collides with. In the layout's\n\t\t * own order a card declared after the lists (pipelinq's full-width\n\t\t * \"client in focus\" card) was added last, so when the banner above\n\t\t * it grew it skipped past the stat tiles AND the lists and landed at\n\t\t * the bottom. Added top to bottom, every card lands under the one\n\t\t * above it. It is also the order a screen reader and the Tab key\n\t\t * follow. An item without a row or column sorts after the items\n\t\t * that have one, in the layout's order.\n\t\t *\n\t\t * @spec openspec/changes/dashboard-growth-keeps-order/specs/dashboard-grid/spec.md#requirement-a-growing-cell-keeps-the-order-of-the-cards-under-it\n\t\t * @return {Array<object>} The items in row order.\n\t\t */\n\t\titemsInRowOrder() {\n\t\t\tconst items = Array.isArray(this.layout) ? [...this.layout] : []\n\t\t\tconst at = (value) => (Number.isFinite(value) ? value : Number.MAX_SAFE_INTEGER)\n\t\t\treturn items.sort((a, b) => (at(a.gridY) - at(b.gridY)) || (at(a.gridX) - at(b.gridX)))\n\t\t},\n\n\t\t/**\n\t\t * Whether the grid draws each layout row as ROW_SPLIT finer rows. A\n\t\t * size-to-content cell can only be a whole number of rows tall, so on\n\t\t * 80px rows it kept up to a row of empty space under its content and\n\t\t * a packing grid (`float: false`) could not close it (pipelinq and\n\t\t * dossiq Mijn werk, decidiq Mijn acties). Split into 4px rows the\n\t\t * cell ends within 4px of its content and the widgets below move up.\n\t\t *\n\t\t * Only in view mode, only on a packing grid with a size-to-content\n\t\t * cell: every other grid is built exactly as before. Item positions\n\t\t * and sizes scale with the rows, so every widget keeps its pixel\n\t\t * place and size until a cell shrinks; the layout itself, what edit\n\t\t * mode shows and what `layout-change` reports, stays in layout rows.\n\t\t *\n\t\t * @spec openspec/changes/dashboard-fit-cells-close-up/specs/dashboard-grid/spec.md#requirement-a-size-to-content-cell-ends-at-its-content\n\t\t * @return {boolean} True to split the rows.\n\t\t */\n\t\twantsRowSplit() {\n\t\t\treturn !this.editable && !this.float && hasFitCell(this.layout)\n\t\t},\n\n\t\t/**\n\t\t * @return {boolean} Whether the keyboard lane is live — items are\n\t\t * focusable and the arrow keys reposition. Requires the opt-in prop,\n\t\t * edit mode (a read-only dashboard has nothing to move, so adding N tab\n\t\t * stops there would be pure noise), and a grid that is not reflowed,\n\t\t * which is where a move cannot be kept and so must not be offered.\n\t\t */\n\t\tkeyboardActive() {\n\t\t\treturn this.keyboardRepositioning && this.editable && !this.reflowed\n\t\t},\n\n\t\t/**\n\t\t * @return {number|null} `0` when grid items should be tab stops,\n\t\t * otherwise `null` so the attribute is omitted entirely.\n\t\t */\n\t\titemTabindex() {\n\t\t\treturn this.keyboardActive ? 0 : null\n\t\t},\n\n\t\t/**\n\t\t * @return {string} DOM id of the shared keyboard-instructions element.\n\t\t */\n\t\tkeyboardHelpDomId() {\n\t\t\treturn `${this.domId}-keyboard-help`\n\t\t},\n\n\t\t/**\n\t\t * @return {string|null} `aria-describedby` target for each grid item —\n\t\t * the instructions element while the keyboard lane is live, `null`\n\t\t * otherwise (a dangling id reference is an axe violation).\n\t\t */\n\t\titemDescribedBy() {\n\t\t\treturn this.keyboardActive ? this.keyboardHelpDomId : null\n\t\t},\n\n\t\t/**\n\t\t * @return {string} The spoken key map for the keyboard lane.\n\t\t */\n\t\tkeyboardHelpText() {\n\t\t\treturn t(\n\t\t\t\t'nextcloud-vue',\n\t\t\t\t'Use the arrow keys to move this widget one cell. Hold Shift and use the arrow keys to resize it. Press Home or End to jump to the first or last column. Press Enter to open the widget menu.',\n\t\t\t)\n\t\t},\n\n\t\t/**\n\t\t * @return {number} The column count currently in force. With responsive\n\t\t * `columnOpts` GridStack reflows to fewer columns on small screens, so\n\t\t * clamping must read the live value rather than the `columns` prop.\n\t\t */\n\t\teffectiveColumns() {\n\t\t\tif (this.grid && typeof this.grid.getColumn === 'function') {\n\t\t\t\tconst live = this.grid.getColumn()\n\t\t\t\tif (Number.isFinite(live) && live > 0) {\n\t\t\t\t\treturn live\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn this.columns\n\t\t},\n\t},\n\n\twatch: {\n\t\teditable() {\n\t\t\tthis.syncInteractivity()\n\t\t},\n\n\t\tfilling(fills) {\n\t\t\tif (fills) {\n\t\t\t\tthis.disconnectContentObserver()\n\t\t\t\tif (this.grid) {\n\t\t\t\t\tthis.grid.destroy(false)\n\t\t\t\t\tthis.grid = null\n\t\t\t\t}\n\t\t\t\treturn\n\t\t\t}\n\t\t\tthis.$nextTick(() => {\n\t\t\t\tif (this.grid || !this.$refs.gridContainer) {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tthis.applyItemAttributes()\n\t\t\t\tthis.initGrid()\n\t\t\t\tthis.observeContentSizes()\n\t\t\t})\n\t\t},\n\n\t\twantsRowSplit(wants) {\n\t\t\tif (this.grid && (wants ? ROW_SPLIT : 1) !== this.rowSplit) {\n\t\t\t\tthis.rebuildGrid()\n\t\t\t}\n\t\t},\n\n\t\tlayout: {\n\t\t\tdeep: true,\n\t\t\thandler(newLayout) {\n\t\t\t\tif (this.grid) {\n\t\t\t\t\tthis.syncGridItems(newLayout)\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t},\n\n\tmounted() {\n\t\tthis.observeContainerWidth()\n\t\tif (this.filling) {\n\t\t\treturn\n\t\t}\n\t\tthis.initGrid()\n\t\tthis.$nextTick(() => this.observeContentSizes())\n\t},\n\n\tbeforeUnmount() {\n\t\tif (this.sizeObserver) {\n\t\t\tthis.sizeObserver.disconnect()\n\t\t\tthis.sizeObserver = null\n\t\t}\n\t\tthis.disconnectContentObserver()\n\t\tif (this.grid) {\n\t\t\tthis.grid.destroy(false)\n\t\t}\n\t},\n\n\tmethods: {\n\t\t/**\n\t\t * Derive the v-for render key for a layout item, honouring the optional\n\t\t * `itemKey` prop and falling back to `item.id`.\n\t\t *\n\t\t * @param {object} item the layout item.\n\t\t * @return {string|number} the render key.\n\t\t */\n\t\tresolveItemKey(item) {\n\t\t\treturn this.itemKey ? this.itemKey(item) : item.id\n\t\t},\n\n\t\t/**\n\t\t * The `gs-size-to-content` attribute for a layout item, or `undefined` to\n\t\t * leave the item on its authored `gridHeight`.\n\t\t *\n\t\t * A widget that decides AT RUNTIME it has nothing to show — a banner whose\n\t\t * condition is false, a list that came back empty — still costs its whole\n\t\t * authored row, because the row is reserved from the layout before the\n\t\t * component renders and the engine positions items absolutely, so no CSS\n\t\t * can reclaim it. `sizeToContent` hands the row's height to the content, so\n\t\t * an empty widget collapses and the grid closes up behind it.\n\t\t *\n\t\t * Opt-in per item: it makes `gridHeight` advisory for that widget, which is\n\t\t * wrong for anything with a deliberate size (a map, a chart) and right for\n\t\t * anything whose height is whatever it turned out to have.\n\t\t *\n\t\t * @param {object} item the layout item.\n\t\t * @return {string|undefined} `'true'`, a row maximum as a string, or undefined.\n\t\t */\n\t\tsizeToContentAttr(item) {\n\t\t\tconst v = item && item.sizeToContent\n\t\t\tif (v === true) {\n\t\t\t\treturn 'true'\n\t\t\t}\n\t\t\t// A number is GridStack's \"size to content, but never taller than N rows\" (a maximum).\n\t\t\tif (Number.isFinite(v) && v > 0) {\n\t\t\t\treturn String(v * this.rowSplit)\n\t\t\t}\n\t\t\treturn undefined\n\t\t},\n\n\t\t/**\n\t\t * A layout row coordinate or height in GridStack rows (`rowSplit`).\n\t\t *\n\t\t * @spec openspec/changes/dashboard-fit-cells-close-up/specs/dashboard-grid/spec.md#requirement-a-size-to-content-cell-ends-at-its-content\n\t\t * @param {number|undefined} value The value in layout rows.\n\t\t * @return {number|undefined} The value in grid rows, or undefined when none is set.\n\t\t */\n\t\tscaledRow(value) {\n\t\t\treturn Number.isFinite(value) ? value * this.rowSplit : undefined\n\t\t},\n\n\t\t/**\n\t\t * The smallest height an item may take, in layout rows: the item's own\n\t\t * `minHeight` (a divider may be one row), else the grid's.\n\t\t *\n\t\t * @param {object} item The layout item.\n\t\t * @return {number} The minimum height in layout rows.\n\t\t */\n\t\titemMinHeight(item) {\n\t\t\tconst own = item && item.minHeight\n\t\t\treturn Number.isFinite(own) && own >= 1 ? Math.floor(own) : this.minHeight\n\t\t},\n\n\t\t/**\n\t\t * The smallest height an item may take, in grid rows: its minimum\n\t\t * height in layout rows, except for a size-to-content cell on split rows, which\n\t\t * may shrink to its content down to one grid row. The minimum is for\n\t\t * resizing by hand, and that only happens on whole rows in edit mode.\n\t\t *\n\t\t * @spec openspec/changes/dashboard-fit-cells-close-up/specs/dashboard-grid/spec.md#requirement-a-size-to-content-cell-ends-at-its-content\n\t\t * @param {object} item The layout item.\n\t\t * @return {number} The minimum height in grid rows.\n\t\t */\n\t\tminRows(item) {\n\t\t\tif (this.rowSplit !== 1 && this.sizeToContentAttr(item) !== undefined) {\n\t\t\t\treturn 1\n\t\t\t}\n\t\t\treturn this.itemMinHeight(item) * this.rowSplit\n\t\t},\n\n\t\t/**\n\t\t * Build the grid again with the row split `wantsRowSplit` asks for, as\n\t\t * edit mode turns on or off: the items go back to their layout places in\n\t\t * the new rows, and the size-to-content cells are measured again.\n\t\t *\n\t\t * @spec openspec/changes/dashboard-fit-cells-close-up/specs/dashboard-grid/spec.md#requirement-a-size-to-content-cell-ends-at-its-content\n\t\t * @return {void}\n\t\t */\n\t\trebuildGrid() {\n\t\t\tthis.disconnectContentObserver()\n\t\t\tthis.grid.destroy(false)\n\t\t\tthis.grid = null\n\t\t\tthis.rowSplit = this.wantsRowSplit ? ROW_SPLIT : 1\n\t\t\tthis.$nextTick(() => {\n\t\t\t\tif (!this.$refs.gridContainer) {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\t// GridStack wrote its own places onto the items; put the layout's back.\n\t\t\t\tthis.applyItemAttributes()\n\t\t\t\tthis.initGrid()\n\t\t\t\tthis.observeContentSizes()\n\t\t\t})\n\t\t},\n\n\t\t/**\n\t\t * Build the accessible name for a grid item. A custom `itemLabel` wins\n\t\t * outright; otherwise the first human-readable field on the item is used\n\t\t * and, while the keyboard lane is live, the current grid coordinates are\n\t\t * appended — without them a screen-reader user tabbing through an edit-mode\n\t\t * dashboard has no way to tell where anything sits.\n\t\t *\n\t\t * @param {object} item the layout item.\n\t\t * @param {number} index the item's index in `layout`, used for the\n\t\t * last-resort positional name.\n\t\t * @return {string} the accessible name.\n\t\t */\n\t\t/**\n\t\t * Write every item's place and size onto its element as the `gs-*`\n\t\t * attributes GridStack reads when it starts, in the current row split.\n\t\t *\n\t\t * @return {void}\n\t\t */\n\t\tapplyItemAttributes() {\n\t\t\tfor (const item of this.layout) {\n\t\t\t\tconst el = this.$refs.gridContainer.querySelector(`[gs-id=\"${item.id}\"]`)\n\t\t\t\tif (!el) {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tfor (const [name, value] of [['gs-x', item.gridX], ['gs-w', item.gridWidth], ['gs-y', this.scaledRow(item.gridY)], ['gs-h', this.scaledRow(item.gridHeight)], ['gs-min-h', this.minRows(item)], ['gs-size-to-content', this.sizeToContentAttr(item)]]) {\n\t\t\t\t\tif (value === undefined || value === null) {\n\t\t\t\t\t\tel.removeAttribute(name)\n\t\t\t\t\t} else {\n\t\t\t\t\t\tel.setAttribute(name, String(value))\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Follow the grid's width, which decides whether `fillHeight` fills.\n\t\t *\n\t\t * @spec openspec/changes/lpvandaag-start-page/specs/lpvandaag-start-page/spec.md#requirement-a-dashboard-can-fill-the-height-below-the-top-bar\n\t\t * @return {void}\n\t\t */\n\t\tobserveContainerWidth() {\n\t\t\tconst container = this.$refs.gridContainer\n\t\t\tif (!this.fillHeight || !container) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tthis.containerWidth = container.clientWidth\n\t\t\tif (typeof ResizeObserver === 'undefined') {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tthis.sizeObserver = new ResizeObserver(() => {\n\t\t\t\tthis.containerWidth = container.clientWidth\n\t\t\t})\n\t\t\tthis.sizeObserver.observe(container)\n\t\t},\n\n\t\t/**\n\t\t * The inline style that places an item on the filled grid.\n\t\t *\n\t\t * @spec openspec/changes/lpvandaag-start-page/specs/lpvandaag-start-page/spec.md#requirement-a-dashboard-can-fill-the-height-below-the-top-bar\n\t\t * @param {object} item The layout item.\n\t\t * @return {object}\n\t\t */\n\t\tfillItemStyle(item) {\n\t\t\tconst x = Number.isFinite(item.gridX) ? item.gridX : 0\n\t\t\tconst y = Number.isFinite(item.gridY) ? item.gridY : 0\n\t\t\tconst w = Number.isFinite(item.gridWidth) ? item.gridWidth : this.minWidth\n\t\t\tconst h = Number.isFinite(item.gridHeight) ? item.gridHeight : this.minHeight\n\t\t\treturn {\n\t\t\t\tgridColumn: `${x + 1} / span ${w}`,\n\t\t\t\tgridRow: `${y + 1} / span ${h}`,\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * The left and width fractions of an item on weighted columns, or\n\t\t * null when the grid keeps its twelve shares or the item is on a\n\t\t * side-column track.\n\t\t *\n\t\t * @spec openspec/changes/dashboard-column-weights/specs/dashboard-column-weights/spec.md#requirement-a-dashboard-can-weigh-its-column-groups\n\t\t * @param {object} item The layout item.\n\t\t * @return {object|null}\n\t\t */\n\t\tweightStyle(item) {\n\t\t\tconst bounds = this.columnBounds\n\t\t\tif (bounds === null || (this.sideColumnStyle !== null && (item.track === 'main' || item.track === 'side'))) {\n\t\t\t\treturn null\n\t\t\t}\n\t\t\tconst x = Math.min(Math.max(Number.isFinite(item.gridX) ? item.gridX : 0, 0), 12)\n\t\t\tconst w = Number.isFinite(item.gridWidth) ? item.gridWidth : this.minWidth\n\t\t\tconst end = Math.min(Math.max(x + w, x), 12)\n\t\t\treturn {\n\t\t\t\t'--cn-weight-left': String(bounds[x]),\n\t\t\t\t'--cn-weight-width': String(bounds[end] - bounds[x]),\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * The inline style of an item: its place on a filled grid, or its\n\t\t * place on weighted columns.\n\t\t *\n\t\t * @param {object} item The layout item.\n\t\t * @return {object|undefined}\n\t\t */\n\t\titemStyle(item) {\n\t\t\tif (this.filling) {\n\t\t\t\treturn this.fillItemStyle(item)\n\t\t\t}\n\t\t\treturn this.weightStyle(item) || undefined\n\t\t},\n\n\t\tresolveItemLabel(item, index) {\n\t\t\tif (this.itemLabel) {\n\t\t\t\treturn String(this.itemLabel(item, index) ?? '')\n\t\t\t}\n\n\t\t\tconst base = item.title\n\t\t\t\t|| item.name\n\t\t\t\t|| item.label\n\t\t\t\t|| item.widgetTitle\n\t\t\t\t|| item.widgetId\n\t\t\t\t|| t('nextcloud-vue', 'Widget {number}', { number: index + 1 })\n\n\t\t\tif (!this.keyboardActive) {\n\t\t\t\treturn String(base)\n\t\t\t}\n\n\t\t\t// Report the rectangle exactly as the reactive `layout` prop states\n\t\t\t// it — unclamped, so the spoken coordinates always match the\n\t\t\t// rendered `gs-*` attributes — and read from the prop (not the\n\t\t\t// GridStack node) so the name re-renders when a move round-trips\n\t\t\t// back through `layout-change`; engine-node mutations are invisible\n\t\t\t// to Vue's reactivity.\n\t\t\tconst rect = {\n\t\t\t\tx: Number.isFinite(item.gridX) ? item.gridX : 0,\n\t\t\t\ty: Number.isFinite(item.gridY) ? item.gridY : 0,\n\t\t\t\tw: Number.isFinite(item.gridWidth) ? item.gridWidth : this.minWidth,\n\t\t\t\th: Number.isFinite(item.gridHeight) ? item.gridHeight : this.minHeight,\n\t\t\t}\n\t\t\treturn t(\n\t\t\t\t'nextcloud-vue',\n\t\t\t\t'{label}, column {column} of {columns}, row {row}, {width} columns wide, {height} rows tall',\n\t\t\t\t{\n\t\t\t\t\tlabel: String(base),\n\t\t\t\t\tcolumn: rect.x + 1,\n\t\t\t\t\tcolumns: this.effectiveColumns,\n\t\t\t\t\trow: rect.y + 1,\n\t\t\t\t\twidth: rect.w,\n\t\t\t\t\theight: rect.h,\n\t\t\t\t},\n\t\t\t)\n\t\t},\n\n\t\t/**\n\t\t * Build the GridStack grid on the rendered items, install the growth\n\t\t * wrapper (`keepOrderOnGrowth`) and listen for its changes.\n\t\t *\n\t\t * @spec openspec/changes/dashboard-growth-keeps-order/specs/dashboard-grid/spec.md#requirement-a-growing-cell-keeps-the-order-of-the-cards-under-it\n\t\t * @return {void}\n\t\t */\n\t\tinitGrid() {\n\t\t\tif (this.cellHeightCssVar && typeof document !== 'undefined' && document.documentElement) {\n\t\t\t\tdocument.documentElement.style.setProperty(this.cellHeightCssVar, `${this.cellHeight}px`)\n\t\t\t}\n\t\t\tconst el = this.$refs.gridContainer.querySelector('.grid-stack')\n\t\t\tthis.grid = GridStack.init({\n\t\t\t\tcolumn: this.columns,\n\t\t\t\tcellHeight: this.cellHeight / this.rowSplit,\n\t\t\t\tmargin: this.margin,\n\t\t\t\t...(this.marginBottom !== null ? { marginBottom: this.marginBottom } : {}),\n\t\t\t\tfloat: this.float,\n\t\t\t\tanimate: true,\n\t\t\t\tdisableDrag: !this.editable,\n\t\t\t\tdisableResize: !this.editable,\n\t\t\t\tremovable: false,\n\t\t\t\t...(this.columnOpts ? { columnOpts: this.columnOpts } : {}),\n\t\t\t}, el)\n\t\t\tthis.keepOrderOnGrowth()\n\t\t\tthis.matchRowHeights()\n\t\t\tthis.placeClearRows()\n\n\t\t\tthis.grid.on('change', (_event, items) => {\n\t\t\t\tthis.handleGridChange(items)\n\t\t\t})\n\n\t\t\t// A grid that mounts already narrow is reflowed before anyone touches\n\t\t\t// it, so the handles have to be judged here and not only on a later\n\t\t\t// change.\n\t\t\tthis.syncInteractivity()\n\t\t},\n\n\t\t/**\n\t\t * Let a size-to-content cell that grows push the cards under it down in\n\t\t * their order. GridStack resolves that collision itself, but not in\n\t\t * order: when pipelinq's banner grew from two rows to three, the\n\t\t * full-width card under the stat tiles landed below the lists, also\n\t\t * with `float: false`. Every grow after the grid is built, whether\n\t\t * GridStack measures it on resize or this grid's content observer asks\n\t\t * for it, now first moves the cards the growth reaches down by the\n\t\t * growth (`planGrowth`), bottom-most first, and only then grows the\n\t\t * cell, so GridStack has no collision left to resolve. The wrapper is\n\t\t * installed after `GridStack.init` has already measured the cells on\n\t\t * load; the order on load comes from adding the items in row order\n\t\t * (`itemsInRowOrder`). A cell that shrinks is left to GridStack as\n\t\t * before.\n\t\t *\n\t\t * The grid is read raw: through Vue's proxy `engine.nodes` holds proxies\n\t\t * while `el.gridstackNode` is the plain node, so the growing cell would\n\t\t * not be recognised among the nodes and would be moved down by its own\n\t\t * growth. Moving a cell makes GridStack measure it again, so a cell the\n\t\t * wrapper is already growing goes straight to GridStack.\n\t\t *\n\t\t * @spec openspec/changes/dashboard-growth-keeps-order/specs/dashboard-grid/spec.md#requirement-a-growing-cell-keeps-the-order-of-the-cards-under-it\n\t\t * @return {void}\n\t\t */\n\t\tkeepOrderOnGrowth() {\n\t\t\tconst grid = toRaw(this.grid)\n\t\t\tif (!grid || typeof grid.resizeToContent !== 'function' || typeof grid.update !== 'function') {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst resize = grid.resizeToContent.bind(grid)\n\t\t\tconst growing = new Set()\n\t\t\tgrid.resizeToContent = (el) => {\n\t\t\t\tif (this.pendingSizes) {\n\t\t\t\t\tif (!this.pendingSizes.includes(el)) {\n\t\t\t\t\t\tthis.pendingSizes.push(el)\n\t\t\t\t\t}\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tthis.matchRowHeights()\n\t\t\t\tthis.resizeKeepingOrder(grid, resize, growing, el)\n\t\t\t\tif (growing.size === 0) {\n\t\t\t\t\tthis.placeClearRows()\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * One `resizeToContent` with the cards under a growing cell moved down\n\t\t * first (`keepOrderOnGrowth`).\n\t\t *\n\t\t * @param {object} grid The raw GridStack.\n\t\t * @param {function(HTMLElement): void} resize GridStack's own resizeToContent.\n\t\t * @param {Set<HTMLElement>} growing The cells being grown now.\n\t\t * @param {HTMLElement} el The cell.\n\t\t * @return {void}\n\t\t */\n\t\tresizeKeepingOrder(grid, resize, growing, el) {\n\t\t\tif (growing.has(el)) {\n\t\t\t\tresize(el)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst node = el && el.gridstackNode\n\t\t\tconst nodes = grid.engine && Array.isArray(grid.engine.nodes) ? grid.engine.nodes : null\n\t\t\tconst rows = node && nodes ? this.contentRows(el, node) : null\n\t\t\tconst plan = rows ? planGrowth(nodes, node, rows) : []\n\t\t\tif (plan.length === 0) {\n\t\t\t\tresize(el)\n\t\t\t\treturn\n\t\t\t}\n\t\t\t// Inside a batch the moves are not packed until the cell has grown.\n\t\t\tconst batching = Boolean(grid.engine.batchMode)\n\t\t\tgrowing.add(el)\n\t\t\ttry {\n\t\t\t\tif (!batching) {\n\t\t\t\t\tgrid.batchUpdate()\n\t\t\t\t}\n\t\t\t\tfor (const step of plan) {\n\t\t\t\t\tgrid.update(step.node.el, { y: step.y })\n\t\t\t\t}\n\t\t\t\tresize(el)\n\t\t\t\tif (!batching) {\n\t\t\t\t\tgrid.batchUpdate(false)\n\t\t\t\t}\n\t\t\t} finally {\n\t\t\t\tgrowing.delete(el)\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Whether a layout item takes part in its row's shared height\n\t\t * (`sameHeight`). A size-to-content card stretches to the tallest; a card\n\t\t * of fixed height is not stretched but counts as the height to reach.\n\t\t *\n\t\t * @spec openspec/changes/dashboard-row-same-height/specs/dashboard-grid/spec.md\n\t\t * @param {object} item The layout item.\n\t\t * @return {boolean} True when it does.\n\t\t */\n\t\tsharesRowHeight(item) {\n\t\t\treturn item?.sameHeight === true\n\t\t},\n\n\t\t/**\n\t\t * Stretch the shorter `sameHeight` cards of each layout row to the\n\t\t * tallest of them (`planSameHeights`), with a min-height on the widget\n\t\t * the cell measures, so GridStack sizes the cells alike and the next row\n\t\t * starts level, as the boards draw a row of cards (DqProcesanalyse).\n\t\t * Each pass measures the content again without the stretch, so a row\n\t\t * shrinks with its content. Edit mode and a reflowed (stacked) grid keep\n\t\t * every card at its own height.\n\t\t *\n\t\t * @spec openspec/changes/dashboard-row-same-height/specs/dashboard-grid/spec.md\n\t\t * @return {void}\n\t\t */\n\t\tmatchRowHeights() {\n\t\t\tconst container = this.$el && typeof this.$el.querySelectorAll === 'function' ? this.$el : null\n\t\t\tif (!container || this.matchingRowHeights) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst byId = new Map(this.layout.map((item) => [String(item.id), item]))\n\t\t\tconst cards = []\n\t\t\tfor (const cell of container.querySelectorAll('.grid-stack-item.cn-dashboard-grid__item--same-height')) {\n\t\t\t\tconst item = byId.get(String(cell.getAttribute('gs-id')))\n\t\t\t\tconst child = cell.querySelector('.grid-stack-item-content')?.firstElementChild\n\t\t\t\tif (item && child) {\n\t\t\t\t\tcards.push({ child, row: item.gridY ?? 0, fit: this.sizeToContentAttr(item) !== undefined })\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (cards.length === 0) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tthis.matchingRowHeights = true\n\t\t\ttry {\n\t\t\t\tfor (const card of cards) {\n\t\t\t\t\tif (card.fit) {\n\t\t\t\t\t\tcard.child.style.minHeight = ''\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (this.editable || this.reflowed) {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tconst heights = planSameHeights(cards.map((card) => ({ row: card.row, height: card.child.getBoundingClientRect().height })))\n\t\t\t\tcards.forEach((card, index) => {\n\t\t\t\t\tif (card.fit && heights[index] !== null) {\n\t\t\t\t\t\tcard.child.style.minHeight = `${heights[index]}px`\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t} finally {\n\t\t\t\tthis.matchingRowHeights = false\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Put every `clear` layout item below the cards of the earlier rows\n\t\t * (`planClearRows`), in one batch. Runs after the grid is built and after\n\t\t * each cell is measured to its content; a move made here that measures a\n\t\t * cell again does not start another round.\n\t\t *\n\t\t * @spec openspec/changes/dashboard-clear-row/specs/dashboard-grid/spec.md\n\t\t * @return {void}\n\t\t */\n\t\tplaceClearRows() {\n\t\t\tconst grid = this.grid ? toRaw(this.grid) : null\n\t\t\tif (this.placingClearRows || !grid || !grid.engine || !Array.isArray(grid.engine.nodes) || typeof grid.update !== 'function') {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst byId = new Map(this.layout.map((item) => [String(item.id), item]))\n\t\t\tconst nodes = grid.engine.nodes.map((n) => {\n\t\t\t\tconst item = byId.get(String(n.id))\n\t\t\t\treturn Object.assign(Object.create(null), { node: n, x: n.x, y: n.y, w: n.w, h: n.h, row: item ? this.scaledRow(item.gridY ?? 0) : 0, clear: !this.editable && item?.clear === true })\n\t\t\t})\n\t\t\tconst plan = planClearRows(nodes)\n\t\t\tif (plan.length === 0) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst batching = Boolean(grid.engine.batchMode)\n\t\t\tthis.placingClearRows = true\n\t\t\ttry {\n\t\t\t\tif (!batching && typeof grid.batchUpdate === 'function') {\n\t\t\t\t\tgrid.batchUpdate()\n\t\t\t\t}\n\t\t\t\tfor (const step of plan) {\n\t\t\t\t\tgrid.update(step.node.node.el, { y: step.y })\n\t\t\t\t}\n\t\t\t\tif (!batching && typeof grid.batchUpdate === 'function') {\n\t\t\t\t\tgrid.batchUpdate(false)\n\t\t\t\t}\n\t\t\t} finally {\n\t\t\t\tthis.placingClearRows = false\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * The rows a size-to-content cell needs for its content, measured the\n\t\t * way GridStack's `resizeToContent` measures it (the content's first\n\t\t * child, plus the cell's own padding), within its size-to-content row\n\t\t * maximum and its minimum and maximum height.\n\t\t *\n\t\t * @spec openspec/changes/dashboard-growth-keeps-order/specs/dashboard-grid/spec.md#requirement-a-growing-cell-keeps-the-order-of-the-cards-under-it\n\t\t * @param {HTMLElement} el The cell.\n\t\t * @param {object} node Its GridStack node.\n\t\t * @return {number|null} The rows, or null when it cannot be measured.\n\t\t */\n\t\tcontentRows(el, node) {\n\t\t\tconst cell = this.grid.getCellHeight(true)\n\t\t\tconst item = el.querySelector('.grid-stack-item-content')\n\t\t\tconst child = item && item.firstElementChild\n\t\t\tif (!el.clientHeight || !cell || !child || !Number.isFinite(node.h)) {\n\t\t\t\treturn null\n\t\t\t}\n\t\t\tconst padding = el.clientHeight - item.clientHeight\n\t\t\tconst itemHeight = node.h * cell - padding\n\t\t\tconst wanted = child.getBoundingClientRect().height || itemHeight\n\t\t\tlet rows = Math.ceil((node.h * cell + wanted - itemHeight) / cell)\n\t\t\tif (Number.isInteger(node.sizeToContent) && rows > node.sizeToContent) {\n\t\t\t\trows = node.sizeToContent\n\t\t\t}\n\t\t\tif (node.minH && rows < node.minH) {\n\t\t\t\trows = node.minH\n\t\t\t} else if (node.maxH && rows > node.maxH) {\n\t\t\t\trows = node.maxH\n\t\t\t}\n\t\t\treturn rows\n\t\t},\n\n\t\t/**\n\t\t * Keep both editing lanes in step with whether an edit could actually be\n\t\t * kept: the pointer's handles, and — through `reflowed` feeding\n\t\t * `keyboardActive` — the tab stops, the help text and the arrow keys.\n\t\t *\n\t\t * A reflowed grid drops every `change` it receives, for the reason\n\t\t * `handleGridChange` gives. Leaving either lane live there offers an edit\n\t\t * that silently snaps back, which is the same class of surprise as\n\t\t * persisting the reflow — pointed the other way, and harder to explain\n\t\t * because the author did everything right. It is worse on the keyboard,\n\t\t * where the move is also announced as done. The affordance has to say what\n\t\t * the grid will do at this width, not what edit mode does at the authored\n\t\t * one.\n\t\t *\n\t\t * @return {void}\n\t\t */\n\t\tsyncInteractivity() {\n\t\t\t// Ahead of the engine guard: the keyboard lane reads this whether or\n\t\t\t// not the engine can be enabled.\n\t\t\tthis.reflowed = this.isReflowed()\n\t\t\tif (!this.grid || typeof this.grid.enable !== 'function') {\n\t\t\t\treturn\n\t\t\t}\n\t\t\t// On the raw grid: enabled through Vue's proxy, GridStack binds its\n\t\t\t// drag handlers to the proxy and a drop never ends, so the move is\n\t\t\t// shown but no `change` follows.\n\t\t\tconst grid = toRaw(this.grid)\n\t\t\tif (this.editable && !this.reflowed) {\n\t\t\t\tgrid.enable()\n\t\t\t} else {\n\t\t\t\tgrid.disable()\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Whether the grid is currently rescaled to a column count other than the\n\t\t * authored one, i.e. a `columnOpts` breakpoint is in force.\n\t\t *\n\t\t * The authored count is `columnOpts.columnMax` when there is one, not the\n\t\t * `columns` prop: GridStack widens to `columnMax` above the top breakpoint,\n\t\t * so a consumer whose two disagree is at its widest, not reflowed.\n\t\t *\n\t\t * @return {boolean} True while a responsive reflow is active.\n\t\t */\n\t\tisReflowed() {\n\t\t\tif (!this.grid || typeof this.grid.getColumn !== 'function') {\n\t\t\t\treturn false\n\t\t\t}\n\t\t\tconst authored = Number.isFinite(this.columnOpts?.columnMax) ? this.columnOpts.columnMax : this.columns\n\t\t\tconst live = this.grid.getColumn()\n\t\t\treturn Number.isFinite(live) && live > 0 && live !== authored\n\t\t},\n\n\t\thandleGridChange(items) {\n\t\t\t// The rescale that crossed a breakpoint arrives here as a `change`, so\n\t\t\t// this is also where the handles are re-judged in both directions:\n\t\t\t// switched off as the grid narrows, and back on as it widens.\n\t\t\tthis.syncInteractivity()\n\n\t\t\tif (this.applyingLayout) {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// GridStack fires `change` for its own responsive rescale too, and at a\n\t\t\t// 12 → 1 breakpoint every item reads `gridX: 0, gridWidth: 1`. Emitting\n\t\t\t// that has the host persist the reflow AS the authored layout, which\n\t\t\t// widening back does not undo. A move made while reflowed is the same\n\t\t\t// rescaled geometry, so it is dropped for the same reason.\n\t\t\tif (this.isReflowed()) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\t// A grid on split rows is a view-mode grid: what changes in it is\n\t\t\t// packing and size-to-content measuring, never a user's\n\t\t\t// arrangement, and it is not reported as one.\n\t\t\tif (this.rowSplit !== 1) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif (!items || items.length === 0) {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tconst updated = this.layout.map((item) => {\n\t\t\t\tconst gridItem = items.find((gi) => String(gi.id) === String(item.id))\n\t\t\t\tif (gridItem) {\n\t\t\t\t\treturn {\n\t\t\t\t\t\t...item,\n\t\t\t\t\t\tgridX: gridItem.x,\n\t\t\t\t\t\tgridY: gridItem.y,\n\t\t\t\t\t\tgridWidth: gridItem.w,\n\t\t\t\t\t\tgridHeight: gridItem.h,\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn item\n\t\t\t})\n\n\t\t\tthis.$emit('layout-change', updated)\n\t\t},\n\n\t\t/**\n\t\t * Keydown handler bound to every grid item.\n\t\t *\n\t\t * Only reacts when the grid item element itself is the event target:\n\t\t * a button, input or menu rendered inside the `#widget` slot must keep\n\t\t * its own arrow/Enter semantics, and a grid that swallowed them would\n\t\t * be a worse a11y regression than the one this handler fixes.\n\t\t *\n\t\t * @param {KeyboardEvent} event the keydown event.\n\t\t * @param {object} item the layout item the key was pressed on.\n\t\t * @return {void}\n\t\t */\n\t\tonItemKeydown(event, item) {\n\t\t\tif (!this.keyboardRepositioning) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif (event.target !== event.currentTarget) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif (event.altKey || event.ctrlKey || event.metaKey) {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tif (event.key === 'Enter' || event.key === ' ' || event.key === 'Spacebar') {\n\t\t\t\tevent.preventDefault()\n\t\t\t\tthis.activateItem(item, event.currentTarget)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// Repositioning only, and only where it can be kept — an item that\n\t\t\t// still holds focus from before a reflow keeps its Enter, but its\n\t\t\t// arrow keys stop moving something that would snap back.\n\t\t\tif (!this.keyboardActive) {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tconst handled = this.applyKey(event.key, event.shiftKey, item)\n\t\t\tif (handled) {\n\t\t\t\t// Arrows would otherwise scroll the dashboard out from under\n\t\t\t\t// the widget the user is moving.\n\t\t\t\tevent.preventDefault()\n\t\t\t\tevent.stopPropagation()\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Translate one repositioning key into a geometry change.\n\t\t *\n\t\t * @param {string} key the `KeyboardEvent.key` value.\n\t\t * @param {boolean} shift whether Shift was held (resize instead of move).\n\t\t * @param {object} item the layout item being operated on.\n\t\t * @return {boolean} `true` when the key belongs to the grid and the\n\t\t * default action must be suppressed.\n\t\t */\n\t\tapplyKey(key, shift, item) {\n\t\t\tconst rect = this.currentRect(item)\n\n\t\t\tswitch (key) {\n\t\t\t\tcase 'ArrowLeft':\n\t\t\t\t\treturn shift\n\t\t\t\t\t\t? this.applyGeometry(item, { w: rect.w - 1 }, 'resize')\n\t\t\t\t\t\t: this.applyGeometry(item, { x: rect.x - 1 }, 'move')\n\t\t\t\tcase 'ArrowRight':\n\t\t\t\t\treturn shift\n\t\t\t\t\t\t? this.applyGeometry(item, { w: rect.w + 1 }, 'resize')\n\t\t\t\t\t\t: this.applyGeometry(item, { x: rect.x + 1 }, 'move')\n\t\t\t\tcase 'ArrowUp':\n\t\t\t\t\treturn shift\n\t\t\t\t\t\t? this.applyGeometry(item, { h: rect.h - 1 }, 'resize')\n\t\t\t\t\t\t: this.applyGeometry(item, { y: rect.y - 1 }, 'move')\n\t\t\t\tcase 'ArrowDown':\n\t\t\t\t\treturn shift\n\t\t\t\t\t\t? this.applyGeometry(item, { h: rect.h + 1 }, 'resize')\n\t\t\t\t\t\t: this.applyGeometry(item, { y: rect.y + 1 }, 'move')\n\t\t\t\tcase 'Home':\n\t\t\t\t\treturn this.applyGeometry(item, { x: 0 }, 'move')\n\t\t\t\tcase 'End':\n\t\t\t\t\treturn this.applyGeometry(item, { x: this.effectiveColumns - rect.w }, 'move')\n\t\t\t\tdefault:\n\t\t\t\t\treturn false\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Read an item's live rectangle. The GridStack node is preferred over\n\t\t * the `layout` prop because a drag that has not yet round-tripped\n\t\t * through the consumer's persistence leaves the prop momentarily stale,\n\t\t * and a keyboard nudge must continue from where the widget actually is.\n\t\t *\n\t\t * @param {object} item the layout item.\n\t\t * @return {{x: number, y: number, w: number, h: number}} the rectangle\n\t\t * in grid units.\n\t\t */\n\t\tcurrentRect(item) {\n\t\t\tconst node = this.gridNode(item.id)\n\t\t\tif (node && Number.isFinite(node.x) && Number.isFinite(node.y)) {\n\t\t\t\treturn {\n\t\t\t\t\tx: node.x,\n\t\t\t\t\ty: node.y,\n\t\t\t\t\tw: Number.isFinite(node.w) ? node.w : this.minWidth,\n\t\t\t\t\th: Number.isFinite(node.h) ? node.h : this.minHeight,\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tx: Number.isFinite(item.gridX) ? item.gridX : 0,\n\t\t\t\ty: Number.isFinite(item.gridY) ? item.gridY : 0,\n\t\t\t\tw: Number.isFinite(item.gridWidth) ? item.gridWidth : this.minWidth,\n\t\t\t\th: Number.isFinite(item.gridHeight) ? item.gridHeight : this.minHeight,\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Clamp a candidate rectangle to the grid's bounds and the configured\n\t\t * minimum widget size, so a held-down arrow key parks the widget at the\n\t\t * edge instead of pushing it into negative coordinates.\n\t\t *\n\t\t * @param {{x: number, y: number, w: number, h: number}} rect the candidate.\n\t\t * @param {object} [item] the layout item, whose own `minHeight` applies.\n\t\t * @return {{x: number, y: number, w: number, h: number}} the clamped rectangle.\n\t\t */\n\t\tclampRect(rect, item) {\n\t\t\tconst cols = this.effectiveColumns\n\t\t\tconst w = Math.min(Math.max(rect.w, this.minWidth), cols)\n\t\t\tconst h = Math.max(rect.h, item ? this.itemMinHeight(item) : this.minHeight)\n\t\t\treturn {\n\t\t\t\tx: Math.min(Math.max(rect.x, 0), Math.max(cols - w, 0)),\n\t\t\t\ty: Math.max(rect.y, 0),\n\t\t\t\tw,\n\t\t\t\th,\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Apply a partial geometry change to an item.\n\t\t *\n\t\t * The change is pushed through `GridStack.update()` — the very call the\n\t\t * drag/resize handlers end in — so collision resolution, the `change`\n\t\t * event and therefore the `layout-change` emission and the consumer's\n\t\t * persistence are identical for keyboard and pointer. There is\n\t\t * deliberately no second, direct-to-`layout` update path.\n\t\t *\n\t\t * @param {object} item the layout item to move or resize.\n\t\t * @param {{x?: number, y?: number, w?: number, h?: number}} patch the\n\t\t * requested change, merged over the item's current rectangle.\n\t\t * @param {'move'|'resize'} kind which announcement to speak.\n\t\t * @return {boolean} `true` when the key was consumed — including when\n\t\t * the widget was already at the edge, because the arrow still belongs\n\t\t * to the grid and must not scroll the page.\n\t\t */\n\t\tapplyGeometry(item, patch, kind) {\n\t\t\tconst el = this.itemElement(item.id)\n\t\t\tif (!el || !this.grid || typeof this.grid.update !== 'function') {\n\t\t\t\treturn false\n\t\t\t}\n\n\t\t\tconst current = this.currentRect(item)\n\t\t\tconst next = this.clampRect({ ...current, ...patch }, item)\n\n\t\t\tif (next.x === current.x && next.y === current.y\n\t\t\t\t&& next.w === current.w && next.h === current.h) {\n\t\t\t\tthis.announce(t('nextcloud-vue', '{label} cannot move further in that direction', {\n\t\t\t\t\tlabel: this.announcementLabel(item),\n\t\t\t\t}))\n\t\t\t\treturn true\n\t\t\t}\n\n\t\t\ttoRaw(this.grid).update(el, next)\n\n\t\t\tthis.announce(kind === 'resize'\n\t\t\t\t? t('nextcloud-vue', '{label} resized to {width} columns by {height} rows', {\n\t\t\t\t\t\tlabel: this.announcementLabel(item),\n\t\t\t\t\t\twidth: next.w,\n\t\t\t\t\t\theight: next.h,\n\t\t\t\t\t})\n\t\t\t\t: t('nextcloud-vue', '{label} moved to column {column}, row {row}', {\n\t\t\t\t\t\tlabel: this.announcementLabel(item),\n\t\t\t\t\t\tcolumn: next.x + 1,\n\t\t\t\t\t\trow: next.y + 1,\n\t\t\t\t\t}))\n\n\t\t\treturn true\n\t\t},\n\n\t\t/**\n\t\t * The short, coordinate-free name used inside live-region sentences —\n\t\t * the full `aria-label` already carries the coordinates and repeating\n\t\t * them would make every announcement unlistenable.\n\t\t *\n\t\t * @param {object} item the layout item.\n\t\t * @return {string} the short name.\n\t\t */\n\t\tannouncementLabel(item) {\n\t\t\treturn String(item.title\n\t\t\t\t|| item.name\n\t\t\t\t|| item.label\n\t\t\t\t|| item.widgetTitle\n\t\t\t\t|| item.widgetId\n\t\t\t\t|| t('nextcloud-vue', 'Widget'))\n\t\t},\n\n\t\t/**\n\t\t * Push text into the polite live region. The region is cleared first so\n\t\t * two identical consecutive announcements (e.g. two failed nudges at the\n\t\t * grid edge) are both spoken — assistive tech ignores a re-render that\n\t\t * leaves the text unchanged.\n\t\t *\n\t\t * @param {string} text the message to announce.\n\t\t * @return {void}\n\t\t */\n\t\tannounce(text) {\n\t\t\tthis.announcement = ''\n\t\t\tthis.$nextTick(() => {\n\t\t\t\tthis.announcement = text\n\t\t\t})\n\t\t},\n\n\t\t/**\n\t\t * Handle `Enter` / `Space` on a focused grid item: tell the consumer via\n\t\t * `item-activate`, and — unless opted out — synthesise the `contextmenu`\n\t\t * event a right-click would have produced, anchored to the item, so\n\t\t * pointer-only widget menus become keyboard-reachable without the\n\t\t * consumer wiring anything new. The synthetic event is dispatched from\n\t\t * inside the item's content so it bubbles through the slot's own root\n\t\t * element (where such handlers live) and on up.\n\t\t *\n\t\t * @param {object} item the layout item being activated.\n\t\t * @param {HTMLElement} el the grid item element.\n\t\t * @return {void}\n\t\t */\n\t\tactivateItem(item, el) {\n\t\t\tconst rect = typeof el.getBoundingClientRect === 'function'\n\t\t\t\t? el.getBoundingClientRect()\n\t\t\t\t: { left: 0, top: 0 }\n\t\t\tconst clientX = Math.round((rect.left || 0) + MENU_ANCHOR_OFFSET)\n\t\t\tconst clientY = Math.round((rect.top || 0) + MENU_ANCHOR_OFFSET)\n\n\t\t\tthis.$emit('item-activate', { item, element: el, clientX, clientY })\n\n\t\t\tif (this.activateOpensContextMenu) {\n\t\t\t\tthis.dispatchContextMenu(el, clientX, clientY)\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Dispatch a bubbling, cancelable `contextmenu` MouseEvent from inside a\n\t\t * grid item.\n\t\t *\n\t\t * @param {HTMLElement} el the grid item element.\n\t\t * @param {number} clientX viewport x for the menu anchor.\n\t\t * @param {number} clientY viewport y for the menu anchor.\n\t\t * @return {void}\n\t\t */\n\t\tdispatchContextMenu(el, clientX, clientY) {\n\t\t\tif (typeof MouseEvent !== 'function') {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst content = el.querySelector('.grid-stack-item-content')\n\t\t\tconst target = (content && content.firstElementChild) || content || el\n\t\t\ttarget.dispatchEvent(new MouseEvent('contextmenu', {\n\t\t\t\tbubbles: true,\n\t\t\t\tcancelable: true,\n\t\t\t\tclientX,\n\t\t\t\tclientY,\n\t\t\t\tbutton: 2,\n\t\t\t}))\n\t\t},\n\n\t\t/**\n\t\t * Look up a grid item's DOM element by its layout id.\n\t\t *\n\t\t * @param {string|number} id the layout item id.\n\t\t * @return {HTMLElement|null} the element, or `null` when not rendered.\n\t\t */\n\t\titemElement(id) {\n\t\t\tconst container = this.$refs.gridContainer\n\t\t\tif (!container) {\n\t\t\t\treturn null\n\t\t\t}\n\t\t\treturn container.querySelector(`[gs-id=\"${id}\"]`)\n\t\t},\n\n\t\t/**\n\t\t * Look up the GridStack engine node backing a layout item.\n\t\t *\n\t\t * @param {string|number} id the layout item id.\n\t\t * @return {object|null} the node, or `null` when GridStack isn't tracking it.\n\t\t */\n\t\t/**\n\t\t * Re-measure a `sizeToContent` item when its content changes height.\n\t\t * GridStack watches only the grid element, so a widget that loaded its data\n\t\t * in `mounted()` keeps the height its empty state had.\n\t\t *\n\t\t * @return {void}\n\t\t */\n\t\tobserveContentSizes() {\n\t\t\tthis.disconnectContentObserver()\n\t\t\tif (typeof ResizeObserver === 'undefined' || !this.$refs.gridContainer) {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tthis.contentObserver = new ResizeObserver((entries) => {\n\t\t\t\tconst cells = new Set()\n\t\t\t\tfor (const entry of entries) {\n\t\t\t\t\tconst cell = entry.target.closest('.grid-stack-item')\n\t\t\t\t\tif (cell) {\n\t\t\t\t\t\tcells.add(cell)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (cells.size === 0) {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\t// A frame later, not inline: `resizeToContent` resizes the cell the\n\t\t\t\t// observed child sits in, and a child that stretches to its parent\n\t\t\t\t// grows with it. Resizing from inside the callback makes that the\n\t\t\t\t// classic ResizeObserver loop (\"undelivered notifications\"); deferred,\n\t\t\t\t// it is an ordinary second pass that settles.\n\t\t\t\trequestAnimationFrame(() => {\n\t\t\t\t\tif (!this.contentObserver || !this.grid || typeof this.grid.resizeToContent !== 'function') {\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\t\tfor (const cell of cells) {\n\t\t\t\t\t\tthis.grid.resizeToContent(cell)\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t})\n\n\t\t\tconst cells = this.$refs.gridContainer.querySelectorAll('.grid-stack-item[gs-size-to-content]')\n\t\t\tfor (const cell of cells) {\n\t\t\t\tconst measured = cell.querySelector('.grid-stack-item-content')?.firstElementChild\n\t\t\t\tif (measured) {\n\t\t\t\t\tthis.contentObserver.observe(measured)\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\n\t\t/**\n\t\t * Drop the content observer, on unmount or before rebuilding it.\n\t\t *\n\t\t * @return {void}\n\t\t */\n\t\tdisconnectContentObserver() {\n\t\t\tif (this.contentObserver) {\n\t\t\t\tthis.contentObserver.disconnect()\n\t\t\t\tthis.contentObserver = null\n\t\t\t}\n\t\t},\n\n\t\tgridNode(id) {\n\t\t\tconst nodes = this.grid && this.grid.engine && this.grid.engine.nodes\n\t\t\tif (!Array.isArray(nodes)) {\n\t\t\t\treturn null\n\t\t\t}\n\t\t\treturn nodes.find((n) => String(n.id) === String(id)) || null\n\t\t},\n\n\t\t/**\n\t\t * Make the cards a layout change brings in GridStack widgets, in the\n\t\t * order given (row order), and size the size-to-content ones only once\n\t\t * all are placed, in the same order. GridStack sizes such a cell the\n\t\t * moment it is added, and a card added after it onto a cell that has\n\t\t * grown pushes that cell below itself: the in-call tile row on\n\t\t * PqWerkplekKlant ended under every column card.\n\t\t *\n\t\t * @spec openspec/changes/dashboard-layout-swap-keeps-order/specs/dashboard-grid/spec.md#requirement-cards-a-layout-change-adds-keep-their-authored-order\n\t\t * @param {Array<HTMLElement>} els The new cells, top to bottom.\n\t\t * @return {void}\n\t\t */\n\t\taddWidgetsInOrder(els) {\n\t\t\tif (els.length === 0) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tconst grid = toRaw(this.grid)\n\t\t\tconst queued = []\n\t\t\tthis.pendingSizes = queued\n\t\t\ttry {\n\t\t\t\tfor (const el of els) {\n\t\t\t\t\tgrid.makeWidget(el)\n\t\t\t\t}\n\t\t\t} finally {\n\t\t\t\tthis.pendingSizes = null\n\t\t\t}\n\t\t\tfor (const el of queued) {\n\t\t\t\tgrid.resizeToContent(el)\n\t\t\t}\n\t\t},\n\n\t\tsyncGridItems(newLayout) {\n\t\t\t// Add new items, and re-adopt items whose backing DOM element was\n\t\t\t// replaced. When a consumer's `itemKey` changes for an unchanged\n\t\t\t// `id` (e.g. a style edit — the documented use of `itemKey`), Vue\n\t\t\t// swaps the element. GridStack keeps tracking the old, now-detached\n\t\t\t// element, leaving the new one unmanaged (no positioning/sizing) —\n\t\t\t// so re-register it against the new element. New items are added\n\t\t\t// together, top to bottom (`addWidgetsInOrder`).\n\t\t\tthis.$nextTick(() => {\n\t\t\t\tif (!this.grid || !this.$refs.gridContainer) {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tconst grid = toRaw(this.grid)\n\t\t\t\tconst added = []\n\t\t\t\tfor (const item of this.itemsInRowOrder) {\n\t\t\t\t\tconst el = this.$refs.gridContainer.querySelector(`[gs-id=\"${item.id}\"]`)\n\t\t\t\t\tif (!el) {\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t\tconst node = grid.engine.nodes.find((n) => String(n.id) === String(item.id))\n\t\t\t\t\tif (!node) {\n\t\t\t\t\t\tadded.push(el)\n\t\t\t\t\t} else if (node.el === el) {\n\t\t\t\t\t\t// The layout MOVED an item the grid already tracks: the\n\t\t\t\t\t\t// page re-compacts its display layout when a widget's\n\t\t\t\t\t\t// condition hides it, and the item below was given a new\n\t\t\t\t\t\t// gridY that never reached GridStack, so a band stayed\n\t\t\t\t\t\t// where the hidden widget had been. A drag reports the\n\t\t\t\t\t\t// grid's own position back, which matches and does\n\t\t\t\t\t\t// nothing here.\n\t\t\t\t\t\t// A width or height the layout changed (a form, an\n\t\t\t\t\t\t// undo) is synced the same way. A size-to-content cell\n\t\t\t\t\t\t// keeps the height its content gave it.\n\t\t\t\t\t\tconst x = item.gridX ?? node.x\n\t\t\t\t\t\tconst y = Number.isFinite(item.gridY) ? item.gridY * this.rowSplit : node.y\n\t\t\t\t\t\tconst w = Number.isFinite(item.gridWidth) ? item.gridWidth : node.w\n\t\t\t\t\t\tconst h = Number.isFinite(item.gridHeight) && this.sizeToContentAttr(item) === undefined\n\t\t\t\t\t\t\t? item.gridHeight * this.rowSplit\n\t\t\t\t\t\t\t: node.h\n\t\t\t\t\t\tif (x !== node.x || y !== node.y || w !== node.w || h !== node.h) {\n\t\t\t\t\t\t\t// The layout said where it goes; GridStack's `change`\n\t\t\t\t\t\t\t// for it is not a user's arrangement and is not\n\t\t\t\t\t\t\t// reported back (it would write the display-only\n\t\t\t\t\t\t\t// compaction into the authored layout).\n\t\t\t\t\t\t\tthis.applyingLayout = true\n\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\tgrid.update(el, { x, y, w, h })\n\t\t\t\t\t\t\t} finally {\n\t\t\t\t\t\t\t\tthis.applyingLayout = false\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// Drop the stale node without touching its detached DOM,\n\t\t\t\t\t\t// then adopt the new element so GridStack sizes/places it.\n\t\t\t\t\t\tgrid.removeWidget(node.el, false, false)\n\t\t\t\t\t\tgrid.makeWidget(el)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tthis.addWidgetsInOrder(added)\n\t\t\t})\n\n\t\t\t// Remove items no longer in layout\n\t\t\tconst ids = newLayout.map((i) => String(i.id))\n\t\t\tconst toRemove = this.grid.engine.nodes.filter((n) => !ids.includes(String(n.id)))\n\t\t\tfor (const node of toRemove) {\n\t\t\t\tconst el = this.$refs.gridContainer.querySelector(`[gs-id=\"${node.id}\"]`)\n\t\t\t\tif (el) {\n\t\t\t\t\ttoRaw(this.grid).removeWidget(el, false)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Elements were added or replaced, so the observer's are stale.\n\t\t\tthis.$nextTick(() => this.observeContentSizes())\n\t\t},\n\t},\n}\n</script>\n\n<style scoped>\n.cn-dashboard-grid {\n\twidth: 100%;\n\tmin-height: 200px;\n}\n\n.grid-stack {\n\tbackground: transparent;\n}\n\n/* `fillHeight`: the layout rows divide the grid's height (CSS grid instead of\n GridStack's absolute rows). GridStack may have left its inline places on the\n items, hence !important. Each cell scrolls what does not fit in it. */\n.cn-dashboard-grid--fill {\n\theight: 100%;\n\tmin-height: 0;\n}\n\n.cn-dashboard-grid--fill > .grid-stack {\n\tdisplay: grid;\n\theight: 100% !important;\n\tmin-height: 0 !important;\n}\n\n.cn-dashboard-grid--fill > .grid-stack > .grid-stack-item {\n\tposition: relative !important;\n\tinset: auto !important;\n\twidth: auto !important;\n\theight: auto !important;\n\tmin-width: 0;\n\tmin-height: 0;\n\tbox-sizing: border-box;\n\tpadding: var(--cn-fill-margin, 0);\n}\n\n.cn-dashboard-grid--fill > .grid-stack > .grid-stack-item > .grid-stack-item-content {\n\tposition: relative !important;\n\tinset: auto !important;\n\theight: 100%;\n\toverflow: hidden auto;\n}\n\n/* `sideColumn`: an item on a track has its left edge and width follow its\n column on two scales, the columns before `--cn-side-from` sharing what the side column\n leaves, the columns after it sharing the side column's fixed width (the\n card plus its two item margins). GridStack writes `--gs-x` and `--gs-w` on\n every item and its own left and width inline, hence !important. */\n.cn-dashboard-grid--side-column > .grid-stack.gs-12:not(.grid-stack-rtl) > .grid-stack-item[data-cn-track] {\n\t--cn-side-cell: calc(var(--cn-side-width) + var(--gs-item-margin-left, 0px) + var(--gs-item-margin-right, 0px));\n\t--cn-main-col: calc((100% - var(--cn-side-cell)) / var(--cn-side-from));\n\t--cn-side-col: calc(var(--cn-side-cell) / var(--cn-side-span));\n\t/* stylelint-disable-next-line csstools/use-logical -- GridStack places a left-to-right item by `left`. */\n\tleft: calc(min(var(--gs-x), var(--cn-side-from)) * var(--cn-main-col) + max(var(--gs-x) - var(--cn-side-from), 0) * var(--cn-side-col)) !important;\n\twidth: calc((min(var(--gs-x) + var(--gs-w), var(--cn-side-from)) - min(var(--gs-x), var(--cn-side-from))) * var(--cn-main-col) + (max(var(--gs-x) + var(--gs-w) - var(--cn-side-from), 0) - max(var(--gs-x) - var(--cn-side-from), 0)) * var(--cn-side-col)) !important;\n}\n\n/* `columnWeights`: an item's left edge and width follow the weighted columns\n it spans, as fractions of the grid. GridStack writes its own left and width\n inline, hence !important. */\n.cn-dashboard-grid--weighted > .grid-stack.gs-12:not(.grid-stack-rtl) > .grid-stack-item[data-cn-weighted] {\n\t/* stylelint-disable-next-line csstools/use-logical -- GridStack places a left-to-right item by `left`. */\n\tleft: calc(var(--cn-weight-left) * 100%) !important;\n\twidth: calc(var(--cn-weight-width) * 100%) !important;\n}\n\n/* Screen-reader-only text: the keyboard key map and the live region. Kept in\n the layout (not `display: none`) so assistive tech still reads it. */\n.cn-dashboard-grid__sr-only {\n\tposition: absolute;\n\twidth: 1px;\n\theight: 1px;\n\tpadding: 0;\n\tmargin: -1px;\n\toverflow: hidden;\n\tclip-path: inset(50%);\n\twhite-space: nowrap;\n\tborder: 0;\n}\n\n/* Grid items become tab stops in edit mode — give them a visible focus ring\n that satisfies WCAG 2.1 SC 2.4.7 without relying on the widget's own\n styling. `outline-offset` keeps the ring outside the rounded card. */\n.grid-stack-item:focus-visible {\n\toutline: 2px solid var(--color-primary-element, #0082c9);\n\toutline-offset: 2px;\n\tborder-radius: var(--border-radius-container-large, 16px);\n}\n\n/* A stretched `sameHeight` card keeps its content at the top, as the boards\n draw a row of cards, not centred in the extra height. `.grid-stack-item`\n outranks the dashboard page's centring of a fitted card, which is as\n strong and loads later (DqProcesanalyse stat tiles).\n @spec openspec/changes/same-height-fit-card-content-top/specs/dashboard-grid/spec.md#requirement-a-stretched-fitted-card-keeps-its-content-at-the-top */\n.cn-dashboard-grid__item--same-height.grid-stack-item > :deep(.grid-stack-item-content > * > .cn-widget-wrapper__content) {\n\tjustify-content: flex-start;\n}\n\n/* A size-to-content cell (`sizeToContent`) is measured by GridStack from the\n content's first child, and a widget wrapper there filled the cell\n (`height: 100%`), so the measure returned the cell's own height and the\n cell never shrank: \"Waiting for me\" stayed a tall card around one row. In\n such a cell the child takes its own height. A cell without the key keeps\n the filling child. */\n.cn-dashboard-grid__item--fit > :deep(.grid-stack-item-content > *) {\n\theight: auto;\n}\n\n:deep(.grid-stack-item-content) {\n\tbackground: var(--color-main-background);\n\tborder: none;\n\tbox-shadow: none;\n\toverflow: hidden;\n}\n\n:deep(.grid-stack-item-content:has(.cn-widget-wrapper--borderless)) {\n\tbackground: transparent;\n}\n\n:deep(.grid-stack-placeholder > .placeholder-content) {\n\tbackground: var(--color-primary-element-light);\n\tborder: 2px dashed var(--color-primary-element);\n\tborder-radius: var(--border-radius-large);\n}\n</style>\n"],"names":["_createElementBlock","_createElementVNode","_Fragment","_renderList","_normalizeClass","_normalizeStyle","_renderSlot"],"mappings":";;;;AAoEG,MAAA,UAAA,GAAA,EAAA,KAAA,EAAA,yBAAA;;;;;;;;;uBAzCAA,kBAAA;AAAG,IAAA,GAAG,EAAC,eAAe;AACtB,IAAA,KAAI,kBAAC,mBAAgB,EAAA,EAAA,gCAAA,EACnB,wBAAA,KAAA,IAAA,EAAA,6BAAA,EAAA,QAAA,CAAA,YAAA,sCAAA,QAAA,CAAA,OAAA,EAAA,CAAA,CAAA;;;KASI,QAAA,CAAA,cAAc;yCAIjB,GAAA,EAAA;;AAHF,UAAA,EAAE,EAAE,QAAA,CAAA,iBAAiB;eACjB,EAAC;2BACH,QAAA,CAAA,gBAAa,CAAA,EAAA,CAAA,oBAAA,UAAA,CAAA;;IAGfC,kBAAA,CA8BC,KAAA,EAAA;AA9BE,MAAA,KAAK,EAAC,YAAY;AAAA,MAAA,KAAA,iBAAA,QAAA,CAAA,aAAA;;wBACrBD,kBAAA,CA4BKE,QAAA,EAAA,IAAA,EAAAC,UAAA,CA3BU,QAAA,CAAA,eAAI,EAAA,CAAZ,IAAI,KAAA;6BADXH,kBAAA,CA4BK,KAAA,EAAA;UA1BJ,GAAG,EAAE,QAAA,CAAA,cAAc,CAAC,IAAG,CAAA;UACxB,KAAK,EAAAI,cAAA,CAAA,CAAC,iBAAiB,EAAA,EAAA,8BAAA,EACmB,QAAA,CAAA,iBAAiB,CAAC,IAAG,CAAA,KAAO,SAAS,EAAA,sCAAA,EAAQ,QAAA,CAAA,eAAA,CAAA,IAAA,CAAA,EAAA,CAAA,CAAA;AACvF,UAAA,IAAI,EAAC,OAAO;UACX,YAAU,EAAE,yBAAgB,CAAC,IAAI,EAAC,MAAA,CAAA,MAAO,CAAC,OAAG,CAAA,IAAA,CAAA,CAAA;AAC7C,UAAA,kBAAgB,EAAE,QAAA,CAAA,eAAc;AAChC,UAAA,QAAQ,EAAE,QAAA,CAAA,YAAY;UACtB,OAAK,EAAE,IAAI,CAAC,EAAE;UACd,MAAI,EAAE,IAAI,CAAC,KAAK;AAChB,UAAA,MAAI,EAAE,QAAA,CAAA,SAAS,CAAC,IAAI,CAAC,KAAK,CAAA;gBACtB,EAAE,IAAI,CAAC,SAAS;AACpB,UAAA,MAAI,EAAE,QAAA,CAAA,SAAA,CAAA,IAAA,CAAA,UAAA,CAAA;AACN,UAAA,UAAI,EAAA,MAAA,CAAA,QAAA;UACJ,UAAG,EAAA,QAAA,CAAA,OAAA,CAAA,IAAA,CAAA;UACH,oBAAE,EAAA,QAAA,CAAA,iBAAA,CAAA,IAAA,CAAA;;AAEF,UAAA,kBAAA,EAAA,QAAA,CAAA,WAAA,CAAA,IAAA,SAAA,SAAA;AACA,UAAA,mBAAiB,EAAE,IAAI,CAAC,QAAQ,IAAI,SAAS;AAC7C,UAAA,WAAS,EAAC,IAAK,CAAC,KAAK,KAAA,IAAA,IAAA,CAAc,MAAA,CAAA,QAAQ,YAAY,SAAI;UAC3D,KAAK,EAAAC,cAAA,CAAE,QAAA,CAAA,SAAS,KAAK,CAAA,CAAA;AACtB,UAAA,SAAA,EAAA,MAAA,KAAA,QAAA,CAAA,aAAA,CAAA,MAAA,EAAA,IAAA,CAAA;;AACD,UAAAJ,kBAAA,CAIO,OAJP,UAIO,EAAA;YAHLK,UAAA,CAEO,IAAA,CAAA,MAAA,EAAA,QAAA,EAAA,EAFc,IAAI,EAAE,IAAI,EAAA;;;;;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../src/components/CnDividerWidget/index.js"],"sourcesContent":["import CnDividerWidgetForm from '../CnDividerWidgetForm/CnDividerWidgetForm.vue'\nimport CnDividerWidget from './CnDividerWidget.vue'\nimport { registerDashboardWidget } from '../CnWidgetGrid/dashboardWidgetRegistry.js'\n\nregisterDashboardWidget('divider', {\n\trenderer: CnDividerWidget,\n\tform: CnDividerWidgetForm,\n\tdefaultContent: {\n\t\tstyle: 'line',\n\t\tlineColor: '',\n\t\tlineThickness: 1,\n\t\tlineStyle: 'solid',\n\t\twhitespaceSize: 'medium',\n\t\theadingText: '',\n\t},\n\tdisplayName: 'Divider',\n\ticon: 'Minus',\n})\n\nexport { CnDividerWidget }\nexport default CnDividerWidget\n"],"names":["CnDividerWidget","CnDividerWidgetForm"],"mappings":";;;;AAIA,uBAAuB,CAAC,SAAS,EAAE;AACnC,CAAC,QAAQ,EAAEA,YAAe;AAC1B,CAAC,IAAI,EAAEC,UAAmB;AAC1B,CAAC,cAAc,EAAE;AACjB,EAAE,KAAK,EAAE,MAAM;AACf,EAAE,SAAS,EAAE,EAAE;AACf,EAAE,aAAa,EAAE,CAAC;AAClB,EAAE,SAAS,EAAE,OAAO;AACpB,EAAE,cAAc,EAAE,QAAQ;AAC1B,EAAE,WAAW,EAAE,EAAE;AACjB,EAAE;AACF,CAAC,WAAW,EAAE,SAAS;AACvB,CAAC,IAAI,EAAE,OAAO;AACd,CAAC;;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/components/CnDividerWidget/index.js"],"sourcesContent":["import CnDividerWidgetForm from '../CnDividerWidgetForm/CnDividerWidgetForm.vue'\nimport CnDividerWidget from './CnDividerWidget.vue'\nimport { registerDashboardWidget } from '../CnWidgetGrid/dashboardWidgetRegistry.js'\n\nregisterDashboardWidget('divider', {\n\trenderer: CnDividerWidget,\n\tform: CnDividerWidgetForm,\n\tdefaultContent: {\n\t\tstyle: 'line',\n\t\tlineColor: '',\n\t\tlineThickness: 1,\n\t\tlineStyle: 'solid',\n\t\twhitespaceSize: 'medium',\n\t\theadingText: '',\n\t},\n\tdisplayName: 'Divider',\n\ticon: 'Minus',\n\tminHeight: 1,\n})\n\nexport { CnDividerWidget }\nexport default CnDividerWidget\n"],"names":["CnDividerWidget","CnDividerWidgetForm"],"mappings":";;;;AAIA,uBAAuB,CAAC,SAAS,EAAE;AACnC,CAAC,QAAQ,EAAEA,YAAe;AAC1B,CAAC,IAAI,EAAEC,UAAmB;AAC1B,CAAC,cAAc,EAAE;AACjB,EAAE,KAAK,EAAE,MAAM;AACf,EAAE,SAAS,EAAE,EAAE;AACf,EAAE,aAAa,EAAE,CAAC;AAClB,EAAE,SAAS,EAAE,OAAO;AACpB,EAAE,cAAc,EAAE,QAAQ;AAC1B,EAAE,WAAW,EAAE,EAAE;AACjB,EAAE;AACF,CAAC,WAAW,EAAE,SAAS;AACvB,CAAC,IAAI,EAAE,OAAO;AACd,CAAC,SAAS,EAAE,CAAC;AACb,CAAC;;"}
|
|
@@ -2,7 +2,7 @@ import script from './CnFilesWidget2.vue.js';
|
|
|
2
2
|
import { render } from './CnFilesWidget3.vue.js';
|
|
3
3
|
|
|
4
4
|
script.render = render;
|
|
5
|
-
script.__scopeId = "data-v-
|
|
5
|
+
script.__scopeId = "data-v-38d9d1a2";
|
|
6
6
|
const __sfc_main = script;
|
|
7
7
|
|
|
8
8
|
export { __sfc_main as default };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { translate } from '@nextcloud/l10n';
|
|
1
|
+
import { translate, translatePlural } from '@nextcloud/l10n';
|
|
2
2
|
import { generateUrl } from '@nextcloud/router';
|
|
3
3
|
import __sfc_main from '../../dialogs/CnFilesWidgetDeleteDialog.vue.js';
|
|
4
4
|
import __sfc_main$1 from '../CnFilePreview/CnFilePreview.vue.js';
|
|
@@ -155,6 +155,13 @@ var script = {
|
|
|
155
155
|
isDragging: false,
|
|
156
156
|
// Depth counter so nested dragenter/dragleave don't flicker the overlay.
|
|
157
157
|
dragDepth: 0,
|
|
158
|
+
// The files of the current or last upload batch, each
|
|
159
|
+
// `{ name, size, loaded, status, error }` with status `queued`,
|
|
160
|
+
// `uploading`, `done` or `failed`.
|
|
161
|
+
uploads: [],
|
|
162
|
+
uploading: false,
|
|
163
|
+
// Why the last delete was refused, shown until dismissed.
|
|
164
|
+
deleteNotice: null,
|
|
158
165
|
}
|
|
159
166
|
},
|
|
160
167
|
|
|
@@ -254,9 +261,35 @@ var script = {
|
|
|
254
261
|
* @return {boolean} `true` unless `content.showThumbnails` is explicitly false.
|
|
255
262
|
*/
|
|
256
263
|
showThumbnails() {
|
|
264
|
+
// Tree mode lists names only, whatever `showThumbnails` says.
|
|
265
|
+
if (this.content?.viewMode === 'tree') {
|
|
266
|
+
return false
|
|
267
|
+
}
|
|
257
268
|
return this.content?.showThumbnails !== false
|
|
258
269
|
},
|
|
259
270
|
|
|
271
|
+
/**
|
|
272
|
+
* The batch line above the upload list: bytes sent of the total while
|
|
273
|
+
* uploading, then how many files arrived.
|
|
274
|
+
*
|
|
275
|
+
* @return {string} the label.
|
|
276
|
+
*/
|
|
277
|
+
uploadTotalLabel() {
|
|
278
|
+
const total = this.uploads.reduce((sum, upload) => sum + upload.size, 0);
|
|
279
|
+
if (this.uploading) {
|
|
280
|
+
const loaded = this.uploads.reduce((sum, upload) => sum + upload.loaded, 0);
|
|
281
|
+
return translate('nextcloud-vue', 'Uploading {loaded} / {total}', {
|
|
282
|
+
loaded: this.formatSize(loaded),
|
|
283
|
+
total: this.formatSize(total),
|
|
284
|
+
})
|
|
285
|
+
}
|
|
286
|
+
const failed = this.uploads.filter((upload) => upload.status === 'failed').length;
|
|
287
|
+
if (failed > 0) {
|
|
288
|
+
return translatePlural('nextcloud-vue', '{count} file could not be uploaded', '{count} files could not be uploaded', failed, { count: failed })
|
|
289
|
+
}
|
|
290
|
+
return translate('nextcloud-vue', 'Upload complete')
|
|
291
|
+
},
|
|
292
|
+
|
|
260
293
|
/**
|
|
261
294
|
* Heuristic write-permission check: an empty folder optimistically
|
|
262
295
|
* surfaces the upload button (the backend re-validates), otherwise at
|
|
@@ -701,6 +734,7 @@ var script = {
|
|
|
701
734
|
if (!target) {
|
|
702
735
|
return
|
|
703
736
|
}
|
|
737
|
+
this.deleteNotice = null;
|
|
704
738
|
try {
|
|
705
739
|
const { default: axios } = await import('@nextcloud/axios');
|
|
706
740
|
|
|
@@ -715,7 +749,10 @@ var script = {
|
|
|
715
749
|
);
|
|
716
750
|
await axios.delete(url);
|
|
717
751
|
this.items = this.items.filter((item) => item.fileId !== target.fileId);
|
|
718
|
-
} catch {
|
|
752
|
+
} catch (err) {
|
|
753
|
+
this.deleteNotice = err?.response?.status === 403
|
|
754
|
+
? translate('nextcloud-vue', 'You no longer have permission to delete {name}.', { name: target.name })
|
|
755
|
+
: translate('nextcloud-vue', 'Could not delete {name}.', { name: target.name });
|
|
719
756
|
this.fetchContents();
|
|
720
757
|
} finally {
|
|
721
758
|
this.confirmTarget = null;
|
|
@@ -761,32 +798,148 @@ var script = {
|
|
|
761
798
|
}
|
|
762
799
|
|
|
763
800
|
const formData = new FormData();
|
|
801
|
+
const files = [];
|
|
764
802
|
for (let i = 0; i < fileList.length; i++) {
|
|
765
803
|
formData.append('files[]', fileList[i]);
|
|
804
|
+
files.push(fileList[i]);
|
|
766
805
|
}
|
|
806
|
+
this.uploads = files.map((file) => ({ name: file.name, size: Number(file.size) || 0, loaded: 0, status: 'queued', error: '' }));
|
|
807
|
+
this.uploading = true;
|
|
808
|
+
const onUploadProgress = (event) => this.trackUploadProgress(event);
|
|
767
809
|
|
|
768
810
|
try {
|
|
769
811
|
const { default: axios } = await import('@nextcloud/axios');
|
|
770
812
|
|
|
813
|
+
let response;
|
|
771
814
|
if (this.objectBound) {
|
|
772
815
|
const objectUrl = generateUrl(
|
|
773
816
|
`${this.objectApiBase}/objects/{register}/{schema}/{objectId}/filesMultipart`,
|
|
774
817
|
{ register: this.register, schema: this.schemaSlug, objectId: this.objectId },
|
|
775
818
|
);
|
|
776
|
-
await axios.post(objectUrl, formData);
|
|
819
|
+
response = await axios.post(objectUrl, formData, { onUploadProgress });
|
|
777
820
|
} else {
|
|
778
821
|
const url = generateUrl(
|
|
779
822
|
`${this.apiBase}/api/widgets/files/{placementId}/upload`,
|
|
780
823
|
{ placementId: this.placementId },
|
|
781
824
|
);
|
|
782
|
-
await axios.post(url, formData, {
|
|
825
|
+
response = await axios.post(url, formData, {
|
|
783
826
|
params: { currentPath: this.currentSubPath },
|
|
827
|
+
onUploadProgress,
|
|
784
828
|
});
|
|
785
829
|
}
|
|
830
|
+
this.settleUploads(Array.isArray(response?.data?.errors) ? response.data.errors : []);
|
|
786
831
|
this.fetchContents();
|
|
787
|
-
} catch {
|
|
832
|
+
} catch (err) {
|
|
833
|
+
const reason = this.uploadErrorLabel(err?.response?.data?.error);
|
|
834
|
+
this.uploads = this.uploads.map((upload) => ({ ...upload, status: 'failed', error: reason }));
|
|
788
835
|
this.fetchContents();
|
|
836
|
+
} finally {
|
|
837
|
+
this.uploading = false;
|
|
838
|
+
}
|
|
839
|
+
},
|
|
840
|
+
|
|
841
|
+
/**
|
|
842
|
+
* Spread the batch's sent bytes over its files in upload order: the
|
|
843
|
+
* files before the byte count are done sending, the one it falls in is
|
|
844
|
+
* uploading, the rest are queued.
|
|
845
|
+
*
|
|
846
|
+
* @param {{loaded: number, total?: number}} event axios' upload progress.
|
|
847
|
+
* @return {void}
|
|
848
|
+
*/
|
|
849
|
+
trackUploadProgress(event) {
|
|
850
|
+
const size = this.uploads.reduce((sum, upload) => sum + upload.size, 0);
|
|
851
|
+
const total = Number(event?.total) || size;
|
|
852
|
+
const scale = total > 0 ? size / total : 0;
|
|
853
|
+
let remaining = Number(event?.loaded || 0) * scale;
|
|
854
|
+
this.uploads = this.uploads.map((upload) => {
|
|
855
|
+
const loaded = Math.max(0, Math.min(upload.size, remaining));
|
|
856
|
+
remaining -= upload.size;
|
|
857
|
+
let status = 'queued';
|
|
858
|
+
if (loaded >= upload.size && upload.size > 0) {
|
|
859
|
+
status = 'done';
|
|
860
|
+
} else if (loaded > 0) {
|
|
861
|
+
status = 'uploading';
|
|
862
|
+
}
|
|
863
|
+
return { ...upload, loaded, status }
|
|
864
|
+
});
|
|
865
|
+
},
|
|
866
|
+
|
|
867
|
+
/**
|
|
868
|
+
* Mark the batch finished: a file the host names in `errors`
|
|
869
|
+
* (`{ name, error }`) failed with that reason, every other one arrived.
|
|
870
|
+
*
|
|
871
|
+
* @param {Array<{name: string, error?: string}>} errors the host's per-file errors.
|
|
872
|
+
* @return {void}
|
|
873
|
+
*/
|
|
874
|
+
settleUploads(errors) {
|
|
875
|
+
const byName = new Map(errors.map((entry) => [String(entry?.name ?? ''), entry]));
|
|
876
|
+
this.uploads = this.uploads.map((upload) => {
|
|
877
|
+
const entry = byName.get(upload.name);
|
|
878
|
+
if (entry) {
|
|
879
|
+
return { ...upload, status: 'failed', error: this.uploadErrorLabel(entry.error) }
|
|
880
|
+
}
|
|
881
|
+
return { ...upload, loaded: upload.size, status: 'done', error: '' }
|
|
882
|
+
});
|
|
883
|
+
},
|
|
884
|
+
|
|
885
|
+
/**
|
|
886
|
+
* The reason shown for a file that did not upload, from the host's code.
|
|
887
|
+
*
|
|
888
|
+
* @param {string|undefined} code the error code (`insufficient_storage`, …).
|
|
889
|
+
* @return {string} the localised reason.
|
|
890
|
+
*/
|
|
891
|
+
uploadErrorLabel(code) {
|
|
892
|
+
if (code === 'insufficient_storage') {
|
|
893
|
+
return translate('nextcloud-vue', 'Not enough storage space')
|
|
894
|
+
}
|
|
895
|
+
if (code === 'no_access' || code === 'forbidden') {
|
|
896
|
+
return translate('nextcloud-vue', 'You may not upload to this folder')
|
|
897
|
+
}
|
|
898
|
+
if (code === 'mime_type_not_allowed' || code === 'mime_not_allowed') {
|
|
899
|
+
return translate('nextcloud-vue', 'This file type is not allowed here')
|
|
900
|
+
}
|
|
901
|
+
return translate('nextcloud-vue', 'Upload failed')
|
|
902
|
+
},
|
|
903
|
+
|
|
904
|
+
/**
|
|
905
|
+
* The percentage of one file sent, for its progress bar.
|
|
906
|
+
*
|
|
907
|
+
* @param {object} upload an entry of `uploads`.
|
|
908
|
+
* @return {number} 0 to 100.
|
|
909
|
+
*/
|
|
910
|
+
uploadPercent(upload) {
|
|
911
|
+
if (upload.status === 'done') {
|
|
912
|
+
return 100
|
|
789
913
|
}
|
|
914
|
+
return upload.size > 0 ? Math.round((upload.loaded / upload.size) * 100) : 0
|
|
915
|
+
},
|
|
916
|
+
|
|
917
|
+
/**
|
|
918
|
+
* The status text of one file in the upload list.
|
|
919
|
+
*
|
|
920
|
+
* @param {object} upload an entry of `uploads`.
|
|
921
|
+
* @return {string} the label.
|
|
922
|
+
*/
|
|
923
|
+
uploadStatusLabel(upload) {
|
|
924
|
+
if (upload.status === 'failed') {
|
|
925
|
+
return upload.error
|
|
926
|
+
}
|
|
927
|
+
if (upload.status === 'done') {
|
|
928
|
+
return this.uploading ? translate('nextcloud-vue', 'Sent') : translate('nextcloud-vue', 'Uploaded')
|
|
929
|
+
}
|
|
930
|
+
if (upload.status === 'uploading') {
|
|
931
|
+
return translate('nextcloud-vue', 'Uploading {percent}%', { percent: this.uploadPercent(upload) })
|
|
932
|
+
}
|
|
933
|
+
return translate('nextcloud-vue', 'Queued')
|
|
934
|
+
},
|
|
935
|
+
|
|
936
|
+
/**
|
|
937
|
+
* Clear a finished upload list.
|
|
938
|
+
*
|
|
939
|
+
* @return {void}
|
|
940
|
+
*/
|
|
941
|
+
dismissUploads() {
|
|
942
|
+
this.uploads = [];
|
|
790
943
|
},
|
|
791
944
|
|
|
792
945
|
/**
|