hypie 0.1.1.dev3__tar.gz → 0.1.1.dev4__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.
- {hypie-0.1.1.dev3 → hypie-0.1.1.dev4}/PKG-INFO +86 -1
- {hypie-0.1.1.dev3 → hypie-0.1.1.dev4}/README.md +85 -0
- {hypie-0.1.1.dev3 → hypie-0.1.1.dev4}/pyproject.toml +1 -1
- {hypie-0.1.1.dev3 → hypie-0.1.1.dev4}/LICENSE +0 -0
- {hypie-0.1.1.dev3 → hypie-0.1.1.dev4}/src/hypie/__init__.py +0 -0
- {hypie-0.1.1.dev3 → hypie-0.1.1.dev4}/src/hypie/cli/build_components.py +0 -0
- {hypie-0.1.1.dev3 → hypie-0.1.1.dev4}/src/hypie/commands.py +0 -0
- {hypie-0.1.1.dev3 → hypie-0.1.1.dev4}/src/hypie/dom_position.py +0 -0
- {hypie-0.1.1.dev3 → hypie-0.1.1.dev4}/src/hypie/events.py +0 -0
- {hypie-0.1.1.dev3 → hypie-0.1.1.dev4}/src/hypie/experimental/client_components.py +0 -0
- {hypie-0.1.1.dev3 → hypie-0.1.1.dev4}/src/hypie/experimental/components.py +0 -0
- {hypie-0.1.1.dev3 → hypie-0.1.1.dev4}/src/hypie/experimental/hyperscript.py +0 -0
- {hypie-0.1.1.dev3 → hypie-0.1.1.dev4}/src/hypie/experimental/templates.py +0 -0
- {hypie-0.1.1.dev3 → hypie-0.1.1.dev4}/src/hypie/features.py +0 -0
- {hypie-0.1.1.dev3 → hypie-0.1.1.dev4}/src/hypie/hs_ast/commands.py +0 -0
- {hypie-0.1.1.dev3 → hypie-0.1.1.dev4}/src/hypie/hs_ast/constants.py +0 -0
- {hypie-0.1.1.dev3 → hypie-0.1.1.dev4}/src/hypie/hs_ast/contexts.py +0 -0
- {hypie-0.1.1.dev3 → hypie-0.1.1.dev4}/src/hypie/hs_ast/expressions.py +0 -0
- {hypie-0.1.1.dev3 → hypie-0.1.1.dev4}/src/hypie/hs_ast/features.py +0 -0
- {hypie-0.1.1.dev3 → hypie-0.1.1.dev4}/src/hypie/hs_ast/helpers.py +0 -0
- {hypie-0.1.1.dev3 → hypie-0.1.1.dev4}/src/hypie/literals.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: hypie
|
|
3
|
-
Version: 0.1.1.
|
|
3
|
+
Version: 0.1.1.dev4
|
|
4
4
|
Summary: Add your description here
|
|
5
5
|
Author: Yasser Ahmed
|
|
6
6
|
Author-email: Yasser Ahmed <yasserfawzi1029@gmail.com>
|
|
@@ -18,6 +18,7 @@ Description-Content-Type: text/markdown
|
|
|
18
18
|
|
|
19
19
|
## Table of Contents
|
|
20
20
|
- [Intro](#intro)
|
|
21
|
+
- [Quick Start](#quick-start)
|
|
21
22
|
- [Installation](#installation)
|
|
22
23
|
- [Motivation](#motivation)
|
|
23
24
|
- [Htpy and _Hyperscript Primers](#htpy-and-hyperscript-primers)
|
|
@@ -38,6 +39,90 @@ Right now Hypie is a personal passion side project that is still very experiment
|
|
|
38
39
|
|
|
39
40
|
There is no official docs website for hypie (yet), so this README is the closest thing to a documentation for now, if you are interested, I would advise reading through the whole thing, hopefully its not too long.
|
|
40
41
|
|
|
42
|
+
## Quick Start
|
|
43
|
+
Hypie code looks like this:
|
|
44
|
+
```python
|
|
45
|
+
import htpy
|
|
46
|
+
from hypie import hs
|
|
47
|
+
from hypie.experimental.components import Component
|
|
48
|
+
from hypie.literals import var
|
|
49
|
+
from hypie.features import On
|
|
50
|
+
from hypie.commands import set_
|
|
51
|
+
|
|
52
|
+
class Counter(Component):
|
|
53
|
+
initial_count: int = 0
|
|
54
|
+
|
|
55
|
+
def template(self):
|
|
56
|
+
count_var = var(":count")
|
|
57
|
+
|
|
58
|
+
return htpy.div[
|
|
59
|
+
htpy.button(
|
|
60
|
+
_=hs(
|
|
61
|
+
set_(count_var, to=self.initial_count),
|
|
62
|
+
On("click")[
|
|
63
|
+
set_(count_var, to=count_var + 1),
|
|
64
|
+
set_(var("me").textContent, to=f"Count is: {count_var}"),
|
|
65
|
+
],
|
|
66
|
+
)
|
|
67
|
+
)[f"Count is: {self.initial_count}"]
|
|
68
|
+
]
|
|
69
|
+
|
|
70
|
+
@staticmethod
|
|
71
|
+
def style():
|
|
72
|
+
return {
|
|
73
|
+
"button": {
|
|
74
|
+
"background-color": "#4A90D9",
|
|
75
|
+
"color": "#ffffff",
|
|
76
|
+
"border": "none",
|
|
77
|
+
"border-radius": "6px",
|
|
78
|
+
"padding": "10px 20px",
|
|
79
|
+
"font-size": "16px",
|
|
80
|
+
"font-weight": "600",
|
|
81
|
+
"cursor": "pointer",
|
|
82
|
+
"transition": "background-color 0.2s ease",
|
|
83
|
+
},
|
|
84
|
+
"button:hover": {"background-color": "#3A7BC8"},
|
|
85
|
+
}
|
|
86
|
+
```
|
|
87
|
+
After that, you build the css of the components:
|
|
88
|
+
```sh
|
|
89
|
+
hypie build -i <path/to/components/dir> -o <path/to/static_or_dist/dir> --watch
|
|
90
|
+
```
|
|
91
|
+
And return your components from your preferred python backend framework:
|
|
92
|
+
|
|
93
|
+
```python
|
|
94
|
+
import pathlib
|
|
95
|
+
|
|
96
|
+
import htpy
|
|
97
|
+
from fastapi import FastAPI
|
|
98
|
+
from fastapi.staticfiles import StaticFiles
|
|
99
|
+
from fastapi.responses import HTMLResponse
|
|
100
|
+
from .ui.components import Counter
|
|
101
|
+
|
|
102
|
+
app = FastAPI()
|
|
103
|
+
|
|
104
|
+
app.mount(
|
|
105
|
+
"/static", StaticFiles(directory=pathlib.Path(__file__).parent.resolve() / "static")
|
|
106
|
+
)
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
@app.get("/")
|
|
110
|
+
def counter_example():
|
|
111
|
+
return HTMLResponse(htpy.html[
|
|
112
|
+
htpy.head[
|
|
113
|
+
htpy.title["Counter"],
|
|
114
|
+
# this was generated with hypie build
|
|
115
|
+
htpy.link(rel="stylesheet", href="/static/_hypie_styles.css"),
|
|
116
|
+
|
|
117
|
+
# we need to load _hyperscript
|
|
118
|
+
htpy.script(src="https://cdn.jsdelivr.net/npm/hyperscript.org@0.9.93"),
|
|
119
|
+
],
|
|
120
|
+
htpy.body[
|
|
121
|
+
Counter(5)
|
|
122
|
+
]
|
|
123
|
+
])
|
|
124
|
+
```
|
|
125
|
+
|
|
41
126
|
## Installation
|
|
42
127
|
```sh
|
|
43
128
|
uv add hypie
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
## Table of Contents
|
|
6
6
|
- [Intro](#intro)
|
|
7
|
+
- [Quick Start](#quick-start)
|
|
7
8
|
- [Installation](#installation)
|
|
8
9
|
- [Motivation](#motivation)
|
|
9
10
|
- [Htpy and _Hyperscript Primers](#htpy-and-hyperscript-primers)
|
|
@@ -24,6 +25,90 @@ Right now Hypie is a personal passion side project that is still very experiment
|
|
|
24
25
|
|
|
25
26
|
There is no official docs website for hypie (yet), so this README is the closest thing to a documentation for now, if you are interested, I would advise reading through the whole thing, hopefully its not too long.
|
|
26
27
|
|
|
28
|
+
## Quick Start
|
|
29
|
+
Hypie code looks like this:
|
|
30
|
+
```python
|
|
31
|
+
import htpy
|
|
32
|
+
from hypie import hs
|
|
33
|
+
from hypie.experimental.components import Component
|
|
34
|
+
from hypie.literals import var
|
|
35
|
+
from hypie.features import On
|
|
36
|
+
from hypie.commands import set_
|
|
37
|
+
|
|
38
|
+
class Counter(Component):
|
|
39
|
+
initial_count: int = 0
|
|
40
|
+
|
|
41
|
+
def template(self):
|
|
42
|
+
count_var = var(":count")
|
|
43
|
+
|
|
44
|
+
return htpy.div[
|
|
45
|
+
htpy.button(
|
|
46
|
+
_=hs(
|
|
47
|
+
set_(count_var, to=self.initial_count),
|
|
48
|
+
On("click")[
|
|
49
|
+
set_(count_var, to=count_var + 1),
|
|
50
|
+
set_(var("me").textContent, to=f"Count is: {count_var}"),
|
|
51
|
+
],
|
|
52
|
+
)
|
|
53
|
+
)[f"Count is: {self.initial_count}"]
|
|
54
|
+
]
|
|
55
|
+
|
|
56
|
+
@staticmethod
|
|
57
|
+
def style():
|
|
58
|
+
return {
|
|
59
|
+
"button": {
|
|
60
|
+
"background-color": "#4A90D9",
|
|
61
|
+
"color": "#ffffff",
|
|
62
|
+
"border": "none",
|
|
63
|
+
"border-radius": "6px",
|
|
64
|
+
"padding": "10px 20px",
|
|
65
|
+
"font-size": "16px",
|
|
66
|
+
"font-weight": "600",
|
|
67
|
+
"cursor": "pointer",
|
|
68
|
+
"transition": "background-color 0.2s ease",
|
|
69
|
+
},
|
|
70
|
+
"button:hover": {"background-color": "#3A7BC8"},
|
|
71
|
+
}
|
|
72
|
+
```
|
|
73
|
+
After that, you build the css of the components:
|
|
74
|
+
```sh
|
|
75
|
+
hypie build -i <path/to/components/dir> -o <path/to/static_or_dist/dir> --watch
|
|
76
|
+
```
|
|
77
|
+
And return your components from your preferred python backend framework:
|
|
78
|
+
|
|
79
|
+
```python
|
|
80
|
+
import pathlib
|
|
81
|
+
|
|
82
|
+
import htpy
|
|
83
|
+
from fastapi import FastAPI
|
|
84
|
+
from fastapi.staticfiles import StaticFiles
|
|
85
|
+
from fastapi.responses import HTMLResponse
|
|
86
|
+
from .ui.components import Counter
|
|
87
|
+
|
|
88
|
+
app = FastAPI()
|
|
89
|
+
|
|
90
|
+
app.mount(
|
|
91
|
+
"/static", StaticFiles(directory=pathlib.Path(__file__).parent.resolve() / "static")
|
|
92
|
+
)
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
@app.get("/")
|
|
96
|
+
def counter_example():
|
|
97
|
+
return HTMLResponse(htpy.html[
|
|
98
|
+
htpy.head[
|
|
99
|
+
htpy.title["Counter"],
|
|
100
|
+
# this was generated with hypie build
|
|
101
|
+
htpy.link(rel="stylesheet", href="/static/_hypie_styles.css"),
|
|
102
|
+
|
|
103
|
+
# we need to load _hyperscript
|
|
104
|
+
htpy.script(src="https://cdn.jsdelivr.net/npm/hyperscript.org@0.9.93"),
|
|
105
|
+
],
|
|
106
|
+
htpy.body[
|
|
107
|
+
Counter(5)
|
|
108
|
+
]
|
|
109
|
+
])
|
|
110
|
+
```
|
|
111
|
+
|
|
27
112
|
## Installation
|
|
28
113
|
```sh
|
|
29
114
|
uv add hypie
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|