@n-ivan/react-justified-gallery 1.0.1 → 1.0.3

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.
@@ -0,0 +1,2 @@
1
+ import type { JustifiedGalleryProps } from './types';
2
+ export declare function JustifiedGallery({ images, gap, renderImage, resizeDebounce, lazyLoad, onImageLoad, onImageError, containerStyle, rowStyle, }: JustifiedGalleryProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,3 @@
1
+ import type { ImageData, ComputedRow } from './types';
2
+ export declare function validateImages(images: ImageData[][]): void;
3
+ export declare function calculateLayout(images: ImageData[][], containerWidth: number, gap: number): ComputedRow[];
@@ -0,0 +1,2 @@
1
+ export { JustifiedGallery } from './JustifiedGallery';
2
+ export type { JustifiedGalleryProps, ImageData, RenderImageProps, } from './types';
@@ -0,0 +1,39 @@
1
+ import type { CSSProperties, ReactNode, SyntheticEvent } from 'react';
2
+ export interface ImageData {
3
+ src: string;
4
+ width: number;
5
+ height: number;
6
+ alt?: string;
7
+ [key: string]: unknown;
8
+ }
9
+ export interface RenderImageProps {
10
+ image: ImageData;
11
+ computedWidth: number;
12
+ computedHeight: number;
13
+ originalWidth: number;
14
+ originalHeight: number;
15
+ rowIndex: number;
16
+ imageIndex: number;
17
+ isFirstInRow: boolean;
18
+ isLastInRow: boolean;
19
+ }
20
+ export interface JustifiedGalleryProps {
21
+ images: ImageData[][];
22
+ gap?: number;
23
+ renderImage?: (props: RenderImageProps) => ReactNode;
24
+ resizeDebounce?: number;
25
+ lazyLoad?: boolean;
26
+ onImageLoad?: (image: ImageData, event: SyntheticEvent<HTMLImageElement>) => void;
27
+ onImageError?: (image: ImageData, event: SyntheticEvent<HTMLImageElement>) => void;
28
+ containerStyle?: CSSProperties;
29
+ rowStyle?: CSSProperties;
30
+ }
31
+ export interface ComputedImage {
32
+ image: ImageData;
33
+ computedWidth: number;
34
+ computedHeight: number;
35
+ }
36
+ export interface ComputedRow {
37
+ images: ComputedImage[];
38
+ height: number;
39
+ }
@@ -0,0 +1,4 @@
1
+ export declare function useContainerWidth(resizeDebounce: number): {
2
+ containerRef: React.RefObject<HTMLDivElement>;
3
+ width: number;
4
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@n-ivan/react-justified-gallery",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "description": "A React component for creating justified image galleries",
5
5
  "keywords": [
6
6
  "react",
@@ -9,7 +9,7 @@
9
9
  "images",
10
10
  "layout"
11
11
  ],
12
- "homepage": "https://github.com/n-ivan/react-justified-gallery#readme",
12
+ "homepage": "https://n-ivan.github.io/react-justified-gallery/",
13
13
  "bugs": {
14
14
  "url": "https://github.com/n-ivan/react-justified-gallery/issues"
15
15
  },
@@ -32,7 +32,8 @@
32
32
  "dist"
33
33
  ],
34
34
  "scripts": {
35
- "build": "tsc && vite build",
35
+ "build": "tsc --project tsconfig.build.json && vite build",
36
+ "build:demo": "vite build --config demo/vite.config.ts",
36
37
  "dev": "vite",
37
38
  "demo": "vite --config demo/vite.config.ts",
38
39
  "test": "vitest",