weft-ui 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.
- weft_ui-0.1.0/.gitignore +52 -0
- weft_ui-0.1.0/LICENSE +21 -0
- weft_ui-0.1.0/PKG-INFO +284 -0
- weft_ui-0.1.0/README.md +261 -0
- weft_ui-0.1.0/THIRD_PARTY_LICENSES +136 -0
- weft_ui-0.1.0/frontend/package.json +33 -0
- weft_ui-0.1.0/frontend/pnpm-lock.yaml +1657 -0
- weft_ui-0.1.0/frontend/scripts/check-size.mjs +20 -0
- weft_ui-0.1.0/frontend/src/design/base.css +139 -0
- weft_ui-0.1.0/frontend/src/design/cx.ts +8 -0
- weft_ui-0.1.0/frontend/src/design/highlight.test.ts +43 -0
- weft_ui-0.1.0/frontend/src/design/highlight.ts +106 -0
- weft_ui-0.1.0/frontend/src/design/inline.test.tsx +44 -0
- weft_ui-0.1.0/frontend/src/design/inline.tsx +32 -0
- weft_ui-0.1.0/frontend/src/design/markdown.test.ts +102 -0
- weft_ui-0.1.0/frontend/src/design/markdown.ts +284 -0
- weft_ui-0.1.0/frontend/src/design/radius.ts +12 -0
- weft_ui-0.1.0/frontend/src/design/theme.css +813 -0
- weft_ui-0.1.0/frontend/src/design/tone.ts +30 -0
- weft_ui-0.1.0/frontend/src/design/typography.css +226 -0
- weft_ui-0.1.0/frontend/src/entry.tsx +174 -0
- weft_ui-0.1.0/frontend/src/load.ts +26 -0
- weft_ui-0.1.0/frontend/src/nodes/announcement.tsx +77 -0
- weft_ui-0.1.0/frontend/src/nodes/autoplay.test.tsx +41 -0
- weft_ui-0.1.0/frontend/src/nodes/autoplay.tsx +49 -0
- weft_ui-0.1.0/frontend/src/nodes/avatar.test.tsx +35 -0
- weft_ui-0.1.0/frontend/src/nodes/avatar.tsx +133 -0
- weft_ui-0.1.0/frontend/src/nodes/button.tsx +231 -0
- weft_ui-0.1.0/frontend/src/nodes/buttons.test.tsx +47 -0
- weft_ui-0.1.0/frontend/src/nodes/buttons.tsx +166 -0
- weft_ui-0.1.0/frontend/src/nodes/callouts.test.tsx +38 -0
- weft_ui-0.1.0/frontend/src/nodes/callouts.tsx +215 -0
- weft_ui-0.1.0/frontend/src/nodes/carousel.tsx +158 -0
- weft_ui-0.1.0/frontend/src/nodes/chart-model.test.ts +82 -0
- weft_ui-0.1.0/frontend/src/nodes/chart-model.ts +160 -0
- weft_ui-0.1.0/frontend/src/nodes/charts.test.tsx +250 -0
- weft_ui-0.1.0/frontend/src/nodes/charts.tsx +1040 -0
- weft_ui-0.1.0/frontend/src/nodes/chat.test.tsx +93 -0
- weft_ui-0.1.0/frontend/src/nodes/chat.tsx +431 -0
- weft_ui-0.1.0/frontend/src/nodes/checkbox.test.tsx +27 -0
- weft_ui-0.1.0/frontend/src/nodes/checkbox.tsx +101 -0
- weft_ui-0.1.0/frontend/src/nodes/close-button.tsx +64 -0
- weft_ui-0.1.0/frontend/src/nodes/code-collapse.test.tsx +22 -0
- weft_ui-0.1.0/frontend/src/nodes/code.test.ts +28 -0
- weft_ui-0.1.0/frontend/src/nodes/code.tsx +192 -0
- weft_ui-0.1.0/frontend/src/nodes/command.tsx +218 -0
- weft_ui-0.1.0/frontend/src/nodes/core.tsx +132 -0
- weft_ui-0.1.0/frontend/src/nodes/date.test.tsx +97 -0
- weft_ui-0.1.0/frontend/src/nodes/date.tsx +822 -0
- weft_ui-0.1.0/frontend/src/nodes/dialog.test.tsx +83 -0
- weft_ui-0.1.0/frontend/src/nodes/dialog.tsx +129 -0
- weft_ui-0.1.0/frontend/src/nodes/dismiss.ts +58 -0
- weft_ui-0.1.0/frontend/src/nodes/display.test.tsx +38 -0
- weft_ui-0.1.0/frontend/src/nodes/display.tsx +291 -0
- weft_ui-0.1.0/frontend/src/nodes/dropdown.test.tsx +65 -0
- weft_ui-0.1.0/frontend/src/nodes/dropdown.tsx +163 -0
- weft_ui-0.1.0/frontend/src/nodes/field.tsx +119 -0
- weft_ui-0.1.0/frontend/src/nodes/forms.test.tsx +44 -0
- weft_ui-0.1.0/frontend/src/nodes/forms.tsx +109 -0
- weft_ui-0.1.0/frontend/src/nodes/gap-fixes.test.tsx +115 -0
- weft_ui-0.1.0/frontend/src/nodes/icon.test.tsx +32 -0
- weft_ui-0.1.0/frontend/src/nodes/icon.tsx +71 -0
- weft_ui-0.1.0/frontend/src/nodes/index.ts +84 -0
- weft_ui-0.1.0/frontend/src/nodes/input.tsx +168 -0
- weft_ui-0.1.0/frontend/src/nodes/layout.test.tsx +57 -0
- weft_ui-0.1.0/frontend/src/nodes/layout.tsx +181 -0
- weft_ui-0.1.0/frontend/src/nodes/markdown.test.tsx +45 -0
- weft_ui-0.1.0/frontend/src/nodes/markdown.tsx +188 -0
- weft_ui-0.1.0/frontend/src/nodes/marketing.test.tsx +199 -0
- weft_ui-0.1.0/frontend/src/nodes/marketing.tsx +638 -0
- weft_ui-0.1.0/frontend/src/nodes/media.ts +18 -0
- weft_ui-0.1.0/frontend/src/nodes/nav.test.tsx +86 -0
- weft_ui-0.1.0/frontend/src/nodes/nav.tsx +214 -0
- weft_ui-0.1.0/frontend/src/nodes/navigation.test.tsx +190 -0
- weft_ui-0.1.0/frontend/src/nodes/navigation.tsx +1046 -0
- weft_ui-0.1.0/frontend/src/nodes/notification.test.tsx +42 -0
- weft_ui-0.1.0/frontend/src/nodes/notification.tsx +289 -0
- weft_ui-0.1.0/frontend/src/nodes/otp.tsx +178 -0
- weft_ui-0.1.0/frontend/src/nodes/popover.tsx +104 -0
- weft_ui-0.1.0/frontend/src/nodes/progress.tsx +70 -0
- weft_ui-0.1.0/frontend/src/nodes/radio.tsx +112 -0
- weft_ui-0.1.0/frontend/src/nodes/segmented.tsx +125 -0
- weft_ui-0.1.0/frontend/src/nodes/select.test.tsx +53 -0
- weft_ui-0.1.0/frontend/src/nodes/select.tsx +179 -0
- weft_ui-0.1.0/frontend/src/nodes/sidebar-context.ts +10 -0
- weft_ui-0.1.0/frontend/src/nodes/slider.tsx +151 -0
- weft_ui-0.1.0/frontend/src/nodes/social.tsx +91 -0
- weft_ui-0.1.0/frontend/src/nodes/switch.tsx +127 -0
- weft_ui-0.1.0/frontend/src/nodes/table.test.tsx +82 -0
- weft_ui-0.1.0/frontend/src/nodes/table.tsx +385 -0
- weft_ui-0.1.0/frontend/src/nodes/tabs.tsx +213 -0
- weft_ui-0.1.0/frontend/src/nodes/tooltip.test.tsx +50 -0
- weft_ui-0.1.0/frontend/src/nodes/tooltip.tsx +150 -0
- weft_ui-0.1.0/frontend/src/nodes/tree.tsx +383 -0
- weft_ui-0.1.0/frontend/src/nodes/upload.test.tsx +62 -0
- weft_ui-0.1.0/frontend/src/nodes/upload.tsx +296 -0
- weft_ui-0.1.0/frontend/src/overlay.ts +61 -0
- weft_ui-0.1.0/frontend/src/render.test.tsx +160 -0
- weft_ui-0.1.0/frontend/src/render.tsx +76 -0
- weft_ui-0.1.0/frontend/src/scroll.ts +6 -0
- weft_ui-0.1.0/frontend/src/store.ts +187 -0
- weft_ui-0.1.0/frontend/src/streams.test.ts +23 -0
- weft_ui-0.1.0/frontend/src/streams.ts +65 -0
- weft_ui-0.1.0/frontend/src/styles.css +198 -0
- weft_ui-0.1.0/frontend/src/styles.test.ts +27 -0
- weft_ui-0.1.0/frontend/src/styles.ts +161 -0
- weft_ui-0.1.0/frontend/src/theme.ts +42 -0
- weft_ui-0.1.0/frontend/src/wire.ts +44 -0
- weft_ui-0.1.0/frontend/tsconfig.json +18 -0
- weft_ui-0.1.0/frontend/vite.config.ts +92 -0
- weft_ui-0.1.0/hatch_build.py +29 -0
- weft_ui-0.1.0/pyproject.toml +63 -0
- weft_ui-0.1.0/src/weft_ui/__init__.py +172 -0
- weft_ui-0.1.0/src/weft_ui/_block.py +412 -0
- weft_ui-0.1.0/src/weft_ui/_charts.py +409 -0
- weft_ui-0.1.0/src/weft_ui/_chat.py +316 -0
- weft_ui-0.1.0/src/weft_ui/_display.py +577 -0
- weft_ui-0.1.0/src/weft_ui/_forms.py +142 -0
- weft_ui-0.1.0/src/weft_ui/_icons.py +266 -0
- weft_ui-0.1.0/src/weft_ui/_layout.py +475 -0
- weft_ui-0.1.0/src/weft_ui/_marketing.py +263 -0
- weft_ui-0.1.0/src/weft_ui/_navigation.py +241 -0
- weft_ui-0.1.0/src/weft_ui/_nodes.py +2231 -0
- weft_ui-0.1.0/src/weft_ui/_overlays.py +329 -0
- weft_ui-0.1.0/src/weft_ui/_page.py +147 -0
- weft_ui-0.1.0/src/weft_ui/_social.json +1 -0
- weft_ui-0.1.0/src/weft_ui/_style.py +32 -0
- weft_ui-0.1.0/src/weft_ui/_table.py +148 -0
- weft_ui-0.1.0/src/weft_ui/_tree.py +99 -0
- weft_ui-0.1.0/src/weft_ui/_upload.py +160 -0
- weft_ui-0.1.0/src/weft_ui/_wire.py +85 -0
- weft_ui-0.1.0/src/weft_ui/icons/lucide.json.gz +0 -0
- weft_ui-0.1.0/src/weft_ui/icons/tabler.json.gz +0 -0
- weft_ui-0.1.0/src/weft_ui/py.typed +0 -0
- weft_ui-0.1.0/src/weft_ui/pyproject.toml +12 -0
- weft_ui-0.1.0/src/weft_ui/static/chunk--gxUMRzL.js +1 -0
- weft_ui-0.1.0/src/weft_ui/static/chunk-0QYwWBp9.js +5 -0
- weft_ui-0.1.0/src/weft_ui/static/chunk-21HbvanZ.js +1 -0
- weft_ui-0.1.0/src/weft_ui/static/chunk-5lpsNjwR.js +1 -0
- weft_ui-0.1.0/src/weft_ui/static/chunk-B08NRPrW.js +1 -0
- weft_ui-0.1.0/src/weft_ui/static/chunk-B1Z9pqBd.js +1 -0
- weft_ui-0.1.0/src/weft_ui/static/chunk-B2l0eAkF.js +1 -0
- weft_ui-0.1.0/src/weft_ui/static/chunk-B4ar8Mb4.js +1 -0
- weft_ui-0.1.0/src/weft_ui/static/chunk-B5gZQ1MQ.js +1 -0
- weft_ui-0.1.0/src/weft_ui/static/chunk-B6dnFzwM.js +1 -0
- weft_ui-0.1.0/src/weft_ui/static/chunk-BCRKdrea.js +1 -0
- weft_ui-0.1.0/src/weft_ui/static/chunk-BD_BLx4t.js +1 -0
- weft_ui-0.1.0/src/weft_ui/static/chunk-BFD0q6D6.js +1 -0
- weft_ui-0.1.0/src/weft_ui/static/chunk-BKcqAyUr.js +7 -0
- weft_ui-0.1.0/src/weft_ui/static/chunk-BN63N6mo.js +1 -0
- weft_ui-0.1.0/src/weft_ui/static/chunk-BNkdYcMn.js +6 -0
- weft_ui-0.1.0/src/weft_ui/static/chunk-BPzqjXsd.js +1 -0
- weft_ui-0.1.0/src/weft_ui/static/chunk-BYZs-Qnc.js +1 -0
- weft_ui-0.1.0/src/weft_ui/static/chunk-BjXCZ1Zm.js +1 -0
- weft_ui-0.1.0/src/weft_ui/static/chunk-BnbbGKVG.js +1 -0
- weft_ui-0.1.0/src/weft_ui/static/chunk-Brh5FDD9.js +1 -0
- weft_ui-0.1.0/src/weft_ui/static/chunk-BskvQx0x.js +1 -0
- weft_ui-0.1.0/src/weft_ui/static/chunk-BvUxY7bA.js +1 -0
- weft_ui-0.1.0/src/weft_ui/static/chunk-BwWKFnVP.js +2 -0
- weft_ui-0.1.0/src/weft_ui/static/chunk-C2mavYUa.js +1 -0
- weft_ui-0.1.0/src/weft_ui/static/chunk-C4qSufNa.js +1 -0
- weft_ui-0.1.0/src/weft_ui/static/chunk-C5BQa1wB.js +1 -0
- weft_ui-0.1.0/src/weft_ui/static/chunk-CE0REZ1j.js +1 -0
- weft_ui-0.1.0/src/weft_ui/static/chunk-CEYipSgi.js +1 -0
- weft_ui-0.1.0/src/weft_ui/static/chunk-CXdvmI8m.js +15 -0
- weft_ui-0.1.0/src/weft_ui/static/chunk-CZsdZyMT.js +1 -0
- weft_ui-0.1.0/src/weft_ui/static/chunk-CbDctLqM.js +1 -0
- weft_ui-0.1.0/src/weft_ui/static/chunk-Ce1Y4sSj.js +1 -0
- weft_ui-0.1.0/src/weft_ui/static/chunk-Cezp23NZ.js +1 -0
- weft_ui-0.1.0/src/weft_ui/static/chunk-ChZOBmOv.js +1 -0
- weft_ui-0.1.0/src/weft_ui/static/chunk-ChxaCvvQ.js +1 -0
- weft_ui-0.1.0/src/weft_ui/static/chunk-CnHyI2uu.js +1 -0
- weft_ui-0.1.0/src/weft_ui/static/chunk-CwSgymUc.js +1 -0
- weft_ui-0.1.0/src/weft_ui/static/chunk-CwTq6Dzi.js +1 -0
- weft_ui-0.1.0/src/weft_ui/static/chunk-Cza9cDJt.js +1 -0
- weft_ui-0.1.0/src/weft_ui/static/chunk-DE8VnE-o.js +1 -0
- weft_ui-0.1.0/src/weft_ui/static/chunk-DGU3uHKf.js +5 -0
- weft_ui-0.1.0/src/weft_ui/static/chunk-DIJCPYCk.js +1 -0
- weft_ui-0.1.0/src/weft_ui/static/chunk-DMla9Riu.js +1 -0
- weft_ui-0.1.0/src/weft_ui/static/chunk-DRsjBNev.js +1 -0
- weft_ui-0.1.0/src/weft_ui/static/chunk-DUypoC7m.js +1 -0
- weft_ui-0.1.0/src/weft_ui/static/chunk-DYfQ5iaD.js +1 -0
- weft_ui-0.1.0/src/weft_ui/static/chunk-DZRnbrfy.js +1 -0
- weft_ui-0.1.0/src/weft_ui/static/chunk-De7USdX7.js +1 -0
- weft_ui-0.1.0/src/weft_ui/static/chunk-DhtOHcji.js +1 -0
- weft_ui-0.1.0/src/weft_ui/static/chunk-DlY2ovAQ.js +1 -0
- weft_ui-0.1.0/src/weft_ui/static/chunk-DnliWZoB.js +1 -0
- weft_ui-0.1.0/src/weft_ui/static/chunk-Dp_mkdnI.js +10 -0
- weft_ui-0.1.0/src/weft_ui/static/chunk-DqX27U5H.js +1 -0
- weft_ui-0.1.0/src/weft_ui/static/chunk-EqfrW3Fz.js +1 -0
- weft_ui-0.1.0/src/weft_ui/static/chunk-RNzQGsRY.js +1 -0
- weft_ui-0.1.0/src/weft_ui/static/chunk-RgbrCBQ8.js +1 -0
- weft_ui-0.1.0/src/weft_ui/static/chunk-TMVXTkix.js +1 -0
- weft_ui-0.1.0/src/weft_ui/static/chunk-UFEcgRNO.js +1 -0
- weft_ui-0.1.0/src/weft_ui/static/chunk-k4qiW1vh.js +1 -0
- weft_ui-0.1.0/src/weft_ui/static/chunk-lpe48EsX.js +1 -0
- weft_ui-0.1.0/src/weft_ui/static/chunk-lvr72rfA.js +1 -0
- weft_ui-0.1.0/src/weft_ui/static/chunk-sQQGM7il.js +1 -0
- weft_ui-0.1.0/src/weft_ui/static/chunk-vrBhIj2-.js +1 -0
- weft_ui-0.1.0/src/weft_ui/static/chunk-xr5IqJE_.js +1 -0
- weft_ui-0.1.0/src/weft_ui/static/index-CC6C-XgA.js +11 -0
weft_ui-0.1.0/.gitignore
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# Python
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
*.so
|
|
6
|
+
.Python
|
|
7
|
+
*.egg-info/
|
|
8
|
+
.eggs/
|
|
9
|
+
/dist/
|
|
10
|
+
/build/
|
|
11
|
+
.mypy_cache/
|
|
12
|
+
.pytest_cache/
|
|
13
|
+
.ruff_cache/
|
|
14
|
+
.coverage
|
|
15
|
+
htmlcov/
|
|
16
|
+
|
|
17
|
+
# Virtualenvs
|
|
18
|
+
.venv/
|
|
19
|
+
**/.venv/
|
|
20
|
+
venv/
|
|
21
|
+
env/
|
|
22
|
+
|
|
23
|
+
# Frontend
|
|
24
|
+
node_modules/
|
|
25
|
+
# Built bundle. Made by `pnpm -C frontend build` (dev) or the Hatch hook (wheels).
|
|
26
|
+
src/weft_ui/static/
|
|
27
|
+
|
|
28
|
+
# Streamlit
|
|
29
|
+
.streamlit/secrets.toml
|
|
30
|
+
|
|
31
|
+
# Local scratch — probe scripts, screenshots, one-off experiments.
|
|
32
|
+
# Keep debugging aids here instead of beside packaged source.
|
|
33
|
+
/scratch/
|
|
34
|
+
|
|
35
|
+
# Docs site and notes, kept local.
|
|
36
|
+
/docs/template-specs
|
|
37
|
+
|
|
38
|
+
# Agent tooling
|
|
39
|
+
.antigravitycli/
|
|
40
|
+
.hallmark/
|
|
41
|
+
|
|
42
|
+
# Editors / OS
|
|
43
|
+
.idea/
|
|
44
|
+
.vscode/
|
|
45
|
+
.DS_Store
|
|
46
|
+
*.swp
|
|
47
|
+
.dev-server.log
|
|
48
|
+
|
|
49
|
+
# Dev notes and tool output, kept local.
|
|
50
|
+
/research/
|
|
51
|
+
/docs/decisions.md
|
|
52
|
+
.lavish/
|
weft_ui-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Ankit Tripathi
|
|
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.
|
weft_ui-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: weft-ui
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Animated React UI components for Streamlit, rendered without iframes.
|
|
5
|
+
Project-URL: Homepage, https://github.com/ankittripathi1/weft-ui
|
|
6
|
+
Project-URL: Repository, https://github.com/ankittripathi1/weft-ui
|
|
7
|
+
Project-URL: Issues, https://github.com/ankittripathi1/weft-ui/issues
|
|
8
|
+
Author: Ankit Tripathi
|
|
9
|
+
License-Expression: MIT
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
License-File: THIRD_PARTY_LICENSES
|
|
12
|
+
Keywords: components,dashboard,react,streamlit,ui
|
|
13
|
+
Classifier: Development Status :: 3 - Alpha
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
18
|
+
Classifier: Topic :: Software Development :: User Interfaces
|
|
19
|
+
Classifier: Typing :: Typed
|
|
20
|
+
Requires-Python: >=3.12
|
|
21
|
+
Requires-Dist: streamlit<2,>=1.66
|
|
22
|
+
Description-Content-Type: text/markdown
|
|
23
|
+
|
|
24
|
+
# weft-ui
|
|
25
|
+
|
|
26
|
+
Animated React UI components for Streamlit. Each `ui.render()` block is one
|
|
27
|
+
Streamlit component, so nothing runs in an iframe and animations behave like
|
|
28
|
+
they do on the web.
|
|
29
|
+
|
|
30
|
+
## Install
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
pip install weft-ui
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Needs Python 3.12 or newer and Streamlit 1.66 or newer.
|
|
37
|
+
|
|
38
|
+
## First app
|
|
39
|
+
|
|
40
|
+
Put components inside `with ui.render():`. Each one gives its value back as
|
|
41
|
+
a plain Python attribute. Save this as `app.py` and run `streamlit run app.py`.
|
|
42
|
+
|
|
43
|
+
```python
|
|
44
|
+
import weft_ui as ui
|
|
45
|
+
|
|
46
|
+
with ui.render():
|
|
47
|
+
fruit = ui.Select("Fruit", ["Apple", "Banana", "Orange"], value="Banana")
|
|
48
|
+
notify = ui.Switch("Enable notifications", value=True)
|
|
49
|
+
if ui.Button("Save"):
|
|
50
|
+
ui.toast(f"Saved {fruit.value}, notifications={notify.value}")
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Make it yours
|
|
54
|
+
|
|
55
|
+
One call sets the look of the whole app. Every component follows it.
|
|
56
|
+
|
|
57
|
+
```python
|
|
58
|
+
import weft_ui as ui
|
|
59
|
+
|
|
60
|
+
ui.theme(
|
|
61
|
+
accent="#1f5f3f", # buttons, links, focus rings
|
|
62
|
+
gray="#8a7a5c", # warm grays for surfaces, borders, muted text
|
|
63
|
+
radius="none", # square corners everywhere
|
|
64
|
+
font="DM Sans",
|
|
65
|
+
heading_font="Fraunces",
|
|
66
|
+
fonts=["DM Sans:wght@400;500;600", "Fraunces:wght@500;600"],
|
|
67
|
+
background="#f6f1e7",
|
|
68
|
+
)
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Components
|
|
72
|
+
|
|
73
|
+
The component list below is implemented.
|
|
74
|
+
Entries describe what you read back in Python.
|
|
75
|
+
See `examples/demo.py` for component examples and `templates/` for whole apps.
|
|
76
|
+
### Templates
|
|
77
|
+
|
|
78
|
+
Whole apps to start from. Find them in the docs site's Templates section, or
|
|
79
|
+
run one with `scripts/dev.sh templates/<name>.py`.
|
|
80
|
+
|
|
81
|
+
- `templates/ai_chat.py`: a chat app for a model, with saved chats, streaming
|
|
82
|
+
answers, tool steps that show while they run, starter prompts, feedback
|
|
83
|
+
buttons, and model settings. It runs on a demo model; swap `ask_model`.
|
|
84
|
+
- `templates/kpi_dashboard.py`: a sales dashboard on a pandas DataFrame, with a
|
|
85
|
+
filter bar, key numbers compared to the period before, charts, and an orders
|
|
86
|
+
table that opens a details panel.
|
|
87
|
+
- `templates/import_wizard.py`: upload a CSV, map its columns, check the rows,
|
|
88
|
+
and see the results, in four steps.
|
|
89
|
+
- `templates/data_explorer.py`: a CSV analytics workspace with sample sales data,
|
|
90
|
+
light and dark themes, CSV import, metric and group selection, date filters,
|
|
91
|
+
charts with totals and stable hover values, customer avatars, channel badges,
|
|
92
|
+
analysis lenses, command search, contextual filters, and record drawers with
|
|
93
|
+
customer history. Its docs preview is the working Weft UI and follows the docs theme.
|
|
94
|
+
- `templates/crm.py`, `templates/social_analytics.py`, `templates/account_settings.py`:
|
|
95
|
+
a customer list, a social dashboard, and a settings page.
|
|
96
|
+
|
|
97
|
+
### Layout
|
|
98
|
+
|
|
99
|
+
- [x] `ui.theme()`: the look of every block, set once: accent, gray tint, corner radius, fonts, surface and border colors, page background, and light or dark
|
|
100
|
+
- [x] `ui.page()`: page background, Google Fonts, full bleed, and hidden Streamlit chrome, for landing pages
|
|
101
|
+
- [x] `ui.render()`: one block; its own theme, accent, and font win over `ui.theme()`
|
|
102
|
+
- [x] `ui.Text`: size and mobile_size (scale or pixels), color, font, tracking, unitless line height, and inline markup
|
|
103
|
+
- [x] `ui.Stack`: nothing (a row or column; use it with `with`); alignment, wrapping, sizing, and mobile direction
|
|
104
|
+
- [x] `ui.Tabs`: panels to fill with `with`, `.value` (the open tab); underline or pill look, a tab-list name, disabled tabs, and autoplay with a pause button
|
|
105
|
+
- [x] `ui.Divider`: nothing (a line, with an optional label that wraps and still reads as one separator)
|
|
106
|
+
- [x] `ui.Carousel`: scroll-snap slides, arrows, dots with 24px tap areas, and autoplay with a pause button
|
|
107
|
+
- [x] `ui.Box`: responsive padding/visibility, edge borders, pixel radius, positioned layers, and backgrounds
|
|
108
|
+
- [x] `ui.Grid`: responsive columns, column spans, and gaps
|
|
109
|
+
- [x] `ui.Card`: a surface built on `Box`, including responsive padding and decoration layers
|
|
110
|
+
- [x] `ui.Accordion`: lined, contained, or separated sections, item icons and descriptions, chevron or plus sign, three sizes, and an eased open
|
|
111
|
+
|
|
112
|
+
- [x] `ui.Navbar`: `.clicked`, `on_click`; height, colors, separators, and inline mobile actions
|
|
113
|
+
- [x] `ui.Section`: a page band with anchor id, a screen-reader name, centered content, and spacing
|
|
114
|
+
- [x] `ui.Reveal`: scroll reveals with stagger, instant reveal on keyboard focus, and reduced-motion support
|
|
115
|
+
- [x] `ui.Marquee`: seamless horizontal or vertical scrolling content, with a pause button
|
|
116
|
+
- [x] `ui.BrowserFrame`: browser chrome around screenshots or content
|
|
117
|
+
|
|
118
|
+
### Buttons and menus
|
|
119
|
+
|
|
120
|
+
- [x] `ui.Button`: `.clicked`, `on_click`; large size, full width, inverse variant, radius, `loading`, and `url` (a real link); `icon=` takes any icon (see Icons below)
|
|
121
|
+
- [x] `ui.IconButton`: `.clicked`, `on_click`
|
|
122
|
+
- [x] `ui.LinkButton`: `.clicked`, `on_click`; with `url` it's a real link ("#id" scrolls); unsafe URLs are ignored
|
|
123
|
+
- [x] `ui.ButtonGroup`: `.clicked` (the item clicked), `on_click`
|
|
124
|
+
- [x] `ui.SocialButton`: `.clicked`, `on_click`; 24 providers, with `url` it's a link
|
|
125
|
+
- [x] `ui.Dropdown`: `.clicked` (the item picked), `on_click`; a keyboard menu (arrows, typeahead), disabled and danger items, check on `selected`
|
|
126
|
+
- [x] `ui.Breadcrumb`: `.clicked` (the item clicked), `on_click`; `(label, url)` links and `max_items` folding
|
|
127
|
+
- [x] `ui.Pagination`: `.value` (the page, from 1), `.changed`, `on_change`; custom Previous/Next labels
|
|
128
|
+
- [x] `ui.Nav`, `ui.NavItem`: navigation inside `ui.Sidebar` or any container; `Nav.value` / `.changed`, `NavItem.clicked`; URL items are real links
|
|
129
|
+
- [x] `ui.Sidebar`: `.collapsed`, `.changed`; inline or fixed, collapsible to icons, and a phone drawer that keeps focus inside and gives it back on close
|
|
130
|
+
- [x] `ui.Popover`: `.open`, `.changed`; arbitrary content anchored to a trigger; `on_change` reports open changes immediately
|
|
131
|
+
- [x] `ui.Dialog`: `.open`, `.changed`; modal content with focus management, `width`, `close_on_outside_click`, and `trigger=False` for opening from another interaction
|
|
132
|
+
- [x] `ui.Drawer`: `.open`, `.changed`; a modal side panel for forms and record details, with `width`, `close_on_outside_click`, and `trigger=False` for opening from another interaction
|
|
133
|
+
- [x] `ui.CommandMenu`: `.clicked`, `on_click`; searchable commands in a modal
|
|
134
|
+
|
|
135
|
+
### Form fields
|
|
136
|
+
|
|
137
|
+
- [x] `ui.Switch`: `.value`, `.changed`, `on_change`
|
|
138
|
+
- [x] `ui.Checkbox`: `.value`, `.changed`, `on_change`
|
|
139
|
+
- [x] `ui.Radio`: `.value` (the chosen option), `.changed`, `on_change`
|
|
140
|
+
- [x] `ui.Select`: `.value` (an option, None, or a list with `multiple=True`); `searchable=True` filters options, `disabled_options`, `.changed`, `on_change`
|
|
141
|
+
- [x] `ui.SegmentedControl`: `.value` (the chosen option), `.changed`, `on_change`
|
|
142
|
+
- [x] `ui.Input`: `.value`, `.changed`, `.submitted` (Enter, not during IME input), `on_change`, `on_submit`; `autocomplete`
|
|
143
|
+
- [x] `ui.OTPInput`: `.value` (digits so far), `.completed` (last box filled), `on_change`, `on_complete`
|
|
144
|
+
- [x] `ui.Textarea`: `.value`, `.changed`, `on_change`
|
|
145
|
+
- [x] `ui.Slider`: `.value`, `.changed`, `on_change`
|
|
146
|
+
- [x] `ui.RangeSlider`: `.value` (a `(low, high)` tuple), `.changed`, `on_change`; `thumb_labels`
|
|
147
|
+
- [x] `ui.DatePicker`: `.value` (a `datetime.date`, or None), `.changed`, `on_change`; limits checked on typed dates and in Python, `clearable`
|
|
148
|
+
- [x] `ui.DateRangePicker`: `.value` (a `(start, end)` tuple of dates, or None), `.changed`, `on_change`; custom presets, limits on every entry path, one month on phones, `clearable`
|
|
149
|
+
- [x] `ui.MeetingScheduler`: `.value` (the picked `datetime.datetime`, or None), `.changed`, `on_change`; checked slots and intervals, stacked layout on phones
|
|
150
|
+
- [x] `ui.FileUpload`: `.file` and `.files` (readable like `BytesIO`), `.uploaded`, `.error`, `on_upload`, `clear()`, `remove()`; Python rechecks size and type
|
|
151
|
+
- [x] `ui.Form`: `.submitted`, `on_submit`; edits stay local until its submit button is pressed
|
|
152
|
+
- [x] `ui.NumberInput`: `.value`, `.changed`, `on_change`; numeric bounds, step controls, size, and label visibility
|
|
153
|
+
|
|
154
|
+
### Data
|
|
155
|
+
|
|
156
|
+
- [x] `ui.Table`: `.selected_rows` (positions in your data), `.changed`, `on_change`; `.action` / `on_action` for row actions; `column_config` accepts `ui.TableColumn` with colored avatars and chips; `row_key` keeps a selection on its rows
|
|
157
|
+
- [x] `ui.Tree`: `.selected` (ids like `"src/app.py"`), `.changed`, `on_change`
|
|
158
|
+
- [x] `ui.LineChart`: trends across an ordered axis, with number formats and `summary`
|
|
159
|
+
- [x] `ui.AreaChart`: filled trends, including stacked series, with number formats, `summary`, and a stable plot height while exploring values
|
|
160
|
+
- [x] `ui.BarChart`: grouped, stacked, and horizontal bars, with number formats and dense-data scrolling
|
|
161
|
+
- [x] `ui.DonutChart`: part-to-whole summaries, number formats, and an "Other" slice with `max_slices`
|
|
162
|
+
- [x] `ui.Heatmap`: values shown as a grid of colored cells, a numeric scale, units, and sideways scroll for dense grids
|
|
163
|
+
- [x] `ui.Sparkline`: a compact trend for cards and tables, with a one-line spoken summary
|
|
164
|
+
|
|
165
|
+
### Display
|
|
166
|
+
|
|
167
|
+
- [x] `ui.Badge`, `ui.Chip`, `ui.StatusDot`, `ui.Kbd`: nothing (small labels; long text ends in "…"; StatusDot `alt` for screen readers)
|
|
168
|
+
- [x] `ui.Avatar`, `ui.AvatarGroup`: a photo or initials, initials fallback when the image fails, status badge, overlapping groups with a "+N" or icon count, and an avatar as a `ui.Dropdown` trigger (`avatar=`)
|
|
169
|
+
- [x] `ui.Tooltip`: nothing (use it with `with` around the nodes it explains); describes the focused child and can be hovered
|
|
170
|
+
- [x] `ui.Heading`: semantic levels with responsive Text sizing, highlights, links, gradients, and an `anchor` id
|
|
171
|
+
- [x] `ui.Link`: inline links, icons, `new_tab`, a focus ring, and shadow-root anchor scrolling
|
|
172
|
+
- [x] `ui.List`: feature lists with independent marker and text colors
|
|
173
|
+
- [x] `ui.Icon`: standalone icons, including size and color
|
|
174
|
+
- [x] `ui.Image`: alternative text, intrinsic pixel dimensions, fit, fades, pixel radius, shadow, tilt, border, and `loading="eager"`
|
|
175
|
+
- [x] `ui.Code`: a code block with a copy button (says when copying fails), colors for Python, JavaScript/TypeScript, JSON, SQL, shell, YAML and HTML, title bar, line numbers, and collapsing
|
|
176
|
+
- [x] `ui.Stat`: a key number on a card, with its change (green or red by `increase=`), an icon tile, and a small trend line
|
|
177
|
+
- [x] `ui.Alert`: a colored message in the page (info, success, warning, error, neutral); fill it with `with` to add buttons
|
|
178
|
+
- [x] `ui.Stepper`: progress through a flow with several steps, horizontal or vertical, with descriptions
|
|
179
|
+
- [x] `ui.EmptyState`: a placeholder with an icon, a title, a description, and your buttons
|
|
180
|
+
|
|
181
|
+
### AI
|
|
182
|
+
|
|
183
|
+
- [x] `ui.Markdown`: `.text`; headings, lists, tables, quotes, links and code blocks, with raw HTML shown as text. Pass a generator, or an OpenAI, Anthropic or LangChain stream, and the text shows as it arrives with no rerun; `on_text` keeps a partial answer
|
|
184
|
+
- [x] `ui.Chat`: the scrolling message list; it follows a streaming answer and stops when the reader scrolls up
|
|
185
|
+
- [x] `ui.ChatMessage`: `.retried`, `.feedback`; a bubble for the user, full width for the reply, avatar and name, and copy, retry, like and dislike buttons
|
|
186
|
+
- [x] `ui.ChatInput`: `.value` (the message, on the run it was sent), `.stopped`, `.files`, `.error`; Enter sends, Shift+Enter adds a line, Stop shows while an answer streams, and files can be attached
|
|
187
|
+
- [x] `ui.Step`: a tool call or other step behind an answer: running, done, error or pending, with details that open on click
|
|
188
|
+
|
|
189
|
+
To show work while it happens, keep the block and draw it again. A redraw
|
|
190
|
+
needs no rerun:
|
|
191
|
+
|
|
192
|
+
```python
|
|
193
|
+
block = ui.render(key="agent")
|
|
194
|
+
for step in plan:
|
|
195
|
+
with block:
|
|
196
|
+
draw(done_so_far, running=step)
|
|
197
|
+
run(step)
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
### Feedback
|
|
201
|
+
|
|
202
|
+
- [x] `ui.Announcement`: `.action_clicked`, `.closed`, `on_action`, `on_close`
|
|
203
|
+
- [x] `ui.Notification`: `.action` (the button clicked), `.closed`, `on_action`, `on_close`; auto-close waits while hovered or focused
|
|
204
|
+
- [x] `ui.toast()`: nothing (fire and forget, like `st.toast`); at most five, repeats replaced, paused while hovered
|
|
205
|
+
- [x] `ui.NumberTicker`: scroll-triggered count-up, digit grouping, a final value for screen readers, and reduced-motion support
|
|
206
|
+
- [x] `ui.Progress`: determinate completion indicators
|
|
207
|
+
- [x] `ui.Spinner`: indeterminate loading feedback
|
|
208
|
+
- [x] `ui.Skeleton`: loading placeholders for content
|
|
209
|
+
|
|
210
|
+
Layout spacing uses a four-pixel scale; numeric widths and heights use pixels.
|
|
211
|
+
Grid breakpoints follow the render block's width: mobile below 640px, tablet
|
|
212
|
+
from 640px, desktop from 1024px. Components nest using `with`; fill Sidebar
|
|
213
|
+
with `sidebar.header()`, `sidebar.body()`, and `sidebar.footer()`, and Accordion
|
|
214
|
+
with `accordion.item("Title")`.
|
|
215
|
+
|
|
216
|
+
Charts accept the same tabular inputs as Table. Use `x="Category"` and
|
|
217
|
+
`y="Value"` (or a list of series columns) for line, area, and bar charts.
|
|
218
|
+
Line and bar charts take `compare="Last year"` to show a gray baseline and the change against it.
|
|
219
|
+
BarChart also takes `summary="sum" | "mean" | "none"` for the header number,
|
|
220
|
+
`format="number" | "percent" | "USD"` (percent values are fractions: 0.25 is 25%),
|
|
221
|
+
`decimals=`, and `increase="good" | "bad" | "neutral"` for the change chip colors.
|
|
222
|
+
DonutChart takes `name=` and `value=` columns; Heatmap takes `x=`, `y=`, and
|
|
223
|
+
`value=` columns; Sparkline takes a sequence of numbers. Full charts include
|
|
224
|
+
an expandable data table. Use `show_title=False` under a custom card header;
|
|
225
|
+
`title` still labels the chart for assistive technology. Fill missing numeric values before charting.
|
|
226
|
+
|
|
227
|
+
Sizes use `sm` / `md` / `lg` where supported; buttons and avatars also have
|
|
228
|
+
`xs`. Text and headings use a separate typography scale; standalone icon
|
|
229
|
+
sizes are pixels. Every `color` takes a palette name such as `orange`,
|
|
230
|
+
`purple`, `green`, or `accent`, or any CSS color like `"#f97316"` or
|
|
231
|
+
`"rgb(0 0 0 / 50%)"`. Use `Box` for styled containers and `Sidebar` for an app's side
|
|
232
|
+
panel (`position="fixed"` pins it to the window); navigation inside it is
|
|
233
|
+
composed with `Nav`, `NavGroup`, and `NavItem`.
|
|
234
|
+
|
|
235
|
+
Overlay triggers accept the same `variant`, `size`, `icon`, and `icon_only`
|
|
236
|
+
options as buttons. Pass `on_change` when Python should rerun immediately
|
|
237
|
+
on open/close; otherwise open state stays local until the next interaction.
|
|
238
|
+
|
|
239
|
+
### Icons
|
|
240
|
+
|
|
241
|
+
Every `icon=` takes any of these:
|
|
242
|
+
|
|
243
|
+
| Form | Example | Where to find names |
|
|
244
|
+
|---|---|---|
|
|
245
|
+
| Iconify name | `"lucide:home"`, `"mdi:github"` | [icon-sets.iconify.design](https://icon-sets.iconify.design): search, click, copy the name |
|
|
246
|
+
| Material Symbol | `":material/home:"` | [fonts.google.com/icons](https://fonts.google.com/icons) |
|
|
247
|
+
| Emoji or symbol | `"🚀"`, `"★"`, `"→"` | copy and paste |
|
|
248
|
+
| SVG markup | `'<svg viewBox="0 0 24 24">...</svg>'` | any SVG; it follows the text color when it uses `currentColor` |
|
|
249
|
+
| Image link or file | `"https://.../logo.png"`, `"assets/logo.svg"` | your own files |
|
|
250
|
+
|
|
251
|
+
Lucide and Tabler ship inside the package and work offline. Any other
|
|
252
|
+
Iconify set downloads the first time you use it and is saved in
|
|
253
|
+
`~/.cache/weft-ui/icons`. A wrong name fails with a "did you mean" hint.
|
|
254
|
+
|
|
255
|
+
## Remaining work
|
|
256
|
+
|
|
257
|
+
- [x] Follow the app's `primaryColor` (an app that keeps Streamlit's default red gets the blue accent)
|
|
258
|
+
- [x] Build the wheel and sdist, install the wheel in a fresh venv, and run the demo from it
|
|
259
|
+
- [x] Add the project's own `LICENSE` file (MIT, with the copyright holder's name)
|
|
260
|
+
- [ ] Publish to TestPyPI, then PyPI
|
|
261
|
+
|
|
262
|
+
- [ ] Responsive behavior: make layouts, tables, and navigation usable on narrow screens
|
|
263
|
+
- [ ] New and extended components: support relevant loading, empty, error, disabled, and selected states
|
|
264
|
+
- [ ] New and extended interactions: keyboard access, focus handling, accessible labels, and predictable keys/reruns
|
|
265
|
+
|
|
266
|
+
Build screen examples from these primitives before adding dedicated components:
|
|
267
|
+
|
|
268
|
+
- [x] Dashboard with metric cards, chart panels, filters, and a rich table
|
|
269
|
+
- [x] Settings page with grouped fields, form submission, and feedback
|
|
270
|
+
- [x] Record details with a page header, label/value rows, composed avatars, and an edit drawer
|
|
271
|
+
- [x] Empty and loading screens using cards, text, icons, skeletons, and actions
|
|
272
|
+
|
|
273
|
+
## Development
|
|
274
|
+
|
|
275
|
+
```
|
|
276
|
+
scripts/dev.sh # build, then run on http://localhost:8501
|
|
277
|
+
scripts/dev.sh templates/crm.py # a full app; see templates/ for more
|
|
278
|
+
scripts/dev.sh docs/app.py # the docs site: templates, blocks, and components
|
|
279
|
+
scripts/dev.sh --ngrok # also print a public ngrok URL
|
|
280
|
+
PORT=8601 scripts/dev.sh app.py
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
The script builds the components once, then starts the app. Nothing reloads by
|
|
284
|
+
itself. After a change, press Ctrl+C and run it again.
|
weft_ui-0.1.0/README.md
ADDED
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
# weft-ui
|
|
2
|
+
|
|
3
|
+
Animated React UI components for Streamlit. Each `ui.render()` block is one
|
|
4
|
+
Streamlit component, so nothing runs in an iframe and animations behave like
|
|
5
|
+
they do on the web.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
pip install weft-ui
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Needs Python 3.12 or newer and Streamlit 1.66 or newer.
|
|
14
|
+
|
|
15
|
+
## First app
|
|
16
|
+
|
|
17
|
+
Put components inside `with ui.render():`. Each one gives its value back as
|
|
18
|
+
a plain Python attribute. Save this as `app.py` and run `streamlit run app.py`.
|
|
19
|
+
|
|
20
|
+
```python
|
|
21
|
+
import weft_ui as ui
|
|
22
|
+
|
|
23
|
+
with ui.render():
|
|
24
|
+
fruit = ui.Select("Fruit", ["Apple", "Banana", "Orange"], value="Banana")
|
|
25
|
+
notify = ui.Switch("Enable notifications", value=True)
|
|
26
|
+
if ui.Button("Save"):
|
|
27
|
+
ui.toast(f"Saved {fruit.value}, notifications={notify.value}")
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Make it yours
|
|
31
|
+
|
|
32
|
+
One call sets the look of the whole app. Every component follows it.
|
|
33
|
+
|
|
34
|
+
```python
|
|
35
|
+
import weft_ui as ui
|
|
36
|
+
|
|
37
|
+
ui.theme(
|
|
38
|
+
accent="#1f5f3f", # buttons, links, focus rings
|
|
39
|
+
gray="#8a7a5c", # warm grays for surfaces, borders, muted text
|
|
40
|
+
radius="none", # square corners everywhere
|
|
41
|
+
font="DM Sans",
|
|
42
|
+
heading_font="Fraunces",
|
|
43
|
+
fonts=["DM Sans:wght@400;500;600", "Fraunces:wght@500;600"],
|
|
44
|
+
background="#f6f1e7",
|
|
45
|
+
)
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Components
|
|
49
|
+
|
|
50
|
+
The component list below is implemented.
|
|
51
|
+
Entries describe what you read back in Python.
|
|
52
|
+
See `examples/demo.py` for component examples and `templates/` for whole apps.
|
|
53
|
+
### Templates
|
|
54
|
+
|
|
55
|
+
Whole apps to start from. Find them in the docs site's Templates section, or
|
|
56
|
+
run one with `scripts/dev.sh templates/<name>.py`.
|
|
57
|
+
|
|
58
|
+
- `templates/ai_chat.py`: a chat app for a model, with saved chats, streaming
|
|
59
|
+
answers, tool steps that show while they run, starter prompts, feedback
|
|
60
|
+
buttons, and model settings. It runs on a demo model; swap `ask_model`.
|
|
61
|
+
- `templates/kpi_dashboard.py`: a sales dashboard on a pandas DataFrame, with a
|
|
62
|
+
filter bar, key numbers compared to the period before, charts, and an orders
|
|
63
|
+
table that opens a details panel.
|
|
64
|
+
- `templates/import_wizard.py`: upload a CSV, map its columns, check the rows,
|
|
65
|
+
and see the results, in four steps.
|
|
66
|
+
- `templates/data_explorer.py`: a CSV analytics workspace with sample sales data,
|
|
67
|
+
light and dark themes, CSV import, metric and group selection, date filters,
|
|
68
|
+
charts with totals and stable hover values, customer avatars, channel badges,
|
|
69
|
+
analysis lenses, command search, contextual filters, and record drawers with
|
|
70
|
+
customer history. Its docs preview is the working Weft UI and follows the docs theme.
|
|
71
|
+
- `templates/crm.py`, `templates/social_analytics.py`, `templates/account_settings.py`:
|
|
72
|
+
a customer list, a social dashboard, and a settings page.
|
|
73
|
+
|
|
74
|
+
### Layout
|
|
75
|
+
|
|
76
|
+
- [x] `ui.theme()`: the look of every block, set once: accent, gray tint, corner radius, fonts, surface and border colors, page background, and light or dark
|
|
77
|
+
- [x] `ui.page()`: page background, Google Fonts, full bleed, and hidden Streamlit chrome, for landing pages
|
|
78
|
+
- [x] `ui.render()`: one block; its own theme, accent, and font win over `ui.theme()`
|
|
79
|
+
- [x] `ui.Text`: size and mobile_size (scale or pixels), color, font, tracking, unitless line height, and inline markup
|
|
80
|
+
- [x] `ui.Stack`: nothing (a row or column; use it with `with`); alignment, wrapping, sizing, and mobile direction
|
|
81
|
+
- [x] `ui.Tabs`: panels to fill with `with`, `.value` (the open tab); underline or pill look, a tab-list name, disabled tabs, and autoplay with a pause button
|
|
82
|
+
- [x] `ui.Divider`: nothing (a line, with an optional label that wraps and still reads as one separator)
|
|
83
|
+
- [x] `ui.Carousel`: scroll-snap slides, arrows, dots with 24px tap areas, and autoplay with a pause button
|
|
84
|
+
- [x] `ui.Box`: responsive padding/visibility, edge borders, pixel radius, positioned layers, and backgrounds
|
|
85
|
+
- [x] `ui.Grid`: responsive columns, column spans, and gaps
|
|
86
|
+
- [x] `ui.Card`: a surface built on `Box`, including responsive padding and decoration layers
|
|
87
|
+
- [x] `ui.Accordion`: lined, contained, or separated sections, item icons and descriptions, chevron or plus sign, three sizes, and an eased open
|
|
88
|
+
|
|
89
|
+
- [x] `ui.Navbar`: `.clicked`, `on_click`; height, colors, separators, and inline mobile actions
|
|
90
|
+
- [x] `ui.Section`: a page band with anchor id, a screen-reader name, centered content, and spacing
|
|
91
|
+
- [x] `ui.Reveal`: scroll reveals with stagger, instant reveal on keyboard focus, and reduced-motion support
|
|
92
|
+
- [x] `ui.Marquee`: seamless horizontal or vertical scrolling content, with a pause button
|
|
93
|
+
- [x] `ui.BrowserFrame`: browser chrome around screenshots or content
|
|
94
|
+
|
|
95
|
+
### Buttons and menus
|
|
96
|
+
|
|
97
|
+
- [x] `ui.Button`: `.clicked`, `on_click`; large size, full width, inverse variant, radius, `loading`, and `url` (a real link); `icon=` takes any icon (see Icons below)
|
|
98
|
+
- [x] `ui.IconButton`: `.clicked`, `on_click`
|
|
99
|
+
- [x] `ui.LinkButton`: `.clicked`, `on_click`; with `url` it's a real link ("#id" scrolls); unsafe URLs are ignored
|
|
100
|
+
- [x] `ui.ButtonGroup`: `.clicked` (the item clicked), `on_click`
|
|
101
|
+
- [x] `ui.SocialButton`: `.clicked`, `on_click`; 24 providers, with `url` it's a link
|
|
102
|
+
- [x] `ui.Dropdown`: `.clicked` (the item picked), `on_click`; a keyboard menu (arrows, typeahead), disabled and danger items, check on `selected`
|
|
103
|
+
- [x] `ui.Breadcrumb`: `.clicked` (the item clicked), `on_click`; `(label, url)` links and `max_items` folding
|
|
104
|
+
- [x] `ui.Pagination`: `.value` (the page, from 1), `.changed`, `on_change`; custom Previous/Next labels
|
|
105
|
+
- [x] `ui.Nav`, `ui.NavItem`: navigation inside `ui.Sidebar` or any container; `Nav.value` / `.changed`, `NavItem.clicked`; URL items are real links
|
|
106
|
+
- [x] `ui.Sidebar`: `.collapsed`, `.changed`; inline or fixed, collapsible to icons, and a phone drawer that keeps focus inside and gives it back on close
|
|
107
|
+
- [x] `ui.Popover`: `.open`, `.changed`; arbitrary content anchored to a trigger; `on_change` reports open changes immediately
|
|
108
|
+
- [x] `ui.Dialog`: `.open`, `.changed`; modal content with focus management, `width`, `close_on_outside_click`, and `trigger=False` for opening from another interaction
|
|
109
|
+
- [x] `ui.Drawer`: `.open`, `.changed`; a modal side panel for forms and record details, with `width`, `close_on_outside_click`, and `trigger=False` for opening from another interaction
|
|
110
|
+
- [x] `ui.CommandMenu`: `.clicked`, `on_click`; searchable commands in a modal
|
|
111
|
+
|
|
112
|
+
### Form fields
|
|
113
|
+
|
|
114
|
+
- [x] `ui.Switch`: `.value`, `.changed`, `on_change`
|
|
115
|
+
- [x] `ui.Checkbox`: `.value`, `.changed`, `on_change`
|
|
116
|
+
- [x] `ui.Radio`: `.value` (the chosen option), `.changed`, `on_change`
|
|
117
|
+
- [x] `ui.Select`: `.value` (an option, None, or a list with `multiple=True`); `searchable=True` filters options, `disabled_options`, `.changed`, `on_change`
|
|
118
|
+
- [x] `ui.SegmentedControl`: `.value` (the chosen option), `.changed`, `on_change`
|
|
119
|
+
- [x] `ui.Input`: `.value`, `.changed`, `.submitted` (Enter, not during IME input), `on_change`, `on_submit`; `autocomplete`
|
|
120
|
+
- [x] `ui.OTPInput`: `.value` (digits so far), `.completed` (last box filled), `on_change`, `on_complete`
|
|
121
|
+
- [x] `ui.Textarea`: `.value`, `.changed`, `on_change`
|
|
122
|
+
- [x] `ui.Slider`: `.value`, `.changed`, `on_change`
|
|
123
|
+
- [x] `ui.RangeSlider`: `.value` (a `(low, high)` tuple), `.changed`, `on_change`; `thumb_labels`
|
|
124
|
+
- [x] `ui.DatePicker`: `.value` (a `datetime.date`, or None), `.changed`, `on_change`; limits checked on typed dates and in Python, `clearable`
|
|
125
|
+
- [x] `ui.DateRangePicker`: `.value` (a `(start, end)` tuple of dates, or None), `.changed`, `on_change`; custom presets, limits on every entry path, one month on phones, `clearable`
|
|
126
|
+
- [x] `ui.MeetingScheduler`: `.value` (the picked `datetime.datetime`, or None), `.changed`, `on_change`; checked slots and intervals, stacked layout on phones
|
|
127
|
+
- [x] `ui.FileUpload`: `.file` and `.files` (readable like `BytesIO`), `.uploaded`, `.error`, `on_upload`, `clear()`, `remove()`; Python rechecks size and type
|
|
128
|
+
- [x] `ui.Form`: `.submitted`, `on_submit`; edits stay local until its submit button is pressed
|
|
129
|
+
- [x] `ui.NumberInput`: `.value`, `.changed`, `on_change`; numeric bounds, step controls, size, and label visibility
|
|
130
|
+
|
|
131
|
+
### Data
|
|
132
|
+
|
|
133
|
+
- [x] `ui.Table`: `.selected_rows` (positions in your data), `.changed`, `on_change`; `.action` / `on_action` for row actions; `column_config` accepts `ui.TableColumn` with colored avatars and chips; `row_key` keeps a selection on its rows
|
|
134
|
+
- [x] `ui.Tree`: `.selected` (ids like `"src/app.py"`), `.changed`, `on_change`
|
|
135
|
+
- [x] `ui.LineChart`: trends across an ordered axis, with number formats and `summary`
|
|
136
|
+
- [x] `ui.AreaChart`: filled trends, including stacked series, with number formats, `summary`, and a stable plot height while exploring values
|
|
137
|
+
- [x] `ui.BarChart`: grouped, stacked, and horizontal bars, with number formats and dense-data scrolling
|
|
138
|
+
- [x] `ui.DonutChart`: part-to-whole summaries, number formats, and an "Other" slice with `max_slices`
|
|
139
|
+
- [x] `ui.Heatmap`: values shown as a grid of colored cells, a numeric scale, units, and sideways scroll for dense grids
|
|
140
|
+
- [x] `ui.Sparkline`: a compact trend for cards and tables, with a one-line spoken summary
|
|
141
|
+
|
|
142
|
+
### Display
|
|
143
|
+
|
|
144
|
+
- [x] `ui.Badge`, `ui.Chip`, `ui.StatusDot`, `ui.Kbd`: nothing (small labels; long text ends in "…"; StatusDot `alt` for screen readers)
|
|
145
|
+
- [x] `ui.Avatar`, `ui.AvatarGroup`: a photo or initials, initials fallback when the image fails, status badge, overlapping groups with a "+N" or icon count, and an avatar as a `ui.Dropdown` trigger (`avatar=`)
|
|
146
|
+
- [x] `ui.Tooltip`: nothing (use it with `with` around the nodes it explains); describes the focused child and can be hovered
|
|
147
|
+
- [x] `ui.Heading`: semantic levels with responsive Text sizing, highlights, links, gradients, and an `anchor` id
|
|
148
|
+
- [x] `ui.Link`: inline links, icons, `new_tab`, a focus ring, and shadow-root anchor scrolling
|
|
149
|
+
- [x] `ui.List`: feature lists with independent marker and text colors
|
|
150
|
+
- [x] `ui.Icon`: standalone icons, including size and color
|
|
151
|
+
- [x] `ui.Image`: alternative text, intrinsic pixel dimensions, fit, fades, pixel radius, shadow, tilt, border, and `loading="eager"`
|
|
152
|
+
- [x] `ui.Code`: a code block with a copy button (says when copying fails), colors for Python, JavaScript/TypeScript, JSON, SQL, shell, YAML and HTML, title bar, line numbers, and collapsing
|
|
153
|
+
- [x] `ui.Stat`: a key number on a card, with its change (green or red by `increase=`), an icon tile, and a small trend line
|
|
154
|
+
- [x] `ui.Alert`: a colored message in the page (info, success, warning, error, neutral); fill it with `with` to add buttons
|
|
155
|
+
- [x] `ui.Stepper`: progress through a flow with several steps, horizontal or vertical, with descriptions
|
|
156
|
+
- [x] `ui.EmptyState`: a placeholder with an icon, a title, a description, and your buttons
|
|
157
|
+
|
|
158
|
+
### AI
|
|
159
|
+
|
|
160
|
+
- [x] `ui.Markdown`: `.text`; headings, lists, tables, quotes, links and code blocks, with raw HTML shown as text. Pass a generator, or an OpenAI, Anthropic or LangChain stream, and the text shows as it arrives with no rerun; `on_text` keeps a partial answer
|
|
161
|
+
- [x] `ui.Chat`: the scrolling message list; it follows a streaming answer and stops when the reader scrolls up
|
|
162
|
+
- [x] `ui.ChatMessage`: `.retried`, `.feedback`; a bubble for the user, full width for the reply, avatar and name, and copy, retry, like and dislike buttons
|
|
163
|
+
- [x] `ui.ChatInput`: `.value` (the message, on the run it was sent), `.stopped`, `.files`, `.error`; Enter sends, Shift+Enter adds a line, Stop shows while an answer streams, and files can be attached
|
|
164
|
+
- [x] `ui.Step`: a tool call or other step behind an answer: running, done, error or pending, with details that open on click
|
|
165
|
+
|
|
166
|
+
To show work while it happens, keep the block and draw it again. A redraw
|
|
167
|
+
needs no rerun:
|
|
168
|
+
|
|
169
|
+
```python
|
|
170
|
+
block = ui.render(key="agent")
|
|
171
|
+
for step in plan:
|
|
172
|
+
with block:
|
|
173
|
+
draw(done_so_far, running=step)
|
|
174
|
+
run(step)
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
### Feedback
|
|
178
|
+
|
|
179
|
+
- [x] `ui.Announcement`: `.action_clicked`, `.closed`, `on_action`, `on_close`
|
|
180
|
+
- [x] `ui.Notification`: `.action` (the button clicked), `.closed`, `on_action`, `on_close`; auto-close waits while hovered or focused
|
|
181
|
+
- [x] `ui.toast()`: nothing (fire and forget, like `st.toast`); at most five, repeats replaced, paused while hovered
|
|
182
|
+
- [x] `ui.NumberTicker`: scroll-triggered count-up, digit grouping, a final value for screen readers, and reduced-motion support
|
|
183
|
+
- [x] `ui.Progress`: determinate completion indicators
|
|
184
|
+
- [x] `ui.Spinner`: indeterminate loading feedback
|
|
185
|
+
- [x] `ui.Skeleton`: loading placeholders for content
|
|
186
|
+
|
|
187
|
+
Layout spacing uses a four-pixel scale; numeric widths and heights use pixels.
|
|
188
|
+
Grid breakpoints follow the render block's width: mobile below 640px, tablet
|
|
189
|
+
from 640px, desktop from 1024px. Components nest using `with`; fill Sidebar
|
|
190
|
+
with `sidebar.header()`, `sidebar.body()`, and `sidebar.footer()`, and Accordion
|
|
191
|
+
with `accordion.item("Title")`.
|
|
192
|
+
|
|
193
|
+
Charts accept the same tabular inputs as Table. Use `x="Category"` and
|
|
194
|
+
`y="Value"` (or a list of series columns) for line, area, and bar charts.
|
|
195
|
+
Line and bar charts take `compare="Last year"` to show a gray baseline and the change against it.
|
|
196
|
+
BarChart also takes `summary="sum" | "mean" | "none"` for the header number,
|
|
197
|
+
`format="number" | "percent" | "USD"` (percent values are fractions: 0.25 is 25%),
|
|
198
|
+
`decimals=`, and `increase="good" | "bad" | "neutral"` for the change chip colors.
|
|
199
|
+
DonutChart takes `name=` and `value=` columns; Heatmap takes `x=`, `y=`, and
|
|
200
|
+
`value=` columns; Sparkline takes a sequence of numbers. Full charts include
|
|
201
|
+
an expandable data table. Use `show_title=False` under a custom card header;
|
|
202
|
+
`title` still labels the chart for assistive technology. Fill missing numeric values before charting.
|
|
203
|
+
|
|
204
|
+
Sizes use `sm` / `md` / `lg` where supported; buttons and avatars also have
|
|
205
|
+
`xs`. Text and headings use a separate typography scale; standalone icon
|
|
206
|
+
sizes are pixels. Every `color` takes a palette name such as `orange`,
|
|
207
|
+
`purple`, `green`, or `accent`, or any CSS color like `"#f97316"` or
|
|
208
|
+
`"rgb(0 0 0 / 50%)"`. Use `Box` for styled containers and `Sidebar` for an app's side
|
|
209
|
+
panel (`position="fixed"` pins it to the window); navigation inside it is
|
|
210
|
+
composed with `Nav`, `NavGroup`, and `NavItem`.
|
|
211
|
+
|
|
212
|
+
Overlay triggers accept the same `variant`, `size`, `icon`, and `icon_only`
|
|
213
|
+
options as buttons. Pass `on_change` when Python should rerun immediately
|
|
214
|
+
on open/close; otherwise open state stays local until the next interaction.
|
|
215
|
+
|
|
216
|
+
### Icons
|
|
217
|
+
|
|
218
|
+
Every `icon=` takes any of these:
|
|
219
|
+
|
|
220
|
+
| Form | Example | Where to find names |
|
|
221
|
+
|---|---|---|
|
|
222
|
+
| Iconify name | `"lucide:home"`, `"mdi:github"` | [icon-sets.iconify.design](https://icon-sets.iconify.design): search, click, copy the name |
|
|
223
|
+
| Material Symbol | `":material/home:"` | [fonts.google.com/icons](https://fonts.google.com/icons) |
|
|
224
|
+
| Emoji or symbol | `"🚀"`, `"★"`, `"→"` | copy and paste |
|
|
225
|
+
| SVG markup | `'<svg viewBox="0 0 24 24">...</svg>'` | any SVG; it follows the text color when it uses `currentColor` |
|
|
226
|
+
| Image link or file | `"https://.../logo.png"`, `"assets/logo.svg"` | your own files |
|
|
227
|
+
|
|
228
|
+
Lucide and Tabler ship inside the package and work offline. Any other
|
|
229
|
+
Iconify set downloads the first time you use it and is saved in
|
|
230
|
+
`~/.cache/weft-ui/icons`. A wrong name fails with a "did you mean" hint.
|
|
231
|
+
|
|
232
|
+
## Remaining work
|
|
233
|
+
|
|
234
|
+
- [x] Follow the app's `primaryColor` (an app that keeps Streamlit's default red gets the blue accent)
|
|
235
|
+
- [x] Build the wheel and sdist, install the wheel in a fresh venv, and run the demo from it
|
|
236
|
+
- [x] Add the project's own `LICENSE` file (MIT, with the copyright holder's name)
|
|
237
|
+
- [ ] Publish to TestPyPI, then PyPI
|
|
238
|
+
|
|
239
|
+
- [ ] Responsive behavior: make layouts, tables, and navigation usable on narrow screens
|
|
240
|
+
- [ ] New and extended components: support relevant loading, empty, error, disabled, and selected states
|
|
241
|
+
- [ ] New and extended interactions: keyboard access, focus handling, accessible labels, and predictable keys/reruns
|
|
242
|
+
|
|
243
|
+
Build screen examples from these primitives before adding dedicated components:
|
|
244
|
+
|
|
245
|
+
- [x] Dashboard with metric cards, chart panels, filters, and a rich table
|
|
246
|
+
- [x] Settings page with grouped fields, form submission, and feedback
|
|
247
|
+
- [x] Record details with a page header, label/value rows, composed avatars, and an edit drawer
|
|
248
|
+
- [x] Empty and loading screens using cards, text, icons, skeletons, and actions
|
|
249
|
+
|
|
250
|
+
## Development
|
|
251
|
+
|
|
252
|
+
```
|
|
253
|
+
scripts/dev.sh # build, then run on http://localhost:8501
|
|
254
|
+
scripts/dev.sh templates/crm.py # a full app; see templates/ for more
|
|
255
|
+
scripts/dev.sh docs/app.py # the docs site: templates, blocks, and components
|
|
256
|
+
scripts/dev.sh --ngrok # also print a public ngrok URL
|
|
257
|
+
PORT=8601 scripts/dev.sh app.py
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
The script builds the components once, then starts the app. Nothing reloads by
|
|
261
|
+
itself. After a change, press Ctrl+C and run it again.
|