Skip to content

v1.33.0 — Site layout, code highlighting and the docs kit

Choose a tag to compare

@robritacca-dotcom robritacca-dotcom released this 22 Nov 00:34
· 209 commits to main since this release

Everything a documentation or marketing site needs is now in the package: a site frame, a footer, a menubar, a copy button, a back-to-top button, and code blocks with highlighting and install tabs. Nothing published was removed.

New components

  • SiteLayout: the frame of a documentation or marketing site, and the site's counterpart to AppLayout. It holds a SiteHeader, a scrollable NavList sidebar, the page and an on-this-page AnchorNav, with SiteFooter below. Its width is contained (in narrow, default or wide steps) or full, and the sidebar docks to the content or to the window's edge. It renders on the server.
  • SiteFooter: a sitemap footer with link columns, a brand block and a copyright row.
  • Menubar: a row of menus that open with the arrow keys, built on DropdownMenu's items (groups, checkbox and radio rows, sub-menus, shortcuts).
  • CopyButton: puts a value on the clipboard and says so, as a button or an icon-only circle.
  • BackToTop: a round button that appears once the reader has scrolled a long way and takes them back to the top. It respects reduced motion.

Code

  • CodeBlock takes pre-highlighted lines, coloured through the new --color-code-* tokens, plus showLineNumbers and highlightLines. Without lines it stays monochrome, as before.
  • CodeBlock tabs show grouped snippets, such as install commands, under one header. Blocks that share a syncKey follow one pick, remembered across visits.
  • rift-ds/code exports packageManagerTabs(pkg). rift-ds/code/highlight exports highlight(code, lang), behind the new optional shiki peer, so nothing else pulls it in.

New on existing components

  • AnchorNav fromHeadings builds the on-this-page list from the page's own headings and keeps it current. useHeadingItems is the same thing as a hook.
  • Heading and SectionTitle anchor give a heading an id and a link that copies its URL.
  • NavList takes titled sections as well as items, with badges, a scrollable form and a compact size.
  • SiteHeader width puts the bar on the contained or full width axis. foldBelow folds it into its menu at a breakpoint. On a full bar, the mega menu hangs from the section pills only past --ds-site-header-menu-hang-from.
  • Pagination variant="adjacent" shows previous and next links as two cards.
  • ArtifactPanel layout="inline" sits in the page flow as a preview and code example.
  • Rating variant="thumbs" asks a thumbs up or down question, for page feedback.
  • Figure carries a do or don't verdict through variant.
  • Link variant="skip" is a skip link, hidden until focused.
  • Table columns take mono for code-set cells.
  • npx rift-ds init block docs scaffolds a documentation page that uses all of the above.

Changed

  • AppLayout's width now defaults to contained in every mode. The inset mode used to force full width. Pass width="full" to keep an edge-to-edge inset layout.
  • NavList, single-open: opening a row now closes only its siblings, never the section or the rows around it. Left uncontrolled, the branch holding the current page opens on top of defaultExpandedIds.
  • Only one menu is open at a time. A tooltip or hover card showing over an open menu no longer stops a press outside from closing it, so opening a second menu closes the first.
  • ShaderScene rebuilds a lost graphics context on a fresh canvas once it comes back near the screen, instead of waiting for the browser.

Upgrading

Nothing to change unless you use AppLayout's inset mode and want it edge to edge: add width="full". If you passed defaultExpandedIds={[]} to NavList to keep every row closed, the current page's branch now opens.

Install

npm install rift-ds@1.33.0