Skip to content
Svartz v2.6.0

@svartz/ui

147 exported symbols.

Classes

c ReferencePageError

Interfaces

i Breadcrumb
i CodeTabOne tab of a `CodePanel`.
i CommentsSettingsGiscus settings a theme passes to `Comments`.
i ContentComponentPropsProps passed to a content override after Markdown plugins finish parsing.
i ExplorerItemHow a page lists in the explorer when a theme renders it specially: a fixed-width badge beside a monospace label.
i ExplorerNode
i FolderLayout
i FolderSection
i LinkSegment
i LogoSettingsThe site's mark beside its title. `dark` replaces `src` in dark mode; `alt` is empty because the title names the site.
i ReferenceAuthHow a page authenticates: `auth: bearer`, or `auth: { scheme, description, scopes }`.
i ReferenceBadgeA fixed-width kind badge: an HTTP method, a GraphQL kind, `TOOL`, `SCHEMA`.
i ReferenceContextWhat every renderer component receives besides its page data.
i ReferenceExamplesProps
i ReferenceNavItemHow a page lists in the sidebar and on listing pages.
i ReferencePageProps
i ReferencePageRendererA page renderer that wraps a reference renderer; its shape is theme-minimal's `PageRenderer`.
i ReferenceRendererRenders one kind of reference page. A page picks its renderer with explicit metadata: `operation.protocol: <id>`, or a `model` block for the `schema` renderer. Pages with neither are guides.
i ReferenceRouteConfigRoute prefixes. The pipeline reads the same keys.
i ReferenceShellThe part of theme-minimal's shell state reference pages read.
i ReferenceShellProps
i ReferenceSourceWhere a page's subject is defined: a source file or line.
i ReferenceThemeConfigThe vault's `theme` settings every reference theme reads. Renderers read their own keys too.
i ReferenceThemeIdentityWho a reference theme is.
i ResolvedCallout
i SchemaNodeThe JSON Schema subset reference pages render. `$ref` names a schema page (`$ref: Pet`); `#/components/schemas/Pet` and `#/$defs/Pet` also name `Pet`.
i SchemaProperty
i SearchDocumentA published note as the artifact producer stores it for search.
i SearchHit
i SettingsLink
i TextSegment
i ThemePagePropsProps every theme layout and page component receives from the Svartz runtime (`SvartzVaultPage`). Layouts also get `children`; pages also get `contentComponents`. Prefer `vault`: its URLs include the deployment base.
i ThemeRouteMatchThe route the runtime matched for this page.
i ThemeSettingsSettings every first-party theme reads from the vault's `theme` config.
i UiFolderEntry
i UiIndexEntry
i UiTagEntry

Types

t BadgeHueA signal hue from the design tokens (`--sv-hue-<name>`), or `neutral`.
t CalloutType
t ColorMode
t ContentComponentOverrides
t ContentComponents
t ContentComponentSlot
t LinkKind
t ReferenceHueA signal hue from the design tokens (`--sv-hue-<name>`), or `neutral` for kinds that aren't calls.
t SearchOptions
t SiteActions
t ThemeTokensThe vault's `theme.tokens`: any design token by name, with or without the `--sv-` prefix (`accent`, `paper`, `radius-m`, `--sv-font-sans`). Config wins over the theme's own tokens, which win over the Svartz defaults.
t ThemeTokenValueA token value for both colour schemes, or one per scheme.

Functions

