A page loads
From the request to a rendered page: the site builder tag, site.json, the theme, the page HTML, then the elements the page uses, lazily.
- 1. Request. The browser asks for a URL. HAXcms on PHP or Node.js, a static host or a HAX11ty build answers with the site's index.html. (1. Request, HAXcms, HAXcms PHP, HAXcms Node.js, Deploy targets, index.html, 404.html)
- 2. index.html. A small page: an import map, a preload of wc-registry.json and base.css, the web app manifest, the <haxcms-site-builder file="site.json?hash"> tag already in the markup, then build-haxcms.js and build.js. (2. index.html, index.html, 404.html, wc-registry.json)
- 3. build.js boots. Detects module support, sets up WCAutoload and loads the haxcms-site-builder module. Nothing else is loaded yet. (3. build.js boots, build.js and the autoloader, the magic script)
- 4. site.json. haxcms-site-builder upgrades and fetches its file attribute: site.json, the JSON Outline Schema manifest. haxcms-site-store holds it for everything else. (4. site.json, JSON Outline Schema, site.json, site.json)
- 5. The theme. From manifest.metadata.theme, the builder imports the theme element by path, waits for customElements.whenDefined, and stamps it. The theme draws menu, breadcrumb and regions from the store. (5. The theme, Themes, custom/)
- 6. Route to a page. The router turns the URL slug into the active item. The builder fetches that item's location, pages/<id>/index.html, with the build timestamp; a missing page shows the 404. (6. Route to a page, pages/<id>/index.html, Outline designer)
- 7. Content into the theme. The HTML is placed in the theme's content slot and an active-item event fires, so menus, previous and next, and xAPI listeners update. (7. Content into the theme, HAX editor, xAPI statements)
- 8. Elements load lazily. wc-autoload watches the DOM for tags that are not defined, looks each up in wc-registry.json and imports its module. Only the elements this page uses are loaded, and they upgrade in place. (8. Elements load lazily, Web components, wc-registry.json, build.js and the autoloader, Web component standard)
- 9. After render. The service worker registers for offline use, search is ready at x/search, and if you are logged in the editor UI loads and the registry graph warms the editor's own elements. (9. After render, manifest.json and service-worker.js, lunrSearchIndex.json, Merlin)
- A page loads: the whole path. (A page loads, 1. Request, 2. index.html, 3. build.js boots, 4. site.json, 5. The theme, 6. Route to a page, 7. Content into the theme, 8. Elements load lazily, 9. After render)