feat: photo/video capture-date pipeline + premium UI/UX overhaul
Backend — Photos timeline now groups by real capture date instead of upload time. New MediaMetadataService (FileLifecycleHook) extracts EXIF DateTimeOriginal from images and container creation_time from videos (mov/mp4/mkv) via nom-exif, timezone-correct (OffsetTimeOriginal), persisting captured_at so the existing media_sort_date trigger takes over. Adds POST /admin/photos/metadata/reextract to backfill existing media. Falls back to upload date when no embedded date exists. Frontend — premium grid cards: combined metadata line (relative date · size, owner avatar when shared), custom selection checkbox with a clear checked state, uniform full-width 4:3 thumbnail tiles independent of filename length, centered file-type icons, and a hit-test fix so checkbox/star/kebab clicks reach the controls (the decorative thumbnail no longer captures pointer events). Notification messages internationalised across all 16 locales. Broader polish: design tokens, a11y/focus-visible states, brand + PWA assets. Chore — bump semver-compatible dependencies (cargo upgrade); add nom-exif 3.6.1. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,61 @@
|
||||
/**
|
||||
* Global ARIA live region.
|
||||
*
|
||||
* Announces transient UI messages (toasts, notifications) to assistive
|
||||
* technology without any visual footprint. Screen-reader users otherwise
|
||||
* miss feedback that sighted users see in the notification bell / toasts.
|
||||
*
|
||||
* Dependency-free; the region is created lazily on first use so importing
|
||||
* this module has no DOM side effect until something is actually announced.
|
||||
*
|
||||
* @module core/liveRegion
|
||||
*/
|
||||
|
||||
/** @type {HTMLElement | null} */
|
||||
let politeRegion = null;
|
||||
/** @type {HTMLElement | null} */
|
||||
let assertiveRegion = null;
|
||||
|
||||
/**
|
||||
* Find or create the visually-hidden live region for the given urgency.
|
||||
* @param {boolean} assertive
|
||||
* @returns {HTMLElement | null}
|
||||
*/
|
||||
function ensureRegion(assertive) {
|
||||
if (!document.body) return null;
|
||||
if (assertive && assertiveRegion) return assertiveRegion;
|
||||
if (!assertive && politeRegion) return politeRegion;
|
||||
|
||||
const el = document.createElement('div');
|
||||
el.className = 'sr-only';
|
||||
el.id = assertive ? 'a11y-live-assertive' : 'a11y-live-polite';
|
||||
el.setAttribute('aria-live', assertive ? 'assertive' : 'polite');
|
||||
el.setAttribute('aria-atomic', 'true');
|
||||
el.setAttribute('role', assertive ? 'alert' : 'status');
|
||||
document.body.appendChild(el);
|
||||
|
||||
if (assertive) assertiveRegion = el;
|
||||
else politeRegion = el;
|
||||
return el;
|
||||
}
|
||||
|
||||
/**
|
||||
* Announce a message to screen readers.
|
||||
*
|
||||
* @param {string} message - text to announce (empty/whitespace is ignored)
|
||||
* @param {{ assertive?: boolean }} [opts] - `assertive: true` interrupts the
|
||||
* current speech (use for errors); default is polite.
|
||||
*/
|
||||
export function announce(message, opts = {}) {
|
||||
const msg = String(message ?? '').trim();
|
||||
if (!msg) return;
|
||||
const region = ensureRegion(Boolean(opts.assertive));
|
||||
if (!region) return;
|
||||
|
||||
// Clear first, then set on the next frame so the DOM mutation is registered
|
||||
// as a change even when the same message is announced twice in a row.
|
||||
region.textContent = '';
|
||||
requestAnimationFrame(() => {
|
||||
region.textContent = msg;
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user