@nxgt/material 3.6.0 → 3.7.0

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.
Files changed (68) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/README.md +46 -1
  3. package/dist/components/components.css +2 -0
  4. package/dist/components/theme-tokens.css +9 -4
  5. package/dist/components/ui/widgets/drawing/drawing-animate.css +123 -0
  6. package/dist/components/ui/widgets/drawing/drawing.css +459 -0
  7. package/dist/{components-BCYZgeoV.js → components-BX4icy-g.js} +733 -733
  8. package/dist/components.js +16 -16
  9. package/dist/{dialog-JQT6iETD.js → dialog-DdJ1C4BR.js} +168 -168
  10. package/dist/dnd.js +1 -1
  11. package/dist/draw-animate.js +106 -0
  12. package/dist/draw-png.js +2 -0
  13. package/dist/draw-sketch.js +38 -0
  14. package/dist/draw.js +65 -0
  15. package/dist/drawing-B8VuG7nx.js +390 -0
  16. package/dist/drawing-context-CeKeZE6b.js +10 -0
  17. package/dist/editor.js +110 -110
  18. package/dist/{icon-badge-C30yKsAM.js → icon-badge-Bb5-73XP.js} +18 -18
  19. package/dist/{icon-button-BXlI3DJ_.js → icon-button-5A6Mrj6w.js} +60 -90
  20. package/dist/lib/components/ui/display/shape/use-shape-morph.d.ts +1 -0
  21. package/dist/lib/components/ui/widgets/drawing/drawing-a11y.d.ts +20 -0
  22. package/dist/lib/components/ui/widgets/drawing/drawing-context.d.ts +23 -0
  23. package/dist/lib/components/ui/widgets/drawing/drawing-types.d.ts +63 -0
  24. package/dist/lib/components/ui/widgets/drawing/drawing.d.ts +17 -0
  25. package/dist/lib/components/ui/widgets/drawing/index.d.ts +5 -0
  26. package/dist/lib/components/ui/widgets/drawing/partials/drawing-root.d.ts +17 -0
  27. package/dist/lib/components/ui/widgets/drawing/partials/interactive-node.d.ts +22 -0
  28. package/dist/lib/components/ui/widgets/drawing/partials/primitives/content.d.ts +20 -0
  29. package/dist/lib/components/ui/widgets/drawing/partials/primitives/path.d.ts +29 -0
  30. package/dist/lib/components/ui/widgets/drawing/partials/primitives/primitive.d.ts +19 -0
  31. package/dist/lib/components/ui/widgets/drawing/partials/primitives/shapes.d.ts +18 -0
  32. package/dist/lib/components/ui/widgets/drawing/partials/react-attrs.d.ts +5 -0
  33. package/dist/lib/components/ui/widgets/drawing/partials/ring.d.ts +9 -0
  34. package/dist/lib/components/ui/widgets/drawing/partials/svg-tree.d.ts +29 -0
  35. package/dist/lib/components/ui/widgets/drawing/use-exact-text.d.ts +16 -0
  36. package/dist/lib/draw/index.d.ts +32 -0
  37. package/dist/lib/draw-animate/index.d.ts +19 -0
  38. package/dist/lib/draw-animate/morph-drawing.d.ts +32 -0
  39. package/dist/lib/draw-animate/reduced-motion.d.ts +2 -0
  40. package/dist/lib/draw-animate/use-drawing-controls.d.ts +27 -0
  41. package/dist/lib/draw-animate/use-scene-morph.d.ts +15 -0
  42. package/dist/lib/draw-png/index.d.ts +11 -0
  43. package/dist/lib/draw-sketch/index.d.ts +17 -0
  44. package/dist/lib/draw-sketch/sketch.d.ts +19 -0
  45. package/dist/lib/print/components/print-drawing.d.ts +16 -0
  46. package/dist/lib/print/index.d.ts +2 -1
  47. package/dist/main.js +21 -21
  48. package/dist/map.js +63 -63
  49. package/dist/material.css +1 -1
  50. package/dist/pdf-reader.js +1 -1
  51. package/dist/print.js +123 -115
  52. package/dist/{public-Cde8_SN8.js → public-CBlV2XuA.js} +742 -742
  53. package/dist/{sortable-provider-DYlpq8lP.js → sortable-provider-BvD98s8Y.js} +19 -19
  54. package/dist/{use-chat-composer-BwpSgP_D.js → use-chat-composer-BhdPNmYm.js} +912 -911
  55. package/dist/use-shape-morph-BKA_R5P5.js +35 -0
  56. package/docs/README.md +1 -0
  57. package/docs/components/rich-widgets.md +196 -0
  58. package/docs/guides/drawing.md +499 -0
  59. package/docs/guides/printing.md +47 -0
  60. package/docs/guides/theming.md +2 -2
  61. package/docs/previews/rich-widgets-drawing.webp +0 -0
  62. package/docs/roadmap.md +17 -0
  63. package/docs/troubleshooting.md +136 -1
  64. package/lib/components/components.css +2 -0
  65. package/lib/components/theme-tokens.css +9 -4
  66. package/lib/components/ui/widgets/drawing/drawing-animate.css +123 -0
  67. package/lib/components/ui/widgets/drawing/drawing.css +459 -0
  68. package/package.json +22 -2
@@ -1,13 +1,13 @@
1
1
  import { t as e } from "./utils-Bcd2Z3ea.js";
