Skip to content

Commit

Permalink
pyi
Browse files Browse the repository at this point in the history
  • Loading branch information
jph00 committed May 25, 2024
1 parent 4fcbb1f commit 91d2479
Show file tree
Hide file tree
Showing 10 changed files with 955 additions and 645 deletions.
1 change: 0 additions & 1 deletion examples/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,3 @@ async def get_todo(id:int):
btn = Button('delete', hx_delete=f'/todos/{todo.id}',
target_id=tid(todo.id), hx_swap="outerHTML")
return Div(Div(todo.title), btn)

100 changes: 81 additions & 19 deletions examples/impl.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@
{
"cell_type": "code",
"execution_count": 7,
"id": "de14f516",
"id": "2a810b91",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -139,16 +139,24 @@
" dt = ' (done)' if self.done else ''\n",
" return Li(show, dt, ' | ', edit, id=tid(self.id))\n",
"\n",
" _repr_html_ = showtags\n",
"\n",
" _repr_html_ = showtags"
]
},
{
"cell_type": "code",
"execution_count": 8,
"id": "de14f516",
"metadata": {},
"outputs": [],
"source": [
"TODO_LIST = [TodoItem(id=0, title=\"Start writing todo list\", done=True),\n",
" TodoItem(id=1, title=\"???\", done=False),\n",
" TodoItem(id=2, title=\"Profit\", done=False)]"
]
},
{
"cell_type": "code",
"execution_count": 8,
"execution_count": 9,
"id": "96541e48",
"metadata": {},
"outputs": [
Expand All @@ -173,7 +181,7 @@
"TodoItem(title='Start writing todo list', id=0, done=True)"
]
},
"execution_count": 8,
"execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -185,7 +193,7 @@
},
{
"cell_type": "code",
"execution_count": 9,
"execution_count": 10,
"id": "3035bd4c",
"metadata": {},
"outputs": [
Expand All @@ -207,7 +215,7 @@
"<IPython.core.display.HTML object>"
]
},
"execution_count": 9,
"execution_count": 10,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -218,7 +226,62 @@
},
{
"cell_type": "code",
"execution_count": 10,
"execution_count": 11,
"id": "50c7a5ed",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<ul>\n",
" <li id=\"todo-0\">\n",
" <a href=\"#\" hx-get=\"/todos/0\" hx-target=\"#current-todo\">\n",
"Start writing todo list\n",
" </a>\n",
" (done)\n",
" | \n",
" <a href=\"#\" hx-get=\"/edit/0\" hx-target=\"#current-todo\">\n",
"edit\n",
" </a>\n",
" </li>\n",
" <li id=\"todo-1\">\n",
" <a href=\"#\" hx-get=\"/todos/1\" hx-target=\"#current-todo\">\n",
"???\n",
" </a>\n",
"\n",
" | \n",
" <a href=\"#\" hx-get=\"/edit/1\" hx-target=\"#current-todo\">\n",
"edit\n",
" </a>\n",
" </li>\n",
" <li id=\"todo-2\">\n",
" <a href=\"#\" hx-get=\"/todos/2\" hx-target=\"#current-todo\">\n",
"Profit\n",
" </a>\n",
"\n",
" | \n",
" <a href=\"#\" hx-get=\"/edit/2\" hx-target=\"#current-todo\">\n",
"edit\n",
" </a>\n",
" </li>\n",
"</ul>\n"
],
"text/plain": [
"<IPython.core.display.HTML object>"
]
},
"execution_count": 11,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"show(Ul(*TODO_LIST))"
]
},
{
"cell_type": "code",
"execution_count": 14,
"id": "25d16330",
"metadata": {},
"outputs": [],
Expand All @@ -229,7 +292,7 @@
},
{
"cell_type": "code",
"execution_count": 11,
"execution_count": 15,
"id": "7ef79e4c",
"metadata": {},
"outputs": [
Expand All @@ -249,7 +312,7 @@
"<IPython.core.display.HTML object>"
]
},
"execution_count": 11,
"execution_count": 15,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -262,7 +325,7 @@
},
{
"cell_type": "code",
"execution_count": 12,
"execution_count": 16,
"id": "1aceba92",
"metadata": {},
"outputs": [],
Expand Down Expand Up @@ -380,7 +443,7 @@
},
{
"cell_type": "code",
"execution_count": 45,
"execution_count": 16,
"id": "39fa9107",
"metadata": {},
"outputs": [],
Expand All @@ -397,7 +460,7 @@
},
{
"cell_type": "code",
"execution_count": 46,
"execution_count": 17,
"id": "f5c08ca9",
"metadata": {},
"outputs": [
Expand All @@ -422,19 +485,19 @@
"<IPython.core.display.HTML object>"
]
},
"execution_count": 46,
"execution_count": 17,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"edit = await edit_item(2)\n",
"edit = get_editform(2)\n",
"show(edit)"
]
},
{
"cell_type": "code",
"execution_count": 40,
"execution_count": 18,
"id": "f6d33549",
"metadata": {},
"outputs": [
Expand All @@ -444,7 +507,7 @@
"['Profit']"
]
},
"execution_count": 40,
"execution_count": 18,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -463,15 +526,14 @@
},
{
"cell_type": "code",
"execution_count": 14,
"execution_count": 19,
"id": "957ff1b9",
"metadata": {},
"outputs": [],
"source": [
"#| eval: false\n",
"#| hide\n",
"from nbdev.export import nb_export\n",
"nb_export('impl.ipynb', '.')from nbdev.export import nb_export\n",
"nb_export('impl.ipynb', '.')"
]
},
Expand Down
1 change: 1 addition & 0 deletions fasthtml/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
__version__ = "0.0.3"
from .core import *
from .components import *
from .xtend import *

