orbitchat 3.3.5 → 3.3.7

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 (63) hide show
  1. package/README.md +39 -1
  2. package/bin/orbitchat.js +12 -1
  3. package/dist/assets/ChartRenderer-CMTtwa7N.js +80 -0
  4. package/dist/assets/{MermaidRenderer-C7HAFShD.js → MermaidRenderer-BGfEn-8D.js} +5 -5
  5. package/dist/assets/{MusicRenderer-CKePwetD.js → MusicRenderer-uD3cRUDk.js} +2 -2
  6. package/dist/assets/{SVGRenderer-nCE3IIGK.js → SVGRenderer-DplZ-T1R.js} +1 -1
  7. package/dist/assets/{_basePickBy-BulxEvv-.js → _basePickBy-CuF4aLpO.js} +1 -1
  8. package/dist/assets/{_baseUniq-BR4RoZuC.js → _baseUniq--aFebvuG.js} +1 -1
  9. package/dist/assets/{architectureDiagram-VXUJARFQ-CypnZOlU.js → architectureDiagram-VXUJARFQ-CP0xy9PB.js} +1 -1
  10. package/dist/assets/{blockDiagram-VD42YOAC-DRF1dQy8.js → blockDiagram-VD42YOAC-DaIhCiLV.js} +1 -1
  11. package/dist/assets/{c4Diagram-YG6GDRKO-CSLQXNMf.js → c4Diagram-YG6GDRKO-BmluaJaJ.js} +1 -1
  12. package/dist/assets/channel-D122_0gd.js +1 -0
  13. package/dist/assets/{chunk-4BX2VUAB-2nN7NKvp.js → chunk-4BX2VUAB-DHplKZMr.js} +1 -1
  14. package/dist/assets/{chunk-55IACEB6-nYrmvqb_.js → chunk-55IACEB6-B987CK5e.js} +1 -1
  15. package/dist/assets/{chunk-B4BG7PRW-yipe0vJ0.js → chunk-B4BG7PRW-BUOgJwMo.js} +1 -1
  16. package/dist/assets/{chunk-DI55MBZ5-DwEbWHkS.js → chunk-DI55MBZ5-B0C8oW6f.js} +1 -1
  17. package/dist/assets/{chunk-FMBD7UC4-D1QJQsnh.js → chunk-FMBD7UC4-BC2UA48D.js} +1 -1
  18. package/dist/assets/{chunk-QN33PNHL-DWEuclDB.js → chunk-QN33PNHL-BRQejh6g.js} +1 -1
  19. package/dist/assets/{chunk-QZHKN3VN-DI20Pp3k.js → chunk-QZHKN3VN-CcTE2T0U.js} +1 -1
  20. package/dist/assets/{chunk-TZMSLE5B-CXyUkbVd.js → chunk-TZMSLE5B-D6s8s4Wd.js} +1 -1
  21. package/dist/assets/classDiagram-2ON5EDUG-D6BaYtGK.js +1 -0
  22. package/dist/assets/classDiagram-v2-WZHVMYZB-D6BaYtGK.js +1 -0
  23. package/dist/assets/clone-DOP8--JF.js +1 -0
  24. package/dist/assets/{cose-bilkent-S5V4N54A-B0nxf5mS.js → cose-bilkent-S5V4N54A-DaFuCEww.js} +1 -1
  25. package/dist/assets/{dagre-6UL2VRFP-DIWGfAdD.js → dagre-6UL2VRFP-P24bz3q4.js} +1 -1
  26. package/dist/assets/{diagram-PSM6KHXK-BFNoH3-9.js → diagram-PSM6KHXK-DcWwAWn6.js} +1 -1
  27. package/dist/assets/{diagram-QEK2KX5R-Bi-ikqxo.js → diagram-QEK2KX5R-C8qX_ZIc.js} +1 -1
  28. package/dist/assets/{diagram-S2PKOQOG-BuzuSgUD.js → diagram-S2PKOQOG-y95jPlcA.js} +1 -1
  29. package/dist/assets/{erDiagram-Q2GNP2WA-CPKR4OjU.js → erDiagram-Q2GNP2WA-BvR9Urxi.js} +1 -1
  30. package/dist/assets/{flowDiagram-NV44I4VS-WjU4Ktok.js → flowDiagram-NV44I4VS-RNumyFUb.js} +1 -1
  31. package/dist/assets/{ganttDiagram-JELNMOA3-BeEFeRzu.js → ganttDiagram-JELNMOA3-BVSoY-AD.js} +1 -1
  32. package/dist/assets/{gitGraphDiagram-V2S2FVAM-Dm1mzWSM.js → gitGraphDiagram-V2S2FVAM-AToARZ8f.js} +1 -1
  33. package/dist/assets/{graph-BtarHVJf.js → graph-B-xnjVJs.js} +1 -1
  34. package/dist/assets/{index-CiIkj2yn.js → index-B_VkYlLj.js} +1 -1
  35. package/dist/assets/index-Baf0NBsK.css +1 -0
  36. package/dist/assets/{index-DwYlYTx2.js → index-Di0lu2HX.js} +59 -48
  37. package/dist/assets/{infoDiagram-HS3SLOUP-BLWp2lVr.js → infoDiagram-HS3SLOUP-THYRKFe_.js} +1 -1
  38. package/dist/assets/{journeyDiagram-XKPGCS4Q-BTWtPUvy.js → journeyDiagram-XKPGCS4Q-BdNAwEyo.js} +1 -1
  39. package/dist/assets/{kanban-definition-3W4ZIXB7-Dv_UJp-s.js → kanban-definition-3W4ZIXB7-kTWYIPgb.js} +1 -1
  40. package/dist/assets/{layout-Ddqk3-rR.js → layout-BXrjXjwv.js} +1 -1
  41. package/dist/assets/{mindmap-definition-VGOIOE7T-Cvc5bKDx.js → mindmap-definition-VGOIOE7T-D96JPac9.js} +1 -1
  42. package/dist/assets/{pieDiagram-ADFJNKIX-CrqTnCbf.js → pieDiagram-ADFJNKIX-Bnl7fLkl.js} +1 -1
  43. package/dist/assets/{quadrantDiagram-AYHSOK5B-BbF95ogu.js → quadrantDiagram-AYHSOK5B-D6vKP45f.js} +1 -1
  44. package/dist/assets/{requirementDiagram-UZGBJVZJ-BwArsYVP.js → requirementDiagram-UZGBJVZJ-m7mIoHxU.js} +1 -1
  45. package/dist/assets/{sankeyDiagram-TZEHDZUN-C15ncLMv.js → sankeyDiagram-TZEHDZUN-CRN5DvQ5.js} +1 -1
  46. package/dist/assets/{sequenceDiagram-WL72ISMW-BgRH2AmM.js → sequenceDiagram-WL72ISMW-C30iDcKx.js} +1 -1
  47. package/dist/assets/{stateDiagram-FKZM4ZOC-ZJnOqPdf.js → stateDiagram-FKZM4ZOC-BDW55C7L.js} +1 -1
  48. package/dist/assets/stateDiagram-v2-4FDKWEC3-U8mFO6E0.js +1 -0
  49. package/dist/assets/{timeline-definition-IT6M3QCI-D_8-uvSS.js → timeline-definition-IT6M3QCI-DsLmL9-l.js} +1 -1
  50. package/dist/assets/treemap-GDKQZRPO-DpWJGyRd.js +160 -0
  51. package/dist/assets/{xychartDiagram-PRI3JC2R-12Y-FyTd.js → xychartDiagram-PRI3JC2R-v2U7nKNz.js} +1 -1
  52. package/dist/index.html +2 -2
  53. package/markdown-renderer/src/MarkdownStyles.css +122 -66
  54. package/markdown-renderer/src/renderers/ChartRenderer.tsx +115 -85
  55. package/package.json +1 -1
  56. package/dist/assets/ChartRenderer-C0BhPMQw.js +0 -80
  57. package/dist/assets/channel-Czdys_Nn.js +0 -1
  58. package/dist/assets/classDiagram-2ON5EDUG-CPxr2wRC.js +0 -1
  59. package/dist/assets/classDiagram-v2-WZHVMYZB-CPxr2wRC.js +0 -1
  60. package/dist/assets/clone-B0ShuZQ4.js +0 -1
  61. package/dist/assets/index-DZIq--T_.css +0 -1
  62. package/dist/assets/stateDiagram-v2-4FDKWEC3-CNxipTRh.js +0 -1
  63. package/dist/assets/treemap-GDKQZRPO-B7tMOStw.js +0 -160
