import {Library} from '@fuzdev/fuz_ui/library.svelte.js'; Rich runtime representation of a library.
Wraps LibraryJson with computed properties and provides the root
of the API documentation hierarchy: Library → Module → Declaration.
A Library and everything it materializes is immutable — library_json is
assigned once in the constructor — so the computed properties across all
three classes are plain getters, with the allocating ones (the Module and
Declaration trees, the lookup maps) cached in a private field on first
read. They are deliberately not $derived: Svelte's server runtime only
memoizes a $derived created during a render (ssr_context is otherwise
null), so a Library constructed at module scope — the normal shape for a
multi-package docs site — rebuilds its entire Module/Declaration tree on
every property read, turning a declaration_by_name lookup into a full
re-materialization of the library. Reactivity is at the instance level
instead: swap the Library (see library_context), don't mutate one.
see also
``module.svelte.ts`` for Module class
``declaration.svelte.ts`` for Declaration class
library_json
type LibraryJson
url_prefix
URL path prefix for multi-package documentation sites.
Prepended to /docs/api/ paths in Module.url_api and Declaration.url_api.
Default '' preserves single-package behavior.
type string
constructor
type new (library_json: LibraryJson, url_prefix?: string): Library
library_json
LibraryJsonurl_prefix?
string''lookup_directory_modules
Look up modules within a directory prefix.
Returns modules whose paths start with path + "/", or null if none match.
type (path: string): Module[] | null
path
stringModule[] | nullsearch_declarations
Search declarations by query string with multi-term AND logic.
type (query: string): Declaration[]
query
stringDeclaration[]pkg_json
type PkgJson
source_json
type SourceJson
name
type string
repo_name
type string
repo_url
Non-null — the constructor rejects a pkg_json without a parseable repository.
type Url
owner_name
type string | null
homepage_url
type Url | null
logo_url
type Url | null
logo_alt
type string
published
type boolean
npm_url
type Url | null
changelog_url
type Url | null
org_url
Organization URL (e.g., 'https://github.com/ryanatkn'), built from owner_name.
type string | null
modules
All modules as rich Module instances.
type Module[]
modules_sorted
All modules sorted alphabetically by path.
type Module[]
declarations
All declarations across all modules as a flat array.
type Declaration[]
module_by_path
Module lookup map by path. Provides O(1) lookup.
type Map<string, Module>
declaration_by_name
Declaration lookup map by name. Provides O(1) lookup.
type Map<string, Declaration>