24 changes: 12 additions & 12 deletions fasthtml/_modidx.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,7 @@
'doc_host': 'https://AnswerDotAI.github.io',
'git_url': 'https://github.com/AnswerDotAI/fasthtml',
'lib_path': 'fasthtml'},
'syms': { 'fasthtml.components': { 'fasthtml.components.A': ('components.html#a', 'fasthtml/components.py'),
'fasthtml.components.AX': ('components.html#ax', 'fasthtml/components.py'),
'fasthtml.components.Card': ('components.html#card', 'fasthtml/components.py'),
'fasthtml.components.Checkbox': ('components.html#checkbox', 'fasthtml/components.py'),
'fasthtml.components.DialogX': ('components.html#dialogx', 'fasthtml/components.py'),
'fasthtml.components.Grid': ('components.html#grid', 'fasthtml/components.py'),
'fasthtml.components.Group': ('components.html#group', 'fasthtml/components.py'),
'fasthtml.components.Hidden': ('components.html#hidden', 'fasthtml/components.py'),
'fasthtml.components.Search': ('components.html#search', 'fasthtml/components.py'),
'fasthtml.components._FindElems': ('components.html#_findelems', 'fasthtml/components.py'),
'syms': { 'fasthtml.components': { 'fasthtml.components._FindElems': ('components.html#_findelems', 'fasthtml/components.py'),
'fasthtml.components._FindElems.__init__': ( 'components.html#_findelems.__init__',
'fasthtml/components.py'),
'fasthtml.components._FindElems.handle_starttag': ( 'components.html#_findelems.handle_starttag',
Expand All @@ -23,7 +14,6 @@
'fasthtml.components.fill_form': ('components.html#fill_form', 'fasthtml/components.py'),
'fasthtml.components.find_elems': ('components.html#find_elems', 'fasthtml/components.py'),
'fasthtml.components.find_inps': ('components.html#find_inps', 'fasthtml/components.py'),
'fasthtml.components.set_pico_cls': ('components.html#set_pico_cls', 'fasthtml/components.py'),
'fasthtml.components.set_val': ('components.html#set_val', 'fasthtml/components.py'),
'fasthtml.components.show': ('components.html#show', 'fasthtml/components.py'),
'fasthtml.components.xt_html': ('components.html#xt_html', 'fasthtml/components.py'),
Expand All @@ -44,4 +34,14 @@
'fasthtml.core._wrap_resp': ('core.html#_wrap_resp', 'fasthtml/core.py'),
'fasthtml.core.date': ('core.html#date', 'fasthtml/core.py'),
'fasthtml.core.reg_re_param': ('core.html#reg_re_param', 'fasthtml/core.py'),
'fasthtml.core.snake2hyphens': ('core.html#snake2hyphens', 'fasthtml/core.py')}}}
'fasthtml.core.snake2hyphens': ('core.html#snake2hyphens', 'fasthtml/core.py')},
'fasthtml.xtend': { 'fasthtml.xtend.A': ('xtend.html#a', 'fasthtml/xtend.py'),
'fasthtml.xtend.AX': ('xtend.html#ax', 'fasthtml/xtend.py'),
'fasthtml.xtend.Card': ('xtend.html#card', 'fasthtml/xtend.py'),
'fasthtml.xtend.Checkbox': ('xtend.html#checkbox', 'fasthtml/xtend.py'),
'fasthtml.xtend.DialogX': ('xtend.html#dialogx', 'fasthtml/xtend.py'),
'fasthtml.xtend.Grid': ('xtend.html#grid', 'fasthtml/xtend.py'),
'fasthtml.xtend.Group': ('xtend.html#group', 'fasthtml/xtend.py'),
'fasthtml.xtend.Hidden': ('xtend.html#hidden', 'fasthtml/xtend.py'),
'fasthtml.xtend.Search': ('xtend.html#search', 'fasthtml/xtend.py'),
'fasthtml.xtend.set_pico_cls': ('xtend.html#set_pico_cls', 'fasthtml/xtend.py')}}}
Loading

0 comments on commit 91d2479

Please sign in to comment.