@michaelthielemann/kestrel 2.1.0 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. package/README.md +2 -1
  2. package/layers/admin/app/components/AdminAccount.vue +3 -3
  3. package/layers/admin/app/components/AdminNav.vue +1 -1
  4. package/layers/admin/app/components/BlockFields.vue +2 -2
  5. package/layers/admin/app/components/BlockPreview.vue +8 -8
  6. package/layers/admin/app/components/BlockTree.vue +10 -10
  7. package/layers/admin/app/components/BlocksBody.vue +4 -4
  8. package/layers/admin/app/components/CollectionDeleteDialog.vue +7 -7
  9. package/layers/admin/app/components/CollectionEditor.vue +3 -3
  10. package/layers/admin/app/components/CollectionList.vue +91 -792
  11. package/layers/admin/app/components/CollectionListBulkBar.vue +48 -0
  12. package/layers/admin/app/components/CollectionListColumnsPanel.vue +37 -0
  13. package/layers/admin/app/components/CollectionListFilterPanel.vue +145 -0
  14. package/layers/admin/app/components/CollectionListPager.vue +70 -0
  15. package/layers/admin/app/components/CollectionListTable.vue +308 -0
  16. package/layers/admin/app/components/EditorStatus.vue +4 -4
  17. package/layers/admin/app/components/FieldsBody.vue +1 -1
  18. package/layers/admin/app/components/LocaleBar.vue +4 -4
  19. package/layers/admin/app/components/PageFields.vue +12 -12
  20. package/layers/admin/app/components/PageFieldsPane.vue +2 -2
  21. package/layers/admin/app/components/SeoFields.vue +19 -19
  22. package/layers/admin/app/components/SingletonEditor.vue +7 -7
  23. package/layers/admin/app/composables/useListBatchActions.ts +61 -0
  24. package/layers/admin/app/composables/useListFilterDraft.ts +128 -0
  25. package/layers/admin/app/composables/useListRows.ts +70 -0
  26. package/layers/admin/app/composables/useListSelection.ts +28 -0
  27. package/layers/admin/app/composables/useToolbarPanel.ts +38 -0
  28. package/layers/admin/app/layouts/admin.vue +7 -7
  29. package/layers/admin/app/pages/admin/[collection]/[id].nuxt.test.ts +2 -2
  30. package/layers/admin/app/pages/admin/[collection]/[id].vue +11 -11
  31. package/layers/admin/app/pages/admin/[collection]/index.vue +2 -2
  32. package/layers/admin/app/pages/admin/[collection]/publish-preview.nuxt.test.ts +1 -1
  33. package/layers/admin/app/pages/admin/index.vue +3 -3
  34. package/layers/admin/app/pages/admin/login.vue +6 -6
  35. package/layers/admin/app/pages/admin/media.vue +1 -1
  36. package/layers/admin/app/pages/admin/references.vue +3 -3
  37. package/layers/admin/app/utils/list-cell.ts +46 -0
  38. package/layers/admin/nuxt.config.ts +3 -0
  39. package/layers/core/modules/component-namespace/index.ts +20 -0
  40. package/layers/core/modules/component-namespace/shared.ts +24 -0
  41. package/layers/core/nuxt.config.ts +1 -0
  42. package/layers/core/server/utils/defineCollection.ts +0 -1
  43. package/layers/core/server/utils/serialize-collection.ts +0 -2
  44. package/layers/fields/app/utils/field-factories.ts +1 -1
  45. package/layers/media/app/components/MediaConflictDialog.vue +7 -7
  46. package/layers/media/app/components/MediaDeleteDialog.vue +5 -5
  47. package/layers/media/app/components/MediaGrid.vue +3 -3
  48. package/layers/media/app/components/MediaLibrary.vue +20 -20
  49. package/layers/media/app/components/MediaNewFolderDialog.vue +7 -7
  50. package/layers/media/app/components/MediaPathBar.vue +1 -1
  51. package/layers/media/app/components/MediaPicker.vue +3 -3
  52. package/layers/media/app/components/MediaRenameDialog.vue +8 -8
  53. package/layers/media/app/components/MediaTable.vue +2 -2
  54. package/layers/media/app/components/MediaToolbar.vue +4 -4
  55. package/layers/media/app/components/MediaUploadDialog.vue +9 -9
  56. package/layers/media/app/components/MediaViewer.vue +14 -14
  57. package/layers/media/app/components/field/Media.vue +9 -9
  58. package/layers/media/app/plugins/field-media.client.ts +3 -3
  59. package/layers/media/nuxt.config.ts +5 -1
  60. package/layers/public/app/pages/[...slug].vue +2 -2
  61. package/layers/public/app/pages/__kestrel/preview.vue +1 -1
  62. package/layers/public/nuxt.config.ts +3 -0
  63. package/layers/ui/app/components/field/DeadRefNote.vue +1 -1
  64. package/layers/ui/app/components/field/Slug.vue +2 -2
  65. package/layers/ui/app/components/ui/Button.vue +1 -1
  66. package/layers/ui/app/components/ui/EmptyState.vue +1 -1
  67. package/layers/ui/app/components/ui/TextInput.vue +1 -1
  68. package/layers/ui/app/components/ui/Toasts.vue +1 -1
  69. package/layers/ui/app/composables/useToast.ts +1 -1
  70. package/layers/ui/nuxt.config.ts +5 -1
  71. package/package.json +1 -1
@@ -1,13 +1,6 @@
1
1
  <script setup lang="ts">
2
2
  import type { SerializedCollection } from '../../../core/server/utils/serialize-collection'
3
- import type { Localized } from '../../../core/server/utils/defineCollection'
4
- import { sortDirection, type FilterCell } from '../utils/list-query'
5
- import type { ListColumn } from '../utils/list-columns'
6
- import { PER_PAGE_OPTIONS } from '../../../core/app/utils/list-limits'
7
- import type { BatchDeleteReport } from '../utils/collection-ops'
8
- import { OPS_BY_KIND, DEFAULT_OP, type FilterKind, type FilterOp } from '../../../core/app/utils/filter-ops'
9
3
  import { resolveLocalized } from '../../../ui/app/utils/localized'
10
- import { humanizeFieldName } from '../../../ui/app/utils/humanize'
11
4
 
12
5
  // `locale` is set only for a translatable collection: it filters the list to that content locale and
13
6
  // shows a locale switcher. New records / row links carry it so they open in the same locale.
