Skip to main content

spaday-lion

Typed Lion components and browser assets for spaday.

Build Status codecov License PyPI

Preview of lion components in spaday rendering a bank account opening page

Overview

from spaday import SetField, element, serve
from spaday_lion import LionButton, LionInput

page = element("form").child(
    LionInput(label="Name", name="name"),
    LionButton().text("Approve").on("click", SetField("state", "approved")),
    element("output").bind("textContent", "state"),
)
serve(page, packages=["lion"], store={"state": "pending"})

Every element @lion/ui registers has a typed class generated from its Custom Elements Manifest, including the attributes its form and localization mixins contribute, so props, events and slots are checked when you author the tree. Installing the package does not inject assets; select it with packages=["lion"] or pass the exported package descriptor.

Run the local example

python -m pip install -e ".[examples]"
python -m spaday_lion.example

Open http://127.0.0.1:8025 for the account opening page: a lion-form of input, email, IBAN, amount, datepicker, rich select, combobox, radio and checkbox groups, range, stepper, switch and text area whose serializedValue is posted to Python as one request and confirmed in a dialog, two-way bindings driving a live preview, a review queue streamed from Python with approvals, tabs, an accordion, a collapsible and a tooltip. Lion is white-label, so the page styles the elements from spaday's palette, and its dark switch flips them with the shell.

Theming

Lion is white-label: its elements ship functional styles only, with no theme and no design tokens, so TOKENS is empty and there is nothing to map onto spaday's --spa-* palette. Style them with ordinary CSS, reading the shell's tokens where they fit:

lion-button { background: var(--spa-accent); border: 1px solid var(--spa-border); }

Sharing Lion with your own library

Lion registers global custom element names, so a second copy on the page throws from customElements.define. The package serves Lion's modules under their own bare specifiers — @lion/ui/button.js, @lion/ui/define/lion-button.js, the translation modules and the rest of its exports — through the page's import map. A library built on Lion that leaves those imports out of its bundle (external: ["@lion/ui"] with esbuild) gets this copy, and nothing registers twice.

[!NOTE] This library was generated using copier from the Base Python Project Template repository.

Metadata

Release files for spaday-lion 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for spaday-lion 0.1.0
File Size Uploaded
spaday_lion-0.1.0.tar.gz 759.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for spaday-lion 0.1.0
File Interpreter ABI Platform
spaday_lion-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 1.8 MB

Release files / spaday_lion-0.1.0.tar.gz

Download URL spaday_lion-0.1.0.tar.gz
Size 759.9 kB
Tags Source
SHA-256 checksum
How to use checksums
06efcd12b028f42945ed3fb1f4e72884fa141749cf403e8cdccabf6e4dc9afe8
BLAKE2b-256 checksum
How to use checksums
c38ac9c6cd7e409f677a35b877fed6d97d22170bfff18d8efb851c462257818a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.14

Release files / spaday_lion-0.1.0-py3-none-any.whl

Download URL spaday_lion-0.1.0-py3-none-any.whl
Size 1.0 MB
Tags Python 3
SHA-256 checksum
How to use checksums
47fed458f043dc5988d33e23ca9c974a40fa348d6f89d609f4c1e1bdae35de75
BLAKE2b-256 checksum
How to use checksums
cb5dfe0512a7766b203a794fa96fec792b887e136836e654916dbc453c2a2439
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.14

Release history Release notifications | RSS feed

0.3.0

2 release files

0.2.0

2 release files

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page