@luxalgo/vela-ui 0.2.0 → 0.4.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 (217) hide show
  1. package/CHANGELOG.md +153 -91
  2. package/LICENSE +201 -201
  3. package/NOTICE +28 -28
  4. package/README.md +86 -86
  5. package/cli/engine.mjs +282 -282
  6. package/cli/index.mjs +154 -154
  7. package/dist/badge.js +1 -1
  8. package/dist/bar-chart.d.ts +1 -1
  9. package/dist/bar-chart.js +1 -1
  10. package/dist/button.d.ts +1 -1
  11. package/dist/button.js +4 -4
  12. package/dist/callout-bubble.d.ts +1 -1
  13. package/dist/callout-bubble.js +4 -4
  14. package/dist/card.d.ts +52 -0
  15. package/dist/card.js +179 -0
  16. package/dist/checkbox.js +5 -5
  17. package/dist/{chunk-B5ZSRUDQ.js → chunk-BWSOMG3G.js} +2 -2
  18. package/dist/{chunk-G7IQLY3A.js → chunk-C3PXY2SW.js} +5 -0
  19. package/dist/{chunk-CC3DDNFC.js → chunk-DXDCKZ2M.js} +4 -4
  20. package/dist/chunk-GUIYFQ27.js +30 -0
  21. package/dist/{chunk-WGULXRWD.js → chunk-KUWTI2PE.js} +4 -4
  22. package/dist/{chunk-Z5PINFQO.js → chunk-QGWAN3EP.js} +5 -5
  23. package/dist/{chunk-V2Q4MRMS.js → chunk-RH53NQGE.js} +30 -4
  24. package/dist/{chunk-WBGSYCV2.js → chunk-SKFAYTDK.js} +4 -4
  25. package/dist/{chunk-MJ4RUGX7.js → chunk-TGJNHUYV.js} +3 -3
  26. package/dist/{chunk-WXH3EFV5.js → chunk-VC7SVSDK.js} +4 -4
  27. package/dist/{chunk-7VMN7NKJ.js → chunk-YT2BSP7O.js} +3 -3
  28. package/dist/collapsible.d.ts +1 -1
  29. package/dist/collapsible.js +3 -3
  30. package/dist/color-picker.js +5 -5
  31. package/dist/context-menu.js +5 -5
  32. package/dist/data-table.d.ts +1 -1
  33. package/dist/data-table.js +1 -1
  34. package/dist/date-picker.d.ts +1 -1
  35. package/dist/date-picker.js +2 -2
  36. package/dist/dialog.d.ts +9 -1
  37. package/dist/dialog.js +15 -5
  38. package/dist/donut.d.ts +1 -1
  39. package/dist/donut.js +1 -1
  40. package/dist/drawer.d.ts +1 -1
  41. package/dist/drawer.js +2 -2
  42. package/dist/dropdown-menu.d.ts +1 -1
  43. package/dist/dropdown-menu.js +5 -5
  44. package/dist/empty.d.ts +1 -1
  45. package/dist/empty.js +2 -2
  46. package/dist/field.js +13 -13
  47. package/dist/{stat.d.ts → figure.d.ts} +9 -9
  48. package/dist/figure.js +41 -0
  49. package/dist/glyph-select.js +5 -5
  50. package/dist/hover-card.d.ts +1 -1
  51. package/dist/hover-card.js +3 -3
  52. package/dist/icons.js +1 -1
  53. package/dist/index.d.ts +4 -2
  54. package/dist/index.js +3 -3
  55. package/dist/input-group.d.ts +1 -1
  56. package/dist/input-group.js +4 -4
  57. package/dist/input.js +2 -2
  58. package/dist/item.d.ts +1 -1
  59. package/dist/item.js +2 -2
  60. package/dist/kbd.d.ts +1 -1
  61. package/dist/kbd.js +2 -2
  62. package/dist/line-chart.d.ts +1 -1
  63. package/dist/line-chart.js +1 -1
  64. package/dist/manifest.json +691 -74
  65. package/dist/month-grid.js +1 -1
  66. package/dist/number-input.d.ts +1 -1
  67. package/dist/number-input.js +5 -5
  68. package/dist/popover.js +3 -3
  69. package/dist/scatter-chart.d.ts +1 -1
  70. package/dist/scatter-chart.js +1 -1
  71. package/dist/select.d.ts +1 -1
  72. package/dist/select.js +7 -7
  73. package/dist/slider.d.ts +1 -1
  74. package/dist/slider.js +2 -2
  75. package/dist/sort-button.js +4 -4
  76. package/dist/sparkline.d.ts +1 -1
  77. package/dist/sparkline.js +1 -1
  78. package/dist/switch.d.ts +1 -1
  79. package/dist/switch.js +3 -3
  80. package/dist/tabs.d.ts +1 -1
  81. package/dist/tabs.js +4 -4
  82. package/dist/text-area.d.ts +1 -1
  83. package/dist/text-area.js +2 -2
  84. package/dist/theme-TefB8vtl.d.ts +341 -0
  85. package/dist/theme.d.ts +42 -192
  86. package/dist/theme.js +1 -1
  87. package/dist/theme.schema.json +321 -30
  88. package/dist/toast.d.ts +49 -0
  89. package/dist/toast.js +463 -0
  90. package/dist/toggle-group.d.ts +1 -1
  91. package/dist/toggle-group.js +4 -4
  92. package/dist/tooltip.js +2 -2
  93. package/dist/treemap.d.ts +80 -0
  94. package/dist/treemap.js +470 -0
  95. package/dist/zag.d.ts +11 -2
  96. package/dist/zag.js +1 -1
  97. package/docs/theming.md +217 -217
  98. package/docs/what-to-change.md +20 -20
  99. package/docs/writing-a-component.md +250 -250
  100. package/llms.txt +6 -3
  101. package/package.json +90 -90
  102. package/registry/badge.ts +119 -119
  103. package/registry/bar-chart.ts +215 -215
  104. package/registry/button.ts +387 -379
  105. package/registry/callout-bubble.ts +347 -347
  106. package/registry/card.ts +379 -0
  107. package/registry/checkbox.ts +234 -234
  108. package/registry/collapsible.ts +271 -271
  109. package/registry/color-picker.ts +582 -582
  110. package/registry/context-menu.ts +208 -208
  111. package/registry/data-table.ts +215 -215
  112. package/registry/date-picker.ts +483 -483
  113. package/registry/dialog.ts +551 -535
  114. package/registry/donut.ts +145 -145
  115. package/registry/drawer.ts +636 -636
  116. package/registry/dropdown-menu.ts +762 -762
  117. package/registry/empty.ts +91 -91
  118. package/registry/field.ts +584 -584
  119. package/registry/{stat.ts → figure.ts} +96 -96
  120. package/registry/glyph-select.ts +268 -268
  121. package/registry/hover-card.ts +222 -222
  122. package/registry/input-group.ts +229 -229
  123. package/registry/input.ts +181 -181
  124. package/registry/item.ts +376 -376
  125. package/registry/kbd.ts +64 -64
  126. package/registry/line-chart.ts +218 -218
  127. package/registry/month-grid.ts +328 -328
  128. package/registry/number-input.ts +443 -443
  129. package/registry/popover.ts +368 -368
  130. package/registry/scatter-chart.ts +221 -221
  131. package/registry/select.ts +620 -620
  132. package/registry/slider.ts +259 -259
  133. package/registry/sort-button.ts +189 -189
  134. package/registry/sparkline.ts +114 -114
  135. package/registry/switch.ts +205 -205
  136. package/registry/tabs.ts +426 -426
  137. package/registry/text-area.ts +186 -186
  138. package/registry/toast.ts +965 -0
  139. package/registry/toggle-group.ts +295 -295
  140. package/registry/tooltip.ts +156 -156
  141. package/registry/treemap.ts +847 -0
  142. package/skills/theming-vela-ui/SKILL.md +137 -137
  143. package/skills/using-vela-ui-components/SKILL.md +139 -137
  144. package/skills/writing-vela-ui-components/SKILL.md +163 -163
  145. package/src/components/badge.ts +119 -119
  146. package/src/components/bar-chart.ts +215 -215
  147. package/src/components/button.ts +387 -379
  148. package/src/components/callout-bubble.ts +347 -347
  149. package/src/components/card.ts +379 -0
  150. package/src/components/checkbox.ts +234 -234
  151. package/src/components/collapsible.ts +271 -271
  152. package/src/components/color-picker.ts +582 -582
  153. package/src/components/context-menu.ts +208 -208
  154. package/src/components/data-table.ts +215 -215
  155. package/src/components/date-picker.ts +483 -483
  156. package/src/components/dialog.ts +551 -535
  157. package/src/components/donut.ts +145 -145
  158. package/src/components/drawer.ts +636 -636
  159. package/src/components/dropdown-menu.ts +762 -762
  160. package/src/components/empty.ts +91 -91
  161. package/src/components/field.ts +584 -584
  162. package/src/components/{stat.ts → figure.ts} +96 -96
  163. package/src/components/glyph-select.ts +268 -268
  164. package/src/components/hover-card.ts +222 -222
  165. package/src/components/input-group.ts +229 -229
  166. package/src/components/input.ts +181 -181
  167. package/src/components/item.ts +376 -376
  168. package/src/components/kbd.ts +64 -64
  169. package/src/components/line-chart.ts +218 -218
  170. package/src/components/month-grid.ts +328 -328
  171. package/src/components/number-input.ts +443 -443
  172. package/src/components/popover.ts +368 -368
  173. package/src/components/scatter-chart.ts +221 -221
  174. package/src/components/select.ts +620 -620
  175. package/src/components/slider.ts +259 -259
  176. package/src/components/sort-button.ts +189 -189
  177. package/src/components/sparkline.ts +114 -114
  178. package/src/components/switch.ts +205 -205
  179. package/src/components/tabs.ts +426 -426
  180. package/src/components/text-area.ts +186 -186
  181. package/src/components/toast.ts +965 -0
  182. package/src/components/toggle-group.ts +295 -295
  183. package/src/components/tooltip.ts +156 -156
  184. package/src/components/treemap.ts +847 -0
  185. package/src/index.ts +24 -24
  186. package/src/lib/calendar.ts +117 -117
  187. package/src/lib/chart.ts +72 -72
  188. package/src/lib/color.ts +89 -89
  189. package/src/lib/component-index.ts +163 -151
  190. package/src/lib/css.ts +48 -48
  191. package/src/lib/define.ts +45 -45
  192. package/src/lib/dispose.ts +36 -36
  193. package/src/lib/h.ts +55 -55
  194. package/src/lib/headless.ts +16 -16
  195. package/src/lib/i18n.ts +30 -30
  196. package/src/lib/icons.ts +244 -237
  197. package/src/lib/kit-text.ts +26 -26
  198. package/src/lib/page.ts +24 -24
  199. package/src/lib/palette.ts +81 -81
  200. package/src/lib/placement.ts +188 -188
  201. package/src/lib/scope.ts +135 -135
  202. package/src/lib/styles.ts +53 -53
  203. package/src/lib/surface-events.ts +31 -31
  204. package/src/lib/surface-exit.ts +87 -87
  205. package/src/lib/t.ts +68 -68
  206. package/src/lib/theme.ts +684 -664
  207. package/src/lib/tokens.ts +110 -110
  208. package/src/lib/variants.ts +32 -32
  209. package/src/lib/zag.ts +61 -46
  210. package/stylelint/index.mjs +60 -60
  211. package/stylelint/lint.mjs +81 -81
  212. package/stylelint/plugin.mjs +115 -115
  213. package/dist/chunk-P4MTEMT7.js +0 -23
  214. package/dist/stat.js +0 -41
  215. package/dist/{chunk-U3EH42YY.js → chunk-5BJV5FY5.js} +1 -1
  216. package/dist/{chunk-E2FE6V2N.js → chunk-ALAHGSLC.js} +1 -1
  217. package/dist/{chunk-C3ICYMI3.js → chunk-FYVQO5TN.js} +1 -1
