@hex-core/components 1.7.0 → 1.8.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 (94) hide show
  1. package/dist/_tsup-dts-rollup.d.ts +1561 -0
  2. package/dist/arc.d.ts +4 -0
  3. package/dist/arc.js +147 -0
  4. package/dist/arc.js.map +1 -0
  5. package/dist/audio-player.d.ts +2 -0
  6. package/dist/audio-player.js +119 -0
  7. package/dist/audio-player.js.map +1 -0
  8. package/dist/audio-waveform.d.ts +2 -0
  9. package/dist/audio-waveform.js +72 -0
  10. package/dist/audio-waveform.js.map +1 -0
  11. package/dist/canvas.d.ts +2 -0
  12. package/dist/canvas.js +73 -0
  13. package/dist/canvas.js.map +1 -0
  14. package/dist/chord.d.ts +4 -0
  15. package/dist/chord.js +230 -0
  16. package/dist/chord.js.map +1 -0
  17. package/dist/cloze.d.ts +3 -0
  18. package/dist/cloze.js +98 -0
  19. package/dist/cloze.js.map +1 -0
  20. package/dist/compare-table.d.ts +4 -0
  21. package/dist/compare-table.js +109 -0
  22. package/dist/compare-table.js.map +1 -0
  23. package/dist/deck.d.ts +3 -0
  24. package/dist/deck.js +231 -0
  25. package/dist/deck.js.map +1 -0
  26. package/dist/dendrogram.d.ts +3 -0
  27. package/dist/dendrogram.js +162 -0
  28. package/dist/dendrogram.js.map +1 -0
  29. package/dist/diagram.d.ts +2 -0
  30. package/dist/diagram.js +70 -0
  31. package/dist/diagram.js.map +1 -0
  32. package/dist/flashcard.d.ts +2 -0
  33. package/dist/flashcard.js +107 -0
  34. package/dist/flashcard.js.map +1 -0
  35. package/dist/flowchart.d.ts +4 -0
  36. package/dist/flowchart.js +275 -0
  37. package/dist/flowchart.js.map +1 -0
  38. package/dist/funnel.d.ts +3 -0
  39. package/dist/funnel.js +157 -0
  40. package/dist/funnel.js.map +1 -0
  41. package/dist/gantt.d.ts +3 -0
  42. package/dist/gantt.js +279 -0
  43. package/dist/gantt.js.map +1 -0
  44. package/dist/image-occlusion.d.ts +3 -0
  45. package/dist/image-occlusion.js +106 -0
  46. package/dist/image-occlusion.js.map +1 -0
  47. package/dist/index.d.ts +84 -0
  48. package/dist/index.js +3946 -2
  49. package/dist/index.js.map +1 -1
  50. package/dist/matrix.d.ts +3 -0
  51. package/dist/matrix.js +155 -0
  52. package/dist/matrix.js.map +1 -0
  53. package/dist/mind-map.d.ts +3 -0
  54. package/dist/mind-map.js +167 -0
  55. package/dist/mind-map.js.map +1 -0
  56. package/dist/org-chart.d.ts +3 -0
  57. package/dist/org-chart.js +215 -0
  58. package/dist/org-chart.js.map +1 -0
  59. package/dist/pyramid.d.ts +3 -0
  60. package/dist/pyramid.js +150 -0
  61. package/dist/pyramid.js.map +1 -0
  62. package/dist/quiz.d.ts +3 -0
  63. package/dist/quiz.js +128 -0
  64. package/dist/quiz.js.map +1 -0
  65. package/dist/sankey.d.ts +4 -0
  66. package/dist/sankey.js +190 -0
  67. package/dist/sankey.js.map +1 -0
  68. package/dist/schemas.d.ts +23 -0
  69. package/dist/schemas.js +2208 -1
  70. package/dist/schemas.js.map +1 -1
  71. package/dist/sequence.d.ts +4 -0
  72. package/dist/sequence.js +229 -0
  73. package/dist/sequence.js.map +1 -0
  74. package/dist/spaced-repetition.d.ts +3 -0
  75. package/dist/spaced-repetition.js +73 -0
  76. package/dist/spaced-repetition.js.map +1 -0
  77. package/dist/sunburst.d.ts +3 -0
  78. package/dist/sunburst.js +205 -0
  79. package/dist/sunburst.js.map +1 -0
  80. package/dist/terminal.d.ts +2 -0
  81. package/dist/terminal.js +153 -0
  82. package/dist/terminal.js.map +1 -0
  83. package/dist/time-axis.d.ts +3 -0
  84. package/dist/time-axis.js +233 -0
  85. package/dist/time-axis.js.map +1 -0
  86. package/dist/tool-call.js +6 -1
  87. package/dist/tool-call.js.map +1 -1
  88. package/dist/tree-map.d.ts +3 -0
  89. package/dist/tree-map.js +171 -0
  90. package/dist/tree-map.js.map +1 -0
  91. package/dist/venn.d.ts +3 -0
  92. package/dist/venn.js +196 -0
  93. package/dist/venn.js.map +1 -0
  94. package/package.json +47 -3
