python-fasthtml 0.12.16__tar.gz → 0.12.18__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.
- {python_fasthtml-0.12.16/python_fasthtml.egg-info → python_fasthtml-0.12.18}/PKG-INFO +4 -4
- {python_fasthtml-0.12.16 → python_fasthtml-0.12.18}/README.md +3 -3
- python_fasthtml-0.12.18/fasthtml/__init__.py +2 -0
- {python_fasthtml-0.12.16 → python_fasthtml-0.12.18}/fasthtml/_modidx.py +4 -3
- {python_fasthtml-0.12.16 → python_fasthtml-0.12.18}/fasthtml/components.py +20 -12
- python_fasthtml-0.12.18/fasthtml/components.pyi +209 -0
- {python_fasthtml-0.12.16 → python_fasthtml-0.12.18}/fasthtml/core.py +39 -23
- {python_fasthtml-0.12.16 → python_fasthtml-0.12.18}/fasthtml/core.pyi +21 -8
- {python_fasthtml-0.12.16 → python_fasthtml-0.12.18}/fasthtml/fastapp.py +2 -1
- python_fasthtml-0.12.18/fasthtml/xtend.pyi +130 -0
- {python_fasthtml-0.12.16 → python_fasthtml-0.12.18/python_fasthtml.egg-info}/PKG-INFO +4 -4
- {python_fasthtml-0.12.16 → python_fasthtml-0.12.18}/settings.ini +3 -3
- python_fasthtml-0.12.16/fasthtml/__init__.py +0 -2
- python_fasthtml-0.12.16/fasthtml/components.pyi +0 -204
- python_fasthtml-0.12.16/fasthtml/xtend.pyi +0 -124
- {python_fasthtml-0.12.16 → python_fasthtml-0.12.18}/CONTRIBUTING.md +0 -0
- {python_fasthtml-0.12.16 → python_fasthtml-0.12.18}/LICENSE +0 -0
- {python_fasthtml-0.12.16 → python_fasthtml-0.12.18}/MANIFEST.in +0 -0
- {python_fasthtml-0.12.16 → python_fasthtml-0.12.18}/fasthtml/authmw.py +0 -0
- {python_fasthtml-0.12.16 → python_fasthtml-0.12.18}/fasthtml/basics.py +0 -0
- {python_fasthtml-0.12.16 → python_fasthtml-0.12.18}/fasthtml/cli.py +0 -0
- {python_fasthtml-0.12.16 → python_fasthtml-0.12.18}/fasthtml/common.py +0 -0
- {python_fasthtml-0.12.16 → python_fasthtml-0.12.18}/fasthtml/ft.py +0 -0
- {python_fasthtml-0.12.16 → python_fasthtml-0.12.18}/fasthtml/js.py +0 -0
- {python_fasthtml-0.12.16 → python_fasthtml-0.12.18}/fasthtml/jupyter.py +0 -0
- {python_fasthtml-0.12.16 → python_fasthtml-0.12.18}/fasthtml/katex.js +0 -0
- {python_fasthtml-0.12.16 → python_fasthtml-0.12.18}/fasthtml/live_reload.py +0 -0
- {python_fasthtml-0.12.16 → python_fasthtml-0.12.18}/fasthtml/oauth.py +0 -0
- {python_fasthtml-0.12.16 → python_fasthtml-0.12.18}/fasthtml/pico.py +0 -0
- {python_fasthtml-0.12.16 → python_fasthtml-0.12.18}/fasthtml/starlette.py +0 -0
- {python_fasthtml-0.12.16 → python_fasthtml-0.12.18}/fasthtml/stripe_otp.py +0 -0
- {python_fasthtml-0.12.16 → python_fasthtml-0.12.18}/fasthtml/svg.py +0 -0
- {python_fasthtml-0.12.16 → python_fasthtml-0.12.18}/fasthtml/toaster.py +0 -0
- {python_fasthtml-0.12.16 → python_fasthtml-0.12.18}/fasthtml/xtend.py +0 -0
- {python_fasthtml-0.12.16 → python_fasthtml-0.12.18}/pyproject.toml +0 -0
- {python_fasthtml-0.12.16 → python_fasthtml-0.12.18}/python_fasthtml.egg-info/SOURCES.txt +0 -0
- {python_fasthtml-0.12.16 → python_fasthtml-0.12.18}/python_fasthtml.egg-info/dependency_links.txt +0 -0
- {python_fasthtml-0.12.16 → python_fasthtml-0.12.18}/python_fasthtml.egg-info/entry_points.txt +0 -0
- {python_fasthtml-0.12.16 → python_fasthtml-0.12.18}/python_fasthtml.egg-info/not-zip-safe +0 -0
- {python_fasthtml-0.12.16 → python_fasthtml-0.12.18}/python_fasthtml.egg-info/requires.txt +0 -0
- {python_fasthtml-0.12.16 → python_fasthtml-0.12.18}/python_fasthtml.egg-info/top_level.txt +0 -0
- {python_fasthtml-0.12.16 → python_fasthtml-0.12.18}/setup.cfg +0 -0
- {python_fasthtml-0.12.16 → python_fasthtml-0.12.18}/setup.py +0 -0
- {python_fasthtml-0.12.16 → python_fasthtml-0.12.18}/tests/test_toaster.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: python-fasthtml
|
|
3
|
-
Version: 0.12.
|
|
3
|
+
Version: 0.12.18
|
|
4
4
|
Summary: The fastest way to create an HTML app
|
|
5
5
|
Home-page: https://github.com/AnswerDotAI/fasthtml
|
|
6
6
|
Author: Jeremy Howard and contributors
|
|
@@ -139,7 +139,7 @@ ChatGPT, Claude, and Copilot won’t give useful answers about it. To fix
|
|
|
139
139
|
that problem, we’ve provided an LLM-friendly guide that teaches them how
|
|
140
140
|
to use FastHTML. To use it, add this link for your AI helper to use:
|
|
141
141
|
|
|
142
|
-
- [/llms-ctx.txt](https://
|
|
142
|
+
- [/llms-ctx.txt](https://www.fastht.ml/docs/llms-ctx.txt)
|
|
143
143
|
|
|
144
144
|
This example is in a format based on recommendations from Anthropic for
|
|
145
145
|
use with [Claude
|
|
@@ -163,8 +163,8 @@ Start with the official sources to learn more about FastHTML:
|
|
|
163
163
|
|
|
164
164
|
- [About](https://fastht.ml/about): Learn about the core ideas behind
|
|
165
165
|
FastHTML
|
|
166
|
-
- [Documentation](https://
|
|
167
|
-
write FastHTML code
|
|
166
|
+
- [Documentation](https://www.fastht.ml/docs): Learn from examples how
|
|
167
|
+
to write FastHTML code
|
|
168
168
|
- [Idiomatic
|
|
169
169
|
app](https://github.com/AnswerDotAI/fasthtml/blob/main/examples/adv_app.py):
|
|
170
170
|
Heavily commented source code walking through a complete application,
|
|
@@ -90,7 +90,7 @@ ChatGPT, Claude, and Copilot won’t give useful answers about it. To fix
|
|
|
90
90
|
that problem, we’ve provided an LLM-friendly guide that teaches them how
|
|
91
91
|
to use FastHTML. To use it, add this link for your AI helper to use:
|
|
92
92
|
|
|
93
|
-
- [/llms-ctx.txt](https://
|
|
93
|
+
- [/llms-ctx.txt](https://www.fastht.ml/docs/llms-ctx.txt)
|
|
94
94
|
|
|
95
95
|
This example is in a format based on recommendations from Anthropic for
|
|
96
96
|
use with [Claude
|
|
@@ -114,8 +114,8 @@ Start with the official sources to learn more about FastHTML:
|
|
|
114
114
|
|
|
115
115
|
- [About](https://fastht.ml/about): Learn about the core ideas behind
|
|
116
116
|
FastHTML
|
|
117
|
-
- [Documentation](https://
|
|
118
|
-
write FastHTML code
|
|
117
|
+
- [Documentation](https://www.fastht.ml/docs): Learn from examples how
|
|
118
|
+
to write FastHTML code
|
|
119
119
|
- [Idiomatic
|
|
120
120
|
app](https://github.com/AnswerDotAI/fasthtml/blob/main/examples/adv_app.py):
|
|
121
121
|
Heavily commented source code walking through a complete application,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# Autogenerated by nbdev
|
|
2
2
|
|
|
3
3
|
d = { 'settings': { 'branch': 'main',
|
|
4
|
-
'doc_baseurl': '/',
|
|
5
|
-
'doc_host': 'https://
|
|
4
|
+
'doc_baseurl': '/docs/',
|
|
5
|
+
'doc_host': 'https://www.fastht.ml',
|
|
6
6
|
'git_url': 'https://github.com/AnswerDotAI/fasthtml',
|
|
7
7
|
'lib_path': 'fasthtml'},
|
|
8
8
|
'syms': { 'fasthtml.authmw': {},
|
|
@@ -90,6 +90,7 @@ d = { 'settings': { 'branch': 'main',
|
|
|
90
90
|
'fasthtml.core._mk_list': ('api/core.html#_mk_list', 'fasthtml/core.py'),
|
|
91
91
|
'fasthtml.core._mk_locfunc': ('api/core.html#_mk_locfunc', 'fasthtml/core.py'),
|
|
92
92
|
'fasthtml.core._params': ('api/core.html#_params', 'fasthtml/core.py'),
|
|
93
|
+
'fasthtml.core._part_resp': ('api/core.html#_part_resp', 'fasthtml/core.py'),
|
|
93
94
|
'fasthtml.core._resp': ('api/core.html#_resp', 'fasthtml/core.py'),
|
|
94
95
|
'fasthtml.core._send_ws': ('api/core.html#_send_ws', 'fasthtml/core.py'),
|
|
95
96
|
'fasthtml.core._to_htmx_header': ('api/core.html#_to_htmx_header', 'fasthtml/core.py'),
|
|
@@ -101,7 +102,6 @@ d = { 'settings': { 'branch': 'main',
|
|
|
101
102
|
'fasthtml.core._wrap_ws': ('api/core.html#_wrap_ws', 'fasthtml/core.py'),
|
|
102
103
|
'fasthtml.core._ws_endp': ('api/core.html#_ws_endp', 'fasthtml/core.py'),
|
|
103
104
|
'fasthtml.core._xt_cts': ('api/core.html#_xt_cts', 'fasthtml/core.py'),
|
|
104
|
-
'fasthtml.core._xt_resp': ('api/core.html#_xt_resp', 'fasthtml/core.py'),
|
|
105
105
|
'fasthtml.core.cookie': ('api/core.html#cookie', 'fasthtml/core.py'),
|
|
106
106
|
'fasthtml.core.decode_uri': ('api/core.html#decode_uri', 'fasthtml/core.py'),
|
|
107
107
|
'fasthtml.core.def_hdrs': ('api/core.html#def_hdrs', 'fasthtml/core.py'),
|
|
@@ -109,6 +109,7 @@ d = { 'settings': { 'branch': 'main',
|
|
|
109
109
|
'fasthtml.core.flat_xt': ('api/core.html#flat_xt', 'fasthtml/core.py'),
|
|
110
110
|
'fasthtml.core.form2dict': ('api/core.html#form2dict', 'fasthtml/core.py'),
|
|
111
111
|
'fasthtml.core.get_key': ('api/core.html#get_key', 'fasthtml/core.py'),
|
|
112
|
+
'fasthtml.core.is_full_page': ('api/core.html#is_full_page', 'fasthtml/core.py'),
|
|
112
113
|
'fasthtml.core.nested_name': ('api/core.html#nested_name', 'fasthtml/core.py'),
|
|
113
114
|
'fasthtml.core.noop_body': ('api/core.html#noop_body', 'fasthtml/core.py'),
|
|
114
115
|
'fasthtml.core.parse_form': ('api/core.html#parse_form', 'fasthtml/core.py'),
|
|
@@ -3,17 +3,18 @@
|
|
|
3
3
|
# AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/api/01_components.ipynb.
|
|
4
4
|
|
|
5
5
|
# %% auto 0
|
|
6
|
-
__all__ = ['named', 'html_attrs', 'hx_attrs', '
|
|
7
|
-
'
|
|
8
|
-
'
|
|
9
|
-
'
|
|
10
|
-
'
|
|
11
|
-
'
|
|
12
|
-
'
|
|
13
|
-
'
|
|
14
|
-
'
|
|
15
|
-
'
|
|
16
|
-
'
|
|
6
|
+
__all__ = ['named', 'html_attrs', 'hx_attrs', 'hx_evts', 'js_evts', 'hx_attrs_annotations', 'hx_evt_attrs', 'js_evt_attrs',
|
|
7
|
+
'evt_attrs', 'attrmap_x', 'ft_html', 'ft_hx', 'File', 'show', 'fill_form', 'fill_dataclass', 'find_inputs',
|
|
8
|
+
'html2ft', 'sse_message', 'A', 'Abbr', 'Address', 'Area', 'Article', 'Aside', 'Audio', 'B', 'Base', 'Bdi',
|
|
9
|
+
'Bdo', 'Blockquote', 'Body', 'Br', 'Button', 'Canvas', 'Caption', 'Cite', 'Code', 'Col', 'Colgroup', 'Data',
|
|
10
|
+
'Datalist', 'Dd', 'Del', 'Details', 'Dfn', 'Dialog', 'Div', 'Dl', 'Dt', 'Em', 'Embed', 'Fencedframe',
|
|
11
|
+
'Fieldset', 'Figcaption', 'Figure', 'Footer', 'Form', 'H1', 'H2', 'H3', 'H4', 'H5', 'H6', 'Head', 'Header',
|
|
12
|
+
'Hgroup', 'Hr', 'I', 'Iframe', 'Img', 'Input', 'Ins', 'Kbd', 'Label', 'Legend', 'Li', 'Link', 'Main', 'Map',
|
|
13
|
+
'Mark', 'Menu', 'Meta', 'Meter', 'Nav', 'Noscript', 'Object', 'Ol', 'Optgroup', 'Option', 'Output', 'P',
|
|
14
|
+
'Picture', 'PortalExperimental', 'Pre', 'Progress', 'Q', 'Rp', 'Rt', 'Ruby', 'S', 'Samp', 'Script', 'Search',
|
|
15
|
+
'Section', 'Select', 'Slot', 'Small', 'Source', 'Span', 'Strong', 'Style', 'Sub', 'Summary', 'Sup', 'Table',
|
|
16
|
+
'Tbody', 'Td', 'Template', 'Textarea', 'Tfoot', 'Th', 'Thead', 'Time', 'Title', 'Tr', 'Track', 'U', 'Ul',
|
|
17
|
+
'Var', 'Video', 'Wbr']
|
|
17
18
|
|
|
18
19
|
# %% ../nbs/api/01_components.ipynb
|
|
19
20
|
from dataclasses import dataclass, asdict, is_dataclass, make_dataclass, replace, astuple, MISSING
|
|
@@ -47,6 +48,9 @@ def __add__(self:FT, b): return f'{self}{b}'
|
|
|
47
48
|
named = set('a button form frame iframe img input map meta object param select textarea'.split())
|
|
48
49
|
html_attrs = 'id cls title style accesskey contenteditable dir draggable enterkeyhint hidden inert inputmode lang popover spellcheck tabindex translate'.split()
|
|
49
50
|
hx_attrs = 'get post put delete patch trigger target swap swap_oob include select select_oob indicator push_url confirm disable replace_url vals disabled_elt ext headers history history_elt indicator inherit params preserve prompt replace_url request sync validate'
|
|
51
|
+
|
|
52
|
+
hx_evts = 'abort afterOnLoad afterProcessNode afterRequest afterSettle afterSwap beforeCleanupElement beforeOnLoad beforeProcessNode beforeRequest beforeSwap beforeSend beforeTransition configRequest confirm historyCacheError historyCacheMiss historyCacheMissError historyCacheMissLoad historyRestore beforeHistorySave load noSSESourceError onLoadError oobAfterSwap oobBeforeSwap oobErrorNoTarget prompt pushedIntoHistory replacedInHistory responseError sendAbort sendError sseError sseOpen swapError targetError timeout validation:validate validation:failed validation:halted xhr:abort xhr:loadend xhr:loadstart xhr:progress'
|
|
53
|
+
js_evts = "blur change contextmenu focus input invalid reset select submit keydown keypress keyup click dblclick mousedown mouseenter mouseleave mousemove mouseout mouseover mouseup wheel"
|
|
50
54
|
hx_attrs = [f'hx_{o}' for o in hx_attrs.split()]
|
|
51
55
|
hx_attrs_annotations = {
|
|
52
56
|
"hx_swap": Literal["innerHTML", "outerHTML", "afterbegin", "beforebegin", "beforeend", "afterend", "delete", "none"] | str,
|
|
@@ -62,6 +66,10 @@ hx_attrs_annotations |= {o: str for o in set(hx_attrs) - set(hx_attrs_annotation
|
|
|
62
66
|
hx_attrs_annotations = {k: Optional[v] for k,v in hx_attrs_annotations.items()}
|
|
63
67
|
hx_attrs = html_attrs + hx_attrs
|
|
64
68
|
|
|
69
|
+
hx_evt_attrs = ['hx_on__'+camel2snake(o).replace(':','_') for o in hx_evts.split()]
|
|
70
|
+
js_evt_attrs = ['hx_on_'+o for o in js_evts.split()]
|
|
71
|
+
evt_attrs = js_evt_attrs+hx_evt_attrs
|
|
72
|
+
|
|
65
73
|
# %% ../nbs/api/01_components.ipynb
|
|
66
74
|
def attrmap_x(o):
|
|
67
75
|
if o.startswith('_at_'): o = '@'+o[4:]
|
|
@@ -90,7 +98,7 @@ def ft_html(tag: str, *c, id=None, cls=None, title=None, style=None, attrmap=Non
|
|
|
90
98
|
return ft_cls(tag,c,kw, void_=tag in voids)
|
|
91
99
|
|
|
92
100
|
# %% ../nbs/api/01_components.ipynb
|
|
93
|
-
@use_kwargs(hx_attrs, keep=True)
|
|
101
|
+
@use_kwargs(hx_attrs+evt_attrs, keep=True)
|
|
94
102
|
def ft_hx(tag: str, *c, target_id=None, hx_vals=None, hx_target=None, **kwargs):
|
|
95
103
|
if hx_vals: kwargs['hx_vals'] = json.dumps(hx_vals) if isinstance (hx_vals,dict) else hx_vals
|
|
96
104
|
if hx_target: kwargs['hx_target'] = '#'+hx_target.id if isinstance(hx_target,FT) else hx_target
|