@alexgorbatchev/shadcn 0.0.155 → 0.0.157
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.
- package/dist/components/image-viewer/ImageComparison.d.ts +23 -6
- package/dist/components/image-viewer/ImageComparisonToolbar.d.ts +6 -3
- package/dist/components/image-viewer/ImageDifferenceOverlay.d.ts +6 -2
- package/dist/components/image-viewer/ImageGallery.d.ts +16 -4
- package/dist/components/image-viewer/ImageRegionMarker.d.ts +3 -1
- package/dist/components/image-viewer/ImageRegionSelect.d.ts +4 -2
- package/dist/components/image-viewer/index.js +597 -211
- package/dist/components/resizable/index.js +2 -2
- package/dist/prototype.js +1 -1
- package/llms/components/data-display/ImageComparison.md +14 -1
- package/llms/components/data-display/ImageGallery.md +9 -1
- package/llms.txt +2 -2
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { type ReactElement } from "react";
|
|
1
|
+
import { type KeyboardEvent, type ReactElement, type ReactNode } from "react";
|
|
2
2
|
import type { IDensityProps } from "../../density/types.js";
|
|
3
|
-
import type { IImageComparisonSource, ImageComparisonMode, ImageComparisonOrientation, ImageComparisonSide, ImageZoom } from "./types.js";
|
|
3
|
+
import type { IImageComparisonSource, IImageDiff, IImageDiffRegion, ImageComparisonMode, ImageComparisonOrientation, ImageComparisonSide, ImageZoom } from "./types.js";
|
|
4
4
|
export interface IImageComparisonProps extends IDensityProps {
|
|
5
5
|
before: IImageComparisonSource;
|
|
6
6
|
after: IImageComparisonSource;
|
|
@@ -18,9 +18,9 @@ export interface IImageComparisonProps extends IDensityProps {
|
|
|
18
18
|
/** Initial image shown in `toggle` mode when uncontrolled. Defaults to `after`. */
|
|
19
19
|
defaultSide?: ImageComparisonSide;
|
|
20
20
|
onSideChange?: (side: ImageComparisonSide) => void;
|
|
21
|
-
/** Controlled side-by-side arrangement. */
|
|
21
|
+
/** Controlled side-by-side arrangement. Omit to choose from the stage shape (vertical when taller than wide). */
|
|
22
22
|
orientation?: ImageComparisonOrientation;
|
|
23
|
-
/** Initial side-by-side arrangement when uncontrolled.
|
|
23
|
+
/** Initial side-by-side arrangement when uncontrolled. Omit to choose automatically from the stage shape. */
|
|
24
24
|
defaultOrientation?: ImageComparisonOrientation;
|
|
25
25
|
onOrientationChange?: (orientation: ImageComparisonOrientation) => void;
|
|
26
26
|
/** Controlled zoom shared by every mode. */
|
|
@@ -35,12 +35,29 @@ export interface IImageComparisonProps extends IDensityProps {
|
|
|
35
35
|
onShowDifferencesChange?: (showDifferences: boolean) => void;
|
|
36
36
|
/** Shows the comparison controls. Defaults to true. */
|
|
37
37
|
showToolbar?: boolean;
|
|
38
|
+
/** Further controls in the toolbar row after the comparison controls, such as comment actions. */
|
|
39
|
+
toolbar?: ReactNode;
|
|
40
|
+
/** Content positioned over the before image (before pane in side-by-side, stage in toggle and swipe). */
|
|
41
|
+
beforeOverlay?: ReactNode;
|
|
42
|
+
/** Content positioned over the after image (after pane in side-by-side, stage in toggle and swipe). */
|
|
43
|
+
afterOverlay?: ReactNode;
|
|
44
|
+
/** Content positioned above the single stage in toggle and swipe modes, such as an active region tool. */
|
|
45
|
+
stageOverlay?: ReactNode;
|
|
46
|
+
/** Renders a Comment button on each highlighted changed region and calls this when activated. */
|
|
47
|
+
onCommentDifference?: (region: IImageDiffRegion, index: number, diff: IImageDiff) => void;
|
|
48
|
+
/** Receives swipe divider position updates (0–100, percent showing the before image). */
|
|
49
|
+
onSwipePositionChange?: (position: number) => void;
|
|
50
|
+
/** Runs before the stage keys while a comparison viewport has focus; call `preventDefault()` to replace a key. */
|
|
51
|
+
onStageKeyDown?: (event: KeyboardEvent<HTMLDivElement>, side: ImageComparisonSide) => void;
|
|
52
|
+
/** Further `aria-keyshortcuts` handled through `onStageKeyDown`, such as "R Enter". */
|
|
53
|
+
stageKeyShortcuts?: string;
|
|
38
54
|
/** Accessible name of the comparison. Defaults to "Image comparison". */
|
|
39
55
|
label?: string;
|
|
40
56
|
}
|
|
41
57
|
/**
|
|
42
58
|
* Compares before and after images by toggling, swiping a divider, or showing them side by side. Every mode starts
|
|
43
59
|
* fitted to the available space and offers original size with scrolling. A differently sized before image is drawn
|
|
44
|
-
* inside the after image's box. Highlighting differences compares pixels on first use
|
|
60
|
+
* inside the after image's box. Highlighting differences compares pixels on first use, caches the result per pair, and
|
|
61
|
+
* steps through changed regions with buttons or N / Shift+N.
|
|
45
62
|
*/
|
|
46
|
-
export declare function ImageComparison({ before, after, beforeLabel, afterLabel, mode: modeProp, defaultMode, onModeChange, side: sideProp, defaultSide, onSideChange, orientation: orientationProp, defaultOrientation, onOrientationChange, zoom: zoomProp, defaultZoom, onZoomChange, showDifferences: showDifferencesProp, defaultShowDifferences, onShowDifferencesChange, showToolbar, label, density, }: IImageComparisonProps): ReactElement;
|
|
63
|
+
export declare function ImageComparison({ before, after, beforeLabel, afterLabel, mode: modeProp, defaultMode, onModeChange, side: sideProp, defaultSide, onSideChange, orientation: orientationProp, defaultOrientation, onOrientationChange, zoom: zoomProp, defaultZoom, onZoomChange, showDifferences: showDifferencesProp, defaultShowDifferences, onShowDifferencesChange, showToolbar, toolbar, beforeOverlay, afterOverlay, stageOverlay, onCommentDifference, onSwipePositionChange, onStageKeyDown, stageKeyShortcuts, label, density, }: IImageComparisonProps): ReactElement;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type ReactElement } from "react";
|
|
1
|
+
import { type ReactElement, type ReactNode } from "react";
|
|
2
2
|
import type { IDensityProps } from "../../density/types.js";
|
|
3
3
|
import type { IImageSize, ImageComparisonMode, ImageComparisonOrientation, ImageComparisonSide, ImageDifferenceState, ImageZoom } from "./types.js";
|
|
4
4
|
interface IImageComparisonToolbarProps extends IDensityProps {
|
|
@@ -13,12 +13,15 @@ interface IImageComparisonToolbarProps extends IDensityProps {
|
|
|
13
13
|
showDifferences: boolean;
|
|
14
14
|
onShowDifferencesChange: (showDifferences: boolean) => void;
|
|
15
15
|
differences: ImageDifferenceState;
|
|
16
|
+
activeRegionIndex: number;
|
|
17
|
+
onStepChange: (delta: -1 | 1) => void;
|
|
16
18
|
onPeekChange: (isPeeking: boolean) => void;
|
|
17
19
|
beforeLabel: string;
|
|
18
20
|
afterLabel: string;
|
|
19
21
|
beforeSize?: IImageSize;
|
|
20
22
|
afterSize?: IImageSize;
|
|
23
|
+
toolbar?: ReactNode;
|
|
21
24
|
}
|
|
22
|
-
/** Comparison controls
|
|
23
|
-
export declare function ImageComparisonToolbar({ mode, onModeChange, side, onSideChange, orientation, onOrientationChange, zoom, onZoomChange, showDifferences, onShowDifferencesChange, differences, onPeekChange, beforeLabel, afterLabel, beforeSize, afterSize, density, }: IImageComparisonToolbarProps): ReactElement;
|
|
25
|
+
/** Comparison controls in a single horizontal wrapping toolbar row above the stage so images get the full width. */
|
|
26
|
+
export declare function ImageComparisonToolbar({ mode, onModeChange, side, onSideChange, orientation, onOrientationChange, zoom, onZoomChange, showDifferences, onShowDifferencesChange, differences, activeRegionIndex, onStepChange, onPeekChange, beforeLabel, afterLabel, beforeSize, afterSize, toolbar, density, }: IImageComparisonToolbarProps): ReactElement;
|
|
24
27
|
export {};
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import type { ReactElement } from "react";
|
|
2
|
-
import type { IImageDiff } from "./types.js";
|
|
2
|
+
import type { IImageDiff, IImageDiffRegion } from "./types.js";
|
|
3
3
|
interface IImageDifferenceOverlayProps {
|
|
4
4
|
diff: IImageDiff;
|
|
5
|
+
/** Index of the currently stepped-to changed region, emphasized more strongly than the rest. */
|
|
6
|
+
activeIndex?: number;
|
|
7
|
+
/** Renders a compact Comment affordance on each outlined changed region when provided. */
|
|
8
|
+
onCommentRegion?: (region: IImageDiffRegion, index: number) => void;
|
|
5
9
|
}
|
|
6
10
|
/** Outlines changed regions over the after image box; percentages keep the outlines aligned at every zoom level. */
|
|
7
|
-
export declare function ImageDifferenceOverlay({ diff }: IImageDifferenceOverlayProps): ReactElement;
|
|
11
|
+
export declare function ImageDifferenceOverlay({ diff, activeIndex, onCommentRegion, }: IImageDifferenceOverlayProps): ReactElement;
|
|
8
12
|
export {};
|
|
@@ -31,11 +31,23 @@ export interface IImageGalleryProps extends IDensityProps {
|
|
|
31
31
|
onStageKeyDown?: (event: KeyboardEvent<HTMLDivElement>) => void;
|
|
32
32
|
/** Further `aria-keyshortcuts` of the stage, such as "R". */
|
|
33
33
|
stageKeyShortcuts?: string;
|
|
34
|
+
/** Controlled side-by-side mode showing every item together with synchronized scrolling. */
|
|
35
|
+
compareAll?: boolean;
|
|
36
|
+
/** Initial side-by-side mode when uncontrolled. Defaults to `false`. */
|
|
37
|
+
defaultCompareAll?: boolean;
|
|
38
|
+
onCompareAllChange?: (compareAll: boolean) => void;
|
|
39
|
+
/** Offers the Compare all toggle when there are at least two items. Enabled automatically when `renderItemFooter`, `compareAll`, or `onCompareAllChange` is passed. */
|
|
40
|
+
allowCompareAll?: boolean;
|
|
41
|
+
/** Label of the Compare all toggle button. Defaults to "Compare all". */
|
|
42
|
+
compareAllLabel?: string;
|
|
43
|
+
/** Footer rendered below each item in Compare all mode, such as a per-option Choose button. */
|
|
44
|
+
renderItemFooter?: (item: IImageGalleryItem, index: number) => ReactNode;
|
|
34
45
|
}
|
|
35
46
|
/**
|
|
36
47
|
* Steps through a set of images in one `ImageViewer`, keeping its zoom and viewed position, so the same area of each
|
|
37
|
-
* image can be compared. The toolbar holds the zoom bar, Previous, "2 of 3" and Next,
|
|
38
|
-
* step on the focused stage only at Fit, where arrows do not pan.
|
|
39
|
-
*
|
|
48
|
+
* image can be compared. The toolbar holds the zoom bar, Previous, "2 of 3" and Next, an optional Compare all toggle,
|
|
49
|
+
* then `toolbar`; Left and Right step on the focused stage only at Fit, where arrows do not pan. Compare all shows
|
|
50
|
+
* every item side by side with synchronized scrolling and optional per-item footers. Compose it inside `MediaShell`
|
|
51
|
+
* and name the shell after the shown item.
|
|
40
52
|
*/
|
|
41
|
-
export declare function ImageGallery({ items, index, onIndexChange, openingWidth, label, previousLabel, nextLabel, toolbar, overlay, imageRef, stageRef, onStageKeyDown, stageKeyShortcuts, density, }: IImageGalleryProps): ReactElement;
|
|
53
|
+
export declare function ImageGallery({ items, index, onIndexChange, openingWidth, label, previousLabel, nextLabel, toolbar, overlay, imageRef, stageRef, onStageKeyDown, stageKeyShortcuts, compareAll: compareAllProp, defaultCompareAll, onCompareAllChange, allowCompareAll, compareAllLabel, renderItemFooter, density, }: IImageGalleryProps): ReactElement;
|
|
@@ -21,6 +21,8 @@ export interface IImageRegionBadgePosition {
|
|
|
21
21
|
export interface IImageRegionMarkerProps extends ComponentProps<"div"> {
|
|
22
22
|
/** Which kind of region the marker outlines. Defaults to `comment`. */
|
|
23
23
|
variant?: ImageRegionMarkerVariant;
|
|
24
|
+
/** Emphasizes the currently focused or stepped-to marker above its siblings. */
|
|
25
|
+
active?: boolean;
|
|
24
26
|
/** The region's box inside the positioned image box. Lets consumers place the marker without passing `style`. */
|
|
25
27
|
region?: IImageRegionBox;
|
|
26
28
|
}
|
|
@@ -29,7 +31,7 @@ export interface IImageRegionMarkerProps extends ComponentProps<"div"> {
|
|
|
29
31
|
* any CSS length, such as percentages of the positioned image box). Children render inside the marker's box, such as
|
|
30
32
|
* an `ImageRegionMarkerBadge` pinned to one of its corners.
|
|
31
33
|
*/
|
|
32
|
-
export declare function ImageRegionMarker({ variant, region, className, style, ...props }: IImageRegionMarkerProps): ReactElement;
|
|
34
|
+
export declare function ImageRegionMarker({ variant, active, region, className, style, ...props }: IImageRegionMarkerProps): ReactElement;
|
|
33
35
|
export interface IImageRegionMarkerBadgeProps extends ComponentProps<"div"> {
|
|
34
36
|
/** Where the badge sits relative to its marker's box. */
|
|
35
37
|
position?: IImageRegionBadgePosition;
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { type ReactElement } from "react";
|
|
2
|
-
import type { IImageRect } from "./types.js";
|
|
2
|
+
import type { IImageRect, INormalizedImagePoint } from "./types.js";
|
|
3
3
|
export interface IImageRegionSelectProps {
|
|
4
4
|
/** The placed region, drawn until it changes or is removed. */
|
|
5
5
|
region?: IImageRect;
|
|
6
6
|
/** Receives each placed region in normalized image coordinates, each value from 0 to 1. */
|
|
7
7
|
onRegionChange: (region: IImageRect) => void;
|
|
8
|
+
/** Runs when a new drag or click starts on the image, with its normalized start point. */
|
|
9
|
+
onStart?: (point: INormalizedImagePoint) => void;
|
|
8
10
|
}
|
|
9
11
|
/**
|
|
10
12
|
* Region tool for an `ImageViewer` overlay. A drag with one pointer draws a region; a click without a drag places a
|
|
@@ -14,4 +16,4 @@ export interface IImageRegionSelectProps {
|
|
|
14
16
|
* turned a region tool on, so pans and pinches stay navigation otherwise. Its pointer is kept from panning the stage; a
|
|
15
17
|
* second finger cancels the drawing and pinch-zooms instead.
|
|
16
18
|
*/
|
|
17
|
-
export declare function ImageRegionSelect({ region, onRegionChange }: IImageRegionSelectProps): ReactElement;
|
|
19
|
+
export declare function ImageRegionSelect({ region, onRegionChange, onStart }: IImageRegionSelectProps): ReactElement;
|