@alexgorbatchev/shadcn 0.0.148 → 0.0.152
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-m32ptxf3.js → chunk-4m2x9jfb.js} +1 -1
- package/dist/{chunk-p0d89mze.js → chunk-5q0670jv.js} +1 -1
- package/dist/{chunk-bfv4qesg.js → chunk-9e1yb90r.js} +1 -1
- package/dist/{chunk-ngttdb6m.js → chunk-fbajrfv6.js} +1 -1
- package/dist/{chunk-cbyqgfv4.js → chunk-kevm8s2n.js} +1 -1
- package/dist/{chunk-3dttg1b6.js → chunk-ncskzkqr.js} +1 -1
- package/dist/{chunk-v1semj30.js → chunk-rf70907h.js} +41 -16
- package/dist/{chunk-7q8kp3t5.js → chunk-ywr2pqhc.js} +1 -1
- package/dist/components/Item.d.ts +3 -1
- package/dist/components/OptionCardGroup.d.ts +23 -8
- package/dist/components/assistant-ui/elements/EditMessage.js +3 -3
- package/dist/components/assistant-ui/elements/ElicitationForm.js +3 -3
- package/dist/components/assistant-ui/elements/FeedbackDialog.js +3 -3
- package/dist/components/assistant-ui/elements/ModelPicker.js +3 -3
- package/dist/components/assistant-ui/index.js +6 -6
- package/dist/components/assistant-ui/native/McpConfigDialog.js +2 -2
- package/dist/components/assistant-ui/native/index.js +2 -2
- package/dist/components/data-grid/index.js +1 -1
- package/dist/components/event-calendar/index.js +2 -2
- package/dist/components/image-viewer/ImageComparison.d.ts +7 -2
- package/dist/components/image-viewer/ImageComparisonToolbar.d.ts +4 -2
- package/dist/components/image-viewer/ImageGallery.d.ts +41 -0
- package/dist/components/image-viewer/MediaShell.d.ts +19 -0
- package/dist/components/image-viewer/index.d.ts +5 -1
- package/dist/components/image-viewer/index.js +292 -75
- package/dist/components/image-viewer/types.d.ts +2 -0
- package/dist/components/input-otp/index.js +2 -2
- package/dist/components/json-render/JsonForm.d.ts +3 -1
- package/dist/components/json-render/index.js +16 -9
- package/dist/index.js +3 -3
- package/dist/prototype.js +1 -1
- package/llms/components/data-display/ImageComparison.md +10 -1
- package/llms/components/data-display/ImageGallery.md +62 -0
- package/llms/components/data-display/Item.md +36 -0
- package/llms/components/data-display/JsonRenderForm.md +11 -1
- package/llms/components/forms/Label.md +14 -0
- package/llms/components/forms/OptionCardGroup.md +46 -0
- package/llms/components/layout/Accordion.md +29 -0
- package/llms.txt +2 -1
- package/package.json +1 -1
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
ToggleGroup2,
|
|
18
18
|
ToggleGroupItem2
|
|
19
19
|
} from "../../chunk-32ah7jyp.js";
|
|
20
|
-
import"../../chunk-
|
|
20
|
+
import"../../chunk-4m2x9jfb.js";
|
|
21
21
|
import {
|
|
22
22
|
Separator2
|
|
23
23
|
} from "../../chunk-52aadmkc.js";
|
|
@@ -26,7 +26,7 @@ import {
|
|
|
26
26
|
FieldContent2,
|
|
27
27
|
FieldLabel2,
|
|
28
28
|
FieldDescription2
|
|
29
|
-
} from "../../chunk-
|
|
29
|
+
} from "../../chunk-9e1yb90r.js";
|
|
30
30
|
import {
|
|
31
31
|
NumberField2,
|
|
32
32
|
NumberFieldGroup2,
|
|
@@ -35,6 +35,13 @@ import {
|
|
|
35
35
|
import {
|
|
36
36
|
FramedImage2
|
|
37
37
|
} from "../../chunk-2jsgsjas.js";
|
|
38
|
+
import {
|
|
39
|
+
Dialog2,
|
|
40
|
+
DialogContent2,
|
|
41
|
+
DialogHeader2,
|
|
42
|
+
DialogTitle2,
|
|
43
|
+
DialogDescription2
|
|
44
|
+
} from "../../chunk-d22t4qx6.js";
|
|
38
45
|
import {
|
|
39
46
|
Switch2
|
|
40
47
|
} from "../../chunk-m98d89xc.js";
|
|
@@ -880,20 +887,174 @@ function ImageRegionFields({
|
|
|
880
887
|
]
|
|
881
888
|
});
|
|
882
889
|
}
|
|
890
|
+
// src/components/image-viewer/ImageGallery.tsx
|
|
891
|
+
import { ChevronLeftIcon, ChevronRightIcon } from "lucide-react";
|
|
892
|
+
import { useState as useState4 } from "react";
|
|
893
|
+
import { jsx as jsx8, jsxs as jsxs5, Fragment } from "react/jsx-runtime";
|
|
894
|
+
function isFitted(stage) {
|
|
895
|
+
return stage.closest("[data-slot=image-viewer]")?.getAttribute("data-zoom") === "fit";
|
|
896
|
+
}
|
|
897
|
+
function ImageGallery({
|
|
898
|
+
items,
|
|
899
|
+
index,
|
|
900
|
+
onIndexChange,
|
|
901
|
+
openingWidth,
|
|
902
|
+
label,
|
|
903
|
+
previousLabel = "Previous image",
|
|
904
|
+
nextLabel = "Next image",
|
|
905
|
+
toolbar,
|
|
906
|
+
overlay,
|
|
907
|
+
imageRef,
|
|
908
|
+
stageRef,
|
|
909
|
+
onStageKeyDown,
|
|
910
|
+
stageKeyShortcuts,
|
|
911
|
+
density
|
|
912
|
+
}) {
|
|
913
|
+
const [announcement, setAnnouncement] = useState4("");
|
|
914
|
+
const item = items[index];
|
|
915
|
+
const count = items.length;
|
|
916
|
+
function step(next) {
|
|
917
|
+
const target = items[next];
|
|
918
|
+
if (!target)
|
|
919
|
+
return;
|
|
920
|
+
setAnnouncement(`${target.label} · ${next + 1} of ${count}`);
|
|
921
|
+
onIndexChange(next);
|
|
922
|
+
}
|
|
923
|
+
function handleStageKey(event) {
|
|
924
|
+
onStageKeyDown?.(event);
|
|
925
|
+
if (event.defaultPrevented || event.altKey || event.ctrlKey || event.metaKey || event.shiftKey)
|
|
926
|
+
return;
|
|
927
|
+
if (event.key !== "ArrowLeft" && event.key !== "ArrowRight")
|
|
928
|
+
return;
|
|
929
|
+
if (!isFitted(event.currentTarget))
|
|
930
|
+
return;
|
|
931
|
+
event.preventDefault();
|
|
932
|
+
step(event.key === "ArrowLeft" ? index - 1 : index + 1);
|
|
933
|
+
}
|
|
934
|
+
if (!item)
|
|
935
|
+
return /* @__PURE__ */ jsx8("div", {
|
|
936
|
+
"data-slot": "image-gallery",
|
|
937
|
+
"data-density": density
|
|
938
|
+
});
|
|
939
|
+
return /* @__PURE__ */ jsxs5("div", {
|
|
940
|
+
"data-slot": "image-gallery",
|
|
941
|
+
"data-scroll": "none",
|
|
942
|
+
"data-density": density,
|
|
943
|
+
className: "flex size-full min-h-0 min-w-0 flex-1 flex-col",
|
|
944
|
+
children: [
|
|
945
|
+
/* @__PURE__ */ jsx8(ImageViewer, {
|
|
946
|
+
src: item.src,
|
|
947
|
+
alt: item.alt,
|
|
948
|
+
label: label ?? item.label,
|
|
949
|
+
openingWidth,
|
|
950
|
+
showZoomControl: true,
|
|
951
|
+
imageRef,
|
|
952
|
+
stageRef,
|
|
953
|
+
overlay,
|
|
954
|
+
onStageKeyDown: handleStageKey,
|
|
955
|
+
stageKeyShortcuts,
|
|
956
|
+
density,
|
|
957
|
+
toolbar: /* @__PURE__ */ jsxs5(Fragment, {
|
|
958
|
+
children: [
|
|
959
|
+
/* @__PURE__ */ jsxs5("div", {
|
|
960
|
+
role: "group",
|
|
961
|
+
"aria-label": "Images",
|
|
962
|
+
"data-slot": "image-gallery-stepper",
|
|
963
|
+
className: "flex items-center gap-control-gap",
|
|
964
|
+
children: [
|
|
965
|
+
/* @__PURE__ */ jsx8(Button2, {
|
|
966
|
+
variant: "outline",
|
|
967
|
+
size: "icon-sm",
|
|
968
|
+
"aria-label": previousLabel,
|
|
969
|
+
disabledReason: index === 0 ? "This is the first image" : undefined,
|
|
970
|
+
onClick: () => step(index - 1),
|
|
971
|
+
children: /* @__PURE__ */ jsx8(ChevronLeftIcon, {})
|
|
972
|
+
}),
|
|
973
|
+
/* @__PURE__ */ jsxs5("span", {
|
|
974
|
+
"data-slot": "image-gallery-position",
|
|
975
|
+
className: "text-xs text-muted-foreground tabular-nums",
|
|
976
|
+
children: [
|
|
977
|
+
index + 1,
|
|
978
|
+
" of ",
|
|
979
|
+
count
|
|
980
|
+
]
|
|
981
|
+
}),
|
|
982
|
+
/* @__PURE__ */ jsx8(Button2, {
|
|
983
|
+
variant: "outline",
|
|
984
|
+
size: "icon-sm",
|
|
985
|
+
"aria-label": nextLabel,
|
|
986
|
+
disabledReason: index === count - 1 ? "This is the last image" : undefined,
|
|
987
|
+
onClick: () => step(index + 1),
|
|
988
|
+
children: /* @__PURE__ */ jsx8(ChevronRightIcon, {})
|
|
989
|
+
})
|
|
990
|
+
]
|
|
991
|
+
}),
|
|
992
|
+
toolbar
|
|
993
|
+
]
|
|
994
|
+
})
|
|
995
|
+
}),
|
|
996
|
+
/* @__PURE__ */ jsx8("p", {
|
|
997
|
+
role: "status",
|
|
998
|
+
"data-slot": "image-gallery-status",
|
|
999
|
+
className: "sr-only",
|
|
1000
|
+
children: announcement
|
|
1001
|
+
})
|
|
1002
|
+
]
|
|
1003
|
+
});
|
|
1004
|
+
}
|
|
1005
|
+
// src/components/image-viewer/MediaShell.tsx
|
|
1006
|
+
import { jsx as jsx9, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1007
|
+
function MediaShell({
|
|
1008
|
+
open,
|
|
1009
|
+
onOpenChange,
|
|
1010
|
+
title,
|
|
1011
|
+
description,
|
|
1012
|
+
children,
|
|
1013
|
+
density
|
|
1014
|
+
}) {
|
|
1015
|
+
return /* @__PURE__ */ jsx9(Dialog2, {
|
|
1016
|
+
open,
|
|
1017
|
+
onOpenChange,
|
|
1018
|
+
children: /* @__PURE__ */ jsxs6(DialogContent2, {
|
|
1019
|
+
size: "fullscreen",
|
|
1020
|
+
density,
|
|
1021
|
+
"data-slot": "media-shell",
|
|
1022
|
+
children: [
|
|
1023
|
+
/* @__PURE__ */ jsxs6(DialogHeader2, {
|
|
1024
|
+
children: [
|
|
1025
|
+
/* @__PURE__ */ jsx9(DialogTitle2, {
|
|
1026
|
+
className: "truncate",
|
|
1027
|
+
children: title
|
|
1028
|
+
}),
|
|
1029
|
+
description !== undefined && /* @__PURE__ */ jsx9(DialogDescription2, {
|
|
1030
|
+
children: description
|
|
1031
|
+
})
|
|
1032
|
+
]
|
|
1033
|
+
}),
|
|
1034
|
+
/* @__PURE__ */ jsx9("div", {
|
|
1035
|
+
"data-slot": "media-shell-stage",
|
|
1036
|
+
"data-scroll": "none",
|
|
1037
|
+
className: "flex min-h-0 min-w-0 flex-1 flex-col",
|
|
1038
|
+
children
|
|
1039
|
+
})
|
|
1040
|
+
]
|
|
1041
|
+
})
|
|
1042
|
+
});
|
|
1043
|
+
}
|
|
883
1044
|
// src/components/image-viewer/ImageComparison.tsx
|
|
884
1045
|
import { useControlled as useControlled2 } from "@base-ui/utils/useControlled";
|
|
885
|
-
import { useRef as useRef5, useState as
|
|
1046
|
+
import { useRef as useRef5, useState as useState6 } from "react";
|
|
886
1047
|
|
|
887
1048
|
// src/components/image-viewer/ImageComparisonToolbar.tsx
|
|
888
1049
|
import { Columns2Icon, Rows2Icon } from "lucide-react";
|
|
889
1050
|
import { useId as useId2 } from "react";
|
|
890
|
-
import { jsx as
|
|
1051
|
+
import { jsx as jsx10, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
891
1052
|
function ToolbarSection({ title, titleId, children }) {
|
|
892
|
-
return /* @__PURE__ */
|
|
1053
|
+
return /* @__PURE__ */ jsxs7("div", {
|
|
893
1054
|
"data-slot": "image-comparison-toolbar-section",
|
|
894
1055
|
className: "flex min-w-0 flex-col gap-1.5",
|
|
895
1056
|
children: [
|
|
896
|
-
/* @__PURE__ */
|
|
1057
|
+
/* @__PURE__ */ jsx10("span", {
|
|
897
1058
|
id: titleId,
|
|
898
1059
|
className: "sr-only text-xs font-medium text-muted-foreground @3xl:not-sr-only",
|
|
899
1060
|
children: title
|
|
@@ -926,6 +1087,8 @@ function formatSize(size) {
|
|
|
926
1087
|
function ImageComparisonToolbar({
|
|
927
1088
|
mode,
|
|
928
1089
|
onModeChange,
|
|
1090
|
+
side,
|
|
1091
|
+
onSideChange,
|
|
929
1092
|
orientation,
|
|
930
1093
|
onOrientationChange,
|
|
931
1094
|
zoom,
|
|
@@ -944,17 +1107,17 @@ function ImageComparisonToolbar({
|
|
|
944
1107
|
const isUnavailable = differences.status === "unavailable";
|
|
945
1108
|
const releasePeek = () => onPeekChange(false);
|
|
946
1109
|
const sizeMismatch = beforeSize && afterSize && (beforeSize.width !== afterSize.width || beforeSize.height !== afterSize.height) ? `Sizes differ: ${beforeLabel} ${formatSize(beforeSize)}, ${afterLabel} ${formatSize(afterSize)}. ` + `${beforeLabel} is fitted inside the ${afterLabel} image box.` : undefined;
|
|
947
|
-
return /* @__PURE__ */
|
|
1110
|
+
return /* @__PURE__ */ jsxs7("div", {
|
|
948
1111
|
role: "group",
|
|
949
1112
|
"aria-label": "Comparison controls",
|
|
950
1113
|
"data-slot": "image-comparison-toolbar",
|
|
951
1114
|
"data-density": density,
|
|
952
1115
|
className: "flex shrink-0 flex-wrap items-end gap-x-panel gap-y-3 border-t border-border p-panel-sm @3xl:w-72 @3xl:flex-col @3xl:flex-nowrap @3xl:items-stretch @3xl:overflow-y-auto @3xl:border-t-0 @3xl:border-s",
|
|
953
1116
|
children: [
|
|
954
|
-
/* @__PURE__ */
|
|
1117
|
+
/* @__PURE__ */ jsx10(ToolbarSection, {
|
|
955
1118
|
title: "Mode",
|
|
956
1119
|
titleId: `${id}-mode`,
|
|
957
|
-
children: /* @__PURE__ */
|
|
1120
|
+
children: /* @__PURE__ */ jsxs7(ToggleGroup2, {
|
|
958
1121
|
"aria-labelledby": `${id}-mode`,
|
|
959
1122
|
required: true,
|
|
960
1123
|
value: [mode],
|
|
@@ -963,25 +1126,50 @@ function ImageComparisonToolbar({
|
|
|
963
1126
|
size: "sm",
|
|
964
1127
|
spacing: 0,
|
|
965
1128
|
children: [
|
|
966
|
-
/* @__PURE__ */
|
|
1129
|
+
/* @__PURE__ */ jsx10(ToggleGroupItem2, {
|
|
967
1130
|
value: "toggle",
|
|
968
1131
|
children: "Toggle"
|
|
969
1132
|
}),
|
|
970
|
-
/* @__PURE__ */
|
|
1133
|
+
/* @__PURE__ */ jsx10(ToggleGroupItem2, {
|
|
971
1134
|
value: "swipe",
|
|
972
1135
|
children: "Swipe"
|
|
973
1136
|
}),
|
|
974
|
-
/* @__PURE__ */
|
|
1137
|
+
/* @__PURE__ */ jsx10(ToggleGroupItem2, {
|
|
975
1138
|
value: "side-by-side",
|
|
976
1139
|
children: "Side by side"
|
|
977
1140
|
})
|
|
978
1141
|
]
|
|
979
1142
|
})
|
|
980
1143
|
}),
|
|
981
|
-
/* @__PURE__ */
|
|
1144
|
+
/* @__PURE__ */ jsx10(ToolbarSection, {
|
|
1145
|
+
title: "Shown image",
|
|
1146
|
+
titleId: `${id}-side`,
|
|
1147
|
+
children: /* @__PURE__ */ jsxs7(ToggleGroup2, {
|
|
1148
|
+
"aria-labelledby": `${id}-side`,
|
|
1149
|
+
"aria-keyshortcuts": "B A",
|
|
1150
|
+
required: true,
|
|
1151
|
+
value: [side],
|
|
1152
|
+
onValueChange: (value) => onSideChange(value[0] === "before" ? "before" : "after"),
|
|
1153
|
+
variant: "outline",
|
|
1154
|
+
size: "sm",
|
|
1155
|
+
spacing: 0,
|
|
1156
|
+
disabled: mode !== "toggle",
|
|
1157
|
+
children: [
|
|
1158
|
+
/* @__PURE__ */ jsx10(ToggleGroupItem2, {
|
|
1159
|
+
value: "before",
|
|
1160
|
+
children: beforeLabel
|
|
1161
|
+
}),
|
|
1162
|
+
/* @__PURE__ */ jsx10(ToggleGroupItem2, {
|
|
1163
|
+
value: "after",
|
|
1164
|
+
children: afterLabel
|
|
1165
|
+
})
|
|
1166
|
+
]
|
|
1167
|
+
})
|
|
1168
|
+
}),
|
|
1169
|
+
/* @__PURE__ */ jsx10(ToolbarSection, {
|
|
982
1170
|
title: "Orientation",
|
|
983
1171
|
titleId: `${id}-orientation`,
|
|
984
|
-
children: /* @__PURE__ */
|
|
1172
|
+
children: /* @__PURE__ */ jsxs7(ToggleGroup2, {
|
|
985
1173
|
"aria-labelledby": `${id}-orientation`,
|
|
986
1174
|
required: true,
|
|
987
1175
|
value: [orientation],
|
|
@@ -991,19 +1179,19 @@ function ImageComparisonToolbar({
|
|
|
991
1179
|
spacing: 0,
|
|
992
1180
|
disabled: mode !== "side-by-side",
|
|
993
1181
|
children: [
|
|
994
|
-
/* @__PURE__ */
|
|
1182
|
+
/* @__PURE__ */ jsxs7(ToggleGroupItem2, {
|
|
995
1183
|
value: "horizontal",
|
|
996
1184
|
children: [
|
|
997
|
-
/* @__PURE__ */
|
|
1185
|
+
/* @__PURE__ */ jsx10(Columns2Icon, {
|
|
998
1186
|
"data-icon": "inline-start"
|
|
999
1187
|
}),
|
|
1000
1188
|
"Horizontal"
|
|
1001
1189
|
]
|
|
1002
1190
|
}),
|
|
1003
|
-
/* @__PURE__ */
|
|
1191
|
+
/* @__PURE__ */ jsxs7(ToggleGroupItem2, {
|
|
1004
1192
|
value: "vertical",
|
|
1005
1193
|
children: [
|
|
1006
|
-
/* @__PURE__ */
|
|
1194
|
+
/* @__PURE__ */ jsx10(Rows2Icon, {
|
|
1007
1195
|
"data-icon": "inline-start"
|
|
1008
1196
|
}),
|
|
1009
1197
|
"Vertical"
|
|
@@ -1012,15 +1200,15 @@ function ImageComparisonToolbar({
|
|
|
1012
1200
|
]
|
|
1013
1201
|
})
|
|
1014
1202
|
}),
|
|
1015
|
-
/* @__PURE__ */
|
|
1203
|
+
/* @__PURE__ */ jsx10(ToolbarSection, {
|
|
1016
1204
|
title: "Zoom",
|
|
1017
1205
|
titleId: `${id}-zoom`,
|
|
1018
|
-
children: /* @__PURE__ */
|
|
1206
|
+
children: /* @__PURE__ */ jsx10(ImageZoomToggle, {
|
|
1019
1207
|
zoom,
|
|
1020
1208
|
onZoomChange
|
|
1021
1209
|
})
|
|
1022
1210
|
}),
|
|
1023
|
-
/* @__PURE__ */
|
|
1211
|
+
/* @__PURE__ */ jsx10(Button2, {
|
|
1024
1212
|
variant: "outline",
|
|
1025
1213
|
size: "sm",
|
|
1026
1214
|
disabled: mode !== "toggle",
|
|
@@ -1042,29 +1230,29 @@ function ImageComparisonToolbar({
|
|
|
1042
1230
|
},
|
|
1043
1231
|
onBlur: releasePeek,
|
|
1044
1232
|
onContextMenu: (event) => event.preventDefault(),
|
|
1045
|
-
children:
|
|
1233
|
+
children: `Hold to show ${side === "before" ? "after" : "before"}`
|
|
1046
1234
|
}),
|
|
1047
|
-
/* @__PURE__ */
|
|
1235
|
+
/* @__PURE__ */ jsxs7(Field2, {
|
|
1048
1236
|
orientation: "horizontal",
|
|
1049
1237
|
children: [
|
|
1050
|
-
/* @__PURE__ */
|
|
1238
|
+
/* @__PURE__ */ jsx10(Switch2, {
|
|
1051
1239
|
id: `${id}-differences`,
|
|
1052
1240
|
"aria-describedby": `${id}-differences-status`,
|
|
1053
1241
|
checked: showDifferences && !isUnavailable,
|
|
1054
1242
|
disabled: isUnavailable,
|
|
1055
1243
|
onCheckedChange: onShowDifferencesChange
|
|
1056
1244
|
}),
|
|
1057
|
-
/* @__PURE__ */
|
|
1245
|
+
/* @__PURE__ */ jsxs7(FieldContent2, {
|
|
1058
1246
|
children: [
|
|
1059
|
-
/* @__PURE__ */
|
|
1247
|
+
/* @__PURE__ */ jsx10(FieldLabel2, {
|
|
1060
1248
|
htmlFor: `${id}-differences`,
|
|
1061
1249
|
children: "Highlight differences"
|
|
1062
1250
|
}),
|
|
1063
|
-
showDifferences && differences.status === "ready" && /* @__PURE__ */
|
|
1251
|
+
showDifferences && differences.status === "ready" && /* @__PURE__ */ jsxs7(FieldDescription2, {
|
|
1064
1252
|
"data-slot": "image-comparison-legend",
|
|
1065
1253
|
className: "flex items-center gap-1.5",
|
|
1066
1254
|
children: [
|
|
1067
|
-
/* @__PURE__ */
|
|
1255
|
+
/* @__PURE__ */ jsx10("span", {
|
|
1068
1256
|
"aria-hidden": "true",
|
|
1069
1257
|
className: "mx-[3px] size-2.5 shrink-0 rounded-xs bg-warning/10 ring-1 ring-background outline-2 outline-offset-1 outline-warning"
|
|
1070
1258
|
}),
|
|
@@ -1075,16 +1263,16 @@ function ImageComparisonToolbar({
|
|
|
1075
1263
|
})
|
|
1076
1264
|
]
|
|
1077
1265
|
}),
|
|
1078
|
-
/* @__PURE__ */
|
|
1266
|
+
/* @__PURE__ */ jsxs7("div", {
|
|
1079
1267
|
"data-slot": "image-comparison-status",
|
|
1080
1268
|
className: "flex min-w-0 flex-col gap-1 text-xs text-muted-foreground",
|
|
1081
1269
|
children: [
|
|
1082
|
-
/* @__PURE__ */
|
|
1270
|
+
/* @__PURE__ */ jsx10("p", {
|
|
1083
1271
|
id: `${id}-differences-status`,
|
|
1084
1272
|
role: "status",
|
|
1085
1273
|
children: describeDifferences(differences, showDifferences)
|
|
1086
1274
|
}),
|
|
1087
|
-
sizeMismatch && /* @__PURE__ */
|
|
1275
|
+
sizeMismatch && /* @__PURE__ */ jsx10("p", {
|
|
1088
1276
|
"data-slot": "image-comparison-size-mismatch",
|
|
1089
1277
|
children: sizeMismatch
|
|
1090
1278
|
})
|
|
@@ -1095,16 +1283,16 @@ function ImageComparisonToolbar({
|
|
|
1095
1283
|
}
|
|
1096
1284
|
|
|
1097
1285
|
// src/components/image-viewer/ImageDifferenceOverlay.tsx
|
|
1098
|
-
import { jsx as
|
|
1286
|
+
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
1099
1287
|
function toPercent2(value, total) {
|
|
1100
1288
|
return `${value / total * 100}%`;
|
|
1101
1289
|
}
|
|
1102
1290
|
function ImageDifferenceOverlay({ diff }) {
|
|
1103
|
-
return /* @__PURE__ */
|
|
1291
|
+
return /* @__PURE__ */ jsx11("div", {
|
|
1104
1292
|
"data-slot": "image-difference-overlay",
|
|
1105
1293
|
"aria-hidden": "true",
|
|
1106
1294
|
className: "pointer-events-none absolute inset-0",
|
|
1107
|
-
children: diff.regions.map((region) => /* @__PURE__ */
|
|
1295
|
+
children: diff.regions.map((region) => /* @__PURE__ */ jsx11(ImageRegionMarker, {
|
|
1108
1296
|
"data-slot": "image-difference-region",
|
|
1109
1297
|
variant: "difference",
|
|
1110
1298
|
region: {
|
|
@@ -1121,16 +1309,16 @@ function ImageDifferenceOverlay({ diff }) {
|
|
|
1121
1309
|
import { DirectionProvider } from "@base-ui/react/direction-provider";
|
|
1122
1310
|
import { Slider as SliderPrimitive } from "@base-ui/react/slider";
|
|
1123
1311
|
import { ChevronsLeftRightIcon } from "lucide-react";
|
|
1124
|
-
import { jsx as
|
|
1312
|
+
import { jsx as jsx12, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1125
1313
|
function ImageSwipeDivider({
|
|
1126
1314
|
value,
|
|
1127
1315
|
onValueChange,
|
|
1128
1316
|
beforeLabel,
|
|
1129
1317
|
afterLabel
|
|
1130
1318
|
}) {
|
|
1131
|
-
return /* @__PURE__ */
|
|
1319
|
+
return /* @__PURE__ */ jsx12(DirectionProvider, {
|
|
1132
1320
|
direction: "ltr",
|
|
1133
|
-
children: /* @__PURE__ */
|
|
1321
|
+
children: /* @__PURE__ */ jsx12(SliderPrimitive.Root, {
|
|
1134
1322
|
dir: "ltr",
|
|
1135
1323
|
"data-slot": "image-swipe-divider",
|
|
1136
1324
|
value,
|
|
@@ -1140,22 +1328,22 @@ function ImageSwipeDivider({
|
|
|
1140
1328
|
step: 1,
|
|
1141
1329
|
largeStep: 10,
|
|
1142
1330
|
className: "pointer-events-none absolute inset-0",
|
|
1143
|
-
children: /* @__PURE__ */
|
|
1331
|
+
children: /* @__PURE__ */ jsx12(SliderPrimitive.Control, {
|
|
1144
1332
|
className: "pointer-events-none absolute inset-0",
|
|
1145
|
-
children: /* @__PURE__ */
|
|
1333
|
+
children: /* @__PURE__ */ jsxs8(SliderPrimitive.Thumb, {
|
|
1146
1334
|
"data-slot": "image-swipe-divider-handle",
|
|
1147
1335
|
getAriaLabel: () => "Swipe divider",
|
|
1148
1336
|
getAriaValueText: (_formatted, current) => `${beforeLabel} ${current}%, ${afterLabel} ${100 - current}%`,
|
|
1149
1337
|
className: "group/divider pointer-events-auto flex h-full w-6 cursor-ew-resize touch-none flex-col items-center justify-center select-none",
|
|
1150
1338
|
children: [
|
|
1151
|
-
/* @__PURE__ */
|
|
1339
|
+
/* @__PURE__ */ jsx12("span", {
|
|
1152
1340
|
"aria-hidden": "true",
|
|
1153
1341
|
className: "absolute inset-y-0 start-1/2 w-0.5 -translate-x-1/2 bg-foreground ring-1 ring-background"
|
|
1154
1342
|
}),
|
|
1155
|
-
/* @__PURE__ */
|
|
1343
|
+
/* @__PURE__ */ jsx12("span", {
|
|
1156
1344
|
"aria-hidden": "true",
|
|
1157
1345
|
className: "relative flex h-8 w-5 items-center justify-center rounded-sm border border-border bg-background text-foreground shadow-frame group-has-[:focus-visible]/divider:border-ring group-has-[:focus-visible]/divider:ring-1 group-has-[:focus-visible]/divider:ring-ring group-data-dragging/divider:border-ring",
|
|
1158
|
-
children: /* @__PURE__ */
|
|
1346
|
+
children: /* @__PURE__ */ jsx12(ChevronsLeftRightIcon, {
|
|
1159
1347
|
className: "size-3.5"
|
|
1160
1348
|
})
|
|
1161
1349
|
})
|
|
@@ -1167,7 +1355,7 @@ function ImageSwipeDivider({
|
|
|
1167
1355
|
}
|
|
1168
1356
|
|
|
1169
1357
|
// src/components/image-viewer/hooks/useImageDifferences.ts
|
|
1170
|
-
import { useEffect as useEffect2, useRef as useRef4, useState as
|
|
1358
|
+
import { useEffect as useEffect2, useRef as useRef4, useState as useState5 } from "react";
|
|
1171
1359
|
|
|
1172
1360
|
// src/components/image-viewer/computeImageDiff.ts
|
|
1173
1361
|
var DEFAULT_THRESHOLD = 32;
|
|
@@ -1380,7 +1568,7 @@ function useImageDifferences({
|
|
|
1380
1568
|
beforeRef,
|
|
1381
1569
|
afterRef
|
|
1382
1570
|
}) {
|
|
1383
|
-
const [entries, setEntries] =
|
|
1571
|
+
const [entries, setEntries] = useState5(() => new Map);
|
|
1384
1572
|
const startedRef = useRef4(new Set);
|
|
1385
1573
|
const controllerRef = useRef4(undefined);
|
|
1386
1574
|
useEffect2(() => () => controllerRef.current?.abort(), [pairKey]);
|
|
@@ -1421,14 +1609,14 @@ function useImageDifferences({
|
|
|
1421
1609
|
}
|
|
1422
1610
|
|
|
1423
1611
|
// src/components/image-viewer/ImageComparison.tsx
|
|
1424
|
-
import { jsx as
|
|
1612
|
+
import { jsx as jsx13, jsxs as jsxs9, Fragment as Fragment2 } from "react/jsx-runtime";
|
|
1425
1613
|
function ComparisonPane({ header, children }) {
|
|
1426
|
-
return /* @__PURE__ */
|
|
1614
|
+
return /* @__PURE__ */ jsxs9("div", {
|
|
1427
1615
|
"data-slot": "image-comparison-pane",
|
|
1428
1616
|
"data-scroll": "none",
|
|
1429
1617
|
className: "flex min-h-0 min-w-0 flex-1 flex-col",
|
|
1430
1618
|
children: [
|
|
1431
|
-
/* @__PURE__ */
|
|
1619
|
+
/* @__PURE__ */ jsx13("div", {
|
|
1432
1620
|
"data-slot": "image-comparison-pane-header",
|
|
1433
1621
|
className: "flex h-control shrink-0 items-center justify-between gap-2 px-control-x text-xs font-medium text-muted-foreground",
|
|
1434
1622
|
children: header
|
|
@@ -1445,6 +1633,9 @@ function ImageComparison({
|
|
|
1445
1633
|
mode: modeProp,
|
|
1446
1634
|
defaultMode = "toggle",
|
|
1447
1635
|
onModeChange,
|
|
1636
|
+
side: sideProp,
|
|
1637
|
+
defaultSide = "after",
|
|
1638
|
+
onSideChange,
|
|
1448
1639
|
orientation: orientationProp,
|
|
1449
1640
|
defaultOrientation = "horizontal",
|
|
1450
1641
|
onOrientationChange,
|
|
@@ -1464,6 +1655,12 @@ function ImageComparison({
|
|
|
1464
1655
|
name: "ImageComparison",
|
|
1465
1656
|
state: "mode"
|
|
1466
1657
|
});
|
|
1658
|
+
const [side, setSideState] = useControlled2({
|
|
1659
|
+
controlled: sideProp,
|
|
1660
|
+
default: defaultSide,
|
|
1661
|
+
name: "ImageComparison",
|
|
1662
|
+
state: "side"
|
|
1663
|
+
});
|
|
1467
1664
|
const [orientation, setOrientationState] = useControlled2({
|
|
1468
1665
|
controlled: orientationProp,
|
|
1469
1666
|
default: defaultOrientation,
|
|
@@ -1482,8 +1679,8 @@ function ImageComparison({
|
|
|
1482
1679
|
name: "ImageComparison",
|
|
1483
1680
|
state: "showDifferences"
|
|
1484
1681
|
});
|
|
1485
|
-
const [isPeeking, setIsPeeking] =
|
|
1486
|
-
const [position, setPosition] =
|
|
1682
|
+
const [isPeeking, setIsPeeking] = useState6(false);
|
|
1683
|
+
const [position, setPosition] = useState6(50);
|
|
1487
1684
|
const [beforeImage, beforeHandlers] = useImageLoad(before.src);
|
|
1488
1685
|
const [afterImage, afterHandlers] = useImageLoad(after.src);
|
|
1489
1686
|
const beforeRef = useRef5(null);
|
|
@@ -1502,11 +1699,12 @@ ${after.src}`,
|
|
|
1502
1699
|
beforeRef,
|
|
1503
1700
|
afterRef
|
|
1504
1701
|
});
|
|
1505
|
-
const
|
|
1506
|
-
const
|
|
1702
|
+
const shownSide = mode !== "toggle" ? "after" : isPeeking ? side === "before" ? "after" : "before" : side;
|
|
1703
|
+
const isShowingBefore = shownSide === "before";
|
|
1704
|
+
const overlay = showDifferences && differences.status === "ready" ? /* @__PURE__ */ jsx13(ImageDifferenceOverlay, {
|
|
1507
1705
|
diff: differences.diff
|
|
1508
1706
|
}) : null;
|
|
1509
|
-
const fallback = failedLabel ? /* @__PURE__ */
|
|
1707
|
+
const fallback = failedLabel ? /* @__PURE__ */ jsxs9("p", {
|
|
1510
1708
|
"data-slot": "image-comparison-error",
|
|
1511
1709
|
className: "m-auto p-panel text-center text-sm text-muted-foreground",
|
|
1512
1710
|
children: [
|
|
@@ -1519,6 +1717,19 @@ ${after.src}`,
|
|
|
1519
1717
|
setModeState(next);
|
|
1520
1718
|
onModeChange?.(next);
|
|
1521
1719
|
}
|
|
1720
|
+
function setSide(next) {
|
|
1721
|
+
setSideState(next);
|
|
1722
|
+
onSideChange?.(next);
|
|
1723
|
+
}
|
|
1724
|
+
function handleToggleStageKey(event) {
|
|
1725
|
+
if (event.altKey || event.ctrlKey || event.metaKey || event.shiftKey)
|
|
1726
|
+
return;
|
|
1727
|
+
const key = event.key.toLowerCase();
|
|
1728
|
+
if (key !== "b" && key !== "a")
|
|
1729
|
+
return;
|
|
1730
|
+
event.preventDefault();
|
|
1731
|
+
setSide(key === "b" ? "before" : "after");
|
|
1732
|
+
}
|
|
1522
1733
|
function setOrientation(next) {
|
|
1523
1734
|
setOrientationState(next);
|
|
1524
1735
|
onOrientationChange?.(next);
|
|
@@ -1544,7 +1755,7 @@ ${after.src}`,
|
|
|
1544
1755
|
}
|
|
1545
1756
|
}
|
|
1546
1757
|
function renderAfterImage(className) {
|
|
1547
|
-
return /* @__PURE__ */
|
|
1758
|
+
return /* @__PURE__ */ jsx13("img", {
|
|
1548
1759
|
ref: afterRef,
|
|
1549
1760
|
src: after.src,
|
|
1550
1761
|
alt: after.alt,
|
|
@@ -1557,7 +1768,7 @@ ${after.src}`,
|
|
|
1557
1768
|
});
|
|
1558
1769
|
}
|
|
1559
1770
|
function renderBeforeImage(className, style) {
|
|
1560
|
-
return /* @__PURE__ */
|
|
1771
|
+
return /* @__PURE__ */ jsx13("img", {
|
|
1561
1772
|
ref: beforeRef,
|
|
1562
1773
|
src: before.src,
|
|
1563
1774
|
alt: before.alt,
|
|
@@ -1572,15 +1783,15 @@ ${after.src}`,
|
|
|
1572
1783
|
}
|
|
1573
1784
|
let content;
|
|
1574
1785
|
if (mode === "side-by-side") {
|
|
1575
|
-
content = /* @__PURE__ */
|
|
1786
|
+
content = /* @__PURE__ */ jsxs9("div", {
|
|
1576
1787
|
"data-slot": "image-comparison-panes",
|
|
1577
1788
|
className: cn2("flex min-h-0 min-w-0 flex-1", orientation === "vertical" ? "flex-col" : "flex-row"),
|
|
1578
1789
|
children: [
|
|
1579
|
-
/* @__PURE__ */
|
|
1580
|
-
header: /* @__PURE__ */
|
|
1790
|
+
/* @__PURE__ */ jsx13(ComparisonPane, {
|
|
1791
|
+
header: /* @__PURE__ */ jsx13("span", {
|
|
1581
1792
|
children: beforeLabel
|
|
1582
1793
|
}),
|
|
1583
|
-
children: /* @__PURE__ */
|
|
1794
|
+
children: /* @__PURE__ */ jsxs9(ImageViewport, {
|
|
1584
1795
|
label: beforeLabel,
|
|
1585
1796
|
zoom,
|
|
1586
1797
|
naturalSize: afterImage.size,
|
|
@@ -1595,14 +1806,14 @@ ${after.src}`,
|
|
|
1595
1806
|
]
|
|
1596
1807
|
})
|
|
1597
1808
|
}),
|
|
1598
|
-
/* @__PURE__ */
|
|
1809
|
+
/* @__PURE__ */ jsx13(Separator2, {
|
|
1599
1810
|
orientation: orientation === "vertical" ? "horizontal" : "vertical"
|
|
1600
1811
|
}),
|
|
1601
|
-
/* @__PURE__ */
|
|
1602
|
-
header: /* @__PURE__ */
|
|
1812
|
+
/* @__PURE__ */ jsx13(ComparisonPane, {
|
|
1813
|
+
header: /* @__PURE__ */ jsx13("span", {
|
|
1603
1814
|
children: afterLabel
|
|
1604
1815
|
}),
|
|
1605
|
-
children: /* @__PURE__ */
|
|
1816
|
+
children: /* @__PURE__ */ jsxs9(ImageViewport, {
|
|
1606
1817
|
label: afterLabel,
|
|
1607
1818
|
zoom,
|
|
1608
1819
|
naturalSize: afterImage.size,
|
|
@@ -1620,18 +1831,18 @@ ${after.src}`,
|
|
|
1620
1831
|
]
|
|
1621
1832
|
});
|
|
1622
1833
|
} else if (mode === "swipe") {
|
|
1623
|
-
content = /* @__PURE__ */
|
|
1624
|
-
header: /* @__PURE__ */
|
|
1834
|
+
content = /* @__PURE__ */ jsx13(ComparisonPane, {
|
|
1835
|
+
header: /* @__PURE__ */ jsxs9(Fragment2, {
|
|
1625
1836
|
children: [
|
|
1626
|
-
/* @__PURE__ */
|
|
1837
|
+
/* @__PURE__ */ jsx13("span", {
|
|
1627
1838
|
children: beforeLabel
|
|
1628
1839
|
}),
|
|
1629
|
-
/* @__PURE__ */
|
|
1840
|
+
/* @__PURE__ */ jsx13("span", {
|
|
1630
1841
|
children: afterLabel
|
|
1631
1842
|
})
|
|
1632
1843
|
]
|
|
1633
1844
|
}),
|
|
1634
|
-
children: /* @__PURE__ */
|
|
1845
|
+
children: /* @__PURE__ */ jsxs9(ImageViewport, {
|
|
1635
1846
|
label: `${beforeLabel} and ${afterLabel}`,
|
|
1636
1847
|
zoom,
|
|
1637
1848
|
naturalSize: afterImage.size,
|
|
@@ -1642,7 +1853,7 @@ ${after.src}`,
|
|
|
1642
1853
|
renderAfterImage(),
|
|
1643
1854
|
renderBeforeImage(undefined, { clipPath: `inset(0 ${100 - position}% 0 0)` }),
|
|
1644
1855
|
overlay,
|
|
1645
|
-
/* @__PURE__ */
|
|
1856
|
+
/* @__PURE__ */ jsx13(ImageSwipeDivider, {
|
|
1646
1857
|
value: position,
|
|
1647
1858
|
onValueChange: setPosition,
|
|
1648
1859
|
beforeLabel,
|
|
@@ -1653,8 +1864,8 @@ ${after.src}`,
|
|
|
1653
1864
|
});
|
|
1654
1865
|
} else {
|
|
1655
1866
|
const showingLabel = isShowingBefore ? beforeLabel : afterLabel;
|
|
1656
|
-
content = /* @__PURE__ */
|
|
1657
|
-
header: /* @__PURE__ */
|
|
1867
|
+
content = /* @__PURE__ */ jsx13(ComparisonPane, {
|
|
1868
|
+
header: /* @__PURE__ */ jsxs9("span", {
|
|
1658
1869
|
"data-slot": "image-comparison-showing",
|
|
1659
1870
|
"aria-live": "polite",
|
|
1660
1871
|
children: [
|
|
@@ -1662,13 +1873,15 @@ ${after.src}`,
|
|
|
1662
1873
|
showingLabel
|
|
1663
1874
|
]
|
|
1664
1875
|
}),
|
|
1665
|
-
children: /* @__PURE__ */
|
|
1876
|
+
children: /* @__PURE__ */ jsxs9(ImageViewport, {
|
|
1666
1877
|
label: showingLabel,
|
|
1667
1878
|
zoom,
|
|
1668
1879
|
naturalSize: afterImage.size,
|
|
1669
1880
|
center,
|
|
1670
1881
|
onZoomChange: setZoom,
|
|
1671
1882
|
fallback,
|
|
1883
|
+
onStageKeyDown: handleToggleStageKey,
|
|
1884
|
+
stageKeyShortcuts: "B A",
|
|
1672
1885
|
children: [
|
|
1673
1886
|
renderAfterImage(isShowingBefore ? "invisible" : undefined),
|
|
1674
1887
|
renderBeforeImage(isShowingBefore ? undefined : "invisible"),
|
|
@@ -1677,7 +1890,7 @@ ${after.src}`,
|
|
|
1677
1890
|
})
|
|
1678
1891
|
});
|
|
1679
1892
|
}
|
|
1680
|
-
return /* @__PURE__ */
|
|
1893
|
+
return /* @__PURE__ */ jsx13("div", {
|
|
1681
1894
|
role: "group",
|
|
1682
1895
|
"aria-label": label,
|
|
1683
1896
|
"data-slot": "image-comparison",
|
|
@@ -1688,18 +1901,20 @@ ${after.src}`,
|
|
|
1688
1901
|
"data-zoom": zoom,
|
|
1689
1902
|
"data-showing": isShowingBefore ? "before" : "after",
|
|
1690
1903
|
className: "@container flex size-full min-h-0 min-w-0 flex-1",
|
|
1691
|
-
children: /* @__PURE__ */
|
|
1904
|
+
children: /* @__PURE__ */ jsxs9("div", {
|
|
1692
1905
|
className: "flex min-h-0 min-w-0 flex-1 flex-col @3xl:flex-row",
|
|
1693
1906
|
children: [
|
|
1694
|
-
/* @__PURE__ */
|
|
1907
|
+
/* @__PURE__ */ jsx13("div", {
|
|
1695
1908
|
"data-slot": "image-comparison-stage",
|
|
1696
1909
|
"data-scroll": "none",
|
|
1697
1910
|
className: "flex min-h-0 min-w-0 flex-1",
|
|
1698
1911
|
children: content
|
|
1699
1912
|
}),
|
|
1700
|
-
showToolbar && /* @__PURE__ */
|
|
1913
|
+
showToolbar && /* @__PURE__ */ jsx13(ImageComparisonToolbar, {
|
|
1701
1914
|
mode,
|
|
1702
1915
|
onModeChange: setMode,
|
|
1916
|
+
side,
|
|
1917
|
+
onSideChange: setSide,
|
|
1703
1918
|
orientation,
|
|
1704
1919
|
onOrientationChange: setOrientation,
|
|
1705
1920
|
zoom,
|
|
@@ -1723,6 +1938,7 @@ export {
|
|
|
1723
1938
|
IMAGE_REGION_STEP,
|
|
1724
1939
|
IMAGE_ZOOM_STEPS,
|
|
1725
1940
|
ImageComparison,
|
|
1941
|
+
ImageGallery,
|
|
1726
1942
|
ImageRegionFields,
|
|
1727
1943
|
ImageRegionMarker,
|
|
1728
1944
|
ImageRegionMarkerBadge,
|
|
@@ -1732,6 +1948,7 @@ export {
|
|
|
1732
1948
|
ImageZoomToggle,
|
|
1733
1949
|
MAX_IMAGE_ZOOM,
|
|
1734
1950
|
MIN_IMAGE_REGION_SIZE,
|
|
1951
|
+
MediaShell,
|
|
1735
1952
|
applyImageRegionKey,
|
|
1736
1953
|
clampImageRegion,
|
|
1737
1954
|
computeImageDiff,
|