@@ -0,0 +1,171 @@
1
+ "use client";
2
+ import * as React from 'react';
3
+ import { clsx } from 'clsx';
4
+ import { twMerge } from 'tailwind-merge';
5
+ import { jsx, jsxs } from 'react/jsx-runtime';
6
+
7
+ // src/lib/chart-palette.ts
8
+ var CHART_PALETTE = [
9
+ "hsl(var(--chart-1, var(--primary)))",
10
+ "hsl(var(--chart-2, var(--primary)))",
11
+ "hsl(var(--chart-3, var(--primary)))",
12
+ "hsl(var(--chart-4, var(--primary)))",
13
+ "hsl(var(--chart-5, var(--primary)))",
14
+ "hsl(var(--chart-6, var(--primary)))"
15
+ ];
16
+ function pickChartHue(index) {
17
+ const safe = (index % CHART_PALETTE.length + CHART_PALETTE.length) % CHART_PALETTE.length;
18
+ return CHART_PALETTE[safe];
19
+ }
20
+ function cn(...inputs) {
21
+ return twMerge(clsx(inputs));
22
+ }
23
+ function TreeMap({
24
+ root,
25
+ width = 600,
26
+ height = 400,
27
+ padding = 2,
28
+ tile = "squarify",
29
+ colorBy = "depth",
30
+ onLeafClick,
31
+ className,
32
+ ...rest
33
+ }) {
34
+ const [d3h, setD3h] = React.useState(null);
35
+ React.useEffect(() => {
36
+ let cancelled = false;
37
+ void import('d3-hierarchy').then((mod) => {
38
+ if (!cancelled) setD3h(mod);
39
+ });
40
+ return () => {
41
+ cancelled = true;
42
+ };
43
+ }, []);
44
+ if (!d3h) {
45
+ return /* @__PURE__ */ jsx(
46
+ "div",
47
+ {
48
+ "data-hex-tree-map-loading": true,
49
+ "aria-busy": "true",
50
+ className: cn("inline-block bg-muted/20", className),
51
+ style: { width, height }
52
+ }
53
+ );
54
+ }
55
+ const leaves = layout(d3h, root, width, height, padding, tile);
56
+ const maxValue = leaves.reduce((m, l) => l.value > m ? l.value : m, 0) || 1;
57
+ const desc = `Tree map of ${leaves.length} leaf${leaves.length === 1 ? "" : "s"}, rooted at "${root.label}"`;
58
+ return /* @__PURE__ */ jsxs(
59
+ "svg",
60
+ {
61
+ ...rest,
62
+ "data-hex-tree-map": true,
63
+ "data-tile": tile,
64
+ role: "img",
65
+ width,
66
+ height,
67
+ viewBox: `0 0 ${width} ${height}`,
68
+ className: cn("block", className),
69
+ children: [
70
+ /* @__PURE__ */ jsx("title", { children: "Tree map" }),
71
+ /* @__PURE__ */ jsx("desc", { children: desc }),
72
+ leaves.map((l) => {
73
+ const w = l.x1 - l.x0;
74
+ const h = l.y1 - l.y0;
75
+ const fill = resolveFill(l, maxValue, colorBy);
76
+ return /* @__PURE__ */ jsxs(
77
+ "g",
78
+ {
79
+ "data-hex-tree-map-leaf": true,
80
+ "data-depth": l.depth,
81
+ transform: `translate(${l.x0},${l.y0})`,
82
+ style: onLeafClick ? { cursor: "pointer" } : void 0,
83
+ onClick: onLeafClick ? () => onLeafClick(l.node) : void 0,
84
+ children: [
85
+ /* @__PURE__ */ jsx(
86
+ "rect",
87
+ {
88
+ width: w,
89
+ height: h,
90
+ fill,
91
+ fillOpacity: 0.85,
92
+ stroke: "hsl(var(--background))",
93
+ strokeWidth: 1
94
+ }
95
+ ),
96
+ w > 40 && h > 16 ? /* @__PURE__ */ jsx(
97
+ "text",
98
+ {
99
+ x: 6,
100
+ y: 16,
101
+ fontSize: 12,
102
+ fontWeight: 500,
103
+ fill: "hsl(var(--background))",
104
+ style: {
105
+ pointerEvents: "none",
106
+ paintOrder: "stroke",
107
+ stroke: "hsl(var(--foreground) / 0.35)",
108
+ strokeWidth: 2
109
+ },
110
+ children: l.node.label
111
+ }
112
+ ) : null,
113
+ w > 60 && h > 32 ? /* @__PURE__ */ jsx(
114
+ "text",
115
+ {
116
+ x: 6,
117
+ y: 32,
118
+ fontSize: 11,
119
+ fill: "hsl(var(--background) / 0.85)",
120
+ style: {
121
+ pointerEvents: "none",
122
+ paintOrder: "stroke",
123
+ stroke: "hsl(var(--foreground) / 0.3)",
124
+ strokeWidth: 1.5
125
+ },
126
+ children: l.value.toLocaleString()
127
+ }
128
+ ) : null
129
+ ]
130
+ },
131
+ l.node.id
132
+ );
133
+ })
134
+ ]
135
+ }
136
+ );
137
+ }
138
+ function layout(d3h, root, width, height, padding, tile) {
139
+ const tileFn = tile === "binary" ? d3h.treemapBinary : tile === "slice-dice" ? d3h.treemapSliceDice : d3h.treemapSquarify;
140
+ const hierarchy = d3h.hierarchy(root).sum((d) => d.children && d.children.length > 0 ? 0 : d.value ?? 0).sort((a, b) => (b.value ?? 0) - (a.value ?? 0));
141
+ const layoutRoot = d3h.treemap().tile(tileFn).size([width, height]).padding(padding)(hierarchy);
142
+ return layoutRoot.leaves().map((leaf, leafIdx) => {
143
+ let cursor = leaf;
144
+ while (cursor && cursor.depth > 1) cursor = cursor.parent;
145
+ const ancestorIdx = cursor?.parent?.children?.indexOf(cursor) ?? leafIdx;
146
+ return {
147
+ node: leaf.data,
148
+ depth: leaf.depth,
149
+ x0: leaf.x0,
150
+ y0: leaf.y0,
151
+ x1: leaf.x1,
152
+ y1: leaf.y1,
153
+ value: leaf.value ?? 0,
154
+ leafIdx,
155
+ rootSiblingIdx: Math.max(0, ancestorIdx)
156
+ };
157
+ });
158
+ }
159
+ function resolveFill(leaf, maxValue, colorBy) {
160
+ if (typeof colorBy === "function") return colorBy(leaf.node, leaf.depth);
161
+ if (colorBy === "value") {
162
+ const t = Math.max(0.2, Math.min(1, leaf.value / maxValue));
163
+ return `hsl(var(--chart-1) / ${t.toFixed(2)})`;
164
+ }
165
+ const idx = leaf.depth > 1 ? leaf.rootSiblingIdx : leaf.leafIdx;
166
+ return pickChartHue(idx);
167
+ }
168
+
169
+ export { TreeMap };
170
+ //# sourceMappingURL=tree-map.js.map
171
+ //# sourceMappingURL=tree-map.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/lib/chart-palette.ts","../src/lib/utils.ts","../src/artifacts/tree-map/tree-map.tsx"],"names":[],"mappings":";;;;;;AAiBO,IAAM,aAAA,GAAgB;AAAA,EAC5B,qCAAA;AAAA,E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,CAAA,GAAI,IAAA,CAAK,iBAAiB,IAAA,CAAK,OAAA;AACxD,EAAA,OAAO,aAAa,GAAG,CAAA;AACxB","file":"tree-map.js","sourcesContent":["/**\n * Categorical chart palette for diagram primitives that encode categorical\n * data (sunburst, treemap, sankey, chord, funnel, pyramid, venn, matrix).\n * Cycled by an integer key — node index, leaf index, depth-1 ancestor, etc.\n *\n * The values reach into `--chart-1` through `--chart-6`, the dedicated\n * diagram-encoding tokens added in `@hex-core/tokens` 1.4. Each token has a\n * `var(--primary)` fallback so consumers on theme presets that haven't been\n * updated to ship `--chart-N` (or who run a custom theme without the chart\n * family) still see a coherent monochrome rendering instead of black SVG\n * fills.\n *\n * Why a chart palette and not the semantic tokens: `--primary`, `--accent`,\n * `--secondary`, and `--muted` collapse to a single hue family in the\n * default monochrome theme — adjacent segments of a chart end up\n * indistinguishable. Chart tokens are tuned for perceptual differentiation.\n */\nexport const CHART_PALETTE = [\n\t\"hsl(var(--chart-1, var(--primary)))\",\n\t\"hsl(var(--chart-2, var(--primary)))\",\n\t\"hsl(var(--chart-3, var(--primary)))\",\n\t\"hsl(var(--chart-4, var(--primary)))\",\n\t\"hsl(var(--chart-5, var(--primary)))\",\n\t\"hsl(var(--chart-6, var(--primary)))\",\n] as const;\n\n/**\n * Return the chart hue at a stable index. Cycles modulo `CHART_PALETTE.length`\n * so the caller doesn't have to range-check.\n *\n * @param index - Integer key (node index, leaf index, depth-1 ancestor index, …).\n * @returns A `hsl(var(...))` string suitable for SVG `fill` / `stroke`.\n */\nexport function pickChartHue(index: number): string {\n\tconst safe = ((index % CHART_PALETTE.length) + CHART_PALETTE.length) % CHART_PALETTE.length;\n\t// `safe` is provably 0..CHART_PALETTE.length-1 — the assertion documents that.\n\treturn CHART_PALETTE[safe] as string;\n}\n","import { type ClassValue, clsx } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\n/**\n * Merge class names with Tailwind CSS conflict resolution.\n * @param inputs - Class values (strings, arrays, objects) to merge\n * @returns A single merged class string with Tailwind conflicts resolved\n */\nexport function cn(...inputs: ClassValue[]) {\n\treturn twMerge(clsx(inputs));\n}\n","\"use client\";\n\nimport * as React from \"react\";\nimport { pickChartHue } from \"../../lib/chart-palette.js\";\nimport { cn } from \"../../lib/utils.js\";\n\n/**\n * Typed React TreeMap. Each leaf is rendered as a rectangle whose area is\n * proportional to its `value`. Internal node values are summed automatically;\n * d3-hierarchy's squarified treemap layout keeps rectangles close to square\n * for legibility.\n *\n * Heavy peer: requires `d3-hierarchy` (~3 KB gzip).\n *\n * @example\n * <TreeMap\n * root={{\n * id: \"root\",\n * label: \"Files\",\n * children: [\n * { id: \"src\", label: \"src\", value: 240 },\n * { id: \"node_modules\", label: \"node_modules\", value: 980 },\n * ],\n * }}\n * />\n */\nexport type TreeMapNode = {\n\tid: string;\n\tlabel: string;\n\tvalue?: number;\n\tchildren?: TreeMapNode[];\n};\n\nexport interface TreeMapProps extends Omit<React.SVGAttributes<SVGSVGElement>, \"children\"> {\n\t/** Root of the hierarchy. Leaves require a positive `value`. */\n\troot: TreeMapNode;\n\t/** Pixel width of the rendered SVG. Default 600. */\n\twidth?: number;\n\t/** Pixel height of the rendered SVG. Default 400. */\n\theight?: number;\n\t/** Inner padding between sibling rectangles, in pixels. Default 2. */\n\tpadding?: number;\n\t/** Tiling algorithm. \"squarify\" (default) keeps rectangles close to square. */\n\ttile?: \"squarify\" | \"binary\" | \"slice-dice\";\n\t/** Choose a fill color per leaf. \"depth\" cycles through theme tokens; \"value\" interpolates by value; or pass a function. */\n\tcolorBy?: \"depth\" | \"value\" | ((node: TreeMapNode, depth: number) => string);\n\t/** Fired when a leaf is clicked. */\n\tonLeafClick?: (node: TreeMapNode) => void;\n}\n\ninterface LaidOutLeaf {\n\tnode: TreeMapNode;\n\tdepth: number;\n\tx0: number;\n\ty0: number;\n\tx1: number;\n\ty1: number;\n\tvalue: number;\n\t/** Leaf index in pre-order traversal — used to cycle through CHART_PALETTE\n\t * so adjacent rectangles read as distinct categories. */\n\tleafIdx: number;\n\t/** Index of this leaf's depth-1 ancestor; multi-level trees use this so\n\t * descendants of the same branch share a hue family. */\n\trootSiblingIdx: number;\n}\n\ntype D3HierarchyMod = typeof import(\"d3-hierarchy\");\n\nfunction TreeMap({\n\troot,\n\twidth = 600,\n\theight = 400,\n\tpadding = 2,\n\ttile = \"squarify\",\n\tcolorBy = \"depth\",\n\tonLeafClick,\n\tclassName,\n\t...rest\n}: TreeMapProps) {\n\tconst [d3h, setD3h] = React.useState<D3HierarchyMod | null>(null);\n\n\tReact.useEffect(() => {\n\t\tlet cancelled = false;\n\t\tvoid import(\"d3-hierarchy\").then((mod) => {\n\t\t\tif (!cancelled) setD3h(mod);\n\t\t});\n\t\treturn () => {\n\t\t\tcancelled = true;\n\t\t};\n\t}, []);\n\n\tif (!d3h) {\n\t\treturn (\n\t\t\t<div\n\t\t\t\tdata-hex-tree-map-loading\n\t\t\t\taria-busy=\"true\"\n\t\t\t\tclassName={cn(\"inline-block bg-muted/20\", className)}\n\t\t\t\tstyle={{ width, height }}\n\t\t\t/>\n\t\t);\n\t}\n\n\tconst leaves = layout(d3h, root, width, height, padding, tile);\n\tconst maxValue = leaves.reduce((m, l) => (l.value > m ? l.value : m), 0) || 1;\n\tconst desc = `Tree map of ${leaves.length} leaf${leaves.length === 1 ? \"\" : \"s\"}, rooted at \"${root.label}\"`;\n\n\treturn (\n\t\t<svg\n\t\t\t{...rest}\n\t\t\tdata-hex-tree-map\n\t\t\tdata-tile={tile}\n\t\t\trole=\"img\"\n\t\t\twidth={width}\n\t\t\theight={height}\n\t\t\tviewBox={`0 0 ${width} ${height}`}\n\t\t\tclassName={cn(\"block\", className)}\n\t\t>\n\t\t\t<title>Tree map</title>\n\t\t\t<desc>{desc}</desc>\n\t\t\t{leaves.map((l) => {\n\t\t\t\tconst w = l.x1 - l.x0;\n\t\t\t\tconst h = l.y1 - l.y0;\n\t\t\t\tconst fill = resolveFill(l, maxValue, colorBy);\n\t\t\t\treturn (\n\t\t\t\t\t<g\n\t\t\t\t\t\tkey={l.node.id}\n\t\t\t\t\t\tdata-hex-tree-map-leaf\n\t\t\t\t\t\tdata-depth={l.depth}\n\t\t\t\t\t\ttransform={`translate(${l.x0},${l.y0})`}\n\t\t\t\t\t\tstyle={onLeafClick ? { cursor: \"pointer\" } : undefined}\n\t\t\t\t\t\tonClick={onLeafClick ? () => onLeafClick(l.node) : undefined}\n\t\t\t\t\t>\n\t\t\t\t\t\t<rect\n\t\t\t\t\t\t\twidth={w}\n\t\t\t\t\t\t\theight={h}\n\t\t\t\t\t\t\tfill={fill}\n\t\t\t\t\t\t\tfillOpacity={0.85}\n\t\t\t\t\t\t\tstroke=\"hsl(var(--background))\"\n\t\t\t\t\t\t\tstrokeWidth={1}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t{w > 40 && h > 16 ? (\n\t\t\t\t\t\t\t<text\n\t\t\t\t\t\t\t\tx={6}\n\t\t\t\t\t\t\t\ty={16}\n\t\t\t\t\t\t\t\tfontSize={12}\n\t\t\t\t\t\t\t\tfontWeight={500}\n\t\t\t\t\t\t\t\tfill=\"hsl(var(--background))\"\n\t\t\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\t\t\tpointerEvents: \"none\",\n\t\t\t\t\t\t\t\t\tpaintOrder: \"stroke\",\n\t\t\t\t\t\t\t\t\tstroke: \"hsl(var(--foreground) / 0.35)\",\n\t\t\t\t\t\t\t\t\tstrokeWidth: 2,\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{l.node.label}\n\t\t\t\t\t\t\t</text>\n\t\t\t\t\t\t) : null}\n\t\t\t\t\t\t{w > 60 && h > 32 ? (\n\t\t\t\t\t\t\t<text\n\t\t\t\t\t\t\t\tx={6}\n\t\t\t\t\t\t\t\ty={32}\n\t\t\t\t\t\t\t\tfontSize={11}\n\t\t\t\t\t\t\t\tfill=\"hsl(var(--background) / 0.85)\"\n\t\t\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\t\t\tpointerEvents: \"none\",\n\t\t\t\t\t\t\t\t\tpaintOrder: \"stroke\",\n\t\t\t\t\t\t\t\t\tstroke: \"hsl(var(--foreground) / 0.3)\",\n\t\t\t\t\t\t\t\t\tstrokeWidth: 1.5,\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{l.value.toLocaleString()}\n\t\t\t\t\t\t\t</text>\n\t\t\t\t\t\t) : null}\n\t\t\t\t\t</g>\n\t\t\t\t);\n\t\t\t})}\n\t\t</svg>\n\t);\n}\n\nfunction layout(\n\td3h: D3HierarchyMod,\n\troot: TreeMapNode,\n\twidth: number,\n\theight: number,\n\tpadding: number,\n\ttile: \"squarify\" | \"binary\" | \"slice-dice\",\n): LaidOutLeaf[] {\n\tconst tileFn = tile === \"binary\" ? d3h.treemapBinary : tile === \"slice-dice\" ? d3h.treemapSliceDice : d3h.treemapSquarify;\n\tconst hierarchy = d3h\n\t\t.hierarchy<TreeMapNode>(root)\n\t\t.sum((d) => (d.children && d.children.length > 0 ? 0 : d.value ?? 0))\n\t\t.sort((a, b) => (b.value ?? 0) - (a.value ?? 0));\n\t// treemap(hierarchy) returns HierarchyRectangularNode<T> with typed\n\t// x0/x1/y0/y1 (pixel coords).\n\tconst layoutRoot = d3h\n\t\t.treemap<TreeMapNode>()\n\t\t.tile(tileFn)\n\t\t.size([width, height])\n\t\t.padding(padding)(hierarchy);\n\treturn layoutRoot.leaves().map((leaf, leafIdx) => {\n\t\t// Walk up to depth-1 ancestor; descendants of the same top-level\n\t\t// branch share a hue family for tree visual cohesion.\n\t\tlet cursor: typeof leaf | null = leaf;\n\t\twhile (cursor && cursor.depth > 1) cursor = cursor.parent;\n\t\tconst ancestorIdx = cursor?.parent?.children?.indexOf(cursor) ?? leafIdx;\n\t\treturn {\n\t\t\tnode: leaf.data,\n\t\t\tdepth: leaf.depth,\n\t\t\tx0: leaf.x0,\n\t\t\ty0: leaf.y0,\n\t\t\tx1: leaf.x1,\n\t\t\ty1: leaf.y1,\n\t\t\tvalue: leaf.value ?? 0,\n\t\t\tleafIdx,\n\t\t\trootSiblingIdx: Math.max(0, ancestorIdx),\n\t\t};\n\t});\n}\n\nfunction resolveFill(\n\tleaf: LaidOutLeaf,\n\tmaxValue: number,\n\tcolorBy: TreeMapProps[\"colorBy\"],\n): string {\n\tif (typeof colorBy === \"function\") return colorBy(leaf.node, leaf.depth);\n\tif (colorBy === \"value\") {\n\t\tconst t = Math.max(0.2, Math.min(1, leaf.value / maxValue));\n\t\treturn `hsl(var(--chart-1) / ${t.toFixed(2)})`;\n\t}\n\t// \"depth\" cycles through CHART_PALETTE by ancestor for nested trees,\n\t// or by leaf index for single-level trees (where every leaf is at the\n\t// same depth and would otherwise collapse to one color).\n\tconst idx = leaf.depth > 1 ? leaf.rootSiblingIdx : leaf.leafIdx;\n\treturn pickChartHue(idx);\n}\n\nexport { TreeMap };\n"]}
package/dist/venn.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ export { VennSet_alias_1 as VennSet } from './_tsup-dts-rollup.js';
2
+ export { VennProps_alias_1 as VennProps } from './_tsup-dts-rollup.js';
3
+ export { Venn_alias_1 as Venn } from './_tsup-dts-rollup.js';
package/dist/venn.js ADDED
@@ -0,0 +1,196 @@
1
+ "use client";
2
+ import * as React from 'react';
3
+ import { clsx } from 'clsx';
4
+ import { twMerge } from 'tailwind-merge';
5
+ import { jsxs, jsx } from 'react/jsx-runtime';
6
+
7
+ // src/lib/chart-palette.ts
8
+ var CHART_PALETTE = [
9
+ "hsl(var(--chart-1, var(--primary)))",
10
+ "hsl(var(--chart-2, var(--primary)))",
11
+ "hsl(var(--chart-3, var(--primary)))",
12
+ "hsl(var(--chart-4, var(--primary)))",
13
+ "hsl(var(--chart-5, var(--primary)))",
14
+ "hsl(var(--chart-6, var(--primary)))"
15
+ ];
16
+ function pickChartHue(index) {
17
+ const safe = (index % CHART_PALETTE.length + CHART_PALETTE.length) % CHART_PALETTE.length;
18
+ return CHART_PALETTE[safe];
19
+ }
20
+ function cn(...inputs) {
21
+ return twMerge(clsx(inputs));
22
+ }
23
+ function Venn({
24
+ sets,
25
+ size = 360,
26
+ onSetClick,
27
+ className,
28
+ ...rest
29
+ }) {
30
+ const circles = React.useMemo(() => layout(sets, size), [sets, size]);
31
+ const desc = `Venn diagram with ${sets.length} set${sets.length === 1 ? "" : "s"}: ${sets.map((s) => s.label).join(", ") || "(empty)"}`;
32
+ const warnedRef = React.useRef(false);
33
+ const nodeEnv = globalThis.process?.env?.NODE_ENV;
34
+ if (nodeEnv !== "production" && !warnedRef.current && (sets.length === 0 || sets.length > 3)) {
35
+ warnedRef.current = true;
36
+ console.warn(
37
+ `[hex-core/Venn] Got ${sets.length} sets \u2014 Venn supports 2 or 3. Use TreeMap or Matrix for higher-arity overlaps.`
38
+ );
39
+ }
40
+ if (sets.length === 0 || sets.length > 3) {
41
+ return /* @__PURE__ */ jsxs(
42
+ "svg",
43
+ {
44
+ ...rest,
45
+ "data-hex-venn": true,
46
+ "data-set-count": sets.length,
47
+ role: "img",
48
+ width: size,
49
+ height: size,
50
+ viewBox: `0 0 ${size} ${size}`,
51
+ className: cn("block", className),
52
+ children: [
53
+ /* @__PURE__ */ jsx("title", { children: "Venn diagram" }),
54
+ /* @__PURE__ */ jsx("desc", { children: desc }),
55
+ /* @__PURE__ */ jsx(
56
+ "text",
57
+ {
58
+ x: size / 2,
59
+ y: size / 2,
60
+ textAnchor: "middle",
61
+ dy: "0.35em",
62
+ fontSize: 12,
63
+ fill: "hsl(var(--muted-foreground))",
64
+ children: sets.length === 0 ? "No sets" : `Venn supports 2\u20133 sets (got ${sets.length})`
65
+ }
66
+ )
67
+ ]
68
+ }
69
+ );
70
+ }
71
+ return /* @__PURE__ */ jsxs(
72
+ "svg",
73
+ {
74
+ ...rest,
75
+ "data-hex-venn": true,
76
+ "data-set-count": sets.length,
77
+ role: "img",
78
+ width: size,
79
+ height: size,
80
+ viewBox: `0 0 ${size} ${size}`,
81
+ className: cn("block", className),
82
+ children: [
83
+ /* @__PURE__ */ jsx("title", { children: "Venn diagram" }),
84
+ /* @__PURE__ */ jsx("desc", { children: desc }),
85
+ /* @__PURE__ */ jsx("g", { "data-hex-venn-sets": true, children: circles.map((c) => {
86
+ const interactive = Boolean(onSetClick);
87
+ const handleActivate = () => onSetClick?.(c.set);
88
+ return /* @__PURE__ */ jsx(
89
+ "g",
90
+ {
91
+ "data-hex-venn-set": true,
92
+ "data-depth": c.depth,
93
+ role: interactive ? "button" : void 0,
94
+ tabIndex: interactive ? 0 : void 0,
95
+ "aria-label": interactive ? c.set.label : void 0,
96
+ style: interactive ? { cursor: "pointer" } : void 0,
97
+ onClick: interactive ? handleActivate : void 0,
98
+ onKeyDown: interactive ? (e) => activateOnKey(e, handleActivate) : void 0,
99
+ children: /* @__PURE__ */ jsx(
100
+ "circle",
101
+ {
102
+ cx: c.cx,
103
+ cy: c.cy,
104
+ r: c.r,
105
+ fill: pickChartHue(c.depth),
106
+ fillOpacity: 0.45,
107
+ stroke: "hsl(var(--background))",
108
+ strokeWidth: 1.5
109
+ }
110
+ )
111
+ },
112
+ c.set.id
113
+ );
114
+ }) }),
115
+ /* @__PURE__ */ jsx("g", { "data-hex-venn-labels": true, children: circles.map((c) => /* @__PURE__ */ jsx(
116
+ "text",
117
+ {
118
+ "data-hex-venn-label": true,
119
+ x: c.labelX,
120
+ y: c.labelY,
121
+ textAnchor: "middle",
122
+ dy: "0.35em",
123
+ fontSize: 12,
124
+ fontWeight: 600,
125
+ fill: "hsl(var(--foreground))",
126
+ style: { paintOrder: "stroke", pointerEvents: "none" },
127
+ stroke: "hsl(var(--background))",
128
+ strokeWidth: 3,
129
+ strokeLinejoin: "round",
130
+ children: `${c.set.label}${c.set.value != null ? ` (${c.set.value})` : ""}`
131
+ },
132
+ `label-${c.set.id}`
133
+ )) })
134
+ ]
135
+ }
136
+ );
137
+ }
138
+ function layout(sets, size) {
139
+ if (sets.length === 0 || sets.length > 3) return [];
140
+ const cx = size / 2;
141
+ const cy = size / 2;
142
+ const r = size * 0.22;
143
+ const sep = size * 0.12;
144
+ if (sets.length === 1) {
145
+ return [{ set: sets[0], cx, cy, r, labelX: cx, labelY: cy - r - 8, depth: 0 }];
146
+ }
147
+ if (sets.length === 2) {
148
+ return sets.map((s, i) => {
149
+ const dx = i === 0 ? -sep : sep;
150
+ return {
151
+ set: s,
152
+ cx: cx + dx,
153
+ cy,
154
+ r,
155
+ labelX: cx + dx + (i === 0 ? -r * 0.6 : r * 0.6),
156
+ labelY: cy - r - 8,
157
+ depth: i
158
+ };
159
+ });
160
+ }
161
+ const verticalOffset = sep * 0.866;
162
+ const triangle = [
163
+ { dx: -sep, dy: verticalOffset },
164
+ // bottom-left
165
+ { dx: sep, dy: verticalOffset },
166
+ // bottom-right
167
+ { dx: 0, dy: -verticalOffset }
168
+ // top
169
+ ];
170
+ const LABEL_PUSH = 1.7;
171
+ const TOP_LABEL_NUDGE = -8;
172
+ const BOTTOM_LABEL_NUDGE = 16;
173
+ return sets.map((s, i) => {
174
+ const { dx, dy } = triangle[i] ?? triangle[0];
175
+ const isTop = i === 2;
176
+ return {
177
+ set: s,
178
+ cx: cx + dx,
179
+ cy: cy + dy,
180
+ r,
181
+ labelX: cx + dx * LABEL_PUSH,
182
+ labelY: cy + dy * LABEL_PUSH + (isTop ? TOP_LABEL_NUDGE : BOTTOM_LABEL_NUDGE),
183
+ depth: i
184
+ };
185
+ });
186
+ }
187
+ function activateOnKey(e, fn) {
188
+ if (e.key === "Enter" || e.key === " ") {
189
+ e.preventDefault();
190
+ fn();
191
+ }
192
+ }
193
+
194
+ export { Venn };
195
+ //# sourceMappingURL=venn.js.map
196
+ //# sourceMappingURL=venn.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/lib/chart-palette.ts","../src/lib/utils.ts","../src/artifacts/venn/venn.tsx"],"names":[],"mappings":";;;;;;AAiBO,IAAM,aAAA,GAAgB;AAAA,EAC5B,qCAAA;AAA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A,EAAe;AAAA;AAAA,IAC9B,EAAE,EAAA,EAAI,CAAA,EAAG,EAAA,EAAI,CAAC,cAAA;AAAe;AAAA,GAC9B;AACA,EAAA,MAAM,UAAA,GAAa,GAAA;AACnB,EAAA,MAAM,eAAA,GAAkB,EAAA;AACxB,EAAA,MAAM,kBAAA,GAAqB,EAAA;AAC3B,EAAA,OAAO,IAAA,CAAK,GAAA,CAAI,CAAC,CAAA,EAAG,CAAA,KAAM;AACzB,IAAA,MAAM,EAAE,IAAI,EAAA,EAAG,GAAI,SAAS,CAAC,CAAA,IAAK,SAAS,CAAC,CAAA;AAC5C,IAAA,MAAM,QAAQ,CAAA,KAAM,CAAA;AACpB,IAAA,OAAO;AAAA,MACN,GAAA,EAAK,CAAA;AAAA,MACL,IAAI,EAAA,GAAK,EAAA;AAAA,MACT,IAAI,EAAA,GAAK,EAAA;AAAA,MACT,CAAA;AAAA,MACA,MAAA,EAAQ,KAAK,EAAA,GAAK,UAAA;AAAA,MAClB,MAAA,EAAQ,EAAA,GAAK,EAAA,GAAK,UAAA,IAAc,QAAQ,eAAA,GAAkB,kBAAA,CAAA;AAAA,MAC1D,KAAA,EAAO;AAAA,KACR;AAAA,EACD,CAAC,CAAA;AACF;AAEA,SAAS,aAAA,CAAc,GAAwB,EAAA,EAAsB;AACpE,EAAA,IAAI,CAAA,CAAE,GAAA,KAAQ,OAAA,IAAW,CAAA,CAAE,QAAQ,GAAA,EAAK;AACvC,IAAA,CAAA,CAAE,cAAA,EAAe;AACjB,IAAA,EAAA,EAAG;AAAA,EACJ;AACD","file":"venn.js","sourcesContent":["/**\n * Categorical chart palette for diagram primitives that encode categorical\n * data (sunburst, treemap, sankey, chord, funnel, pyramid, venn, matrix).\n * Cycled by an integer key — node index, leaf index, depth-1 ancestor, etc.\n *\n * The values reach into `--chart-1` through `--chart-6`, the dedicated\n * diagram-encoding tokens added in `@hex-core/tokens` 1.4. Each token has a\n * `var(--primary)` fallback so consumers on theme presets that haven't been\n * updated to ship `--chart-N` (or who run a custom theme without the chart\n * family) still see a coherent monochrome rendering instead of black SVG\n * fills.\n *\n * Why a chart palette and not the semantic tokens: `--primary`, `--accent`,\n * `--secondary`, and `--muted` collapse to a single hue family in the\n * default monochrome theme — adjacent segments of a chart end up\n * indistinguishable. Chart tokens are tuned for perceptual differentiation.\n */\nexport const CHART_PALETTE = [\n\t\"hsl(var(--chart-1, var(--primary)))\",\n\t\"hsl(var(--chart-2, var(--primary)))\",\n\t\"hsl(var(--chart-3, var(--primary)))\",\n\t\"hsl(var(--chart-4, var(--primary)))\",\n\t\"hsl(var(--chart-5, var(--primary)))\",\n\t\"hsl(var(--chart-6, var(--primary)))\",\n] as const;\n\n/**\n * Return the chart hue at a stable index. Cycles modulo `CHART_PALETTE.length`\n * so the caller doesn't have to range-check.\n *\n * @param index - Integer key (node index, leaf index, depth-1 ancestor index, …).\n * @returns A `hsl(var(...))` string suitable for SVG `fill` / `stroke`.\n */\nexport function pickChartHue(index: number): string {\n\tconst safe = ((index % CHART_PALETTE.length) + CHART_PALETTE.length) % CHART_PALETTE.length;\n\t// `safe` is provably 0..CHART_PALETTE.length-1 — the assertion documents that.\n\treturn CHART_PALETTE[safe] as string;\n}\n","import { type ClassValue, clsx } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\n/**\n * Merge class names with Tailwind CSS conflict resolution.\n * @param inputs - Class values (strings, arrays, objects) to merge\n * @returns A single merged class string with Tailwind conflicts resolved\n */\nexport function cn(...inputs: ClassValue[]) {\n\treturn twMerge(clsx(inputs));\n}\n","\"use client\";\n\nimport * as React from \"react\";\nimport { pickChartHue } from \"../../lib/chart-palette.js\";\nimport { cn } from \"../../lib/utils.js\";\n\n/**\n * Set-overlap (Venn) diagram for 2 or 3 sets. Pure SVG; no heavy peer\n * dependency. Set positions and radii are fixed at sensible defaults\n * — Venn is for showing CATEGORICAL overlap (Linux ∩ Mac, paid ∩ active),\n * not for showing the EXACT cardinality of intersections (that's\n * Euler-diagram territory and requires a real layout solver).\n *\n * @example\n * <Venn\n * sets={[\n * { id: \"linux\", label: \"Linux\" },\n * { id: \"mac\", label: \"Mac\" },\n * { id: \"windows\", label: \"Windows\" },\n * ]}\n * />\n */\nexport type VennSet = {\n\tid: string;\n\tlabel: string;\n\tvalue?: number;\n};\n\nexport interface VennProps extends Omit<React.SVGAttributes<SVGSVGElement>, \"children\"> {\n\t/** 2 or 3 sets. More than 3 isn't visually tractable in a strict Venn. */\n\tsets: VennSet[];\n\t/** Pixel size of the rendered SVG (it's square). Default 360. */\n\tsize?: number;\n\t/** Fired when a set is clicked. */\n\tonSetClick?: (set: VennSet) => void;\n}\n\ninterface LaidOutCircle {\n\tset: VennSet;\n\tcx: number;\n\tcy: number;\n\tr: number;\n\tlabelX: number;\n\tlabelY: number;\n\tdepth: number;\n}\n\n// Venn supports 2 or 3 sets only — picks the first 2-3 categorical hues\n// from the shared chart palette via `pickChartHue` (which falls back to\n// `--primary` if a consumer's theme is missing the chart family).\n\nfunction Venn({\n\tsets,\n\tsize = 360,\n\tonSetClick,\n\tclassName,\n\t...rest\n}: VennProps) {\n\tconst circles = React.useMemo(() => layout(sets, size), [sets, size]);\n\tconst desc = `Venn diagram with ${sets.length} set${sets.length === 1 ? \"\" : \"s\"}: ${sets.map((s) => s.label).join(\", \") || \"(empty)\"}`;\n\n\t// Surface unsupported set counts in dev so an LLM-generated artifact with\n\t// the wrong shape isn't silently degraded to the fallback message. The\n\t// ref guard fires once per mount, not per render. Reads NODE_ENV via\n\t// globalThis to avoid pulling `@types/node` into the components package.\n\tconst warnedRef = React.useRef(false);\n\tconst nodeEnv = (globalThis as { process?: { env?: { NODE_ENV?: string } } }).process?.env?.NODE_ENV;\n\tif (\n\t\tnodeEnv !== \"production\" &&\n\t\t!warnedRef.current &&\n\t\t(sets.length === 0 || sets.length > 3)\n\t) {\n\t\twarnedRef.current = true;\n\t\t// eslint-disable-next-line no-console\n\t\tconsole.warn(\n\t\t\t`[hex-core/Venn] Got ${sets.length} sets — Venn supports 2 or 3. Use TreeMap or Matrix for higher-arity overlaps.`,\n\t\t);\n\t}\n\n\tif (sets.length === 0 || sets.length > 3) {\n\t\treturn (\n\t\t\t<svg\n\t\t\t\t{...rest}\n\t\t\t\tdata-hex-venn\n\t\t\t\tdata-set-count={sets.length}\n\t\t\t\trole=\"img\"\n\t\t\t\twidth={size}\n\t\t\t\theight={size}\n\t\t\t\tviewBox={`0 0 ${size} ${size}`}\n\t\t\t\tclassName={cn(\"block\", className)}\n\t\t\t>\n\t\t\t\t<title>Venn diagram</title>\n\t\t\t\t<desc>{desc}</desc>\n\t\t\t\t<text\n\t\t\t\t\tx={size / 2}\n\t\t\t\t\ty={size / 2}\n\t\t\t\t\ttextAnchor=\"middle\"\n\t\t\t\t\tdy=\"0.35em\"\n\t\t\t\t\tfontSize={12}\n\t\t\t\t\tfill=\"hsl(var(--muted-foreground))\"\n\t\t\t\t>\n\t\t\t\t\t{sets.length === 0 ? \"No sets\" : `Venn supports 2–3 sets (got ${sets.length})`}\n\t\t\t\t</text>\n\t\t\t</svg>\n\t\t);\n\t}\n\n\treturn (\n\t\t<svg\n\t\t\t{...rest}\n\t\t\tdata-hex-venn\n\t\t\tdata-set-count={sets.length}\n\t\t\trole=\"img\"\n\t\t\twidth={size}\n\t\t\theight={size}\n\t\t\tviewBox={`0 0 ${size} ${size}`}\n\t\t\tclassName={cn(\"block\", className)}\n\t\t>\n\t\t\t<title>Venn diagram</title>\n\t\t\t<desc>{desc}</desc>\n\t\t\t<g data-hex-venn-sets>\n\t\t\t\t{circles.map((c) => {\n\t\t\t\t\tconst interactive = Boolean(onSetClick);\n\t\t\t\t\tconst handleActivate = () => onSetClick?.(c.set);\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<g\n\t\t\t\t\t\t\tkey={c.set.id}\n\t\t\t\t\t\t\tdata-hex-venn-set\n\t\t\t\t\t\t\tdata-depth={c.depth}\n\t\t\t\t\t\t\trole={interactive ? \"button\" : undefined}\n\t\t\t\t\t\t\ttabIndex={interactive ? 0 : undefined}\n\t\t\t\t\t\t\taria-label={interactive ? c.set.label : undefined}\n\t\t\t\t\t\t\tstyle={interactive ? { cursor: \"pointer\" } : undefined}\n\t\t\t\t\t\t\tonClick={interactive ? handleActivate : undefined}\n\t\t\t\t\t\t\tonKeyDown={interactive ? (e) => activateOnKey(e, handleActivate) : undefined}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<circle\n\t\t\t\t\t\t\t\tcx={c.cx}\n\t\t\t\t\t\t\t\tcy={c.cy}\n\t\t\t\t\t\t\t\tr={c.r}\n\t\t\t\t\t\t\t\tfill={pickChartHue(c.depth)}\n\t\t\t\t\t\t\t\tfillOpacity={0.45}\n\t\t\t\t\t\t\t\tstroke=\"hsl(var(--background))\"\n\t\t\t\t\t\t\t\tstrokeWidth={1.5}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</g>\n\t\t\t\t\t);\n\t\t\t\t})}\n\t\t\t</g>\n\t\t\t<g data-hex-venn-labels>\n\t\t\t\t{circles.map((c) => (\n\t\t\t\t\t<text\n\t\t\t\t\t\tkey={`label-${c.set.id}`}\n\t\t\t\t\t\tdata-hex-venn-label\n\t\t\t\t\t\tx={c.labelX}\n\t\t\t\t\t\ty={c.labelY}\n\t\t\t\t\t\ttextAnchor=\"middle\"\n\t\t\t\t\t\tdy=\"0.35em\"\n\t\t\t\t\t\tfontSize={12}\n\t\t\t\t\t\tfontWeight={600}\n\t\t\t\t\t\tfill=\"hsl(var(--foreground))\"\n\t\t\t\t\t\tstyle={{ paintOrder: \"stroke\", pointerEvents: \"none\" }}\n\t\t\t\t\t\tstroke=\"hsl(var(--background))\"\n\t\t\t\t\t\tstrokeWidth={3}\n\t\t\t\t\t\tstrokeLinejoin=\"round\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{`${c.set.label}${c.set.value != null ? ` (${c.set.value})` : \"\"}`}\n\t\t\t\t\t</text>\n\t\t\t\t))}\n\t\t\t</g>\n\t\t</svg>\n\t);\n}\n\nfunction layout(sets: VennSet[], size: number): LaidOutCircle[] {\n\tif (sets.length === 0 || sets.length > 3) return [];\n\tconst cx = size / 2;\n\tconst cy = size / 2;\n\tconst r = size * 0.22; // circle radius\n\tconst sep = size * 0.12; // half-distance between centers\n\n\tif (sets.length === 1) {\n\t\treturn [{ set: sets[0], cx, cy, r, labelX: cx, labelY: cy - r - 8, depth: 0 }];\n\t}\n\n\tif (sets.length === 2) {\n\t\treturn sets.map((s, i) => {\n\t\t\tconst dx = i === 0 ? -sep : sep;\n\t\t\treturn {\n\t\t\t\tset: s,\n\t\t\t\tcx: cx + dx,\n\t\t\t\tcy,\n\t\t\t\tr,\n\t\t\t\tlabelX: cx + dx + (i === 0 ? -r * 0.6 : r * 0.6),\n\t\t\t\tlabelY: cy - r - 8,\n\t\t\t\tdepth: i,\n\t\t\t};\n\t\t});\n\t}\n\n\t// 3 sets — equilateral triangle of centers (60° apart). Bottom-left,\n\t// bottom-right, top. Label position pushes outward along the radial\n\t// direction from the centroid so labels don't overlap the circles.\n\tconst verticalOffset = sep * 0.866; // sin(60°)\n\tconst triangle: Array<{ dx: number; dy: number }> = [\n\t\t{ dx: -sep, dy: verticalOffset }, // bottom-left\n\t\t{ dx: sep, dy: verticalOffset }, // bottom-right\n\t\t{ dx: 0, dy: -verticalOffset }, // top\n\t];\n\tconst LABEL_PUSH = 1.7;\n\tconst TOP_LABEL_NUDGE = -8; // top label sits above its circle; pull up\n\tconst BOTTOM_LABEL_NUDGE = 16; // bottom labels sit below; push down\n\treturn sets.map((s, i) => {\n\t\tconst { dx, dy } = triangle[i] ?? triangle[0];\n\t\tconst isTop = i === 2;\n\t\treturn {\n\t\t\tset: s,\n\t\t\tcx: cx + dx,\n\t\t\tcy: cy + dy,\n\t\t\tr,\n\t\t\tlabelX: cx + dx * LABEL_PUSH,\n\t\t\tlabelY: cy + dy * LABEL_PUSH + (isTop ? TOP_LABEL_NUDGE : BOTTOM_LABEL_NUDGE),\n\t\t\tdepth: i,\n\t\t};\n\t});\n}\n\nfunction activateOnKey(e: React.KeyboardEvent, fn: () => void): void {\n\tif (e.key === \"Enter\" || e.key === \" \") {\n\t\te.preventDefault();\n\t\tfn();\n\t}\n}\n\nexport { Venn };\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hex-core/components",
3
- "version": "1.7.0",
3
+ "version": "1.8.0",
4
4
  "description": "AI-native React components for Hex UI — Radix UI + Tailwind CSS with machine-readable schemas. RSC-aware per-component bundles + tree-shakable.",