@@ -0,0 +1,49 @@
1
+ import './define-D5u3F5Dj.js';
2
+ export { E as ExternalToast, P as PromiseData, j as PromiseSource, S as SwipeDirection, k as ToastAction, l as ToastContent, m as ToastFunction, n as ToastId, o as ToastOffset, p as ToastPromise, q as ToastT, r as ToastType, s as ToasterHandle, t as ToasterPosition, u as ToasterProps, v as createToaster, w as toast, x as toastDef } from './theme-TefB8vtl.js';
3
+ import './i18n.js';
4
+ import './t.js';
5
+ import './badge.js';
6
+ import './variants-B4stUBnY.js';
7
+ import './bar-chart.js';
8
+ import './button.js';
9
+ import './callout-bubble.js';
10
+ import './placement.js';
11
+ import './tokens.js';
12
+ import './popover.js';
13
+ import './card.js';
14
+ import './h-Bl37qUis.js';
15
+ import './color-picker.js';
16
+ import './data-table.js';
17
+ import './date-picker.js';
18
+ import './dialog.js';
19
+ import '@zag-js/dialog';
20
+ import './donut.js';
21
+ import './drawer.js';
22
+ import './empty.js';
23
+ import './field.js';
24
+ import './select.js';
25
+ import './glyph-select.js';
26
+ import './hover-card.js';
27
+ import './kbd.js';
28
+ import './line-chart.js';
29
+ import './dropdown-menu.js';
30
+ import '@zag-js/menu';
31
+ import './number-input.js';
32
+ import './scatter-chart.js';
33
+ import './sparkline.js';
34
+ import './figure.js';
35
+ import './checkbox.js';
36
+ import './collapsible.js';
37
+ import './tabs.js';
38
+ import './text-area.js';
39
+ import './input.js';
40
+ import './input-group.js';
41
+ import './item.js';
42
+ import './month-grid.js';
43
+ import './slider.js';
44
+ import './sort-button.js';
45
+ import './switch.js';
46
+ import './toggle-group.js';
47
+ import './tooltip.js';
48
+ import '@zag-js/tooltip';
49
+ import './treemap.js';
package/dist/toast.js ADDED
@@ -0,0 +1,463 @@
1
+ import { kitTranslator } from './chunk-FVH6L7FM.js';
2
+ import { msg, textOf } from './chunk-FN2BUFNM.js';
3
+ import { ensureUIHost } from './chunk-RH53NQGE.js';
4
+ import './chunk-TAKSIV57.js';
5
+ import './chunk-MMTMOV6R.js';
6
+ import { iconEl } from './chunk-C3PXY2SW.js';
7
+ import { h } from './chunk-Q6WTDVH6.js';
8
+ import { t } from './chunk-6QCILIT2.js';
9
+ import { defineComponent } from './chunk-VMCR3S2A.js';
10
+ import { defineStyles, css } from './chunk-XBEL4K33.js';
11
+ import './chunk-2GQIZM5Z.js';
12
+ import './chunk-BXMWQIBO.js';
13
+ import { pageState } from './chunk-X66RJAIS.js';
14
+
15
+ // src/components/toast.ts
16
+ var toastDef = defineComponent({
17
+ name: "toast",
18
+ parts: ["root", "list", "item", "close", "icon", "content", "title", "description", "cancel", "action"],
19
+ settings: {
20
+ width: "356px",
21
+ radius: t.radius.lg,
22
+ background: t.surface.elev,
23
+ border: t.border,
24
+ foreground: t.fg.bright,
25
+ "description-color": t.fg.muted,
26
+ shadow: t.shadow,
27
+ success: t.profit,
28
+ info: t.accent,
29
+ warning: t.highlight,
30
+ error: t.danger
31
+ }
32
+ });
33
+ var QUEUE_CAP = 50;
34
+ var queue = pageState("toasts@1", () => ({ toasts: [], listeners: /* @__PURE__ */ new Set(), n: 0 }));
35
+ function emit(e) {
36
+ for (const fn of [...queue.listeners]) fn(e);
37
+ }
38
+ function raise(title, type, data = {}) {
39
+ const id = data.id ?? ++queue.n;
40
+ const at = queue.toasts.findIndex((x) => x.id === id);
41
+ const next = { ...at >= 0 ? queue.toasts[at] : {}, ...data, id, type, title };
42
+ if (at >= 0) queue.toasts[at] = next;
43
+ else {
44
+ queue.toasts.push(next);
45
+ if (queue.toasts.length > QUEUE_CAP) queue.toasts.shift();
46
+ }
47
+ emit({ kind: "show", toast: next });
48
+ return id;
49
+ }
50
+ function settle(id, reason) {
51
+ const at = queue.toasts.findIndex((x) => x.id === id);
52
+ if (at >= 0) {
53
+ const [gone] = queue.toasts.splice(at, 1);
54
+ if (reason === "auto") gone.onAutoClose?.(gone);
55
+ else gone.onDismiss?.(gone);
56
+ }
57
+ emit({ kind: "dismiss", id });
58
+ }
59
+ var resolve = (v, arg) => typeof v === "function" && v.length > 0 ? v(arg) : v;
60
+ function promiseToast(source, data = {}) {
61
+ const { loading, success, error, description, finally: done, ...rest } = data;
62
+ let id = rest.id;
63
+ if (loading !== void 0) id = raise(loading, "loading", { ...rest, description: resolve(description, void 0) });
64
+ const p = typeof source === "function" ? source() : source;
65
+ p.then(
66
+ (value) => {
67
+ const title = resolve(success, value);
68
+ if (title !== void 0) raise(title, "success", { ...rest, id, description: resolve(description, value) });
69
+ else if (id !== void 0) settle(id, "dismiss");
70
+ },
71
+ (err) => {
72
+ const title = resolve(error, err);
73
+ if (title !== void 0) raise(title, "error", { ...rest, id, description: resolve(description, err) });
74
+ else if (id !== void 0) settle(id, "dismiss");
75
+ }
76
+ ).finally(() => done?.());
77
+ return { id, unwrap: () => p };
78
+ }
79
+ var kind = (type) => (message, data) => raise(message, type, data);
80
+ var toast = Object.assign(kind("default"), {
81
+ message: kind("default"),
82
+ success: kind("success"),
83
+ info: kind("info"),
84
+ warning: kind("warning"),
85
+ error: kind("error"),
86
+ loading: kind("loading"),
87
+ promise: promiseToast,
88
+ dismiss(id) {
89
+ if (id === void 0) for (const x of [...queue.toasts]) settle(x.id, "dismiss");
90
+ else settle(id, "dismiss");
91
+ return id;
92
+ },
93
+ getToasts: () => queue.toasts.slice()
94
+ });
95
+ var TEXT = {
96
+ region: msg("ui.toast.region", "Notifications"),
97
+ close: msg("ui.toast.close", "Close toast")
98
+ };
99
+ var DEFAULT_ICONS = {
100
+ success: "circle-check",
101
+ info: "circle-info",
102
+ warning: "triangle-alert",
103
+ error: "circle-x",
104
+ loading: "loader",
105
+ close: "close"
106
+ };
107
+ var KEY_NAMES = { altKey: "Alt", ctrlKey: "Control", metaKey: "Meta", shiftKey: "Shift" };
108
+ var SWIPE_THRESHOLD = 45;
109
+ var VELOCITY_THRESHOLD = 0.11;
110
+ var EXIT_MS = 400;
111
+ var injectStyles = defineStyles(
112
+ "vela-ui-toast",
113
+ css`@layer vela.ui{[data-slot=toast]{display:contents}[data-slot=toast-list]{--_offset-top:24px;--_offset-bottom:24px;--_offset-start:24px;--_offset-end:24px;--_gap:14px;z-index:${t.z.popover};box-sizing:border-box;width:min(${toastDef.vars.width}, calc(100% - var(--_offset-start) - var(--_offset-end)));font-family:${t.font};transition:height calc(${t.dur.med} * 2.5) ${t.ease};margin:0;padding:0;list-style:none;position:fixed}[data-slot=toast-list][data-contained]{position:absolute}[data-slot=toast-list][data-y=top]{top:var(--_offset-top)}[data-slot=toast-list][data-y=bottom]{bottom:var(--_offset-bottom)}[data-slot=toast-list][data-x=left]{inset-inline-start:var(--_offset-start)}[data-slot=toast-list][data-x=right]{inset-inline-end:var(--_offset-end)}[data-slot=toast-list][data-x=center]{margin-inline:auto;inset-inline:0}[data-slot=toast-list]:focus-visible{outline:2px solid ${t.focus};outline-offset:4px;border-radius:${toastDef.vars.radius}}[data-slot=toast-item]{--_y:0px;--_scale:1;--_swipe-x:0px;--_swipe-y:0px;--_tint:${toastDef.vars.foreground};box-sizing:border-box;border:1px solid ${toastDef.vars.border};border-radius:${toastDef.vars.radius};background:${toastDef.vars.background};box-shadow:${toastDef.vars.shadow};color:${toastDef.vars.foreground};opacity:0;overflow-wrap:anywhere;touch-action:none;-webkit-user-select:none;user-select:none;transition:transform calc(${t.dur.med} * 2.5) ${t.ease}, opacity calc(${t.dur.med} * 2.5) ${t.ease}, height calc(${t.dur.med} * 2.5) ${t.ease};gap:6px;padding:16px;font-size:13px;line-height:1.4;position:absolute;inset-inline:0}[data-slot=toast-item]:where(:not([hidden])){align-items:center;display:flex}[data-slot=toast-item][data-y=bottom]{transform-origin:bottom;bottom:0;transform:translateY(100%)}[data-slot=toast-item][data-y=top]{transform-origin:top;top:0;transform:translateY(-100%)}[data-slot=toast-item][data-mounted]{opacity:1;transform:translate(var(--_swipe-x), calc(var(--_y) + var(--_swipe-y))) scale(var(--_scale))}[data-slot=toast-item][data-mounted][data-visible=false]{opacity:0;pointer-events:none}[data-slot=toast-item][data-expanded=false][data-front=false]{overflow:hidden}[data-slot=toast-item][data-expanded=false][data-front=false]>*{opacity:0}[data-slot=toast-item][data-removed]{opacity:0;pointer-events:none}[data-slot=toast-item][data-removed=front][data-y=bottom]{transform:translateY(100%)}[data-slot=toast-item][data-removed=front][data-y=top]{transform:translateY(-100%)}[data-slot=toast-item][data-swiping]{transition:none}[data-slot=toast-item]:after{height:var(--_gap);content:"";position:absolute;inset-inline:0}[data-slot=toast-item][data-y=bottom]:after{top:100%}[data-slot=toast-item][data-y=top]:after{bottom:100%}[data-slot=toast-item]:focus-visible{outline:2px solid ${t.focus};outline-offset:2px}[data-slot=toast-item][data-invert]{--_tint:${toastDef.vars.background};border-color:${toastDef.vars.foreground};background:${toastDef.vars.foreground};color:${toastDef.vars.background}}[data-slot=toast-item][data-rich-colors][data-type=success]{--_tint:${toastDef.vars.success}}[data-slot=toast-item][data-rich-colors][data-type=info]{--_tint:${toastDef.vars.info}}[data-slot=toast-item][data-rich-colors][data-type=warning]{--_tint:${toastDef.vars.warning}}[data-slot=toast-item][data-rich-colors][data-type=error]{--_tint:${toastDef.vars.error}}[data-slot=toast-item][data-rich-colors]:is([data-type=success],[data-type=info],[data-type=warning],[data-type=error]){border-color:color-mix(in srgb, var(--_tint) 40%, ${toastDef.vars.background});background:color-mix(in srgb, var(--_tint) 14%, ${toastDef.vars.background});color:color-mix(in srgb, var(--_tint) 80%, ${toastDef.vars.foreground})}[data-slot=toast-icon]{flex:none;width:16px;height:16px;margin-inline:-3px 4px;font-size:16px;line-height:0}[data-slot=toast-icon]:where(:not([hidden])){justify-content:center;align-items:center;display:flex}[data-slot=toast-icon]:is([data-type=loading] *){animation:vela-toast-spin calc(${t.dur.med} * 5) linear infinite}[data-slot=toast-content]{flex:auto;gap:2px;min-width:0}[data-slot=toast-content]:where(:not([hidden])){flex-direction:column;display:flex}[data-slot=toast-title]{font-weight:500;line-height:1.5}[data-slot=toast-description]{color:${toastDef.vars["description-color"]};font-weight:400;line-height:1.4}[data-slot=toast-description]:is([data-rich-colors] *),[data-slot=toast-description]:is([data-invert] *){color:inherit;opacity:.85}[data-slot=toast-action],[data-slot=toast-cancel]{border-radius:${t.radius.sm};height:24px;font:inherit;cursor:pointer;transition:opacity ${t.dur.fast} ease;border:0;flex:none;padding:0 8px;font-size:12px;font-weight:500}:is([data-slot=toast-action],[data-slot=toast-cancel]):hover{opacity:.88}:is([data-slot=toast-action],[data-slot=toast-cancel]):focus-visible{outline:2px solid ${t.focus};outline-offset:2px}[data-slot=toast-action]{background:var(--_tint);color:${toastDef.vars.background}}[data-slot=toast-cancel]{background:color-mix(in srgb, currentcolor 12%, transparent);color:inherit}[data-slot=toast-close]{top:0;border:1px solid ${toastDef.vars.border};background:${toastDef.vars.background};width:20px;height:20px;color:${toastDef.vars.foreground};cursor:pointer;transition:opacity ${t.dur.fast} ease, background ${t.dur.fast} ease;border-radius:50%;padding:0;font-size:12px;line-height:0;position:absolute;inset-inline-start:0;translate:-35% -35%}[data-slot=toast-close]:where(:not([hidden])){justify-content:center;align-items:center;display:flex}[data-slot=toast-close]:is([dir=rtl] *){translate:35% -35%}[data-slot=toast-close]:hover{background:${t.surface.overlay}}[data-slot=toast-close]:focus-visible{outline:2px solid ${t.focus};outline-offset:1px}@keyframes vela-toast-spin{to{transform:rotate(360deg)}}}`
114
+ );
115
+ var px = (v) => typeof v === "number" ? `${v}px` : v;
116
+ var ToasterImpl = class {
117
+ constructor(props) {
118
+ this.props = props;
119
+ this.stacks = /* @__PURE__ */ new Map();
120
+ this.views = /* @__PURE__ */ new Map();
121
+ this.byLi = /* @__PURE__ */ new WeakMap();
122
+ this.paused = false;
123
+ this.hotkeyOpen = false;
124
+ this.onQueue = (e) => {
125
+ if (e.kind === "show") {
126
+ if ((e.toast.toasterId ?? null) !== (this.props.id ?? null)) return;
127
+ this.show(e.toast);
128
+ } else if (e.id === void 0) for (const v of [...this.views.values()]) this.remove(v);
129
+ else {
130
+ const v = this.views.get(e.id);
131
+ if (v) this.remove(v);
132
+ }
133
+ };
134
+ this.onKey = (e) => {
135
+ const keys = this.props.hotkey ?? ["altKey", "KeyT"];
136
+ const pressed = keys.length > 0 && keys.every((k) => e[k] === true || e.code === k);
137
+ if (pressed) {
138
+ const first = [...this.stacks.values()].find((s) => s.ol.childElementCount > 0);
139
+ if (!first) return;
140
+ this.hotkeyOpen = true;
141
+ first.ol.focus();
142
+ this.relayoutAll();
143
+ return;
144
+ }
145
+ if (e.key === "Escape" && this.hotkeyOpen && this.el.contains(document.activeElement)) {
146
+ this.hotkeyOpen = false;
147
+ document.activeElement?.blur();
148
+ this.relayoutAll();
149
+ }
150
+ };
151
+ this.onVisibility = () => this.syncTimers();
152
+ const host = props.host ?? document.body;
153
+ const root = host.getRootNode();
154
+ injectStyles(root instanceof ShadowRoot ? root : host.ownerDocument);
155
+ this.i18n = props.i18n ?? kitTranslator();
156
+ this.position = props.position ?? "bottom-right";
157
+ this.gap = props.gap ?? 14;
158
+ this.visible = props.visibleToasts ?? 3;
159
+ const keys = (props.hotkey ?? ["altKey", "KeyT"]).map((k) => KEY_NAMES[k] ?? k.replace(/^(Key|Digit)/, "")).join("+");
160
+ this.el = h("section", {
161
+ className: props.className,
162
+ slot: toastDef.slot("root"),
163
+ attrs: {
164
+ "aria-keyshortcuts": keys || null,
165
+ tabindex: -1,
166
+ "aria-live": "polite",
167
+ "aria-relevant": "additions text",
168
+ "aria-atomic": "false",
169
+ dir: props.dir && props.dir !== "auto" ? props.dir : null
170
+ }
171
+ });
172
+ this.relabel();
173
+ host.append(this.el);
174
+ if (props.theme || !this.el.parentElement?.closest(".vela-ui")) ensureUIHost(this.el, props.theme);
175
+ queue.listeners.add(this.onQueue);
176
+ document.addEventListener("keydown", this.onKey);
177
+ document.addEventListener("visibilitychange", this.onVisibility);
178
+ }
179
+ relabel() {
180
+ this.el.setAttribute("aria-label", this.props.containerAriaLabel ?? textOf(this.i18n, TEXT.region));
181
+ const close = textOf(this.i18n, TEXT.close);
182
+ for (const b of this.el.querySelectorAll(`[data-slot='${toastDef.slot("close")}']`)) b.setAttribute("aria-label", close);
183
+ }
184
+ destroy() {
185
+ queue.listeners.delete(this.onQueue);
186
+ document.removeEventListener("keydown", this.onKey);
187
+ document.removeEventListener("visibilitychange", this.onVisibility);
188
+ for (const v of this.views.values()) if (v.timer) clearTimeout(v.timer);
189
+ this.views.clear();
190
+ this.stacks.clear();
191
+ this.el.remove();
192
+ }
193
+ stack(position) {
194
+ let s = this.stacks.get(position);
195
+ if (s) return s;
196
+ const [y, x] = position.split("-");
197
+ const ol = h("ol", { slot: toastDef.slot("list"), data: { y, x, contained: this.props.contained ?? false }, attrs: { tabindex: -1 } });
198
+ this.applyOffset(ol);
199
+ const stack = { ol, y, x, hovered: false, interacting: false };
200
+ ol.addEventListener("mouseenter", () => this.setHover(stack, true));
201
+ ol.addEventListener("mousemove", () => this.setHover(stack, true));
202
+ ol.addEventListener("mouseleave", () => {
203
+ if (!stack.interacting) this.setHover(stack, false);
204
+ });
205
+ ol.addEventListener("pointerdown", (e) => {
206
+ if (e.pointerType === "mouse" && e.button !== 0) return;
207
+ stack.interacting = true;
208
+ this.relayout(position);
209
+ });
210
+ ol.addEventListener("pointerup", () => {
211
+ stack.interacting = false;
212
+ this.relayout(position);
213
+ });
214
+ ol.addEventListener("focusout", (e) => {
215
+ if (e.relatedTarget instanceof Node && ol.contains(e.relatedTarget)) return;
216
+ this.hotkeyOpen = false;
217
+ this.relayout(position);
218
+ });
219
+ this.el.append(ol);
220
+ this.stacks.set(position, stack);
221
+ return stack;
222
+ }
223
+ applyOffset(ol) {
224
+ const fallback = this.props.contained ? "16px" : "24px";
225
+ const offset = this.props.offset ?? fallback;
226
+ const sides = typeof offset === "object" ? offset : { top: offset, right: offset, bottom: offset, left: offset };
227
+ const rtl = this.props.dir === "rtl";
228
+ ol.style.setProperty("--_offset-top", px(sides.top ?? fallback));
229
+ ol.style.setProperty("--_offset-bottom", px(sides.bottom ?? fallback));
230
+ ol.style.setProperty("--_offset-start", px((rtl ? sides.right : sides.left) ?? fallback));
231
+ ol.style.setProperty("--_offset-end", px((rtl ? sides.left : sides.right) ?? fallback));
232
+ ol.style.setProperty("--_gap", `${this.gap}px`);
233
+ }
234
+ setHover(stack, hovered) {
235
+ if (stack.hovered === hovered) return;
236
+ stack.hovered = hovered;
237
+ this.relayoutAll();
238
+ }
239
+ show(toast2) {
240
+ const existing = this.views.get(toast2.id);
241
+ if (existing && !existing.removed) {
242
+ existing.toast = toast2;
243
+ this.render(existing);
244
+ existing.height = this.measure(existing.li);
245
+ this.restartTimer(existing);
246
+ this.relayout(existing.position);
247
+ return;
248
+ }
249
+ const position = toast2.position ?? this.position;
250
+ const stack = this.stack(position);
251
+ const li = h("li", { slot: toastDef.slot("item"), data: { y: stack.y, x: stack.x }, attrs: { tabindex: 0 } });
252
+ const view = { toast: toast2, li, position, height: 0, removed: false, duration: 0, remaining: 0, started: 0, timer: null };
253
+ this.views.set(toast2.id, view);
254
+ this.byLi.set(li, view);
255
+ this.render(view);
256
+ stack.ol.prepend(li);
257
+ view.height = this.measure(li);
258
+ this.bindSwipe(view, stack);
259
+ this.restartTimer(view);
260
+ this.relayout(position);
261
+ requestAnimationFrame(() => li.setAttribute("data-mounted", ""));
262
+ }
263
+ render(view) {
264
+ const { toast: x, li } = view;
265
+ const opts = this.props.toastOptions ?? {};
266
+ const dismissible = x.dismissible ?? opts.dismissible ?? true;
267
+ li.className = [opts.className, x.className].filter(Boolean).join(" ");
268
+ li.setAttribute("data-type", x.type);
269
+ li.setAttribute("data-dismissible", String(dismissible));
270
+ li.toggleAttribute("data-rich-colors", x.richColors ?? opts.richColors ?? this.props.richColors ?? false);
271
+ li.toggleAttribute("data-invert", x.invert ?? opts.invert ?? this.props.invert ?? false);
272
+ li.replaceChildren();
273
+ if (dismissible && x.type !== "loading" && (x.closeButton ?? opts.closeButton ?? this.props.closeButton ?? false)) {
274
+ const close = h("button", {
275
+ slot: toastDef.slot("close"),
276
+ attrs: { type: "button", "aria-label": textOf(this.i18n, TEXT.close) },
277
+ on: { click: () => settle(x.id, "dismiss") }
278
+ });
279
+ close.append(this.icon(this.props.icons?.close ?? DEFAULT_ICONS.close));
280
+ li.append(close);
281
+ }
282
+ const icon = x.icon === null ? null : x.icon ?? (x.type === "default" ? null : this.props.icons?.[x.type] ?? DEFAULT_ICONS[x.type]);
283
+ if (icon !== null) li.append(h("div", { slot: toastDef.slot("icon"), data: { type: x.type } }, this.icon(icon)));
284
+ const content = h("div", { slot: toastDef.slot("content") });
285
+ const title = read(x.title);
286
+ if (title !== void 0) content.append(h("div", { slot: toastDef.slot("title") }, title));
287
+ const description = read(x.description);
288
+ if (description !== void 0) content.append(h("div", { slot: toastDef.slot("description") }, description));
289
+ li.append(content);
290
+ if (x.cancel) li.append(this.button(x, x.cancel, "cancel"));
291
+ if (x.action) li.append(this.button(x, x.action, "action"));
292
+ }
293
+ icon(icon) {
294
+ return typeof icon === "string" ? iconEl(icon, this.el.ownerDocument) : icon.cloneNode(true);
295
+ }
296
+ button(x, action, part) {
297
+ if (action instanceof Node) return action;
298
+ return h("button", {
299
+ slot: toastDef.slot(part),
300
+ attrs: { type: "button" },
301
+ text: action.label,
302
+ on: {
303
+ click: (e) => {
304
+ action.onClick(e);
305
+ if (part === "cancel" || !e.defaultPrevented) settle(x.id, "dismiss");
306
+ }
307
+ }
308
+ });
309
+ }
310
+ /** The toast's natural height, whatever height the stack gives it. */
311
+ measure(li) {
312
+ const height = li.style.height;
313
+ li.style.height = "auto";
314
+ const natural = li.offsetHeight;
315
+ li.style.height = height;
316
+ return natural;
317
+ }
318
+ remove(view) {
319
+ if (view.removed) return;
320
+ view.removed = true;
321
+ if (view.timer) clearTimeout(view.timer);
322
+ view.timer = null;
323
+ const front = view.li.getAttribute("data-front") === "true" && !view.li.hasAttribute("data-swiped");
324
+ view.li.setAttribute("data-removed", front ? "front" : "");
325
+ this.views.delete(view.toast.id);
326
+ this.relayout(view.position);
327
+ setTimeout(() => view.li.remove(), EXIT_MS);
328
+ }
329
+ expanded(stack) {
330
+ return (this.props.expand ?? false) || stack.hovered || stack.interacting || this.hotkeyOpen;
331
+ }
332
+ relayoutAll() {
333
+ for (const position of this.stacks.keys()) this.relayout(position);
334
+ }
335
+ relayout(position) {
336
+ const stack = this.stacks.get(position);
337
+ if (!stack) return;
338
+ const items = [...stack.ol.children].flatMap((li) => {
339
+ const v = this.byLi.get(li);
340
+ return v && !v.removed ? [v] : [];
341
+ });
342
+ const expanded = this.expanded(stack);
343
+ const lift = stack.y === "bottom" ? -1 : 1;
344
+ const front = items[0]?.height ?? 0;
345
+ let offset = 0;
346
+ let extent = 0;
347
+ items.forEach((v, i) => {
348
+ const visible = i < this.visible;
349
+ const y = expanded ? lift * offset : lift * this.gap * i;
350
+ const scale = expanded ? 1 : 1 - i * 0.05;
351
+ const li = v.li;
352
+ li.style.setProperty("--_y", `${y}px`);
353
+ li.style.setProperty("--_scale", String(scale));
354
+ li.style.height = `${expanded || i === 0 ? v.height : front}px`;
355
+ li.style.zIndex = String(items.length - i);
356
+ li.setAttribute("data-index", String(i));
357
+ li.setAttribute("data-front", String(i === 0));
358
+ li.setAttribute("data-expanded", String(expanded));
359
+ li.setAttribute("data-visible", String(visible));
360
+ if (visible) extent = expanded ? offset + v.height : front + this.gap * i;
361
+ offset += v.height + this.gap;
362
+ });
363
+ stack.ol.style.height = `${extent}px`;
364
+ stack.ol.toggleAttribute("data-expanded", expanded);
365
+ this.syncTimers();
366
+ }
367
+ restartTimer(view) {
368
+ if (view.timer) clearTimeout(view.timer);
369
+ view.timer = null;
370
+ const opts = this.props.toastOptions ?? {};
371
+ view.duration = view.toast.type === "loading" ? Infinity : view.toast.duration ?? opts.duration ?? this.props.duration ?? 4e3;
372
+ view.remaining = view.duration;
373
+ view.started = 0;
374
+ if (!this.paused) this.runTimer(view);
375
+ }
376
+ runTimer(view) {
377
+ if (view.timer || view.removed || !Number.isFinite(view.remaining)) return;
378
+ view.started = Date.now();
379
+ view.timer = setTimeout(() => {
380
+ view.timer = null;
381
+ settle(view.toast.id, "auto");
382
+ }, view.remaining);
383
+ }
384
+ /** Timers stand still while a stack is spread out or held, and while the page is hidden. */
385
+ syncTimers() {
386
+ const paused = document.hidden || [...this.stacks.values()].some((s) => s.hovered || s.interacting) || this.hotkeyOpen;
387
+ if (paused === this.paused) return;
388
+ this.paused = paused;
389
+ for (const v of this.views.values()) {
390
+ if (paused) {
391
+ if (!v.timer) continue;
392
+ clearTimeout(v.timer);
393
+ v.timer = null;
394
+ v.remaining = Math.max(0, v.remaining - (Date.now() - v.started));
395
+ } else this.runTimer(v);
396
+ }
397
+ }
398
+ bindSwipe(view, stack) {
399
+ const li = view.li;
400
+ const allowed = new Set(this.props.swipeDirections ?? [stack.y, ...stack.x === "center" ? [] : [this.physicalX(stack.x)]]);
401
+ let start = null;
402
+ let axis = null;
403
+ let amount = 0;
404
+ const reset = () => {
405
+ start = null;
406
+ axis = null;
407
+ amount = 0;
408
+ li.removeAttribute("data-swiping");
409
+ li.style.setProperty("--_swipe-x", "0px");
410
+ li.style.setProperty("--_swipe-y", "0px");
411
+ };
412
+ li.addEventListener("pointerdown", (e) => {
413
+ if (view.removed || li.getAttribute("data-dismissible") === "false" || view.toast.type === "loading") return;
414
+ if (e.pointerType === "mouse" && e.button !== 0) return;
415
+ if (e.target instanceof Element && e.target.closest("button, a, input, select, textarea")) return;
416
+ start = { x: e.clientX, y: e.clientY, time: Date.now() };
417
+ li.setPointerCapture(e.pointerId);
418
+ });
419
+ li.addEventListener("pointermove", (e) => {
420
+ if (!start) return;
421
+ const dx = e.clientX - start.x;
422
+ const dy = e.clientY - start.y;
423
+ if (!axis) {
424
+ if (Math.abs(dx) < 2 && Math.abs(dy) < 2) return;
425
+ axis = Math.abs(dx) > Math.abs(dy) ? "x" : "y";
426
+ li.setAttribute("data-swiping", "");
427
+ }
428
+ const delta = axis === "x" ? dx : dy;
429
+ const dir = axis === "x" ? delta > 0 ? "right" : "left" : delta > 0 ? "bottom" : "top";
430
+ amount = allowed.has(dir) ? delta : delta / (1.5 + Math.abs(delta) / 20);
431
+ li.style.setProperty(axis === "x" ? "--_swipe-x" : "--_swipe-y", `${amount}px`);
432
+ });
433
+ const end = () => {
434
+ if (!start) return;
435
+ const elapsed = Math.max(1, Date.now() - start.time);
436
+ const dir = axis === "x" ? amount > 0 ? "right" : "left" : axis === "y" ? amount > 0 ? "bottom" : "top" : null;
437
+ if (dir && allowed.has(dir) && (Math.abs(amount) >= SWIPE_THRESHOLD || Math.abs(amount) / elapsed > VELOCITY_THRESHOLD)) {
438
+ const out = (axis === "x" ? li.offsetWidth : li.offsetHeight) * Math.sign(amount);
439
+ li.removeAttribute("data-swiping");
440
+ li.setAttribute("data-swiped", "");
441
+ li.style.setProperty(axis === "x" ? "--_swipe-x" : "--_swipe-y", `${out}px`);
442
+ start = null;
443
+ settle(view.toast.id, "dismiss");
444
+ return;
445
+ }
446
+ reset();
447
+ };
448
+ li.addEventListener("pointerup", end);
449
+ li.addEventListener("pointercancel", reset);
450
+ }
451
+ physicalX(x) {
452
+ const rtl = (this.props.dir === "rtl" || getComputedStyle(this.el.parentElement ?? document.documentElement).direction === "rtl") && this.props.dir !== "ltr";
453
+ return rtl ? x === "left" ? "right" : "left" : x;
454
+ }
455
+ };
456
+ function read(content) {
457
+ return typeof content === "function" ? content() : content;
458
+ }
459
+ function createToaster(props = {}) {
460
+ return new ToasterImpl(props);
461
+ }
462
+
463
+ export { createToaster, toast, toastDef };
@@ -2,7 +2,7 @@ import { a as VariantProps, V as VariantFn } from './variants-B4stUBnY.js';
2
2
  import { C as ComponentDef } from './define-D5u3F5Dj.js';
