@antv/gpt-vis 0.1.0 → 0.2.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.
- package/README.md +54 -9
- package/README.zh-CN.md +54 -9
- package/dist/cjs/ConfigProvider/hooks/useConfig.js +2 -1
- package/dist/cjs/GPTVis/Lite.d.ts +10 -0
- package/dist/cjs/GPTVis/Lite.js +54 -0
- package/dist/cjs/GPTVis/index.d.ts +2 -6
- package/dist/cjs/GPTVis/index.js +3 -12
- package/dist/cjs/Text/VisText.js +3 -0
- package/dist/cjs/export.d.ts +11 -8
- package/dist/cjs/export.js +7 -10
- package/dist/cjs/index.d.ts +7 -2
- package/dist/cjs/index.js +8 -2
- package/dist/cjs/types/config.d.ts +5 -0
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/ConfigProvider/hooks/useConfig.js +4 -2
- package/dist/esm/GPTVis/Lite.d.ts +10 -0
- package/dist/esm/GPTVis/Lite.js +18 -0
- package/dist/esm/GPTVis/index.d.ts +2 -6
- package/dist/esm/GPTVis/index.js +4 -8
- package/dist/esm/Text/VisText.js +5 -1
- package/dist/esm/export.d.ts +11 -8
- package/dist/esm/export.js +15 -9
- package/dist/esm/index.d.ts +7 -2
- package/dist/esm/index.js +9 -2
- package/dist/esm/types/config.d.ts +5 -0
- package/dist/esm/version.d.ts +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/umd/895.async.js +1 -0
- package/dist/umd/index.min.js +1 -1
- package/package.json +1 -1
- package/dist/umd/861.async.js +0 -1
package/README.md
CHANGED
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
|
|
5
5
|
<div align="center">
|
|
6
6
|
|
|
7
|
-
Components for GPTs, generative AI, and LLM projects. Not only UI Components
|
|
7
|
+
Components for GPTs, generative AI, and LLM projects. **Not only UI Components**.
|
|
8
8
|
|
|
9
9
|
<p align="center">
|
|
10
|
-
<a href="https://gpt-vis.antv.
|
|
10
|
+
<a href="https://gpt-vis.antv.vision" target="_blank">Document</a> •
|
|
11
11
|
<a href="/knowledges" target="_blank">Knowledge</a> •
|
|
12
12
|
<a href="https://huggingface.co/antvis" target="_blank">Huggingface</a> •
|
|
13
13
|
<a href="https://tbox.alipay.com/share/202410APr1n200110168?platform=WebService" target="_blank">Agent Demo</a>
|
|
@@ -42,7 +42,21 @@ const markdownContent = `
|
|
|
42
42
|
Here’s a visualization of Haidilao's food delivery revenue from 2013 to 2022. You can see a steady increase over the years, with notable *growth* particularly in recent years.
|
|
43
43
|
|
|
44
44
|
\`\`\`vis-chart
|
|
45
|
-
{
|
|
45
|
+
{
|
|
46
|
+
"type": "line",
|
|
47
|
+
"data": [
|
|
48
|
+
{ "time":2013,"value":59.3 },
|
|
49
|
+
{ "time":2014,"value":64.4 },
|
|
50
|
+
{ "time":2015,"value":68.9 },
|
|
51
|
+
{ "time":2016,"value":74.4 },
|
|
52
|
+
{ "time":2017,"value":82.7 },
|
|
53
|
+
{ "time":2018,"value":91.9 },
|
|
54
|
+
{ "time":2019,"value":99.1 },
|
|
55
|
+
{ "time":2020,"value":101.6 },
|
|
56
|
+
{ "time":2021,"value":114.4 },
|
|
57
|
+
{ "time":2022,"value":121 }
|
|
58
|
+
]
|
|
59
|
+
}
|
|
46
60
|
\`\`\`
|
|
47
61
|
`;
|
|
48
62
|
|
|
@@ -54,27 +68,58 @@ export default () => {
|
|
|
54
68
|
## 🛠 Custom renderer
|
|
55
69
|
|
|
56
70
|
```jsx
|
|
57
|
-
import {
|
|
71
|
+
import { GPTVisLite, withChartCode, ChartType, Pie } from '@antv/gpt-vis';
|
|
58
72
|
|
|
59
73
|
const markdownContent = `
|
|
60
|
-
<vis-text type="time_desc">本月</vis-text>共产生<vis-text type="metric_name">决策数量</vis-text><vis-text type="metric_value">2,783</vis-text>个,环比<vis-text type="trend_desc">增长</vis-text><vis-text type="ratio_value_pos">15.2%</vis-text>。<vis-text type="dim_name">高优先级决策</vis-text>占比<vis-text type="proportion">56.2%</vis-text>,呈现稳定<vis-text type="trend_desc" origin="[1, 2, 6, 18, 24, 48]">上升</vis-text>趋势,预计<vis-text type="time_desc">下月</vis-text>将突破<vis-text type="metric_value">3,000</vis-text>大关。
|
|
61
|
-
|
|
62
74
|
\`\`\`my-ui
|
|
63
75
|
my data
|
|
64
76
|
\`\`\`
|
|
77
|
+
|
|
78
|
+
\`\`\`vis-chart
|
|
79
|
+
{
|
|
80
|
+
"type": "pie",
|
|
81
|
+
"data": [
|
|
82
|
+
{ "category": "category 1", "value": 27 },
|
|
83
|
+
{ "category": "category 2", "value": 25 },
|
|
84
|
+
{ "category": "category 3", "value": 18 },
|
|
85
|
+
{ "category": "other", "value": 5 }
|
|
86
|
+
]
|
|
87
|
+
}
|
|
88
|
+
\`\`\`
|
|
65
89
|
`;
|
|
66
90
|
|
|
67
91
|
const customRenderers = { 'my-ui': ({ children }) => <div>{children}</div> };
|
|
68
92
|
const components = {
|
|
69
|
-
|
|
70
|
-
|
|
93
|
+
code: withChartCode({
|
|
94
|
+
languageRenderers: customRenderers, // register custom block renderer
|
|
95
|
+
components: { [ChartType.Pie]: Pie }, // register a pie chart
|
|
96
|
+
}),
|
|
71
97
|
};
|
|
72
98
|
|
|
73
99
|
export default () => {
|
|
74
|
-
return <
|
|
100
|
+
return <GPTVisLite components={components}>{markdownContent}</GPTVisLite>;
|
|
75
101
|
};
|
|
76
102
|
```
|
|
77
103
|
|
|
104
|
+
## 🐍 Streamlit
|
|
105
|
+
|
|
106
|
+
```python
|
|
107
|
+
import streamlit as st
|
|
108
|
+
from streamlit_gpt_vis import set_gpt_vis
|
|
109
|
+
|
|
110
|
+
content = '''
|
|
111
|
+
Here’s a visualization of Haidilao's food delivery revenue from 2013 to 2022. You can see a steady increase over the years, with notable *growth* particularly in recent years.
|
|
112
|
+
|
|
113
|
+
\`\`\`vis-chart
|
|
114
|
+
{"type": "line","data": [{"time":2013,"value":59.3},{"time":2014,"value":64.4},{"time":2015,"value":68.9},{"time":2016,"value":74.4},{"time":2017,"value":82.7},{"time":2018,"value":91.9},{"time":2019,"value":99.1},{"time":2020,"value":101.6},{"time":2021,"value":114.4},{"time":2022,"value":121}]}
|
|
115
|
+
\`\`\`
|
|
116
|
+
'''
|
|
117
|
+
|
|
118
|
+
set_gpt_vis(content)
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
Learn more 👉 [streamlit-gpt-vis](https://github.com/antvis/GPT-Vis/bindings/streamlit-gpt-vis)
|
|
122
|
+
|
|
78
123
|
## 💻 Development
|
|
79
124
|
|
|
80
125
|
```bash
|
package/README.zh-CN.md
CHANGED
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
|
|
5
5
|
<div align="center">
|
|
6
6
|
|
|
7
|
-
Components for GPTs, generative AI, and LLM projects. Not only UI Components
|
|
7
|
+
Components for GPTs, generative AI, and LLM projects. **Not only UI Components**.
|
|
8
8
|
|
|
9
9
|
<p align="center">
|
|
10
|
-
<a href="https://gpt-vis.antv.
|
|
10
|
+
<a href="https://gpt-vis.antv.vision" target="_blank">文档</a> •
|
|
11
11
|
<a href="/knowledges" target="_blank">知识库</a> •
|
|
12
12
|
<a href="https://huggingface.co/antvis" target="_blank">Huggingface</a> •
|
|
13
13
|
<a href="https://tbox.alipay.com/share/202410APr1n200110168?platform=WebService" target="_blank">体验 Agent</a>
|
|
@@ -42,7 +42,21 @@ const markdownContent = `
|
|
|
42
42
|
Here’s a visualization of Haidilao's food delivery revenue from 2013 to 2022. You can see a steady increase over the years, with notable *growth* particularly in recent years.
|
|
43
43
|
|
|
44
44
|
\`\`\`vis-chart
|
|
45
|
-
{
|
|
45
|
+
{
|
|
46
|
+
"type": "line",
|
|
47
|
+
"data": [
|
|
48
|
+
{ "time":2013,"value":59.3 },
|
|
49
|
+
{ "time":2014,"value":64.4 },
|
|
50
|
+
{ "time":2015,"value":68.9 },
|
|
51
|
+
{ "time":2016,"value":74.4 },
|
|
52
|
+
{ "time":2017,"value":82.7 },
|
|
53
|
+
{ "time":2018,"value":91.9 },
|
|
54
|
+
{ "time":2019,"value":99.1 },
|
|
55
|
+
{ "time":2020,"value":101.6 },
|
|
56
|
+
{ "time":2021,"value":114.4 },
|
|
57
|
+
{ "time":2022,"value":121 }
|
|
58
|
+
]
|
|
59
|
+
}
|
|
46
60
|
\`\`\`
|
|
47
61
|
`;
|
|
48
62
|
|
|
@@ -54,27 +68,58 @@ export default () => {
|
|
|
54
68
|
## 🛠 定制渲染器
|
|
55
69
|
|
|
56
70
|
```jsx
|
|
57
|
-
import {
|
|
71
|
+
import { GPTVisLite, withChartCode, ChartType, Pie } from '@antv/gpt-vis';
|
|
58
72
|
|
|
59
73
|
const markdownContent = `
|
|
60
|
-
<vis-text type="time_desc">本月</vis-text>共产生<vis-text type="metric_name">决策数量</vis-text><vis-text type="metric_value">2,783</vis-text>个,环比<vis-text type="trend_desc">增长</vis-text><vis-text type="ratio_value_pos">15.2%</vis-text>。<vis-text type="dim_name">高优先级决策</vis-text>占比<vis-text type="proportion">56.2%</vis-text>,呈现稳定<vis-text type="trend_desc" origin="[1, 2, 6, 18, 24, 48]">上升</vis-text>趋势,预计<vis-text type="time_desc">下月</vis-text>将突破<vis-text type="metric_value">3,000</vis-text>大关。
|
|
61
|
-
|
|
62
74
|
\`\`\`my-ui
|
|
63
75
|
my data
|
|
64
76
|
\`\`\`
|
|
77
|
+
|
|
78
|
+
\`\`\`vis-chart
|
|
79
|
+
{
|
|
80
|
+
"type": "pie",
|
|
81
|
+
"data": [
|
|
82
|
+
{ "category": "分类一", "value": 27 },
|
|
83
|
+
{ "category": "分类二", "value": 25 },
|
|
84
|
+
{ "category": "分类三", "value": 18 },
|
|
85
|
+
{ "category": "其他", "value": 5 }
|
|
86
|
+
]
|
|
87
|
+
}
|
|
88
|
+
\`\`\`
|
|
65
89
|
`;
|
|
66
90
|
|
|
67
91
|
const customRenderers = { 'my-ui': ({ children }) => <div>{children}</div> };
|
|
68
92
|
const components = {
|
|
69
|
-
|
|
70
|
-
|
|
93
|
+
code: withChartCode({
|
|
94
|
+
languageRenderers: customRenderers, // register custom block renderer
|
|
95
|
+
components: { [ChartType.Pie]: Pie }, // register a pie chart
|
|
96
|
+
}),
|
|
71
97
|
};
|
|
72
98
|
|
|
73
99
|
export default () => {
|
|
74
|
-
return <
|
|
100
|
+
return <GPTVisLite components={components}>{markdownContent}</GPTVisLite>;
|
|
75
101
|
};
|
|
76
102
|
```
|
|
77
103
|
|
|
104
|
+
## 🐍 Streamlit
|
|
105
|
+
|
|
106
|
+
```python
|
|
107
|
+
import streamlit as st
|
|
108
|
+
from streamlit_gpt_vis import set_gpt_vis
|
|
109
|
+
|
|
110
|
+
content = '''
|
|
111
|
+
Here’s a visualization of Haidilao's food delivery revenue from 2013 to 2022. You can see a steady increase over the years, with notable *growth* particularly in recent years.
|
|
112
|
+
|
|
113
|
+
\`\`\`vis-chart
|
|
114
|
+
{"type": "line","data": [{"time":2013,"value":59.3},{"time":2014,"value":64.4},{"time":2015,"value":68.9},{"time":2016,"value":74.4},{"time":2017,"value":82.7},{"time":2018,"value":91.9},{"time":2019,"value":99.1},{"time":2020,"value":101.6},{"time":2021,"value":114.4},{"time":2022,"value":121}]}
|
|
115
|
+
\`\`\`
|
|
116
|
+
'''
|
|
117
|
+
|
|
118
|
+
set_gpt_vis(content)
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
更多了解 👉 [streamlit-gpt-vis](https://github.com/antvis/GPT-Vis/bindings/streamlit-gpt-vis)
|
|
122
|
+
|
|
78
123
|
## 💻 本地开发
|
|
79
124
|
|
|
80
125
|
```bash
|
|
@@ -91,8 +91,9 @@ function useMapConfig(name, props) {
|
|
|
91
91
|
return mapConfig;
|
|
92
92
|
}
|
|
93
93
|
function useGraphGlobalConfig(name) {
|
|
94
|
+
const { graph: graphConfig = {} } = useConfig();
|
|
94
95
|
const componentConfig = useComponentGlobalConfig(name);
|
|
95
|
-
return componentConfig || {};
|
|
96
|
+
return (0, import_config.mergeGraphOptions)(graphConfig, componentConfig || {});
|
|
96
97
|
}
|
|
97
98
|
function useGraphConfig(name, defaultConfig, props) {
|
|
98
99
|
const globalConfig = useGraphGlobalConfig(name);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { Options } from 'react-markdown';
|
|
3
|
+
export interface GPTVisLiteProps extends Options {
|
|
4
|
+
/** 自定义 markdown components样式 */
|
|
5
|
+
components?: Options['components'] | {
|
|
6
|
+
[key: string]: (props: any) => React.ReactNode;
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
declare const _default: React.NamedExoticComponent<GPTVisLiteProps>;
|
|
10
|
+
export default _default;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
|
|
29
|
+
// src/GPTVis/Lite.tsx
|
|
30
|
+
var Lite_exports = {};
|
|
31
|
+
__export(Lite_exports, {
|
|
32
|
+
default: () => Lite_default
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(Lite_exports);
|
|
35
|
+
var import_react = __toESM(require("react"));
|
|
36
|
+
var import_react_markdown = __toESM(require("react-markdown"));
|
|
37
|
+
var import_rehype_raw = __toESM(require("rehype-raw"));
|
|
38
|
+
var GPTVisLite = ({
|
|
39
|
+
children,
|
|
40
|
+
components,
|
|
41
|
+
rehypePlugins,
|
|
42
|
+
...rest
|
|
43
|
+
}) => {
|
|
44
|
+
return /* @__PURE__ */ import_react.default.createElement(
|
|
45
|
+
import_react_markdown.default,
|
|
46
|
+
{
|
|
47
|
+
components,
|
|
48
|
+
rehypePlugins: [import_rehype_raw.default, ...rehypePlugins ? rehypePlugins : []],
|
|
49
|
+
...rest
|
|
50
|
+
},
|
|
51
|
+
children
|
|
52
|
+
);
|
|
53
|
+
};
|
|
54
|
+
var Lite_default = (0, import_react.memo)(GPTVisLite);
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type
|
|
3
|
-
export interface GPTVisProps extends
|
|
4
|
-
/** 自定义 markdown components样式 */
|
|
5
|
-
components?: Options['components'] | {
|
|
6
|
-
[key: string]: (props: any) => React.ReactNode;
|
|
7
|
-
};
|
|
2
|
+
import { type GPTVisLiteProps } from './Lite';
|
|
3
|
+
export interface GPTVisProps extends GPTVisLiteProps {
|
|
8
4
|
}
|
|
9
5
|
declare const _default: React.NamedExoticComponent<GPTVisProps>;
|
|
10
6
|
export default _default;
|
package/dist/cjs/GPTVis/index.js
CHANGED
|
@@ -33,19 +33,10 @@ __export(GPTVis_exports, {
|
|
|
33
33
|
});
|
|
34
34
|
module.exports = __toCommonJS(GPTVis_exports);
|
|
35
35
|
var import_react = __toESM(require("react"));
|
|
36
|
-
var import_react_markdown = __toESM(require("react-markdown"));
|
|
37
|
-
var import_rehype_raw = __toESM(require("rehype-raw"));
|
|
38
36
|
var import_ChartCodeRender = require("../ChartCodeRender");
|
|
37
|
+
var import_Lite = __toESM(require("./Lite"));
|
|
39
38
|
var CodeBlock = (0, import_ChartCodeRender.withDefaultChartCode)();
|
|
40
|
-
var GPTVis = ({ children, components,
|
|
41
|
-
return /* @__PURE__ */ import_react.default.createElement(
|
|
42
|
-
import_react_markdown.default,
|
|
43
|
-
{
|
|
44
|
-
components: { code: CodeBlock, ...components },
|
|
45
|
-
rehypePlugins: [import_rehype_raw.default, ...rehypePlugins ? rehypePlugins : []],
|
|
46
|
-
...rest
|
|
47
|
-
},
|
|
48
|
-
children
|
|
49
|
-
);
|
|
39
|
+
var GPTVis = ({ children, components, ...rest }) => {
|
|
40
|
+
return /* @__PURE__ */ import_react.default.createElement(import_Lite.default, { components: { code: CodeBlock, ...components }, ...rest }, children);
|
|
50
41
|
};
|
|
51
42
|
var GPTVis_default = (0, import_react.memo)(GPTVis);
|
package/dist/cjs/Text/VisText.js
CHANGED
|
@@ -58,6 +58,9 @@ var VisText = (props) => {
|
|
|
58
58
|
{
|
|
59
59
|
className,
|
|
60
60
|
style: {
|
|
61
|
+
// antd Text 组件写死了 14px,在段落定义了 font-size 的情况下,显示很突兀,这里不设置,跟随上级容器字体大小改变。
|
|
62
|
+
// TODO @羽熙 之后看能否通过 antd ConfigProvider 统一配置
|
|
63
|
+
fontSize: "unset",
|
|
61
64
|
...style,
|
|
62
65
|
...(0, import_lodash.pick)(encoding, ["color", "backgroundColor", "fontWeight"])
|
|
63
66
|
}
|
package/dist/cjs/export.d.ts
CHANGED
|
@@ -1,25 +1,28 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
/********** plot chart **********/
|
|
2
3
|
import { default as Area, type AreaProps } from './Area';
|
|
3
4
|
import { default as Bar, type BarProps } from './Bar';
|
|
4
5
|
import { default as Column, type ColumnProps } from './Column';
|
|
5
6
|
import { default as DualAxes, type DualAxesProps } from './DualAxes';
|
|
6
|
-
import { default as FlowDiagram, type FlowDiagramProps } from './FlowDiagram';
|
|
7
7
|
import { default as HeatMap, type HeatMapProps } from './HeatMap';
|
|
8
8
|
import { default as Histogram, type HistogramProps } from './Histogram';
|
|
9
9
|
import { default as Line, type LineProps } from './Line';
|
|
10
|
-
import { default as MindMap, type MindMapProps } from './MindMap';
|
|
11
|
-
import { default as NetworkGraph, type NetworkGraphProps } from './NetworkGraph';
|
|
12
|
-
import { default as PathMap, type PathMapProps } from './PathMap';
|
|
13
10
|
import { default as Pie, type PieProps } from './Pie';
|
|
14
|
-
import { default as PinMap, type PinMapProps } from './PinMap';
|
|
15
11
|
import { default as Radar, type RadarProps } from './Radar';
|
|
16
12
|
import { default as Scatter, type ScatterProps } from './Scatter';
|
|
17
13
|
import { default as Treemap, type TreemapProps } from './Treemap';
|
|
18
14
|
import { default as WordCloud, type WordCloudProps } from './WordCloud';
|
|
19
|
-
|
|
15
|
+
/********** graph chart **********/
|
|
16
|
+
import { default as FlowDiagram, type FlowDiagramProps } from './FlowDiagram';
|
|
17
|
+
import { default as MindMap, type MindMapProps } from './MindMap';
|
|
18
|
+
import { default as NetworkGraph, type NetworkGraphProps } from './NetworkGraph';
|
|
19
|
+
import { default as PathMap, type PathMapProps } from './PathMap';
|
|
20
|
+
import { default as PinMap, type PinMapProps } from './PinMap';
|
|
20
21
|
export { default as IndentedTree, type IndentedTreeProps } from './IndentedTree';
|
|
21
|
-
export { default as Map, type MapProps } from './Map';
|
|
22
22
|
export { default as OrganizationChart, type OrganizationChartProps } from './OrganizationChart';
|
|
23
|
-
|
|
23
|
+
/********** map chart **********/
|
|
24
|
+
export { default as Map, type MapProps } from './Map';
|
|
25
|
+
/********** NTV **********/
|
|
24
26
|
export { VisText, type VisTextProps } from './Text';
|
|
27
|
+
export { Area, Bar, Column, DualAxes, FlowDiagram, HeatMap, Histogram, Line, MindMap, NetworkGraph, PathMap, Pie, PinMap, Radar, Scatter, Treemap, WordCloud, type AreaProps, type BarProps, type ColumnProps, type DualAxesProps, type FlowDiagramProps, type HeatMapProps, type HistogramProps, type LineProps, type MindMapProps, type NetworkGraphProps, type PathMapProps, type PieProps, type PinMapProps, type RadarProps, type ScatterProps, type TreemapProps, type WordCloudProps, };
|
|
25
28
|
export declare const DEFAULT_CHART_COMPONENTS: Record<string, React.FC<any>>;
|
package/dist/cjs/export.js
CHANGED
|
@@ -32,7 +32,6 @@ __export(export_exports, {
|
|
|
32
32
|
Area: () => import_Area.default,
|
|
33
33
|
Bar: () => import_Bar.default,
|
|
34
34
|
Column: () => import_Column.default,
|
|
35
|
-
ConfigProvider: () => import_ConfigProvider.default,
|
|
36
35
|
DEFAULT_CHART_COMPONENTS: () => DEFAULT_CHART_COMPONENTS,
|
|
37
36
|
DualAxes: () => import_DualAxes.default,
|
|
38
37
|
FlowDiagram: () => import_FlowDiagram.default,
|
|
@@ -58,24 +57,23 @@ var import_Area = __toESM(require("./Area"));
|
|
|
58
57
|
var import_Bar = __toESM(require("./Bar"));
|
|
59
58
|
var import_Column = __toESM(require("./Column"));
|
|
60
59
|
var import_DualAxes = __toESM(require("./DualAxes"));
|
|
61
|
-
var import_FlowDiagram = __toESM(require("./FlowDiagram"));
|
|
62
60
|
var import_HeatMap = __toESM(require("./HeatMap"));
|
|
63
61
|
var import_Histogram = __toESM(require("./Histogram"));
|
|
64
62
|
var import_Line = __toESM(require("./Line"));
|
|
65
|
-
var import_MindMap = __toESM(require("./MindMap"));
|
|
66
|
-
var import_NetworkGraph = __toESM(require("./NetworkGraph"));
|
|
67
|
-
var import_PathMap = __toESM(require("./PathMap"));
|
|
68
63
|
var import_Pie = __toESM(require("./Pie"));
|
|
69
|
-
var import_PinMap = __toESM(require("./PinMap"));
|
|
70
64
|
var import_Radar = __toESM(require("./Radar"));
|
|
71
65
|
var import_Scatter = __toESM(require("./Scatter"));
|
|
72
66
|
var import_Treemap = __toESM(require("./Treemap"));
|
|
73
|
-
var import_types = require("./types");
|
|
74
67
|
var import_WordCloud = __toESM(require("./WordCloud"));
|
|
75
|
-
var
|
|
68
|
+
var import_FlowDiagram = __toESM(require("./FlowDiagram"));
|
|
69
|
+
var import_MindMap = __toESM(require("./MindMap"));
|
|
70
|
+
var import_NetworkGraph = __toESM(require("./NetworkGraph"));
|
|
71
|
+
var import_PathMap = __toESM(require("./PathMap"));
|
|
72
|
+
var import_PinMap = __toESM(require("./PinMap"));
|
|
73
|
+
var import_types = require("./types");
|
|
76
74
|
var import_IndentedTree = __toESM(require("./IndentedTree"));
|
|
77
|
-
var import_Map = __toESM(require("./Map"));
|
|
78
75
|
var import_OrganizationChart = __toESM(require("./OrganizationChart"));
|
|
76
|
+
var import_Map = __toESM(require("./Map"));
|
|
79
77
|
var import_Text = require("./Text");
|
|
80
78
|
var DEFAULT_CHART_COMPONENTS = {
|
|
81
79
|
[import_types.ChartType.Line]: import_Line.default,
|
|
@@ -96,7 +94,6 @@ var DEFAULT_CHART_COMPONENTS = {
|
|
|
96
94
|
Area,
|
|
97
95
|
Bar,
|
|
98
96
|
Column,
|
|
99
|
-
ConfigProvider,
|
|
100
97
|
DEFAULT_CHART_COMPONENTS,
|
|
101
98
|
DualAxes,
|
|
102
99
|
FlowDiagram,
|
package/dist/cjs/index.d.ts
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
|
+
/********** export chart **********/
|
|
1
2
|
export * from './export';
|
|
2
|
-
export
|
|
3
|
+
/********** export types **********/
|
|
4
|
+
export * from './types';
|
|
5
|
+
/********** export GPTVis **********/
|
|
3
6
|
export { withChartCode, withDefaultChartCode } from './ChartCodeRender';
|
|
4
7
|
export type { CodeBlockComponent, WithChartCodeOptions } from './ChartCodeRender/type';
|
|
8
|
+
export { default as ConfigProvider, type ConfigProviderProps } from './ConfigProvider';
|
|
5
9
|
export { default as GPTVis, type GPTVisProps } from './GPTVis';
|
|
6
|
-
export
|
|
10
|
+
export { default as GPTVisLite, type GPTVisLiteProps } from './GPTVis/Lite';
|
|
11
|
+
export { default as version } from './version';
|
package/dist/cjs/index.js
CHANGED
|
@@ -30,20 +30,26 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
30
30
|
// src/index.ts
|
|
31
31
|
var src_exports = {};
|
|
32
32
|
__export(src_exports, {
|
|
33
|
+
ConfigProvider: () => import_ConfigProvider.default,
|
|
33
34
|
GPTVis: () => import_GPTVis.default,
|
|
35
|
+
GPTVisLite: () => import_Lite.default,
|
|
34
36
|
version: () => import_version.default,
|
|
35
37
|
withChartCode: () => import_ChartCodeRender.withChartCode,
|
|
36
38
|
withDefaultChartCode: () => import_ChartCodeRender.withDefaultChartCode
|
|
37
39
|
});
|
|
38
40
|
module.exports = __toCommonJS(src_exports);
|
|
39
41
|
__reExport(src_exports, require("./export"), module.exports);
|
|
40
|
-
|
|
42
|
+
__reExport(src_exports, require("./types"), module.exports);
|
|
41
43
|
var import_ChartCodeRender = require("./ChartCodeRender");
|
|
44
|
+
var import_ConfigProvider = __toESM(require("./ConfigProvider"));
|
|
42
45
|
var import_GPTVis = __toESM(require("./GPTVis"));
|
|
43
|
-
|
|
46
|
+
var import_Lite = __toESM(require("./GPTVis/Lite"));
|
|
47
|
+
var import_version = __toESM(require("./version"));
|
|
44
48
|
// Annotate the CommonJS export names for ESM import in node:
|
|
45
49
|
0 && (module.exports = {
|
|
50
|
+
ConfigProvider,
|
|
46
51
|
GPTVis,
|
|
52
|
+
GPTVisLite,
|
|
47
53
|
version,
|
|
48
54
|
withChartCode,
|
|
49
55
|
withDefaultChartCode,
|
|
@@ -1,9 +1,13 @@
|
|
|
1
|
+
import type { GraphOptions as ADCGraphOptions } from '@ant-design/graphs';
|
|
1
2
|
import type { G2 } from '@ant-design/plots';
|
|
2
3
|
import type { Charts } from './chart';
|
|
3
4
|
type PlotGlobalConfig = {
|
|
4
5
|
theme?: G2.Theme;
|
|
5
6
|
[key: string]: any;
|
|
6
7
|
};
|
|
8
|
+
type GraphGlobalConfig = ADCGraphOptions & {
|
|
9
|
+
[key: string]: any;
|
|
10
|
+
};
|
|
7
11
|
type MapGlobalConfig = {
|
|
8
12
|
style?: 'normal' | 'light' | 'dark' | string;
|
|
9
13
|
token?: string;
|
|
@@ -14,6 +18,7 @@ type MapGlobalConfig = {
|
|
|
14
18
|
type ComponentsGlobalConfig = Partial<Record<Charts, Record<string, any>>>;
|
|
15
19
|
export type GlobalConfig = {
|
|
16
20
|
plot?: PlotGlobalConfig;
|
|
21
|
+
graph?: GraphGlobalConfig;
|
|
17
22
|
map?: MapGlobalConfig;
|
|
18
23
|
components?: ComponentsGlobalConfig;
|
|
19
24
|
};
|
package/dist/cjs/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: "0.
|
|
1
|
+
declare const _default: "0.2.0";
|
|
2
2
|
export default _default;
|
package/dist/cjs/version.js
CHANGED
|
@@ -45,9 +45,11 @@ export function useMapConfig(name, props) {
|
|
|
45
45
|
return mapConfig;
|
|
46
46
|
}
|
|
47
47
|
function useGraphGlobalConfig(name) {
|
|
48
|
-
|
|
48
|
+
var _useConfig3 = useConfig(),
|
|
49
|
+
_useConfig3$graph = _useConfig3.graph,
|
|
50
|
+
graphConfig = _useConfig3$graph === void 0 ? {} : _useConfig3$graph;
|
|
49
51
|
var componentConfig = useComponentGlobalConfig(name);
|
|
50
|
-
return componentConfig || {};
|
|
52
|
+
return mergeGraphOptions(graphConfig, componentConfig || {});
|
|
51
53
|
}
|
|
52
54
|
export function useGraphConfig(name, defaultConfig, props) {
|
|
53
55
|
var globalConfig = useGraphGlobalConfig(name);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { Options } from 'react-markdown';
|
|
3
|
+
export interface GPTVisLiteProps extends Options {
|
|
4
|
+
/** 自定义 markdown components样式 */
|
|
5
|
+
components?: Options['components'] | {
|
|
6
|
+
[key: string]: (props: any) => React.ReactNode;
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
declare const _default: React.NamedExoticComponent<GPTVisLiteProps>;
|
|
10
|
+
export default _default;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
3
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
4
|
+
var _excluded = ["children", "components", "rehypePlugins"];
|
|
5
|
+
import React, { memo } from 'react';
|
|
6
|
+
import Markdown from 'react-markdown';
|
|
7
|
+
import rehypeRaw from 'rehype-raw';
|
|
8
|
+
var GPTVisLite = function GPTVisLite(_ref) {
|
|
9
|
+
var children = _ref.children,
|
|
10
|
+
components = _ref.components,
|
|
11
|
+
rehypePlugins = _ref.rehypePlugins,
|
|
12
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
13
|
+
return /*#__PURE__*/React.createElement(Markdown, _extends({
|
|
14
|
+
components: components,
|
|
15
|
+
rehypePlugins: [rehypeRaw].concat(_toConsumableArray(rehypePlugins ? rehypePlugins : []))
|
|
16
|
+
}, rest), children);
|
|
17
|
+
};
|
|
18
|
+
export default /*#__PURE__*/memo(GPTVisLite);
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type
|
|
3
|
-
export interface GPTVisProps extends
|
|
4
|
-
/** 自定义 markdown components样式 */
|
|
5
|
-
components?: Options['components'] | {
|
|
6
|
-
[key: string]: (props: any) => React.ReactNode;
|
|
7
|
-
};
|
|
2
|
+
import { type GPTVisLiteProps } from './Lite';
|
|
3
|
+
export interface GPTVisProps extends GPTVisLiteProps {
|
|
8
4
|
}
|
|
9
5
|
declare const _default: React.NamedExoticComponent<GPTVisProps>;
|
|
10
6
|
export default _default;
|
package/dist/esm/GPTVis/index.js
CHANGED
|
@@ -1,23 +1,19 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
-
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
3
2
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
4
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
5
|
-
var _excluded = ["children", "components"
|
|
4
|
+
var _excluded = ["children", "components"];
|
|
6
5
|
import React, { memo } from 'react';
|
|
7
|
-
import Markdown from 'react-markdown';
|
|
8
|
-
import rehypeRaw from 'rehype-raw';
|
|
9
6
|
import { withDefaultChartCode } from "../ChartCodeRender";
|
|
7
|
+
import { default as GPTVisLite } from "./Lite";
|
|
10
8
|
var CodeBlock = withDefaultChartCode();
|
|
11
9
|
var GPTVis = function GPTVis(_ref) {
|
|
12
10
|
var children = _ref.children,
|
|
13
11
|
components = _ref.components,
|
|
14
|
-
rehypePlugins = _ref.rehypePlugins,
|
|
15
12
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
16
|
-
return /*#__PURE__*/React.createElement(
|
|
13
|
+
return /*#__PURE__*/React.createElement(GPTVisLite, _extends({
|
|
17
14
|
components: _objectSpread({
|
|
18
15
|
code: CodeBlock
|
|
19
|
-
}, components)
|
|
20
|
-
rehypePlugins: [rehypeRaw].concat(_toConsumableArray(rehypePlugins ? rehypePlugins : []))
|
|
16
|
+
}, components)
|
|
21
17
|
}, rest), children);
|
|
22
18
|
};
|
|
23
19
|
export default /*#__PURE__*/memo(GPTVis);
|
package/dist/esm/Text/VisText.js
CHANGED
|
@@ -27,7 +27,11 @@ var VisText = function VisText(props) {
|
|
|
27
27
|
title: toString(origin)
|
|
28
28
|
}, /*#__PURE__*/React.createElement(Text, {
|
|
29
29
|
className: className,
|
|
30
|
-
style: _objectSpread(_objectSpread({
|
|
30
|
+
style: _objectSpread(_objectSpread({
|
|
31
|
+
// antd Text 组件写死了 14px,在段落定义了 font-size 的情况下,显示很突兀,这里不设置,跟随上级容器字体大小改变。
|
|
32
|
+
// TODO @羽熙 之后看能否通过 antd ConfigProvider 统一配置
|
|
33
|
+
fontSize: 'unset'
|
|
34
|
+
}, style), pick(encoding, ['color', 'backgroundColor', 'fontWeight']))
|
|
31
35
|
}, renderPrefixSuffix(encoding === null || encoding === void 0 ? void 0 : encoding.prefix, staticsConfig, props), children, renderPrefixSuffix(encoding === null || encoding === void 0 ? void 0 : encoding.suffix, staticsConfig, props)))
|
|
32
36
|
);
|
|
33
37
|
};
|
package/dist/esm/export.d.ts
CHANGED
|
@@ -1,25 +1,28 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
/********** plot chart **********/
|
|
2
3
|
import { default as Area, type AreaProps } from './Area';
|
|
3
4
|
import { default as Bar, type BarProps } from './Bar';
|
|
4
5
|
import { default as Column, type ColumnProps } from './Column';
|
|
5
6
|
import { default as DualAxes, type DualAxesProps } from './DualAxes';
|
|
6
|
-
import { default as FlowDiagram, type FlowDiagramProps } from './FlowDiagram';
|
|
7
7
|
import { default as HeatMap, type HeatMapProps } from './HeatMap';
|
|
8
8
|
import { default as Histogram, type HistogramProps } from './Histogram';
|
|
9
9
|
import { default as Line, type LineProps } from './Line';
|
|
10
|
-
import { default as MindMap, type MindMapProps } from './MindMap';
|
|
11
|
-
import { default as NetworkGraph, type NetworkGraphProps } from './NetworkGraph';
|
|
12
|
-
import { default as PathMap, type PathMapProps } from './PathMap';
|
|
13
10
|
import { default as Pie, type PieProps } from './Pie';
|
|
14
|
-
import { default as PinMap, type PinMapProps } from './PinMap';
|
|
15
11
|
import { default as Radar, type RadarProps } from './Radar';
|
|
16
12
|
import { default as Scatter, type ScatterProps } from './Scatter';
|
|
17
13
|
import { default as Treemap, type TreemapProps } from './Treemap';
|
|
18
14
|
import { default as WordCloud, type WordCloudProps } from './WordCloud';
|
|
19
|
-
|
|
15
|
+
/********** graph chart **********/
|
|
16
|
+
import { default as FlowDiagram, type FlowDiagramProps } from './FlowDiagram';
|
|
17
|
+
import { default as MindMap, type MindMapProps } from './MindMap';
|
|
18
|
+
import { default as NetworkGraph, type NetworkGraphProps } from './NetworkGraph';
|
|
19
|
+
import { default as PathMap, type PathMapProps } from './PathMap';
|
|
20
|
+
import { default as PinMap, type PinMapProps } from './PinMap';
|
|
20
21
|
export { default as IndentedTree, type IndentedTreeProps } from './IndentedTree';
|
|
21
|
-
export { default as Map, type MapProps } from './Map';
|
|
22
22
|
export { default as OrganizationChart, type OrganizationChartProps } from './OrganizationChart';
|
|
23
|
-
|
|
23
|
+
/********** map chart **********/
|
|
24
|
+
export { default as Map, type MapProps } from './Map';
|
|
25
|
+
/********** NTV **********/
|
|
24
26
|
export { VisText, type VisTextProps } from './Text';
|
|
27
|
+
export { Area, Bar, Column, DualAxes, FlowDiagram, HeatMap, Histogram, Line, MindMap, NetworkGraph, PathMap, Pie, PinMap, Radar, Scatter, Treemap, WordCloud, type AreaProps, type BarProps, type ColumnProps, type DualAxesProps, type FlowDiagramProps, type HeatMapProps, type HistogramProps, type LineProps, type MindMapProps, type NetworkGraphProps, type PathMapProps, type PieProps, type PinMapProps, type RadarProps, type ScatterProps, type TreemapProps, type WordCloudProps, };
|
|
25
28
|
export declare const DEFAULT_CHART_COMPONENTS: Record<string, React.FC<any>>;
|