feat: add justified layout modes and aspect-ratio-aware mosaic (#146)

- Add Flickr justified-layout and react-photo-album as masonry mode options
- Implement aspect-ratio-aware mosaic layout that dynamically selects
  patterns based on photo orientations to minimize cropping
- Add 9 mosaic pattern types optimized for different orientation combinations
- Add theme customizer options for masonry mode selection (columns/rows/flickr/justified)
- Add i18n translations for new layout options
This commit is contained in:
Paul Nothaft
2026-01-28 22:31:34 +01:00
parent 8097a0cb53
commit 608bbd50e7
10 changed files with 1466 additions and 232 deletions
+38
View File
@@ -0,0 +1,38 @@
declare module 'justified-layout' {
interface JustifiedLayoutOptions {
containerWidth: number;
containerPadding?: number | { top: number; right: number; bottom: number; left: number };
boxSpacing?: number | { horizontal: number; vertical: number };
targetRowHeight?: number;
targetRowHeightTolerance?: number;
maxNumRows?: number;
forceAspectRatio?: boolean | number;
showWidows?: boolean;
fullWidthBreakoutRowCadence?: boolean | number;
widowLayoutStyle?: 'left' | 'center' | 'justify';
}
interface Box {
aspectRatio: number;
top: number;
left: number;
width: number;
height: number;
forcedAspectRatio?: boolean;
}
interface JustifiedLayoutResult {
containerHeight: number;
widowCount: number;
boxes: Box[];
}
type InputItem = number | { width: number; height: number };
function justifiedLayout(
input: InputItem[],
options?: JustifiedLayoutOptions
): JustifiedLayoutResult;
export = justifiedLayout;
}
+1 -1
View File
@@ -15,7 +15,7 @@ export interface GalleryLayoutSettings {
};
// Masonry specific
masonryMode?: 'columns' | 'rows'; // columns = Pinterest-style, rows = Google Photos-style
masonryMode?: 'columns' | 'rows' | 'flickr' | 'justified'; // columns = Pinterest-style, rows = custom rows, flickr = Flickr justified-layout, justified = react-photo-album (Google Photos style)
masonryGutter?: number;
masonryRowHeight?: number; // Target row height for rows mode (150-400)
masonryLastRowBehavior?: 'justify' | 'left' | 'center'; // How to align incomplete last row