3
3
  import './t.js';
4
4
 
5
- declare const toggleGroupDef: ComponentDef<"toggle-group", "root" | "icon" | "item", "radius" | "radius-sm" | "item-radius" | "item-radius-sm">;
5
+ declare const toggleGroupDef: ComponentDef<"toggle-group", "root" | "icon" | "item", "radius-sm" | "radius" | "item-radius" | "item-radius-sm">;
6
6
  /** `default` = 32px; `sm` = 28px. */
7
7
  declare const toggleGroupVariants: VariantFn<{
8
8
  readonly size: readonly ["default", "sm"];
@@ -1,14 +1,14 @@
1
- import { variants } from './chunk-LZWZV2ZS.js';
2
- import { iconEl } from './chunk-G7IQLY3A.js';
3
1
  import { ownTeardown } from './chunk-A72NWYNP.js';
4
- import { nextUid, runMachine, normalizeProps, spreadProps } from './chunk-P4MTEMT7.js';
2
+ import { nextUid, runMachine, normalizeProps, spreadProps } from './chunk-GUIYFQ27.js';
3
+ import { iconEl } from './chunk-C3PXY2SW.js';
4
+ import { variants } from './chunk-LZWZV2ZS.js';
5
5
  import { h } from './chunk-Q6WTDVH6.js';
6
+ import { t } from './chunk-6QCILIT2.js';
6
7
  import { defineComponent } from './chunk-VMCR3S2A.js';
7
8
  import { css, defineStyles } from './chunk-XBEL4K33.js';
8
9
  import './chunk-2GQIZM5Z.js';
9
10
  import './chunk-BXMWQIBO.js';
10
11
  import './chunk-X66RJAIS.js';
11
- import { t } from './chunk-6QCILIT2.js';
12
12
  import * as toggleGroup from '@zag-js/toggle-group';
13
13
 
14
14
  var toggleGroupDef = defineComponent({
package/dist/tooltip.js CHANGED
@@ -1,13 +1,13 @@
1
1
  import { zagPositioning, splitPlacement } from './chunk-3Q32K4PE.js';
2
2
  import { ownTeardown } from './chunk-A72NWYNP.js';
3
- import { normalizeProps, nextUid, runMachine, spreadProps } from './chunk-P4MTEMT7.js';
3
+ import { normalizeProps, nextUid, runMachine, spreadProps } from './chunk-GUIYFQ27.js';
4
4
  import { h } from './chunk-Q6WTDVH6.js';
5
+ import { t } from './chunk-6QCILIT2.js';
5
6
  import { defineComponent } from './chunk-VMCR3S2A.js';
6
7
  import { defineStyles, css } from './chunk-XBEL4K33.js';
7
8
  import './chunk-2GQIZM5Z.js';
8
9
  import './chunk-BXMWQIBO.js';
9
10
  import './chunk-X66RJAIS.js';
10
- import { t } from './chunk-6QCILIT2.js';
11
11
  import * as tooltip from '@zag-js/tooltip';
12
12
 
13
13
  function tooltipController(opts = {}) {
@@ -0,0 +1,80 @@
1
+ import { C as ComponentDef } from './define-D5u3F5Dj.js';
2
+ import { Translator } from './i18n.js';
3
+ import './t.js';
4
+
5
+ declare const treemapDef: ComponentDef<"treemap", "legend" | "map" | "root" | "tip" | "group" | "crumbs" | "crumb" | "group-name" | "group-value" | "tile" | "tile-label" | "tile-value" | "legend-bar", "up" | "down" | "radius" | "tip-radius" | "tip-shadow" | "tip-z" | "tip-bg" | "tile-bg" | "tint-min" | "tint-max" | "hover-z">;
6
+ interface TreemapItem {
7
+ /** Stable across updates: a tile keeps its element by id. */
8
+ id: string;
9
+ label: string;
10
+ /** The tile's share of the area (default 1, equal tiles); zero or less leaves it out. A
11
+ * group's share is the sum of its items'. */
12
+ weight?: number;
13
+ /** What the tile is tinted by and shows; null while it is unknown. */
14
+ value?: number | null;
15
+ /** The tile's ink instead of its value's tone: a token's `var()` (`t.accent.var`) or a color. */
16
+ color?: string;
17
+ /** The group's items: the item becomes a group. */
18
+ children?: readonly TreemapItem[];
19
+ }
20
+ /** How a group's header sums up its items' values, or a function of them. */
21
+ type TreemapGroupValue = 'median' | 'mean' | 'sum' | 'none' | ((values: readonly number[], group: TreemapItem) => number | null);
22
+ interface TreemapProps {
23
+ items?: readonly TreemapItem[];
24
+ /** The size of a value whose tint is full. Default: the largest one on the map. */
25
+ domain?: number;
26
+ /** A value as the tiles, the headers, the readout and the legend write it. Default: signed,
27
+ * two decimals. */
28
+ format?: (value: number) => string;
29
+ /** A group header's figure (default the median of its items' values). */
30
+ groupValue?: TreemapGroupValue;
31
+ /** The readout beside a hovered or focused tile, or `false` for none. Default: its label,
32
+ * value and groups. */
33
+ tip?: ((item: TreemapItem, path: readonly TreemapItem[]) => string | Node) | false;
34
+ /** A tile's click, Enter or Space. `path` lists its groups, outermost first. */
35
+ onSelect?: (item: TreemapItem, path: readonly TreemapItem[]) => void;
36
+ /** The id of the tile drawn as selected. */
37
+ selected?: string | null;
38
+ /** Group headers zoom into their group, and a breadcrumb above the map leads back. */
39
+ drill?: boolean;
40
+ /** A zoom changed: `path` is the zoomed group's path (empty at the top). */
41
+ onDrill?: (path: readonly TreemapItem[]) => void;
42
+ /** The breadcrumb's first entry (default "All"). */
43
+ rootLabel?: string;
44
+ /** A scale under the map, from the negative to the positive domain. */
45
+ legend?: boolean;
46
+ /** Space between tiles, in pixels (default 3). */
47
+ gap?: number;
48
+ /** The map's accessible name. */
49
+ label?: string;
50
+ /** The translator of the treemap's own words. Default: the kit build's, else English. */
51
+ i18n?: Translator | null;
52
+ /** Extra class names (layout hooks). */
53
+ className?: string;
54
+ }
55
+ interface TreemapHandle {
56
+ readonly el: HTMLElement;
57
+ /** New items: lays the map out again. A zoom stays on its group while the group exists. */
58
+ setData(items: readonly TreemapItem[]): void;
59
+ /** New values by id: repaints the tints, figures and readout without a new layout. */
60
+ setValues(values: ReadonlyMap<string, number | null> | Readonly<Record<string, number | null>>): void;
61
+ setSelected(id: string | null): void;
62
+ /** Zoom into a group by id, or back to the top with null. */
63
+ drillTo(id: string | null): void;
64
+ destroy(): void;
65
+ }
66
+ interface TreemapRect {
67
+ x: number;
68
+ y: number;
69
+ w: number;
70
+ h: number;
71
+ }
72
+ /** Lay weighted items into `bounds` as tiles close to square (the squarified layout): areas
73
+ * follow the weights and fill the bounds exactly, heaviest first. Items weighing nothing are
74
+ * left out. */
75
+ declare function squarify<T extends {
76
+ weight: number;
77
+ }>(items: readonly T[], bounds: TreemapRect): Array<T & TreemapRect>;
78
+ declare function createTreemap(props?: TreemapProps): TreemapHandle;
79
+
80
+ export { type TreemapGroupValue, type TreemapHandle, type TreemapItem, type TreemapProps, type TreemapRect, createTreemap, squarify, treemapDef };