{"vsa":"0.9.0","type":"StaticManifest","manifestVersion":"1.0.0","viewId":"docs-v0-1-views-2","title":"Views (2) · Docs v0.1","requires":[{"name":"zone.text","version":"^1.0.0"}],"optional":[{"name":"render.dom","version":"^1.0.0"},{"name":"projection.slots","version":"^1.0.0"}],"trustDomain":"self","dataClass":"public","zones":[{"zoneId":"l-1","kind":"text","label":"Luxel"},{"zoneId":"l-2","kind":"text","label":"Docs"},{"zoneId":"l-3","kind":"text","label":"Demo"},{"zoneId":"l-4","kind":"text","label":"Numbers"},{"zoneId":"l-5","kind":"text","label":"Security"},{"zoneId":"l-6","kind":"text","label":"Releases"},{"zoneId":"l-7","kind":"text","label":"Roadmap"},{"zoneId":"l-8","kind":"text","label":"Blog"},{"zoneId":"l-9","kind":"text","label":"Español"},{"zoneId":"t-10","kind":"text","label":"Docs v0.1"},{"zoneId":"l-11","kind":"text","label":"Search documentation →"},{"zoneId":"t-12","kind":"text","label":"Start"},{"zoneId":"l-13","kind":"text","label":"Overview"},{"zoneId":"l-14","kind":"text","label":"Getting started"},{"zoneId":"l-15","kind":"text","label":"Primeros pasos"},{"zoneId":"l-16","kind":"text","label":"Concepts"},{"zoneId":"t-17","kind":"text","label":"Guide"},{"zoneId":"l-18","kind":"text","label":"Views"},{"zoneId":"l-19","kind":"text","label":"Screens"},{"zoneId":"l-20","kind":"text","label":"Testing screens"},{"zoneId":"l-21","kind":"text","label":"Forms"},{"zoneId":"l-22","kind":"text","label":"Collections"},{"zoneId":"l-23","kind":"text","label":"Charts"},{"zoneId":"l-24","kind":"text","label":"Polling"},{"zoneId":"l-25","kind":"text","label":"Languages"},{"zoneId":"l-26","kind":"text","label":"Server"},{"zoneId":"l-27","kind":"text","label":"Sessions"},{"zoneId":"l-28","kind":"text","label":"Production"},{"zoneId":"l-29","kind":"text","label":"Tooling"},{"zoneId":"l-30","kind":"text","label":"From React or Next.js"},{"zoneId":"t-31","kind":"text","label":"Reference"},{"zoneId":"l-32","kind":"text","label":"Typical React mistakes"},{"zoneId":"l-33","kind":"text","label":"API"},{"zoneId":"l-34","kind":"text","label":"Diagnostics"},{"zoneId":"t-35","kind":"text","label":"Security"},{"zoneId":"l-36","kind":"text","label":"Security guide"},{"zoneId":"l-37","kind":"text","label":"Threat model"},{"zoneId":"l-38","kind":"text","label":"Claims and evidence"},{"zoneId":"t-39","kind":"text","label":"Project"},{"zoneId":"l-40","kind":"text","label":"Known gaps"},{"zoneId":"l-41","kind":"text","label":"Changelog"},{"zoneId":"l-42","kind":"text","label":"Index of all sections"},{"zoneId":"t-43","kind":"text","label":"Luxel v0.1 · Guide · part 2 of 2"},{"zoneId":"t-44","kind":"text","label":"Views (2)"},{"zoneId":"t-45","kind":"text","label":"Contract leaf"},{"zoneId":"t-46","kind":"text","label":"Where it goes"},{"zoneId":"t-47","kind":"text","label":"What the server sends"},{"zoneId":"t-48","kind":"text","label":"collection({ key, fields })"},{"zoneId":"t-49","kind":"text","label":"‹Collection bind>"},{"zoneId":"t-50","kind":"text","label":"A list of items, each with its key"},{"zoneId":"t-51","kind":"text","label":"Inside a collection item, the fields have their own leaf types: text(), money(), date(), quantity(), number(), status([...]) and value()."},{"zoneId":"t-52","kind":"text","label":"What the compiler checks:"},{"zoneId":"t-53","kind":"text","label":"a bind that names no path is LUXEL-E006 (the message lists the paths and suggests the closest);"},{"zoneId":"t-54","kind":"text","label":"a Text bound to a collection, or a Collection bound to a single value, is LUXEL-E014;"},{"zoneId":"t-55","kind":"text","label":"a money Text with children is LUXEL-E011 (put the visible label in label);"},{"zoneId":"t-56","kind":"text","label":"label on a non-money Text is LUXEL-E011."},{"zoneId":"t-57","kind":"text","label":"The handler side is checked too: .luxel/server.ts types each path, so ctx.set('contacts.summary', 42) is a TypeScript error."},{"zoneId":"t-58","kind":"text","label":"Layout: Stack, Row and as"},{"zoneId":"t-59","kind":"text","label":"Stack and Row are plain containers. They have no layout of their own: the layout comes from your stylesheet, through className, as in any CSS project."},{"zoneId":"t-60","kind":"text","label":"as picks the element: main, section, header, footer, div (default), p, form, span, table, thead, tbody, tr, td, th, ul, ol, li, figure. View takes as too (default main)."},{"zoneId":"t-61","kind":"text","label":"‹Stack as=\"table\" className=\"table\">\n  ‹Stack as=\"thead\">\n    ‹Stack as=\"tr\">\n      ‹Text id=\"h-name\" as=\"th\">Name‹/Text>\n      ‹Text id=\"h-email\" as=\"th\">Email‹/Text>\n    ‹/Stack>\n  ‹/Stack>\n"},{"zoneId":"t-62","kind":"text","label":"  {/* ‹Collection as=\"tbody\"> … see Collections */}\n‹/Stack>"},{"zoneId":"t-63","kind":"text","label":"as=\"form\" has a meaning beyond the element: it groups the Fields that an Action inside it sends."},{"zoneId":"t-64","kind":"text","label":"The layout may nest at most 16 elements (LUXEL-E050). Flatten wrappers that only carry a class."},{"zoneId":"t-65","kind":"text","label":"Classes and stylesheets"},{"zoneId":"t-66","kind":"text","label":"No inline styles: style is LUXEL-E010. The strict CSP allows no inline style attribute."},{"zoneId":"t-67","kind":"text","label":"className takes space-separated tokens matching [a-z][a-z0-9_-]*, at most 8."},{"zoneId":"t-68","kind":"text","label":"Stylesheets are files of your project:"},{"zoneId":"t-69","kind":"text","label":"// luxel.config.ts\nstyles: ['src/styles.css'],                    // every page\nviews: {\n  agencies: { loginView: 'login', styles: ['src/agencies.css'] },   // this view only\n},"},{"zoneId":"t-70","kind":"text","label":"For each view the compiler keeps only the CSS rules the view can use. Then:"},{"zoneId":"t-71","kind":"text","label":"if that CSS fits the inline budget (css.inlineLimit, counted as css.inlineMeasure: see below), it is inlined in a ‹style> that the CSP allows by its hash;"},{"zoneId":"t-72","kind":"text","label":"if it is larger, the critical part (what the first paint needs) is inlined with its hash and the whole page CSS is linked as one hashed file, applied after the paint;"},{"zoneId":"t-73","kind":"text","label":"if even the critical part is above the limit, the whole CSS is linked and blocks the paint, and the build warns with LUXEL-W003."},{"zoneId":"t-74","kind":"text","label":"css: { mode: 'auto' | 'inline' | 'link', inlineLimit, inlineMeasure } in luxel.config.ts changes this; auto is the default. inlineMeasure says what inlineLimit counts: 'brotli' (the bytes the CSS adds to the compressed page) or 'raw' (its "},{"zoneId":"t-75","kind":"text","label":"uncompressed bytes); the default budget is chosen in ADR-059. Inlined CSS travels with every page and is not cached between pages; a linked file is cached, but the first page that needs it waits for it. For measurements, "},{"zoneId":"t-76","kind":"text","label":"LUXEL_CSS_INLINE_LIMIT and LUXEL_CSS_INLINE_MEASURE override the config (set them for luxel build and luxel-host alike)."},{"zoneId":"t-77","kind":"text","label":"Hover, focus and other local presentation come from CSS. There is no JavaScript to toggle classes."},{"zoneId":"t-78","kind":"text","label":"Static data at build time"},{"zoneId":"t-79","kind":"text","label":"Because the view runs in Node at build time, you can use anything the build can evaluate:"},{"zoneId":"t-80","kind":"text","label":"imports of your own files and static data;"},{"zoneId":"t-81","kind":"text","label":"constants;"},{"zoneId":"t-82","kind":"text","label":"your own helper components (plain, synchronous functions);"},{"zoneId":"t-83","kind":"text","label":".map() over arrays;"},{"zoneId":"t-84","kind":"text","label":"fragments;"},{"zoneId":"t-85","kind":"text","label":"cond && ‹X />, where cond is known at build time."},{"zoneId":"t-86","kind":"text","label":"A real example, the month labels under a chart:"},{"zoneId":"t-87","kind":"text","label":"const MONTHS = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];\n\n‹Row className=\"chart__labels\">\n  {MONTHS.map((m, i) => (\n    ‹Text id={`m${i + 1}`} as=\"span\">{m}‹/Text>\n  ))}\n‹/Row>"},{"zoneId":"t-88","kind":"text","label":"Each generated Text gets its own id: static texts need one."},{"zoneId":"t-89","kind":"text","label":"A helper component:"},{"zoneId":"t-90","kind":"text","label":"// src/components/Notice.tsx\nimport { Status } from '@luxel-framework/ui';\n\nexport function Notice({ id }: { id: string }) {\n  return ‹Status id={id} errorClassName=\"notice notice--error\" successClassName=\"notice notice--success\" />;\n}"},{"zoneId":"t-91","kind":"text","label":"‹Notice id=\"result\" />"},{"zoneId":"t-92","kind":"text","label":"What you cannot do:"},{"zoneId":"t-93","kind":"text","label":"read server state at build time (there is none: state arrives per request through bind);"},{"zoneId":"t-94","kind":"text","label":"return a Promise from a component (LUXEL-E025);"},{"zoneId":"t-95","kind":"text","label":"throw (LUXEL-E019), or import a module that does not exist (LUXEL-E020);"},{"zoneId":"t-96","kind":"text","label":"compute with an item field of a collection (see "},{"zoneId":"l-97","kind":"text","label":"Collections"},{"zoneId":"t-98","kind":"text","label":")."},{"zoneId":"t-99","kind":"text","label":"cond && ‹X /> decides once, at build time. A part that appears or disappears per user is decided by the server: an empty text, a collection with zero items, a state class, or an item marked unavailable."},{"zoneId":"t-100","kind":"text","label":"Determinism"},{"zoneId":"t-101","kind":"text","label":"The compiler runs each view twice. If the two results differ, the build fails with LUXEL-E026. So no Date.now(), no Math.random(), nothing that changes between runs: the same input must give the same bytes. A date or a random id the page "},{"zoneId":"t-102","kind":"text","label":"needs comes from the server."},{"zoneId":"t-103","kind":"text","label":"Runtime messages"},{"zoneId":"t-104","kind":"text","label":"The runtime shows two texts of its own: when the server cannot be reached, and on an unexpected error. The app owns them:"},{"zoneId":"t-105","kind":"text","label":"// luxel.config.ts\nmessages: {\n  network: 'Could not reach the server. Check your connection and try again.',\n  unexpected: 'Something went wrong. Reload the page.',\n},"},{"zoneId":"t-106","kind":"text","label":"‹View messages={{ … }}> overrides them for one view."},{"zoneId":"l-107","kind":"text","label":"Previous: Views"},{"zoneId":"l-108","kind":"text","label":"Previous: Concepts"},{"zoneId":"l-109","kind":"text","label":"Next: Screens"},{"zoneId":"l-110","kind":"text","label":"Edit this page on GitHub"},{"zoneId":"t-111","kind":"text","label":"This page: 7.9 KB of JavaScript (Luxel's shared runtime), 0 KB from your app."},{"zoneId":"t-112","kind":"text","label":"Measured when the site is built: the runtime files this page loads, compressed as they are sent."},{"zoneId":"l-113","kind":"text","label":"GitHub"},{"zoneId":"l-114","kind":"text","label":"Discussions"},{"zoneId":"l-115","kind":"text","label":"Apache-2.0"},{"zoneId":"l-116","kind":"text","label":"Ties and losses"},{"zoneId":"t-117","kind":"text","label":"Made by IntiOps. Luxel 0.1.0-beta.1 is a beta: no external security review yet."}],"events":[],"messages":{"network":"Could not reach the server. Check your connection and try again.","unexpected":"Something went wrong. Reload the page."},"extensions":{"render.dom@1":{"root":{"el":"div","class":"site site--en page--doc","children":[{"el":"header","class":"topbar","children":[{"zone":"l-1","el":"span","class":"brand"},{"el":"div","class":"nav","children":[{"zone":"l-2","el":"span","class":"nav-link"},{"zone":"l-3","el":"span","class":"nav-link"},{"zone":"l-4","el":"span","class":"nav-link"},{"zone":"l-5","el":"span","class":"nav-link"},{"zone":"l-6","el":"span","class":"nav-link"},{"zone":"l-7","el":"span","class":"nav-link"},{"zone":"l-8","el":"span","class":"nav-link"}]},{"zone":"l-9","el":"span","class":"lang"}]},{"el":"main","class":"main main--doc","children":[{"el":"div","class":"sidebar","children":[{"zone":"t-10","el":"p","class":"sidebar-version"},{"zone":"l-11","el":"span","class":"side-link side-link--search"},{"zone":"t-12","el":"p","class":"sidebar-group"},{"el":"div","class":"sidebar-links","children":[{"zone":"l-13","el":"span","class":"side-link"},{"zone":"l-14","el":"span","class":"side-link"},{"zone":"l-15","el":"span","class":"side-link"},{"zone":"l-16","el":"span","class":"side-link"}]},{"zone":"t-17","el":"p","class":"sidebar-group"},{"el":"div","class":"sidebar-links","children":[{"zone":"l-18","el":"span","class":"side-link side-link--current"},{"zone":"l-19","el":"span","class":"side-link"},{"zone":"l-20","el":"span","class":"side-link"},{"zone":"l-21","el":"span","class":"side-link"},{"zone":"l-22","el":"span","class":"side-link"},{"zone":"l-23","el":"span","class":"side-link"},{"zone":"l-24","el":"span","class":"side-link"},{"zone":"l-25","el":"span","class":"side-link"},{"zone":"l-26","el":"span","class":"side-link"},{"zone":"l-27","el":"span","class":"side-link"},{"zone":"l-28","el":"span","class":"side-link"},{"zone":"l-29","el":"span","class":"side-link"},{"zone":"l-30","el":"span","class":"side-link"}]},{"zone":"t-31","el":"p","class":"sidebar-group"},{"el":"div","class":"sidebar-links","children":[{"zone":"l-32","el":"span","class":"side-link"},{"zone":"l-33","el":"span","class":"side-link"},{"zone":"l-34","el":"span","class":"side-link"}]},{"zone":"t-35","el":"p","class":"sidebar-group"},{"el":"div","class":"sidebar-links","children":[{"zone":"l-36","el":"span","class":"side-link"},{"zone":"l-37","el":"span","class":"side-link"},{"zone":"l-38","el":"span","class":"side-link"}]},{"zone":"t-39","el":"p","class":"sidebar-group"},{"el":"div","class":"sidebar-links","children":[{"zone":"l-40","el":"span","class":"side-link"},{"zone":"l-41","el":"span","class":"side-link"}]},{"zone":"l-42","el":"span","class":"side-link side-link--index"}]},{"el":"section","class":"article","children":[{"zone":"t-43","el":"p","class":"doc-meta"},{"zone":"t-44","el":"h1","class":"page-title"},{"el":"div","class":"block","children":[{"el":"div","class":"table-wrap","children":[{"el":"table","class":"table","children":[{"el":"thead","children":[{"el":"tr","children":[{"zone":"t-45","el":"th"},{"zone":"t-46","el":"th"},{"zone":"t-47","el":"th"}]}]},{"el":"tbody","children":[{"el":"tr","children":[{"zone":"t-48","el":"td"},{"zone":"t-49","el":"td"},{"zone":"t-50","el":"td"}]}]}]}]},{"zone":"t-51","el":"p","class":"para"},{"zone":"t-52","el":"p","class":"para"},{"el":"div","class":"list-wrap","children":[{"el":"ul","class":"list","children":[{"zone":"t-53","el":"li"},{"zone":"t-54","el":"li"},{"zone":"t-55","el":"li"},{"zone":"t-56","el":"li"}]}]},{"zone":"t-57","el":"p","class":"para"},{"zone":"t-58","el":"h2","class":"section-title"},{"zone":"t-59","el":"p","class":"para"},{"zone":"t-60","el":"p","class":"para"},{"el":"p","class":"code","children":[{"zone":"t-61","el":"span"},{"zone":"t-62","el":"span"}]},{"zone":"t-63","el":"p","class":"para"},{"zone":"t-64","el":"p","class":"para"},{"zone":"t-65","el":"h2","class":"section-title"},{"el":"div","class":"list-wrap","children":[{"el":"ul","class":"list","children":[{"zone":"t-66","el":"li"},{"zone":"t-67","el":"li"},{"zone":"t-68","el":"li"}]}]},{"zone":"t-69","el":"p","class":"code"},{"zone":"t-70","el":"p","class":"para"},{"el":"div","class":"list-wrap","children":[{"el":"ul","class":"list","children":[{"zone":"t-71","el":"li"},{"zone":"t-72","el":"li"},{"zone":"t-73","el":"li"}]}]},{"el":"p","class":"para","children":[{"zone":"t-74","el":"span"},{"zone":"t-75","el":"span"},{"zone":"t-76","el":"span"}]},{"zone":"t-77","el":"p","class":"para"},{"zone":"t-78","el":"h2","class":"section-title"},{"zone":"t-79","el":"p","class":"para"},{"el":"div","class":"list-wrap","children":[{"el":"ul","class":"list","children":[{"zone":"t-80","el":"li"},{"zone":"t-81","el":"li"},{"zone":"t-82","el":"li"},{"zone":"t-83","el":"li"},{"zone":"t-84","el":"li"},{"zone":"t-85","el":"li"}]}]},{"zone":"t-86","el":"p","class":"para"},{"zone":"t-87","el":"p","class":"code"},{"zone":"t-88","el":"p","class":"para"},{"zone":"t-89","el":"p","class":"para"},{"zone":"t-90","el":"p","class":"code"},{"zone":"t-91","el":"p","class":"code"},{"zone":"t-92","el":"p","class":"para"},{"el":"div","class":"list-wrap","children":[{"el":"ul","class":"list","children":[{"zone":"t-93","el":"li"},{"zone":"t-94","el":"li"},{"zone":"t-95","el":"li"},{"el":"li","children":[{"zone":"t-96","el":"span"},{"zone":"l-97","el":"span"},{"zone":"t-98","el":"span"}]}]}]},{"zone":"t-99","el":"p","class":"para"},{"zone":"t-100","el":"h2","class":"section-title"},{"el":"p","class":"para","children":[{"zone":"t-101","el":"span"},{"zone":"t-102","el":"span"}]},{"zone":"t-103","el":"h2","class":"section-title"},{"zone":"t-104","el":"p","class":"para"},{"zone":"t-105","el":"p","class":"code"},{"zone":"t-106","el":"p","class":"para"}]},{"el":"div","class":"pager","children":[{"zone":"l-107","el":"span","class":"pager-link"},{"zone":"l-108","el":"span","class":"pager-link"},{"zone":"l-109","el":"span","class":"pager-link pager-link--next"}]},{"zone":"l-110","el":"span","class":"edit-link"}]}]},{"el":"footer","class":"footer","children":[{"zone":"t-111","el":"p","class":"jsline"},{"zone":"t-112","el":"p","class":"jsnote"},{"el":"div","class":"footer-links","children":[{"zone":"l-113","el":"span","class":"footer-link"},{"zone":"l-114","el":"span","class":"footer-link"},{"zone":"l-115","el":"span","class":"footer-link"},{"zone":"l-116","el":"span","class":"footer-link"}]},{"zone":"t-117","el":"p","class":"made"}]}]}},"projection.slots@1":{"template":"/_luxel/a/docs-v0-1-views-2.ae01e8ce02ba.html","map":"/_luxel/a/docs-v0-1-views-2.slots.012090ea000f.json"}}}