@alexgorbatchev/shadcn 0.0.162 → 0.0.164
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/{chunk-zyt63zrh.js → chunk-aw5f97jz.js} +1 -1
- package/dist/{chunk-hev911n9.js → chunk-cjfd69vt.js} +2 -2
- package/dist/{chunk-e4t5njn9.js → chunk-fecmzpgx.js} +4 -4
- package/dist/{chunk-46p9pkw1.js → chunk-nx931ac3.js} +1 -1
- package/dist/{chunk-y7jv23qt.js → chunk-rghpa4yc.js} +1 -1
- package/dist/components/assistant-ui/elements/ElicitationForm.js +2 -2
- package/dist/components/assistant-ui/elements/ScheduleCard.js +2 -2
- package/dist/components/assistant-ui/elements/SettingsPanel.js +2 -2
- package/dist/components/assistant-ui/index.js +4 -4
- package/dist/components/image-viewer/ImageComparison.d.ts +3 -1
- package/dist/components/image-viewer/ImageComparisonToolbar.d.ts +5 -2
- package/dist/components/image-viewer/hooks/useElementSize.d.ts +1 -1
- package/dist/components/image-viewer/index.js +125 -90
- package/dist/components/json-render/index.js +1 -1
- package/dist/components/text-diff/index.js +1 -1
- package/dist/index.js +1 -1
- package/dist/prototype.js +1 -1
- package/package.json +1 -1
|
@@ -14,12 +14,12 @@ function Switch2({ analytics, density, className, size = "default", ...props })
|
|
|
14
14
|
"data-density": density,
|
|
15
15
|
"data-slot": "switch",
|
|
16
16
|
"data-size": size,
|
|
17
|
-
className: (state) => cn2("peer group/switch relative inline-flex shrink-0 items-center rounded-sm border border-input transition-colors outline-none group-has-[:focus-visible]/field-label:border-transparent group-has-[:focus-visible]/field-label:ring-0 after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive data-[size=default]:h-
|
|
17
|
+
className: (state) => cn2("peer group/switch relative inline-flex shrink-0 items-center rounded-sm border border-input transition-colors outline-none group-has-[:focus-visible]/field-label:border-transparent group-has-[:focus-visible]/field-label:ring-0 after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-1 focus-visible:ring-ring aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive data-[size=default]:h-6 data-[size=default]:w-10 data-[size=sm]:h-4 data-[size=sm]:w-7 data-checked:border-primary data-checked:bg-primary data-unchecked:bg-muted data-disabled:cursor-not-allowed data-disabled:opacity-50", typeof className === "function" ? className(state) : className),
|
|
18
18
|
...props,
|
|
19
19
|
onCheckedChange: trackedOnCheckedChange,
|
|
20
20
|
children: /* @__PURE__ */ jsx(SwitchPrimitive.Thumb, {
|
|
21
21
|
"data-slot": "switch-thumb",
|
|
22
|
-
className: "pointer-events-none absolute top-1/2 start-0.5 block -translate-y-1/2 rounded-xs bg-foreground ring-0 transition-[inset-inline-start,background-color] group-data-[size=default]/switch:size-
|
|
22
|
+
className: "pointer-events-none absolute top-1/2 start-0.5 block -translate-y-1/2 rounded-xs bg-foreground ring-0 transition-[inset-inline-start,background-color] group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-2.5 data-checked:bg-primary-foreground group-data-[size=default]/switch:data-checked:start-[calc(100%-1rem-2px)] group-data-[size=sm]/switch:data-checked:start-[calc(100%-0.625rem-2px)]"
|
|
23
23
|
})
|
|
24
24
|
});
|
|
25
25
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// src/components/image-viewer/hooks/useElementSize.ts
|
|
2
2
|
import { useIsoLayoutEffect } from "@base-ui/utils/useIsoLayoutEffect";
|
|
3
3
|
import { useState } from "react";
|
|
4
|
-
function useElementSize(
|
|
4
|
+
function useElementSize(target) {
|
|
5
5
|
const [size, setSize] = useState();
|
|
6
6
|
useIsoLayoutEffect(() => {
|
|
7
|
-
const element =
|
|
7
|
+
const element = target && "current" in target ? target.current : target;
|
|
8
8
|
if (!element)
|
|
9
9
|
return;
|
|
10
10
|
const measure = () => {
|
|
@@ -16,8 +16,8 @@ function useElementSize(ref) {
|
|
|
16
16
|
const observer = new ResizeObserver(measure);
|
|
17
17
|
observer.observe(element);
|
|
18
18
|
return () => observer.disconnect();
|
|
19
|
-
}, [
|
|
20
|
-
return size;
|
|
19
|
+
}, [target]);
|
|
20
|
+
return target ? size : undefined;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
export { useElementSize };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ElicitationForm2
|
|
3
|
-
} from "../../../chunk-
|
|
3
|
+
} from "../../../chunk-nx931ac3.js";
|
|
4
4
|
import"../../../chunk-vxvaaptq.js";
|
|
5
5
|
import"../../../chunk-kgqe8gpb.js";
|
|
6
|
-
import"../../../chunk-
|
|
6
|
+
import"../../../chunk-cjfd69vt.js";
|
|
7
7
|
import"../../../chunk-5ez5vgkn.js";
|
|
8
8
|
import"../../../chunk-jc3cbwyg.js";
|
|
9
9
|
import"../../../chunk-4m2x9jfb.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ScheduleCard2
|
|
3
|
-
} from "../../../chunk-
|
|
4
|
-
import"../../../chunk-
|
|
3
|
+
} from "../../../chunk-rghpa4yc.js";
|
|
4
|
+
import"../../../chunk-cjfd69vt.js";
|
|
5
5
|
import"../../../chunk-5mydsjp3.js";
|
|
6
6
|
import"../../../chunk-8ssktt4b.js";
|
|
7
7
|
import"../../../chunk-7ny0vyek.js";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
SettingsPanel2
|
|
3
|
-
} from "../../../chunk-
|
|
3
|
+
} from "../../../chunk-aw5f97jz.js";
|
|
4
4
|
import"../../../chunk-7cq1s2ey.js";
|
|
5
|
-
import"../../../chunk-
|
|
5
|
+
import"../../../chunk-cjfd69vt.js";
|
|
6
6
|
import"../../../chunk-p51p95er.js";
|
|
7
7
|
import"../../../chunk-7jpsybag.js";
|
|
8
8
|
import"../../../chunk-2sx8m8b2.js";
|
|
@@ -231,10 +231,10 @@ import {
|
|
|
231
231
|
EditMessage2
|
|
232
232
|
} from "../../chunk-tgkc06q4.js";
|
|
233
233
|
import"../../chunk-kgqe8gpb.js";
|
|
234
|
-
import"../../chunk-
|
|
234
|
+
import"../../chunk-cjfd69vt.js";
|
|
235
235
|
import {
|
|
236
236
|
ElicitationForm2
|
|
237
|
-
} from "../../chunk-
|
|
237
|
+
} from "../../chunk-nx931ac3.js";
|
|
238
238
|
import"../../chunk-4e96tpw0.js";
|
|
239
239
|
import {
|
|
240
240
|
EmptyState2
|
|
@@ -499,7 +499,7 @@ import {
|
|
|
499
499
|
} from "../../chunk-x4rwh3pv.js";
|
|
500
500
|
import {
|
|
501
501
|
ScheduleCard2
|
|
502
|
-
} from "../../chunk-
|
|
502
|
+
} from "../../chunk-rghpa4yc.js";
|
|
503
503
|
import {
|
|
504
504
|
ScoreBreakdown2
|
|
505
505
|
} from "../../chunk-cqwg3q9q.js";
|
|
@@ -509,7 +509,7 @@ import {
|
|
|
509
509
|
import"../../chunk-7cq1s2ey.js";
|
|
510
510
|
import {
|
|
511
511
|
SettingsPanel2
|
|
512
|
-
} from "../../chunk-
|
|
512
|
+
} from "../../chunk-aw5f97jz.js";
|
|
513
513
|
import {
|
|
514
514
|
SharedConversation2
|
|
515
515
|
} from "../../chunk-fxh3wgg9.js";
|
|
@@ -35,6 +35,8 @@ 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
|
+
/** Uses the incremental zoom control (Fit, Fit width, −, %, +) instead of the two-way Fit/Original toggle. */
|
|
39
|
+
showZoomControl?: boolean;
|
|
38
40
|
/** Further controls in the toolbar row after the comparison controls, such as comment actions. */
|
|
39
41
|
toolbar?: ReactNode;
|
|
40
42
|
/** Content positioned over the before image (before pane in side-by-side, stage in toggle and swipe). */
|
|
@@ -60,4 +62,4 @@ export interface IImageComparisonProps extends IDensityProps {
|
|
|
60
62
|
* inside the after image's box. Highlighting differences compares pixels on first use, caches the result per pair, and
|
|
61
63
|
* steps through changed regions with buttons or N / Shift+N.
|
|
62
64
|
*/
|
|
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;
|
|
65
|
+
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, showZoomControl, toolbar, beforeOverlay, afterOverlay, stageOverlay, onCommentDifference, onSwipePositionChange, onStageKeyDown, stageKeyShortcuts, label, density, }: IImageComparisonProps): ReactElement;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type ReactElement, type ReactNode } from "react";
|
|
2
2
|
import type { IDensityProps } from "../../density/types.js";
|
|
3
|
-
import type { IImageSize, ImageComparisonMode, ImageComparisonOrientation, ImageComparisonSide, ImageDifferenceState, ImageZoom } from "./types.js";
|
|
3
|
+
import type { IImageSize, IImageZoomScales, ImageComparisonMode, ImageComparisonOrientation, ImageComparisonSide, ImageDifferenceState, ImageZoom } from "./types.js";
|
|
4
4
|
interface IImageComparisonToolbarProps extends IDensityProps {
|
|
5
5
|
mode: ImageComparisonMode;
|
|
6
6
|
onModeChange: (mode: ImageComparisonMode) => void;
|
|
@@ -10,6 +10,9 @@ interface IImageComparisonToolbarProps extends IDensityProps {
|
|
|
10
10
|
onOrientationChange: (orientation: ImageComparisonOrientation) => void;
|
|
11
11
|
zoom: ImageZoom;
|
|
12
12
|
onZoomChange: (zoom: ImageZoom) => void;
|
|
13
|
+
showZoomControl?: boolean;
|
|
14
|
+
zoomScale?: number;
|
|
15
|
+
zoomScales?: IImageZoomScales;
|
|
13
16
|
showDifferences: boolean;
|
|
14
17
|
onShowDifferencesChange: (showDifferences: boolean) => void;
|
|
15
18
|
differences: ImageDifferenceState;
|
|
@@ -24,5 +27,5 @@ interface IImageComparisonToolbarProps extends IDensityProps {
|
|
|
24
27
|
toolbar?: ReactNode;
|
|
25
28
|
}
|
|
26
29
|
/** Comparison controls in a single horizontal wrapping toolbar row above the stage so images get the full width. */
|
|
27
|
-
export declare function ImageComparisonToolbar({ mode, onModeChange, side, onSideChange, orientation, onOrientationChange, zoom, onZoomChange, showDifferences, onShowDifferencesChange, differences, activeRegionIndex, onStepChange, onCommentActiveDifference, onPeekChange, beforeLabel, afterLabel, beforeSize, afterSize, toolbar, density, }: IImageComparisonToolbarProps): ReactElement;
|
|
30
|
+
export declare function ImageComparisonToolbar({ mode, onModeChange, side, onSideChange, orientation, onOrientationChange, zoom, onZoomChange, showZoomControl, zoomScale, zoomScales, showDifferences, onShowDifferencesChange, differences, activeRegionIndex, onStepChange, onCommentActiveDifference, onPeekChange, beforeLabel, afterLabel, beforeSize, afterSize, toolbar, density, }: IImageComparisonToolbarProps): ReactElement;
|
|
28
31
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { type RefObject } from "react";
|
|
2
2
|
import type { IImageSize } from "../types.js";
|
|
3
3
|
/** Tracks an element's client size, which excludes borders and scrollbars. */
|
|
4
|
-
export declare function useElementSize(
|
|
4
|
+
export declare function useElementSize(target: RefObject<HTMLElement | null> | HTMLElement | null): IImageSize | undefined;
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "../../chunk-en44w1pn.js";
|
|
4
4
|
import {
|
|
5
5
|
useElementSize
|
|
6
|
-
} from "../../chunk-
|
|
6
|
+
} from "../../chunk-fecmzpgx.js";
|
|
7
7
|
import"../../chunk-7ny0vyek.js";
|
|
8
8
|
import"../../chunk-8ssktt4b.js";
|
|
9
9
|
import"../../chunk-e6hk39ev.js";
|
|
@@ -48,7 +48,7 @@ import {
|
|
|
48
48
|
} from "../../chunk-d22t4qx6.js";
|
|
49
49
|
import {
|
|
50
50
|
Switch2
|
|
51
|
-
} from "../../chunk-
|
|
51
|
+
} from "../../chunk-cjfd69vt.js";
|
|
52
52
|
import"../../chunk-5mydsjp3.js";
|
|
53
53
|
|
|
54
54
|
// src/components/image-viewer/ImageViewer.tsx
|
|
@@ -409,25 +409,25 @@ function ImageViewport({
|
|
|
409
409
|
"data-slot": "image-viewport-scroll-hint",
|
|
410
410
|
"data-edge": "left",
|
|
411
411
|
"aria-hidden": "true",
|
|
412
|
-
className: "pointer-events-none absolute inset-y-0 left-0 w-5 bg-gradient-to-r from-black/45 via-black/15 to-transparent dark:from-black/
|
|
412
|
+
className: "pointer-events-none absolute inset-y-0 left-0 w-5 bg-gradient-to-r from-black/45 via-black/15 to-transparent dark:from-black/75 dark:via-black/30 dark:shadow-[inset_8px_0_12px_-8px_rgba(255,255,255,0.28)]"
|
|
413
413
|
}),
|
|
414
414
|
scrollHints.right && /* @__PURE__ */ jsx("div", {
|
|
415
415
|
"data-slot": "image-viewport-scroll-hint",
|
|
416
416
|
"data-edge": "right",
|
|
417
417
|
"aria-hidden": "true",
|
|
418
|
-
className: "pointer-events-none absolute inset-y-0 right-0 w-5 bg-gradient-to-l from-black/45 via-black/15 to-transparent dark:from-black/
|
|
418
|
+
className: "pointer-events-none absolute inset-y-0 right-0 w-5 bg-gradient-to-l from-black/45 via-black/15 to-transparent dark:from-black/75 dark:via-black/30 dark:shadow-[inset_-8px_0_12px_-8px_rgba(255,255,255,0.28)]"
|
|
419
419
|
}),
|
|
420
420
|
scrollHints.top && /* @__PURE__ */ jsx("div", {
|
|
421
421
|
"data-slot": "image-viewport-scroll-hint",
|
|
422
422
|
"data-edge": "top",
|
|
423
423
|
"aria-hidden": "true",
|
|
424
|
-
className: "pointer-events-none absolute inset-x-0 top-0 h-5 bg-gradient-to-b from-black/45 via-black/15 to-transparent dark:from-black/
|
|
424
|
+
className: "pointer-events-none absolute inset-x-0 top-0 h-5 bg-gradient-to-b from-black/45 via-black/15 to-transparent dark:from-black/75 dark:via-black/30 dark:shadow-[inset_0_8px_12px_-8px_rgba(255,255,255,0.28)]"
|
|
425
425
|
}),
|
|
426
426
|
scrollHints.bottom && /* @__PURE__ */ jsx("div", {
|
|
427
427
|
"data-slot": "image-viewport-scroll-hint",
|
|
428
428
|
"data-edge": "bottom",
|
|
429
429
|
"aria-hidden": "true",
|
|
430
|
-
className: "pointer-events-none absolute inset-x-0 bottom-0 h-5 bg-gradient-to-t from-black/45 via-black/15 to-transparent dark:from-black/
|
|
430
|
+
className: "pointer-events-none absolute inset-x-0 bottom-0 h-5 bg-gradient-to-t from-black/45 via-black/15 to-transparent dark:from-black/75 dark:via-black/30 dark:shadow-[inset_0_-8px_12px_-8px_rgba(255,255,255,0.28)]"
|
|
431
431
|
})
|
|
432
432
|
]
|
|
433
433
|
});
|
|
@@ -788,7 +788,13 @@ function prepareDiagramSvg(svg, ownerDocument, options) {
|
|
|
788
788
|
imported.style.height = "100%";
|
|
789
789
|
} else {
|
|
790
790
|
imported.removeAttribute("height");
|
|
791
|
-
|
|
791
|
+
if (size.width > 0) {
|
|
792
|
+
imported.setAttribute("width", String(size.width));
|
|
793
|
+
imported.style.width = "100%";
|
|
794
|
+
imported.style.maxWidth = `${size.width}px`;
|
|
795
|
+
} else {
|
|
796
|
+
imported.style.maxWidth = "100%";
|
|
797
|
+
}
|
|
792
798
|
imported.style.height = "auto";
|
|
793
799
|
imported.style.marginInline = "auto";
|
|
794
800
|
}
|
|
@@ -914,7 +920,7 @@ function DiagramViewer({
|
|
|
914
920
|
children: [
|
|
915
921
|
(showZoomControl || toolbar !== undefined) && /* @__PURE__ */ jsxs5("div", {
|
|
916
922
|
"data-slot": "diagram-viewer-toolbar",
|
|
917
|
-
className: "flex shrink-0 flex-wrap items-center gap-control-gap *:shrink-0",
|
|
923
|
+
className: "flex shrink-0 flex-wrap items-center gap-control-gap *:shrink-0 [@media(max-height:280px)]:flex-nowrap [@media(max-height:280px)]:overflow-x-auto",
|
|
918
924
|
children: [
|
|
919
925
|
showZoomControl && /* @__PURE__ */ jsx5(ImageZoomControl, {
|
|
920
926
|
zoom: shownZoom,
|
|
@@ -937,7 +943,7 @@ function DiagramViewer({
|
|
|
937
943
|
stageKeyShortcuts,
|
|
938
944
|
children: /* @__PURE__ */ jsx5("div", {
|
|
939
945
|
"data-slot": "diagram-viewer-frame",
|
|
940
|
-
className: "size-full bg-card
|
|
946
|
+
className: "size-full bg-card",
|
|
941
947
|
children: /* @__PURE__ */ jsx5(DiagramSurface, {
|
|
942
948
|
svg,
|
|
943
949
|
label,
|
|
@@ -1770,6 +1776,7 @@ function MediaShell({
|
|
|
1770
1776
|
}
|
|
1771
1777
|
// src/components/image-viewer/ImageComparison.tsx
|
|
1772
1778
|
import { useControlled as useControlled4 } from "@base-ui/utils/useControlled";
|
|
1779
|
+
import { useMergedRefs as useMergedRefs4 } from "@base-ui/utils/useMergedRefs";
|
|
1773
1780
|
import { useRef as useRef8, useState as useState9 } from "react";
|
|
1774
1781
|
|
|
1775
1782
|
// src/components/image-viewer/ImageComparisonToolbar.tsx
|
|
@@ -1820,6 +1827,9 @@ function ImageComparisonToolbar({
|
|
|
1820
1827
|
onOrientationChange,
|
|
1821
1828
|
zoom,
|
|
1822
1829
|
onZoomChange,
|
|
1830
|
+
showZoomControl = false,
|
|
1831
|
+
zoomScale,
|
|
1832
|
+
zoomScales,
|
|
1823
1833
|
showDifferences,
|
|
1824
1834
|
onShowDifferencesChange,
|
|
1825
1835
|
differences,
|
|
@@ -1846,7 +1856,7 @@ function ImageComparisonToolbar({
|
|
|
1846
1856
|
"aria-label": "Comparison controls",
|
|
1847
1857
|
"data-slot": "image-comparison-toolbar",
|
|
1848
1858
|
"data-density": density,
|
|
1849
|
-
className: "flex shrink-0 flex-wrap items-center gap-
|
|
1859
|
+
className: "flex shrink-0 flex-wrap items-center gap-1.5 border-b border-border py-2",
|
|
1850
1860
|
children: [
|
|
1851
1861
|
/* @__PURE__ */ jsx12(ToolbarSection, {
|
|
1852
1862
|
title: "Mode",
|
|
@@ -1916,20 +1926,28 @@ function ImageComparisonToolbar({
|
|
|
1916
1926
|
children: [
|
|
1917
1927
|
/* @__PURE__ */ jsxs10(ToggleGroupItem2, {
|
|
1918
1928
|
value: "horizontal",
|
|
1929
|
+
"aria-label": "Horizontal",
|
|
1919
1930
|
children: [
|
|
1920
1931
|
/* @__PURE__ */ jsx12(Columns2Icon, {
|
|
1921
1932
|
"data-icon": "inline-start"
|
|
1922
1933
|
}),
|
|
1923
|
-
"
|
|
1934
|
+
/* @__PURE__ */ jsx12("span", {
|
|
1935
|
+
className: "hidden @md:inline",
|
|
1936
|
+
children: "Horizontal"
|
|
1937
|
+
})
|
|
1924
1938
|
]
|
|
1925
1939
|
}),
|
|
1926
1940
|
/* @__PURE__ */ jsxs10(ToggleGroupItem2, {
|
|
1927
1941
|
value: "vertical",
|
|
1942
|
+
"aria-label": "Vertical",
|
|
1928
1943
|
children: [
|
|
1929
1944
|
/* @__PURE__ */ jsx12(Rows2Icon, {
|
|
1930
1945
|
"data-icon": "inline-start"
|
|
1931
1946
|
}),
|
|
1932
|
-
"
|
|
1947
|
+
/* @__PURE__ */ jsx12("span", {
|
|
1948
|
+
className: "hidden @md:inline",
|
|
1949
|
+
children: "Vertical"
|
|
1950
|
+
})
|
|
1933
1951
|
]
|
|
1934
1952
|
})
|
|
1935
1953
|
]
|
|
@@ -1938,7 +1956,13 @@ function ImageComparisonToolbar({
|
|
|
1938
1956
|
/* @__PURE__ */ jsx12(ToolbarSection, {
|
|
1939
1957
|
title: "Zoom",
|
|
1940
1958
|
titleId: `${id}-zoom`,
|
|
1941
|
-
children: /* @__PURE__ */ jsx12(
|
|
1959
|
+
children: showZoomControl ? /* @__PURE__ */ jsx12(ImageZoomControl, {
|
|
1960
|
+
zoom,
|
|
1961
|
+
scale: zoomScale,
|
|
1962
|
+
scales: zoomScales,
|
|
1963
|
+
onZoomChange,
|
|
1964
|
+
density
|
|
1965
|
+
}) : /* @__PURE__ */ jsx12(ImageZoomToggle, {
|
|
1942
1966
|
zoom,
|
|
1943
1967
|
onZoomChange,
|
|
1944
1968
|
density
|
|
@@ -1968,27 +1992,43 @@ function ImageComparisonToolbar({
|
|
|
1968
1992
|
onContextMenu: (event) => event.preventDefault(),
|
|
1969
1993
|
children: `Hold to show ${side === "before" ? "after" : "before"}`
|
|
1970
1994
|
}),
|
|
1995
|
+
toolbar && /* @__PURE__ */ jsx12("div", {
|
|
1996
|
+
"data-slot": "image-comparison-toolbar-extra",
|
|
1997
|
+
className: "contents",
|
|
1998
|
+
children: toolbar
|
|
1999
|
+
}),
|
|
1971
2000
|
/* @__PURE__ */ jsxs10("div", {
|
|
1972
|
-
className: "flex
|
|
2001
|
+
className: "flex shrink-0 items-center gap-1.5",
|
|
1973
2002
|
children: [
|
|
1974
|
-
/* @__PURE__ */
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
children: "Highlight differences"
|
|
1988
|
-
})
|
|
1989
|
-
]
|
|
2003
|
+
/* @__PURE__ */ jsx12(Switch2, {
|
|
2004
|
+
id: `${id}-differences`,
|
|
2005
|
+
"aria-labelledby": `${id}-differences-label`,
|
|
2006
|
+
"aria-describedby": `${id}-differences-status`,
|
|
2007
|
+
checked: showDifferences && !isUnavailable,
|
|
2008
|
+
disabled: isUnavailable,
|
|
2009
|
+
onCheckedChange: onShowDifferencesChange
|
|
2010
|
+
}),
|
|
2011
|
+
/* @__PURE__ */ jsx12("label", {
|
|
2012
|
+
id: `${id}-differences-label`,
|
|
2013
|
+
htmlFor: `${id}-differences`,
|
|
2014
|
+
className: "cursor-pointer text-sm leading-none font-medium whitespace-nowrap select-none",
|
|
2015
|
+
children: "Highlight differences"
|
|
1990
2016
|
}),
|
|
1991
|
-
|
|
2017
|
+
/* @__PURE__ */ jsx12("p", {
|
|
2018
|
+
id: `${id}-differences-status`,
|
|
2019
|
+
role: "status",
|
|
2020
|
+
className: hasStepper || !statusText ? "sr-only" : "text-xs text-muted-foreground",
|
|
2021
|
+
children: statusText
|
|
2022
|
+
})
|
|
2023
|
+
]
|
|
2024
|
+
}),
|
|
2025
|
+
hasStepper && /* @__PURE__ */ jsxs10("div", {
|
|
2026
|
+
role: "group",
|
|
2027
|
+
"aria-label": "Changed regions",
|
|
2028
|
+
"data-slot": "image-comparison-stepper",
|
|
2029
|
+
className: "flex flex-wrap items-center gap-1.5",
|
|
2030
|
+
children: [
|
|
2031
|
+
/* @__PURE__ */ jsxs10("span", {
|
|
1992
2032
|
"data-slot": "image-comparison-legend",
|
|
1993
2033
|
className: "flex items-center gap-1.5 text-xs whitespace-nowrap text-muted-foreground",
|
|
1994
2034
|
children: [
|
|
@@ -1996,71 +2036,55 @@ function ImageComparisonToolbar({
|
|
|
1996
2036
|
"aria-hidden": "true",
|
|
1997
2037
|
className: "mx-[3px] size-2.5 shrink-0 rounded-xs bg-warning/10 ring-1 ring-background outline-2 outline-offset-1 outline-warning"
|
|
1998
2038
|
}),
|
|
1999
|
-
"
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
role: "group",
|
|
2004
|
-
"aria-label": "Changed regions",
|
|
2005
|
-
"data-slot": "image-comparison-stepper",
|
|
2006
|
-
className: "flex flex-wrap items-center gap-1.5",
|
|
2007
|
-
children: [
|
|
2039
|
+
/* @__PURE__ */ jsx12("span", {
|
|
2040
|
+
className: "hidden @md:inline",
|
|
2041
|
+
children: "Changed region"
|
|
2042
|
+
}),
|
|
2008
2043
|
/* @__PURE__ */ jsx12("span", {
|
|
2009
2044
|
"aria-hidden": "true",
|
|
2010
|
-
className: "
|
|
2045
|
+
className: "hidden @md:inline",
|
|
2011
2046
|
children: "·"
|
|
2012
|
-
}),
|
|
2013
|
-
/* @__PURE__ */ jsxs10("span", {
|
|
2014
|
-
"data-slot": "image-comparison-change-count",
|
|
2015
|
-
className: "text-xs whitespace-nowrap text-muted-foreground tabular-nums",
|
|
2016
|
-
children: [
|
|
2017
|
-
"Change ",
|
|
2018
|
-
activeRegionIndex + 1,
|
|
2019
|
-
" of ",
|
|
2020
|
-
regionCount
|
|
2021
|
-
]
|
|
2022
|
-
}),
|
|
2023
|
-
/* @__PURE__ */ jsx12(Button2, {
|
|
2024
|
-
variant: "outline",
|
|
2025
|
-
size: "icon-sm",
|
|
2026
|
-
density,
|
|
2027
|
-
"aria-label": "Previous change",
|
|
2028
|
-
"aria-keyshortcuts": "Shift+N",
|
|
2029
|
-
onClick: () => onStepChange(-1),
|
|
2030
|
-
children: /* @__PURE__ */ jsx12(ChevronLeftIcon2, {})
|
|
2031
|
-
}),
|
|
2032
|
-
/* @__PURE__ */ jsx12(Button2, {
|
|
2033
|
-
variant: "outline",
|
|
2034
|
-
size: "icon-sm",
|
|
2035
|
-
density,
|
|
2036
|
-
"aria-label": "Next change",
|
|
2037
|
-
"aria-keyshortcuts": "N",
|
|
2038
|
-
onClick: () => onStepChange(1),
|
|
2039
|
-
children: /* @__PURE__ */ jsx12(ChevronRightIcon2, {})
|
|
2040
|
-
}),
|
|
2041
|
-
onCommentActiveDifference && /* @__PURE__ */ jsx12(Button2, {
|
|
2042
|
-
variant: "outline",
|
|
2043
|
-
size: "sm",
|
|
2044
|
-
density,
|
|
2045
|
-
"aria-label": `Comment on change ${activeRegionIndex + 1} of ${regionCount}`,
|
|
2046
|
-
onClick: onCommentActiveDifference,
|
|
2047
|
-
children: "Comment on change"
|
|
2048
2047
|
})
|
|
2049
2048
|
]
|
|
2050
2049
|
}),
|
|
2051
|
-
/* @__PURE__ */
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2050
|
+
/* @__PURE__ */ jsxs10("span", {
|
|
2051
|
+
"data-slot": "image-comparison-change-count",
|
|
2052
|
+
className: "text-xs whitespace-nowrap text-muted-foreground tabular-nums",
|
|
2053
|
+
children: [
|
|
2054
|
+
"Change ",
|
|
2055
|
+
activeRegionIndex + 1,
|
|
2056
|
+
" of ",
|
|
2057
|
+
regionCount
|
|
2058
|
+
]
|
|
2059
|
+
}),
|
|
2060
|
+
/* @__PURE__ */ jsx12(Button2, {
|
|
2061
|
+
variant: "outline",
|
|
2062
|
+
size: "icon-sm",
|
|
2063
|
+
density,
|
|
2064
|
+
"aria-label": "Previous change",
|
|
2065
|
+
"aria-keyshortcuts": "Shift+N",
|
|
2066
|
+
onClick: () => onStepChange(-1),
|
|
2067
|
+
children: /* @__PURE__ */ jsx12(ChevronLeftIcon2, {})
|
|
2068
|
+
}),
|
|
2069
|
+
/* @__PURE__ */ jsx12(Button2, {
|
|
2070
|
+
variant: "outline",
|
|
2071
|
+
size: "icon-sm",
|
|
2072
|
+
density,
|
|
2073
|
+
"aria-label": "Next change",
|
|
2074
|
+
"aria-keyshortcuts": "N",
|
|
2075
|
+
onClick: () => onStepChange(1),
|
|
2076
|
+
children: /* @__PURE__ */ jsx12(ChevronRightIcon2, {})
|
|
2077
|
+
}),
|
|
2078
|
+
onCommentActiveDifference && /* @__PURE__ */ jsx12(Button2, {
|
|
2079
|
+
variant: "outline",
|
|
2080
|
+
size: "sm",
|
|
2081
|
+
density,
|
|
2082
|
+
"aria-label": `Comment on change ${activeRegionIndex + 1} of ${regionCount}`,
|
|
2083
|
+
onClick: onCommentActiveDifference,
|
|
2084
|
+
children: "Comment on change"
|
|
2056
2085
|
})
|
|
2057
2086
|
]
|
|
2058
2087
|
}),
|
|
2059
|
-
toolbar && /* @__PURE__ */ jsx12("div", {
|
|
2060
|
-
"data-slot": "image-comparison-toolbar-extra",
|
|
2061
|
-
className: "flex min-w-0 flex-wrap items-center gap-2 @2xl:border-s @2xl:border-border @2xl:ps-2",
|
|
2062
|
-
children: toolbar
|
|
2063
|
-
}),
|
|
2064
2088
|
sizeMismatch && /* @__PURE__ */ jsx12("p", {
|
|
2065
2089
|
"data-slot": "image-comparison-size-mismatch",
|
|
2066
2090
|
className: "w-full text-xs text-muted-foreground",
|
|
@@ -2441,6 +2465,7 @@ function ImageComparison({
|
|
|
2441
2465
|
defaultShowDifferences = false,
|
|
2442
2466
|
onShowDifferencesChange,
|
|
2443
2467
|
showToolbar = true,
|
|
2468
|
+
showZoomControl = false,
|
|
2444
2469
|
toolbar,
|
|
2445
2470
|
beforeOverlay,
|
|
2446
2471
|
afterOverlay,
|
|
@@ -2504,9 +2529,16 @@ ${after.src}`;
|
|
|
2504
2529
|
const singleViewportRef = useRef8(null);
|
|
2505
2530
|
const beforeViewportRef = useRef8(null);
|
|
2506
2531
|
const afterViewportRef = useRef8(null);
|
|
2532
|
+
const [singleViewportElement, setSingleViewportElement] = useState9(null);
|
|
2533
|
+
const [afterViewportElement, setAfterViewportElement] = useState9(null);
|
|
2534
|
+
const mergedSingleViewportRef = useMergedRefs4(singleViewportRef, setSingleViewportElement);
|
|
2535
|
+
const mergedAfterViewportRef = useMergedRefs4(afterViewportRef, setAfterViewportElement);
|
|
2507
2536
|
const expectedScrollRef = useRef8(new WeakMap);
|
|
2508
2537
|
const center = useRef8({ x: 0.5, y: 0.5 });
|
|
2509
2538
|
const stageSize = useElementSize(stageRef);
|
|
2539
|
+
const activeViewportSize = useElementSize(mode === "side-by-side" ? afterViewportElement : singleViewportElement);
|
|
2540
|
+
const zoomScales = afterImage.size && activeViewportSize ? getImageZoomScales(afterImage.size, activeViewportSize) : undefined;
|
|
2541
|
+
const zoomScale = zoomScales ? resolveImageZoomScale(zoom, zoomScales) : undefined;
|
|
2510
2542
|
const autoOrientation = stageSize && stageSize.height > stageSize.width ? "vertical" : "horizontal";
|
|
2511
2543
|
const orientation = chosenOrientation ?? autoOrientation;
|
|
2512
2544
|
const failedLabel = afterImage.status === "error" ? afterLabel : beforeImage.status === "error" ? beforeLabel : undefined;
|
|
@@ -2701,7 +2733,7 @@ ${after.src}`;
|
|
|
2701
2733
|
center,
|
|
2702
2734
|
onZoomChange: setZoom,
|
|
2703
2735
|
fallback,
|
|
2704
|
-
viewportRef:
|
|
2736
|
+
viewportRef: mergedAfterViewportRef,
|
|
2705
2737
|
onViewportScroll: (viewport) => syncScroll(viewport, beforeViewportRef.current),
|
|
2706
2738
|
onStageKeyDown: (event) => handleStageKey(event, "after"),
|
|
2707
2739
|
stageKeyShortcuts: sharedStageKeys || undefined,
|
|
@@ -2733,7 +2765,7 @@ ${after.src}`;
|
|
|
2733
2765
|
center,
|
|
2734
2766
|
onZoomChange: setZoom,
|
|
2735
2767
|
fallback,
|
|
2736
|
-
viewportRef:
|
|
2768
|
+
viewportRef: mergedSingleViewportRef,
|
|
2737
2769
|
onStageKeyDown: (event) => handleStageKey(event, position > 50 ? "before" : "after"),
|
|
2738
2770
|
stageKeyShortcuts: sharedStageKeys || undefined,
|
|
2739
2771
|
children: [
|
|
@@ -2770,7 +2802,7 @@ ${after.src}`;
|
|
|
2770
2802
|
center,
|
|
2771
2803
|
onZoomChange: setZoom,
|
|
2772
2804
|
fallback,
|
|
2773
|
-
viewportRef:
|
|
2805
|
+
viewportRef: mergedSingleViewportRef,
|
|
2774
2806
|
onStageKeyDown: (event) => handleStageKey(event, shownSide),
|
|
2775
2807
|
stageKeyShortcuts: toggleStageKeys,
|
|
2776
2808
|
children: [
|
|
@@ -2805,6 +2837,9 @@ ${after.src}`;
|
|
|
2805
2837
|
onOrientationChange: setOrientation,
|
|
2806
2838
|
zoom,
|
|
2807
2839
|
onZoomChange: setZoom,
|
|
2840
|
+
showZoomControl,
|
|
2841
|
+
zoomScale,
|
|
2842
|
+
zoomScales,
|
|
2808
2843
|
showDifferences,
|
|
2809
2844
|
onShowDifferencesChange: setShowDifferences,
|
|
2810
2845
|
differences,
|
package/dist/index.js
CHANGED
package/dist/prototype.js
CHANGED
|
@@ -2051,7 +2051,7 @@ var program = new Command;
|
|
|
2051
2051
|
// package.json
|
|
2052
2052
|
var package_default = {
|
|
2053
2053
|
name: "@alexgorbatchev/shadcn",
|
|
2054
|
-
version: "0.0.
|
|
2054
|
+
version: "0.0.164",
|
|
2055
2055
|
description: "Sharp, monospace React components with compact, comfortable, and touch densities.",
|
|
2056
2056
|
license: "MIT",
|
|
2057
2057
|
repository: {
|