@@ -610,10 +610,12 @@ export const ChartRenderer: React.FC<ChartRendererProps> = ({ code, language })
610
610
  const [config, setConfig] = useState<ChartConfig | null>(null);
611
611
  const [isStreaming, setIsStreaming] = useState(false);
612
612
  const [isWaitingForData, setIsWaitingForData] = useState(false);
613
+ const [containerWidth, setContainerWidth] = useState(0);
613
614
  const debounceTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);
614
615
  const lastCodeRef = useRef<string>('');
615
616
  const lastUpdateTimeRef = useRef<number>(0);
616
617
  const streamingTimeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null);
618
+ const chartViewportRef = useRef<HTMLDivElement>(null);
617
619
 
618
620
  useEffect(() => {
619
621
  const now = Date.now();
@@ -749,6 +751,21 @@ export const ChartRenderer: React.FC<ChartRendererProps> = ({ code, language })
749
751
  };
750
752
  }, [code, language]);
751
753
 
754
+ useEffect(() => {
755
+ const node = chartViewportRef.current;
756
+ if (!node || typeof window === 'undefined' || typeof window.ResizeObserver === 'undefined') return;
757
+
758
+ const observer = new window.ResizeObserver((entries) => {
759
+ const width = entries[0]?.contentRect?.width ?? 0;
760
+ if (width > 0) {
761
+ setContainerWidth(width);
762
+ }
763
+ });
764
+ observer.observe(node);
765
+
766
+ return () => observer.disconnect();
767
+ }, []);
768
+
752
769
  if (error) {
753
770
  return (
754
771
  <div className="graph-error">
@@ -806,7 +823,6 @@ export const ChartRenderer: React.FC<ChartRendererProps> = ({ code, language })
806
823
  }
807
824
 
808
825
  const colors = config.colors && config.colors.length ? config.colors : DEFAULT_COLORS;
809
- const height = config.height || 320;
810
826
  const derivedSeries = buildSeries(config, colors);
811
827
 
812
828
  const hasRightAxis = derivedSeries.some((series) => series.yAxisId === 'right');
@@ -839,9 +855,19 @@ export const ChartRenderer: React.FC<ChartRendererProps> = ({ code, language })
839
855
  config.xAxisType ??
840
856
  (config.type === 'scatter' ? 'number' : inferXAxisTypeFromData(config.data, config.xKey));
841
857
  const isCategoryXAxis = xAxisType === 'category';
858
+ const isCompactViewport = containerWidth > 0 && containerWidth < 640;
859
+ const height = config.height || (isCompactViewport ? 380 : 320);
842
860
 
843
861
  // Calculate data point count and determine label rotation/truncation needs
844
862
  const dataPointCount = config.data?.length || 0;
863
+ const defaultChartWidth = isCompactViewport ? 520 : 720;
864
+ const estimatedPerPointWidth =
865
+ config.type === 'bar' || config.type === 'composed'
866
+ ? (isCompactViewport ? 92 : 72)
867
+ : config.type === 'line' || config.type === 'area'
868
+ ? (isCompactViewport ? 84 : 64)
869
+ : (isCompactViewport ? 64 : 56);
870
+ const intrinsicChartWidth = config.width ?? (isCategoryXAxis ? Math.max(defaultChartWidth, dataPointCount * estimatedPerPointWidth) : defaultChartWidth);
845
871
 
846
872
  // Analyze actual label lengths for smarter truncation decisions
847
873
  const analyzeLabelLengths = (): { maxLength: number; avgLength: number } => {
@@ -899,8 +925,8 @@ export const ChartRenderer: React.FC<ChartRendererProps> = ({ code, language })
899
925
 
900
926
  const estimatedTickLabelHeight = estimateTickLabelHeight();
901
927
  const xAxisHeight = shouldRotateLabels
902
- ? Math.min(Math.max(estimatedTickLabelHeight + 16, 80), 160)
903
- : Math.max(estimatedTickLabelHeight + 12, 36);
928
+ ? Math.min(Math.max(estimatedTickLabelHeight + (isCompactViewport ? 12 : 16), isCompactViewport ? 64 : 80), isCompactViewport ? 140 : 160)
929
+ : Math.max(estimatedTickLabelHeight + 12, isCompactViewport ? 32 : 36);
904
930
 
905
931
  // Note: Don't set scale: 'band' explicitly - Recharts handles this automatically
906
932
  // for bar charts, and setting it can interfere with rendering in some cases
@@ -1013,8 +1039,8 @@ export const ChartRenderer: React.FC<ChartRendererProps> = ({ code, language })
1013
1039
  const bottomMargin = baseBottomMargin + axisLabelSpace + legendSpace + rotatedPadding + rotatedWithLabelExtra;
1014
1040
 
1015
1041
  const chartMargin = {
1016
- left: leftAxisLabelText ? 80 : 10,
1017
- right: rightAxisLabelText ? 80 : 10,
1042
+ left: leftAxisLabelText ? (isCompactViewport ? 68 : 80) : 10,
1043
+ right: rightAxisLabelText ? (isCompactViewport ? 68 : 80) : 10,
1018
1044
  top: 10,
1019
1045
  bottom: bottomMargin,
1020
1046
  };
@@ -1037,85 +1063,86 @@ export const ChartRenderer: React.FC<ChartRendererProps> = ({ code, language })
1037
1063
 
1038
1064
  const legendWrapperStyle: React.CSSProperties = {
1039
1065
  color: textColor,
1040
- marginTop: xAxisHasLabel ? 16 + xAxisLabelOffset : 12,
1041
- paddingTop: shouldRotateLabels ? Math.min(Math.max(estimatedTickLabelHeight - 50, 8), 30) : 8,
1066
+ marginTop: xAxisHasLabel ? (isCompactViewport ? 12 : 16) + xAxisLabelOffset : (isCompactViewport ? 8 : 12),
1067
+ paddingTop: shouldRotateLabels ? Math.min(Math.max(estimatedTickLabelHeight - 50, 8), isCompactViewport ? 22 : 30) : 8,
1042
1068
  display: 'flex',
1043
1069
  justifyContent: 'center',
1044
- gap: useLegendVerticalLayout ? '8px' : '16px',
1070
+ gap: useLegendVerticalLayout ? '8px' : (isCompactViewport ? '10px' : '16px'),
1045
1071
  flexDirection: useLegendVerticalLayout ? 'column' : 'row',
1046
1072
  alignItems: useLegendVerticalLayout ? 'center' : undefined,
1047
1073
  };
1048
1074
 
1049
1075
  return (
1050
- <div
1051
- className="graph-container chart-container"
1052
- style={{ flexDirection: 'column', alignItems: 'stretch', position: 'relative' }}
1053
- >
1054
- {isStreaming && (
1055
- <div
1056
- style={{
1057
- position: 'absolute',
1058
- top: '8px',
1059
- right: '8px',
1060
- display: 'flex',
1061
- alignItems: 'center',
1062
- padding: '4px 8px',
1063
- backgroundColor: 'rgba(59, 130, 246, 0.1)',
1064
- borderRadius: '4px',
1065
- fontSize: '12px',
1066
- color: '#3b82f6',
1067
- zIndex: 10,
1068
- }}
1069
- >
1070
- <svg
1076
+ <>
1077
+ <div
1078
+ className="graph-container chart-container"
1079
+ style={{ flexDirection: 'column', alignItems: 'stretch', position: 'relative' }}
1080
+ >
1081
+ {isStreaming && (
1082
+ <div className="md-expandable-actions">
1083
+ <div
1084
+ style={{
1085
+ display: 'flex',
1086
+ alignItems: 'center',
1087
+ padding: '4px 8px',
1088
+ backgroundColor: 'rgba(59, 130, 246, 0.1)',
1089
+ borderRadius: '4px',
1090
+ fontSize: '12px',
1091
+ color: '#3b82f6',
1092
+ }}
1093
+ >
1094
+ <svg
1095
+ style={{
1096
+ animation: 'spin 1s linear infinite',
1097
+ marginRight: '4px',
1098
+ width: '12px',
1099
+ height: '12px'
1100
+ }}
1101
+ viewBox="0 0 24 24"
1102
+ fill="none"
1103
+ >
1104
+ <circle cx="12" cy="12" r="10" stroke="currentColor" strokeWidth="2" strokeDasharray="32" strokeLinecap="round" />
1105
+ </svg>
1106
+ Updating...
1107
+ <style>{`
1108
+ @keyframes spin {
1109
+ from { transform: rotate(0deg); }
1110
+ to { transform: rotate(360deg); }
1111
+ }
1112
+ `}</style>
1113
+ </div>
1114
+ </div>
1115
+ )}
1116
+ {config.title && (
1117
+ <h4
1071
1118
  style={{
1072
- animation: 'spin 1s linear infinite',
1073
- marginRight: '4px',
1074
- width: '12px',
1075
- height: '12px'
1119
+ textAlign: 'center',
1120
+ marginBottom: config.description ? '4px' : '12px',
1121
+ marginTop: 0,
1122
+ color: textColor,
1123
+ fontWeight: 600,
1124
+ background: 'transparent',
1076
1125
  }}
1077
- viewBox="0 0 24 24"
1078
- fill="none"
1079
1126
  >
1080
- <circle cx="12" cy="12" r="10" stroke="currentColor" strokeWidth="2" strokeDasharray="32" strokeLinecap="round" />
1081
- </svg>
1082
- Updating...
1083
- <style>{`
1084
- @keyframes spin {
1085
- from { transform: rotate(0deg); }
1086
- to { transform: rotate(360deg); }
1087
- }
1088
- `}</style>
1089
- </div>
1090
- )}
1091
- {config.title && (
1092
- <h4
1093
- style={{
1094
- textAlign: 'center',
1095
- marginBottom: config.description ? '4px' : '12px',
1096
- marginTop: 0,
1097
- color: textColor,
1098
- fontWeight: 600,
1099
- background: 'transparent',
1100
- }}
1101
- >
1102
- {config.title}
1103
- </h4>
1104
- )}
1105
- {config.description && (
1106
- <p
1107
- style={{
1108
- textAlign: 'center',
1109
- marginTop: 0,
1110
- marginBottom: '12px',
1111
- color: secondaryTextColor,
1112
- fontSize: '0.9rem',
1113
- }}
1114
- >
1115
- {config.description}
1116
- </p>
1117
- )}
1118
- <ResponsiveContainer width="100%" height={height}>
1127
+ {config.title}
1128
+ </h4>
1129
+ )}
1130
+ {config.description && (
1131
+ <p
1132
+ style={{
1133
+ textAlign: 'center',
1134
+ marginTop: 0,
1135
+ marginBottom: '12px',
1136
+ color: secondaryTextColor,
1137
+ fontSize: '0.9rem',
1138
+ }}
1139
+ >
1140
+ {config.description}
1141
+ </p>
1142
+ )}
1143
+ <div ref={chartViewportRef} style={{ width: '100%', overflowX: 'auto', overflowY: 'hidden' }}>
1144
+ <div style={{ width: `${intrinsicChartWidth}px`, minWidth: '100%', height: `${height}px` }}>
1145
+ <ResponsiveContainer width="100%" height="100%">
1119
1146
  {config.type === 'bar' && (
1120
1147
  <BarChart data={config.data} margin={chartMargin} barCategoryGap="20%">
1121
1148
  {showGrid && <CartesianGrid strokeDasharray="3 3" stroke={gridColor} />}
@@ -1128,7 +1155,7 @@ export const ChartRenderer: React.FC<ChartRendererProps> = ({ code, language })
1128
1155
  />
1129
1156
  <YAxis
1130
1157
  yAxisId="left"
1131
- width={80}
1158
+ width={isCompactViewport ? 68 : 80}
1132
1159
  tickFormatter={axisTickFormatter}
1133
1160
  {...axisStylingProps}
1134
1161
  >
@@ -1138,7 +1165,7 @@ export const ChartRenderer: React.FC<ChartRendererProps> = ({ code, language })
1138
1165
  <YAxis
1139
1166
  yAxisId="right"
1140
1167
  orientation="right"
1141
- width={80}
1168
+ width={isCompactViewport ? 68 : 80}
1142
1169
  tickFormatter={axisTickFormatter}
1143
1170
  {...axisStylingProps}
1144
1171
  >
@@ -1181,7 +1208,7 @@ export const ChartRenderer: React.FC<ChartRendererProps> = ({ code, language })
1181
1208
  />
1182
1209
  <YAxis
1183
1210
  yAxisId="left"
1184
- width={80}
1211
+ width={isCompactViewport ? 68 : 80}
1185
1212
  tickFormatter={axisTickFormatter}
1186
1213
  {...axisStylingProps}
1187
1214
  >
@@ -1191,7 +1218,7 @@ export const ChartRenderer: React.FC<ChartRendererProps> = ({ code, language })
1191
1218
  <YAxis
1192
1219
  yAxisId="right"
1193
1220
  orientation="right"
1194
- width={80}
1221
+ width={isCompactViewport ? 68 : 80}
1195
1222
  tickFormatter={axisTickFormatter}
1196
1223
  {...axisStylingProps}
1197
1224
  >
@@ -1235,7 +1262,7 @@ export const ChartRenderer: React.FC<ChartRendererProps> = ({ code, language })
1235
1262
  />
1236
1263
  <YAxis
1237
1264
  yAxisId="left"
1238
- width={80}
1265
+ width={isCompactViewport ? 68 : 80}
1239
1266
  tickFormatter={axisTickFormatter}
1240
1267
  {...axisStylingProps}
1241
1268
  >
@@ -1245,7 +1272,7 @@ export const ChartRenderer: React.FC<ChartRendererProps> = ({ code, language })
1245
1272
  <YAxis
1246
1273
  yAxisId="right"
1247
1274
  orientation="right"
1248
- width={80}
1275
+ width={isCompactViewport ? 68 : 80}
1249
1276
  tickFormatter={axisTickFormatter}
1250
1277
  {...axisStylingProps}
1251
1278
  >
@@ -1290,7 +1317,7 @@ export const ChartRenderer: React.FC<ChartRendererProps> = ({ code, language })
1290
1317
  />
1291
1318
  <YAxis
1292
1319
  yAxisId="left"
1293
- width={80}
1320
+ width={isCompactViewport ? 68 : 80}
1294
1321
  tickFormatter={axisTickFormatter}
1295
1322
  {...axisStylingProps}
1296
1323
  >
@@ -1300,7 +1327,7 @@ export const ChartRenderer: React.FC<ChartRendererProps> = ({ code, language })
1300
1327
  <YAxis
1301
1328
  yAxisId="right"
1302
1329
  orientation="right"
1303
- width={80}
1330
+ width={isCompactViewport ? 68 : 80}
1304
1331
  tickFormatter={axisTickFormatter}
1305
1332
  {...axisStylingProps}
1306
1333
  >
@@ -1409,7 +1436,7 @@ export const ChartRenderer: React.FC<ChartRendererProps> = ({ code, language })
1409
1436
  />
1410
1437
  <YAxis
1411
1438
  dataKey={config.dataKeys?.[0] || 'y'}
1412
- width={80}
1439
+ width={isCompactViewport ? 68 : 80}
1413
1440
  tickFormatter={axisTickFormatter}
1414
1441
  {...axisStylingProps}
1415
1442
  >
@@ -1428,7 +1455,10 @@ export const ChartRenderer: React.FC<ChartRendererProps> = ({ code, language })
1428
1455
  <Scatter name="Data" data={config.data} fill={colors[0]} />
1429
1456
  </ScatterChart>
1430
1457
  )}
1431
- </ResponsiveContainer>
1432
- </div>
1458
+ </ResponsiveContainer>
1459
+ </div>
1460
+ </div>
1461
+ </div>
1462
+ </>
1433
1463
  );
1434
1464
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "orbitchat",
3
3
  "private": false,
4
- "version": "3.3.5",
4
+ "version": "3.3.7",
5
5
  "type": "module",
6
6
  "bin": {
7
7
  "orbitchat": "./bin/orbitchat.js",