@alexgorbatchev/shadcn 0.0.161 → 0.0.163
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-1j2hz3w9.js → chunk-3kb1gkke.js} +5 -7
- package/dist/{chunk-zh1vby37.js → chunk-aw5f97jz.js} +1 -1
- package/dist/{chunk-dv0rz8r9.js → chunk-cjfd69vt.js} +2 -2
- package/dist/{chunk-g2amqz9q.js → chunk-crvagbjs.js} +1 -1
- package/dist/chunk-dpedhp0c.js +5 -0
- package/dist/{chunk-ajnmzqsv.js → chunk-jkjq1jkd.js} +1 -1
- package/dist/{chunk-fnfaa0zx.js → chunk-nx931ac3.js} +1 -1
- package/dist/{chunk-j0sw6cn8.js → chunk-rghpa4yc.js} +1 -1
- package/dist/{chunk-wvap51y9.js → chunk-vvt6y9j4.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/elements/VoiceOrb.js +3 -2
- package/dist/components/assistant-ui/index.js +7 -6
- package/dist/components/assistant-ui/native/VoiceOrb.js +4 -3
- package/dist/components/assistant-ui/native/index.js +4 -3
- package/dist/components/image-viewer/DiagramSurface.d.ts +22 -0
- package/dist/components/image-viewer/DiagramViewer.d.ts +42 -0
- 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/useMermaidTheme.d.ts +11 -0
- package/dist/components/image-viewer/index.d.ts +10 -0
- package/dist/components/image-viewer/index.js +780 -250
- package/dist/components/image-viewer/mermaidTheme.d.ts +58 -0
- package/dist/components/image-viewer/prepareDiagramSvg.d.ts +21 -0
- package/dist/components/json-render/index.js +4 -3
- package/dist/components/sonner/index.js +2 -1
- package/dist/index.js +4 -3
- package/dist/prototype.js +1 -1
- package/llms/components/data-display/DiagramViewer.md +66 -0
- package/llms.txt +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
export interface IMermaidThemeVariables {
|
|
2
|
+
darkMode: boolean;
|
|
3
|
+
fontFamily: string;
|
|
4
|
+
background: string;
|
|
5
|
+
primaryColor: string;
|
|
6
|
+
primaryTextColor: string;
|
|
7
|
+
primaryBorderColor: string;
|
|
8
|
+
secondaryColor: string;
|
|
9
|
+
secondaryTextColor: string;
|
|
10
|
+
secondaryBorderColor: string;
|
|
11
|
+
tertiaryColor: string;
|
|
12
|
+
tertiaryTextColor: string;
|
|
13
|
+
tertiaryBorderColor: string;
|
|
14
|
+
mainBkg: string;
|
|
15
|
+
nodeBorder: string;
|
|
16
|
+
nodeTextColor: string;
|
|
17
|
+
textColor: string;
|
|
18
|
+
titleColor: string;
|
|
19
|
+
lineColor: string;
|
|
20
|
+
defaultLinkColor: string;
|
|
21
|
+
edgeLabelBackground: string;
|
|
22
|
+
clusterBkg: string;
|
|
23
|
+
clusterBorder: string;
|
|
24
|
+
actorBkg: string;
|
|
25
|
+
actorBorder: string;
|
|
26
|
+
actorTextColor: string;
|
|
27
|
+
actorLineColor: string;
|
|
28
|
+
signalColor: string;
|
|
29
|
+
signalTextColor: string;
|
|
30
|
+
labelBoxBkgColor: string;
|
|
31
|
+
labelBoxBorderColor: string;
|
|
32
|
+
labelTextColor: string;
|
|
33
|
+
loopTextColor: string;
|
|
34
|
+
noteBkgColor: string;
|
|
35
|
+
noteBorderColor: string;
|
|
36
|
+
noteTextColor: string;
|
|
37
|
+
activationBkgColor: string;
|
|
38
|
+
activationBorderColor: string;
|
|
39
|
+
sequenceNumberColor: string;
|
|
40
|
+
errorBkgColor: string;
|
|
41
|
+
errorTextColor: string;
|
|
42
|
+
}
|
|
43
|
+
export interface IMermaidThemeConfig {
|
|
44
|
+
theme: "base";
|
|
45
|
+
darkMode: boolean;
|
|
46
|
+
fontFamily: string;
|
|
47
|
+
themeVariables: IMermaidThemeVariables;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Resolves any CSS color string (including `oklch(...)` or custom properties) to `#rrggbb` so Mermaid's internal
|
|
51
|
+
* color functions never fail on modern color spaces.
|
|
52
|
+
*/
|
|
53
|
+
export declare function resolveCssColorToHex(raw: string, fallback: string): string;
|
|
54
|
+
/**
|
|
55
|
+
* Maps the active theme tokens onto Mermaid's `base` theme variables so diagrams render on the card surface in the
|
|
56
|
+
* library's font with accessible label contrast in both dark and light appearances.
|
|
57
|
+
*/
|
|
58
|
+
export declare function getMermaidThemeConfig(element?: Element): IMermaidThemeConfig;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { IImageSize } from "./types.js";
|
|
2
|
+
export interface IPrepareDiagramSvgOptions {
|
|
3
|
+
/** Prefix added to every internal SVG ID so inline and expanded copies never collide. */
|
|
4
|
+
idPrefix: string;
|
|
5
|
+
/** Accessible name applied to the live `<svg>` when `labelledBy` is not provided. */
|
|
6
|
+
label?: string;
|
|
7
|
+
/** ID of an external element labelling the `<svg>`. */
|
|
8
|
+
labelledBy?: string;
|
|
9
|
+
/** ID of an element describing the `<svg>`. */
|
|
10
|
+
describedBy?: string;
|
|
11
|
+
/** `inline` keeps responsive width with natural aspect ratio; `fill` stretches cleanly to a zoom stage. */
|
|
12
|
+
fit?: "inline" | "fill";
|
|
13
|
+
}
|
|
14
|
+
/** Reads a diagram SVG's natural dimensions from its `viewBox`, falling back to explicit numeric `width`/`height`. */
|
|
15
|
+
export declare function getDiagramSvgSize(svg: string): IImageSize | undefined;
|
|
16
|
+
/**
|
|
17
|
+
* Parses a rendered diagram SVG into a live `SVGSVGElement` safe for mounting in the document: removes `@import`
|
|
18
|
+
* stylesheet rules, scopes every internal ID to `idPrefix`, sets `role="img"` with accessible naming/description,
|
|
19
|
+
* and configures inline or zoom-stage sizing.
|
|
20
|
+
*/
|
|
21
|
+
export declare function prepareDiagramSvg(svg: string, ownerDocument: Document, options: IPrepareDiagramSvgOptions): SVGSVGElement;
|
|
@@ -26,7 +26,7 @@ import {
|
|
|
26
26
|
PaginationPrevious2,
|
|
27
27
|
PaginationNext2,
|
|
28
28
|
PaginationEllipsis2
|
|
29
|
-
} from "../../chunk-
|
|
29
|
+
} from "../../chunk-crvagbjs.js";
|
|
30
30
|
import {
|
|
31
31
|
MenuPopup,
|
|
32
32
|
MenuItem2,
|
|
@@ -75,7 +75,7 @@ import {
|
|
|
75
75
|
} from "../../chunk-7cq1s2ey.js";
|
|
76
76
|
import {
|
|
77
77
|
Switch2
|
|
78
|
-
} from "../../chunk-
|
|
78
|
+
} from "../../chunk-cjfd69vt.js";
|
|
79
79
|
import {
|
|
80
80
|
Textarea2
|
|
81
81
|
} from "../../chunk-p51p95er.js";
|
|
@@ -119,7 +119,8 @@ import {
|
|
|
119
119
|
DrawerTitle2,
|
|
120
120
|
DrawerDescription2
|
|
121
121
|
} from "../../chunk-cc35g6sr.js";
|
|
122
|
-
import"../../chunk-
|
|
122
|
+
import"../../chunk-dpedhp0c.js";
|
|
123
|
+
import"../../chunk-3kb1gkke.js";
|
|
123
124
|
import {
|
|
124
125
|
Toggle2,
|
|
125
126
|
ToggleGroup2,
|
package/dist/index.js
CHANGED
|
@@ -188,7 +188,7 @@ import {
|
|
|
188
188
|
DashboardLayout2,
|
|
189
189
|
BillingUsage2,
|
|
190
190
|
SelectionAction2
|
|
191
|
-
} from "./chunk-
|
|
191
|
+
} from "./chunk-crvagbjs.js";
|
|
192
192
|
import {
|
|
193
193
|
statusDotVariants2,
|
|
194
194
|
StatusDot2
|
|
@@ -311,7 +311,7 @@ import {
|
|
|
311
311
|
} from "./chunk-7vnpp3ya.js";
|
|
312
312
|
import {
|
|
313
313
|
Switch2
|
|
314
|
-
} from "./chunk-
|
|
314
|
+
} from "./chunk-cjfd69vt.js";
|
|
315
315
|
import {
|
|
316
316
|
Progress2,
|
|
317
317
|
ProgressTrack2,
|
|
@@ -411,7 +411,8 @@ import {
|
|
|
411
411
|
} from "./chunk-fw86vanx.js";
|
|
412
412
|
import {
|
|
413
413
|
useTheme2
|
|
414
|
-
} from "./chunk-
|
|
414
|
+
} from "./chunk-3kb1gkke.js";
|
|
415
|
+
import"./chunk-dpedhp0c.js";
|
|
415
416
|
import {
|
|
416
417
|
Label2
|
|
417
418
|
} from "./chunk-4m2x9jfb.js";
|
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.163",
|
|
2055
2055
|
description: "Sharp, monospace React components with compact, comfortable, and touch densities.",
|
|
2056
2056
|
license: "MIT",
|
|
2057
2057
|
repository: {
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# DiagramViewer
|
|
2
|
+
|
|
3
|
+
Import from `@alexgorbatchev/shadcn/image-viewer`. `DiagramViewer` renders a live vector `<svg>` diagram inside the shared pan-and-zoom `ImageViewport` with `ImageZoomControl` (Fit, Fit width, zoom out/in up to 400%, keyboard shortcuts, drag/pinch/Mod+wheel, and `openingWidth` floor). Pair with `DiagramSurface` for inline rendering and `getMermaidThemeConfig` / `useMermaidTheme` to map active theme tokens onto Mermaid diagrams.
|
|
4
|
+
|
|
5
|
+
Story: @alexgorbatchev/shadcn/components/data-display/DiagramViewer
|
|
6
|
+
Source: src/components/stories/data-display/DiagramViewer.stories.tsx
|
|
7
|
+
|
|
8
|
+
[Full source and local helpers](https://github.com/alexgorbatchev/shadcn/blob/main/src/components/stories/data-display/DiagramViewer.stories.tsx)
|
|
9
|
+
|
|
10
|
+
## Public imports
|
|
11
|
+
|
|
12
|
+
```tsx
|
|
13
|
+
import { DiagramSurface, DiagramViewer, MediaShell, useMermaidTheme } from "@alexgorbatchev/shadcn/image-viewer";
|
|
14
|
+
import { Button } from "@alexgorbatchev/shadcn";
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Supporting imports
|
|
18
|
+
|
|
19
|
+
```tsx
|
|
20
|
+
import { useState, type ReactElement } from "react";
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Default component
|
|
24
|
+
|
|
25
|
+
```tsx
|
|
26
|
+
DiagramViewer
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Default args
|
|
30
|
+
|
|
31
|
+
```tsx
|
|
32
|
+
{
|
|
33
|
+
svg: buildThemedSequenceSvg({
|
|
34
|
+
background: "#121417",
|
|
35
|
+
actorBkg: "#1c1f24",
|
|
36
|
+
actorBorder: "#6f7783",
|
|
37
|
+
actorTextColor: "#eceff3",
|
|
38
|
+
signalColor: "#a3abb6",
|
|
39
|
+
signalTextColor: "#eceff3",
|
|
40
|
+
fontFamily: "JetBrains Mono Variable, monospace",
|
|
41
|
+
}),
|
|
42
|
+
label: "Payments failure sequence",
|
|
43
|
+
showZoomControl: true,
|
|
44
|
+
onZoomChange: fn(),
|
|
45
|
+
}
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Examples
|
|
49
|
+
|
|
50
|
+
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.
|
|
51
|
+
|
|
52
|
+
### ZoomableLiveSvg
|
|
53
|
+
|
|
54
|
+
```tsx
|
|
55
|
+
{
|
|
56
|
+
render: (args) => <ThemedDiagramViewer showZoomControl={args.showZoomControl} onZoomChange={args.onZoomChange}/>
|
|
57
|
+
}
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### FullscreenShell
|
|
61
|
+
|
|
62
|
+
```tsx
|
|
63
|
+
{
|
|
64
|
+
render: () => <FullscreenDiagramExample />
|
|
65
|
+
}
|
|
66
|
+
```
|
package/llms.txt
CHANGED
|
@@ -343,6 +343,7 @@ Generated from the public package exports and Storybook sources.
|
|
|
343
343
|
- [DataGridSelectHeader](./llms/components/data-display/DataGridSelectHeader.md)
|
|
344
344
|
- [DataViewer](./llms/components/data-display/DataViewer.md)
|
|
345
345
|
- [DescriptionList](./llms/components/data-display/DescriptionList.md)
|
|
346
|
+
- [DiagramViewer](./llms/components/data-display/DiagramViewer.md): Import from `@alexgorbatchev/shadcn/image-viewer`. `DiagramViewer` renders a live vector `<svg>` diagram inside the shared pan-and-zoom `ImageViewport` with `ImageZoomControl` (Fit, Fit width, zoom out/in up to 400%, keyboard shortcuts, drag/pinch/Mod+wheel, and `openingWidth` floor). Pair with `DiagramSurface` for inline rendering and `getMermaidThemeConfig` / `useMermaidTheme` to map active theme tokens onto Mermaid diagrams.
|
|
346
347
|
- [FramedImage](./llms/components/data-display/FramedImage.md): Import from `@alexgorbatchev/shadcn/image-viewer`. FramedImage shows a screenshot or other supplied image as evidence: a 1px edge in the `media-edge` token, which keeps at least 3:1 against the page in both themes, so a white image in the light theme and a black one in the dark theme still show where they end. `size="intrinsic"` (the default) keeps the image's own size within its column and at most 70% of the viewport height, scaled and never cropped; `size="fill"` fills its container's width, as in a row of thumbnails. It takes every `<img>` attribute.
|
|
347
348
|
- [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, and the display sizes 2xl and 3xl for a page's own title) sets the visual size independently. Sizes default by level: 1 xl, 2 lg, 3 base, 4–6 sm. `truncate` keeps one line.
|
|
348
349
|
- [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 one image, chosen by the "Shown image" control or B and A on the focused stage (`side`, default `after`), and the "Hold to show before" (or "after") button shows the other image while a pointer, Space, or Enter is held; the header announces the shown image. `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`, chosen automatically when the stage is taller than wide unless controlled) that scroll in sync when zoomed. Every mode starts fitted and offers original size (zoom `1`) with edge-fade scroll hints when content extends out of view; the focused stage also takes the ImageViewer stage keys, Mod+wheel and pinch, and its name ends with the zoom percent. 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 offers a "Change n of m" stepper (`N` / `Shift+N` on the stage, centering each change in every shown pane, and jumping to the first change at original size); it is disabled with a reason when pixels cannot be read. `toolbar`, `beforeOverlay`, `afterOverlay`, `stageOverlay`, and `onCommentDifference` let consumers host region comments in every mode. Controls sit in a single horizontal wrapping row above the stage so images use the full width.
|