Skip to main content

max / quasi

2.3 KB · 50 lines History Blame Raw
1 //! The first-party widget set.
2 //!
3 //! <!-- wiki: quasi-overview -->
4 //!
5 //! A widget is an assembly of primitives under a name. `makeover-layout` grew
6 //! [`Region::Widget`](makeover_layout::Region::Widget) at 0.20.0 to make one
7 //! sayable; this crate is where ours live.
8 //!
9 //! # Why this is not a makeover crate
10 //!
11 //! It was going to be, as `makeover-basics`, and the carousel proved it could
12 //! not be. A widget is an assembly of [`Node`](quasi_router::Node)s, and
13 //! `Node`, [`Slot`](quasi_router::Slot) and [`Image`](quasi_router::Image)
14 //! are `quasi-router`'s. That is not an accident of which crate somebody typed
15 //! them into: `makeover-layout` defers every address by rule, and
16 //! `layout::Image` carries a shape and its alt text and deliberately no source.
17 //! So a widget with a picture in it is unsayable below `quasi-router` by
18 //! construction, and the widget tier sits above the description suite rather
19 //! than inside it.
20 //!
21 //! The consequence worth knowing is the good one: nothing here is a new
22 //! drawing surface. Every widget is made of members the vocabulary already
23 //! has, so a renderer that has never heard of one walks its body and draws
24 //! primitives. Naming a widget costs no renderer release, and a widget is
25 //! never how a primitive gets added by the back door.
26 //!
27 //! # What belongs here
28 //!
29 //! What more than one of our apps wants, and what one of them wants badly
30 //! enough to be worth sharing the shape of. The first-party set stays
31 //! deliberately thin: the suite ships the tier, and every widget shipped here
32 //! is one the ecosystem does not get to name itself.
33 //!
34 //! A thing that needs a member the vocabulary does not have is still a finding
35 //! about the vocabulary. A thing specific to one app is still
36 //! [`Region::Handover`](makeover_layout::Region::Handover).
37 //!
38 //! # Adopting one in a webview app
39 //!
40 //! The description emits a plain `<div>` carrying `data-widget="<name>"`,
41 //! because it has no idea the host prefixes its custom elements. An app that
42 //! enhances a widget with script wraps the region in its own custom element
43 //! rather than expecting to be one: a custom element is what the browser
44 //! re-upgrades after an htmx swap, which is the whole reason islands are
45 //! custom elements.
46
47 pub mod carousel;
48
49 pub use carousel::{Frame, Gallery, Size, carousel};
50