Skip to main content

spaday-fluent

Typed Fluent UI web components and browser assets for spaday.

Build Status codecov License PyPI

Preview of fluent components in spaday rendering a sprint hub

Overview

from spaday import SetField, element, serve
from spaday_fluent import FluentBadge, FluentButton

page = element("div").child(
    FluentButton(appearance="primary").text("Approve").on("click", SetField("state", "approved")),
    FluentBadge(color="brand").bind("textContent", "state"),
)
serve(page, packages=["fluent"], store={"state": "pending"})

Every element of @fluentui/web-components has a typed class generated from its Custom Elements Manifest, so props, events and slots are checked when you author the tree; enum props such as appearance carry their choices. Installing the package does not inject assets; select it with packages=["fluent"] or pass the exported package descriptor.

Run the local example

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

Open http://127.0.0.1:8024 for the sprint hub: a task board streamed from Python over transports with progress bars, badges and avatars, tasks closed through a Python endpoint, an activity drawer, a team accordion whose presence updates live, a task form of text input, dropdown, radio group, slider, text area and checkbox bound to spaday state and confirmed in a dialog, tabs, a tooltip, and a dark switch that re-themes Fluent and the spaday shell together.

Theming

Fluent's design tokens are CSS custom properties. The stylesheet carries Fluent's light and dark themes and maps spaday's --spa-* shell palette onto them, so restyling Fluent restyles the shell and every other spaday component package with it. TOKENS lists the Fluent tokens wired to the palette, each settable through css():

App().css(colorBrandBackground="#0C4253")

The dark theme follows spaday's page mode: a wa-dark class on the root (for example App(...).bind_root_class("wa-dark", "dark")) or on any island switches it, and wa-light flips a nested island back. A theme applied with Fluent's own setTheme() takes precedence.

Sharing Fluent with your own library

Fluent registers global custom element names, so a second copy on the page throws from customElements.define. The package serves Fluent's modules under their own bare specifiers — @fluentui/web-components, @fluentui/web-components/button.js and the rest of its exports — along with @microsoft/fast-element, which a library extending Fluent's classes has to share, and @fluentui/tokens, through the page's import map. A library built on Fluent that leaves those imports out of its bundle (external: ["@fluentui/web-components", "@microsoft/fast-element"] 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-fluent 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-fluent 0.1.0
File Size Uploaded
spaday_fluent-0.1.0.tar.gz 577.6 kB Details

Built distribution (wheel)

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

Total release size: 1.3 MB

Release files / spaday_fluent-0.1.0.tar.gz

Download URL spaday_fluent-0.1.0.tar.gz
Size 577.6 kB
Tags Source
SHA-256 checksum
How to use checksums
f3fe8e3fe9287da598b5abcc63d858fa7605ecae2a91a6a54cab421fd1f43490
BLAKE2b-256 checksum
How to use checksums
04d6eff65a12ac7964d53fc87aad9c68eb6a5c0590fb15695b26462dbbe404d1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.14

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

Download URL spaday_fluent-0.1.0-py3-none-any.whl
Size 721.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9c8eecc91ee3eaba19dcdfa416408053cc7af9663d3212640e64aa5e56403c28
BLAKE2b-256 checksum
How to use checksums
cd1561332a24d5b17c6fc3627a86ec1119317bd72d916fc9edb27c315955f003
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