[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6D2G8MDRA57KY921Y0PW025":3,"skill-same:01M6D2G8MDRA57KY921Y0PW025":67},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":39,"linkOnly":40,"markdownContent":41,"markdownBody":42,"frontMatter":43,"refName":44,"commitSha":45,"skillDirectory":46,"forksCount":47,"repositoryHtmlUrl":48,"repositoryHomepageUrl":49,"ownerHtmlUrl":50,"ownerBlogUrl":49,"ownerDescription":51,"updatedAt":52,"install":53,"resources":66},"01M6D2G8MDRA57KY921Y0PW025","ui-stack-plain",null,"Building with plain HTML, CSS and a little JavaScript, no framework and no build step: file layout, the document head, cascade layers, tokens as custom properties, modern CSS (grid, clamp, container queries, :has, nesting), a small reset, component classes, light and dark themes with color-scheme and a toggle, progressive enhancement with ES modules, native dialog, details and popover, forms that really submit, images with srcset, SVG icons, fonts, performance budgets, and when to move to Astro or a framework. Read when the project uses plain HTML and CSS, or a page of content needs nothing more.","enowdev\u002Fenowxcli","enowdev","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F179420349?v=4","01M6D1MVX2KC0X3Z9NESE7P22K","Enow Dev.","01M6D1MW1FMZGBDKWAJY4GQX81",67,"Apache-2.0","https:\u002F\u002Fgithub.com\u002Fenowdev\u002Fenowxcli\u002Fblob\u002Fmain\u002Fcrates\u002Fenowx-core\u002Fskills\u002Fui-stack-plain\u002FSKILL.md",[],[19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38],"ui stack plain","ui","stack","html","layout","tokens","project","forms","es","images","modules","container","css","read","dialog","page","astro","framework","component","performance","2026-11-10 10:12:30",false,"---\nname: ui-stack-plain\ndescription: \"Building with plain HTML, CSS and a little JavaScript, no framework and no build step: file layout, the document head, cascade layers, tokens as custom properties, modern CSS (grid, clamp, container queries, :has, nesting), a small reset, component classes, light and dark themes with color-scheme and a toggle, progressive enhancement with ES modules, native dialog, details and popover, forms that really submit, images with srcset, SVG icons, fonts, performance budgets, and when to move to Astro or a framework. Read when the project uses plain HTML and CSS, or a page of content needs nothing more.\"\n---\n\n# Plain HTML, CSS and JavaScript\n\nThe right stack for a page of content: nothing to build, nothing to break.\nIt still needs structure, or it becomes one long file of one-off styles. The\nnaive version adds jQuery for a menu, builds HTML from strings, fakes its\nform and goes blank when its script fails. This keeps a static site tidy\nwith what browsers do natively in 2026.\n\n## 1. Files\n\n- One page: `index.html`, `styles.css`, and `script.js` only when something\n  must behave. Assets in `assets\u002F` or `img\u002F`.\n- Several pages, or CSS past about 400 lines:\n\n```text\nindex.html  about.html  contact.html   one file per page\ncss\u002Ftokens.css  css\u002Fbase.css  css\u002Fcomponents.css   each linked from \u003Chead>\njs\u002Fmain.js                             entry module; js\u002Fmenu.js, js\u002Fforms.js\nimg\u002F  fonts\u002F  favicon.svg\n```\n\n## 2. The document\n\n```html\n\u003C!doctype html>\n\u003Chtml lang=\"en\">\n\u003Chead>\n  \u003Cmeta charset=\"utf-8\">\n  \u003Cmeta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n  \u003Ctitle>[Page] | [Site name]\u003C\u002Ftitle>\n  \u003Cmeta name=\"description\" content=\"[What this page offers, in one sentence]\">\n  \u003Clink rel=\"icon\" href=\"favicon.svg\" type=\"image\u002Fsvg+xml\">\n  \u003Clink rel=\"stylesheet\" href=\"css\u002Ftokens.css\"> \u003C!-- then base.css, components.css -->\n  \u003Cscript type=\"module\" src=\"js\u002Fmain.js\">\u003C\u002Fscript>\n\u003C\u002Fhead>\n\u003Cbody>\n  \u003Ca class=\"skip-link\" href=\"#main\">Skip to content\u003C\u002Fa>\n  \u003Cheader>...\u003C\u002Fheader> \u003Cmain id=\"main\">...\u003C\u002Fmain> \u003Cfooter>...\u003C\u002Ffooter>\n\u003C\u002Fbody>\n\u003C\u002Fhtml>\n```\n\n- A real `\u003Ctitle>` and `\u003Cmeta name=\"description\">` on every page; a\n  canonical link, and Open Graph tags with an absolute image URL on pages\n  that get shared (`frontend-seo`).\n- Landmarks: `header`, `nav`, `main`, `footer`; one `h1`; headings in order.\n- `type=\"module\"` scripts are deferred (no `DOMContentLoaded` wrapper\n  needed); a classic script gets `defer`.\n\n## 3. CSS, in layers and in this order\n\n`@layer reset, tokens, base, layout, components, utilities;` as the first\nline of the first stylesheet. A later layer wins whatever the selectors, so\na utility beats a component without `!important`; CSS outside any layer\nbeats them all, so keep none, or only overrides of third-party CSS.\n\n1. **Tokens** in `:root`: colours by role (`--paper`, `--ink`, `--muted`,\n   `--line`, `--accent`), the spacing scale (`--s-1` to `--s-9`), radii,\n   the type scale with `clamp()` for display sizes, font stacks.\n2. **Reset and base**: `*, *::before, *::after { box-sizing: border-box; }`,\n   body margin 0, `img, svg { max-width: 100%; height: auto; display:\n   block; }`, `font: inherit` on form controls, `[hidden] { display: none\n   !important; }` (a component's `display` would otherwise override it),\n   body font and colour from the tokens, a visible `:focus-visible`.\n3. **Layout**: `.container` (max-width, side padding), the grid, sections.\n4. **Components**: one class per part and its pieces (`.card`,\n   `.card__title`), modifiers for variants (`.btn--primary`), states from\n   attributes (`[aria-expanded=\"true\"]`). Every value from a token; the same\n   markup repeated keeps the same classes, so the CSS styles it once.\n5. **Utilities**: a few single-purpose classes (`.visually-hidden`), last.\n\nMedia queries mobile-first (`@media (min-width: 48em)`), nested in the\ncomponent they change, not in one block at the end. Motion only inside\n`@media (prefers-reduced-motion: no-preference)` (`motion-stacks`).\n\n## 4. Tokens and themes\n\n```css\n@layer tokens {\n  :root {\n    color-scheme: light dark;\n    \u002F* values from DESIGN.md: light first, dark second *\u002F\n    --paper: light-dark(#f7f4ee, #0e0f11);\n    --ink: light-dark(#18170f, #ebeae6);\n    --muted: light-dark(#5b584f, #9c9a94);\n    --line: light-dark(#dcd6c8, #2a2b30);\n    --accent: light-dark(#9a3412, #fb923c);\n    --on-accent: light-dark(#ffffff, #18170f);\n    --s-1: 0.25rem; --s-2: 0.5rem; --s-3: 0.75rem; --s-4: 1rem; --s-5: 1.5rem;\n    --s-6: 2rem; --s-7: 3rem; --s-8: 4rem; --s-9: 6rem; --radius-1: 4px; --radius-2: 8px;\n    --step-1: 1.25rem; --step-2: clamp(1.5rem, 1.25rem + 1vw, 1.95rem);\n    --step-3: clamp(1.95rem, 1.4rem + 2.4vw, 3.05rem);\n    --font-text: \"Public Sans\", system-ui, sans-serif;\n    --font-display: \"Newsreader\", Georgia, serif;\n  }\n  :root[data-theme=\"light\"] { color-scheme: light; }\n  :root[data-theme=\"dark\"] { color-scheme: dark; }\n}\n```\n\n- `light-dark()` (Baseline 2024) picks by the element's `color-scheme`: the\n  system setting by default, a saved `data-theme` when there is one. Colours\n  only; a shadow or an image per theme goes in an override block.\n- Without it, a dark theme overrides only the tokens (`[data-theme=\"dark\"]\n  { --paper: ...; }`), with `prefers-color-scheme` as the default.\n- A saved choice is applied before the first paint by a script at the top\n  of `\u003Chead>` setting `data-theme` from `localStorage` (`ui-themes`).\n\n## 5. Modern CSS worth using\n\n- Grids that fit without breakpoints: `repeat(auto-fit, minmax(min(100%,\n  18rem), 1fr))`; the `min()` keeps one column from overflowing at 360px.\n- `clamp()` for fluid type and space; `min-height: 100dvh`, never `100vh`.\n- Container queries for a component placed at different widths, `:has()`\n  for a parent that changes with its content, nesting one level deep.\n- `text-wrap: balance` on headings, `pretty` on paragraphs; `:user-invalid`\n  to flag a field once it is left wrong; `scroll-margin-top` for anchors.\n\n```css\n@layer components {\n  .card { container-type: inline-size; border: 1px solid var(--line); border-radius: var(--radius-2); }\n  .card__body {\n    display: grid; gap: var(--s-3); padding: var(--s-5);\n    @container (min-width: 36rem) { grid-template-columns: 12rem 1fr; }\n  }\n  .card__title { font: 600 var(--step-1)\u002F1.25 var(--font-display); text-wrap: balance; }\n  .card:has(.card__media) .card__body { padding-block-start: var(--s-3); }\n}\n```\n\n## 6. JavaScript adds behaviour\n\n- The page reads and works without it; script adds behaviour (a menu, a\n  copy button, a form that submits without reload).\n- ES modules (or an IIFE in a classic script), no bundler, no globals:\n  `js\u002Fmain.js` imports what the page uses. Event delegation on a parent for\n  repeated items. `aria-expanded` and `hidden` toggled with the visuals.\n- Content rendered by script comes from a `\u003Ctemplate>`, filled with\n  `textContent`, never HTML built in strings (an injection hole).\n- No framework or jQuery for a menu and a form.\n\n```js\n\u002F\u002F js\u002Fmenu.js, for \u003Cnav data-menu> with \u003Cbutton aria-controls=\"site-links\" aria-expanded=\"false\" hidden>;\n\u002F\u002F main.js calls it on each [data-menu]. Without script the links show and the button stays hidden.\nexport function initMenu(nav) {\n  const button = nav.querySelector(\"[aria-controls]\");\n  const list = document.getElementById(button.getAttribute(\"aria-controls\"));\n  const narrow = matchMedia(\"(width \u003C 48em)\");\n  const isOpen = () => button.getAttribute(\"aria-expanded\") === \"true\";\n  const sync = () => { button.hidden = !narrow.matches; list.hidden = narrow.matches && !isOpen(); };\n  const set = (open) => { button.setAttribute(\"aria-expanded\", String(open)); sync(); };\n  button.addEventListener(\"click\", () => set(!isOpen()));\n  nav.addEventListener(\"keydown\", (e) => { if (e.key === \"Escape\" && isOpen()) { set(false); button.focus(); } });\n  narrow.addEventListener(\"change\", sync);\n  sync();\n}\n```\n\n## 7. Native elements before scripts\n\n| Need | Element | What it gives, without a library |\n|---|---|---|\n| A modal (a confirm, a short form) | `\u003Cdialog>` opened with `showModal()` | Focus moved in, the page behind inert, `Esc`, `::backdrop` |\n| A disclosure, an FAQ | `\u003Cdetails>` and `\u003Csummary>`; a shared `name` for one open at a time | Keyboard and state, with no script |\n| A floating menu or panel | `popover` and a button with `popovertarget` | Top layer, light dismiss, `Esc`, with no script |\n\nA `\u003Cform method=\"dialog\">` inside a dialog closes it; `@starting-style`\nanimates opening and closing (`motion-interface`).\n\n## 8. Forms that really submit\n\n- A form posts to a real endpoint: the site's own backend, or a form\n  service (Formspree, Netlify Forms, Basin) named in the README. Never a\n  handler that shows a thank-you and sends nothing.\n- A label on every field, the right `type`, `autocomplete`, `inputmode` and\n  `required`: the browser validates and fills; messages in words beside the\n  field (`ui-part-forms`).\n- Script upgrades it to send without reload: the same endpoint, progress on\n  the button, the result in a `role=\"status\"` region.\n\n```js\n\u002F\u002F js\u002Fforms.js, for \u003Cform action=\"...\" method=\"post\" data-enhance> with a [role=status] inside\nexport function enhanceForm(form) {\n  const status = form.querySelector(\"[role=status]\");\n  const button = form.querySelector(\"[type=submit]\");\n  form.addEventListener(\"submit\", async (event) => {\n    event.preventDefault();\n    button.disabled = true;\n    status.textContent = \"Sending...\";\n    const init = { method: \"POST\", body: new FormData(form), headers: { Accept: \"application\u002Fjson\" } };\n    try {\n      const response = await fetch(form.action, init);\n      if (!response.ok) throw new Error(String(response.status));\n      form.reset();\n      status.textContent = \"Sent. [What happens next]\";\n    } catch {\n      status.textContent = \"It did not send. Check your connection and try again.\";\n    }\n    button.disabled = false;\n  });\n}\n```\n\n## 9. Images, icons, fonts\n\n- Images: `width` and `height`, `alt` on every one, `loading=\"lazy\"` below\n  the fold (the first view's largest image gets `fetchpriority=\"high\"`\n  instead), `srcset` and `sizes` for photographs, AVIF with a JPEG fallback:\n\n```html\n\u003Cpicture>\n  \u003Csource type=\"image\u002Favif\" srcset=\"img\u002Fshop-800.avif 800w, img\u002Fshop-1600.avif 1600w\" sizes=\"(min-width: 64em) 50vw, 100vw\">\n  \u003Cimg src=\"img\u002Fshop-800.jpg\" srcset=\"img\u002Fshop-800.jpg 800w, img\u002Fshop-1600.jpg 1600w\" sizes=\"(min-width: 64em) 50vw, 100vw\"\n       width=\"1600\" height=\"1067\" alt=\"[What the photo shows]\" loading=\"lazy\" decoding=\"async\">\n\u003C\u002Fpicture>\n```\n\n- Icons: inline SVG `\u003Csymbol>`s at the top of `\u003Cbody>`, used as `\u003Csvg\n  class=\"icon\" aria-hidden=\"true\">\u003Cuse href=\"#i-phone\"\u002F>\u003C\u002Fsvg>`, fetched\n  exactly with the `icon` tool, drawn in `currentColor`. No icon fonts.\n- Fonts: a system stack, or one or two families self-hosted as WOFF2 with\n  `font-display: swap`, the face above the fold preloaded (`as=\"font\"\n  type=\"font\u002Fwoff2\" crossorigin`); or the provider's CSS with `preconnect`,\n  `display=swap` and only the weights used.\n\n## 10. Performance, and when to move on\n\n- Budget for a content page: HTML, CSS and script under about 100 KB\n  compressed, script under 30 KB and none of it render-blocking, the first\n  view's largest image under about 200 KB, two font families at most.\n- The same header pasted into more than about five pages, or a blog with\n  lists and tags: Astro (layouts and components, no JavaScript by default)\n  or Eleventy, keeping the tokens and CSS. Shared state, sign-in or live\n  data: a framework (`ui-stack-react`, `ui-stack-vue`, `ui-stack-svelte`).\n\n## Check it\n\n- Look at it with the `preview` tool, giving the HTML file's `path`, and\n  run `ui_check`. `path` opens the file as `file:\u002F\u002F`, where Chrome refuses\n  ES modules and `fetch`: for a page with `type=\"module\"`, use `url`\n  `http:\u002F\u002Flocalhost:8000\u002F` and `start` `python3 -m http.server 8000`.\n- `npx html-validate \"*.html\"` for broken markup (unclosed elements,\n  duplicate ids, a `for` pointing at nothing).\n- JavaScript off: the content, the navigation and the form still work.\n  Tab from the top: the skip link first, focus visible on every control.\n\n## Avoid\n\nOne stylesheet of one-off values; raw colours in components; `!important`\nwhere a layer would do; a `div` with a click handler; jQuery for a menu; a\npage blank without its script; HTML built from strings holding data; a form\nthat thanks the user and sends nothing; images without dimensions; lazy\nloading on the first view's main image; icon fonts; a chain of `@import`s;\none header maintained by hand in fifteen files.\n","# Plain HTML, CSS and JavaScript\n\nThe right stack for a page of content: nothing to build, nothing to break.\nIt still needs structure, or it becomes one long file of one-off styles. The\nnaive version adds jQuery for a menu, builds HTML from strings, fakes its\nform and goes blank when its script fails. This keeps a static site tidy\nwith what browsers do natively in 2026.\n\n## 1. Files\n\n- One page: `index.html`, `styles.css`, and `script.js` only when something\n  must behave. Assets in `assets\u002F` or `img\u002F`.\n- Several pages, or CSS past about 400 lines:\n\n```text\nindex.html  about.html  contact.html   one file per page\ncss\u002Ftokens.css  css\u002Fbase.css  css\u002Fcomponents.css   each linked from \u003Chead>\njs\u002Fmain.js                             entry module; js\u002Fmenu.js, js\u002Fforms.js\nimg\u002F  fonts\u002F  favicon.svg\n```\n\n## 2. The document\n\n```html\n\u003C!doctype html>\n\u003Chtml lang=\"en\">\n\u003Chead>\n  \u003Cmeta charset=\"utf-8\">\n  \u003Cmeta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n  \u003Ctitle>[Page] | [Site name]\u003C\u002Ftitle>\n  \u003Cmeta name=\"description\" content=\"[What this page offers, in one sentence]\">\n  \u003Clink rel=\"icon\" href=\"favicon.svg\" type=\"image\u002Fsvg+xml\">\n  \u003Clink rel=\"stylesheet\" href=\"css\u002Ftokens.css\"> \u003C!-- then base.css, components.css -->\n  \u003Cscript type=\"module\" src=\"js\u002Fmain.js\">\u003C\u002Fscript>\n\u003C\u002Fhead>\n\u003Cbody>\n  \u003Ca class=\"skip-link\" href=\"#main\">Skip to content\u003C\u002Fa>\n  \u003Cheader>...\u003C\u002Fheader> \u003Cmain id=\"main\">...\u003C\u002Fmain> \u003Cfooter>...\u003C\u002Ffooter>\n\u003C\u002Fbody>\n\u003C\u002Fhtml>\n```\n\n- A real `\u003Ctitle>` and `\u003Cmeta name=\"description\">` on every page; a\n  canonical link, and Open Graph tags with an absolute image URL on pages\n  that get shared (`frontend-seo`).\n- Landmarks: `header`, `nav`, `main`, `footer`; one `h1`; headings in order.\n- `type=\"module\"` scripts are deferred (no `DOMContentLoaded` wrapper\n  needed); a classic script gets `defer`.\n\n## 3. CSS, in layers and in this order\n\n`@layer reset, tokens, base, layout, components, utilities;` as the first\nline of the first stylesheet. A later layer wins whatever the selectors, so\na utility beats a component without `!important`; CSS outside any layer\nbeats them all, so keep none, or only overrides of third-party CSS.\n\n1. **Tokens** in `:root`: colours by role (`--paper`, `--ink`, `--muted`,\n   `--line`, `--accent`), the spacing scale (`--s-1` to `--s-9`), radii,\n   the type scale with `clamp()` for display sizes, font stacks.\n2. **Reset and base**: `*, *::before, *::after { box-sizing: border-box; }`,\n   body margin 0, `img, svg { max-width: 100%; height: auto; display:\n   block; }`, `font: inherit` on form controls, `[hidden] { display: none\n   !important; }` (a component's `display` would otherwise override it),\n   body font and colour from the tokens, a visible `:focus-visible`.\n3. **Layout**: `.container` (max-width, side padding), the grid, sections.\n4. **Components**: one class per part and its pieces (`.card`,\n   `.card__title`), modifiers for variants (`.btn--primary`), states from\n   attributes (`[aria-expanded=\"true\"]`). Every value from a token; the same\n   markup repeated keeps the same classes, so the CSS styles it once.\n5. **Utilities**: a few single-purpose classes (`.visually-hidden`), last.\n\nMedia queries mobile-first (`@media (min-width: 48em)`), nested in the\ncomponent they change, not in one block at the end. Motion only inside\n`@media (prefers-reduced-motion: no-preference)` (`motion-stacks`).\n\n## 4. Tokens and themes\n\n```css\n@layer tokens {\n  :root {\n    color-scheme: light dark;\n    \u002F* values from DESIGN.md: light first, dark second *\u002F\n    --paper: light-dark(#f7f4ee, #0e0f11);\n    --ink: light-dark(#18170f, #ebeae6);\n    --muted: light-dark(#5b584f, #9c9a94);\n    --line: light-dark(#dcd6c8, #2a2b30);\n    --accent: light-dark(#9a3412, #fb923c);\n    --on-accent: light-dark(#ffffff, #18170f);\n    --s-1: 0.25rem; --s-2: 0.5rem; --s-3: 0.75rem; --s-4: 1rem; --s-5: 1.5rem;\n    --s-6: 2rem; --s-7: 3rem; --s-8: 4rem; --s-9: 6rem; --radius-1: 4px; --radius-2: 8px;\n    --step-1: 1.25rem; --step-2: clamp(1.5rem, 1.25rem + 1vw, 1.95rem);\n    --step-3: clamp(1.95rem, 1.4rem + 2.4vw, 3.05rem);\n    --font-text: \"Public Sans\", system-ui, sans-serif;\n    --font-display: \"Newsreader\", Georgia, serif;\n  }\n  :root[data-theme=\"light\"] { color-scheme: light; }\n  :root[data-theme=\"dark\"] { color-scheme: dark; }\n}\n```\n\n- `light-dark()` (Baseline 2024) picks by the element's `color-scheme`: the\n  system setting by default, a saved `data-theme` when there is one. Colours\n  only; a shadow or an image per theme goes in an override block.\n- Without it, a dark theme overrides only the tokens (`[data-theme=\"dark\"]\n  { --paper: ...; }`), with `prefers-color-scheme` as the default.\n- A saved choice is applied before the first paint by a script at the top\n  of `\u003Chead>` setting `data-theme` from `localStorage` (`ui-themes`).\n\n## 5. Modern CSS worth using\n\n- Grids that fit without breakpoints: `repeat(auto-fit, minmax(min(100%,\n  18rem), 1fr))`; the `min()` keeps one column from overflowing at 360px.\n- `clamp()` for fluid type and space; `min-height: 100dvh`, never `100vh`.\n- Container queries for a component placed at different widths, `:has()`\n  for a parent that changes with its content, nesting one level deep.\n- `text-wrap: balance` on headings, `pretty` on paragraphs; `:user-invalid`\n  to flag a field once it is left wrong; `scroll-margin-top` for anchors.\n\n```css\n@layer components {\n  .card { container-type: inline-size; border: 1px solid var(--line); border-radius: var(--radius-2); }\n  .card__body {\n    display: grid; gap: var(--s-3); padding: var(--s-5);\n    @container (min-width: 36rem) { grid-template-columns: 12rem 1fr; }\n  }\n  .card__title { font: 600 var(--step-1)\u002F1.25 var(--font-display); text-wrap: balance; }\n  .card:has(.card__media) .card__body { padding-block-start: var(--s-3); }\n}\n```\n\n## 6. JavaScript adds behaviour\n\n- The page reads and works without it; script adds behaviour (a menu, a\n  copy button, a form that submits without reload).\n- ES modules (or an IIFE in a classic script), no bundler, no globals:\n  `js\u002Fmain.js` imports what the page uses. Event delegation on a parent for\n  repeated items. `aria-expanded` and `hidden` toggled with the visuals.\n- Content rendered by script comes from a `\u003Ctemplate>`, filled with\n  `textContent`, never HTML built in strings (an injection hole).\n- No framework or jQuery for a menu and a form.\n\n```js\n\u002F\u002F js\u002Fmenu.js, for \u003Cnav data-menu> with \u003Cbutton aria-controls=\"site-links\" aria-expanded=\"false\" hidden>;\n\u002F\u002F main.js calls it on each [data-menu]. Without script the links show and the button stays hidden.\nexport function initMenu(nav) {\n  const button = nav.querySelector(\"[aria-controls]\");\n  const list = document.getElementById(button.getAttribute(\"aria-controls\"));\n  const narrow = matchMedia(\"(width \u003C 48em)\");\n  const isOpen = () => button.getAttribute(\"aria-expanded\") === \"true\";\n  const sync = () => { button.hidden = !narrow.matches; list.hidden = narrow.matches && !isOpen(); };\n  const set = (open) => { button.setAttribute(\"aria-expanded\", String(open)); sync(); };\n  button.addEventListener(\"click\", () => set(!isOpen()));\n  nav.addEventListener(\"keydown\", (e) => { if (e.key === \"Escape\" && isOpen()) { set(false); button.focus(); } });\n  narrow.addEventListener(\"change\", sync);\n  sync();\n}\n```\n\n## 7. Native elements before scripts\n\n| Need | Element | What it gives, without a library |\n|---|---|---|\n| A modal (a confirm, a short form) | `\u003Cdialog>` opened with `showModal()` | Focus moved in, the page behind inert, `Esc`, `::backdrop` |\n| A disclosure, an FAQ | `\u003Cdetails>` and `\u003Csummary>`; a shared `name` for one open at a time | Keyboard and state, with no script |\n| A floating menu or panel | `popover` and a button with `popovertarget` | Top layer, light dismiss, `Esc`, with no script |\n\nA `\u003Cform method=\"dialog\">` inside a dialog closes it; `@starting-style`\nanimates opening and closing (`motion-interface`).\n\n## 8. Forms that really submit\n\n- A form posts to a real endpoint: the site's own backend, or a form\n  service (Formspree, Netlify Forms, Basin) named in the README. Never a\n  handler that shows a thank-you and sends nothing.\n- A label on every field, the right `type`, `autocomplete`, `inputmode` and\n  `required`: the browser validates and fills; messages in words beside the\n  field (`ui-part-forms`).\n- Script upgrades it to send without reload: the same endpoint, progress on\n  the button, the result in a `role=\"status\"` region.\n\n```js\n\u002F\u002F js\u002Fforms.js, for \u003Cform action=\"...\" method=\"post\" data-enhance> with a [role=status] inside\nexport function enhanceForm(form) {\n  const status = form.querySelector(\"[role=status]\");\n  const button = form.querySelector(\"[type=submit]\");\n  form.addEventListener(\"submit\", async (event) => {\n    event.preventDefault();\n    button.disabled = true;\n    status.textContent = \"Sending...\";\n    const init = { method: \"POST\", body: new FormData(form), headers: { Accept: \"application\u002Fjson\" } };\n    try {\n      const response = await fetch(form.action, init);\n      if (!response.ok) throw new Error(String(response.status));\n      form.reset();\n      status.textContent = \"Sent. [What happens next]\";\n    } catch {\n      status.textContent = \"It did not send. Check your connection and try again.\";\n    }\n    button.disabled = false;\n  });\n}\n```\n\n## 9. Images, icons, fonts\n\n- Images: `width` and `height`, `alt` on every one, `loading=\"lazy\"` below\n  the fold (the first view's largest image gets `fetchpriority=\"high\"`\n  instead), `srcset` and `sizes` for photographs, AVIF with a JPEG fallback:\n\n```html\n\u003Cpicture>\n  \u003Csource type=\"image\u002Favif\" srcset=\"img\u002Fshop-800.avif 800w, img\u002Fshop-1600.avif 1600w\" sizes=\"(min-width: 64em) 50vw, 100vw\">\n  \u003Cimg src=\"img\u002Fshop-800.jpg\" srcset=\"img\u002Fshop-800.jpg 800w, img\u002Fshop-1600.jpg 1600w\" sizes=\"(min-width: 64em) 50vw, 100vw\"\n       width=\"1600\" height=\"1067\" alt=\"[What the photo shows]\" loading=\"lazy\" decoding=\"async\">\n\u003C\u002Fpicture>\n```\n\n- Icons: inline SVG `\u003Csymbol>`s at the top of `\u003Cbody>`, used as `\u003Csvg\n  class=\"icon\" aria-hidden=\"true\">\u003Cuse href=\"#i-phone\"\u002F>\u003C\u002Fsvg>`, fetched\n  exactly with the `icon` tool, drawn in `currentColor`. No icon fonts.\n- Fonts: a system stack, or one or two families self-hosted as WOFF2 with\n  `font-display: swap`, the face above the fold preloaded (`as=\"font\"\n  type=\"font\u002Fwoff2\" crossorigin`); or the provider's CSS with `preconnect`,\n  `display=swap` and only the weights used.\n\n## 10. Performance, and when to move on\n\n- Budget for a content page: HTML, CSS and script under about 100 KB\n  compressed, script under 30 KB and none of it render-blocking, the first\n  view's largest image under about 200 KB, two font families at most.\n- The same header pasted into more than about five pages, or a blog with\n  lists and tags: Astro (layouts and components, no JavaScript by default)\n  or Eleventy, keeping the tokens and CSS. Shared state, sign-in or live\n  data: a framework (`ui-stack-react`, `ui-stack-vue`, `ui-stack-svelte`).\n\n## Check it\n\n- Look at it with the `preview` tool, giving the HTML file's `path`, and\n  run `ui_check`. `path` opens the file as `file:\u002F\u002F`, where Chrome refuses\n  ES modules and `fetch`: for a page with `type=\"module\"`, use `url`\n  `http:\u002F\u002Flocalhost:8000\u002F` and `start` `python3 -m http.server 8000`.\n- `npx html-validate \"*.html\"` for broken markup (unclosed elements,\n  duplicate ids, a `for` pointing at nothing).\n- JavaScript off: the content, the navigation and the form still work.\n  Tab from the top: the skip link first, focus visible on every control.\n\n## Avoid\n\nOne stylesheet of one-off values; raw colours in components; `!important`\nwhere a layer would do; a `div` with a click handler; jQuery for a menu; a\npage blank without its script; HTML built from strings holding data; a form\nthat thanks the user and sends nothing; images without dimensions; lazy\nloading on the first view's main image; icon fonts; a chain of `@import`s;\none header maintained by hand in fifteen files.\n",{"name":5,"description":7},"main","38293fe1b096e6bf3646c7344c38786ed688f464","crates\u002Fenowx-core\u002Fskills\u002Fui-stack-plain",21,"https:\u002F\u002Fgithub.com\u002Fenowdev\u002Fenowxcli","https:\u002F\u002Fenowx.ai","https:\u002F\u002Fgithub.com\u002Fenowdev","Pretending to be a Developer","2026-10-06 02:05:35",{"source":8,"skillName":5,"commands":54,"prompt":64,"zipAvailable":65},[55,58,61],{"tool":56,"command":57},"npx","npx skills add enowdev\u002Fenowxcli --skill ui-stack-plain",{"tool":59,"command":60},"bunx","bunx skills add enowdev\u002Fenowxcli --skill ui-stack-plain",{"tool":62,"command":63},"pnpm","pnpm dlx skills add enowdev\u002Fenowxcli --skill ui-stack-plain","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fenowdev\u002Fenowxcli\u002Fblob\u002Fmain\u002Fcrates\u002Fenowx-core\u002Fskills\u002Fui-stack-plain\u002FSKILL.md",true,[],[68,78,94,105,125,144],{"skillNo":69,"name":70,"nameZh":6,"description":71,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":72,"categories":73,"keywords":74,"publishedAt":39},"01M6D2HQYSQD9N7MTNDT4A7CBM","demo-skill","Project-scope demo skill for tests.","https:\u002F\u002Fgithub.com\u002Fenowdev\u002Fenowxcli\u002Fblob\u002Fmain\u002Fworkspace\u002F.agents\u002Fskills\u002Fdemo-skill\u002FSKILL.md",[],[75,76,77,25,32],"demo skill","demo","tests",{"skillNo":79,"name":80,"nameZh":6,"description":81,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":82,"categories":83,"keywords":84,"publishedAt":39},"01M6D2HM0GCPM0TM2HPG9HHR2R","writing","Writing words people read: the specific thing instead of claims, words to drop, sentences, interface copy (buttons, labels, errors, empty states, confirmations), page copy, notifications and emails, alt text and link text, numbers and dates, words that translate well, documentation and voice. Read before writing a page's copy, an interface's text or a document.","https:\u002F\u002Fgithub.com\u002Fenowdev\u002Fenowxcli\u002Fblob\u002Fmain\u002Fcrates\u002Fenowx-core\u002Fskills\u002Fwriting\u002FSKILL.md",[],[80,85,86,87,88,89,32,34,90,91,92,93],"text","emails","empty","drop","document","voice","notifications","documentation","translate",{"skillNo":95,"name":20,"nameZh":6,"description":96,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":97,"categories":98,"keywords":99,"publishedAt":39},"01M6D2HG07YS49NM196Q0R3AZ8","Designing or restyling an interface: direction, layout, type, colour, icons, components, states, responsive behaviour. Read before building a page, a screen or a set of components.","https:\u002F\u002Fgithub.com\u002Fenowdev\u002Fenowxcli\u002Fblob\u002Fmain\u002Fcrates\u002Fenowx-core\u002Fskills\u002Fui\u002FSKILL.md",[],[20,100,101,102,103,34,23,32,104],"icons","components","SET","responsive","before building",{"skillNo":106,"name":107,"nameZh":6,"description":108,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":109,"categories":110,"keywords":111,"publishedAt":39},"01M6D2HB59HZHWG1RYZDV4SJ91","ui-themes","Light and dark themes, and colour that holds in both: tokens with a value per theme, and what each kind of content needs to stay visible (icons, SVG drawings and line art, logos, photos, screenshots, charts, code, maps, borders, shadows, focus, form controls), switching without a flash, and checking both. Read before building a second theme or a theme toggle, and before any drawing, logo or chart on a page that has two themes.","https:\u002F\u002Fgithub.com\u002Fenowdev\u002Fenowxcli\u002Fblob\u002Fmain\u002Fcrates\u002Fenowx-core\u002Fskills\u002Fui-themes\u002FSKILL.md",[],[20,112,113,114,24,115,116,117,118,32,104,119,34,120,121,122,100,123,124],"ui themes","switching","photos","drawing","focus","maps","Art","flash","code","Charts","content","screenshots","logo",{"skillNo":126,"name":127,"nameZh":6,"description":128,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":129,"categories":130,"keywords":131,"publishedAt":39},"01M6D2H5R5KRAE524C8QX0T7Q0","ui-structure","Structure before styling: the blueprint written before any interface code (the screen's job, the regions its kind of page needs, their order and why, the layout skeleton in numbers, the components and their states), the anatomy and order of a homepage, a dashboard, a list, a detail page, settings, a form, sign-in, pricing, docs, an article and a checkout, and how to turn the blueprint into code (tokens, layout primitives, components, sections, page). Read first, before building or rebuilding any page or screen.","https:\u002F\u002Fgithub.com\u002Fenowdev\u002Fenowxcli\u002Fblob\u002Fmain\u002Fcrates\u002Fenowx-core\u002Fskills\u002Fui-structure\u002FSKILL.md",[],[132,20,133,101,134,135,120,136,137,138,23,24,139,140,141,32,104,34,142,143],"structure","ui structure","pricing","dashboard","Blueprint","article","anatomy","styling","primitives","list","why","how",{"skillNo":145,"name":146,"nameZh":6,"description":147,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":148,"categories":149,"keywords":150,"publishedAt":39},"01M6D2H0ZZBJG77MBGPZHA6MWD","ui-stack-vue","Building interfaces in Vue 3 and Nuxt: project layout, script setup with typed defineProps, defineEmits and defineModel, attribute fallthrough, slots and scoped slots, template refs, ref, reactive and computed, watch versus watchEffect, composables and VueUse, provide and inject, Pinia, keyed v-for, transitions, Nuxt 4 (app directory, pages, layouts, useFetch and useAsyncData keys, $fetch in handlers, server routes, runtime config, useSeoMeta, NuxtImg, middleware), VeeValidate forms, Reka UI and Nuxt UI, testing, vue-tsc, and the traps. Read when the project uses Vue or Nuxt.","https:\u002F\u002Fgithub.com\u002Fenowdev\u002Fenowxcli\u002Fblob\u002Fmain\u002Fcrates\u002Fenowx-core\u002Fskills\u002Fui-stack-vue\u002FSKILL.md",[],[20,151,21,152,26,153,154,155,23,25,156,157,32,158,159,160,161,162,163,164],"vue","ui stack vue","pages","watch","runtime","transitions","fetch","pinia","nuxt","template","server","config","directory","testing"]