reachat 2.2.0 → 3.1.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 (46) hide show
  1. package/dist/{CSVFileRenderer-BOdL4Jte.js → CSVFileRenderer-C2E4Xnkz.js} +2 -2
  2. package/dist/{CSVFileRenderer-BOdL4Jte.js.map → CSVFileRenderer-C2E4Xnkz.js.map} +1 -1
  3. package/dist/Chat.d.ts +12 -0
  4. package/dist/{Markdown/charts/ChartError.d.ts → ComponentCatalog/ComponentError.d.ts} +2 -2
  5. package/dist/ComponentCatalog/ComponentPre.d.ts +18 -0
  6. package/dist/ComponentCatalog/ComponentRenderer.d.ts +17 -0
  7. package/dist/ComponentCatalog/chartComponentDef.d.ts +36 -0
  8. package/dist/ComponentCatalog/componentCatalog.d.ts +44 -0
  9. package/dist/ComponentCatalog/componentCatalog.spec.d.ts +1 -0
  10. package/dist/ComponentCatalog/generatePrompt.d.ts +9 -0
  11. package/dist/ComponentCatalog/generatePrompt.spec.d.ts +1 -0
  12. package/dist/ComponentCatalog/index.d.ts +9 -0
  13. package/dist/ComponentCatalog/types.d.ts +108 -0
  14. package/dist/ComponentCatalog/validateSpec.d.ts +17 -0
  15. package/dist/ComponentCatalog/validateSpec.spec.d.ts +1 -0
  16. package/dist/{DefaultFileRenderer-C2MsQ9wz.js → DefaultFileRenderer-Day12qYs.js} +2 -2
  17. package/dist/{DefaultFileRenderer-C2MsQ9wz.js.map → DefaultFileRenderer-Day12qYs.js.map} +1 -1
  18. package/dist/Markdown/charts/ChartRenderer.d.ts +1 -1
  19. package/dist/Markdown/charts/ComponentError.d.ts +1 -0
  20. package/dist/Markdown/charts/index.d.ts +2 -6
  21. package/dist/Markdown/charts/types.d.ts +21 -0
  22. package/dist/Markdown/plugins/index.d.ts +1 -1
  23. package/dist/Markdown/plugins/remarkComponent.d.ts +27 -0
  24. package/dist/docs.json +275 -93
  25. package/dist/{index-DdRyk11n.js → index-CZSBRZbI.js} +524 -230
  26. package/dist/index-CZSBRZbI.js.map +1 -0
  27. package/dist/index.css +101 -1077
  28. package/dist/index.d.ts +1 -0
  29. package/dist/index.js +22 -22
  30. package/dist/index.umd.cjs +509 -215
  31. package/dist/index.umd.cjs.map +1 -1
  32. package/dist/stories/Changelog.mdx +1 -1
  33. package/dist/stories/Charts.stories.tsx +118 -130
  34. package/dist/stories/ComponentCatalog.stories.tsx +509 -0
  35. package/dist/stories/{ChartError.stories.tsx → ComponentError.stories.tsx} +14 -11
  36. package/dist/stories/Intro.mdx +1 -1
  37. package/dist/theme.d.ts +3 -0
  38. package/dist/utils/getChildText.d.ts +10 -0
  39. package/dist/utils/getChildText.spec.d.ts +1 -0
  40. package/package.json +27 -30
  41. package/dist/Markdown/charts/ChartPre.d.ts +0 -6
  42. package/dist/Markdown/charts/chartHelpers.d.ts +0 -40
  43. package/dist/Markdown/plugins/remarkChart.d.ts +0 -59
  44. package/dist/index-DdRyk11n.js.map +0 -1
  45. package/dist/stories/Integration.stories.tsx +0 -312
  46. /package/dist/{Markdown/charts/chartHelpers.spec.d.ts → ComponentCatalog/chartComponentDef.spec.d.ts} +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "reachat",
3
- "version": "2.2.0",
3
+ "version": "3.1.0",
4
4
  "description": "Chat UI for Building LLMs",
5
5
  "scripts": {
6
6
  "build-storybook": "storybook build",
@@ -16,6 +16,8 @@
16
16
  "start": "storybook dev -p 9009",
17
17
  "test": "vitest --passWithNoTests",
18
18
  "test:coverage": "vitest run --coverage --passWithNoTests",
19
+ "test:visual": "test-storybook --url http://localhost:9009",
20
+ "test:visual:update": "test-storybook --url http://localhost:9009 --updateSnapshot",
19
21
  "prepare": "husky install"
20
22
  },
21
23
  "license": "Apache-2.0",
@@ -50,15 +52,17 @@
50
52
  "@tiptap/extension-paragraph": "^3.15.3",
51
53
  "@tiptap/extension-placeholder": "^3.15.3",
52
54
  "@tiptap/extension-text": "^3.15.3",
