refast-echarts 0.1.0__tar.gz
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.
- refast_echarts-0.1.0/.gitignore +93 -0
- refast_echarts-0.1.0/LICENSE +22 -0
- refast_echarts-0.1.0/PKG-INFO +152 -0
- refast_echarts-0.1.0/README.md +130 -0
- refast_echarts-0.1.0/frontend/package-lock.json +1754 -0
- refast_echarts-0.1.0/frontend/package.json +29 -0
- refast_echarts-0.1.0/frontend/src/ECharts.tsx +320 -0
- refast_echarts-0.1.0/frontend/src/index.tsx +62 -0
- refast_echarts-0.1.0/frontend/src/utils.ts +20 -0
- refast_echarts-0.1.0/frontend/tsconfig.json +24 -0
- refast_echarts-0.1.0/frontend/vite.config.ts +37 -0
- refast_echarts-0.1.0/hatch_build.py +74 -0
- refast_echarts-0.1.0/pyproject.toml +58 -0
- refast_echarts-0.1.0/src/refast_echarts/__init__.py +64 -0
- refast_echarts-0.1.0/src/refast_echarts/components.py +185 -0
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
lib/
|
|
18
|
+
lib64/
|
|
19
|
+
parts/
|
|
20
|
+
sdist/
|
|
21
|
+
var/
|
|
22
|
+
wheels/
|
|
23
|
+
pip-wheel-metadata/
|
|
24
|
+
share/python-wheels/
|
|
25
|
+
*.egg-info/
|
|
26
|
+
.installed.cfg
|
|
27
|
+
*.egg
|
|
28
|
+
MANIFEST
|
|
29
|
+
|
|
30
|
+
# PyInstaller
|
|
31
|
+
*.manifest
|
|
32
|
+
*.spec
|
|
33
|
+
|
|
34
|
+
# Installer logs
|
|
35
|
+
pip-log.txt
|
|
36
|
+
pip-delete-this-directory.txt
|
|
37
|
+
|
|
38
|
+
# Unit test / coverage reports
|
|
39
|
+
htmlcov/
|
|
40
|
+
.tox/
|
|
41
|
+
.nox/
|
|
42
|
+
.coverage
|
|
43
|
+
.coverage.*
|
|
44
|
+
.cache
|
|
45
|
+
nosetests.xml
|
|
46
|
+
coverage.xml
|
|
47
|
+
*.cover
|
|
48
|
+
*.py,cover
|
|
49
|
+
.hypothesis/
|
|
50
|
+
.pytest_cache/
|
|
51
|
+
|
|
52
|
+
# Translations
|
|
53
|
+
*.mo
|
|
54
|
+
*.pot
|
|
55
|
+
|
|
56
|
+
# Environments
|
|
57
|
+
.env
|
|
58
|
+
.venv
|
|
59
|
+
env/
|
|
60
|
+
venv/
|
|
61
|
+
ENV/
|
|
62
|
+
env.bak/
|
|
63
|
+
venv.bak/
|
|
64
|
+
|
|
65
|
+
# IDEs
|
|
66
|
+
.idea/
|
|
67
|
+
.vscode/
|
|
68
|
+
*.swp
|
|
69
|
+
*.swo
|
|
70
|
+
*~
|
|
71
|
+
|
|
72
|
+
# Jupyter Notebook
|
|
73
|
+
.ipynb_checkpoints
|
|
74
|
+
|
|
75
|
+
# pyenv
|
|
76
|
+
.python-version
|
|
77
|
+
|
|
78
|
+
# Node.js
|
|
79
|
+
node_modules/
|
|
80
|
+
npm-debug.log*
|
|
81
|
+
yarn-debug.log*
|
|
82
|
+
yarn-error.log*
|
|
83
|
+
|
|
84
|
+
# Frontend build artifacts (keep the static directory but not its contents except .gitkeep)
|
|
85
|
+
# Note: Built assets are not committed, they're built during install via hatch hook
|
|
86
|
+
src/refast_echarts/static/*.js
|
|
87
|
+
src/refast_echarts/static/*.css
|
|
88
|
+
!src/refast_echarts/static/.gitkeep
|
|
89
|
+
|
|
90
|
+
# OS files
|
|
91
|
+
.DS_Store
|
|
92
|
+
Thumbs.db
|
|
93
|
+
uv.lock
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Najeem Muhammed
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
22
|
+
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: refast-echarts
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Refast extension for ECharts
|
|
5
|
+
Project-URL: Homepage, https://github.com/idling-mind/refast-echarts
|
|
6
|
+
Project-URL: Bug Tracker, https://github.com/idling-mind/refast-echarts/issues
|
|
7
|
+
Project-URL: Documentation, https://github.com/idling-mind/refast-echarts#readme
|
|
8
|
+
Author-email: Najeem Muhammed <najeem@gmail.com>
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Classifier: Framework :: FastAPI
|
|
11
|
+
Classifier: Intended Audience :: Developers
|
|
12
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
13
|
+
Classifier: Operating System :: OS Independent
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
|
|
19
|
+
Requires-Python: >=3.11
|
|
20
|
+
Requires-Dist: refast>=0.0.8
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
|
|
23
|
+
# refast-echarts
|
|
24
|
+
|
|
25
|
+
Refast extension for ECharts
|
|
26
|
+
|
|
27
|
+
A [Refast](https://github.com/idling-mind/refast) extension that provides the `Echarts` component.
|
|
28
|
+
|
|
29
|
+
## Installation
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
pip install refast-echarts
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Usage
|
|
36
|
+
|
|
37
|
+
### Option 1: Auto-Discovery (Recommended)
|
|
38
|
+
|
|
39
|
+
When you install the package, Refast will automatically discover and load the extension:
|
|
40
|
+
|
|
41
|
+
```python
|
|
42
|
+
from fastapi import FastAPI
|
|
43
|
+
from refast import RefastApp, Context
|
|
44
|
+
from refast.components import Container
|
|
45
|
+
from refast_echarts import ECharts
|
|
46
|
+
|
|
47
|
+
ui = RefastApp(title="ECharts Demo")
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
@ui.page("/")
|
|
51
|
+
def home(ctx: Context):
|
|
52
|
+
option = {
|
|
53
|
+
"title": {"text": "Monthly Sales"},
|
|
54
|
+
"tooltip": {},
|
|
55
|
+
"xAxis": {
|
|
56
|
+
"data": ["Jan", "Feb", "Mar", "Apr", "May", "Jun"],
|
|
57
|
+
},
|
|
58
|
+
"yAxis": {},
|
|
59
|
+
"series": [
|
|
60
|
+
{
|
|
61
|
+
"name": "Sales",
|
|
62
|
+
"type": "bar",
|
|
63
|
+
"data": [120, 200, 150, 80, 70, 110],
|
|
64
|
+
}
|
|
65
|
+
],
|
|
66
|
+
}
|
|
67
|
+
return Container(
|
|
68
|
+
children=[
|
|
69
|
+
ECharts(option=option, height="400px"),
|
|
70
|
+
]
|
|
71
|
+
)
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
app = FastAPI()
|
|
75
|
+
app.include_router(ui.router)
|
|
76
|
+
|
|
77
|
+
if __name__ == "__main__":
|
|
78
|
+
import uvicorn
|
|
79
|
+
uvicorn.run(app, host="0.0.0.0", port=8000)
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### Option 2: Manual Registration
|
|
83
|
+
|
|
84
|
+
If you want to disable auto-discovery and register extensions manually:
|
|
85
|
+
|
|
86
|
+
```python
|
|
87
|
+
from refast import RefastApp
|
|
88
|
+
from refast_echarts import Echarts, EchartsExtension
|
|
89
|
+
|
|
90
|
+
ui = RefastApp(
|
|
91
|
+
title="Echarts Demo",
|
|
92
|
+
auto_discover_extensions=False,
|
|
93
|
+
extensions=[EchartsExtension()],
|
|
94
|
+
)
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
## Component Props
|
|
98
|
+
|
|
99
|
+
| Prop | Type | Default | Description |
|
|
100
|
+
|------|------|---------|-------------|
|
|
101
|
+
| `option` | dict | `{}` | ECharts option configuration object |
|
|
102
|
+
| `theme` | str \| dict | `None` | Theme name (`"light"`, `"dark"`) or custom theme object |
|
|
103
|
+
| `height` | str | `None` | Chart height (e.g. `"400px"`) |
|
|
104
|
+
| `width` | str | `None` | Chart width (e.g. `"100%"`) |
|
|
105
|
+
| `auto_resize` | bool | `True` | Auto-resize chart when container size changes |
|
|
106
|
+
| `loading` | bool | `False` | Show loading animation |
|
|
107
|
+
| `on_click` | Callback | `None` | Fired when clicking on a chart element |
|
|
108
|
+
| `on_mouseover` | Callback | `None` | Fired when hovering over a chart element |
|
|
109
|
+
| `id` | str | `None` | Component ID (required for `setOption` calls) |
|
|
110
|
+
| `class_name` | str | `""` | CSS classes to apply to the container |
|
|
111
|
+
|
|
112
|
+
## Development
|
|
113
|
+
|
|
114
|
+
### Prerequisites
|
|
115
|
+
|
|
116
|
+
- Python 3.10+
|
|
117
|
+
- Node.js 18+
|
|
118
|
+
- npm
|
|
119
|
+
|
|
120
|
+
### Building the Frontend
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
cd frontend
|
|
124
|
+
npm install
|
|
125
|
+
npm run build
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
This builds the UMD bundle to `src/refast_echarts/static/`.
|
|
129
|
+
|
|
130
|
+
### Installing Locally
|
|
131
|
+
|
|
132
|
+
```bash
|
|
133
|
+
# Install with automatic frontend build (via hatch hook)
|
|
134
|
+
pip install -e .
|
|
135
|
+
|
|
136
|
+
# Or build frontend first, then install
|
|
137
|
+
cd frontend && npm install && npm run build && cd ..
|
|
138
|
+
pip install -e .
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
### Running the Example
|
|
142
|
+
|
|
143
|
+
```bash
|
|
144
|
+
python usage.py
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
Then open http://localhost:8000 in your browser.
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
## License
|
|
151
|
+
|
|
152
|
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
# refast-echarts
|
|
2
|
+
|
|
3
|
+
Refast extension for ECharts
|
|
4
|
+
|
|
5
|
+
A [Refast](https://github.com/idling-mind/refast) extension that provides the `Echarts` component.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
pip install refast-echarts
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
### Option 1: Auto-Discovery (Recommended)
|
|
16
|
+
|
|
17
|
+
When you install the package, Refast will automatically discover and load the extension:
|
|
18
|
+
|
|
19
|
+
```python
|
|
20
|
+
from fastapi import FastAPI
|
|
21
|
+
from refast import RefastApp, Context
|
|
22
|
+
from refast.components import Container
|
|
23
|
+
from refast_echarts import ECharts
|
|
24
|
+
|
|
25
|
+
ui = RefastApp(title="ECharts Demo")
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
@ui.page("/")
|
|
29
|
+
def home(ctx: Context):
|
|
30
|
+
option = {
|
|
31
|
+
"title": {"text": "Monthly Sales"},
|
|
32
|
+
"tooltip": {},
|
|
33
|
+
"xAxis": {
|
|
34
|
+
"data": ["Jan", "Feb", "Mar", "Apr", "May", "Jun"],
|
|
35
|
+
},
|
|
36
|
+
"yAxis": {},
|
|
37
|
+
"series": [
|
|
38
|
+
{
|
|
39
|
+
"name": "Sales",
|
|
40
|
+
"type": "bar",
|
|
41
|
+
"data": [120, 200, 150, 80, 70, 110],
|
|
42
|
+
}
|
|
43
|
+
],
|
|
44
|
+
}
|
|
45
|
+
return Container(
|
|
46
|
+
children=[
|
|
47
|
+
ECharts(option=option, height="400px"),
|
|
48
|
+
]
|
|
49
|
+
)
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
app = FastAPI()
|
|
53
|
+
app.include_router(ui.router)
|
|
54
|
+
|
|
55
|
+
if __name__ == "__main__":
|
|
56
|
+
import uvicorn
|
|
57
|
+
uvicorn.run(app, host="0.0.0.0", port=8000)
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### Option 2: Manual Registration
|
|
61
|
+
|
|
62
|
+
If you want to disable auto-discovery and register extensions manually:
|
|
63
|
+
|
|
64
|
+
```python
|
|
65
|
+
from refast import RefastApp
|
|
66
|
+
from refast_echarts import Echarts, EchartsExtension
|
|
67
|
+
|
|
68
|
+
ui = RefastApp(
|
|
69
|
+
title="Echarts Demo",
|
|
70
|
+
auto_discover_extensions=False,
|
|
71
|
+
extensions=[EchartsExtension()],
|
|
72
|
+
)
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## Component Props
|
|
76
|
+
|
|
77
|
+
| Prop | Type | Default | Description |
|
|
78
|
+
|------|------|---------|-------------|
|
|
79
|
+
| `option` | dict | `{}` | ECharts option configuration object |
|
|
80
|
+
| `theme` | str \| dict | `None` | Theme name (`"light"`, `"dark"`) or custom theme object |
|
|
81
|
+
| `height` | str | `None` | Chart height (e.g. `"400px"`) |
|
|
82
|
+
| `width` | str | `None` | Chart width (e.g. `"100%"`) |
|
|
83
|
+
| `auto_resize` | bool | `True` | Auto-resize chart when container size changes |
|
|
84
|
+
| `loading` | bool | `False` | Show loading animation |
|
|
85
|
+
| `on_click` | Callback | `None` | Fired when clicking on a chart element |
|
|
86
|
+
| `on_mouseover` | Callback | `None` | Fired when hovering over a chart element |
|
|
87
|
+
| `id` | str | `None` | Component ID (required for `setOption` calls) |
|
|
88
|
+
| `class_name` | str | `""` | CSS classes to apply to the container |
|
|
89
|
+
|
|
90
|
+
## Development
|
|
91
|
+
|
|
92
|
+
### Prerequisites
|
|
93
|
+
|
|
94
|
+
- Python 3.10+
|
|
95
|
+
- Node.js 18+
|
|
96
|
+
- npm
|
|
97
|
+
|
|
98
|
+
### Building the Frontend
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
cd frontend
|
|
102
|
+
npm install
|
|
103
|
+
npm run build
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
This builds the UMD bundle to `src/refast_echarts/static/`.
|
|
107
|
+
|
|
108
|
+
### Installing Locally
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
# Install with automatic frontend build (via hatch hook)
|
|
112
|
+
pip install -e .
|
|
113
|
+
|
|
114
|
+
# Or build frontend first, then install
|
|
115
|
+
cd frontend && npm install && npm run build && cd ..
|
|
116
|
+
pip install -e .
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### Running the Example
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
python usage.py
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
Then open http://localhost:8000 in your browser.
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
## License
|
|
129
|
+
|
|
130
|
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|