f assetHrefThe published URL of an attachment named in a note's frontmatter (`cover: hero.jpg`, `image: portrait.svg`); external URLs pass through. Undefined when the vault didn't publish it. Resolves like the pipeline, which publishes attachments named by top-level `image`, `cover`, and `socialImage`: relative to the note's file, then from the vault root, then by a basename only one attachment has.
f authLabel`Bearer token`, `None`, or the scheme as written.
f buildBreadcrumbsHome, each folder the note sits in, then the note. A folder note ends its own folder's trail instead of repeating it. A slug no folder record places falls back to its own segments.
f buildExplorerTreeThe vault as a tree: folders first, then notes. Each group sorts by `order` frontmatter, then by a theme's explorer row (`itemOf`), then in natural order by title; a folder takes its folder note's `order`. The home note is left out (the site title links home). A folder links its folder note (`guides/index.md`) when one exists, otherwise its generated folder page.
f classifyLinkClassify a link in rendered note content. Internal links get previews and the internal style; files, heading anchors, and footnote links stay quiet.
f count`1 note`, `3 notes`.
f createSearchBuild a query function over the vault's search index. `documents` carries final URLs; the stored index may predate the deployment base, so hrefs come from it.
f currentColorModeThe mode the page currently renders in.
f defineRendererKeeps a renderer's data type flowing from `read` to `nav`, `page`, and `examples`.
f exampleFromSchemaA representative value: the schema's example, then its default, its first enum value, then a placeholder by type.
f excerptAbout `words` words of `content`, centred on the first matched term.
f fetchPreviewCloned preview nodes for `href`. IDs get a prefix so previews never collide with the host page's headings; `scrollTarget` finds the linked heading inside them.
f folderBreadcrumbsHome, then each folder down to `folder` (a folder page's trail).
f folderContentsEvery note under a folder, nested ones included, plus its direct subfolders. The folder's own note (`log/index.md`) is its page, not an item.
f folderLayoutWhere each note's file sits, read from the index's folder records. Slugs can't tell: when two files want one URL, one gets a suffix (`guides/index.md` may publish as `guides-2`), and a root `guides.md` may hold the folder's slug.
f formatDateFormat a note date as `Sep 4, 2026`. Dates are calendar days, so format in UTC.
f highlightSplit text into matched and plain runs, so results render highlights without HTML.
f isoDateISO date for `<time datetime>`.
f isRecord
f newestFirst
f noteDateThe date a list shows for a note: last modified, else published, else created. An unparseable date is skipped, so one bad value can't hide the note's date.
f notesTaggedNotes tagged `tag` or a nested tag under it (`tag/…`).
f noteStylesheetsStylesheet URLs for a host note route. Call it in the route's server `load` (`+page.server.ts`): it prepares the vault itself, and `hostStylesheets` is empty in the browser, so serialized server data must carry the SSR list.
f openFolderIdsFolder ids to open so `folder` shows in the explorer: it and every folder above it.
f pageCrumbsBreadcrumbs for any page, ending with the page itself (Quartz's `showCurrentPage`). List pages walk through their index route; home and missing pages have none. Themes with other list routes pass their own `titles`.
f parseSearchQuery`#guides setup` searches notes tagged `guides` for "setup".
f readAuth
f readingTime`N min read`, rounded up, at least one minute.
f readLinksA `{ Label: 'url' }` map from user config as ordered links; non-string URLs are dropped.
f readModelA schema page: `model: { name: Pet, schema: {…} }`.
f readReferencePageThe page's data as `renderer` reads it from the page's frontmatter. Throws a `ReferencePageError` with the reason when the metadata isn't a valid page; the shell adds the page's path.
f readSchemaA frontmatter schema, normalized. `null` never stands alone in a union: a `null` type or alternative marks the schema `nullable`, and a union left with one alternative becomes that alternative. `type: [string, number]` reads as `anyOf` its types.
f readSourcesThe page's `source`: a URL, `{ label, href }`, or a list of either.
f referenceContextWhat a reference renderer's components receive, worked out from the shell: every schema page by name, for `$ref`s.
f referenceExtensionA reference theme as a theme-minimal extension: the reference frame and top bar, these renderers, and reference chrome. Guides get minimal's page head and contents; pages a renderer claims get its page and examples.
f referenceRendererA reference renderer as a theme-minimal page renderer: it claims the pages whose `operation.protocol` (or `model`) names it, renders through `ReferenceBody` and `ReferenceExamples`, and lists with its badge. The same renderer always adapts to the same object, so a renderer two themes share (the schema renderer) stays one claim.
f rendererIdOfThe renderer id a page's metadata names, or `undefined` for a guide. An `operation` without a protocol is REST, as in the API theme's first release.
f resolveCalloutResolve an author-written callout type (`[!faq]`, `[!my-idea]`) to its canonical type, styling, and title. Unknown types render as notes but keep their own title.
f schemaLabelHow a schema reads in one line: `string (uuid)`, `Pet[]`, `"a" | "b"`, `map of string`.
f setColorModePin a mode on <html>, remember it, and tell listeners (comments, graphs).
f slugToHref
f sourceLabelA short label for a source URL. A GitHub or GitLab file link reads as its path and line (`src/mcp/tools.ts:23`); any other URL keeps its host and path.
f svartzSocialImageThe 1200×630 social preview shared by first-party themes.
f svartzSyntaxThe syntax plugin for a first-party theme's `pluginPreset`.
f tagHrefForThe URL of a tag's page, including the mount path, for tags the index knows or not.
f themeSettingsRead the vault's `theme` settings. They come from user config, so every field is checked; anything malformed is ignored rather than rendered.
f themeTokenCssThe CSS for `theme.tokens`, or nothing when there are none. The selector is `html:root` so it outranks the `:root` rules in the Svartz defaults and in every theme. Names and values that could escape the rule are dropped.
f titleFromSlugSegment
f topLevelSectionsNotes grouped by top-level folder, in first-seen order, without the home note. A folder note (`guides/index.md`) links its section instead of listing in it; a folder with only its note is an empty section.
f wikilinkSegmentsFrontmatter isn't run through the Markdown pipeline, so values like `Home: "[[Vessa]], Lower Wards"` keep raw `[[links]]`. Split such a value into text and linked segments, resolving targets against published notes by title, file name, or slug. Unresolved links become plain text.

Variables

v AuthSummary
v Backlinks
v Badge
v Breadcrumbs
v BreakAfterSlashes
v Callout
v CALLOUT_TYPESObsidian's built-in callout types. Each owns an icon and a signal hue.
v CodeBlock
v CodePanel
v COLOR_MODE_KEYlocalStorage key for the reader's explicit choice. Absent means "follow the OS".
v COLOR_MODE_SCRIPTInline `<head>` script. Pins the stored mode on <html> before first paint so dark readers never see a light flash. Without a stored mode the OS decides through `color-scheme: light dark`.
v COLOR_MODE_SCRIPT_HASHCSP source for `COLOR_MODE_SCRIPT`. A host with a Content Security Policy adds it to `script-src` so the script can run; `color-mode.test.ts` keeps it in sync.
v COLOR_MODE_TAG`COLOR_MODE_SCRIPT` as a `<script>` element. It lives here rather than in `ColorModeToggle.svelte` because Vite's dependency scanner reads any `<script>` text in a `.svelte` file as the component's script and fails.
v ColorModeToggle
v Comments
v default
v DescText
v Embed
v EndpointBar
v explorerOpenIdsPersisted set of open folder IDs in the explorer.
v FileTrie
v GraphPanel
v Link
v LinkPreviews
v NoteHeader
v PageActions
v PREVIEW_ATTRIBUTEPage previews for link hovers and search. A theme marks the part of its page worth previewing with `data-sv-preview`; previews fetch the target URL and clone those nodes. Works for static output and SvelteKit hosts alike.
v RecentNotes
v ReferenceBody
v referenceChromeReference sites keep the page and its examples: no graph, backlinks, dates, or reader mode; a filter above the explorer.
v ReferenceExamples
v ReferenceFrame
v ReferenceSection
v ReferenceTopBar
v SCHEMA_RENDERERThe renderer id that handles `model` pages.
v schemaRendererRenders `model` pages: one shared schema per page, which operations and tools name with `$ref`. Every preset includes it; listing it twice is fine.
v SchemaTree
v SearchBox
v SearchDialog
v SiteActions
v SiteLogo
v SourceLinks
v SVARTZ_MARK_SVGThe Svartz mark: an ink block with a vermilion proof mark. The default favicon.
v svartzContentComponentsThe shared OFM content slots, ready to spread into a theme's `components`. Pair with `prose.css` on the element that wraps the note body.
v SvartzNoteContentRenders one published note's body inside a host-owned page. The route's universal `load` must have awaited `prepareHostVault(pathname)` first. `stylesheets` comes from `await noteStylesheets(pathname)` in the route's server `load` (`+page.server.ts`); the helper prepares the vault itself, and only serialized server data keeps the SSR links because a universal `load` reruns in the browser where the registry is empty. For a pathname that is not a published note (or a vault that was not prepared) it renders nothing.
v SvartzPluginPage
v TableOfContents