55
+ "@tiptap/extensions": "^3.20.4",
53
56
  "@tiptap/pm": "^3.15.3",
54
57
  "@tiptap/react": "^3.15.3",
58
+ "@tiptap/suggestion": "^3.20.4",
55
59
  "date-fns": "^4.1.0",
56
60
  "katex": "^0.16.11",
57
61
  "lodash": "^4.17.21",
58
62
  "mdast-util-find-and-replace": "^3.0.1",
59
63
  "motion": "^12.4.2",
60
- "reablocks": "^9.0.0",
61
- "react-markdown": "^9.0.3",
64
+ "reablocks": "^10.0.0-beta.1",
65
+ "react-markdown": "^10.0.0",
62
66
  "react-syntax-highlighter": "^16.1.0",
63
67
  "reakeys": "^2.0.3",
64
68
  "rehype-katex": "^7.0.0",
@@ -67,7 +71,8 @@
67
71
  "remark-math": "^6.0.0",
68
72
  "remark-youtube": "^1.3.2",
69
73
  "unified": "^11.0.5",
70
- "unist-util-visit": "^5.0.0"
74
+ "unist-util-visit": "^5.0.0",
75
+ "zod": "^4.0.0"
71
76
  },
72
77
  "peerDependencies": {
73
78
  "react": ">=18",
@@ -80,64 +85,56 @@
80
85
  }
81
86
  },
82
87
  "devDependencies": {
83
- "@ai-sdk/openai": "^1.1.9",
84
- "@storybook/addon-docs": "^8.2.6",
85
- "@storybook/addon-essentials": "^8.2.6",
86
- "@storybook/addon-mdx-gfm": "^8.2.6",
87
- "@storybook/addon-storysource": "^8.2.6",
88
- "@storybook/addon-themes": "^8.2.6",
89
- "@storybook/manager-api": "^8.2.6",
90
- "@storybook/preview-api": "^8.2.6",
91
- "@storybook/react": "^8.2.6",
92
- "@storybook/react-vite": "^8.2.6",
93
- "@storybook/theming": "^8.2.6",
88
+ "@storybook/addon-docs": "^10.0.0",
89
+ "@storybook/addon-themes": "^10.0.0",
90
+ "@storybook/react": "^10.0.0",
91
+ "@storybook/react-vite": "^10.0.0",
92
+ "@storybook/test-runner": "^0.24.0",
94
93
  "@tailwindcss/cli": "^4.0.3",
95
94
  "@tailwindcss/postcss": "^4.0.1",
96
95
  "@tailwindcss/vite": "^4.0.6",
97
- "@types/classnames": "^2.3.1",
98
96
  "@types/lodash": "^4.17.21",
99
97
  "@types/mdast": "^4.0.4",
100
- "@types/react": "^18.2.61",
101
- "@types/react-dom": "^18.2.19",
98
+ "@types/react": "^19.0.0",
99
+ "@types/react-dom": "^19.0.0",
102
100
  "@typescript-eslint/eslint-plugin": "^7.6.0",
103
101
  "@typescript-eslint/parser": "^7.6.0",
104
- "@vitejs/plugin-react": "^4.2.1",
105
- "@vitest/coverage-v8": "^1.4.0",
106
- "ai": "^4.1.35",
102
+ "@vitejs/plugin-react": "^5.0.0",
103
+ "@vitest/coverage-v8": "^3.2.0",
107
104
  "autoprefixer": "^10.4.19",
108
105
  "eslint": "^8.57.0",
109
106
  "eslint-config-prettier": "^9.1.0",
110
107
  "eslint-plugin-no-relative-import-paths": "^1.5.4",
111
108
  "eslint-plugin-react": "^7.34.1",
112
109
  "eslint-plugin-react-hooks": "^4.3.0",
113
- "eslint-plugin-storybook": "^0.8.0",
110
+ "eslint-plugin-storybook": "^0.12.0",
114
111
  "fast-glob": "^3.3.2",
115
112
  "husky": "^9.0.11",
113
+ "jest-image-snapshot": "^6.4.0",
116
114
  "jsdom": "^24.0.0",
117
115
  "lint-staged": "^15.2.2",
118
- "openai": "^4.84.0",
119
116
  "postcss": "^8.4.39",
120
117
  "postcss-nested": "^6.0.1",
121
118
  "postcss-preset-env": "^9.5.2",
122
119
  "prettier": "^3.2.5",
123
- "react": "^18.3.1",
120
+ "react": "^19.0.0",
124
121
  "react-docgen-typescript": "^2.2.2",
125
- "react-dom": "^18.3.1",
122
+ "react-dom": "^19.0.0",
126
123
  "reaviz": "^16.1.1",
127
124
  "rollup-plugin-peer-deps-external": "2.2.4",
128
- "storybook": "^8.2.6",
125
+ "storybook": "^10.0.0",
129
126
  "tailwindcss": "^4.0.0",
130
127
  "tw-colors": "^3.3.1",
131
- "typescript": "^4.9.5",
128
+ "typescript": "^5.9.3",
132
129
  "typescript-rewrite-paths": "^1.3.1",
133
- "vite": "^5.2.2",
134
- "vite-plugin-checker": "^0.8.0",
130
+ "vite": "^7.0.0",
131
+ "vite-plugin-checker": "^0.12.0",
135
132
  "vite-plugin-css-injected-by-js": "^3.5.0",
136
133
  "vite-plugin-dts": "^4.5.0",
137
134
  "vite-plugin-static-copy": "^3.1.1",
138
135
  "vite-plugin-svgr": "^4.2.0",
139
136
  "vite-tsconfig-paths": "^4.3.2",
140
- "vitest": "^1.4.0"
137
+ "vitest": "^3.2.0"
141
138
  },