2
- import { t } from "./icon-button-BXlI3DJ_.js";
3
- import { f as n } from "./dialog-JQT6iETD.js";
4
- import { a as r, i, n as a } from "./field-blur-context-Dw9ZAgBr.js";
2
+ import { f as t } from "./dialog-DdJ1C4BR.js";
3
+ import { a as n, i as r, n as i } from "./field-blur-context-Dw9ZAgBr.js";
4
+ import { t as a } from "./icon-button-5A6Mrj6w.js";
5
5
  import { isValidElement as o, useId as s } from "react";
6
6
  import { jsx as c, jsxs as l } from "react/jsx-runtime";
7
7
  import { describedBy as u } from "@nxgt/material-core/described-by";
8
8
  //#region lib/components/ui/fields/text-field/text-field.tsx
9
- function d({ error: t, helperText: d, label: p, className: m, leading: h, trailing: g, ..._ }) {
10
- let v = a(), y = s(), b = s(), x = u(_["aria-describedby"], !!d && b), S = !!h && !o(h), C = !!g && !o(g), w = /* @__PURE__ */ l("div", {
9
+ function d({ error: a, helperText: d, label: p, className: m, leading: h, trailing: g, ..._ }) {
10
+ let v = i(), y = s(), b = s(), x = u(_["aria-describedby"], !!d && b), S = !!h && !o(h), C = !!g && !o(g), w = /* @__PURE__ */ l("div", {
11
11
  className: e("relative", {
12
12
  "*:first:size-8 *:first:absolute *:first:top-[calc(50%-16px)] *:first:left-1.5 [&_input]:pl-10 *:first:bg-muted/80 *:first:text-muted-foreground": !!h && !S,
13
13
  "*:last:size-8 *:last:absolute *:last:top-[calc(50%-16px)] *:last:right-1.5 *:last:pointer-coarse:size-11 *:last:pointer-coarse:top-[calc(50%-22px)] *:last:pointer-coarse:right-0 [&_input]:pr-.5 *:last:bg-muted/80 *:last:text-muted-foreground": !!g && !C,
@@ -19,8 +19,8 @@ function d({ error: t, helperText: d, label: p, className: m, leading: h, traili
19
19
  slot: "leading",
20
20
  children: h
21
21
  }) : h && h,
22
- /* @__PURE__ */ c(n, {
23
- "aria-invalid": t,
22
+ /* @__PURE__ */ c(t, {
23
+ "aria-invalid": a,
24
24
  ..._,
25
25
  id: _.id ?? y,
26
26
  "aria-describedby": x
@@ -35,15 +35,15 @@ function d({ error: t, helperText: d, label: p, className: m, leading: h, traili
35
35
  ref: v,
36
36
  "data-slot": "text-field",
37
37
  className: e("grid w-full gap-1.5", m),
38
- children: [/* @__PURE__ */ c(i, {
38
+ children: [/* @__PURE__ */ c(r, {
39
39
  withAsterisk: _.required,
40
40
  htmlFor: _.id ?? y,
41
41
  children: p
42
42
  }), /* @__PURE__ */ l("div", {
43
43
  className: "flex flex-col gap-0.5",
44
- children: [w, d ? /* @__PURE__ */ c(r, {
44
+ children: [w, d ? /* @__PURE__ */ c(n, {
45
45
  id: b,
46
- error: t,
46
+ error: a,
47
47
  children: d
48
48
  }) : null]
49
49
  })]
@@ -58,15 +58,15 @@ function f({ slot: t, children: n }) {
58
58
  }
59
59
  //#endregion
60
60
  //#region lib/components/ui/actions/icon-button/icon-badge.tsx
61
- function p({ children: n, className: r, ...i }) {
62
- let a = !!(i["aria-label"] || i["aria-labelledby"]);
63
- return /* @__PURE__ */ c(t, {
64
- "aria-hidden": a ? void 0 : "true",
65
- role: a ? "img" : void 0,
66
- ...i,
61
+ function p({ children: t, className: n, ...r }) {
62
+ let i = !!(r["aria-label"] || r["aria-labelledby"]);
63
+ return /* @__PURE__ */ c(a, {
64
+ "aria-hidden": i ? void 0 : "true",
65
+ role: i ? "img" : void 0,
66
+ ...r,
67
67
  asChild: !0,
68
- className: e("cursor-default", r),
69
- children: /* @__PURE__ */ c("span", { children: n })
68
+ className: e("cursor-default", n),
69
+ children: /* @__PURE__ */ c("span", { children: t })
70
70
  });
71
71
  }
72
72
  //#endregion
@@ -1,43 +1,13 @@
1
1
  import { t as e } from "./utils-Bcd2Z3ea.js";
2
- import { F as t, P as n, o as r, t as i } from "./tooltip-tmFoTU_d.js";
3
- import { i as a, n as o, r as s, t as c } from "./button-tones-BgZJ1tkD.js";
4
- import { morph as l, morphAt as u, shapeOutline as d, toSvgPath as f } from "@nxgt/material-core/shapes";
5
- import { useLayoutEffect as p, useRef as m } from "react";
6
- import { jsx as h, jsxs as g } from "react/jsx-runtime";
7
- //#region lib/components/ui/display/shape/use-shape-morph.ts
8
- var _ = .8, v = 14, y = v * Math.sqrt(1 - _ * _), b = 520;
9
- function x(e) {
10
- let t = e / 1e3;
11
- return 1 - Math.exp(-.8 * v * t) * (Math.cos(y * t) + _ * v / y * Math.sin(y * t));
12
- }
13
- var S = () => typeof window.matchMedia == "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
14
- function C(e, t, n) {
15
- let r = m(t);
16
- p(() => {
17
- let i = e.current, a = r.current;
18
- if (!i || a === t || !n || S()) {
19
- i && a !== t && i.setAttribute("d", f(t)), r.current = t;
20
- return;
21
- }
22
- let o = l(a, t), s = f(t), c = 0, d = performance.now(), p = (e) => {
23
- let n = e - d;
24
- if (n >= b) {
25
- r.current = t, i.setAttribute("d", s);
26
- return;
27
- }
28
- let a = u(o, x(n));
29
- r.current = a, i.setAttribute("d", f(a)), c = requestAnimationFrame(p);
30
- };
31
- return i.setAttribute("d", f(o.from)), c = requestAnimationFrame(p), () => cancelAnimationFrame(c);
32
- }, [
33
- e,
34
- t,
35
- n
36
- ]);
37
- }
2
+ import { n as t } from "./use-shape-morph-BKA_R5P5.js";
3
+ import { F as n, P as r, o as i, t as a } from "./tooltip-tmFoTU_d.js";
4
+ import { i as o, n as s, r as c, t as l } from "./button-tones-BgZJ1tkD.js";
5
+ import { shapeOutline as u, toSvgPath as d } from "@nxgt/material-core/shapes";
6
+ import { useRef as f } from "react";
7
+ import { jsx as p, jsxs as m } from "react/jsx-runtime";
38
8
  //#endregion
39
9
  //#region lib/components/ui/actions/icon-button/icon-button.variants.ts
40
- var w = r("inline-flex size-9 center gap-2 cursor-pointer whitespace-nowrap text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:bg-transparent [&_svg]:text-foreground [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-error/20 dark:aria-invalid:ring-error/40 aria-invalid:border-error has-[[data-slot=icon]]:p-1.5 aspect-square rounded-full", {
10
+ var h = i("inline-flex size-9 center gap-2 cursor-pointer whitespace-nowrap text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:bg-transparent [&_svg]:text-foreground [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-error/20 dark:aria-invalid:ring-error/40 aria-invalid:border-error has-[[data-slot=icon]]:p-1.5 aspect-square rounded-full", {
41
11
  variants: {
42
12
  variant: {
43
13
  filled: "shadow-xs bg-primary text-primary-foreground [&_svg]:data-[slot=icon]:text-primary-foreground [&_svg]:stroke-primary-foreground hover:bg-[color-mix(in_oklab,var(--color-primary)_90%,black)] active:bg-[color-mix(in_oklab,var(--color-primary)_80%,black)] focus:bg-[color-mix(in_oklab,var(--color-primary)_85%,black)]",
@@ -99,37 +69,37 @@ var w = r("inline-flex size-9 center gap-2 cursor-pointer whitespace-nowrap text
99
69
  {
100
70
  variant: "tonal",
101
71
  color: "primary",
102
- class: `${s.primary} ${c.primary} ${o.primary} bg-primary/15 hover:bg-primary/10 active:bg-primary/5 focus:bg-primary/10`
72
+ class: `${c.primary} ${l.primary} ${s.primary} bg-primary/15 hover:bg-primary/10 active:bg-primary/5 focus:bg-primary/10`
103
73
  },
104
74
  {
105
75
  variant: "tonal",
106
76
  color: "secondary",
107
- class: `${s.secondary} ${c.secondary} ${o.secondary} bg-secondary/15 hover:bg-secondary/10 active:bg-secondary/5 focus:bg-secondary/10`
77
+ class: `${c.secondary} ${l.secondary} ${s.secondary} bg-secondary/15 hover:bg-secondary/10 active:bg-secondary/5 focus:bg-secondary/10`
108
78
  },
109
79
  {
110
80
  variant: "tonal",
111
81
  color: "success",
112
- class: `${s.success} ${c.success} ${o.success} bg-success/15 hover:bg-success/10 active:bg-success/5 focus:bg-success/10`
82
+ class: `${c.success} ${l.success} ${s.success} bg-success/15 hover:bg-success/10 active:bg-success/5 focus:bg-success/10`
113
83
  },
114
84
  {
115
85
  variant: "tonal",
116
86
  color: "info",
117
- class: `${s.info} ${c.info} ${o.info} bg-info/15 hover:bg-info/10 active:bg-info/5 focus:bg-info/10`
87
+ class: `${c.info} ${l.info} ${s.info} bg-info/15 hover:bg-info/10 active:bg-info/5 focus:bg-info/10`
118
88
  },
119
89
  {
120
90
  variant: "tonal",
121
91
  color: "warning",
122
- class: `${s.warning} ${c.warning} ${o.warning} bg-warning/15 hover:bg-warning/10 active:bg-warning/5 focus:bg-warning/10`
92
+ class: `${c.warning} ${l.warning} ${s.warning} bg-warning/15 hover:bg-warning/10 active:bg-warning/5 focus:bg-warning/10`
123
93
  },
124
94
  {
125
95
  variant: "tonal",
126
96
  color: "error",
127
- class: `${s.error} ${c.error} ${o.error} bg-error/15 hover:bg-error/10 active:bg-error/5 focus:bg-error/10`
97
+ class: `${c.error} ${l.error} ${s.error} bg-error/15 hover:bg-error/10 active:bg-error/5 focus:bg-error/10`
128
98
  },
129
99
  {
130
100
  variant: "tonal",
131
101
  color: "default",
132
- class: `${s.default} ${c.default} ${o.default} bg-foreground/15 hover:bg-foreground/10 active:bg-muted focus:bg-muted`
102
+ class: `${c.default} ${l.default} ${s.default} bg-foreground/15 hover:bg-foreground/10 active:bg-muted focus:bg-muted`
133
103
  },
134
104
  {
135
105
  variant: "ghost",
@@ -144,103 +114,103 @@ var w = r("inline-flex size-9 center gap-2 cursor-pointer whitespace-nowrap text
144
114
  {
145
115
  variant: "ghost",
146
116
  color: "secondary",
147
- class: `${s.secondary} ${c.secondary} ${o.secondary} hover:bg-secondary/10 active:bg-secondary/5 focus:bg-secondary/10`
117
+ class: `${c.secondary} ${l.secondary} ${s.secondary} hover:bg-secondary/10 active:bg-secondary/5 focus:bg-secondary/10`
148
118
  },
149
119
  {
150
120
  variant: "ghost",
151
121
  color: "success",
152
- class: `${s.success} ${c.success} ${o.success} hover:bg-success/10 active:bg-success/5 focus:bg-success/10`
122
+ class: `${c.success} ${l.success} ${s.success} hover:bg-success/10 active:bg-success/5 focus:bg-success/10`
153
123
  },
154
124
  {
155
125
  variant: "ghost",
156
126
  color: "info",
157
- class: `${s.info} ${c.info} ${o.info} hover:bg-info/10 active:bg-info/5 focus:bg-info/10`
127
+ class: `${c.info} ${l.info} ${s.info} hover:bg-info/10 active:bg-info/5 focus:bg-info/10`
158
128
  },
159
129
  {
160
130
  variant: "ghost",
161
131
  color: "warning",
162
- class: `${s.warning} ${c.warning} ${o.warning} hover:bg-warning/10 active:bg-warning/5 focus:bg-warning/10`
132
+ class: `${c.warning} ${l.warning} ${s.warning} hover:bg-warning/10 active:bg-warning/5 focus:bg-warning/10`
163
133
  },
164
134
  {
165
135
  variant: "ghost",
166
136
  color: "error",
167
- class: `${s.error} ${c.error} ${o.error} hover:bg-error/10 active:bg-error/5 focus:bg-error/10`
137
+ class: `${c.error} ${l.error} ${s.error} hover:bg-error/10 active:bg-error/5 focus:bg-error/10`
168
138
  },
169
139
  {
170
140
  variant: "outlined",
171
141
  color: "primary",
172
- class: `${s.primary} ${c.primary} ${o.primary} border-primary/50 focus:bg-primary/10 hover:bg-primary/10`
142
+ class: `${c.primary} ${l.primary} ${s.primary} border-primary/50 focus:bg-primary/10 hover:bg-primary/10`
173
143
  },
174
144
  {
175
145
  variant: "outlined",
176
146
  color: "secondary",
177
- class: `${s.secondary} ${c.secondary} ${o.secondary} border-secondary/50 focus:bg-secondary/10 hover:bg-secondary/10`
147
+ class: `${c.secondary} ${l.secondary} ${s.secondary} border-secondary/50 focus:bg-secondary/10 hover:bg-secondary/10`
178
148
  },
179
149
  {
180
150
  variant: "outlined",
181
151
  color: "success",
182
- class: `${s.success} ${c.success} ${o.success} border-success/50 focus:bg-success/10 hover:bg-success/10`
152
+ class: `${c.success} ${l.success} ${s.success} border-success/50 focus:bg-success/10 hover:bg-success/10`
183
153
  },
184
154
  {
185
155
  variant: "outlined",
186
156
  color: "info",
187
- class: `${s.info} ${c.info} ${o.info} border-info/50 focus:bg-info/10 hover:bg-info/10`
157
+ class: `${c.info} ${l.info} ${s.info} border-info/50 focus:bg-info/10 hover:bg-info/10`
188
158
  },
189
159
  {
190
160
  variant: "outlined",
191
161
  color: "warning",
192
- class: `${s.warning} ${c.warning} ${o.warning} border-warning/50 focus:bg-warning/10 hover:bg-warning/10`
162
+ class: `${c.warning} ${l.warning} ${s.warning} border-warning/50 focus:bg-warning/10 hover:bg-warning/10`
193
163
  },
194
164
  {
195
165
  variant: "outlined",
196
166
  color: "error",
197
- class: `${s.error} ${c.error} ${o.error} border-error/50 focus:bg-error/10 hover:bg-error/10`
167
+ class: `${c.error} ${l.error} ${s.error} border-error/50 focus:bg-error/10 hover:bg-error/10`
198
168
  },
199
169
  {
200
170
  variant: "outlined",
201
171
  color: "default",
202
- class: `${s.default} ${c.default} ${o.default} border-foreground/50 focus:bg-foreground/10 hover:bg-foreground/10`
172
+ class: `${c.default} ${l.default} ${s.default} border-foreground/50 focus:bg-foreground/10 hover:bg-foreground/10`
203
173
  },
204
174
  {
205
175
  variant: "link",
206
176
  color: "primary",
207
- class: `${s.primary} ${c.primary} ${o.primary} underline-offset-4 hover:underline hover:bg-primary/10 active:bg-primary/5 focus:bg-primary/10`
177
+ class: `${c.primary} ${l.primary} ${s.primary} underline-offset-4 hover:underline hover:bg-primary/10 active:bg-primary/5 focus:bg-primary/10`
208
178
  },
209
179
  {
210
180
  variant: "link",
211
181
  color: "secondary",
212
- class: `${s.secondary} ${c.secondary} ${o.secondary} underline-offset-4 hover:underline hover:bg-secondary/10 active:bg-secondary/5 focus:bg-secondary/10`
182
+ class: `${c.secondary} ${l.secondary} ${s.secondary} underline-offset-4 hover:underline hover:bg-secondary/10 active:bg-secondary/5 focus:bg-secondary/10`
213
183
  },
214
184
  {
215
185
  variant: "link",
216
186
  color: "success",
217
- class: `${s.success} ${c.success} ${o.success} underline-offset-4 hover:underline hover:bg-success/10 active:bg-success/5 focus:bg-success/10`
187
+ class: `${c.success} ${l.success} ${s.success} underline-offset-4 hover:underline hover:bg-success/10 active:bg-success/5 focus:bg-success/10`
218
188
  },
219
189
  {
220
190
  variant: "link",
221
191
  color: "info",
222
- class: `${s.info} ${c.info} ${o.info} underline-offset-4 hover:underline hover:bg-info/10 active:bg-info/5 focus:bg-info/10`
192
+ class: `${c.info} ${l.info} ${s.info} underline-offset-4 hover:underline hover:bg-info/10 active:bg-info/5 focus:bg-info/10`
223
193
  },
224
194
  {
225
195
  variant: "link",
226
196
  color: "warning",
227
- class: `${s.warning} ${c.warning} ${o.warning} underline-offset-4 hover:underline hover:bg-warning/10 active:bg-warning/5 focus:bg-warning/10`
197
+ class: `${c.warning} ${l.warning} ${s.warning} underline-offset-4 hover:underline hover:bg-warning/10 active:bg-warning/5 focus:bg-warning/10`
228
198
  },
229
199
  {
230
200
  variant: "link",
231
201
  color: "error",
232
- class: `${s.error} ${c.error} ${o.error} underline-offset-4 hover:underline hover:bg-error/10 active:bg-error/5 focus:bg-error/10`
202
+ class: `${c.error} ${l.error} ${s.error} underline-offset-4 hover:underline hover:bg-error/10 active:bg-error/5 focus:bg-error/10`
233
203
  },
234
204
  {
235
205
  variant: "link",
236
206
  color: "default",
237
- class: `${s.default} ${c.default} ${o.default} underline-offset-4 hover:underline hover:bg-foreground/10 active:bg-muted focus:bg-foreground/10`
207
+ class: `${c.default} ${l.default} ${s.default} underline-offset-4 hover:underline hover:bg-foreground/10 active:bg-muted focus:bg-foreground/10`
238
208
  }
239
209
  ]
240
- }), T = ((e) => w(e?.variant === "ghost" && e.color === null ? {
210
+ }), g = ((e) => h(e?.variant === "ghost" && e.color === null ? {
241
211
  ...e,
242
212
  color: void 0
243
- } : e)), E = {
213
+ } : e)), _ = {
244
214
  filled: {
245
215
  primary: "fill-primary",
246
216
  secondary: "fill-secondary dark:fill-[color-mix(in_oklab,var(--color-secondary)_70%,var(--color-background))]",
@@ -287,62 +257,62 @@ var w = r("inline-flex size-9 center gap-2 cursor-pointer whitespace-nowrap text
287
257
  default: "fill-transparent group-hover/icon-button:fill-accent dark:group-hover/icon-button:fill-accent/50"
288
258
  }
289
259
  };
290
- function D({ shape: t, variant: n, color: r }) {
291
- let i = d(t), a = m(null);
292
- return C(a, i, !0), /* @__PURE__ */ h("svg", {
260
+ function v({ shape: n, variant: r, color: i }) {
261
+ let a = u(n), o = f(null);
262
+ return t(o, a, !0), /* @__PURE__ */ p("svg", {
293
263
  "data-slot": "icon-button-shape",
294
264
  viewBox: "0 0 100 100",
295
265
  "aria-hidden": "true",
296
266
  focusable: "false",
297
- className: e("-z-10 pointer-events-none absolute inset-0 size-full overflow-visible transition-[filter]", n === "filled" && "group-hover/icon-button:brightness-90 group-active/icon-button:brightness-80"),
298
- children: /* @__PURE__ */ h("path", {
299
- ref: a,
300
- d: f(i),
267
+ className: e("-z-10 pointer-events-none absolute inset-0 size-full overflow-visible transition-[filter]", r === "filled" && "group-hover/icon-button:brightness-90 group-active/icon-button:brightness-80"),
268
+ children: /* @__PURE__ */ p("path", {
269
+ ref: o,
270
+ d: d(a),
301
271
  vectorEffect: "non-scaling-stroke",
302
272
  paintOrder: "stroke",
303
- className: e("stroke-transparent stroke-1 transition-[fill]", E[n][r], "group-focus-visible/icon-button:stroke-ring/50 group-focus-visible/icon-button:stroke-[6px]", "forced-colors:fill-none forced-colors:stroke-[ButtonText] forced-colors:group-focus-visible/icon-button:stroke-[Highlight]")
273
+ className: e("stroke-transparent stroke-1 transition-[fill]", _[r][i], "group-focus-visible/icon-button:stroke-ring/50 group-focus-visible/icon-button:stroke-[6px]", "forced-colors:fill-none forced-colors:stroke-[ButtonText] forced-colors:group-focus-visible/icon-button:stroke-[Highlight]")
304
274
  })
305
275
  });
306
276
  }
307
277
  //#endregion
308
278
  //#region lib/components/ui/actions/icon-button/icon-button.tsx
309
- function O({ variant: r, color: i, className: o, asChild: s, type: c = "button", shape: l, morph: u = "pill", children: d, ...f }) {
310
- let p = s ? n : "button";
311
- return /* @__PURE__ */ h(a, {
279
+ function y({ variant: t, color: i, className: a, asChild: s, type: c = "button", shape: l, morph: u = "pill", children: d, ...f }) {
280
+ let h = s ? r : "button";
281
+ return /* @__PURE__ */ p(o, {
312
282
  value: !!(f["aria-label"] || f["aria-labelledby"]),
313
- children: /* @__PURE__ */ g(p, {
283
+ children: /* @__PURE__ */ m(h, {
314
284
  "data-slot": "icon-button",
315
285
  "data-icon-button": "",
316
- "data-variant": r,
286
+ "data-variant": t,
317
287
  "data-color": i,
318
288
  type: s ? void 0 : c,
319
289
  "data-shape": l,
320
290
  "data-morph": !l && u !== "none" && f["aria-pressed"] !== void 0 ? u : void 0,
321
- className: e(T({
322
- variant: r,
291
+ className: e(g({
292
+ variant: t,
323
293
  color: i
324
- }), l && "group/icon-button relative isolate bg-transparent! border-0! shadow-none! ring-0! focus-visible:ring-0! aria-invalid:ring-0! forced-colors:[&_svg]:stroke-[ButtonText] forced-colors:[&_svg]:text-[ButtonText]", o),
294
+ }), l && "group/icon-button relative isolate bg-transparent! border-0! shadow-none! ring-0! focus-visible:ring-0! aria-invalid:ring-0! forced-colors:[&_svg]:stroke-[ButtonText] forced-colors:[&_svg]:text-[ButtonText]", a),
325
295
  ...f,
326
- children: [l ? /* @__PURE__ */ h(D, {
296
+ children: [l ? /* @__PURE__ */ p(v, {
327
297
  shape: l,
328
- variant: r ?? "filled",
329
- color: i ?? (r === "ghost" ? "default" : "primary")
330
- }) : null, /* @__PURE__ */ h(t, { children: d })]
298
+ variant: t ?? "filled",
299
+ color: i ?? (t === "ghost" ? "default" : "primary")
300
+ }) : null, /* @__PURE__ */ p(n, { children: d })]
331
301
  })
332
302
  });
333
303
  }
334
- function k({ tooltip: e, "aria-label": t, ...n }) {
304
+ function b({ tooltip: e, "aria-label": t, ...n }) {
335
305
  let r = t ?? (typeof e == "string" ? e : void 0);
336
- return e ? /* @__PURE__ */ h(i, {
306
+ return e ? /* @__PURE__ */ p(a, {
337
307
  content: e,
338
- children: /* @__PURE__ */ h(O, {
308
+ children: /* @__PURE__ */ p(y, {
339
309
  "aria-label": r,
340
310
  ...n
341
311
  })
342
- }) : /* @__PURE__ */ h(O, {
312
+ }) : /* @__PURE__ */ p(y, {
343
313
  "aria-label": r,
344
314
  ...n
345
315
  });
346
316
  }
347
317
  //#endregion
348
- export { T as n, C as r, k as t };
318
+ export { g as n, b as t };
@@ -1,5 +1,6 @@
1
1
  import { Outline } from '@nxgt/material-core/shapes';
2
2
  import { RefObject } from 'react';
3
+ export declare const SETTLE_MS = 520;
3
4
  export declare function spring(ms: number): number;
4
5
  /**
5
6
  * Morphs the path in `ref` whenever `outline` changes, frame by frame
@@ -0,0 +1,20 @@
1
+ export type RootRole = 'img' | 'group' | 'none';
2
+ type Attrs = Record<string, string | number | undefined>;
3
+ /** The root `<svg>`: decorative, a named image, or a named group when a node inside is interactive. */
4
+ export declare function rootRole(o: {
5
+ decorative?: boolean;
6
+ interactive: boolean;
7
+ }): RootRole;
8
+ export declare function rootA11y(role: RootRole, title: string | undefined): Record<string, string>;
9
+ /**
10
+ * An interactive node is a focusable `button` (it has a click) or `img`, named
11
+ * by its label. A node with only a label is a named `img`, unless the root
12
+ * already is one (its parts are then presentational).
13
+ */
14
+ export declare function nodeA11y(o: {
15
+ interactive: boolean;
16
+ clickable: boolean;
17
+ label?: string;
18
+ root: RootRole;
19
+ }): Attrs;
20
+ export {};
@@ -0,0 +1,23 @@
1
+ import { DrawNode, Scene } from '@nxgt/material-core/draw';
2
+ import { RootRole } from './drawing-a11y.js';
3
+ import { NodeClick } from './drawing-types.js';
4
+ /** What a `Drawing` hands the primitives inside it. */
5
+ export type DrawingContextValue = {
6
+ /** The root's role: a primitive's label is a name only when the root is a group. */
7
+ root: RootRole;
8
+ decorative: boolean;
9
+ exactText: boolean;
10
+ onNodeClick?: NodeClick;
11
+ /** An interactive primitive calls it when it mounts, so the root becomes a group. */
12
+ register: () => () => void;
13
+ /**
14
+ * A plugin's hook: every primitive passes its node through it before it is
15
+ * compiled (`Sketch` of `@nxgt/material/draw/sketch` draws it by hand). It
16
+ * must be pure and deterministic, so the server and the client agree.
17
+ */
18
+ transform?: (node: DrawNode) => DrawNode;
19
+ /** The same for a whole `scene` given to a `Drawing`. */
20
+ transformScene?: (scene: Scene) => Scene;
21
+ };
22
+ export declare const DrawingContext: import('react').Context<DrawingContextValue>;
23
+ export declare const useDrawingContext: () => DrawingContextValue;
@@ -0,0 +1,63 @@
1
+ import { Paint, Scene } from '@nxgt/material-core/draw';
2
+ import { ComponentProps, FocusEvent, KeyboardEvent, MouseEvent, PointerEvent, ReactNode } from 'react';
3
+ /** The events one drawn node takes: set per scene id (`handlers`) or as props of a JSX primitive. */
4
+ export type NodeHandlers = {
5
+ onClick?: (event: MouseEvent<SVGGElement>) => void;
6
+ onPointerEnter?: (event: PointerEvent<SVGGElement>) => void;
7
+ onPointerLeave?: (event: PointerEvent<SVGGElement>) => void;
8
+ onPointerDown?: (event: PointerEvent<SVGGElement>) => void;
9
+ onPointerUp?: (event: PointerEvent<SVGGElement>) => void;
10
+ onFocus?: (event: FocusEvent<SVGGElement>) => void;
11
+ onBlur?: (event: FocusEvent<SVGGElement>) => void;
12
+ onKeyDown?: (event: KeyboardEvent<SVGGElement>) => void;
13
+ };
14
+ /** Called with the node's scene `id` when an interactive node is clicked, or activated with Enter or Space. */
15
+ export type NodeClick = (id: string, event: MouseEvent<SVGGElement>) => void;
16
+ /** The root takes a name or is decorative, never neither: the type enforces it. */
17
+ export type DrawingName = {
18
+ title: string;
19
+ decorative?: never;
20
+ } | {
21
+ decorative: true;
22
+ title?: never;
23
+ };
24
+ type Root = Omit<ComponentProps<'svg'>, 'children' | 'style' | 'title' | 'role' | 'width' | 'height' | 'viewBox' | 'aria-label' | 'aria-labelledby' | 'aria-hidden'>;
25
+ type Shared = Root & {
26
+ /**
27
+ * Refines the line breaks of wrapped text (`maxWidth`) with the browser's
28
+ * own font metrics once mounted. The first render, on the server and on the
29
+ * client, uses Inter's metrics. Default true.
30
+ */
31
+ exactText?: boolean;
32
+ };
33
+ /** A drawing from a `Scene` of plain data (`scene(...)` from `@nxgt/material/draw`). */
34
+ export type SceneDrawingProps = Shared & {
35
+ scene: Scene;
36
+ /** Events by node `id`. A node with an entry is interactive. */
37
+ handlers?: Record<string, NodeHandlers>;
38
+ /** A click or Enter or Space on any interactive node. */
39
+ onNodeClick?: NodeClick;
40
+ w?: never;
41
+ h?: never;
42
+ children?: never;
43
+ };
44
+ /** A drawing from JSX primitives (`Rect`, `Path`, `Text`...). */
45
+ export type JsxDrawingProps = Shared & {
46
+ w: number;
47
+ h: number;
48
+ viewBox?: [number, number, number, number];
49
+ /** A paint behind everything (a rect covering the view box). */
50
+ background?: Paint;
51
+ /**
52
+ * Set it when a primitive is interactive and the drawing is server
53
+ * rendered: the root is then `role="group"` in the first markup too. (The
54
+ * client switches to it by itself once a primitive mounts.)
55
+ */
56
+ interactive?: boolean;
57
+ onNodeClick?: NodeClick;
58
+ children?: ReactNode;
59
+ scene?: never;
60
+ handlers?: never;
61
+ };
62
+ export type DrawingProps = (SceneDrawingProps | JsxDrawingProps) & DrawingName;
63
+ export {};
@@ -0,0 +1,17 @@
1
+ import { DrawingProps } from './drawing-types.js';
2
+ /**
3
+ * A vector drawing. Give it a `scene` (plain data from `scene(...)` and the
4
+ * builders of `@nxgt/material/draw`) or `w`, `h` and primitives (`Rect`, `Path`,
5
+ * `Text`...) as children. A `title` names it (`role="img"`, or `"group"` when a
6
+ * node inside is interactive) or `decorative` hides it: one of the two, by type.
7
+ * Colours are theme roles (`primary-container`, `on-surface`...) that follow
8
+ * light and dark with no inline style, so a strict CSP is satisfied.
9
+ *
10
+ * ```tsx
11
+ * <Drawing w={200} h={80} title="Status">
12
+ * <Rect x={0} y={0} w={200} h={80} r={16} fill="primary-container" />
13
+ * <Text x={100} y={46} anchor="middle" fill="on-primary-container">Shipped</Text>
14
+ * </Drawing>
15
+ * ```
16
+ */
17
+ export declare function Drawing(props: DrawingProps): import("react").JSX.Element;
@@ -0,0 +1,5 @@
1
+ export { Drawing } from './drawing.js';
2
+ export type { DrawingName, DrawingProps, JsxDrawingProps, NodeClick, NodeHandlers, SceneDrawingProps, } from './drawing-types.js';
3
+ export { Group, Image, Text } from './partials/primitives/content.js';
4
+ export { Path, type PathProps } from './partials/primitives/path.js';
5
+ export { Circle, Ellipse, Line, Polygon, Rect, } from './partials/primitives/shapes.js';
@@ -0,0 +1,17 @@
1
+ import { ReactNode } from 'react';
2
+ import { RootRole } from '../drawing-a11y.js';
3
+ type Props = {
4
+ role: RootRole;
5
+ title?: string;
6
+ /** `width`, `height` and `viewBox`. */
7
+ attrs: Record<string, string | number>;
8
+ rest: Record<string, unknown>;
9
+ children: ReactNode;
10
+ };
11
+ /**
12
+ * The `<svg>`: named as an image or a group, or hidden. Made with
13
+ * `createElement`: the role is data (drawing-a11y.ts), and there is never a
14
+ * `<title>` (React 19 would hoist it into the document head).
15
+ */
16
+ export declare function DrawingRoot({ role, title, attrs, rest, children }: Props): import('react').ReactSVGElement;
17
+ export {};
@@ -0,0 +1,22 @@
1
+ import { ReactNode } from 'react';
2
+ import { RootRole } from '../drawing-a11y.js';
3
+ import { NodeClick, NodeHandlers } from '../drawing-types.js';
4
+ type Props = {
5
+ /** The node's scene `id`, written as `data-id`. */
6
+ id?: string;
7
+ label?: string;
8
+ handlers: NodeHandlers;
9
+ onNodeClick?: NodeClick;
10
+ root: RootRole;
11
+ /** A group with JSX children has no outline copy: it gets the CSS outline instead. */
12
+ outline?: boolean;
13
+ children: ReactNode;
14
+ };
15
+ /**
16
+ * The focusable wrapper of an interactive node: `role="button"` when it can be
17
+ * clicked, `role="img"` otherwise, with its label as name. Enter and Space
18
+ * click it. `createElement`, not JSX: the roles are set from data, and a
19
+ * native `<button>` cannot live in an SVG.
20
+ */
21
+ export declare function InteractiveNode(props: Props): ReactNode;
22
+ export {};
@@ -0,0 +1,20 @@
1
+ import { group, image, text } from '@nxgt/material-core/draw';
2
+ import { ReactNode } from 'react';
3
+ import { NodeHandlers } from '../../drawing-types.js';
4
+ type TextOptions = Parameters<typeof text>[1];
5
+ type GroupStyle = Parameters<typeof group>[0];
6
+ type ImageOptions = Parameters<typeof image>[0];
7
+ /** `<Text x y size anchor maxWidth ...>Hello</Text>`: the children are the text (`\n` breaks a line). */
8
+ export declare function Text(props: TextOptions & NodeHandlers & {
9
+ children?: ReactNode;
10
+ }): import("react").JSX.Element;
11
+ /**
12
+ * `<Group transform fill ...>...</Group>`: its style passes down to the
13
+ * children, which are JSX. An interactive group shows its focus as a CSS outline.
14
+ */
15
+ export declare function Group(props: GroupStyle & NodeHandlers & {
16
+ children?: ReactNode;
17
+ }): import("react").JSX.Element;
18
+ /** `<Image href x y w h fit alt ... />` */
19
+ export declare function Image(props: ImageOptions & NodeHandlers): import("react").JSX.Element;
20
+ export {};
@@ -0,0 +1,29 @@
1
+ import { DrawNode, PathBuilder, Style } from '@nxgt/material-core/draw';
2
+ import { NodeHandlers } from '../../drawing-types.js';
3
+ type Arrows = Extract<DrawNode, {
4
+ type: 'path';
5
+ }>['arrow'];
6
+ type Source = {
7
+ d: string;
8
+ build?: never;
9
+ node?: never;
10
+ } | {
11
+ build: (p: PathBuilder) => PathBuilder | undefined;
12
+ d?: never;
13
+ node?: never;
14
+ }
15
+ /** A ready node, such as `shape('cookie-9', ...)` from the shapes library; the other props override its style. */
16
+ | {
17
+ node: DrawNode;
18
+ d?: never;
19
+ build?: never;
20
+ };
21
+ export type PathProps = Style & {
22
+ arrow?: Arrows;
23
+ } & NodeHandlers & Source;
24
+ /**
25
+ * `<Path d="M0 0 L10 10" />`, `<Path build={(p) => p.moveTo(0, 0).lineTo(10, 10)} />`
26
+ * or `<Path node={shape(...)} />`.
27
+ */
28
+ export declare function Path(props: PathProps): import("react").JSX.Element;
29
+ export {};
@@ -0,0 +1,19 @@
1
+ import { DrawNode } from '@nxgt/material-core/draw';
2
+ import { ReactNode } from 'react';
3
+ import { NodeHandlers } from '../../drawing-types.js';
4
+ /** Splits a primitive's props into its events and the rest (the node's own). */
5
+ export declare function splitEvents<P extends NodeHandlers>(props: P): [NodeHandlers, Omit<P, keyof NodeHandlers>];
6
+ type Props = {
7
+ node: DrawNode;
8
+ events: NodeHandlers;
9
+ /** JSX children of a group, drawn inside it. */
10
+ slot?: ReactNode;
11
+ };
12
+ /**
13
+ * Draws one node: the core builder made it, `compileNode` turns it into
14
+ * elements (its gradients and clips become local `<defs>` under an id of this
15
+ * instance), `SvgTree` maps them. A node with events, or `interactive`, is
16
+ * focusable and makes the root a group.
17
+ */
18
+ export declare function Primitive({ node, events, slot }: Props): import("react").JSX.Element;
19
+ export {};