5
5
  "keywords": [
6
6
  "react",
@@ -88,34 +88,54 @@
88
88
  "devDependencies": {
89
89
  "@microsoft/api-extractor": "^7.58.7",
90
90
  "@tanstack/react-table": "^8.21.3",
91
+ "@types/d3-chord": "^3.0.6",
92
+ "@types/d3-hierarchy": "^3.1.7",
93
+ "@types/d3-sankey": "^0.12.4",
94
+ "@types/d3-shape": "^3.1.6",
91
95
  "@types/react": "^19.0.0",
92
96
  "@types/react-dom": "^19.0.0",
97
+ "@xterm/xterm": "^5.5.0",
93
98
  "cmdk": "^1.1.1",
99
+ "d3-chord": "^3.0.1",
100
+ "d3-hierarchy": "^3.1.2",
101
+ "d3-sankey": "^0.12.3",
102
+ "d3-shape": "^3.2.0",
94
103
  "date-fns": "^4.1.0",
95
104
  "fast-glob": "^3.3.3",
96
105
  "input-otp": "^1.4.2",
106
+ "mermaid": "^11.0.0",
97
107
  "react-day-picker": "^9.14.0",
98
108
  "react-hook-form": "^7.74.0",
99
109
  "react-resizable-panels": "^4.10.0",
110
+ "reactflow": "^11.11.0",
100
111
  "sonner": "^2.0.7",
101
112
  "tsup": "^8.3.0",
102
113
  "typescript": "^6.0.3",
103
114
  "vaul": "^1.1.2",
104
- "@hex-core/registry": "^0.3.3"
115
+ "wavesurfer.js": "^7.8.0",
116
+ "@hex-core/registry": "^0.3.4"
105
117
  },
106
118
  "peerDependencies": {
107
119
  "@hex-core/registry": "*",
108
120
  "@tanstack/react-table": "^8.0.0 || ^9.0.0",
121
+ "@xterm/xterm": "^5.5.0",
109
122
  "cmdk": "^1.0.0",
123
+ "d3-chord": "^3.0.1",
124
+ "d3-hierarchy": "^3.1.2",
125
+ "d3-sankey": "^0.12.3",
126
+ "d3-shape": "^3.2.0",
110
127
  "date-fns": "^3.0.0 || ^4.0.0",
111
128
  "input-otp": "^1.0.0",
129
+ "mermaid": "^11.0.0",
112
130
  "react": "^18.0.0 || ^19.0.0",
113
131
  "react-day-picker": "^8.0.0 || ^9.0.0",
114
132
  "react-dom": "^18.0.0 || ^19.0.0",
115
133
  "react-hook-form": "^7.0.0",
116
134
  "react-resizable-panels": "^2.0.0 || ^3.0.0 || ^4.0.0",
135
+ "reactflow": "^11.11.0",
117
136
  "sonner": "^1.0.0 || ^2.0.0",
118
- "vaul": "^1.0.0"
137
+ "vaul": "^1.0.0",
138
+ "wavesurfer.js": "^7.8.0"
119
139
  },
120
140
  "peerDependenciesMeta": {
121
141
  "@hex-core/registry": {
@@ -124,15 +144,33 @@
124
144
  "@tanstack/react-table": {
125
145
  "optional": true
126
146
  },
147
+ "@xterm/xterm": {
148
+ "optional": true
149
+ },
127
150
  "cmdk": {
128
151
  "optional": true
129
152
  },
153
+ "d3-chord": {
154
+ "optional": true
155
+ },
156
+ "d3-hierarchy": {
157
+ "optional": true
158
+ },
159
+ "d3-sankey": {
160
+ "optional": true
161
+ },
162
+ "d3-shape": {
163
+ "optional": true
164
+ },
130
165
  "date-fns": {
131
166
  "optional": true
132
167
  },
133
168
  "input-otp": {
134
169
  "optional": true
135
170
  },
171
+ "mermaid": {
172
+ "optional": true
173
+ },
136
174
  "react-day-picker": {
137
175
  "optional": true
138
176
  },
@@ -142,11 +180,17 @@
142
180
  "react-resizable-panels": {
143
181
  "optional": true
144
182
  },
183
+ "reactflow": {
184
+ "optional": true
185
+ },
145
186
  "sonner": {
146
187
  "optional": true
147
188
  },
148
189
  "vaul": {
149
190
  "optional": true
191
+ },
192
+ "wavesurfer.js": {
193
+ "optional": true
150
194
  }
151
195
  },
152
196
  "scripts": {