@@ -28,10 +21,6 @@ const { available, visibleColumns, visibleKeys, toggle: toggleColumn, reset: res
28
21
  useListColumns(toRef(props, 'schema'))
29
22
  const filterableColumns = computed(() => available.value.filter((c) => c.filterable))
30
23
 
31
- function colLabel(col: ListColumn): string {
32
- return col.type === 'field' ? humanizeFieldName(col.name ?? col.key) : t(col.labelKey ?? col.key)
33
- }
34
-
35
24
  // The URL is the single source of truth for committed list state. `sort`/`page`/`perPage`/`filter` are
36
25
  // derived (read-only) computeds off `route.query`; `effectiveQuery` is the sanitized `$fetch` query; the
37
26
  // setters navigate (page → push so Back walks pages, the rest → replace). The composable also owns the
@@ -39,231 +28,34 @@ function colLabel(col: ListColumn): string {
39
28
  const { sort, page, perPage, filter, effectiveQuery, setSort, setPage, clampPage, setPerPage, setFilter } =
40
29
  useListUrlState(available)
41
30
 
42
- // `filter` (above, from the URL) = the committed clauses that drive the query. `draft` = the panel's pending
43
- // edits, kept local and seeded per filterable column below (keyed by column key { op, value }).
44
- const draft = reactive<Record<string, FilterCell>>({})
45
-
46
- // Overwrite each draft cell FROM the committed `filter` so deep-link / Back-Forward / chip-removal reflect
47
- // back into the open panel; drop drafts for columns this collection no longer has. We key the watch on the
48
- // committed filter's CONTENT (its JSON), not its object identity: `filter` recomputes to a fresh-but-EQUAL
49
- // object on every `route.query` change (page/sort/perPage navigations too), and resyncing on those identity
50
- // flips would wipe an in-progress panel edit. Clobber-safe on a real filter commit: a commit sends ALL
51
- // drafts at once, so post-commit `filter` equals `draft` (a no-op overwrite) — the content only actually
52
- // changes on external navigation (deep-link/Back-Forward/chip-removal), which is when the panel should resync.
53
- watch([filterableColumns, () => JSON.stringify(filter.value)], () => {
54
- const cols = filterableColumns.value
55
- for (const c of cols) {
56
- const cm = filter.value[c.key]
57
- draft[c.key] = { op: cm?.op ?? DEFAULT_OP[c.filterKind ?? 'text'], value: cm?.value ?? '' }
58
- }
59
- for (const key of Object.keys(draft)) if (!cols.some((c) => c.key === key)) Reflect.deleteProperty(draft, key)
60
- }, { immediate: true })
61
-
62
- function opsFor(c: ListColumn): readonly FilterOp[] {
63
- return OPS_BY_KIND[c.filterKind ?? 'text']
64
- }
65
- // Operator labels are kind-aware: a datetime comparison reads "before / on or before / …" instead of the
66
- // generic "less than / less or equal / …".
67
- function opLabel(kind: FilterKind, op: FilterOp): string {
68
- if (kind === 'datetime' && (op === 'lt' || op === 'lte' || op === 'gt' || op === 'gte')) return t(`filter.opDate.${op}`)
69
- return t(`filter.op.${op}`)
70
- }
71
- // Choices for an `enum` / `stringSet` value control: a fixed draft/published set for `status`, else the
72
- // choice field's own (single- and multi-choice fields both carry `options.choices`).
73
- function enumOptions(c: ListColumn): { label: string; value: string }[] {
74
- if (c.key === 'status') return [
75
- { value: 'draft', label: t('pageSettings.statusDraft') },
76
- { value: 'published', label: t('pageSettings.statusPublished') },
77
- ]
78
- // A choice label is `Localized`, so resolve it here as the editor widget does — `{{ o.label }}` would
79
- // stringify a `{ en, de }` map into the filter dropdown.
80
- return ((c.field?.options?.choices ?? []) as { label: Localized; value: string }[])
81
- .map((o) => ({ value: o.value, label: resolveLocalized(o.label, lang.value) ?? o.value }))
82
- }
83
- function displayValue(kind: FilterKind, value: string): string {
84
- if (kind === 'boolean') return value === 'true' ? t('filter.bool.true') : value === 'false' ? t('filter.bool.false') : value
85
- return value
86
- }
87
-
88
- const rows = ref<Record<string, unknown>[]>([])
89
- const total = ref(0)
90
- // Surfaced when a (re)fetch fails — an inline error + Retry, never a silent stale list or a thrown
91
- // error boundary. Distinct from the empty state (which only shows when the fetch SUCCEEDED with no rows).
92
- const error = ref<string | null>(null)
93
-
94
- const toast = useToast()
95
-
96
- // ── Page-scoped row selection ──────────────────────────────────────────────────────────────────────
97
- // A Set of selected row ids, valid only for the rows currently on screen (cleared on every fetch). The
98
- // header checkbox is select-all-on-this-page with a tri-state (some-but-not-all) indeterminate marker.
99
- // A reactive Set (Vue tracks add/delete/has/size), so a single-row toggle is O(1) — no full-Set copy or
100
- // whole-table re-diff on each click, which mattered at the 500-row page cap.
101
- const selected = reactive(new Set<number>())
102
- const pageIds = computed(() => rows.value.map((r) => Number(r.id)))
103
- const allSelected = computed(() => pageIds.value.length > 0 && pageIds.value.every((id) => selected.has(id)))
104
- const headerIndeterminate = computed(() => pageIds.value.some((id) => selected.has(id)) && !allSelected.value)
105
- function toggleRow(id: number, on: boolean) {
106
- if (on) selected.add(id)
107
- else selected.delete(id)
108
- }
109
- function toggleAll(on: boolean) {
110
- selected.clear()
111
- if (on) for (const id of pageIds.value) selected.add(id)
112
- }
113
- function clearSelection() {
114
- selected.clear()
115
- }
116
- // A row's human label: the first visible non-sidecar cell that has a value, else the bare id — used for
117
- // the per-row checkbox / action aria-labels so each control names its row.
118
- function rowLabel(row: Record<string, unknown>): string {
119
- for (const c of visibleColumns.value) {
120
- if (c.type === 'translations' || c.type === 'deadRefs') continue
121
- const d = cellDisplay(c, row)
122
- if (d) return d
123
- }
124
- return `#${row.id}`
125
- }
126
-
127
- // ── Batch operations (row action = 1 id, bulk bar = N ids; the server does the batching) ─────────────
128
- const { busy: opsBusy, error: opsError, previewDelete, confirmDelete: runDelete, duplicate: runDuplicate, setStatus: runSetStatus } =
129
- useCollectionOps(collection, () => fetchRows())
130
-
131
- const deleteOpen = ref(false)
132
- const deleteReport = ref<BatchDeleteReport | null>(null)
133
- const deleteIds = ref<number[]>([])
134
-
135
- // Destructive → confirm dialog. The referrer preview is best-effort: if it fails we still open the dialog
136
- // with a bare summary (never block a delete on the warning lookup).
137
- async function askDelete(ids: number[]) {
138
- if (!ids.length) return
139
- deleteIds.value = ids
140
- deleteReport.value = null
141
- deleteOpen.value = true
142
- try {
143
- deleteReport.value = await previewDelete(ids)
144
- } catch {
145
- // The referrer lookup FAILED — do not fabricate a "no inbound links" report (that would look exactly
146
- // like a verified-safe delete). Flag `checked: false` so the dialog cautions the check couldn't run.
147
- deleteReport.value = { count: ids.length, referencedCount: 0, referenced: [], checked: false }
148
- opsError.value = null
149
- }
150
- }
151
- async function confirmDelete() {
152
- try {
153
- await runDelete(deleteIds.value)
154
- toast.success(t('toast.deleted'))
155
- deleteOpen.value = false
156
- } catch {
157
- // error stays surfaced in the dialog via opsError
158
- }
159
- }
160
- // Non-destructive / reversible → no dialog: run, toast, refetch (the composable's onChanged).
161
- async function onDuplicate(id: number) {
162
- try {
163
- await runDuplicate([id])
164
- toast.success(t('toast.duplicated'))
165
- } catch {
166
- toast.error(opsError.value ?? t('list.opFailed'))
167
- }
168
- }
169
- async function onBulkStatus(status: 'published' | 'draft') {
170
- try {
171
- await runSetStatus([...selected], status)
172
- toast.success(status === 'published' ? t('toast.published') : t('toast.unpublished'))
173
- } catch {
174
- toast.error(opsError.value ?? t('list.opFailed'))
175
- }
176
- }
31
+ // `filter` (above, from the URL) = the committed clauses that drive the query; the panel's pending edits
32
+ // live in `draft` inside the composable, which also owns the debounce and the chip model.
33
+ const filterDraft = useListFilterDraft({ available, filterableColumns, filter, setFilter })
34
+ const activeFilters = filterDraft.activeFilters
35
+
36
+ const { rows, total, error, totalPages, fetchRows } = useListRows({
37
+ collection,
38
+ effectiveQuery,
39
+ locale: () => props.locale,
40
+ page,
41
+ perPage,
42
+ clampPage,
43
+ // Selection is PAGE-SCOPED: any (re)fetch — page, filter, sort, per-page — replaces the visible rows, so
44
+ // the previous selection no longer maps to what's on screen. (A locale switch remounts the whole
45
+ // component, so that case clears too.)
46
+ onLoaded: () => clearSelection(),
47
+ })
177
48
 
178
- // Monotonic request id: a slow earlier response must not overwrite a newer one.
179
- let seq = 0
180
- async function fetchRows() {
181
- const mine = ++seq
182
- try {
183
- const res = await $fetch<{ data: Record<string, unknown>[]; total: number; page: number; perPage: number }>(
184
- `/api/${collection.value}`,
185
- { query: { ...effectiveQuery.value, ...(props.locale ? { locale: props.locale } : {}) } },
186
- )
187
- if (mine !== seq) return
188
- rows.value = res.data
189
- total.value = res.total
190
- error.value = null
191
- // A page that emptied out from under us — e.g. bulk-deleting the last rows of the trailing page —
192
- // would otherwise strand the user on an out-of-range page showing the "create your first" empty
193
- // state. Clamp back to the last page that still has rows (REPLACE, so the dead page isn't left as a
194
- // history entry that Back would bounce off; the query watch refetches).
195
- if (res.data.length === 0 && res.total > 0 && page.value > 1) {
196
- clampPage(Math.max(1, Math.ceil(res.total / perPage.value)))
197
- }
198
- // Selection is PAGE-SCOPED: any (re)fetch — page, filter, sort, per-page — replaces the visible rows,
199
- // so the previous selection no longer maps to what's on screen. Clear it. (A locale switch remounts
200
- // the whole component, so that case clears too.)
201
- selected.clear()
202
- } catch (e) {
203
- if (mine !== seq) return
204
- // Keep any previously-rendered rows, but surface that this fetch failed (and don't show the
205
- // "create your first" empty state — that would imply the collection is empty when it isn't).
206
- error.value = (e as { statusMessage?: string })?.statusMessage ?? t('list.loadError')
207
- }
208
- }
49
+ const { selected, allSelected, headerIndeterminate, toggleRow, toggleAll, clear: clearSelection } =
50
+ useListSelection(rows)
209
51
 
210
- const totalPages = computed(() => Math.max(1, Math.ceil(total.value / perPage.value)))
211
- // The per-page `<select>` is hand-rolled directly in this template (no UiField/UiCheckbox wrapper), so the
212
- // label↔control association needs an explicit pair for static a11y analysis to see it.
213
- const perPageId = useId()
52
+ // Row action = 1 id, bulk bar = N ids; the server does the batching.
53
+ const { busy: opsBusy, error: opsError, deleteOpen, deleteReport, askDelete, confirmDelete, duplicate: onDuplicate, setStatus } =
54
+ useListBatchActions(collection, fetchRows)
214
55
 
215
- // Filters: edited in the Filter panel (a value change debounces; an operator change commits at once), shown
216
- // as removable chips in the bar. `commitDrafts` builds a fresh clause map from the non-empty draft cells and
217
- // navigates via `setFilter` (which also resets page → 1).
218
- let filterTimer: ReturnType<typeof setTimeout> | undefined
219
- function commitDrafts() {
220
- const next: Record<string, FilterCell> = {}
221
- for (const [field, cell] of Object.entries(draft)) {
222
- if (cell.value !== '' && cell.value != null) next[field] = { op: cell.op, value: cell.value }
223
- }
224
- setFilter(next)
225
- }
226
- function setValue(field: string, value: string) {
227
- if (draft[field]) draft[field].value = value
228
- clearTimeout(filterTimer)
229
- filterTimer = setTimeout(commitDrafts, 250)
230
- }
231
- function setOp(field: string, op: FilterOp) {
232
- if (draft[field]) draft[field].op = op
233
- // An operator change is deliberate — re-query immediately (no debounce) if the field has a value.
234
- clearTimeout(filterTimer)
235
- commitDrafts()
236
- }
237
- function clearFilter(field: string) {
238
- if (draft[field]) draft[field].value = ''
239
- commitDrafts() // re-commits the drafts with this one now empty → the clause is dropped (and page → 1)
240
- }
241
- function clearAllFilters() {
242
- for (const cell of Object.values(draft)) cell.value = ''
243
- setFilter({}) // clear the committed clauses (and page → 1); the draft-resync watch clears the panel
244
- }
245
- const activeFilters = computed(() => Object.entries(filter.value).map(([key, cell]) => {
246
- const col = available.value.find((c) => c.key === key)
247
- const kind = col?.filterKind ?? 'text'
248
- return { key, op: cell.op, opLabel: opLabel(kind, cell.op), label: col ? colLabel(col) : key, display: displayValue(kind, cell.value) }
249
- }))
250
- onBeforeUnmount(() => clearTimeout(filterTimer))
56
+ // Toolbar popovers (filter / columns), including the outside-click and Escape-restores-focus behaviour.
57
+ const { container: toolsRef, open: openPanel, toggle: togglePanel } = useToolbarPanel<'filter' | 'columns'>()
251
58
 
252
- function prev() {
253
- if (page.value > 1) setPage(page.value - 1)
254
- }
255
- function next() {
256
- if (page.value < totalPages.value) setPage(page.value + 1)
257
- }
258
- function arrow(field: string) {
259
- const dir = sortDirection(sort.value, field)
260
- return dir === 'asc' ? ' ▲' : dir === 'desc' ? ' ▼' : ''
261
- }
262
- // Programmatic sort state for AT (the visual arrow is aria-hidden) — WCAG 1.3.1 / 4.1.2.
263
- function ariaSort(field: string): 'ascending' | 'descending' | 'none' {
264
- const dir = sortDirection(sort.value, field)
265
- return dir === 'asc' ? 'ascending' : dir === 'desc' ? 'descending' : 'none'
266
- }
267
59
  // Polite status announced after every (re)fetch so filter/sort/page changes report their result count
268
60
  // to screen readers — WCAG 4.1.3 Status Messages.
269
61
  const resultsLabel = computed(() => t(total.value === 1 ? 'list.result' : 'list.results', { total: total.value }))
@@ -273,74 +65,6 @@ const resultsLabel = computed(() => t(total.value === 1 ? 'list.result' : 'list.
273
65
  // which would silence the first selection. Selection takes precedence; with none, it reports the count.
274
66
  const srStatus = computed(() => (selected.size ? t('list.selected', { n: selected.size }) : resultsLabel.value))
275
67
 
276
- const dateFmt = new Intl.DateTimeFormat(undefined, { year: 'numeric', month: 'short', day: '2-digit' })
277
- // A date-only value ('YYYY-MM-DD', from a datetime field with precision 'date') parses as UTC midnight;
278
- // formatting it in the local zone would shift the calendar day, so pin it to UTC. Full ISO timestamps
279
- // (createdAt/updatedAt carry a 'Z') and local datetimes keep the local-zone formatter.
280
- const dateOnlyFmt = new Intl.DateTimeFormat(undefined, { year: 'numeric', month: 'short', day: '2-digit', timeZone: 'UTC' })
281
- function isDateColumn(col: ListColumn): boolean {
282
- return col.key === 'createdAt' || col.key === 'updatedAt' || col.field?.type === 'datetime'
283
- }
284
- function cellDisplay(col: ListColumn, row: Record<string, unknown>): string {
285
- const value = row[col.key]
286
- if (isDateColumn(col) && value != null) {
287
- const dateOnly = typeof value === 'string' && /^\d{4}-\d{2}-\d{2}$/.test(value)
288
- const d = new Date(value as string)
289
- if (!Number.isNaN(d.getTime())) return (dateOnly ? dateOnlyFmt : dateFmt).format(d)
290
- }
291
- return cellText(value)
292
- }
293
- function cellText(value: unknown): string {
294
- if (value == null) return ''
295
- if (typeof value === 'string') return value.replace(/<[^>]*>/g, '').slice(0, 80)
296
- if (typeof value === 'object') return JSON.stringify(value).slice(0, 80)
297
- return String(value)
298
- }
299
-
300
- // Per-row translation status (A4 attaches `$translations`: locale → sibling id, or null). Present
301
- // locales link to their sibling; missing ones offer create-and-link, carrying the translation group.
302
- function rowTranslations(row: Record<string, unknown>) {
303
- const map = (row.$translations ?? {}) as Record<string, number | null>
304
- const group = row.translationGroup as string | undefined
305
- return locales.map((loc) => {
306
- const id = map[loc]
307
- return id != null
308
- ? { loc, present: true, to: `/admin/${collection.value}/${id}?locale=${loc}` }
309
- : { loc, present: false, to: `/admin/${collection.value}/new?locale=${loc}${group ? `&group=${group}` : ''}` }
310
- })
311
- }
312
-
313
- // Toolbar popovers (filter / columns). Plain inline panels (not teleported) so they stay testable and
314
- // keep their scoped styles; a document listener closes them on an outside click.
315
- const toolsRef = ref<HTMLElement | null>(null)
316
- const openPanel = ref<'filter' | 'columns' | null>(null)
317
- // The element that opened the current panel — Escape restores focus to it (otherwise closing the panel
318
- // from inside drops keyboard focus onto <body>, stranding the keyboard user at the top of the document).
319
- let panelTrigger: HTMLElement | null = null
320
- function togglePanel(which: 'filter' | 'columns', e: MouseEvent) {
321
- if (openPanel.value === which) { openPanel.value = null; return }
322
- panelTrigger = e.currentTarget as HTMLElement
323
- openPanel.value = which
324
- }
325
- function onDocPointer(e: PointerEvent) {
326
- // Outside click: close but do NOT steal focus — it belongs wherever the user just clicked.
327
- if (toolsRef.value && !toolsRef.value.contains(e.target as Node)) openPanel.value = null
328
- }
329
- function onDocKeydown(e: KeyboardEvent) {
330
- if (e.key === 'Escape' && openPanel.value) {
331
- openPanel.value = null
332
- panelTrigger?.focus() // return focus to the trigger, per the disclosure/APG pattern
333
- }
334
- }
335
- onMounted(() => {
336
- document.addEventListener('pointerdown', onDocPointer)
337
- document.addEventListener('keydown', onDocKeydown)
338
- })
339
- onBeforeUnmount(() => {
340
- document.removeEventListener('pointerdown', onDocPointer)
341
- document.removeEventListener('keydown', onDocKeydown)
342
- })
343
-
344
68
  // Exactly ONE refetch per navigation: the effective (sanitized) query is stringified so an identical or
345
69
  // junk-only URL change never refetches, and a single change fires a single fetch. Every URL-driven refetch
346
70
  // clears the page-scoped selection inside `fetchRows`.
@@ -369,7 +93,7 @@ await fetchRows()
369
93
 
370
94
  <div ref="toolsRef" class="list__tools">
371
95
  <div class="list__tool">
372
- <UiButton
96
+ <KestrelUiButton
373
97
  type="button"
374
98
  size="sm"
375
99
  icon="filter"
@@ -379,84 +103,17 @@ await fetchRows()
379
103
  @click="togglePanel('filter', $event)"
380
104
  >
381
105
  {{ t('list.filter') }}<span v-if="activeFilters.length" class="list__tool-count">{{ activeFilters.length }}</span>
382
- </UiButton>
383
- <div v-if="openPanel === 'filter'" id="list-filter-panel" class="list__panel list__panel--filter">
384
- <p v-if="!filterableColumns.length" class="list__panel-empty">{{ t('list.noFilters') }}</p>
385
- <div v-for="c in filterableColumns" :key="c.key" class="list__filter-row">
386
- <span class="list__filter-label">{{ colLabel(c) }}</span>
387
- <div class="list__filter-controls">
388
- <select
389
- v-if="opsFor(c).length > 1"
390
- class="list__filter-op"
391
- :data-filter-op="c.key"
392
- :aria-label="`${t('filter.operator')} — ${colLabel(c)}`"
393
- :value="draft[c.key]?.op"
394
- @change="setOp(c.key, ($event.target as HTMLSelectElement).value as FilterOp)"
395
- >
396
- <option v-for="op in opsFor(c)" :key="op" :value="op">{{ opLabel(c.filterKind ?? 'text', op) }}</option>
397
- </select>
398
-
399
- <input
400
- v-if="c.filterKind === 'datetime'"
401
- type="date"
402
- class="list__filter"
403
- :data-filter="c.key"
404
- :aria-label="colLabel(c)"
405
- :value="draft[c.key]?.value ?? ''"
406
- @input="setValue(c.key, ($event.target as HTMLInputElement).value)"
407
- >
408
- <input
409
- v-else-if="c.filterKind === 'number' || c.filterKind === 'ref' || c.filterKind === 'idSet'"
410
- type="number"
411
- class="list__filter"
412
- :data-filter="c.key"
413
- :aria-label="colLabel(c)"
414
- :value="draft[c.key]?.value ?? ''"
415
- @input="setValue(c.key, ($event.target as HTMLInputElement).value)"
416
- >
417
- <select
418
- v-else-if="c.filterKind === 'boolean'"
419
- class="list__filter"
420
- :data-filter="c.key"
421
- :aria-label="colLabel(c)"
422
- :value="draft[c.key]?.value ?? ''"
423
- @change="setValue(c.key, ($event.target as HTMLSelectElement).value)"
424
- >
425
- <option value="">—</option>
426
- <option value="true">{{ t('filter.bool.true') }}</option>
427
- <option value="false">{{ t('filter.bool.false') }}</option>
428
- </select>
429
- <!-- Single choice (`enum`) and multi choice (`stringSet`) both pick a stored VALUE from the
430
- field's choices; a free-text box would let the user type the visible LABEL and match nothing. -->
431
- <select
432
- v-else-if="c.filterKind === 'enum' || c.filterKind === 'stringSet'"
433
- class="list__filter"
434
- :data-filter="c.key"
435
- :aria-label="colLabel(c)"
436
- :value="draft[c.key]?.value ?? ''"
437
- @change="setValue(c.key, ($event.target as HTMLSelectElement).value)"
438
- >
439
- <option value="">—</option>
440
- <option v-for="o in enumOptions(c)" :key="o.value" :value="o.value">{{ o.label }}</option>
441
- </select>
442
- <input
443
- v-else
444
- type="text"
445
- class="list__filter"
446
- :data-filter="c.key"
447
- :aria-label="colLabel(c)"
448
- :value="draft[c.key]?.value ?? ''"
449
- :placeholder="t('list.filterPlaceholder', { name: colLabel(c) })"
450
- @input="setValue(c.key, ($event.target as HTMLInputElement).value)"
451
- >
452
- </div>
453
- </div>
454
- <button v-if="activeFilters.length" type="button" class="list__panel-action" @click="clearAllFilters">{{ t('list.filterClearAll') }}</button>
455
- </div>
106
+ </KestrelUiButton>
107
+ <KestrelCollectionListFilterPanel
108
+ v-if="openPanel === 'filter'"
109
+ :columns="filterableColumns"
110
+ :filter="filterDraft"
111
+ :has-active="activeFilters.length > 0"
112
+ />
456
113
  </div>
457
114
 
458
115
  <div class="list__tool">
459
- <UiButton
116
+ <KestrelUiButton
460
117
  type="button"
461
118
  size="sm"
462
119
  icon="columns"
@@ -464,152 +121,76 @@ await fetchRows()
464
121
  :aria-expanded="openPanel === 'columns'"
465
122
  class="list__tool-btn"
466
123
  @click="togglePanel('columns', $event)"
467
- >{{ t('list.columns') }}</UiButton>
468
- <div v-if="openPanel === 'columns'" id="list-columns-panel" class="list__panel">
469
- <!-- eslint-disable-next-line vuejs-accessibility/label-has-for -- native wrapping label around a custom UiCheckbox; no `for`/`id` pair needed, invisible to static analysis -->
470
- <label v-for="c in available" :key="c.key" class="list__col-row">
471
- <UiCheckbox
472
- class="list__col-check"
473
- :data-col="c.key"
474
- :model-value="visibleKeys.includes(c.key)"
475
- :disabled="visibleKeys.length === 1 && visibleKeys.includes(c.key)"
476
- @update:model-value="() => toggleColumn(c.key)"
477
- />
478
- <span>{{ colLabel(c) }}</span>
479
- </label>
480
- <button v-if="!columnsAreDefault" type="button" class="list__panel-action" @click="resetColumns">{{ t('list.columnsReset') }}</button>
481
- </div>
124
+ >{{ t('list.columns') }}</KestrelUiButton>
125
+ <KestrelCollectionListColumnsPanel
126
+ v-if="openPanel === 'columns'"
127
+ :columns="available"
128
+ :visible-keys="visibleKeys"
129
+ :is-default="columnsAreDefault"
130
+ @toggle="toggleColumn"
131
+ @reset="resetColumns"
132
+ />
482
133
  </div>
483
134
  </div>
484
135
 
485
136
  <NuxtLink :to="`/admin/${collection}/new${localeQuery}`" class="list__new">{{ newLabel }}</NuxtLink>
486
137
  </div>
487
138
 
488
- <!-- Bulk action bar: chrome (flex:0 0 auto) that appears when ≥1 row is selected, shrinking the one
489
- scroll region rather than overlaying it. Publish/Unpublish are schema-driven (only when status).
490
- NOT a live region: the selection count is announced through the permanent .list__sr-status region
491
- (see `srStatus`); a v-if-toggled role="status" here would double up and stay silent on first show. -->
492
- <div v-if="selected.size" class="list__bulkbar">
493
- <span class="list__bulk-count">{{ t('list.selected', { n: selected.size }) }}</span>
494
- <div class="list__bulk-actions">
495
- <template v-if="schema.status">
496
- <UiButton type="button" size="sm" variant="secondary" :disabled="opsBusy" @click="onBulkStatus('published')">{{ t('list.bulkPublish') }}</UiButton>
497
- <UiButton type="button" size="sm" variant="secondary" :disabled="opsBusy" @click="onBulkStatus('draft')">{{ t('list.bulkUnpublish') }}</UiButton>
498
- </template>
499
- <UiButton type="button" size="sm" variant="danger" :disabled="opsBusy" @click="askDelete([...selected])">{{ t('list.bulkDelete') }}</UiButton>
500
- <UiButton type="button" size="sm" variant="ghost" @click="clearSelection">{{ t('list.clearSelection') }}</UiButton>
501
- </div>
502
- </div>
139
+ <KestrelCollectionListBulkBar
140
+ v-if="selected.size"
141
+ :count="selected.size"
142
+ :has-status="!!schema.status"
143
+ :busy="opsBusy"
144
+ @set-status="(status) => setStatus([...selected], status)"
145
+ @delete="askDelete([...selected])"
146
+ @clear="clearSelection"
147
+ />
503
148
 
504
149
  <div v-if="activeFilters.length" class="list__chips">
505
150
  <span v-for="f in activeFilters" :key="f.key" class="list__chip">
506
151
  <span class="list__chip-label">{{ f.label }} {{ f.opLabel }}:</span> {{ f.display }}
507
- <button type="button" class="list__chip-x" :aria-label="t('list.removeFilter', { name: f.label })" @click="clearFilter(f.key)">
508
- <UiIcon name="x" :size="12" />
152
+ <button type="button" class="list__chip-x" :aria-label="t('list.removeFilter', { name: f.label })" @click="filterDraft.clearFilter(f.key)">
153
+ <KestrelUiIcon name="x" :size="12" />
509
154
  </button>
510
155
  </span>
511
156
  </div>
512
157
 
513
- <UiAlert v-if="error" variant="error" class="list__error">
158
+ <KestrelUiAlert v-if="error" variant="error" class="list__error">
514
159
  {{ error }}
515
- <UiButton type="button" variant="secondary" size="sm" class="list__retry" @click="fetchRows">{{ t('common.retry') }}</UiButton>
516
- </UiAlert>
160
+ <KestrelUiButton type="button" variant="secondary" size="sm" class="list__retry" @click="fetchRows">{{ t('common.retry') }}</KestrelUiButton>
161
+ </KestrelUiAlert>
517
162
 
518
163
  <!-- The one scroll region: the table + its alternate empty-states scroll here while the bar, chips,
519
164
  error and pager stay fixed (see the admin layout's scroll-ownership convention). -->
520
165
  <div class="list__scroll">
521
- <table class="list__table">
522
- <thead>
523
- <tr>
524
- <th class="list__select-th" scope="col">
525
- <UiCheckbox
526
- :model-value="allSelected"
527
- :indeterminate="headerIndeterminate"
528
- :aria-label="t('list.selectAll')"
529
- @update:model-value="toggleAll"
530
- />
531
- </th>
532
- <!-- Row actions: an always-visible, left-frozen chrome column placed right after Select. Its
533
- accessible name is real visually-hidden text, not aria-label on a static <th> (which several
534
- screen-reader / browser pairs ignore on non-interactive table cells). -->
535
- <th class="list__actions-th" scope="col">
536
- <span class="list__vh">{{ t('a11y.rowActions') }}</span>
537
- </th>
538
- <th
539
- v-for="c in visibleColumns"
540
- :key="c.key"
541
- scope="col"
542
- :aria-sort="c.sortable ? ariaSort(c.key) : undefined"
543
- :class="{ 'list__th-narrow': c.type === 'translations' || c.type === 'deadRefs' }"
544
- >
545
- <button v-if="c.sortable" type="button" class="list__sort" @click="setSort(c.key)">{{ colLabel(c) }}<span aria-hidden="true">{{ arrow(c.key) }}</span></button>
546
- <span v-else>{{ colLabel(c) }}</span>
547
- </th>
548
- </tr>
549
- </thead>
550
- <tbody>
551
- <tr v-for="row in rows" :key="String(row.id)" class="list__row">
552
- <td class="list__select-cell">
553
- <UiCheckbox
554
- :model-value="selected.has(Number(row.id))"
555
- :aria-label="t('list.selectRow', { name: rowLabel(row) })"
556
- @update:model-value="(v) => toggleRow(Number(row.id), v)"
557
- />
558
- </td>
559
- <td class="list__actions-cell">
560
- <div class="list__row-actions">
561
- <NuxtLink :to="`/admin/${collection}/${row.id}${localeQuery}`" class="list__action-btn" :aria-label="t('list.rowEdit', { name: rowLabel(row) })">
562
- <UiIcon name="pencil" :size="15" />
563
- </NuxtLink>
564
- <button type="button" class="list__action-btn" :disabled="opsBusy" :aria-label="t('list.rowDuplicate', { name: rowLabel(row) })" @click="onDuplicate(Number(row.id))">
565
- <UiIcon name="copy" :size="15" />
566
- </button>
567
- <button type="button" class="list__action-btn list__action-btn--danger" :disabled="opsBusy" :aria-label="t('list.rowDelete', { name: rowLabel(row) })" @click="askDelete([Number(row.id)])">
568
- <UiIcon name="trash" :size="15" />
569
- </button>
570
- </div>
571
- </td>
572
- <td v-for="c in visibleColumns" :key="c.key" :class="{ 'list__narrow-cell': c.type === 'translations' || c.type === 'deadRefs' }">
573
- <span v-if="c.type === 'deadRefs'" class="list__deadrefs">
574
- <UiIcon
575
- v-if="row.$hasDeadRefs"
576
- name="triangle-alert"
577
- :size="15"
578
- class="list__deadref-icon"
579
- role="img"
580
- :aria-label="t('deadRefs.listWarning')"
581
- :title="t('deadRefs.listWarning')"
582
- />
583
- </span>
584
- <span v-else-if="c.type === 'translations'" class="list__transl">
585
- <NuxtLink
586
- v-for="tr in rowTranslations(row)"
587
- :key="tr.loc"
588
- :to="tr.to"
589
- :data-loc="tr.loc"
590
- class="list__badge"
591
- :class="tr.present ? 'list__badge--present' : 'list__badge--missing'"
592
- :title="tr.present ? t('list.editLocale', { loc: tr.loc.toUpperCase() }) : t('list.createLocale', { loc: tr.loc.toUpperCase() })"
593
- :aria-label="tr.present ? t('list.editLocale', { loc: tr.loc.toUpperCase() }) : t('list.createLocale', { loc: tr.loc.toUpperCase() })"
594
- >{{ tr.loc.toUpperCase() }}</NuxtLink>
595
- </span>
596
- <template v-else>{{ cellDisplay(c, row) }}</template>
597
- </td>
598
- </tr>
599
- </tbody>
600
- </table>
601
-
602
- <UiEmptyState
166
+ <KestrelCollectionListTable
167
+ :rows="rows"
168
+ :columns="visibleColumns"
169
+ :collection="collection"
170
+ :locale-query="localeQuery"
171
+ :sort="sort"
172
+ :busy="opsBusy"
173
+ :selected="selected"
174
+ :all-selected="allSelected"
175
+ :header-indeterminate="headerIndeterminate"
176
+ @sort="setSort"
177
+ @toggle-row="toggleRow"
178
+ @toggle-all="toggleAll"
179
+ @duplicate="onDuplicate"
180
+ @delete="askDelete"
181
+ />
182
+
183
+ <KestrelUiEmptyState
603
184
  v-if="!rows.length && !error && activeFilters.length"
604
185
  icon="filter"
605
186
  :title="t('list.noMatch.title')"
606
187
  :description="t('list.noMatch.desc', { name: label })"
607
188
  >
608
189
  <template #action>
609
- <button type="button" class="list__new" @click="clearAllFilters">{{ t('list.filterClearAll') }}</button>
190
+ <button type="button" class="list__new" @click="filterDraft.clearAll">{{ t('list.filterClearAll') }}</button>
610
191
  </template>
611
- </UiEmptyState>
612
- <UiEmptyState
192
+ </KestrelUiEmptyState>
193
+ <KestrelUiEmptyState
613
194
  v-else-if="!rows.length && !error"
614
195
  icon="file-text"
615
196
  :title="t('list.empty.title')"
@@ -618,30 +199,21 @@ await fetchRows()
618
199
  <template #action>
619
200
  <NuxtLink :to="`/admin/${collection}/new${localeQuery}`" class="list__new">{{ newLabel }}</NuxtLink>
620
201
  </template>
621
- </UiEmptyState>
202
+ </KestrelUiEmptyState>
622
203
  </div>
623
204
 
624
205
  <p class="list__sr-status" role="status" aria-live="polite">{{ srStatus }}</p>
625
206
 
626
- <div class="list__pager">
627
- <UiButton type="button" size="sm" :disabled="page <= 1" @click="prev">{{ t('list.prev') }}</UiButton>
628
- <span class="list__page">{{ t('list.page', { page, totalPages, total }) }}</span>
629
- <UiButton type="button" size="sm" :disabled="page >= totalPages" @click="next">{{ t('list.next') }}</UiButton>
630
- <label class="list__perpage" :for="perPageId">
631
- <span class="list__perpage-label">{{ t('list.perPage') }}</span>
632
- <select
633
- :id="perPageId"
634
- class="list__perpage-select"
635
- :value="perPage"
636
- :aria-label="t('list.perPage')"
637
- @change="setPerPage(Number(($event.target as HTMLSelectElement).value))"
638
- >
639
- <option v-for="n in PER_PAGE_OPTIONS" :key="n" :value="n">{{ n }}</option>
640
- </select>
641
- </label>
642
- </div>
207
+ <KestrelCollectionListPager
208
+ :page="page"
209
+ :total-pages="totalPages"
210
+ :total="total"
211
+ :per-page="perPage"
212
+ @update:page="setPage"
213
+ @update:per-page="setPerPage"
214
+ />
643
215
 
644
- <CollectionDeleteDialog
216
+ <KestrelCollectionDeleteDialog
645
217
  :open="deleteOpen"
646
218
  :report="deleteReport"
647
219
  :busy="opsBusy"
@@ -670,26 +242,12 @@ await fetchRows()
670
242
  border: 0;
671
243
  }
672
244
 
673
- // Visually-hidden text for a static cell that must be announced but not shown (the Actions column header).
674
- // Same technique as .list__sr-status above; chosen over aria-label, which is unreliably announced on
675
- // non-interactive table cells.
676
- .list__vh {
677
- position: absolute;
678
- width: 1px;
679
- height: 1px;
680
- padding: 0;
681
- margin: -1px;
682
- overflow: hidden;
683
- clip: rect(0, 0, 0, 0);
684
- white-space: nowrap;
685
- border: 0;
686
- }
687
-
688
245
  // Fills the height handed down and stays fixed itself; scroll is delegated to .list__scroll. Overflow is
689
246
  // left VISIBLE (not a scroll container) so the inline Filter/Columns popovers are never clipped.
690
247
  .list {
691
248
  // Frozen-column token: the actions column's sticky `left` must equal the select column's width
692
- // (1.25rem checkbox + 2×var(--space-3) cell padding). Keep in sync if the checkbox size or padding change.
249
+ // (1.25rem checkbox + 2×var(--space-3) cell padding). Read by CollectionListTable's frozen columns
250
+ // keep in sync if the checkbox size or padding change.
693
251
  --list-col-select: 2.75rem;
694
252
  display: flex;
695
253
  flex-direction: column;
@@ -737,7 +295,8 @@ await fetchRows()
737
295
  }
738
296
  }
739
297
 
740
- // Filter / Columns toolbar
298
+ // Filter / Columns toolbar. The panels themselves live in CollectionListFilterPanel /
299
+ // CollectionListColumnsPanel; the shared popover chrome below styles both.
741
300
  &__tools {
742
301
  display: flex;
743
302
  align-items: center;
@@ -788,56 +347,6 @@ await fetchRows()
788
347
  font-size: var(--text-sm);
789
348
  cursor: pointer;
790
349
  }
791
- // The inline filter rows need room for name + operator + value; the columns panel stays compact.
792
- &__panel--filter {
793
- min-width: 30rem;
794
- }
795
- // Name, operator and value on ONE line: a stacked label doubled the panel's height for no information.
796
- &__filter-row {
797
- display: flex;
798
- align-items: center;
799
- gap: var(--space-2);
800
- font-size: var(--text-sm);
801
- }
802
- // Fixed basis so the names form an aligned column and the controls all start at the same x.
803
- &__filter-label {
804
- flex: 0 0 6.5rem;
805
- min-width: 0;
806
- overflow: hidden;
807
- text-overflow: ellipsis;
808
- white-space: nowrap;
809
- color: var(--color-text-muted);
810
- }
811
- // Operator select + value control; the value control takes the remaining width.
812
- &__filter-controls {
813
- flex: 1 1 auto;
814
- min-width: 0;
815
- display: flex;
816
- gap: var(--space-1);
817
- align-items: center;
818
- }
819
- &__filter-op {
820
- flex: 0 0 auto;
821
- max-width: 45%;
822
- padding: var(--space-1) var(--space-2);
823
- border: 1px solid var(--color-border);
824
- border-radius: var(--radius-sm);
825
- background: var(--color-surface);
826
- color: var(--color-text-muted);
827
- font: inherit;
828
- font-size: var(--text-sm);
829
- }
830
- &__filter-controls .list__filter {
831
- flex: 1 1 auto;
832
- min-width: 0;
833
- }
834
- &__col-row {
835
- display: flex;
836
- align-items: center;
837
- gap: var(--space-2);
838
- font-size: var(--text-sm);
839
- cursor: pointer;
840
- }
841
350
 
842
351
  &__new {
843
352
  margin-left: auto;
@@ -885,215 +394,5 @@ await fetchRows()
885
394
  color: var(--color-text);
886
395
  }
887
396
  }
888
-
889
- &__table {
890
- width: 100%;
891
- border-collapse: collapse;
892
- font-size: var(--text-sm);
893
-
894
- th,
895
- td {
896
- text-align: start;
897
- padding: var(--space-2) var(--space-3);
898
- border-bottom: 1px solid var(--color-border);
899
- vertical-align: top;
900
- }
901
- // Keep the column headers visible while the rows scroll inside .list__scroll. A solid background is
902
- // required so scrolling rows don't show through. Part of the frozen-column z-index stack (see the
903
- // &__select-* / &__actions-* rules): scrolling body td 0 < frozen body td 1 < scrolling header th 2 <
904
- // frozen corner th 3, so nothing bleeds through on either scroll axis.
905
- thead th {
906
- position: sticky;
907
- top: 0;
908
- z-index: 2; // scrolling header: above scrolling body cells (0) and the frozen body columns (1)
909
- background: var(--color-bg);
910
- }
911
- // Frozen corner: the select + actions headers are sticky on BOTH axes, so they must sit above every
912
- // scrolling header AND every frozen body column where the two frozen edges cross.
913
- thead th.list__select-th,
914
- thead th.list__actions-th {
915
- z-index: 3;
916
- }
917
- }
918
- &__sort {
919
- background: none;
920
- border: 0;
921
- padding: 0;
922
- font: inherit;
923
- font-weight: var(--weight-medium);
924
- cursor: pointer;
925
- color: var(--color-text);
926
- }
927
- &__filter {
928
- width: 100%;
929
- padding: var(--space-1) var(--space-2);
930
- border: 1px solid var(--color-border);
931
- border-radius: var(--radius-sm);
932
- font: inherit;
933
- }
934
- // Compact, de-emphasised info columns (translations · dead-reference warning).
935
- &__th-narrow,
936
- &__narrow-cell {
937
- width: 1%;
938
- white-space: nowrap;
939
- }
940
-
941
- // Dead-reference warning: an amber triangle, shown only on rows holding a stale reference.
942
- &__deadrefs {
943
- display: inline-flex;
944
- }
945
- &__deadref-icon {
946
- color: var(--color-warning);
947
- }
948
- &__transl {
949
- display: inline-flex;
950
- gap: 2px;
951
- flex-wrap: wrap;
952
- }
953
- &__badge {
954
- display: inline-flex;
955
- align-items: center;
956
- justify-content: center;
957
- min-width: 1.4rem;
958
- padding: 0 3px;
959
- border: 1px solid transparent;
960
- border-radius: var(--radius-sm);
961
- font-size: 0.625rem;
962
- font-weight: var(--weight-medium);
963
- line-height: 1.5;
964
- letter-spacing: 0.02em;
965
- text-decoration: none;
966
-
967
- &--present {
968
- background: var(--color-primary-soft);
969
- color: var(--color-primary);
970
- }
971
- &--missing {
972
- color: var(--color-text-muted);
973
- border-color: var(--color-border);
974
- border-style: dashed;
975
- }
976
- &:focus-visible {
977
- outline: 2px solid var(--color-focus);
978
- outline-offset: -2px;
979
- }
980
- }
981
-
982
- // Selection column — the first frozen chrome column, pinned to the left with `position: sticky` inside
983
- // the existing .list__scroll (no new scroll container). Opaque `var(--color-bg)` so horizontally-scrolled
984
- // data can't bleed through; z-index 1 lifts the frozen body cell above the scrolling body cells.
985
- &__select-th,
986
- &__select-cell {
987
- position: sticky;
988
- left: 0;
989
- z-index: 1;
990
- width: var(--list-col-select);
991
- white-space: nowrap;
992
- vertical-align: middle;
993
- background: var(--color-bg);
994
- }
995
- // Row-actions column — the second frozen column, sitting immediately after Select (its `left` offset is
996
- // exactly the select column's width). Always visible; snug `width: 1%` so the three icon buttons never
997
- // steal width from the Title column.
998
- &__actions-th,
999
- &__actions-cell {
1000
- position: sticky;
1001
- left: var(--list-col-select);
1002
- z-index: 1;
1003
- width: 1%;
1004
- white-space: nowrap;
1005
- vertical-align: middle;
1006
- background: var(--color-bg);
1007
- }
1008
- // A plain, always-visible inline row of icon buttons (Edit → Duplicate → Delete; destructive last, never
1009
- // default focus). BlockTree.vue deliberately keeps its own absolute overlay: a tree row is a single flex
1010
- // row with no column grid — there is no cell to place actions in.
1011
- &__row-actions {
1012
- display: inline-flex;
1013
- align-items: center;
1014
- gap: 1px;
1015
- }
1016
- &__action-btn {
1017
- display: flex;
1018
- align-items: center;
1019
- justify-content: center;
1020
- width: 1.5rem;
1021
- height: 1.5rem;
1022
- border: 0;
1023
- border-radius: var(--radius-sm);
1024
- background: transparent;
1025
- color: var(--color-text-muted); /* meaningful icon control at rest → ≥3:1 (SC 1.4.11) */
1026
- text-decoration: none;
1027
- cursor: pointer;
1028
- transition:
1029
- background-color var(--motion-fast) var(--ease-standard),
1030
- color var(--motion-fast) var(--ease-standard);
1031
-
1032
- &:hover {
1033
- background: var(--color-hover);
1034
- color: var(--color-text);
1035
- }
1036
- &:focus-visible {
1037
- outline: 2px solid var(--color-focus);
1038
- outline-offset: -2px;
1039
- }
1040
- &--danger:hover {
1041
- color: var(--color-danger);
1042
- }
1043
- &:disabled {
1044
- opacity: 0.5;
1045
- cursor: default;
1046
- pointer-events: none;
1047
- }
1048
- }
1049
-
1050
- // Bulk action bar — appears above the scroll region when ≥1 row is selected.
1051
- &__bulkbar {
1052
- display: flex;
1053
- align-items: center;
1054
- gap: var(--space-3);
1055
- padding: var(--space-2) var(--space-3);
1056
- border: 1px solid var(--color-border);
1057
- border-radius: var(--radius-md);
1058
- background: var(--color-surface);
1059
- }
1060
- &__bulk-count {
1061
- font-size: var(--text-sm);
1062
- font-weight: var(--weight-medium);
1063
- }
1064
- &__bulk-actions {
1065
- display: flex;
1066
- align-items: center;
1067
- gap: var(--space-2);
1068
- margin-inline-start: auto;
1069
- }
1070
-
1071
- &__pager {
1072
- display: flex;
1073
- align-items: center;
1074
- gap: var(--space-3);
1075
- }
1076
- &__page {
1077
- font-size: var(--text-sm);
1078
- color: var(--color-text-muted);
1079
- }
1080
- // Per-page size selector sits at the far end of the pager.
1081
- &__perpage {
1082
- display: inline-flex;
1083
- align-items: center;
1084
- gap: var(--space-2);
1085
- margin-inline-start: auto;
1086
- font-size: var(--text-sm);
1087
- color: var(--color-text-muted);
1088
- }
1089
- &__perpage-select {
1090
- padding: var(--space-1) var(--space-2);
1091
- border: 1px solid var(--color-border);
1092
- border-radius: var(--radius-sm);
1093
- background: var(--color-surface);
1094
- color: var(--color-text);
1095
- font: inherit;
1096
- font-size: var(--text-sm);
1097
- }
1098
397
  }
1099
398
  </style>