142
139
  "prettier": {
143
140
  "semi": true,
@@ -1,6 +0,0 @@
1
- import { default as React, FC } from 'react';
2
- export interface ChartPreProps {
3
- children?: React.ReactNode;
4
- [key: string]: unknown;
5
- }
6
- export declare const ChartPre: FC<ChartPreProps>;
@@ -1,40 +0,0 @@
1
- import { default as React } from 'react';
2
- import { ChartConfig } from '../plugins/remarkChart';
3
- /**
4
- * Validates that chart data is an array of objects with the required structure.
5
- * Each item must have a `key` (convertible to string) and `data` (number) property.
6
- *
7
- * @param data - The unknown data array to validate
8
- * @returns An array of validated chart data points with `key` and `data` properties,
9
- * or `null` if the data is invalid or empty
10
- */
11
- export declare function validateChartData(data: unknown[]): {
12
- key: string;
13
- data: number;
14
- }[] | null;
15
- /**
16
- * Parses a JSON string into a validated ChartConfig object.
17
- * The JSON must contain a `type` and `data` property, where `data` is validated
18
- * using `validateChartData`.
19
- *
20
- * @param value - The JSON string to parse
21
- * @returns A validated ChartConfig object, or `null` if parsing fails or the config is invalid
22
- */
23
- export declare function parseChartConfig(value: string): ChartConfig | null;
24
- /**
25
- * Checks if the given className indicates a chart code block.
26
- * Used to identify markdown code blocks that should be rendered as charts.
27
- *
28
- * @param className - The className to check
29
- * @returns `true` if the className is 'language-chart', `false` otherwise
30
- */
31
- export declare function isChartClassName(className?: string): boolean;
32
- /**
33
- * Recursively extracts text content from React children.
34
- * Handles strings, numbers, arrays, and React elements by traversing
35
- * their children props.
36
- *
37
- * @param children - The React children to extract text from
38
- * @returns The concatenated text content as a string
39
- */
40
- export declare function getChildText(children: React.ReactNode): string;
@@ -1,59 +0,0 @@
1
- import { Plugin } from 'unified';
2
- import { Root } from 'mdast';
3
- /**
4
- * Supported chart types for the remarkChart plugin.
5
- */
6
- export type ChartType = 'bar' | 'line' | 'area' | 'pie' | 'radialBar' | 'radialArea' | 'sparkline';
7
- /**
8
- * Data point structure for charts.
9
- */
10
- export interface ChartDataPoint {
11
- key: string;
12
- data: number | ChartDataPoint[];
13
- }
14
- /**
15
- * Configuration for chart rendering.
16
- */
17
- export interface ChartConfig {
18
- type: ChartType;
19
- data: ChartDataPoint[];
20
- width?: number;
21
- height?: number;
22
- title?: string;
23
- }
24
- /**
25
- * Options for the remarkChart plugin.
26
- */
27
- export interface RemarkChartOptions {
28
- /**
29
- * Default width for charts.
30
- * @default 400
31
- */
32
- defaultWidth?: number;
33
- /**
34
- * Default height for charts.
35
- * @default 300
36
- */
37
- defaultHeight?: number;
38
- }
39
- /**
40
- * A remark plugin that preprocesses fenced code blocks with language "chart"
41
- * by validating and applying default dimensions to the chart configuration.
42
- *
43
- * The actual rendering is handled by the ChartRenderer component via
44
- * chartComponents.
45
- *
46
- * Usage in markdown:
47
- * ```chart
48
- * {
49
- * "type": "bar",
50
- * "data": [
51
- * { "key": "A", "data": 10 },
52
- * { "key": "B", "data": 20 }
53
- * ]
54
- * }
55
- * ```
56
- *
57
- * @param options - Plugin options
58
- */
59
- export declare const remarkChart: Plugin<[RemarkChartOptions?], Root>;