Skip to main content

max / quasi

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