API
App
App(content: ElementFactory, state_resolver: StateResolver | None = None, page_factory: PageFactory = default_page)
Methods:
Name | Description |
---|---|
__call__ |
|
Source code in rxxxt/app.py
37 38 39 40 |
|
__call__
async
__call__(scope: ASGIScope, receive: ASGIFnReceive, send: ASGIFnSend) -> Any
Source code in rxxxt/app.py
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
|
Component
Component()
Bases: Element
Methods:
Name | Description |
---|---|
add_job |
Runs a background job until completion. Only runs when the session is persistent. |
add_worker |
Runs a background worker, which may be cancelled at any time. Only runs when the session is persistent. |
lc_destroy |
|
lc_handle_event |
|
lc_init |
|
lc_render |
|
on_after_destroy |
|
on_after_update |
|
on_before_destroy |
|
on_before_update |
|
on_init |
|
render |
|
tonode |
|
Attributes:
Name | Type | Description |
---|---|---|
context |
Context
|
|
Source code in rxxxt/component.py
79 80 81 82 83 |
|
add_job
add_job(a: Coroutine)
Runs a background job until completion. Only runs when the session is persistent. args: a: Coroutine - the coroutine that should be run
Source code in rxxxt/component.py
88 89 90 91 92 93 94 95 96 |
|
add_worker
add_worker(a: Coroutine)
Runs a background worker, which may be cancelled at any time. Only runs when the session is persistent. args: a: Coroutine - the coroutine that should be run
Source code in rxxxt/component.py
97 98 99 100 101 102 103 104 105 |
|
lc_destroy
async
lc_destroy() -> None
Source code in rxxxt/component.py
116 117 118 119 120 121 122 123 124 125 126 127 |
|
lc_handle_event
async
lc_handle_event(event: dict[str, int | float | str | bool])
Source code in rxxxt/component.py
129 130 131 132 133 134 |
|
lc_init
async
lc_init(context: Context) -> None
Source code in rxxxt/component.py
107 108 109 |
|
lc_render
async
lc_render() -> Element
Source code in rxxxt/component.py
111 112 113 114 115 |
|
on_after_destroy
async
on_after_destroy() -> None
Source code in rxxxt/component.py
140 |
|
on_after_update
async
on_after_update() -> None
Source code in rxxxt/component.py
138 |
|
on_before_destroy
async
on_before_destroy() -> None
Source code in rxxxt/component.py
139 |
|
on_before_update
async
on_before_update() -> None
Source code in rxxxt/component.py
137 |
|
on_init
async
on_init() -> None
Source code in rxxxt/component.py
136 |
|
render
abstractmethod
Source code in rxxxt/component.py
85 86 |
|
tonode
tonode(context: Context) -> Node
Source code in rxxxt/component.py
142 |
|
event_handler
event_handler(**kwargs)
Source code in rxxxt/component.py
65 66 67 68 |
|
HandleNavigate
HandleNavigate(location: str)
Bases: CustomAttribute
Methods:
Name | Description |
---|---|
get_key_value |
|
Attributes:
Name | Type | Description |
---|---|---|
location |
|
Source code in rxxxt/component.py
71 72 73 |
|
location
instance-attribute
location = location
get_key_value
get_key_value(original_key: str) -> tuple[str, str]
Source code in rxxxt/component.py
75 76 |
|
CustomAttribute
Bases: ABC
Methods:
Name | Description |
---|---|
get_key_value |
|
get_key_value
abstractmethod
get_key_value(original_key: str) -> tuple[str, str | None]
Source code in rxxxt/elements.py
9 10 |
|
El
Element
ElementFactory
HTMLElement
HTMLElement(tag: str, attributes: dict[str, HTMLAttributeValue], content: ElementContent)
Bases: HTMLVoidElement
Methods:
Name | Description |
---|---|
tonode |
|
Source code in rxxxt/elements.py
53 54 55 |
|
tonode
tonode(context: Context) -> Node
Source code in rxxxt/elements.py
57 58 |
|
HTMLFragment
HTMLFragment(content: ElementContent)
Bases: Element
Methods:
Name | Description |
---|---|
tonode |
|
Source code in rxxxt/elements.py
29 30 31 |
|
tonode
tonode(context: Context) -> Node
Source code in rxxxt/elements.py
33 34 |
|
HTMLVoidElement
HTMLVoidElement(tag: str, attributes: dict[str, HTMLAttributeValue])
Bases: Element
Methods:
Name | Description |
---|---|
tonode |
|
Source code in rxxxt/elements.py
37 38 39 40 41 42 43 44 45 46 47 |
|
tonode
tonode(context: Context) -> Node
Source code in rxxxt/elements.py
49 50 |
|
UnescapedHTMLElement
UnescapedHTMLElement(text: str)
Bases: Element
Methods:
Name | Description |
---|---|
tonode |
|
Source code in rxxxt/elements.py
72 73 74 |
|
tonode
tonode(context: Context) -> Node
Source code in rxxxt/elements.py
76 |
|
VEl
ContextInputEventHandlerOptions
Bases: BaseModel
Attributes:
Name | Type | Description |
---|---|---|
debounce |
int | None
|
|
prevent_default |
bool
|
|
throttle |
int | None
|
|
debounce
class-attribute
instance-attribute
debounce: int | None = None
prevent_default
class-attribute
instance-attribute
prevent_default: bool = False
throttle
class-attribute
instance-attribute
throttle: int | None = None
Context
Context(state: State, config: ContextConfig, stack: ContextStack)
Methods:
Attributes:
Name | Type | Description |
---|---|---|
config |
|
|
cookies |
dict[str, str]
|
|
id |
|
|
location |
|
|
path |
|
|
query_string |
|
|
sid |
|
|
stack_sids |
|
|
state |
|
Source code in rxxxt/execution.py
148 149 150 151 |
|
config
property
config
cookies
property
cookies: dict[str, str]
id
property
id
location
property
location
path
property
path
query_string
property
query_string
sid
cached
property
sid
stack_sids
property
stack_sids
state
instance-attribute
state = state
add_query_selector_event
add_query_selector_event(selector: str, name: str, descriptor: ContextInputEventDescriptor | ContextInputEventDescriptorGenerator, all: bool = False)
Source code in rxxxt/execution.py
210 211 |
|
add_window_event
add_window_event(name: str, descriptor: ContextInputEventDescriptor | ContextInputEventDescriptorGenerator)
Source code in rxxxt/execution.py
208 209 |
|
delete_cookie
delete_cookie(name: str)
Source code in rxxxt/execution.py
225 226 |
|
get_header
get_header(name: str) -> list[str]
Source code in rxxxt/execution.py
198 199 200 201 |
|
navigate
navigate(location: str)
Source code in rxxxt/execution.py
218 219 220 |
|
remove_query_selector_event
remove_query_selector_event(selector: str, name: str, descriptor: ContextInputEventDescriptor | ContextInputEventDescriptorGenerator, all: bool = False)
Source code in rxxxt/execution.py
215 216 |
|
remove_window_event
remove_window_event(name: str, descriptor: ContextInputEventDescriptor | ContextInputEventDescriptorGenerator)
Source code in rxxxt/execution.py
213 214 |
|
replace_index
replace_index(key: str)
Source code in rxxxt/execution.py
194 195 196 |
|
request_update
request_update()
Source code in rxxxt/execution.py
203 |
|
set_cookie
set_cookie(name: str, value: str, expires: datetime | None = None, path: str | None = None, secure: bool | None = None, http_only: bool | None = None, domain: str | None = None, max_age: int | None = None)
Source code in rxxxt/execution.py
222 223 224 |
|
sub
sub(key: ContextStackKey)
Source code in rxxxt/execution.py
193 |
|
subscribe
subscribe(key: str)
Source code in rxxxt/execution.py
204 |
|
unsubscribe
unsubscribe(key: str)
Source code in rxxxt/execution.py
205 |
|
unsubscribe_all
unsubscribe_all()
Source code in rxxxt/execution.py
206 |
|
use_websocket
use_websocket(websocket: bool = True)
Source code in rxxxt/execution.py
221 |
|
State
State(update_event: Event)
State keys may have prefixes. These prefixes inidcate how and when and if a key should be removed from the state. Prefixes: "#" = temporary - removed from the user data and session state, if no longer used "!" = protocol - removed from user state, if not used but not purged from the session
Methods:
Attributes:
Name | Type | Description |
---|---|---|
keys |
set[str]
|
|
user_data |
|
Source code in rxxxt/execution.py
25 26 27 28 29 30 31 32 |
|
keys
property
keys: set[str]
user_data
property
user_data
add_output_event
add_output_event(event: OutputEvent)
Source code in rxxxt/execution.py
93 94 95 |
|
cleanup
cleanup()
Source code in rxxxt/execution.py
113 114 115 116 117 118 119 120 121 |
|
delete_key
delete_key(key: str)
Source code in rxxxt/execution.py
56 57 58 59 |
|
destroy
destroy()
Source code in rxxxt/execution.py
108 109 110 111 |
|
get_key_cell
get_key_cell(key: str)
Source code in rxxxt/execution.py
51 |
|
get_key_str
get_key_str(key: str)
Source code in rxxxt/execution.py
46 47 48 49 50 |
|
init
init(k_str_store: dict[str, str])
Source code in rxxxt/execution.py
44 |
|
pop_output_events
pop_output_events()
Source code in rxxxt/execution.py
97 98 99 100 |
|
pop_updates
pop_updates()
Source code in rxxxt/execution.py
102 103 104 105 106 |
|
request_context_updates
request_context_updates(ids: set[ContextStack])
Source code in rxxxt/execution.py
72 73 74 |
|
request_key_updates
request_key_updates(keys: set[str])
Source code in rxxxt/execution.py
76 77 78 |
|
set_key_cell
set_key_cell(key: str, cell: StateCell, overwrite: bool = False)
Source code in rxxxt/execution.py
52 53 54 55 |
|
subscribe
subscribe(cid: ContextStack, key: str)
Source code in rxxxt/execution.py
80 81 |
|
unsubscribe
unsubscribe(cid: ContextStack, key: str)
Source code in rxxxt/execution.py
83 84 85 |
|
unsubscribe_all
unsubscribe_all(cid: ContextStack)
Source code in rxxxt/execution.py
87 88 89 90 91 |
|
update_state_strs
update_state_strs(data: dict[str, str])
Source code in rxxxt/execution.py
61 62 63 64 65 66 67 68 69 70 |
|
default_page
Source code in rxxxt/page.py
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
|
PageBuilder
PageBuilder(page_factory: PageFactory = default_page)
Bases: PageFactory
Methods:
Name | Description |
---|---|
__call__ |
|
add_body_end |
|
add_body_script |
|
add_header |
|
add_header_script |
|
add_stylesheet |
|
Source code in rxxxt/page.py
24 25 26 27 |
|
__call__
Source code in rxxxt/page.py
38 39 |
|
add_body_end
add_body_end(el: Element)
Source code in rxxxt/page.py
36 |
|
add_body_script
add_body_script(url: str, content: list[Element | str] = [], **kwargs: str)
Source code in rxxxt/page.py
32 33 |
|
add_header
add_header(el: Element)
Source code in rxxxt/page.py
35 |
|
add_header_script
add_header_script(url: str, content: list[Element | str] = [], **kwargs: str)
Source code in rxxxt/page.py
30 31 |
|
add_stylesheet
add_stylesheet(url: str, **kwargs: str)
Source code in rxxxt/page.py
29 |
|
Router
Router()
Bases: ElementFactory
Classes:
Name | Description |
---|---|
RoutedComponent |
|
Methods:
Name | Description |
---|---|
__call__ |
|
add_route |
|
route |
|
Source code in rxxxt/router.py
93 94 |
|
RoutedComponent
RoutedComponent(routes: list[tuple[PathPattern, ElementFactory]])
Bases: Component
Methods:
Name | Description |
---|---|
on_before_update |
|
render |
|
Attributes:
Name | Type | Description |
---|---|---|
params |
|
Source code in rxxxt/router.py
70 71 72 73 |
|
on_before_update
async
on_before_update() -> None
Source code in rxxxt/router.py
75 76 77 |
|
render
render() -> Element
Source code in rxxxt/router.py
79 80 81 82 83 |
|
__call__
__call__() -> Element
Source code in rxxxt/router.py
103 |
|
add_route
add_route(path: str, element_factory: ElementFactory)
Source code in rxxxt/router.py
96 |
|
route
route(path: str)
Source code in rxxxt/router.py
97 98 99 100 101 |
|
router_params
router_params()
Source code in rxxxt/router.py
64 |
|
context_state
context_state(default_factory: Callable[[], T], name: str | None = None)
Source code in rxxxt/state.py
128 129 |
|
context_state_box
context_state_box(default_factory: Callable[[], T], name: str | None = None)
Source code in rxxxt/state.py
137 138 |
|
default_state_resolver
default_state_resolver() -> JWTStateResolver
Creates a JWTStateResolver.
Uses the environment variable JWT_SECRET
as its secret, if set, otherwise creates a new random, temporary secret.
Source code in rxxxt/state.py
206 207 208 209 210 211 212 213 214 215 |
|
global_state
global_state(default_factory: Callable[[], T], name: str | None = None)
Source code in rxxxt/state.py
125 126 |
|
global_state_box
global_state_box(default_factory: Callable[[], T], name: str | None = None)
Source code in rxxxt/state.py
134 135 |
|
JWTStateResolver
JWTStateResolver(secret: bytes, max_age: timedelta | None = None, algorithm: Literal['HS256'] | Literal['HS384'] | Literal['HS512'] = 'HS512')
Bases: StateResolver
Methods:
Name | Description |
---|---|
create_token |
|
resolve |
|
Source code in rxxxt/state.py
149 150 151 152 153 154 |
|
create_token
create_token(data: dict[str, str], old_token: str | None) -> str
Source code in rxxxt/state.py
156 157 158 159 160 161 162 163 164 165 166 167 168 169 |
|
resolve
resolve(token: str) -> dict[str, str] | Awaitable[dict[str, str]]
Source code in rxxxt/state.py
171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 |
|
local_state
local_state(default_factory: Callable[[], T], name: str | None = None)
Source code in rxxxt/state.py
122 123 |
|
local_state_box
local_state_box(default_factory: Callable[[], T], name: str | None = None)
Source code in rxxxt/state.py
131 132 |
|
StateResolver
Bases: ABC
Methods:
Name | Description |
---|---|
create_token |
|
resolve |
|
create_token
abstractmethod
create_token(data: dict[str, str], old_token: str | None) -> str | Awaitable[str]
Source code in rxxxt/state.py
143 144 |
|
resolve
abstractmethod
resolve(token: str) -> dict[str, str] | Awaitable[dict[str, str]]
Source code in rxxxt/state.py
145 146 |
|
class_map
class_map(map: dict[str, bool])
Source code in rxxxt/utils.py
1 2 |
|