Dharmalib

Routes and components

The route layer should be thin: resolve parameters, fetch bounded artifacts, and pass typed data to a page component.

Principal routes

RouteResponsibility
/Landing and graph-led discovery
/textCurated and class-filterable text catalogue
/text/[slug]Reader, text description, and text-note surface
/dictionaryDictionary search and result exploration
/lemma/[slug]Dedicated lemma entry
/root and /root/[slug]Paginated Dhātu index and root detail
/concept/[id] and /conceptsSemantic concepts and hierarchy
/sutra/[id]Sūtra detail
/docs/user/* and /docs/developer/*MDsveX documentation

The text catalogue and individual readers now share the /text route family. Do not restore a separate /read route unless there is a deliberate migration and redirect plan.

Text route loader

src/routes/text/[slug]/+page.ts validates page and limit, loads a text’s metadata, references, and text note, then fetches only the 20-verse artifacts necessary to assemble the requested display range. It returns a TextPageArtifact-compatible result to the page.

The loader must preserve the URL’s limit parameter during previous/next and reference navigation. A reference is a verse location, not a fixed page number.

Key components

  • text-browser.svelte renders the text index and class filters.
  • text-reader.svelte is display-only: it receives the current verse range and handles word selection.
  • reference-navigator.svelte renders a text-aware hierarchy of selects, computes the display page from a verse index, and changes page size.
  • context-lens.svelte reacts to the active word and loads its lemma bucket on demand.
  • Root pages send the selected word and its root context to context-lens.svelte; they do not render expanded dictionary entries inline.
  • word-graph.svelte uses the graph endpoint for bounded graph data.

MDsveX documentation

Markdown files in src/routes/docs/user and src/routes/docs/developer become subroutes. Each carries frontmatter for title and description. The folder’s +page.ts defines the index-card metadata; keep it synchronized when adding or removing a guide.

Prefer ordinary Markdown headings, lists, tables, and internal links. Documentation should explain behavior and contracts, not mirror source line by line.

A project by designLab at Bodha.