stnd.build

@stnd/layout

Circle 1 — Core Framework (Inviolable Pillar) · Stable · Load-Bearing

Role: Document-level Astro shells and application window frames (Base.astro, Window.astro, Panel.astro, Meta.astro, Encrypted.astro).

When to use: Wrap every route or application layout in <Base> or <Window> so hooks, theme initialization, and window chrome mount automatically.

Quick Start (TL;DR)

---
import Base from "@stnd/layout/Base";
---
<Base title="My Page" description="Page summary">
  <main class="prose"><slot /></main>
</Base>

Definitive root layouts and base components for Standard websites.


ELI5

The <html> wrapper every Standard page shares: the <head> metadata, the header/footer, the “restore theme before paint” script. Most pages just want Base.astro; Encrypted.astro is the special case for a password-gated page.

---
import Base from "@stnd/layout/Base";
---
<Base title="My Page"><h1>Hello</h1></Base>

Security Caveat: Encrypted.astro

Encrypted.astro is a casual visitor gate, not cryptographic access control:

  • The password check uses a SHA-256-derived XOR keystream where both the ciphertext and decryption script ship to the browser.
  • Predictable HTML headers (<!DOCTYPE html>) make known-plaintext recovery straightforward.
  • Use it to keep casual visitors out; rely on server-side authentication (@stnd/account) when protecting sensitive data.

Overview

@stnd/layout provides the foundational structure for all websites in the Standard ecosystem. It handles essential infrastructure such as meta tags, SEO, favicons, headers, footers, and system-wide initializations.

Key Layouts

Base Layout (Base.astro)

The primary layout for most pages. It includes:

Window Layout (Window.astro)

Desktop and macOS-style application window layout. It includes:

Encrypted Layout (Encrypted.astro)

A specialized layout for password-protected content. It uses client-side encryption to ensure privacy while maintaining a consistent design.

Components & Primitives

Usage

In your Astro page:

---
import Base from "@stnd/layout/Base";
---
<Base title="My Page" description="A well-made page.">
  <h1>Hello Standard!</h1>
</Base>

The panel

A sidebar, in three parts that can be taken apart:

Part File What it is
The surface @stnd/styles (.panel, .item, .panel-head…) What a floating pane looks like, and where it sits (data-position). Static; the Workshop and any app sidebar use it as is.
The behaviour panel.js Folding, peek under the pointer, the drawer on a small screen, the remembered choice, the shortcut, ClientRouter. Framework-free JS, used as use:panel or createPanel(el).
The CSS of that behaviour panel.css Rail, icon, entry button, scrim, drawer, the dock’s toolbar look, the flow layout. It answers data-folded, data-peek, data-open.

Panel.svelte is the panel: the markup, use:panel and panel.css together. A Svelte host imports it and fills its slots with snippets (brand, top, start, children, footer, end, service). Panel.astro is its door for an Astro site: it reads the nav from the site config and the current path, passes the slots that are present, mounts the Svelte component as an island (client:load, so the links are in the HTML) and keeps the small script that folds a remembered panel before first paint.

A host that renders its own markup (an app’s sidebar) takes the other two:

import "@stnd/layout/panel.css";
import { panel } from "@stnd/layout/panel.js"; // <aside data-stnd-panel data-storage-key="app:nav" use:panel>

Props (the same on both; in Svelte the brand’s accessible name is brandLabel, because brand is its slot). position (left | right | top-center | bottom-center), collapse (icon | rail | none), layout (float | flow), labels (nav, open, expand, collapse), storageKey, shortcut, defaultFolded, foldBelow (start folded under that screen width, px, when the person never chose), trigger, items, width. Slots: brand, top, start, default (the grouped rows), footer, end, service.

What the markup must carry for panel.js. data-stnd-panel, data-storage-key, data-collapse, data-shortcut; inside it a [data-panel-toggle]; elsewhere, optionally, [data-panel-open="<key>"] (the mobile entry) and [data-panel-scrim="<key>"]. It sets data-folded, data-peek and data-open on the panel.

Layouts. float (default) is a layer over the page: the page is pushed aside only while a left or right panel is pinned open on a wide screen. flow is a column of the page, for an app whose content sits beside it in a flex row (àVélo): sticky, its rail is a real column, and a peek widens it without moving the page. flow is left only, and a rail.

Docks. top-center and bottom-center are bars of icon buttons (.item, aria-selected marks the current one). They do not fold. The Studio page of stnd.build is one.

Configuration

Layouts inherit site-wide settings from the config.nav and config.title defined in your module manifests or astro.config.mjs.