max / makenotwork
| 1 | //! Widgets: named assemblies of things the description already says. |
| 2 | //! |
| 3 | //! The third tier, between a primitive and `Region::Handover`. A primitive is |
| 4 | //! drawn from scratch by every renderer and has to be something every host can |
| 5 | //! honour; a bespoke region is one app's own and carries no contents the |
| 6 | //! description knows. A widget is neither: a *name* over an assembly of members |
| 7 | //! the vocabulary already has. |
| 8 | //! |
| 9 | //! Full argument: wiki `widget-tier`. |
| 10 | //! |
| 11 | //! # What is left here |
| 12 | //! |
| 13 | //! Glue, and only glue. The widgets themselves live in `quasi-basics`, which is |
| 14 | //! where the carousel went once it had been proved against three real pages. |
| 15 | //! Each module here is an Askama entry point: it turns whatever the templates |
| 16 | //! happened to need into the widget's own types, renders the fragment, and |
| 17 | //! stops. |
| 18 | //! |
| 19 | //! A widget that has never rendered anything is a guess about what the assembly |
| 20 | //! needs, so a new one is welcome to start here and leave later. The carousel |
| 21 | //! found a missing primitive on its way through |
| 22 | //! (`makeover_layout::Image`, added 0.21.0, merged away in 0.42.0), which is the argument for proving one in |
| 23 | //! an app before it becomes shared. |
| 24 | //! |
| 25 | //! # A primitive's glue is a sibling of this directory, never a member |
| 26 | //! |
| 27 | //! Written here because this doc is what gets read when someone asks where a |
| 28 | //! described fragment goes. |
| 29 | //! |
| 30 | //! **A described fragment inside an Askama page is legitimate at any |
| 31 | //! granularity the vocabulary already names, primitive included.** One `Field` |
| 32 | //! qualifies; so does one `Act`. A single primitive is not a widget: it is a |
| 33 | //! primitive with an entry point. So the glue module sits at `src/quasi/`, |
| 34 | //! beside `rich_field.rs`, `upload_field.rs` and `export_act.rs`, and this |
| 35 | //! directory keeps meaning what the paragraphs above say it means: a name over |
| 36 | //! an assembly. |
| 37 | //! |
| 38 | //! What it buys is that a shared control converts at its own granularity |
| 39 | //! instead of once per parent. `export_act.rs` is the first one taken: five |
| 40 | //! Export CSV buttons in four templates, described once. The same applies to |
| 41 | //! the shared act rows — `partials/link_row.html`, `partials/tag.html`, and the |
| 42 | //! two identical delete buttons in `tabs/project_content.html` and |
| 43 | //! `tabs/project_blog.html`. |
| 44 | //! |
| 45 | //! ## What it costs, stated so it is not rediscovered |
| 46 | //! |
| 47 | //! A live visual change on a page no flag gates. The templates write |
| 48 | //! `class="btn-secondary text-sm"` and a described act emits `class="button"`, |
| 49 | //! so the control lands on the design system's button rather than the app's: |
| 50 | //! `--surface-raised` and `--bevel-raised` where `.btn-secondary` sets |
| 51 | //! `--surface-sunken`, `--shadow-raised` and its own padding and font size. |
| 52 | //! That is the swap, it is deliberate, and it wants an eyeball rather than a |
| 53 | //! test. |
| 54 | //! |
| 55 | //! It is not a loss of the design system's button altogether. `style.css` is |
| 56 | //! unlayered and outranks `@layer makeover` at any specificity, so a bare |
| 57 | //! `button { }` rule there takes the surface, the bevel **and the tone** off |
| 58 | //! every described act. The `revert-layer` handoff at `style.css:473` is what |
| 59 | //! lets a described act reaching for `Tone::Danger` get it. |
| 60 | |
| 61 | |
| 62 | |
| 63 | |
| 64 |