vizmatic 0.1.21 → 0.1.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -48,6 +48,7 @@ __export(index_exports, {
48
48
  DashedLine: () => DashedLine,
49
49
  DataTable: () => DataTable,
50
50
  DetailList: () => DetailList,
51
+ DonutChart: () => DonutChart,
51
52
  DotPoint: () => DotPoint,
52
53
  EquationCard: () => EquationCard,
53
54
  Flow: () => Flow,
@@ -56,6 +57,7 @@ __export(index_exports, {
56
57
  GraphDiagram: () => GraphDiagram,
57
58
  Grid: () => Grid,
58
59
  Heatmap: () => Heatmap,
60
+ Icon: () => Icon,
59
61
  IntervalPlot: () => IntervalPlot,
60
62
  KeyValueList: () => KeyValueList,
61
63
  LayeredNetwork: () => LayeredNetwork,
@@ -85,8 +87,10 @@ __export(index_exports, {
85
87
  Tile: () => Tile,
86
88
  TileGrid: () => TileGrid,
87
89
  TiledMatrix: () => TiledMatrix,
90
+ Timeline: () => Timeline,
88
91
  TitleBar: () => TitleBar,
89
92
  ToneStrip: () => ToneStrip,
93
+ TreeDiagram: () => TreeDiagram,
90
94
  ValuePill: () => ValuePill,
91
95
  VectorArrow: () => VectorArrow,
92
96
  VectorSegment: () => VectorSegment,
@@ -558,6 +562,113 @@ function ToneStrip({ tone, width = 34, height = 4 }) {
558
562
  }
559
563
  }, "");
560
564
  }
565
+ var iconShapes = {
566
+ agent: [
567
+ { tag: "rect", attrs: { x: 5, y: 7, width: 14, height: 12, rx: 4 } },
568
+ { tag: "path", attrs: { d: "M12 7V4" } },
569
+ { tag: "circle", attrs: { cx: 12, cy: 3, r: 1 } },
570
+ { tag: "circle", attrs: { cx: 9, cy: 13, r: 1 } },
571
+ { tag: "circle", attrs: { cx: 15, cy: 13, r: 1 } },
572
+ { tag: "path", attrs: { d: "M9 17h6" } }
573
+ ],
574
+ chart: [
575
+ { tag: "path", attrs: { d: "M4 19V5" } },
576
+ { tag: "path", attrs: { d: "M4 19h16" } },
577
+ { tag: "polyline", attrs: { points: "7 15 11 11 14 13 19 7" } }
578
+ ],
579
+ check: [{ tag: "polyline", attrs: { points: "20 6 9 17 4 12" } }],
580
+ code: [
581
+ { tag: "polyline", attrs: { points: "8 9 4 12 8 15" } },
582
+ { tag: "polyline", attrs: { points: "16 9 20 12 16 15" } },
583
+ { tag: "path", attrs: { d: "M13 5l-2 14" } }
584
+ ],
585
+ database: [
586
+ { tag: "path", attrs: { d: "M4 7c0-2 16-2 16 0s-16 2-16 0Z" } },
587
+ { tag: "path", attrs: { d: "M4 7v5c0 2 16 2 16 0V7" } },
588
+ { tag: "path", attrs: { d: "M4 12v5c0 2 16 2 16 0v-5" } }
589
+ ],
590
+ file: [
591
+ { tag: "path", attrs: { d: "M6 3h8l4 4v14H6Z" } },
592
+ { tag: "path", attrs: { d: "M14 3v5h5" } },
593
+ { tag: "path", attrs: { d: "M9 13h6" } },
594
+ { tag: "path", attrs: { d: "M9 17h4" } }
595
+ ],
596
+ git: [
597
+ { tag: "circle", attrs: { cx: 6, cy: 6, r: 2 } },
598
+ { tag: "circle", attrs: { cx: 18, cy: 18, r: 2 } },
599
+ { tag: "circle", attrs: { cx: 6, cy: 18, r: 2 } },
600
+ { tag: "path", attrs: { d: "M8 6h3a5 5 0 0 1 5 5v5" } },
601
+ { tag: "path", attrs: { d: "M6 8v8" } }
602
+ ],
603
+ globe: [
604
+ { tag: "circle", attrs: { cx: 12, cy: 12, r: 9 } },
605
+ { tag: "path", attrs: { d: "M3 12h18" } },
606
+ { tag: "path", attrs: { d: "M12 3a14 14 0 0 1 0 18" } },
607
+ { tag: "path", attrs: { d: "M12 3a14 14 0 0 0 0 18" } }
608
+ ],
609
+ image: [
610
+ { tag: "rect", attrs: { x: 4, y: 5, width: 16, height: 14, rx: 3 } },
611
+ { tag: "circle", attrs: { cx: 9, cy: 10, r: 1.5 } },
612
+ { tag: "polyline", attrs: { points: "7 17 11 13 14 16 16 14 20 18" } }
613
+ ],
614
+ layers: [
615
+ { tag: "path", attrs: { d: "M12 3 3 8l9 5 9-5Z" } },
616
+ { tag: "path", attrs: { d: "m3 13 9 5 9-5" } },
617
+ { tag: "path", attrs: { d: "m3 18 9 5 9-5" } }
618
+ ],
619
+ lock: [
620
+ { tag: "rect", attrs: { x: 5, y: 10, width: 14, height: 10, rx: 2 } },
621
+ { tag: "path", attrs: { d: "M8 10V7a4 4 0 0 1 8 0v3" } }
622
+ ],
623
+ play: [{ tag: "path", attrs: { d: "M8 5v14l11-7Z" } }],
624
+ spark: [
625
+ { tag: "path", attrs: { d: "M12 3l1.8 5.2L19 10l-5.2 1.8L12 17l-1.8-5.2L5 10l5.2-1.8Z" } },
626
+ { tag: "path", attrs: { d: "M5 16l.8 2.2L8 19l-2.2.8L5 22l-.8-2.2L2 19l2.2-.8Z" } }
627
+ ],
628
+ terminal: [
629
+ { tag: "polyline", attrs: { points: "5 7 10 12 5 17" } },
630
+ { tag: "path", attrs: { d: "M12 17h7" } }
631
+ ],
632
+ tool: [
633
+ { tag: "path", attrs: { d: "M14 6a5 5 0 0 0 6 6L11 21l-6-6 9-9Z" } },
634
+ { tag: "path", attrs: { d: "M8 18l-2-2" } }
635
+ ],
636
+ warning: [
637
+ { tag: "path", attrs: { d: "M12 4 22 20H2Z" } },
638
+ { tag: "path", attrs: { d: "M12 9v5" } },
639
+ { tag: "path", attrs: { d: "M12 17h.01" } }
640
+ ]
641
+ };
642
+ function Icon({
643
+ c,
644
+ name,
645
+ tone = "blue",
646
+ color,
647
+ size = 24,
648
+ strokeWidth = 2,
649
+ label,
650
+ muted = false
651
+ }) {
652
+ const stroke = muted ? c.textMuted : color ?? getToneColor(tone, c);
653
+ const shapes = iconShapes[name];
654
+ return import_react.default.createElement("svg", {
655
+ width: size,
656
+ height: size,
657
+ viewBox: "0 0 24 24",
658
+ fill: "none",
659
+ stroke,
660
+ strokeWidth,
661
+ strokeLinecap: "round",
662
+ strokeLinejoin: "round",
663
+ role: label ? "img" : void 0,
664
+ "aria-hidden": label ? void 0 : "true",
665
+ "aria-label": label,
666
+ style: { flex: `0 0 ${size}px` }
667
+ }, shapes.map((shape, index) => import_react.default.createElement(shape.tag, {
668
+ key: `${name}-${index}`,
669
+ ...shape.attrs
670
+ })));
671
+ }
561
672
  function Panel({
562
673
  title,
563
674
  c,
@@ -2549,6 +2660,274 @@ function StatusList({
2549
2660
  ))
2550
2661
  });
2551
2662
  }
2663
+ function renderTimelineCard(event, c, math, width) {
2664
+ const accent = getToneColor(event.tone ?? statusTones[event.status ?? "dot"], c);
2665
+ const resolvedWidth = event.width ?? width;
2666
+ return import_react.default.createElement(
2667
+ "div",
2668
+ {
2669
+ style: {
2670
+ display: "flex",
2671
+ flexDirection: "column",
2672
+ gap: 5,
2673
+ ...resolvedWidth != null ? { width: resolvedWidth } : {},
2674
+ ...typeof resolvedWidth === "string" ? { minWidth: 0 } : {},
2675
+ padding: "10px 12px",
2676
+ borderRadius: 8,
2677
+ border: `1px solid ${accent}44`,
2678
+ backgroundColor: c.bgCard,
2679
+ boxShadow: `0 7px 18px ${c.shadow}`,
2680
+ boxSizing: "border-box"
2681
+ }
2682
+ },
2683
+ ...compactChildren([
2684
+ event.time != null && import_react.default.createElement("div", {
2685
+ style: {
2686
+ display: "flex",
2687
+ color: accent,
2688
+ fontFamily: "JetBrains Mono",
2689
+ fontSize: 9,
2690
+ fontWeight: 900,
2691
+ lineHeight: 1.15,
2692
+ textTransform: "uppercase",
2693
+ letterSpacing: "0.04em"
2694
+ }
2695
+ }, renderMaybeMath(event.time, math)),
2696
+ import_react.default.createElement("div", {
2697
+ style: {
2698
+ display: "flex",
2699
+ color: c.textPrimary,
2700
+ fontFamily: "Inter",
2701
+ fontSize: 14,
2702
+ fontWeight: 900,
2703
+ lineHeight: 1.18,
2704
+ ...textFitStyle()
2705
+ }
2706
+ }, renderMaybeMath(event.title, math)),
2707
+ event.detail != null && import_react.default.createElement("div", {
2708
+ style: {
2709
+ display: "flex",
2710
+ color: c.textSecondary,
2711
+ fontFamily: "Inter",
2712
+ fontSize: 11,
2713
+ fontWeight: 500,
2714
+ lineHeight: 1.35,
2715
+ ...textFitStyle()
2716
+ }
2717
+ }, renderMaybeMath(event.detail, math))
2718
+ ])
2719
+ );
2720
+ }
2721
+ function Timeline({
2722
+ events,
2723
+ c,
2724
+ title,
2725
+ subtitle,
2726
+ direction = "vertical",
2727
+ width,
2728
+ eventWidth,
2729
+ gap = 12,
2730
+ markerSize = 14,
2731
+ math = false
2732
+ }) {
2733
+ const header = (title != null || subtitle != null) && import_react.default.createElement(
2734
+ "div",
2735
+ {
2736
+ style: {
2737
+ display: "flex",
2738
+ flexDirection: "column",
2739
+ gap: subtitle != null ? 4 : 0,
2740
+ width: "100%"
2741
+ }
2742
+ },
2743
+ ...compactChildren([
2744
+ title != null && import_react.default.createElement("div", {
2745
+ style: {
2746
+ display: "flex",
2747
+ alignItems: "center",
2748
+ gap: 8,
2749
+ color: c.textPrimary,
2750
+ fontFamily: "Inter",
2751
+ fontSize: 16,
2752
+ fontWeight: 900,
2753
+ lineHeight: 1.2
2754
+ }
2755
+ }, ToneStrip({ tone: events[0]?.tone ?? "blue" }), renderMaybeMath(title, math)),
2756
+ subtitle != null && import_react.default.createElement("div", {
2757
+ style: {
2758
+ display: "flex",
2759
+ color: c.textSecondary,
2760
+ fontFamily: "Inter",
2761
+ fontSize: 11,
2762
+ fontWeight: 500,
2763
+ lineHeight: 1.35
2764
+ }
2765
+ }, renderMaybeMath(subtitle, math))
2766
+ ])
2767
+ );
2768
+ if (direction === "horizontal") {
2769
+ return import_react.default.createElement(
2770
+ "div",
2771
+ {
2772
+ style: {
2773
+ display: "flex",
2774
+ flexDirection: "column",
2775
+ gap,
2776
+ ...width != null ? { width } : {}
2777
+ }
2778
+ },
2779
+ ...compactChildren([
2780
+ header,
2781
+ import_react.default.createElement("div", {
2782
+ style: {
2783
+ display: "flex",
2784
+ alignItems: "stretch",
2785
+ gap: 0,
2786
+ width: "100%"
2787
+ }
2788
+ }, ...events.map((event, index) => {
2789
+ const accent = getToneColor(event.tone ?? statusTones[event.status ?? "dot"], c);
2790
+ return import_react.default.createElement(
2791
+ "div",
2792
+ {
2793
+ key: `timeline-h-${index}`,
2794
+ style: {
2795
+ display: "flex",
2796
+ flexDirection: "column",
2797
+ gap: 8,
2798
+ ...eventWidth == null ? { flex: 1 } : {},
2799
+ ...(event.width ?? eventWidth) != null ? { width: event.width ?? eventWidth } : {},
2800
+ minWidth: 0
2801
+ }
2802
+ },
2803
+ import_react.default.createElement(
2804
+ "div",
2805
+ {
2806
+ style: {
2807
+ display: "flex",
2808
+ alignItems: "center",
2809
+ width: "100%"
2810
+ }
2811
+ },
2812
+ import_react.default.createElement("div", {
2813
+ style: {
2814
+ display: "flex",
2815
+ flex: 1,
2816
+ height: 2,
2817
+ backgroundColor: c.borderLight,
2818
+ opacity: index === 0 ? 0 : 1
2819
+ }
2820
+ }),
2821
+ import_react.default.createElement("div", {
2822
+ style: {
2823
+ display: "flex",
2824
+ width: markerSize,
2825
+ height: markerSize,
2826
+ borderRadius: 999,
2827
+ backgroundColor: accent,
2828
+ border: `3px solid ${c.bg}`,
2829
+ boxShadow: `0 0 0 1px ${accent}`,
2830
+ flexShrink: 0
2831
+ }
2832
+ }),
2833
+ import_react.default.createElement("div", {
2834
+ style: {
2835
+ display: "flex",
2836
+ flex: 1,
2837
+ height: 2,
2838
+ backgroundColor: c.borderLight,
2839
+ opacity: index === events.length - 1 ? 0 : 1
2840
+ }
2841
+ })
2842
+ ),
2843
+ renderTimelineCard(event, c, math, eventWidth)
2844
+ );
2845
+ }))
2846
+ ])
2847
+ );
2848
+ }
2849
+ return import_react.default.createElement(
2850
+ "div",
2851
+ {
2852
+ style: {
2853
+ display: "flex",
2854
+ flexDirection: "column",
2855
+ gap,
2856
+ ...width != null ? { width } : {}
2857
+ }
2858
+ },
2859
+ ...compactChildren([
2860
+ header,
2861
+ import_react.default.createElement("div", {
2862
+ style: {
2863
+ display: "flex",
2864
+ flexDirection: "column",
2865
+ gap,
2866
+ width: "100%"
2867
+ }
2868
+ }, ...events.map((event, index) => {
2869
+ const accent = getToneColor(event.tone ?? statusTones[event.status ?? "dot"], c);
2870
+ return import_react.default.createElement(
2871
+ "div",
2872
+ {
2873
+ key: `timeline-v-${index}`,
2874
+ style: {
2875
+ display: "flex",
2876
+ alignItems: "stretch",
2877
+ gap: 11,
2878
+ width: "100%"
2879
+ }
2880
+ },
2881
+ import_react.default.createElement(
2882
+ "div",
2883
+ {
2884
+ style: {
2885
+ display: "flex",
2886
+ flexDirection: "column",
2887
+ alignItems: "center",
2888
+ width: markerSize + 8,
2889
+ flexShrink: 0
2890
+ }
2891
+ },
2892
+ import_react.default.createElement("div", {
2893
+ style: {
2894
+ display: "flex",
2895
+ flex: 1,
2896
+ minHeight: 4,
2897
+ width: 2,
2898
+ backgroundColor: c.borderLight,
2899
+ opacity: index === 0 ? 0 : 1
2900
+ }
2901
+ }),
2902
+ import_react.default.createElement("div", {
2903
+ style: {
2904
+ display: "flex",
2905
+ width: markerSize,
2906
+ height: markerSize,
2907
+ borderRadius: 999,
2908
+ backgroundColor: accent,
2909
+ border: `3px solid ${c.bg}`,
2910
+ boxShadow: `0 0 0 1px ${accent}`,
2911
+ flexShrink: 0
2912
+ }
2913
+ }),
2914
+ import_react.default.createElement("div", {
2915
+ style: {
2916
+ display: "flex",
2917
+ flex: 1,
2918
+ minHeight: 4,
2919
+ width: 2,
2920
+ backgroundColor: c.borderLight,
2921
+ opacity: index === events.length - 1 ? 0 : 1
2922
+ }
2923
+ })
2924
+ ),
2925
+ renderTimelineCard(event, c, math)
2926
+ );
2927
+ }))
2928
+ ])
2929
+ );
2930
+ }
2552
2931
  function renderFlowStage(stage, c, math) {
2553
2932
  const tone = stage.tone ?? "blue";
2554
2933
  const hasDetails = Boolean(stage.children || stage.lines?.length);
@@ -2985,6 +3364,209 @@ function GraphDiagram({
2985
3364
  })
2986
3365
  );
2987
3366
  }
3367
+ function countTreeLeaves(node) {
3368
+ if (!node.children?.length) return 1;
3369
+ return node.children.reduce((sum, child) => sum + countTreeLeaves(child), 0);
3370
+ }
3371
+ function maxTreeDepth(node) {
3372
+ if (!node.children?.length) return 0;
3373
+ return 1 + Math.max(...node.children.map(maxTreeDepth));
3374
+ }
3375
+ function TreeDiagram({
3376
+ root,
3377
+ c,
3378
+ title,
3379
+ subtitle,
3380
+ width,
3381
+ height,
3382
+ nodeWidth = 156,
3383
+ nodeHeight = 64,
3384
+ levelGap = 58,
3385
+ siblingGap = 24,
3386
+ padding = 28,
3387
+ math = false
3388
+ }) {
3389
+ const leafCount = Math.max(1, countTreeLeaves(root));
3390
+ const depthCount = maxTreeDepth(root);
3391
+ const resolvedWidth = width ?? Math.max(520, padding * 2 + leafCount * nodeWidth + Math.max(0, leafCount - 1) * siblingGap);
3392
+ const resolvedHeight = height ?? padding * 2 + (depthCount + 1) * nodeHeight + depthCount * levelGap;
3393
+ const levelStep = depthCount === 0 ? 0 : Math.max(nodeHeight + 18, (resolvedHeight - padding * 2 - nodeHeight) / depthCount);
3394
+ const usableWidth = Math.max(0, resolvedWidth - padding * 2 - nodeWidth);
3395
+ const leafStep = leafCount <= 1 ? 0 : usableWidth / (leafCount - 1);
3396
+ const positioned = [];
3397
+ const edges = [];
3398
+ let nextLeaf = 0;
3399
+ const placeWithEdges = (node, depth, path) => {
3400
+ const children = node.children ?? [];
3401
+ let centerIndex;
3402
+ const childPlacements = [];
3403
+ if (!children.length) {
3404
+ centerIndex = nextLeaf;
3405
+ nextLeaf += 1;
3406
+ } else {
3407
+ for (let index = 0; index < children.length; index += 1) {
3408
+ const child = children[index];
3409
+ childPlacements.push({
3410
+ node: child,
3411
+ index,
3412
+ center: placeWithEdges(child, depth + 1, `${path}-${index}`)
3413
+ });
3414
+ }
3415
+ centerIndex = childPlacements.reduce((sum, child) => sum + child.center, 0) / childPlacements.length;
3416
+ }
3417
+ const placed = {
3418
+ ...node,
3419
+ key: node.id ?? path,
3420
+ depth,
3421
+ cx: leafCount <= 1 ? resolvedWidth / 2 : padding + nodeWidth / 2 + centerIndex * leafStep,
3422
+ cy: padding + nodeHeight / 2 + depth * levelStep
3423
+ };
3424
+ positioned.push(placed);
3425
+ for (const childPlacement of childPlacements) {
3426
+ const childKey = childPlacement.node.id ?? `${path}-${childPlacement.index}`;
3427
+ const childNode = positioned.find((candidate) => candidate.key === childKey);
3428
+ if (childNode) edges.push({ key: `${placed.key}-${childNode.key}`, from: placed, to: childNode });
3429
+ }
3430
+ return centerIndex;
3431
+ };
3432
+ placeWithEdges(root, 0, "root");
3433
+ const header = (title != null || subtitle != null) && import_react.default.createElement(
3434
+ "div",
3435
+ {
3436
+ style: {
3437
+ display: "flex",
3438
+ flexDirection: "column",
3439
+ gap: subtitle != null ? 4 : 0,
3440
+ width: resolvedWidth,
3441
+ maxWidth: "100%"
3442
+ }
3443
+ },
3444
+ ...compactChildren([
3445
+ title != null && import_react.default.createElement("div", {
3446
+ style: {
3447
+ display: "flex",
3448
+ alignItems: "center",
3449
+ gap: 8,
3450
+ color: c.textPrimary,
3451
+ fontFamily: "Inter",
3452
+ fontSize: 16,
3453
+ fontWeight: 900,
3454
+ lineHeight: 1.2
3455
+ }
3456
+ }, ToneStrip({ tone: root.tone ?? "blue" }), renderMaybeMath(title, math)),
3457
+ subtitle != null && import_react.default.createElement("div", {
3458
+ style: {
3459
+ display: "flex",
3460
+ color: c.textSecondary,
3461
+ fontFamily: "Inter",
3462
+ fontSize: 11,
3463
+ fontWeight: 500,
3464
+ lineHeight: 1.35
3465
+ }
3466
+ }, renderMaybeMath(subtitle, math))
3467
+ ])
3468
+ );
3469
+ return import_react.default.createElement(
3470
+ "div",
3471
+ {
3472
+ style: {
3473
+ display: "flex",
3474
+ flexDirection: "column",
3475
+ gap: header ? 10 : 0,
3476
+ width: resolvedWidth,
3477
+ maxWidth: "100%"
3478
+ }
3479
+ },
3480
+ ...compactChildren([
3481
+ header,
3482
+ import_react.default.createElement(
3483
+ "div",
3484
+ {
3485
+ role: "img",
3486
+ style: {
3487
+ position: "relative",
3488
+ display: "flex",
3489
+ width: resolvedWidth,
3490
+ height: resolvedHeight,
3491
+ maxWidth: "100%",
3492
+ flexShrink: 0
3493
+ }
3494
+ },
3495
+ import_react.default.createElement("svg", {
3496
+ width: resolvedWidth,
3497
+ height: resolvedHeight,
3498
+ viewBox: `0 0 ${resolvedWidth} ${resolvedHeight}`,
3499
+ style: { position: "absolute", inset: 0, overflow: "visible" }
3500
+ }, ...edges.map((edge) => {
3501
+ const tone = edge.to.muted ? "neutral" : edge.to.tone ?? edge.from.tone ?? "blue";
3502
+ const color = edge.to.muted ? c.textMuted : getToneColor(tone, c);
3503
+ const startY = edge.from.cy + nodeHeight / 2;
3504
+ const endY = edge.to.cy - nodeHeight / 2;
3505
+ const midY = startY + (endY - startY) / 2;
3506
+ return import_react.default.createElement("path", {
3507
+ key: `tree-edge-${edge.key}`,
3508
+ d: `M ${edge.from.cx} ${startY} C ${edge.from.cx} ${midY}, ${edge.to.cx} ${midY}, ${edge.to.cx} ${endY}`,
3509
+ fill: "none",
3510
+ stroke: color,
3511
+ strokeWidth: edge.to.muted ? 1.4 : 2.4,
3512
+ strokeLinecap: "round",
3513
+ opacity: edge.to.muted ? 0.4 : 0.74
3514
+ });
3515
+ })),
3516
+ ...positioned.map((node) => {
3517
+ const accent = node.muted ? c.textMuted : getToneColor(node.tone ?? "blue", c);
3518
+ return import_react.default.createElement(
3519
+ "div",
3520
+ {
3521
+ key: `tree-node-${node.key}`,
3522
+ style: {
3523
+ position: "absolute",
3524
+ left: node.cx - nodeWidth / 2,
3525
+ top: node.cy - nodeHeight / 2,
3526
+ width: nodeWidth,
3527
+ height: nodeHeight,
3528
+ display: "flex",
3529
+ flexDirection: "column",
3530
+ alignItems: "center",
3531
+ justifyContent: "center",
3532
+ gap: node.detail ? 4 : 0,
3533
+ padding: "8px 10px",
3534
+ boxSizing: "border-box",
3535
+ borderRadius: 8,
3536
+ backgroundColor: node.muted ? c.bgSubtle : c.bgCard,
3537
+ border: `1.5px solid ${node.muted ? c.borderLight : `${accent}88`}`,
3538
+ ...!node.muted ? { boxShadow: `0 8px 18px ${c.shadow}` } : {},
3539
+ opacity: node.muted ? 0.62 : 1,
3540
+ color: accent,
3541
+ textAlign: "center"
3542
+ }
3543
+ },
3544
+ import_react.default.createElement("div", {
3545
+ style: {
3546
+ color: accent,
3547
+ fontFamily: "Inter",
3548
+ fontSize: 13,
3549
+ fontWeight: 900,
3550
+ lineHeight: 1.15,
3551
+ ...textFitStyle("center")
3552
+ }
3553
+ }, renderMaybeMath(node.label, math)),
3554
+ node.detail != null && import_react.default.createElement("div", {
3555
+ style: {
3556
+ color: c.textMuted,
3557
+ fontFamily: "JetBrains Mono",
3558
+ fontSize: 9,
3559
+ fontWeight: 650,
3560
+ lineHeight: 1.2,
3561
+ ...textFitStyle("center")
3562
+ }
3563
+ }, renderMaybeMath(node.detail, math))
3564
+ );
3565
+ })
3566
+ )
3567
+ ])
3568
+ );
3569
+ }
2988
3570
  function CalloutCard({
2989
3571
  c,
2990
3572
  children,
@@ -3934,6 +4516,200 @@ function ChartFrame({
3934
4516
  )
3935
4517
  );
3936
4518
  }
4519
+ function polarPoint(cx, cy, radius, angleDegrees) {
4520
+ const radians = angleDegrees * Math.PI / 180;
4521
+ return {
4522
+ x: cx + radius * Math.cos(radians),
4523
+ y: cy + radius * Math.sin(radians)
4524
+ };
4525
+ }
4526
+ function donutArcPath(cx, cy, outerRadius, innerRadius, startAngle, endAngle) {
4527
+ const span = Math.min(359.99, Math.max(0.01, endAngle - startAngle));
4528
+ const safeEnd = startAngle + span;
4529
+ const outerStart = polarPoint(cx, cy, outerRadius, startAngle);
4530
+ const outerEnd = polarPoint(cx, cy, outerRadius, safeEnd);
4531
+ const innerEnd = polarPoint(cx, cy, innerRadius, safeEnd);
4532
+ const innerStart = polarPoint(cx, cy, innerRadius, startAngle);
4533
+ const largeArc = span > 180 ? 1 : 0;
4534
+ return [
4535
+ `M ${outerStart.x} ${outerStart.y}`,
4536
+ `A ${outerRadius} ${outerRadius} 0 ${largeArc} 1 ${outerEnd.x} ${outerEnd.y}`,
4537
+ `L ${innerEnd.x} ${innerEnd.y}`,
4538
+ `A ${innerRadius} ${innerRadius} 0 ${largeArc} 0 ${innerStart.x} ${innerStart.y}`,
4539
+ "Z"
4540
+ ].join(" ");
4541
+ }
4542
+ function DonutChart({
4543
+ segments,
4544
+ c,
4545
+ title,
4546
+ subtitle,
4547
+ width = 360,
4548
+ height = 230,
4549
+ size,
4550
+ thickness,
4551
+ format = "decimal",
4552
+ centerLabel,
4553
+ centerValue,
4554
+ showLegend = true,
4555
+ footer
4556
+ }) {
4557
+ const positiveSegments = segments.filter((segment) => segment.value > 0);
4558
+ const total = positiveSegments.reduce((sum, segment) => sum + segment.value, 0);
4559
+ const resolvedSize = size ?? Math.min(162, Math.max(128, height - 44), Math.max(128, width * 0.48));
4560
+ const resolvedThickness = thickness ?? Math.max(20, Math.round(resolvedSize * 0.18));
4561
+ const outerRadius = resolvedSize / 2 - 2;
4562
+ const innerRadius = Math.max(18, outerRadius - resolvedThickness);
4563
+ const cx = resolvedSize / 2;
4564
+ const cy = resolvedSize / 2;
4565
+ let cursor = -90;
4566
+ const resolvedCenterValue = centerValue ?? (centerLabel != null ? formatChartValue(total, format) : void 0);
4567
+ const paths = positiveSegments.map((segment, index) => {
4568
+ const rawSpan = total > 0 ? segment.value / total * 360 : 0;
4569
+ const gap = positiveSegments.length > 1 ? Math.min(1.5, rawSpan * 0.28) : 0;
4570
+ const start = cursor + gap / 2;
4571
+ const end = cursor + rawSpan - gap / 2;
4572
+ cursor += rawSpan;
4573
+ if (end <= start) return null;
4574
+ return import_react.default.createElement("path", {
4575
+ key: `donut-segment-${segment.label}-${index}`,
4576
+ d: donutArcPath(cx, cy, outerRadius, innerRadius, start, end),
4577
+ fill: chartColor(segment.color, c, index)
4578
+ });
4579
+ }).filter(Boolean);
4580
+ const legend = showLegend && positiveSegments.length > 0 && import_react.default.createElement("div", {
4581
+ style: {
4582
+ display: "flex",
4583
+ flexDirection: "column",
4584
+ gap: 8,
4585
+ flex: 1,
4586
+ minWidth: 112
4587
+ }
4588
+ }, ...positiveSegments.map((segment, index) => import_react.default.createElement(
4589
+ "div",
4590
+ {
4591
+ key: `donut-legend-${segment.label}-${index}`,
4592
+ style: {
4593
+ display: "flex",
4594
+ alignItems: "center",
4595
+ gap: 8,
4596
+ minWidth: 0
4597
+ }
4598
+ },
4599
+ import_react.default.createElement("span", {
4600
+ style: {
4601
+ display: "flex",
4602
+ width: 10,
4603
+ height: 10,
4604
+ borderRadius: 3,
4605
+ backgroundColor: chartColor(segment.color, c, index),
4606
+ flexShrink: 0
4607
+ }
4608
+ }),
4609
+ import_react.default.createElement("span", {
4610
+ style: {
4611
+ ...typography.tiny,
4612
+ ...textFitStyle(),
4613
+ color: c.textSecondary,
4614
+ flex: 1
4615
+ }
4616
+ }, segment.label),
4617
+ import_react.default.createElement("span", {
4618
+ style: {
4619
+ ...typography.tiny,
4620
+ color: c.textPrimary,
4621
+ fontFamily: "JetBrains Mono",
4622
+ fontWeight: 850,
4623
+ flexShrink: 0
4624
+ }
4625
+ }, segment.valueLabel ?? formatChartValue(segment.value, format))
4626
+ )));
4627
+ return ChartFrame({
4628
+ c,
4629
+ title,
4630
+ subtitle,
4631
+ footer,
4632
+ width,
4633
+ height,
4634
+ padding: 16,
4635
+ children: import_react.default.createElement(
4636
+ "div",
4637
+ {
4638
+ style: {
4639
+ display: "flex",
4640
+ alignItems: "center",
4641
+ justifyContent: showLegend ? "space-between" : "center",
4642
+ gap: 18,
4643
+ minHeight: resolvedSize,
4644
+ width: "100%"
4645
+ }
4646
+ },
4647
+ import_react.default.createElement(
4648
+ "div",
4649
+ {
4650
+ style: {
4651
+ position: "relative",
4652
+ display: "flex",
4653
+ width: resolvedSize,
4654
+ height: resolvedSize,
4655
+ flexShrink: 0
4656
+ }
4657
+ },
4658
+ import_react.default.createElement(
4659
+ "svg",
4660
+ {
4661
+ width: resolvedSize,
4662
+ height: resolvedSize,
4663
+ viewBox: `0 0 ${resolvedSize} ${resolvedSize}`
4664
+ },
4665
+ positiveSegments.length === 0 ? import_react.default.createElement("circle", {
4666
+ cx,
4667
+ cy,
4668
+ r: (outerRadius + innerRadius) / 2,
4669
+ fill: "none",
4670
+ stroke: c.borderLight,
4671
+ strokeWidth: resolvedThickness
4672
+ }) : paths
4673
+ ),
4674
+ (centerLabel != null || resolvedCenterValue != null) && import_react.default.createElement(
4675
+ "div",
4676
+ {
4677
+ style: {
4678
+ position: "absolute",
4679
+ inset: resolvedThickness,
4680
+ display: "flex",
4681
+ flexDirection: "column",
4682
+ alignItems: "center",
4683
+ justifyContent: "center",
4684
+ gap: 3,
4685
+ textAlign: "center"
4686
+ }
4687
+ },
4688
+ resolvedCenterValue != null && import_react.default.createElement("div", {
4689
+ style: {
4690
+ ...typography.small,
4691
+ color: c.textPrimary,
4692
+ fontFamily: "JetBrains Mono",
4693
+ fontSize: 18,
4694
+ fontWeight: 900,
4695
+ lineHeight: 1.05,
4696
+ ...textFitStyle("center")
4697
+ }
4698
+ }, resolvedCenterValue),
4699
+ centerLabel != null && import_react.default.createElement("div", {
4700
+ style: {
4701
+ ...typography.tiny,
4702
+ color: c.textMuted,
4703
+ lineHeight: 1.2,
4704
+ ...textFitStyle("center")
4705
+ }
4706
+ }, centerLabel)
4707
+ )
4708
+ ),
4709
+ legend
4710
+ )
4711
+ });
4712
+ }
3937
4713
  function StackedBar({
3938
4714
  segments,
3939
4715
  c,
@@ -5027,12 +5803,11 @@ function resolveSatori(api) {
5027
5803
  var satori = resolveSatori(satoriModule);
5028
5804
 
5029
5805
  // src/render.ts
5030
- var import_meta = {};
5031
5806
  var FONT_CACHE_DIR = process.env.VIZMATIC_FONT_DIR ?? (0, import_path.join)(process.env.XDG_CACHE_HOME ?? (0, import_path.join)((0, import_os.homedir)(), ".cache"), "vizmatic", "fonts");
5032
5807
  var NETWORK_FALLBACK_DISABLED = process.env.VIZMATIC_DISABLE_NETWORK === "1" || process.env.VIZMATIC_OFFLINE === "1";
5033
5808
  function moduleDirectory() {
5034
5809
  if (typeof __dirname !== "undefined") return __dirname;
5035
- return (0, import_path.dirname)((0, import_url.fileURLToPath)(import_meta.url));
5810
+ return (0, import_path.dirname)((0, import_url.fileURLToPath)(void 0));
5036
5811
  }
5037
5812
  function unique(values) {
5038
5813
  return [...new Set(values.filter((value) => Boolean(value)))];
@@ -5571,6 +6346,7 @@ async function renderAnimatedGif(scenes, options) {
5571
6346
  DashedLine,
5572
6347
  DataTable,
5573
6348
  DetailList,
6349
+ DonutChart,
5574
6350
  DotPoint,
5575
6351
  EquationCard,
5576
6352
  Flow,
@@ -5579,6 +6355,7 @@ async function renderAnimatedGif(scenes, options) {
5579
6355
  GraphDiagram,
5580
6356
  Grid,
5581
6357
  Heatmap,
6358
+ Icon,
5582
6359
  IntervalPlot,
5583
6360
  KeyValueList,
5584
6361
  LayeredNetwork,
@@ -5608,8 +6385,10 @@ async function renderAnimatedGif(scenes, options) {
5608
6385
  Tile,
5609
6386
  TileGrid,
5610
6387
  TiledMatrix,
6388
+ Timeline,
5611
6389
  TitleBar,
5612
6390
  ToneStrip,
6391
+ TreeDiagram,
5613
6392
  ValuePill,
5614
6393
  VectorArrow,
5615
6394
  VectorSegment,