Demos Applications
Settings application
An account-settings screen built from the primitives and the table with the package styles, the way an application would build it. The runtime panel under it reads the page you are looking at.
On this page
The screen has a section rail, an account menu, three tabs of forms, a table of active sessions with a row menu, and three dialogs. Every control is the real primitive: the dialogs and popovers are native elements opened by invoker attributes, the tabs and menus are Tier 1 behaviors discovered from the static markers in the component, and Svelte owns only what the application owns.
Application
Acme Workspace
Settings
Account
A code from your authenticator app is required at every new sign-in.
Turned on since March. Recovery codes are below.
An email for every sign-in from a new device.
Recovery codes
Each code signs you in once when the authenticator is unavailable.
- hq4t-p7xn
- v2fk-r9wd
- c8nj-t3yq
- m5zr-k6pw
Delivered to the devices in the sessions table.
A monthly summary of new features.
Active sessions
Devices signed in to this account. Revoking a session signs that device out.
Last active | Actions | ||
|---|---|---|---|
MacBook Pro This device Chrome on macOS | Berlin, Germany | Now | |
iPhone Safari on iOS | Berlin, Germany | Today, 08:41 | |
ThinkPad X1 Firefox on Windows | Ankara, Türkiye | Yesterday, 19:05 | |
iPad Safari on iPadOS | Lisbon, Portugal | Three days ago |
What counts as a session
A session starts at sign-in on one browser and ends at sign-out, at revocation, or after thirty days without activity.
Danger zone
Deleting the account removes its workspaces, documents and sessions. This cannot be undone.
Runtime
Read from the page after it loads: the primitives in the document by tier, the behaviors
registered on the document runtime, the shared listeners counted by the runtime and, separately,
by static/instrument.js, the router-sourced listeners on elements (a per-instance
listener would show up there), and the scoped controllers in development builds. The counts
cover the whole document; the roots inside the application are the "in examples" part.
- Runtime
- Read from the page after it loads; requires JavaScript.
Primitives by tier
| Primitive | Tier | Shared listeners | Registration module | Behavior JS (brotli) |
|---|---|---|---|---|
button | 0 | none | none (native) | 0 B |
dialog | 0 | none | none (native) | 0 B |
popover | 0 | none | none (native) | 0 B |
disclosure | 0 | none | none (native) | 0 B |
checkbox | 0 | none | none (native) | 0 B |
switch | 0 | none | none (native) | 0 B |
radio-group | 0 | none | none (native) | 0 B |
tabs | 1 | click, keydown | @svelte-lean/primitives/tabs/register | 1521 B |
menu | 1 | click, keydown, toggle | @svelte-lean/primitives/menu/register | 1932 B |
Behaviors loaded by this build
@svelte-lean/vite scanned the demo's files for static data-slean markers and injected the matching registration modules; native primitives have none. This is what
the manifest of the build you are looking at recorded for src/routes/demos/settings/.
| Behavior | Registration module | Found in |
|---|---|---|
button | none (native) | SettingsApp.svelte |
checkbox | none (native) | SettingsApp.svelte |
dialog | none (native) | SettingsApp.svelte |
disclosure | none (native) | SettingsApp.svelte |
menu | @svelte-lean/primitives/menu/register | SettingsApp.svelte |
popover | none (native) | SettingsApp.svelte |
radio-group | none (native) | SettingsApp.svelte |
switch | none (native) | SettingsApp.svelte |
tabs | @svelte-lean/primitives/tabs/register | SettingsApp.svelte |
Without JavaScript
What keeps working with scripting disabled, and where each statement is tested. A statement is called tested only when a spec runs the same markup with JavaScript disabled or before any script has arrived; everything else is expected from the platform and marked as not tested on this page.
| Part | With JavaScript disabled | Evidence |
|---|---|---|
| Dialogs: Change email, Delete account, Revoke session | Open through command="show-modal" on the buttons and on the menu items, close through command="close", Escape and the method="dialog" forms; focus returns to the invoker. | native.spec.ts, the same markup with JavaScript disabled demos.spec.ts, this page with JavaScript disabled |
| Popovers: the two help hints | Open and close through popovertarget, with light dismiss and Escape. | native.spec.ts, the same markup with JavaScript disabled demos.spec.ts, this page with JavaScript disabled |
| Menus: account, session actions | Open and close as plain popovers, and the items that carry commandfor open their dialog. Arrow keys, Home, End and typeahead need the behavior. | demos.spec.ts, this page with JavaScript disabled |
| Disclosures: Recovery codes, What counts as a session | Open and close. | native.spec.ts, the same markup with JavaScript disabled |
| Switches, checkboxes, radio group | Toggle and select; the state is the native checked state. | native.spec.ts, the same markup with JavaScript disabled |
| Change-email form | required and type="email" keep the dialog open and show the message while the address is invalid (:user-invalid). | demos.spec.ts, this page with JavaScript disabled |
| Native selects and text inputs | Work; nothing on this page depends on script for them. | expected from the platform, not tested on this page |
| Tabs | The Profile panel stays visible; Security and Notifications cannot be shown until the behavior is registered. | hydration.spec.ts, before any script arrives demos.spec.ts, this page with JavaScript disabled |
| Sessions table | The rows are in the prerendered document. Sorting, Show details and removing a revoked row need JavaScript. | expected from the platform, not tested on this page |
| Profile form | Save submits a GET request and reloads the page; with JavaScript the demo intercepts the submit. | expected from the platform, not tested on this page |
Notes
- Native select is the default primitive (blueprint §16.8): Language and Timezone are
<select>elements. A custom listbox would have to provide focus management, keyboard interaction, typeahead, positioning, mobile behavior and assistive technology behavior that the browser already provides. - One menu per table, not per row: the session actions menu is a single popover. Each row's
button invokes it through
popovertarget, the invoker becomes the menu's anchor, and the table'sonActiontells the application which row asked. Every row shares that one menu and the behavior's shared listeners; a row adds a button, not a menu. - Menu items that open a dialog carry
command="show-modal". The behavior hides the menu during the click, the platform returns focus to the menu button, and the command then opens the dialog from that button, so closing the dialog puts focus back where the user started. - Application state (Tier 3) is limited to what the application owns: the email shown after a change, the session list after a revoke, the status line. Open, checked and selected states stay in the DOM and are never mirrored into Svelte state.
- Nothing is sent anywhere: there is no server. Saving, exporting and deleting write a status line; revoking removes the row.
Source
- SettingsApp.svelte, the application
- +page.svelte, this page and its technical panel
- demos.spec.ts, the keyboard-only walkthrough, the narrow-viewport check and the JavaScript-disabled context