feat(post-form): client-side HEIC->JPEG photo picker (U4)

Replace /post's managed filepond field with a controlled 'photos' field
(theme forms/fields/photos) + picker logic in post-form.js: magic-byte
sniff (ISO-BMFF ftyp brands, not filename/MIME), lazy import('heic-to')
only for real HEIC (deferred 3MB chunk via ESM splitting), per-thumbnail
converting/uploading/done/error states, in-flight counter gating Submit,
and fail-closed skip on conversion failure. Converted JPEGs POST to Grav's
AJAX file-upload route into the form flash (the only path copyFiles reads),
so add-page-by-form attaches them on submit. Web-format photos pass through.

Refs R8, R9, R16, R17, AE1, AE4, KTD4.
This commit is contained in:
2026-07-04 16:38:13 +02:00
parent 6282528dd8
commit bf5b5c2f3c
10 changed files with 318 additions and 66 deletions
+46
View File
@@ -19,3 +19,49 @@
.EasyMDEContainer .CodeMirror {
min-height: 180px;
}
/* ── Photo picker (U4) — functional states; Field Notes polish in U5 ── */
.photo-picker__list {
list-style: none;
margin: 0.5rem 0 0;
padding: 0;
display: flex;
flex-wrap: wrap;
gap: 0.5rem;
}
.photo-card {
position: relative;
width: 84px;
height: 84px;
border-radius: 6px;
overflow: hidden;
background: rgba(0, 0, 0, 0.06);
display: flex;
align-items: center;
justify-content: center;
}
.photo-card__thumb {
width: 100%;
height: 100%;
object-fit: cover;
display: block;
}
.photo-card__state {
position: absolute;
left: 0;
right: 0;
bottom: 0;
padding: 2px 4px;
font-size: 0.7rem;
line-height: 1.2;
text-align: center;
color: #fff;
background: rgba(0, 0, 0, 0.55);
}
.photo-card.is-done .photo-card__state { background: rgba(31, 107, 90, 0.85); }
.photo-card.is-error {
background: rgba(176, 0, 32, 0.12);
outline: 2px solid rgba(176, 0, 32, 0.5);
}
.photo-card.is-error .photo-card__state { background: rgba(176, 0, 32, 0.85); }
.photo-card.is-converting .photo-card__thumb { opacity: 0.4; }