@antv/gpt-vis 0.0.3 → 0.0.5
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/cjs/ChartCodeRender/index.d.ts +0 -1
- package/dist/cjs/ChartCodeRender/index.js +23 -5
- package/dist/esm/ChartCodeRender/index.d.ts +0 -1
- package/dist/esm/ChartCodeRender/index.js +12 -4
- package/package.json +2 -3
- package/dist/cjs/ChartCodeRender/index.css +0 -19
- package/dist/esm/ChartCodeRender/index.css +0 -19
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import './index.css';
|
|
3
2
|
import { WithChartCodeOptions } from './type';
|
|
4
3
|
export declare const withChartCode: (options: WithChartCodeOptions) => keyof JSX.IntrinsicElements | import("hast-util-to-jsx-runtime/lib/components").Component<React.ClassAttributes<HTMLElement> & React.HTMLAttributes<HTMLElement> & import("hast-util-to-jsx-runtime/lib/components").ExtraProps> | undefined;
|
|
5
4
|
/**
|
|
@@ -34,12 +34,30 @@ __export(ChartCodeRender_exports, {
|
|
|
34
34
|
});
|
|
35
35
|
module.exports = __toCommonJS(ChartCodeRender_exports);
|
|
36
36
|
var import_icons = require("@ant-design/icons");
|
|
37
|
-
var
|
|
37
|
+
var import_lodash = require("lodash");
|
|
38
38
|
var import_react = __toESM(require("react"));
|
|
39
|
+
var import_styled_components = __toESM(require("styled-components"));
|
|
39
40
|
var import_constants = require("../constants");
|
|
40
|
-
var
|
|
41
|
+
var StyledGPTVis = import_styled_components.default.div`
|
|
42
|
+
min-width: 600px;
|
|
43
|
+
max-width: 100%;
|
|
44
|
+
`;
|
|
45
|
+
var StyledLoading = import_styled_components.default.div`
|
|
46
|
+
display: flex;
|
|
47
|
+
align-items: center;
|
|
48
|
+
justify-content: center;
|
|
49
|
+
flex-direction: column;
|
|
50
|
+
width: 400px;
|
|
51
|
+
height: 400px;
|
|
52
|
+
background-image: linear-gradient(135deg, #e3f3ff 0%, #f1eeff 100%);
|
|
53
|
+
color: rgba(0, 0, 0, 88%);
|
|
54
|
+
|
|
55
|
+
&-icon {
|
|
56
|
+
margin-bottom: 6px;
|
|
57
|
+
}
|
|
58
|
+
`;
|
|
41
59
|
var Loading = () => {
|
|
42
|
-
return /* @__PURE__ */ import_react.default.createElement(
|
|
60
|
+
return /* @__PURE__ */ import_react.default.createElement(StyledLoading, { className: "gpt-vis-loading" }, /* @__PURE__ */ import_react.default.createElement("div", { className: "gpt-vis-loading-icon" }, /* @__PURE__ */ import_react.default.createElement(
|
|
43
61
|
import_icons.LoadingOutlined,
|
|
44
62
|
{
|
|
45
63
|
style: { fontSize: "24px", color: "rgb(56, 177, 246)" }
|
|
@@ -89,7 +107,7 @@ var withCodeBlock = (options) => {
|
|
|
89
107
|
if (!ChartComponent) {
|
|
90
108
|
return /* @__PURE__ */ import_react.default.createElement("code", null, `Chart type "${type}" is not supported.`);
|
|
91
109
|
}
|
|
92
|
-
return /* @__PURE__ */ import_react.default.createElement(
|
|
110
|
+
return /* @__PURE__ */ import_react.default.createElement(StyledGPTVis, { className: "gpt-vis" }, /* @__PURE__ */ import_react.default.createElement(ChartComponent, { ...chartJson }));
|
|
93
111
|
}
|
|
94
112
|
const languageName = ((_a = className.match(/language-(.*)/)) == null ? void 0 : _a[1]) || "";
|
|
95
113
|
const extraLanguageRenderers = extraRenderers || languageRenderers;
|
|
@@ -111,7 +129,7 @@ var withChartCode = (options) => {
|
|
|
111
129
|
var withDefaultChartCode = (options) => {
|
|
112
130
|
return withChartCode({
|
|
113
131
|
...options,
|
|
114
|
-
components: [import_constants.DEFAULT_CHART_COMPONENTS, ...(0,
|
|
132
|
+
components: [import_constants.DEFAULT_CHART_COMPONENTS, ...(0, import_lodash.get)(options, "components", [])]
|
|
115
133
|
});
|
|
116
134
|
};
|
|
117
135
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import './index.css';
|
|
3
2
|
import { WithChartCodeOptions } from './type';
|
|
4
3
|
export declare const withChartCode: (options: WithChartCodeOptions) => keyof JSX.IntrinsicElements | import("hast-util-to-jsx-runtime/lib/components").Component<React.ClassAttributes<HTMLElement> & React.HTMLAttributes<HTMLElement> & import("hast-util-to-jsx-runtime/lib/components").ExtraProps> | undefined;
|
|
5
4
|
/**
|
|
@@ -5,12 +5,20 @@ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
|
5
5
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
6
6
|
var _excluded = ["children", "className", "node"];
|
|
7
7
|
import { LoadingOutlined } from '@ant-design/icons';
|
|
8
|
-
import { get } from 'lodash
|
|
8
|
+
import { get } from 'lodash';
|
|
9
9
|
import React, { useRef, useState } from 'react';
|
|
10
|
+
import styled from 'styled-components';
|
|
10
11
|
import { DEFAULT_CHART_COMPONENTS } from "../constants";
|
|
11
|
-
|
|
12
|
+
var StyledGPTVis = styled.div.withConfig({
|
|
13
|
+
displayName: "StyledGPTVis",
|
|
14
|
+
componentId: "gpt-vis-ed04__sc-1osp6pj-0"
|
|
15
|
+
})(["min-width:600px;max-width:100%;"]);
|
|
16
|
+
var StyledLoading = styled.div.withConfig({
|
|
17
|
+
displayName: "StyledLoading",
|
|
18
|
+
componentId: "gpt-vis-ed04__sc-1osp6pj-1"
|
|
19
|
+
})(["display:flex;align-items:center;justify-content:center;flex-direction:column;width:400px;height:400px;background-image:linear-gradient(135deg,#e3f3ff 0%,#f1eeff 100%);color:rgba(0,0,0,88%);&-icon{margin-bottom:6px;}"]);
|
|
12
20
|
var Loading = function Loading() {
|
|
13
|
-
return /*#__PURE__*/React.createElement(
|
|
21
|
+
return /*#__PURE__*/React.createElement(StyledLoading, {
|
|
14
22
|
className: "gpt-vis-loading"
|
|
15
23
|
}, /*#__PURE__*/React.createElement("div", {
|
|
16
24
|
className: "gpt-vis-loading-icon"
|
|
@@ -79,7 +87,7 @@ var withCodeBlock = function withCodeBlock(options) {
|
|
|
79
87
|
|
|
80
88
|
// Render the supported chart component with data
|
|
81
89
|
|
|
82
|
-
return /*#__PURE__*/React.createElement(
|
|
90
|
+
return /*#__PURE__*/React.createElement(StyledGPTVis, {
|
|
83
91
|
className: "gpt-vis"
|
|
84
92
|
}, /*#__PURE__*/React.createElement(ChartComponent, chartJson));
|
|
85
93
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antv/gpt-vis",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.5",
|
|
4
4
|
"description": "A chart library for LLM Agent",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"@antv/l7": "^2.22.0",
|
|
60
60
|
"@antv/larkmap": "^1.4.17",
|
|
61
61
|
"@babel/runtime": "^7.18.0",
|
|
62
|
-
"lodash
|
|
62
|
+
"lodash": "^4.17.21",
|
|
63
63
|
"react-markdown": "^9.0.1",
|
|
64
64
|
"rehype-raw": "^7.0.0",
|
|
65
65
|
"styled-components": "^6.0.7"
|
|
@@ -73,7 +73,6 @@
|
|
|
73
73
|
"@testing-library/jest-dom": "^5.1.1",
|
|
74
74
|
"@testing-library/react": "^15.0.0",
|
|
75
75
|
"@types/jest": "^29.4.0",
|
|
76
|
-
"@types/lodash-es": "^4.17.12",
|
|
77
76
|
"@types/react": "^18.0.0",
|
|
78
77
|
"antd": "^5.0.0",
|
|
79
78
|
"husky": "^8.0.0",
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
.gpt-vis {
|
|
2
|
-
min-width: 600px;
|
|
3
|
-
max-width: 100%;
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
.gpt-vis-loading {
|
|
7
|
-
display: flex;
|
|
8
|
-
align-items: center;
|
|
9
|
-
justify-content: center;
|
|
10
|
-
flex-direction: column;
|
|
11
|
-
width: 400px;
|
|
12
|
-
height: 400px;
|
|
13
|
-
background-image: linear-gradient(135deg, #e3f3ff 0%, #f1eeff 100%);
|
|
14
|
-
color: rgba(0, 0, 0, 88%);
|
|
15
|
-
|
|
16
|
-
&-icon {
|
|
17
|
-
margin-bottom: 6px;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
.gpt-vis {
|
|
2
|
-
min-width: 600px;
|
|
3
|
-
max-width: 100%;
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
.gpt-vis-loading {
|
|
7
|
-
display: flex;
|
|
8
|
-
align-items: center;
|
|
9
|
-
justify-content: center;
|
|
10
|
-
flex-direction: column;
|
|
11
|
-
width: 400px;
|
|
12
|
-
height: 400px;
|
|
13
|
-
background-image: linear-gradient(135deg, #e3f3ff 0%, #f1eeff 100%);
|
|
14
|
-
color: rgba(0, 0, 0, 88%);
|
|
15
|
-
|
|
16
|
-
&-icon {
|
|
17
|
-
margin-bottom: 6px;
|
|
18
|
-
}
|
|
19
|
-
}
|