@alexgorbatchev/shadcn 0.0.89 → 0.0.91
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-x6ed6smh.js → chunk-s5820zky.js} +6 -4
- package/dist/components/Toolbar.d.ts +10 -2
- package/dist/components/editor/index.js +1 -1
- package/dist/components/image-viewer/ImageRegionMarker.d.ts +24 -0
- package/dist/components/image-viewer/index.d.ts +2 -0
- package/dist/components/image-viewer/index.js +60 -29
- package/dist/components/json-render/index.js +1 -1
- package/dist/index.js +1 -1
- package/dist/prototype.js +1 -1
- package/dist/theme.css +17 -0
- package/llms/components/actions/Toolbar.md +14 -0
- package/llms/components/data-display/ImageRegionMarker.md +89 -0
- package/llms.txt +1 -0
- package/package.json +1 -1
|
@@ -14,12 +14,13 @@ import {
|
|
|
14
14
|
// src/components/Toolbar.tsx
|
|
15
15
|
import { Toolbar as ToolbarPrimitive } from "@base-ui/react/toolbar";
|
|
16
16
|
import { jsx } from "react/jsx-runtime";
|
|
17
|
-
function Toolbar2({ density, className, ...props }) {
|
|
17
|
+
function Toolbar2({ density, className, variant = "framed", ...props }) {
|
|
18
18
|
return /* @__PURE__ */ jsx(ToolbarPrimitive.Root, {
|
|
19
19
|
"data-density": density,
|
|
20
20
|
"data-slot": "toolbar",
|
|
21
21
|
"data-scroll": "none",
|
|
22
|
-
|
|
22
|
+
"data-variant": variant,
|
|
23
|
+
className: (state) => cn2("flex min-w-0 gap-control-gap rounded-sm text-card-foreground data-[orientation=vertical]:flex-col", variant === "framed" && "border border-border bg-card p-1", typeof className === "function" ? className(state) : className),
|
|
23
24
|
...props
|
|
24
25
|
});
|
|
25
26
|
}
|
|
@@ -68,11 +69,12 @@ function ToolbarInput2({
|
|
|
68
69
|
...analyticsInput
|
|
69
70
|
});
|
|
70
71
|
}
|
|
71
|
-
function ToolbarGroup2({ density, className, ...props }) {
|
|
72
|
+
function ToolbarGroup2({ density, className, wrap = false, ...props }) {
|
|
72
73
|
return /* @__PURE__ */ jsx(ToolbarPrimitive.Group, {
|
|
73
74
|
"data-density": density,
|
|
74
75
|
"data-slot": "toolbar-group",
|
|
75
|
-
|
|
76
|
+
"data-wrap": wrap ? "" : undefined,
|
|
77
|
+
className: (state) => cn2("flex items-center gap-control-gap data-[orientation=vertical]:flex-col", wrap && "flex-wrap", typeof className === "function" ? className(state) : className),
|
|
76
78
|
...props
|
|
77
79
|
});
|
|
78
80
|
}
|
|
@@ -2,10 +2,18 @@ import type { IAnalyticsProps } from "../analytics/types.js";
|
|
|
2
2
|
import type { ReactElement } from "react";
|
|
3
3
|
import type { IDensityProps } from "../density/types.js";
|
|
4
4
|
import { Toolbar as ToolbarPrimitive } from "@base-ui/react/toolbar";
|
|
5
|
-
|
|
5
|
+
type ToolbarProps = ToolbarPrimitive.Root.Props & IDensityProps & {
|
|
6
|
+
/** `framed` (the default) draws a card around the controls; `plain` lays them out inside another surface. */
|
|
7
|
+
variant?: "framed" | "plain";
|
|
8
|
+
};
|
|
9
|
+
declare function Toolbar({ density, className, variant, ...props }: ToolbarProps): ReactElement;
|
|
6
10
|
declare function ToolbarButton({ analytics, density, className, ...props }: ToolbarPrimitive.Button.Props & IDensityProps & IAnalyticsProps): ReactElement;
|
|
7
11
|
declare function ToolbarLink({ analytics, density, className, ...props }: ToolbarPrimitive.Link.Props & IDensityProps & IAnalyticsProps): ReactElement;
|
|
8
12
|
declare function ToolbarInput({ analytics, density, className, ...props }: ToolbarPrimitive.Input.Props & IDensityProps & IAnalyticsProps): ReactElement;
|
|
9
|
-
|
|
13
|
+
type ToolbarGroupProps = ToolbarPrimitive.Group.Props & IDensityProps & {
|
|
14
|
+
/** Lets the group's controls wrap onto further lines instead of overflowing, as a set of chips does. */
|
|
15
|
+
wrap?: boolean;
|
|
16
|
+
};
|
|
17
|
+
declare function ToolbarGroup({ density, className, wrap, ...props }: ToolbarGroupProps): ReactElement;
|
|
10
18
|
declare function ToolbarSeparator({ density, className, ...props }: ToolbarPrimitive.Separator.Props & IDensityProps): ReactElement;
|
|
11
19
|
export { Toolbar, ToolbarButton, ToolbarLink, ToolbarInput, ToolbarGroup, ToolbarSeparator };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { ComponentProps, ReactElement } from "react";
|
|
2
|
+
import { type VariantProps } from "class-variance-authority";
|
|
3
|
+
declare const imageRegionMarkerVariants: (props?: ({
|
|
4
|
+
variant?: "difference" | "draft" | "comment" | null | undefined;
|
|
5
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
6
|
+
export type ImageRegionMarkerVariant = NonNullable<VariantProps<typeof imageRegionMarkerVariants>["variant"]>;
|
|
7
|
+
export interface IImageRegionMarkerProps extends ComponentProps<"div"> {
|
|
8
|
+
/** Which kind of region the marker outlines. Defaults to `comment`. */
|
|
9
|
+
variant?: ImageRegionMarkerVariant;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Outlines a region drawn over an image. Position it with `style` (`left`, `top`, `width`, `height`, in pixels or
|
|
13
|
+
* percentages of the positioned image box). Children render inside the marker's box, such as an
|
|
14
|
+
* `ImageRegionMarkerBadge` pinned to one of its corners.
|
|
15
|
+
*/
|
|
16
|
+
export declare function ImageRegionMarker({ variant, className, ...props }: IImageRegionMarkerProps): ReactElement;
|
|
17
|
+
export type IImageRegionMarkerBadgeProps = ComponentProps<"div">;
|
|
18
|
+
/**
|
|
19
|
+
* Holds an interactive control, such as a comment-count button, beside an `ImageRegionMarker`. It carries the
|
|
20
|
+
* marker's outline and halo, so its edge stays visible on light and dark screenshots. Position it with `style`
|
|
21
|
+
* relative to the marker's box; it receives pointer events although the marker does not.
|
|
22
|
+
*/
|
|
23
|
+
export declare function ImageRegionMarkerBadge({ className, ...props }: IImageRegionMarkerBadgeProps): ReactElement;
|
|
24
|
+
export {};
|
|
@@ -7,3 +7,5 @@ export type { IImageComparisonProps } from "./ImageComparison.js";
|
|
|
7
7
|
export { computeImageDiff } from "./computeImageDiff.js";
|
|
8
8
|
export { getNormalizedImagePoint } from "./getNormalizedImagePoint.js";
|
|
9
9
|
export type { IImageComparisonSource, IImageDiff, IImageDiffOptions, IImageDiffRegion, IImagePixels, IImageRect, IImageSize, INormalizedImagePoint, ImageComparisonMode, ImageComparisonOrientation, ImageZoom, } from "./types.js";
|
|
10
|
+
export { ImageRegionMarker, ImageRegionMarkerBadge } from "./ImageRegionMarker.js";
|
|
11
|
+
export type { IImageRegionMarkerBadgeProps, IImageRegionMarkerProps, ImageRegionMarkerVariant, } from "./ImageRegionMarker.js";
|
|
@@ -475,19 +475,48 @@ function ImageComparisonToolbar({
|
|
|
475
475
|
});
|
|
476
476
|
}
|
|
477
477
|
|
|
478
|
-
// src/components/image-viewer/
|
|
478
|
+
// src/components/image-viewer/ImageRegionMarker.tsx
|
|
479
|
+
import { cva } from "class-variance-authority";
|
|
479
480
|
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
481
|
+
var imageRegionMarkerVariants = cva("pointer-events-none absolute rounded-xs shadow-[0_0_0_4px_var(--background)] ring-1 ring-background outline-2 outline-offset-1 forced-colors:outline-[Highlight]", {
|
|
482
|
+
variants: {
|
|
483
|
+
variant: {
|
|
484
|
+
comment: "bg-primary/10 outline-primary",
|
|
485
|
+
draft: "bg-primary/10 outline-dashed outline-primary",
|
|
486
|
+
difference: "bg-warning/10 outline-warning"
|
|
487
|
+
}
|
|
488
|
+
},
|
|
489
|
+
defaultVariants: { variant: "comment" }
|
|
490
|
+
});
|
|
491
|
+
function ImageRegionMarker({ variant, className, ...props }) {
|
|
492
|
+
return /* @__PURE__ */ jsx5("div", {
|
|
493
|
+
"data-slot": "image-region-marker",
|
|
494
|
+
"data-variant": variant ?? "comment",
|
|
495
|
+
className: cn2(imageRegionMarkerVariants({ variant }), className),
|
|
496
|
+
...props
|
|
497
|
+
});
|
|
498
|
+
}
|
|
499
|
+
function ImageRegionMarkerBadge({ className, ...props }) {
|
|
500
|
+
return /* @__PURE__ */ jsx5("div", {
|
|
501
|
+
"data-slot": "image-region-marker-badge",
|
|
502
|
+
className: cn2("pointer-events-auto absolute z-10 rounded-sm shadow-[0_0_0_4px_var(--background)] outline-2 outline-primary forced-colors:outline-[Highlight]", className),
|
|
503
|
+
...props
|
|
504
|
+
});
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
// src/components/image-viewer/ImageDifferenceOverlay.tsx
|
|
508
|
+
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
480
509
|
function toPercent(value, total) {
|
|
481
510
|
return `${value / total * 100}%`;
|
|
482
511
|
}
|
|
483
512
|
function ImageDifferenceOverlay({ diff }) {
|
|
484
|
-
return /* @__PURE__ */
|
|
513
|
+
return /* @__PURE__ */ jsx6("div", {
|
|
485
514
|
"data-slot": "image-difference-overlay",
|
|
486
515
|
"aria-hidden": "true",
|
|
487
516
|
className: "pointer-events-none absolute inset-0",
|
|
488
|
-
children: diff.regions.map((region) => /* @__PURE__ */
|
|
517
|
+
children: diff.regions.map((region) => /* @__PURE__ */ jsx6(ImageRegionMarker, {
|
|
489
518
|
"data-slot": "image-difference-region",
|
|
490
|
-
|
|
519
|
+
variant: "difference",
|
|
491
520
|
style: {
|
|
492
521
|
left: toPercent(region.x, diff.width),
|
|
493
522
|
top: toPercent(region.y, diff.height),
|
|
@@ -502,16 +531,16 @@ function ImageDifferenceOverlay({ diff }) {
|
|
|
502
531
|
import { DirectionProvider } from "@base-ui/react/direction-provider";
|
|
503
532
|
import { Slider as SliderPrimitive } from "@base-ui/react/slider";
|
|
504
533
|
import { ChevronsLeftRightIcon } from "lucide-react";
|
|
505
|
-
import { jsx as
|
|
534
|
+
import { jsx as jsx7, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
506
535
|
function ImageSwipeDivider({
|
|
507
536
|
value,
|
|
508
537
|
onValueChange,
|
|
509
538
|
beforeLabel,
|
|
510
539
|
afterLabel
|
|
511
540
|
}) {
|
|
512
|
-
return /* @__PURE__ */
|
|
541
|
+
return /* @__PURE__ */ jsx7(DirectionProvider, {
|
|
513
542
|
direction: "ltr",
|
|
514
|
-
children: /* @__PURE__ */
|
|
543
|
+
children: /* @__PURE__ */ jsx7(SliderPrimitive.Root, {
|
|
515
544
|
dir: "ltr",
|
|
516
545
|
"data-slot": "image-swipe-divider",
|
|
517
546
|
value,
|
|
@@ -521,7 +550,7 @@ function ImageSwipeDivider({
|
|
|
521
550
|
step: 1,
|
|
522
551
|
largeStep: 10,
|
|
523
552
|
className: "pointer-events-none absolute inset-0",
|
|
524
|
-
children: /* @__PURE__ */
|
|
553
|
+
children: /* @__PURE__ */ jsx7(SliderPrimitive.Control, {
|
|
525
554
|
className: "pointer-events-none absolute inset-0",
|
|
526
555
|
children: /* @__PURE__ */ jsxs4(SliderPrimitive.Thumb, {
|
|
527
556
|
"data-slot": "image-swipe-divider-handle",
|
|
@@ -529,14 +558,14 @@ function ImageSwipeDivider({
|
|
|
529
558
|
getAriaValueText: (_formatted, current) => `${beforeLabel} ${current}%, ${afterLabel} ${100 - current}%`,
|
|
530
559
|
className: "group/divider pointer-events-auto flex h-full w-6 cursor-ew-resize touch-none flex-col items-center justify-center select-none",
|
|
531
560
|
children: [
|
|
532
|
-
/* @__PURE__ */
|
|
561
|
+
/* @__PURE__ */ jsx7("span", {
|
|
533
562
|
"aria-hidden": "true",
|
|
534
563
|
className: "absolute inset-y-0 start-1/2 w-0.5 -translate-x-1/2 bg-foreground ring-1 ring-background"
|
|
535
564
|
}),
|
|
536
|
-
/* @__PURE__ */
|
|
565
|
+
/* @__PURE__ */ jsx7("span", {
|
|
537
566
|
"aria-hidden": "true",
|
|
538
567
|
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",
|
|
539
|
-
children: /* @__PURE__ */
|
|
568
|
+
children: /* @__PURE__ */ jsx7(ChevronsLeftRightIcon, {
|
|
540
569
|
className: "size-3.5"
|
|
541
570
|
})
|
|
542
571
|
})
|
|
@@ -802,14 +831,14 @@ function useImageDifferences({
|
|
|
802
831
|
}
|
|
803
832
|
|
|
804
833
|
// src/components/image-viewer/ImageComparison.tsx
|
|
805
|
-
import { jsx as
|
|
834
|
+
import { jsx as jsx8, jsxs as jsxs5, Fragment } from "react/jsx-runtime";
|
|
806
835
|
function ComparisonPane({ header, children }) {
|
|
807
836
|
return /* @__PURE__ */ jsxs5("div", {
|
|
808
837
|
"data-slot": "image-comparison-pane",
|
|
809
838
|
"data-scroll": "none",
|
|
810
839
|
className: "flex min-h-0 min-w-0 flex-1 flex-col",
|
|
811
840
|
children: [
|
|
812
|
-
/* @__PURE__ */
|
|
841
|
+
/* @__PURE__ */ jsx8("div", {
|
|
813
842
|
"data-slot": "image-comparison-pane-header",
|
|
814
843
|
className: "flex h-control shrink-0 items-center justify-between gap-2 px-control-x text-xs font-medium text-muted-foreground",
|
|
815
844
|
children: header
|
|
@@ -884,7 +913,7 @@ ${after.src}`,
|
|
|
884
913
|
afterRef
|
|
885
914
|
});
|
|
886
915
|
const isShowingBefore = mode === "toggle" && isPeeking;
|
|
887
|
-
const overlay = showDifferences && differences.status === "ready" ? /* @__PURE__ */
|
|
916
|
+
const overlay = showDifferences && differences.status === "ready" ? /* @__PURE__ */ jsx8(ImageDifferenceOverlay, {
|
|
888
917
|
diff: differences.diff
|
|
889
918
|
}) : null;
|
|
890
919
|
const fallback = failedLabel ? /* @__PURE__ */ jsxs5("p", {
|
|
@@ -925,7 +954,7 @@ ${after.src}`,
|
|
|
925
954
|
}
|
|
926
955
|
}
|
|
927
956
|
function renderAfterImage(className) {
|
|
928
|
-
return /* @__PURE__ */
|
|
957
|
+
return /* @__PURE__ */ jsx8("img", {
|
|
929
958
|
ref: afterRef,
|
|
930
959
|
src: after.src,
|
|
931
960
|
alt: after.alt,
|
|
@@ -938,7 +967,7 @@ ${after.src}`,
|
|
|
938
967
|
});
|
|
939
968
|
}
|
|
940
969
|
function renderBeforeImage(className, style) {
|
|
941
|
-
return /* @__PURE__ */
|
|
970
|
+
return /* @__PURE__ */ jsx8("img", {
|
|
942
971
|
ref: beforeRef,
|
|
943
972
|
src: before.src,
|
|
944
973
|
alt: before.alt,
|
|
@@ -957,8 +986,8 @@ ${after.src}`,
|
|
|
957
986
|
"data-slot": "image-comparison-panes",
|
|
958
987
|
className: cn2("flex min-h-0 min-w-0 flex-1", orientation === "vertical" ? "flex-col" : "flex-row"),
|
|
959
988
|
children: [
|
|
960
|
-
/* @__PURE__ */
|
|
961
|
-
header: /* @__PURE__ */
|
|
989
|
+
/* @__PURE__ */ jsx8(ComparisonPane, {
|
|
990
|
+
header: /* @__PURE__ */ jsx8("span", {
|
|
962
991
|
children: beforeLabel
|
|
963
992
|
}),
|
|
964
993
|
children: /* @__PURE__ */ jsxs5(ImageViewport, {
|
|
@@ -975,11 +1004,11 @@ ${after.src}`,
|
|
|
975
1004
|
]
|
|
976
1005
|
})
|
|
977
1006
|
}),
|
|
978
|
-
/* @__PURE__ */
|
|
1007
|
+
/* @__PURE__ */ jsx8(Separator2, {
|
|
979
1008
|
orientation: orientation === "vertical" ? "horizontal" : "vertical"
|
|
980
1009
|
}),
|
|
981
|
-
/* @__PURE__ */
|
|
982
|
-
header: /* @__PURE__ */
|
|
1010
|
+
/* @__PURE__ */ jsx8(ComparisonPane, {
|
|
1011
|
+
header: /* @__PURE__ */ jsx8("span", {
|
|
983
1012
|
children: afterLabel
|
|
984
1013
|
}),
|
|
985
1014
|
children: /* @__PURE__ */ jsxs5(ImageViewport, {
|
|
@@ -999,13 +1028,13 @@ ${after.src}`,
|
|
|
999
1028
|
]
|
|
1000
1029
|
});
|
|
1001
1030
|
} else if (mode === "swipe") {
|
|
1002
|
-
content = /* @__PURE__ */
|
|
1031
|
+
content = /* @__PURE__ */ jsx8(ComparisonPane, {
|
|
1003
1032
|
header: /* @__PURE__ */ jsxs5(Fragment, {
|
|
1004
1033
|
children: [
|
|
1005
|
-
/* @__PURE__ */
|
|
1034
|
+
/* @__PURE__ */ jsx8("span", {
|
|
1006
1035
|
children: beforeLabel
|
|
1007
1036
|
}),
|
|
1008
|
-
/* @__PURE__ */
|
|
1037
|
+
/* @__PURE__ */ jsx8("span", {
|
|
1009
1038
|
children: afterLabel
|
|
1010
1039
|
})
|
|
1011
1040
|
]
|
|
@@ -1020,7 +1049,7 @@ ${after.src}`,
|
|
|
1020
1049
|
renderAfterImage(),
|
|
1021
1050
|
renderBeforeImage(undefined, { clipPath: `inset(0 ${100 - position}% 0 0)` }),
|
|
1022
1051
|
overlay,
|
|
1023
|
-
/* @__PURE__ */
|
|
1052
|
+
/* @__PURE__ */ jsx8(ImageSwipeDivider, {
|
|
1024
1053
|
value: position,
|
|
1025
1054
|
onValueChange: setPosition,
|
|
1026
1055
|
beforeLabel,
|
|
@@ -1031,7 +1060,7 @@ ${after.src}`,
|
|
|
1031
1060
|
});
|
|
1032
1061
|
} else {
|
|
1033
1062
|
const showingLabel = isShowingBefore ? beforeLabel : afterLabel;
|
|
1034
|
-
content = /* @__PURE__ */
|
|
1063
|
+
content = /* @__PURE__ */ jsx8(ComparisonPane, {
|
|
1035
1064
|
header: /* @__PURE__ */ jsxs5("span", {
|
|
1036
1065
|
"data-slot": "image-comparison-showing",
|
|
1037
1066
|
"aria-live": "polite",
|
|
@@ -1054,7 +1083,7 @@ ${after.src}`,
|
|
|
1054
1083
|
})
|
|
1055
1084
|
});
|
|
1056
1085
|
}
|
|
1057
|
-
return /* @__PURE__ */
|
|
1086
|
+
return /* @__PURE__ */ jsx8("div", {
|
|
1058
1087
|
role: "group",
|
|
1059
1088
|
"aria-label": label,
|
|
1060
1089
|
"data-slot": "image-comparison",
|
|
@@ -1068,13 +1097,13 @@ ${after.src}`,
|
|
|
1068
1097
|
children: /* @__PURE__ */ jsxs5("div", {
|
|
1069
1098
|
className: "flex min-h-0 min-w-0 flex-1 flex-col @3xl:flex-row",
|
|
1070
1099
|
children: [
|
|
1071
|
-
/* @__PURE__ */
|
|
1100
|
+
/* @__PURE__ */ jsx8("div", {
|
|
1072
1101
|
"data-slot": "image-comparison-stage",
|
|
1073
1102
|
"data-scroll": "none",
|
|
1074
1103
|
className: "flex min-h-0 min-w-0 flex-1",
|
|
1075
1104
|
children: content
|
|
1076
1105
|
}),
|
|
1077
|
-
showToolbar && /* @__PURE__ */
|
|
1106
|
+
showToolbar && /* @__PURE__ */ jsx8(ImageComparisonToolbar, {
|
|
1078
1107
|
mode,
|
|
1079
1108
|
onModeChange: setMode,
|
|
1080
1109
|
orientation,
|
|
@@ -1107,6 +1136,8 @@ function getNormalizedImagePoint(point, box) {
|
|
|
1107
1136
|
}
|
|
1108
1137
|
export {
|
|
1109
1138
|
ImageComparison,
|
|
1139
|
+
ImageRegionMarker,
|
|
1140
|
+
ImageRegionMarkerBadge,
|
|
1110
1141
|
ImageViewer,
|
|
1111
1142
|
ImageZoomToggle,
|
|
1112
1143
|
computeImageDiff,
|
|
@@ -151,7 +151,7 @@ import"../../chunk-m4geb1s5.js";
|
|
|
151
151
|
import"../../chunk-9ecf92s6.js";
|
|
152
152
|
import"../../chunk-fe33dx54.js";
|
|
153
153
|
import"../../chunk-tcefvfr8.js";
|
|
154
|
-
import"../../chunk-
|
|
154
|
+
import"../../chunk-s5820zky.js";
|
|
155
155
|
import {
|
|
156
156
|
Carousel2,
|
|
157
157
|
CarouselContent2,
|
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.91",
|
|
2055
2055
|
description: "Sharp, monospace React components with compact and comfortable densities.",
|
|
2056
2056
|
license: "MIT",
|
|
2057
2057
|
repository: {
|
package/dist/theme.css
CHANGED
|
@@ -96,6 +96,9 @@
|
|
|
96
96
|
--ag-panel-padding-sm: 12px;
|
|
97
97
|
--ag-field-gap: 20px;
|
|
98
98
|
--ag-section-gap: 32px;
|
|
99
|
+
/* Target emphasis: a dark and a light line that keep 3:1 against any content in every theme, so they stay fixed. */
|
|
100
|
+
--target-emphasis: #4a0a3a;
|
|
101
|
+
--target-emphasis-contrast: #ffffff;
|
|
99
102
|
color-scheme: dark;
|
|
100
103
|
--background: #121417;
|
|
101
104
|
--foreground: #eceff3;
|
|
@@ -648,3 +651,17 @@
|
|
|
648
651
|
}
|
|
649
652
|
}
|
|
650
653
|
}
|
|
654
|
+
|
|
655
|
+
/* Marks the target a jump went to: a light 2px line against the element, then a dark 2px line outside it. Against any
|
|
656
|
+
colour one of the two keeps at least 3:1. Forced colours drop the shadow, so both lines become one Highlight
|
|
657
|
+
outline. */
|
|
658
|
+
@utility target-emphasis {
|
|
659
|
+
outline: 2px solid var(--target-emphasis);
|
|
660
|
+
outline-offset: 2px;
|
|
661
|
+
box-shadow: 0 0 0 2px var(--target-emphasis-contrast);
|
|
662
|
+
|
|
663
|
+
@media (forced-colors: active) {
|
|
664
|
+
outline: 4px solid Highlight;
|
|
665
|
+
outline-offset: 0;
|
|
666
|
+
}
|
|
667
|
+
}
|
|
@@ -87,3 +87,17 @@ Storybook CSF excerpts. Default args and render apply unless overridden. Local h
|
|
|
87
87
|
</Toolbar>)
|
|
88
88
|
}
|
|
89
89
|
```
|
|
90
|
+
|
|
91
|
+
### PlainWrapping
|
|
92
|
+
|
|
93
|
+
```tsx
|
|
94
|
+
{
|
|
95
|
+
render: (args) => (<div className="w-48">
|
|
96
|
+
<Toolbar {...args} aria-label="Tags" orientation="vertical" variant="plain">
|
|
97
|
+
<ToolbarGroup aria-label="Vibe" wrap>
|
|
98
|
+
{["Dark", "Bright", "Hypnotic", "Warm", "Deep"].map((name) => (<ToolbarButton key={name}>{name}</ToolbarButton>))}
|
|
99
|
+
</ToolbarGroup>
|
|
100
|
+
</Toolbar>
|
|
101
|
+
</div>)
|
|
102
|
+
}
|
|
103
|
+
```
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
# ImageRegionMarker
|
|
2
|
+
|
|
3
|
+
Import from `@alexgorbatchev/shadcn/image-viewer`. Outlines a region over an image: a 2px outline 1px outside the region over a 4px halo in the page background, so the outline keeps 3:1 against any screenshot in both themes; forced colours draw it in Highlight. Variants: `comment` (a saved comment's region), `draft` (dashed, a region being drawn) and `difference` (changed pixels, used by ImageComparison's Highlight differences). Position it with `style` over a positioned image box. `ImageRegionMarkerBadge` pins an interactive control, such as a comment count, beside the marker with the same outline and halo. The theme's `target-emphasis` utility is the matching two-tone mark for a jump target on the page.
|
|
4
|
+
|
|
5
|
+
Story: @alexgorbatchev/shadcn/components/data-display/ImageRegionMarker
|
|
6
|
+
Source: src/components/stories/data-display/ImageRegionMarker.stories.tsx
|
|
7
|
+
|
|
8
|
+
[Full source and local helpers](https://github.com/alexgorbatchev/shadcn/blob/main/src/components/stories/data-display/ImageRegionMarker.stories.tsx)
|
|
9
|
+
|
|
10
|
+
## Public imports
|
|
11
|
+
|
|
12
|
+
```tsx
|
|
13
|
+
import { Button } from "@alexgorbatchev/shadcn";
|
|
14
|
+
import { ImageRegionMarker, ImageRegionMarkerBadge } from "@alexgorbatchev/shadcn/image-viewer";
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Default component
|
|
18
|
+
|
|
19
|
+
```tsx
|
|
20
|
+
ImageRegionMarker
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Story controls
|
|
24
|
+
|
|
25
|
+
```tsx
|
|
26
|
+
{ variant: { control: "inline-radio", options: ["comment", "draft", "difference"] } }
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Default args
|
|
30
|
+
|
|
31
|
+
```tsx
|
|
32
|
+
{ variant: "comment" }
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Default render
|
|
36
|
+
|
|
37
|
+
```tsx
|
|
38
|
+
(args) => (<div className="flex flex-wrap gap-6">
|
|
39
|
+
{screenshots.map((screenshot) => (<figure key={screenshot.label} className="flex flex-col gap-2">
|
|
40
|
+
<div role="img" aria-label={screenshot.label} className="relative h-40 w-72" style={{ background: screenshot.background }}>
|
|
41
|
+
<ImageRegionMarker {...args} style={{ left: "20%", top: "35%", width: "45%", height: "30%" }}>
|
|
42
|
+
<ImageRegionMarkerBadge style={{ left: "calc(100% + 8px)", top: -32 }}>
|
|
43
|
+
<Button size="sm" variant="secondary" aria-label={`Open comments on ${screenshot.label}`}>
|
|
44
|
+
3
|
|
45
|
+
</Button>
|
|
46
|
+
</ImageRegionMarkerBadge>
|
|
47
|
+
</ImageRegionMarker>
|
|
48
|
+
</div>
|
|
49
|
+
<figcaption className="text-sm text-muted-foreground">{screenshot.label}</figcaption>
|
|
50
|
+
</figure>))}
|
|
51
|
+
</div>)
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Examples
|
|
55
|
+
|
|
56
|
+
Storybook CSF excerpts. Default args and render apply unless overridden. Local helpers, fixtures, decorators, and providers may be required; these are reference excerpts, not standalone consumer modules. Interaction tests are omitted.
|
|
57
|
+
|
|
58
|
+
### Comment
|
|
59
|
+
|
|
60
|
+
```tsx
|
|
61
|
+
{}
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### Draft
|
|
65
|
+
|
|
66
|
+
```tsx
|
|
67
|
+
{
|
|
68
|
+
args: { variant: "draft" }
|
|
69
|
+
}
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### Difference
|
|
73
|
+
|
|
74
|
+
```tsx
|
|
75
|
+
{
|
|
76
|
+
args: { variant: "difference" }
|
|
77
|
+
}
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### TargetEmphasis
|
|
81
|
+
|
|
82
|
+
```tsx
|
|
83
|
+
{
|
|
84
|
+
render: () => (<div className="flex flex-col gap-6 p-4">
|
|
85
|
+
<p className="w-fit target-emphasis">A paragraph a jump landed on keeps a two-tone mark until you move on.</p>
|
|
86
|
+
<div className="h-24 w-72 target-emphasis" style={{ background: "#1e293b" }} role="img" aria-label="Dark chart"/>
|
|
87
|
+
</div>)
|
|
88
|
+
}
|
|
89
|
+
```
|
package/llms.txt
CHANGED
|
@@ -343,6 +343,7 @@ Generated from the public package exports and Storybook sources.
|
|
|
343
343
|
- [DataViewer](./llms/components/data-display/DataViewer.md)
|
|
344
344
|
- [Heading](./llms/components/data-display/Heading.md): Heading renders `h1`–`h6` from the required `level` so the document outline stays correct, while `size` (sm, base, lg, xl) sets the visual size independently. Sizes default by level: 1 xl, 2 lg, 3 base, 4–6 sm. `truncate` keeps one line.
|
|
345
345
|
- [ImageComparison](./llms/components/data-display/ImageComparison.md): Import from `@alexgorbatchev/shadcn/image-viewer`. ImageComparison fills its container and compares `before` and `after` images (`{ src, alt, crossOrigin? }`) labelled by `beforeLabel` and `afterLabel` (default "Before" and "After"). `toggle` (the default) shows the after image and the "Hold to show before" button shows the before image while a pointer, Space, or Enter is held. `swipe` stacks both images; the divider is a slider (0–100, arrows ±1, Page Up/Page Down ±10, Home/End) whose handle drags with pointer capture. `side-by-side` shows labelled panes left and right (`horizontal`) or top and bottom (`vertical`) that scroll in sync at original size. Every mode starts fitted and offers original size. A differently sized before image is drawn inside the after image box, and the toolbar reports the mismatch. "Highlight differences" compares pixels on first use, caches the result per image pair, outlines changed regions, and summarizes them; it is disabled with a reason when pixels cannot be read. `mode`, `orientation`, `zoom`, and `showDifferences` are controllable with matching `default*` and `on*Change` props; `showToolbar={false}` hides the controls, which sit beside wide comparisons and below narrow ones.
|
|
346
|
+
- [ImageRegionMarker](./llms/components/data-display/ImageRegionMarker.md): Import from `@alexgorbatchev/shadcn/image-viewer`. Outlines a region over an image: a 2px outline 1px outside the region over a 4px halo in the page background, so the outline keeps 3:1 against any screenshot in both themes; forced colours draw it in Highlight. Variants: `comment` (a saved comment's region), `draft` (dashed, a region being drawn) and `difference` (changed pixels, used by ImageComparison's Highlight differences). Position it with `style` over a positioned image box. `ImageRegionMarkerBadge` pins an interactive control, such as a comment count, beside the marker with the same outline and halo. The theme's `target-emphasis` utility is the matching two-tone mark for a jump target on the page.
|
|
346
347
|
- [ImageViewer](./llms/components/data-display/ImageViewer.md): Import from `@alexgorbatchev/shadcn/image-viewer`. ImageViewer fills the container it is given, such as a `DialogContent size="fullscreen"` body, and shows one image in a native scroll viewport. `fit` (the default) scales the image down proportionally to fit both dimensions, centered and without scrollbars, and never upscales it; `original` shows natural size in CSS pixels, centered on axes where it is smaller and scrolling where it is larger. Switching zoom keeps the viewed center. Control zoom with `zoom` and `onZoomChange`, or leave it uncontrolled with `defaultZoom`; place `ImageZoomToggle` in a header or toolbar, or set `showZoomControl` for the built-in toggle. `overlay` renders content sized and positioned exactly over the rendered image at every zoom, `imageRef` and `overlayRef` expose the rendered image box, and `getNormalizedImagePoint(event, box)` maps pointer coordinates to 0–1 image coordinates.
|
|
347
348
|
- [ImageZoomToggle](./llms/components/data-display/ImageZoomToggle.md): Import from `@alexgorbatchev/shadcn/image-viewer`. A two-option toggle for ImageViewer and ImageComparison zoom that consumers place in a header or toolbar. "Fit to screen" and "Original size" are pressed-state toggles with constant names, so assistive technology announces the active zoom through `aria-pressed`. One option always stays pressed. `label` names the group (default "Zoom"); `size`, `orientation`, `layout`, `disabled`, and `density` follow ToggleGroup.
|
|
348
349
|
- [Item](./llms/components/data-display/Item.md)
|