Skip to main content

chromeSkeletonHtml

The server-rendered stand-in for MapChrome, as a string of HTML: the search pill, the map controls, the zoom group on a device with a fine pointer and the credits button, each in the slot and grid the live chrome uses, so the live chrome replaces it in the same boxes. A host writes the string into its page over the map's background colour, as the first paint before the map mounts (in React, with dangerouslySetInnerHTML on a wrapper that takes no box of its own, display: contents).

This is a function exported by @mapcairn/map, checked against version 0.2.0.

Signature​

import { chromeSkeletonHtml } from "@mapcairn/map";

function chromeSkeletonHtml(input: ChromeSkeletonOptions): string;

Parameters​

  • { copy, directions, draw, }
  • input (ChromeSkeletonOptions)

Returns​

string

Remarks​

It is a pure function of its options: no browser global, no hook, no provider, no custom element, so a server renders it. Every word is escaped (&, <, >, " and ') whatever the catalogue holds, and the class names, icon paths and attribute names come from this package, so the string holds no markup but its own. It is decorative: aria-hidden and inert, so nobody can focus a control that does nothing yet. It reuses the MapChrome grid, padding and slot classes, and the real controls' own classes. The layout (bottom sheet or side panel) follows a media query built from the constants chooseLayout uses, because the server cannot measure the container. It writes no style attribute (production CSP is style-src 'self') and no script, and is the same in light and dark themes because it uses only theme tokens. Its styles are in the package's styles.css.

See also​

Source: packages/map/src/chrome/ChromeSkeleton/ChromeSkeleton.ts:323