@turingpaper/ui 0.0.1-test.8 → 0.0.2

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/badge.mjs CHANGED
@@ -1,8 +1,8 @@
1
1
  import { jsx as o } from "react/jsx-runtime";
2
2
  import { cva as n } from "class-variance-authority";
3
- import { cn as a } from "./utils.mjs";
4
- const i = n(
5
- "inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",
3
+ import { cn as i } from "./utils.mjs";
4
+ const a = n(
5
+ "inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus-visible:outline-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50",
6
6
  {
7
7
  variants: {
8
8
  variant: {
@@ -17,10 +17,10 @@ const i = n(
17
17
  }
18
18
  }
19
19
  );
20
- function f({ className: r, variant: e, ...t }) {
21
- return /* @__PURE__ */ o("div", { className: a(i({ variant: e }), r), ...t });
20
+ function c({ className: r, variant: e, ...t }) {
21
+ return /* @__PURE__ */ o("div", { className: i(a({ variant: e }), r), ...t });
22
22
  }
23
23
  export {
24
- f as Badge,
25
- i as badgeVariants
24
+ c as Badge,
25
+ a as badgeVariants
26
26
  };
package/dist/button.mjs CHANGED
@@ -3,8 +3,8 @@ import * as d from "react";
3
3
  import { Slot as u } from "radix-ui";
4
4
  import { cva as c } from "class-variance-authority";
5
5
  import { cn as f } from "./utils.mjs";
6
- const g = c(
7
- "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
6
+ const m = c(
7
+ "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
8
8
  {
9
9
  variants: {
10
10
  variant: {
@@ -27,21 +27,21 @@ const g = c(
27
27
  size: "default"
28
28
  }
29
29
  }
30
- ), m = d.forwardRef(
30
+ ), g = d.forwardRef(
31
31
  ({ className: e, variant: r, size: t, asChild: o = !1, ...n }, i) => {
32
32
  const s = o ? u.Root : "button";
33
33
  return /* @__PURE__ */ a(
34
34
  s,
35
35
  {
36
- className: f(g({ variant: r, size: t, className: e })),
36
+ className: f(m({ variant: r, size: t, className: e })),
37
37
  ref: i,
38
38
  ...n
39
39
  }
40
40
  );
41
41
  }
42
42
  );
43
- m.displayName = "Button";
43
+ g.displayName = "Button";
44
44
  export {
45
- m as Button,
46
- g as buttonVariants
45
+ g as Button,
46
+ m as buttonVariants
47
47
  };
package/dist/checkbox.mjs CHANGED
@@ -3,12 +3,12 @@ import * as c from "react";
3
3
  import { Checkbox as r } from "radix-ui";
4
4
  import { Check as s } from "lucide-react";
5
5
  import { cn as o } from "./utils.mjs";
6
- const n = c.forwardRef(({ className: i, ...t }, a) => /* @__PURE__ */ e(
6
+ const d = c.forwardRef(({ className: i, ...t }, a) => /* @__PURE__ */ e(
7
7
  r.Root,
8
8
  {
9
9
  ref: a,
10
10
  className: o(
11
- "grid place-content-center peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",
11
+ "grid place-content-center peer h-4 w-4 shrink-0 rounded-sm border border-primary focus-visible:outline-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",
12
12
  i
13
13
  ),
14
14
  ...t,
@@ -21,7 +21,7 @@ const n = c.forwardRef(({ className: i, ...t }, a) => /* @__PURE__ */ e(
21
21
  )
22
22
  }
23
23
  ));
24
- n.displayName = r.Root.displayName;
24
+ d.displayName = r.Root.displayName;
25
25
  export {
26
- n as Checkbox
26
+ d as Checkbox
27
27
  };
@@ -0,0 +1,8 @@
1
+ import { RenderOptions } from 'beautiful-mermaid';
2
+ export interface MermaidDiagramProps {
3
+ className?: string;
4
+ code: string;
5
+ filename?: string;
6
+ options?: RenderOptions;
7
+ }
8
+ export declare const MermaidDiagram: import('react').ForwardRefExoticComponent<Omit<Omit<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof MermaidDiagramProps> & MermaidDiagramProps, "ref"> & import('react').RefAttributes<HTMLDivElement>>;
package/dist/dialog.mjs CHANGED
@@ -1,34 +1,34 @@
1
1
  import { jsx as o, jsxs as n } from "react/jsx-runtime";
2
- import * as i from "react";
3
- import { Dialog as a } from "radix-ui";
2
+ import * as l from "react";
3
+ import { Dialog as e } from "radix-ui";
4
4
  import { X as c } from "lucide-react";
5
- import { cn as l } from "./utils.mjs";
6
- const h = a.Root, w = a.Trigger, m = a.Portal, v = a.Close, d = i.forwardRef(({ className: e, ...t }, s) => /* @__PURE__ */ o(
7
- a.Overlay,
5
+ import { cn as i } from "./utils.mjs";
6
+ const v = e.Root, h = e.Trigger, m = e.Portal, w = e.Close, d = l.forwardRef(({ className: a, ...t }, s) => /* @__PURE__ */ o(
7
+ e.Overlay,
8
8
  {
9
9
  ref: s,
10
- className: l(
10
+ className: i(
11
11
  "fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
12
- e
12
+ a
13
13
  ),
14
14
  ...t
15
15
  }
16
16
  ));
17
- d.displayName = a.Overlay.displayName;
18
- const f = i.forwardRef(({ className: e, children: t, ...s }, r) => /* @__PURE__ */ n(m, { children: [
17
+ d.displayName = e.Overlay.displayName;
18
+ const p = l.forwardRef(({ className: a, children: t, ...s }, r) => /* @__PURE__ */ n(m, { children: [
19
19
  /* @__PURE__ */ o(d, {}),
20
20
  /* @__PURE__ */ n(
21
- a.Content,
21
+ e.Content,
22
22
  {
23
23
  ref: r,
24
- className: l(
24
+ className: i(
25
25
  "fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",
26
- e
26
+ a
27
27
  ),
28
28
  ...s,
29
29
  children: [
30
30
  t,
31
- /* @__PURE__ */ n(a.Close, { className: "absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground", children: [
31
+ /* @__PURE__ */ n(e.Close, { className: "absolute right-4 top-4 rounded-sm opacity-70 transition-opacity hover:opacity-100 focus-visible:outline-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground", children: [
32
32
  /* @__PURE__ */ o(c, { className: "h-4 w-4" }),
33
33
  /* @__PURE__ */ o("span", { className: "sr-only", children: "Close" })
34
34
  ] })
@@ -36,65 +36,65 @@ const f = i.forwardRef(({ className: e, children: t, ...s }, r) => /* @__PURE__
36
36
  }
37
37
  )
38
38
  ] }));
39
- f.displayName = a.Content.displayName;
40
- const p = ({
41
- className: e,
39
+ p.displayName = e.Content.displayName;
40
+ const f = ({
41
+ className: a,
42
42
  ...t
43
43
  }) => /* @__PURE__ */ o(
44
44
  "div",
45
45
  {
46
- className: l(
46
+ className: i(
47
47
  "flex flex-col space-y-1.5 text-center sm:text-left",
48
- e
48
+ a
49
49
  ),
50
50
  ...t
51
51
  }
52
52
  );
53
- p.displayName = "DialogHeader";
53
+ f.displayName = "DialogHeader";
54
54
  const g = ({
55
- className: e,
55
+ className: a,
56
56
  ...t
57
57
  }) => /* @__PURE__ */ o(
58
58
  "div",
59
59
  {
60
- className: l(
60
+ className: i(
61
61
  "flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",
62
- e
62
+ a
63
63
  ),
64
64
  ...t
65
65
  }
66
66
  );
67
67
  g.displayName = "DialogFooter";
68
- const u = i.forwardRef(({ className: e, ...t }, s) => /* @__PURE__ */ o(
69
- a.Title,
68
+ const u = l.forwardRef(({ className: a, ...t }, s) => /* @__PURE__ */ o(
69
+ e.Title,
70
70
  {
71
71
  ref: s,
72
- className: l(
72
+ className: i(
73
73
  "text-lg font-semibold leading-none tracking-tight",
74
- e
74
+ a
75
75
  ),
76
76
  ...t
77
77
  }
78
78
  ));
79
- u.displayName = a.Title.displayName;
80
- const y = i.forwardRef(({ className: e, ...t }, s) => /* @__PURE__ */ o(
81
- a.Description,
79
+ u.displayName = e.Title.displayName;
80
+ const y = l.forwardRef(({ className: a, ...t }, s) => /* @__PURE__ */ o(
81
+ e.Description,
82
82
  {
83
83
  ref: s,
84
- className: l("text-sm text-muted-foreground", e),
84
+ className: i("text-sm text-muted-foreground", a),
85
85
  ...t
86
86
  }
87
87
  ));
88
- y.displayName = a.Description.displayName;
88
+ y.displayName = e.Description.displayName;
89
89
  export {
90
- h as Dialog,
91
- v as DialogClose,
92
- f as DialogContent,
90
+ v as Dialog,
91
+ w as DialogClose,
92
+ p as DialogContent,
93
93
  y as DialogDescription,
94
94
  g as DialogFooter,
95
- p as DialogHeader,
95
+ f as DialogHeader,
96
96
  d as DialogOverlay,
97
97
  m as DialogPortal,
98
98
  u as DialogTitle,
99
- w as DialogTrigger
99
+ h as DialogTrigger
100
100
  };
package/dist/map.mjs CHANGED
@@ -254,7 +254,7 @@ function Pe({
254
254
  {
255
255
  type: "button",
256
256
  onClick: p,
257
- className: "ring-offset-background focus:ring-ring absolute top-1 right-1 z-10 rounded-sm opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-none",
257
+ className: "absolute top-1 right-1 z-10 rounded-sm opacity-70 transition-opacity hover:opacity-100 focus-visible:outline-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50",
258
258
  "aria-label": "Close popup",
259
259
  children: [
260
260
  /* @__PURE__ */ f(K, { className: "h-4 w-4" }),
@@ -492,7 +492,7 @@ function ze({
492
492
  {
493
493
  type: "button",
494
494
  onClick: c,
495
- className: "ring-offset-background focus:ring-ring absolute top-1 right-1 z-10 rounded-sm opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-none",
495
+ className: "absolute top-1 right-1 z-10 rounded-sm opacity-70 transition-opacity hover:opacity-100 focus-visible:outline-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50",
496
496
  "aria-label": "Close popup",
497
497
  children: [
498
498
  /* @__PURE__ */ f(K, { className: "h-4 w-4" }),
@@ -0,0 +1,144 @@
1
+ import { jsx as r, jsxs as v } from "react/jsx-runtime";
2
+ import { cn as b } from "./utils.mjs";
3
+ import { forwardRef as p, useMemo as f, useState as x, useCallback as h } from "react";
4
+ import { THEMES as S, renderMermaidSVG as w } from "beautiful-mermaid";
5
+ import { TransformWrapper as C, TransformComponent as k, useControls as E } from "react-zoom-pan-pinch";
6
+ import { ZoomIn as N, ZoomOut as O, RotateCcw as T, Check as y, Copy as I, Download as z } from "lucide-react";
7
+ const R = "script, foreignObject, iframe, object, embed", M = /^on/i;
8
+ function j(e) {
9
+ let t;
10
+ try {
11
+ t = new DOMParser().parseFromString(e, "image/svg+xml");
12
+ } catch {
13
+ return null;
14
+ }
15
+ const o = t.documentElement;
16
+ if (o.tagName !== "svg" || t.querySelector("parsererror") || o.querySelectorAll(R).length > 0) return null;
17
+ const n = o.querySelectorAll("*");
18
+ for (const s of n)
19
+ for (const a of s.attributes)
20
+ if (M.test(a.name)) return null;
21
+ return e;
22
+ }
23
+ const L = {
24
+ ...S["github-light"],
25
+ transparent: !0
26
+ };
27
+ function _(e) {
28
+ if (!e) return "mermaid-diagram.svg";
29
+ const t = Math.max(e.lastIndexOf("/"), e.lastIndexOf("\\")), o = t >= 0 ? e.substring(t + 1) : e, n = o.lastIndexOf(".");
30
+ return `${(n > 0 ? o.substring(0, n) : o).replace(/[^a-zA-Z0-9_-]/g, "") || "mermaid-diagram"}.svg`;
31
+ }
32
+ const G = p(({ className: e, code: t, filename: o, options: n, ...s }, a) => {
33
+ const i = f(() => _(o), [o]), { svg: l, error: u } = f(() => {
34
+ if (!t.trim())
35
+ return { svg: null, error: "Empty diagram" };
36
+ let d;
37
+ try {
38
+ d = w(t, { ...L, ...n });
39
+ } catch (c) {
40
+ return {
41
+ svg: null,
42
+ error: c instanceof Error ? c.message : "Invalid diagram"
43
+ };
44
+ }
45
+ return j(d) ? { svg: d, error: null } : { svg: null, error: "Invalid SVG" };
46
+ }, [t, n]);
47
+ return u ? /* @__PURE__ */ r(
48
+ "div",
49
+ {
50
+ ref: a,
51
+ className: b(
52
+ "flex items-center justify-center text-muted-foreground text-sm",
53
+ e
54
+ ),
55
+ ...s,
56
+ children: u
57
+ }
58
+ ) : /* @__PURE__ */ r(
59
+ "div",
60
+ {
61
+ ref: a,
62
+ className: b("relative w-full h-full overflow-hidden", e),
63
+ ...s,
64
+ children: /* @__PURE__ */ v(
65
+ C,
66
+ {
67
+ initialScale: 1,
68
+ minScale: 0.25,
69
+ maxScale: 4,
70
+ centerOnInit: !0,
71
+ children: [
72
+ /* @__PURE__ */ r(A, { code: t, svg: l, svgFilename: i }),
73
+ /* @__PURE__ */ r(
74
+ k,
75
+ {
76
+ wrapperClass: "!w-full !h-full",
77
+ contentClass: "!w-full",
78
+ children: /* @__PURE__ */ r(
79
+ "div",
80
+ {
81
+ className: "w-full [&>svg]:w-full [&>svg]:h-auto",
82
+ dangerouslySetInnerHTML: { __html: l }
83
+ }
84
+ )
85
+ }
86
+ )
87
+ ]
88
+ }
89
+ )
90
+ }
91
+ );
92
+ }), A = ({ code: e, svg: t, svgFilename: o }) => {
93
+ const { zoomIn: n, zoomOut: s, resetTransform: a } = E(), [i, l] = x(!1), u = h(async () => {
94
+ await navigator.clipboard.writeText(e), l(!0), setTimeout(() => l(!1), 2e3);
95
+ }, [e]), d = h(() => {
96
+ const g = new Blob([t], { type: "image/svg+xml" }), c = URL.createObjectURL(g), m = document.createElement("a");
97
+ m.href = c, m.download = o, m.click(), URL.revokeObjectURL(c);
98
+ }, [t, o]);
99
+ return /* @__PURE__ */ v("div", { className: "absolute top-2 right-2 z-10 flex gap-1", children: [
100
+ /* @__PURE__ */ r(
101
+ "button",
102
+ {
103
+ onClick: () => n(),
104
+ className: "p-1.5 rounded-md bg-background/80 border border-border hover:bg-muted text-foreground",
105
+ children: /* @__PURE__ */ r(N, { size: 16 })
106
+ }
107
+ ),
108
+ /* @__PURE__ */ r(
109
+ "button",
110
+ {
111
+ onClick: () => s(),
112
+ className: "p-1.5 rounded-md bg-background/80 border border-border hover:bg-muted text-foreground",
113
+ children: /* @__PURE__ */ r(O, { size: 16 })
114
+ }
115
+ ),
116
+ /* @__PURE__ */ r(
117
+ "button",
118
+ {
119
+ onClick: () => a(),
120
+ className: "p-1.5 rounded-md bg-background/80 border border-border hover:bg-muted text-foreground",
121
+ children: /* @__PURE__ */ r(T, { size: 16 })
122
+ }
123
+ ),
124
+ /* @__PURE__ */ r(
125
+ "button",
126
+ {
127
+ onClick: u,
128
+ className: "p-1.5 rounded-md bg-background/80 border border-border hover:bg-muted text-foreground",
129
+ children: i ? /* @__PURE__ */ r(y, { size: 16 }) : /* @__PURE__ */ r(I, { size: 16 })
130
+ }
131
+ ),
132
+ /* @__PURE__ */ r(
133
+ "button",
134
+ {
135
+ onClick: d,
136
+ className: "p-1.5 rounded-md bg-background/80 border border-border hover:bg-muted text-foreground",
137
+ children: /* @__PURE__ */ r(z, { size: 16 })
138
+ }
139
+ )
140
+ ] });
141
+ };
142
+ export {
143
+ G as MermaidDiagram
144
+ };