authorgravatar for git@paperclover.netclover caruso <git@paperclover.net> 2026-04-02 23:01:46-07:00
committergravatar for git@paperclover.netclover caruso <git@paperclover.net> 2026-04-06 01:17:01-07:00
loga2edc9aa2044b09fccabfd343759f4f6e151e0a3
tree58243b0f5228c0250aab16ddd2cf9be17deb1573
parent223b5dc94bf1459d8a62aed61e447b8f3abafcd8
signature Signed by SSH key SHA256:xbd+BjjhyBfwk7GVoURf9Yx0gzDerHbvYv7SddNWmAs

fix: file scanning shit

resolves #49. aspect ratio bugs on videos and images are fixed.

5 files changed, 16 insertions(+), 10 deletions(-)

src/tags/clover-media.marko+2-2
......@@ -12,7 +12,7 @@ export interface Input {
1212 <div style={ color: "red" }>ERROR: No file in database: ${src}</div>
1313</if>
1414<else if=extsVideo.has(file.extension.toLowerCase())>
15 <clover-video noFigure ...{ file }/>
15 <clover-video minimal noFigure ...{ file }/>
1616</else>
1717<else if=file.extension === ".gif">
1818 <img src=`/file${escapeUri(file.path)}` ...rest>
......@@ -29,7 +29,7 @@ export interface Input {
2929 : `100vw`
3030 )>
3131 <picture>
32 <for|ext| of=["jxl", "avif", "webp"]>
32 <for|ext| of=["jxl", "webp"]>
3333 <source
3434 type=`image/${ext}`
3535 srcset=targetSizes.map((s) => `${base}:/${s}.${ext} ${s}w`)
src/tags/clover-video.marko+1-1
......@@ -34,7 +34,7 @@ export interface Input {
3434<define/Inner>
3535 <video
3636 ...{ id }
37 class={ "clover-video": noFigure }
37 class={ "clover-video": noFigure, minimal: noFigure && minimal }
3838 data-src=file.path
3939 poster=poster ? `/file${poster.path}` : null
4040 width=width
src/tags/image.tsx+1-1
......@@ -35,7 +35,7 @@ export default function Image(
3535
3636 return (
3737 <picture>
38 {["jxl", "avif", "webp"].map((ext) => (
38 {["jxl", "webp"].map((ext) => (
3939 <source
4040 type={`image/${ext}`}
4141 srcset={targetSizes.map((s) => `${base}:/${s}.${ext} ${s}w`)}
src/tags/photo-grid.css+6
......@@ -22,3 +22,9 @@ photo-grid-item {
2222 object-fit: cover;
2323 }
2424}
25photo-grid + blockquote {
26 margin: 0 -4px;
27 border: none;
28 background-color: var(--primary);
29 color: black;
30}
src/tags/photo-grid.marko+6-6
......@@ -1,19 +1,18 @@
11import "./photo-grid.css";
22
3static const gap = 11;
4
53export interface Input {
64 base?: string;
75 cols: number[]; // weights
86 rows?: number[]; // pixel heights, based on a 768px container
97 style?: Marko.AttrStyle;
8 gapless?: boolean;
9 gap?: number;
1010 // images are placed left to right, top to bottom
1111 img: Marko.AttrTag<{
1212 src: string;
1313 w?: number; // column span
1414 h?: number; // row span
1515 s?: number; // skipped columns before placement
16 small?: unknown;
1716 mutedLoop?: boolean;
1817 align?: "top" | "center" | "bottom" | (string & {});
1918 }>;
......@@ -39,7 +38,7 @@ static const alignments = {
3938 "right-end": "100% 50%",
4039};
4140
42<const/{ base, cols, style }=input>
41<const/{ base, cols, style, gapless, gap = gapless ? 4 : 11 }=input>
4342<const/rows=input.rows ?? [325]>
4443<const/colCount=input.cols.length>
4544<const/rowSum=rows.reduce((a, b) => a + b, 0) + gap * (rows.length - 1)>
......@@ -55,8 +54,8 @@ static const alignments = {
5554 return false;
5655 };
5756
58 let x = 0,
59 y = 0;
57 let x = 0;
58 let y = 0;
6059 let result: Positioned[] = [];
6160 for (const img of input.img) {
6261 const w = img.w ?? 1;
......@@ -97,6 +96,7 @@ static const alignments = {
9796 .map((x) => ((100 * x) / rowSum).toFixed(1) + "%")
9897 .join(" "),
9998 "aspect-ratio": `768/${rowSum}`,
99 gap: gap !== 11 ? gap + "px" : undefined,
100100 ...style,
101101}>
102102 <for|{ x, y, w, h, src, align }| of=items>