api #

Declarations
#

Svelte UI library

301 declarations

Alert
#

alert_status_options
#

AlertStatus
#

AlertStatusOptions
#

AnalysisContext
#

analysis_context.ts view source

Context for collecting diagnostics during source analysis.

Thread an instance through analysis functions to collect errors and warnings without halting analysis. After analysis completes, check has_errors() and report collected diagnostics.

examples

Example 1

diagnostics

type Array<Diagnostic>

readonly

add

Add a diagnostic to the collection.

type (diagnostic: Diagnostic): void

diagnostic
returns void

has_errors

Check if any errors were collected.

type (): boolean

returns boolean

has_warnings

Check if any warnings were collected.

type (): boolean

returns boolean

errors

Get all error diagnostics.

type (): Diagnostic[]

returns Diagnostic[]

warnings

Get all warning diagnostics.

type (): Diagnostic[]

returns Diagnostic[]

by_kind

Get diagnostics of a specific kind.

type <K extends DiagnosticKind>(kind: K): (Extract<TypeExtractionDiagnostic, { kind: K; }> | Extract<SignatureAnalysisDiagnostic, { ...; }> | Extract<...> | Extract<...> | Extract<...>)[]

kind
type K
returns (Extract<TypeExtractionDiagnostic, { kind: K; }> | Extract<SignatureAnalysisDiagnostic, { kind: K; }> | Extract<...> | Extract<...> | Extract<...>)[]

AnalyzerType
#

module_helpers.ts view source

AnalyzerType

Analyzer type for source files.

- 'typescript' - TypeScript/JS files analyzed via TypeScript Compiler API - 'svelte' - Svelte components analyzed via svelte2tsx + TypeScript Compiler API

ApiDeclarationList
#

ApiIndex
#

ApiIndex.svelte view source

library?

The library instance to render API docs for. Defaults to getting from library_context.

type Library
optional

tome?

The tome for the API docs page. Defaults to looking up the 'api' tome.

type Tome
optional

minimal?

Whether to show minimal content (just a link to full API docs). Used when the API index is shown on a parent docs page.

type boolean
optional

ApiModule
#

ApiModule.svelte view source

module_path

The module path parameter from the route (e.g., "lib/Button.svelte").

type string | Array<string>

library?

The library instance to render API docs for. Defaults to getting from library_context.

type Library
optional

tome?

The tome for the API docs page. Defaults to looking up the 'api' tome.

type Tome
optional

BaseDiagnostic
#

analysis_context.ts view source

BaseDiagnostic

Base diagnostic fields shared by all diagnostic types.

kind

file

File path relative to project root (display with './' prefix).

type string

line

Line number (1-based), or null if location unavailable.

type number | null

column

Column number (1-based), or null if location unavailable.

type number | null

message

Human-readable description of the issue.

type string

severity

Breadcrumb
#

Card
#

Card.svelte view source

tag?

type string | undefined
optional

align?

type 'left' | 'right' | 'above' | 'below'
optional

icon?

type string | Snippet
optional

children

type Snippet

ClassMemberDiagnostic
#

analysis_context.ts view source

ClassMemberDiagnostic

Class member analysis failed.

inheritance

kind

type 'class_member_failed'

class_name

Name of the class.

type string

member_name

Name of the member that failed.

type string

CollectedReExport
#

library_pipeline.ts view source

CollectedReExport

A collected re-export with its source module context.

Used during the two-phase re-export resolution: 1. Phase 1: Collect re-exports from each module during analysis 2. Phase 2: Group by original module and merge into also_exported_from

re_exporting_module

The module that re-exports the declaration.

type string

re_export

The re-export info (name and original module).

COLOR_SCHEME_SCRIPT_HASH
#

COLOR_SCHEME_STORAGE_KEY
#

ColorSchemeInput
#

Contextmenu
#

contextmenu_attachment
#

contextmenu_state.svelte.ts view source

<T extends ContextmenuParams, U extends T | Array<T>>(params: U | null | undefined): Attachment<HTMLElement | SVGElement>

Creates an attachment that sets up contextmenu behavior on an element.

params

Contextmenu parameters or nullish to disable

type U | null | undefined

returns

Attachment<HTMLElement | SVGElement>

contextmenu_calculate_constrained_x
#

contextmenu_helpers.ts view source

(menu_x: number, menu_width: number, layout_width: number): number

menu_x

type number

menu_width

type number

layout_width

type number

returns

number

contextmenu_calculate_constrained_y
#

contextmenu_helpers.ts view source

(menu_y: number, menu_height: number, layout_height: number): number

menu_y

type number

menu_height

type number

layout_height

type number

returns

number

contextmenu_check_global_root
#

contextmenu_state.svelte.ts view source

(get_scoped: () => boolean): void

Registers a contextmenu root and warns if multiple non-scoped roots are detected. Only active in development mode. Automatically handles cleanup on unmount.

get_scoped

Getter function that returns the current scoped value

type () => boolean

returns

void

contextmenu_context
#

contextmenu_state.svelte.ts view source

{ get: (error_message?: string | undefined) => ContextmenuState; get_maybe: () => ContextmenuState | undefined; set: (value: ContextmenuState) => ContextmenuState; }

contextmenu_create_keyboard_handlers
#

contextmenu_create_keydown_handler
#

contextmenu_helpers.ts view source

(keyboard_handlers: Map<string, () => void>): (e: KeyboardEvent) => void

keyboard_handlers

type Map<string, () => void>

returns

(e: KeyboardEvent) => void

CONTEXTMENU_DEFAULT_BYPASS_MOVE_TOLERANCE
#

CONTEXTMENU_DEFAULT_BYPASS_WINDOW
#

CONTEXTMENU_DEFAULT_LONGPRESS_DURATION
#

CONTEXTMENU_DEFAULT_LONGPRESS_MOVE_TOLERANCE
#

CONTEXTMENU_DEFAULT_OPEN_OFFSET_X
#

CONTEXTMENU_DEFAULT_OPEN_OFFSET_Y
#

contextmenu_dimensions_context
#

contextmenu_is_valid_target
#

contextmenu_helpers.ts view source

(target: EventTarget | null, shiftKey: boolean): target is HTMLElement | SVGElement

Returns true if valid and narrows the type to HTMLElement | SVGElement.

target

type EventTarget | null

shiftKey

type boolean

returns

boolean

contextmenu_open
#

contextmenu_state.svelte.ts view source

(target: HTMLElement | SVGElement, x: number, y: number, contextmenu: ContextmenuState, options?: ContextmenuOpenOptions | undefined): boolean

Opens the contextmenu, if appropriate, querying the menu items from the DOM starting at the event target.

target

the leaf element from which to open the contextmenu

type HTMLElement | SVGElement

x

the page X coordinate at which to open the contextmenu, typically the mouse pageX

type number

y

the page Y coordinate at which to open the contextmenu, typically the mouse pageY

type number

contextmenu

the contextmenu store

options?

optional configuration for filtering entries and haptic feedback

type ContextmenuOpenOptions | undefined
optional

returns

boolean

a boolean indicating if the menu was opened or not

contextmenu_submenu_context
#

contextmenu_state.svelte.ts view source

{ get: (error_message?: string | undefined) => SubmenuState; get_maybe: () => SubmenuState | undefined; set: (value: SubmenuState) => SubmenuState; }

ContextmenuActivateResult
#

ContextmenuEntry
#

ContextmenuLinkEntry
#

ContextmenuLinkEntry.svelte view source

href

type string

icon?

type string | Snippet
optional

children?

type Snippet
optional

disabled?

type boolean
optional

external_rel?

type string
optional

ContextmenuOpenOptions
#

ContextmenuParams
#

ContextmenuRoot
#

ContextmenuRoot.svelte view source

Touch event handler for tap-then-longpress bypass detection.

This allows users to access the native context menu by performing a tap followed by a longpress/rightclick within a specified time window. The bypass gesture is useful for accessing browser features like text selection or the native context menu when the Fuz contextmenu would normally override it.

Note: preventDefault is not called as we're only observing touch patterns, not intercepting them. The actual bypass happens in on_window_contextmenu.

contextmenu?

The contextmenu prop is not reactive because that's a rare corner case and it's easier to put the contextmenu directly in the context rather than wrapping with a store or other reactivity. If you need to change the contextmenu prop for some reason, use a {#key contextmenu} block: https://svelte.dev/docs#template-syntax-key

optional

open_offset_x?

The number of pixels to offset from the pointer X position when opened. Useful to ensure the first menu item is immediately under the pointer.

type number
optional

open_offset_y?

The number of pixels to offset from the pointer Y position when opened. Useful to ensure the first menu item is immediately under the pointer.

type number
optional

bypass_with_tap_then_longpress?

Whether to detect tap-then-longpress to bypass the Fuz contextmenu. This allows access to the system contextmenu by tapping once then rightclicking/long-pressing. Setting to false disables the gesture.

type boolean
optional

bypass_window?

The number of milliseconds between taps to detect a gesture that bypasses the Fuz contextmenu. Used only when bypass_with_tap_then_longpress is true. If the duration is too long, it'll detect more false positives and interrupt normal usage, but too short and some people will have difficulty performing the gesture.

type number
optional

bypass_move_tolerance?

The number of pixels the pointer can be moved between taps to detect a tap-then-longpress. Used only when bypass_with_tap_then_longpress is true.

type number
optional

scoped?

If true, wraps children with a div and listens to events on it instead of the window.

type boolean
optional

link_entry?

Snippet for rendering link entries. Set to null to disable automatic link detection. Defaults to link_entry_default which renders ContextmenuLinkEntry.

type Snippet<[ComponentProps<typeof ContextmenuLinkEntry>]> | null
optional

text_entry?

Snippet for rendering copy text entries. Set to null to disable automatic copy text detection. Defaults to text_entry_default which renders ContextmenuTextEntry.

type Snippet<[ComponentProps<typeof ContextmenuTextEntry>]> | null
optional

separator_entry?

Snippet for rendering separator entries. Set to null to disable automatic separator rendering. Defaults to separator_entry_default which renders ContextmenuSeparator.

type Snippet<[ComponentProps<typeof ContextmenuSeparator>]> | null
optional

children

type Snippet

ContextmenuRootForSafariCompatibility
#

ContextmenuRootForSafariCompatibility.svelte view source

Blocks the next click event. Set to true when a longpress completes to prevent iOS's synthesized click from activating the first menu item.

contextmenu?

The contextmenu prop is not reactive because that's a rare corner case and it's easier to put the contextmenu directly in the context rather than wrapping with a store or other reactivity. If you need to change the contextmenu prop for some reason, use a {#key contextmenu} block: https://svelte.dev/docs#template-syntax-key

optional

longpress_move_tolerance?

The number of pixels the pointer can be moved without canceling longpress.

type number
optional

longpress_duration?

The number of milliseconds after a touch starts before opening the Fuz contextmenu.

type number
optional

bypass_with_tap_then_longpress?

Whether to detect tap-then-longpress to bypass the Fuz contextmenu. This allows access to the system contextmenu by tapping once then long-pressing. Setting to false disables the gesture.

type boolean
optional

bypass_window?

The number of milliseconds between taps to detect a gesture that bypasses the Fuz contextmenu. Used only when bypass_with_tap_then_longpress is true. If the duration is too long, it'll detect more false positives and interrupt normal usage, but too short and some people will have difficulty performing the gesture.

type number
optional

bypass_move_tolerance?

The number of pixels the pointer can be moved between taps to detect a tap-then-longpress. Used only when bypass_with_tap_then_longpress is true.

type number
optional

open_offset_x?

The number of pixels to offset from the pointer X position when opened. Useful to ensure the first menu item is immediately under the pointer.

type number
optional

open_offset_y?

The number of pixels to offset from the pointer Y position when opened. Useful to ensure the first menu item is immediately under the pointer.

type number
optional

scoped?

If true, wraps children with a div and listens to events on it instead of the window.

type boolean
optional

link_entry?

Snippet for rendering link entries. Set to null to disable automatic link detection. Defaults to link_entry_default which renders ContextmenuLinkEntry.

type Snippet<[ComponentProps<typeof ContextmenuLinkEntry>]> | null
optional

text_entry?

Snippet for rendering copy text entries. Set to null to disable automatic copy text detection. Defaults to text_entry_default which renders ContextmenuTextEntry.

type Snippet<[ComponentProps<typeof ContextmenuTextEntry>]> | null
optional

separator_entry?

Snippet for rendering separator entries. Set to null to disable automatic separator rendering. Defaults to separator_entry_default which renders ContextmenuSeparator.

type Snippet<[ComponentProps<typeof ContextmenuSeparator>]> | null
optional

children

type Snippet

ContextmenuRun
#

ContextmenuSeparator
#

ContextmenuState
#

contextmenu_state.svelte.ts view source

Creates a contextmenu store. See usage with ContextmenuRoot.svelte and Contextmenu.svelte.

see also

layout

type Dimensions

has_custom_layout

If an initial layout is provided, control is deferred externally. Otherwise the layout syncs to the page dimensions.

type boolean

readonly

opened

type boolean

x

type number

y

type number

params

type ReadonlyArray<ContextmenuParams>

error

type string | undefined

root_menu

type RootMenuState

readonly

selections

type ReadonlyArray<ItemState>

can_collapse

can_expand

can_select_next

can_select_previous

can_activate

constructor

type new (options?: ContextmenuStateOptions): ContextmenuState

options
default EMPTY_OBJECT

open

type (params: ContextmenuParams[], x: number, y: number): void

params
type ContextmenuParams[]
x
type number
y
type number
returns void

close

type (): void

returns void

reset_items

type (items: readonly ItemState[]): void

items
type readonly ItemState[]
returns void

activate

type (item: ItemState): boolean | Promise<ContextmenuActivateResult>

item
returns boolean | Promise<ContextmenuActivateResult>

activate_selected

type (): boolean | void | Promise<ContextmenuActivateResult>

returns boolean | void | Promise<ContextmenuActivateResult>

select

Activates the selected entry, or if none, selects the first.

type (item: ItemState): void

item
returns void

collapse_selected

type (): void

returns void

expand_selected

type (): void

returns void

select_next

type (): void

returns void

select_previous

type (): void

returns void

select_first

type (): void

returns void

select_last

type (): void

returns void

add_entry

Used by ContextmenuEntry and custom entry components

type (run: () => ContextmenuRun, disabled?: () => boolean): EntryState

run
type () => ContextmenuRun
disabled
type () => boolean
default () => false
returns EntryState

add_submenu

type (): SubmenuState

returns SubmenuState

ContextmenuStateOptions
#

ContextmenuSubmenu
#

ContextmenuTextEntry
#

CopyToClipboard
#

CopyToClipboard.svelte view source

text

type string | null

copied_display_duration?

type number
optional

allow_copying_empty_string?

type boolean
optional

icon_button?

Defaults to true, ignored if children is provided.

type boolean
optional

oncopy?

type (text: string | null, e: MouseEvent) => void
optional

children?

type Snippet<[copied: boolean, failed: boolean]>
optional

create_context
#

context_helpers.ts view source

<T>(fallback: () => T): { get: () => T; set: (value?: T | undefined) => T; }

Wraps Svelte's setContext and getContext for better ergonomics. When no value is set in the context, get throws an error and get_maybe returns undefined. If a fallback is provided, the value argument to set is optional and get_maybe is omitted from the type.

fallback

type () => T

returns

{ get: () => T; set: (value?: T | undefined) => T; }

generics

T

create_csp_directives
#

csp.ts view source

(options?: CreateCspDirectivesOptions): CspDirectives

This is designed for compatibility with SvelteKit and maps to the KitConfig directives option. The goal is to provide an ergonomic, modern, and safe API for Content Security Policy (CSP) creation that's simple to write and audit, and isn't error-prone.

Things like validation and rendering to a string are out of scope and left to SvelteKit.

options

default {}

returns

CspDirectives

create_declaration_contextmenu
#

create_declaration_search
#

create_module_contextmenu
#

create_module_declaration_search
#

CreateCspDirectivesOptions
#

csp.ts view source

CreateCspDirectivesOptions

directives

Override or transform specific directives. Returning null or undefined from a transform function will remove the directive.

type { [K in CspDirective]?: | CspDirectiveValue<K> // Static value replacement | null // Removes the directive // Transform function returning one of the previous types | ((value: CspDirectiveValue<K>) => CspDirectiveValue<K> | null); }

trusted_sources

Sources to include based on their trust levels.

type Array<CspSourceSpec>

value_defaults

Override default values for specific directives, merging with value_defaults_base (or replacing if that directive is null in the base).

type Partial<typeof csp_directive_value_defaults>

value_defaults_base

Base values for directive defaults. Set to null or {} to start with no defaults. Defaults to csp_directive_value_defaults.

type Partial<typeof csp_directive_value_defaults> | null

required_trust_defaults

Override trust requirements for specific directives, merging with required_trust_defaults_base (or replacing if that directive is null in the base).

type Partial<typeof csp_directive_required_trust_defaults>

required_trust_defaults_base

Base values for directive trust requirements. Set to null or {} to start with no trust requirements. Defaults to csp_directive_required_trust_defaults.

type Partial<typeof csp_directive_required_trust_defaults> | null

csp_directive_required_trust_defaults
#

csp.ts view source

Record<keyof CspDirectives, "low" | "medium" | "high" | null>

Sources that meet this trust requirement are included for it by default. If null, no trusted sources are added to the directive automatically. Directives that don't support sources or default to ['none'] are null.

Feedback is welcome, please see the issues - https://github.com/fuzdev/fuz_ui/issues

csp_directive_spec_by_name
#

csp_directive_specs
#

csp_directive_value_defaults
#

csp.ts view source

Record<keyof CspDirectives, boolean | (CspSource | CspActionSource)[] | CspSources | CspFrameSource[] | string[] | "script"[] | ("allow-downloads-without-user-activation" | ... 11 more ... | "allow-top-navigation-by-user-activation")[] | null>

The base CSP directive defaults. Prioritizes safety but loosens around media and styles, relying on defense-in-depth. Customizable via CreateCspDirectivesOptions.defaults.

csp_trust_level_value
#

csp.ts view source

Record<"low" | "medium" | "high", number | undefined>

Numeric values for CSP trust levels, csp_trust_levels. Lower is less trusted. Includes undefined in the type for safety.

csp_trust_levels
#

csp_trusted_sources_of_ryanatkn
#

CspActionSource
#

CspBaseSource
#

CspCryptoSource
#

csp.ts view source

`nonce-${string}` | `sha256-${string}` | `sha384-${string}` | `sha512-${string}`

CspDirective
#

CspDirectives
#

csp.ts view source

CspDirectives

sandbox

type Array< | 'allow-downloads-without-user-activation' | 'allow-forms' | 'allow-modals' | 'allow-orientation-lock' | 'allow-pointer-lock' | 'allow-popups' | 'allow-popups-to-escape-sandbox' | 'allow-presentation' | 'allow-same-origin' | 'allow-scripts' | 'allow-storage-access-by-user-activation' | 'allow-top-navigation' | 'allow-top-navigation-by-user-activation' >

CspDirectiveSpec
#

CspDirectiveValue
#

CspFrameSource
#

CspHostNameScheme
#

CspHostProtocolSchemes
#

CspHostSource
#

csp.ts view source

`${string}.${string}` | "localhost" | `${string}.${string}:${number}` | `${string}.${string}:*` | `localhost:${number}` | "localhost:*" | `${string}://${string}.${string}` | `${string}://${string}.${string}:${number}` | `${string}://${string}.${string}:*` | `${string}://localhost` | `${string}://localhost:${number}`...

CspPortScheme
#

CspSchemeSource
#

CspSource
#

CspSources
#

CspSourceSpec
#

CspTrustLevel
#

csp.ts view source

"low" | "medium" | "high"

Trust levels for CSP sources.

With the base defaults, trust levels roughly correspond to:

- low – Passive resources only (no script execution, no styling or UI control). Examples: img-src, font-src. - medium – Content that may affect layout, styling, or embed external browsing contexts, but cannot directly run code in the page's JS execution environment or perform other high-risk actions. Examples: style-src, frame-src, frame-ancestors. - high – Sources that can execute code in the page's context or open powerful network channels. Examples: script-src, connect-src, child-src. - null – No trust. This is used for directives that don't support sources.

Declaration
#

declaration.svelte.ts view source

Rich runtime representation of an exported declaration.

module

type Module

readonly

declaration_json

type DeclarationJson

readonly

library

module_path

Module path where this declaration is defined.

name

kind

url_github

GitHub source URL with line number.

url_api

API documentation URL.

import_statement

Generated TypeScript import statement.

url_api_full

Public documentation link (if homepage_url is available).

display_name

Display name with generic parameters.

type_signature

doc_comment

deprecated_message

parameters

props

return_type

return_description

generic_params

extends

implements

throws

since

examples

see_also

members

type Array<DeclarationJson> | undefined

properties

type Array<DeclarationJson> | undefined

has_examples

is_deprecated

has_documentation

has_parameters

has_props

has_generics

constructor

type new (module: Module, declaration_json: { [x: string]: unknown; name: string; kind: "function" | "json" | "type" | "variable" | "class" | "constructor" | "component" | "css"; doc_comment?: string | undefined; ... 18 more ...; alias_of?: { ...; } | undefined; }): Declaration

module
type Module
declaration_json
type { [x: string]: unknown; name: string; kind: "function" | "json" | "type" | "variable" | "class" | "constructor" | "component" | "css"; doc_comment?: string | undefined; type_signature?: string | undefined; ... 17 more ...; alias_of?: { ...; } | undefined; }

DeclarationAnalysis
#

library_analysis.ts view source

DeclarationAnalysis

Result of analyzing a single declaration. Used by both TypeScript and Svelte analyzers for uniform handling.

declaration

The analyzed declaration metadata.

type DeclarationJson

nodocs

Whether the declaration is marked

type boolean

DeclarationDetail
#

DeclarationLink
#

DeclarationSearchState
#

Details
#

Details.svelte view source

Like details but renders children lazily by default.

open?

type boolean
optional bindable

eager?

Children are lazily rendered by default, enabling transitions and improving performance, sometimes significantly. Pass true to render children eagerly to gain ctrl+f functionality while trading away the benefits. Consider a <details> element instead of making this component eager.

type boolean
optional

summary

type string | Snippet

summary_attrs?

type SvelteHTMLElements['summary']
optional

children

type Snippet

Diagnostic
#

DiagnosticKind
#

DiagnosticSeverity
#

analysis_context.ts view source

DiagnosticSeverity

Diagnostic severity levels.

- error: Analysis failed, declaration may be incomplete or missing data - warning: Partial success, something seems off but analysis continued

Dialog
#

Dialog.svelte view source

container?

type HTMLElement
optional

layout?

optional

index?

index 0 is under 1 is under 2 etc -- the topmost dialog is the last in the array

type number
optional

active?

type boolean
optional

content_selector?

If provided, prevents clicks that would close the dialog from bubbling past any elements matching this selector.

type string | null
optional

onclose?

type () => void
optional

children

type Snippet<[close: (e?: Event) => void]>

dialog_layouts
#

DialogLayout
#

DialogParams
#

dialog.ts view source

DialogParams<T>

This pattern is based on: https://github.com/ivanhofer/sveltekit-typescript-showcase/blob/main/src/01-props/09-svelte-component/Component.svelte The main limitation is that the generic cannot be inferred automatically, so we use to_dialog_params to construct instances in most cases. Definining DialogParams with no concrete T lacks typechecking for props.

generics

T

constraint Component<any>
default Component<any>

Component

type T

props

type ComponentProps<T>

dialog_props

type Partial<ComponentProps<typeof Dialog>> | undefined

Dialogs
#

Dialogs.svelte view source

dialogs

type Array<DialogParams>

onclose?

type () => void
optional

children?

type Snippet<[dialog: DialogParams]>
optional

Dimensions
#

DisconnectState
#

intersect.svelte.ts view source

DisconnectState

intersecting

type boolean

intersections

type number

el

type HTMLElement | SVGElement

observer

type IntersectionObserver

Docs
#

Docs.svelte view source

tomes

type Array<Tome>

library

type Library

breadcrumb_children?

type Snippet<[is_primary_nav: boolean]>
optional

children

type Snippet

DOCS_API_PATH
#

docs_links_context
#

DOCS_PATH
#

docs_helpers.svelte.ts view source

"/docs" | "/" | "/about" | "/docs/Alert" | "/docs/Breadcrumb" | "/docs/Breadcrumb/a" | "/docs/Breadcrumb/a/b" | "/docs/Breadcrumb/a/b/c" | "/docs/Breadcrumb/a/b/c/d" | "/docs/Card" | ... 97 more ... | `/${string}/help/`

DOCS_PATH_DEFAULT
#

docs_slugify
#

docs_helpers.svelte.ts view source

(str: string): string

Convert a string to a URL-safe fragment identifier, preserving case for API declarations. Only transforms spaces and special characters, keeping valid identifier characters intact. Used for hash anchors in documentation.

str

- The string to convert to a fragment

type string

returns

string

A URL-safe fragment identifier

DocsContent
#

DocsContent.svelte view source

tomes

type Array<Tome>

library

type Library

repo_name?

type Snippet<[repo_name: string]>
optional

content?

type Snippet
optional

header?

type Snippet
optional

DocsFooter
#

DocsFooter.svelte view source

library

type Library

root_url?

type Url | null
optional

logo?

type Snippet
optional

logo_header?

type Snippet
optional

logo_footer?

type Snippet
optional

DocsLink
#

DocsLinkInfo
#

docs_helpers.svelte.ts view source

DocsLinkInfo

id

type string

text

type string

fragment

type string

tag

type DocsLinkTag | undefined

depth

type number

order

type number

parent_id

type string | undefined

DocsLinks
#

DocsLinkTag
#

DocsList
#

DocsMenu
#

DocsMenu.svelte view source

tomes

type Array<Tome>

children?

type Snippet<[category: string]>
optional

expand_width?

type boolean
optional

DocsMenuHeader
#

DocsModulesList
#

DocsPageLinks
#

DocsPrimaryNav
#

DocsSearch
#

DocsSearch.svelte view source

placeholder?

type string
optional

total_count

type number

result_count?

type number
optional

search_query

type string
bindable

DocsSecondaryNav
#

DocsTertiaryNav
#

DuplicateInfo
#

library_pipeline.ts view source

DuplicateInfo

A duplicate declaration with its full metadata and module path.

declaration

The full declaration metadata.

type DeclarationJson

module

Module path where this declaration is defined.

type string

EcosystemLinks
#

EcosystemLinksPanel
#

effect_with_count
#

rune_helpers.svelte.ts view source

(fn: (count: number) => void, initial?: number): void

Runs fn in an $effect, passing true as the skip argument for the first count runs. Calls fn even when skipping so callers can read any dependent signals.

fn

type (count: number) => void

initial

type number
default 0

returns

void

EntryState
#

contextmenu_state.svelte.ts view source

is_menu

readonly

menu

type SubmenuState | RootMenuState

readonly

run

type () => ContextmenuRun

readonly

disabled

type () => boolean

readonly

selected

type boolean

pending

type boolean

error_message

type string | null

promise

type Promise<ContextmenuActivateResult> | null

constructor

type new (menu: SubmenuState | RootMenuState, run: () => ContextmenuRun, disabled?: () => boolean): EntryState

menu
type SubmenuState | RootMenuState
run
type () => ContextmenuRun
disabled
type () => boolean
default () => false

format_diagnostic
#

analysis_context.ts view source

(diagnostic: Diagnostic, options?: FormatDiagnosticOptions | undefined): string

Format a diagnostic for display.

diagnostic

The diagnostic to format

options?

Formatting options

type FormatDiagnosticOptions | undefined
optional

returns

string

Formatted string like './file.ts:10:5: error: message'

FormatDiagnosticOptions
#

analysis_context.ts view source

FormatDiagnosticOptions

Options for formatting diagnostics.

prefix

Prefix for file path (default: './').

type string

strip_base

Base path to strip from absolute file paths (e.g., process.cwd()).

type string

get_tome_by_name
#

tome.ts view source

(name: string): { name: string; category: string; Component: Component<any, any, string>; related_tomes: string[]; related_modules: string[]; related_declarations: string[]; }

name

type string

returns

{ name: string; category: string; Component: Component<any, any, string>; related_tomes: string[]; related_modules: string[]; related_declarations: string[]; }

GithubLink
#

Glyph
#

Hashlink
#

HueInput
#

ImgOrSvg
#

ImgOrSvg.svelte view source

src

type string

label?

type string
optional

size?

Sets both the width and height of the svg. Overridden by the width and height props.

type string
optional

width?

Sets the width of the svg. Overrides size.

type string
optional

height?

Sets the height of the svg. Overrides size.

type string
optional

svg_attrs?

type SvelteHTMLElements['svg']
optional

img_attrs?

type SvelteHTMLElements['img']
optional

intersect
#

intersect.svelte.ts view source

(get_params: () => IntersectParamsOrCallback | null | undefined): Attachment<HTMLElement | SVGElement>

Creates an attachment that observes element viewport intersection. Uses the lazy function pattern to optimize reactivity: callbacks can update without recreating the observer, preserving state.

get_params

Function that returns callback, params object, or nullish to disable

type () => IntersectParamsOrCallback | null | undefined

returns

Attachment<HTMLElement | SVGElement>

IntersectParams
#

intersect.svelte.ts view source

IntersectParams

onintersect

Called when the element enters or leaves the viewport until disconnected.

ondisconnect

Called when the attachment's observer is disconnected, either by the user calling disconnect or the attachment being destroyed.

count

A value of 1 disconnects after el enters and leaves the viewport one time, similar to 'once' for an event. 0 disables and undefined or a negative number like -1 never disconnects.

type number

options

Same as the options param to IntersectionObserver

type IntersectionObserverInit

IntersectParamsOrCallback
#

IntersectState
#

intersect.svelte.ts view source

IntersectState

intersecting

type boolean

intersections

type number

el

type HTMLElement | SVGElement

observer

type IntersectionObserver

disconnect

type () => void

is_csp_trusted
#

csp.ts view source

(required_trust: "low" | "medium" | "high" | null | undefined, granted_trust: "low" | "medium" | "high" | null | undefined): boolean

Determines if a granted trust level is sufficient to satisfy a required trust level.

Trust levels have the following hierarchy: - 'high' sources can be used in high, medium, and low trust directives (highest privilege) - 'medium' sources can be used in medium and low trust directives - 'low' sources can only be used in low trust directives (lowest privilege)

required_trust

type "low" | "medium" | "high" | null | undefined

granted_trust

type "low" | "medium" | "high" | null | undefined

returns

boolean

ItemState
#

Library
#

library.svelte.ts view source

Rich runtime representation of a library.

Wraps LibraryJson with computed properties and provides the root of the API documentation hierarchy: Library → modules → declarations

see also

  • module.svelte.ts for Module class

  • declaration.svelte.ts for Declaration class

library_json

type LibraryJson

readonly

package_json

source_json

name

repo_name

repo_url

owner_name

homepage_url

logo_url

logo_alt

npm_url

changelog_url

published

org_url

Organization URL (e.g., 'https://github.com/ryanatkn').

modules

All modules as rich Module instances.

modules_sorted

All modules sorted alphabetically by path.

declarations

All declarations across all modules as a flat array.

declaration_map

Declaration lookup map by name. Provides O(1) lookup.

constructor

type new (library_json: LibraryJson): Library

library_json
type LibraryJson

lookup_declaration

Look up a declaration by name.

type (name: string): Declaration | undefined

name
type string
returns Declaration | undefined

has_declaration

Check if a declaration exists.

type (name: string): boolean

name
type string
returns boolean

lookup_module

Look up a module by its canonical path.

type (path: string): Module | undefined

path
type string
returns Module | undefined

search_declarations

Search declarations by query string with multi-term AND logic.

type (query: string): Declaration[]

query
type string
returns Declaration[]

library_analyze_module
#

library_analysis.ts view source

(source_file: SourceFileInfo, program: Program, options: ModuleSourceOptions, ctx: AnalysisContext, log?: Logger | undefined): ModuleAnalysis | undefined

Analyze a source file and extract module metadata.

Unified entry point that dispatches to the appropriate analyzer based on file type: - TypeScript/JS files → ts_analyze_module - Svelte components → svelte_analyze_module

Returns raw analysis data including nodocs flags on declarations. Consumer is responsible for filtering based on their policy.

This function can be called incrementally - consumers may cache results and only re-analyze changed files. The TypeScript program should include all files for accurate type resolution, but only changed files need re-analysis.

source_file

The source file info with content and optional dependency data

program

TypeScript program (used for type checking and source file lookup)

type Program

options

Module source options for path extraction

ctx

Analysis context for collecting diagnostics

log?

Optional logger for warnings

type Logger | undefined
optional

returns

ModuleAnalysis | undefined

Module metadata and re-exports, or undefined if source file not found in program

library_collect_source_files
#

library_pipeline.ts view source

(files: Iterable<SourceFileInfo>, options: ModuleSourceOptions, log?: Logger | undefined): SourceFileInfo[]

Collect and filter source files.

Returns source files for TypeScript/JS files and Svelte components, excluding test files. Returns an empty array with a warning if no source files are found.

File types are determined by options.get_analyzer. By default, .ts, .js, and .svelte files are supported. Customize get_analyzer to support additional file types like .svx.

files

Iterable of source file info (from Gro filer, file system, or other source)

type Iterable<SourceFileInfo>

options

Module source options for filtering

log?

Optional logger for status messages

type Logger | undefined
optional

returns

SourceFileInfo[]

library_collect_source_files_from_disknodes
#

library_gen.ts view source

(disknodes: Iterable<Disknode>, options: ModuleSourceOptions, log?: { info: (...args: unknown[]) => void; warn: (...args: unknown[]) => void; } | undefined): SourceFileInfo[]

Collect source files from Gro disknodes, filtering BEFORE conversion to SourceFileInfo.

This avoids errors from files outside source directories (like test fixtures that may have malformed paths or missing content). The filtering uses module_is_source which checks source_paths to only include files in configured source directories.

disknodes

Iterator of Gro disknodes from filer

type Iterable<Disknode>

options

Module source options for filtering

log?

Optional logger for status messages

type { info: (...args: unknown[]) => void; warn: (...args: unknown[]) => void; } | undefined
optional

returns

SourceFileInfo[]

library_context
#

library.svelte.ts view source

{ get: (error_message?: string | undefined) => Library; get_maybe: () => Library | undefined; set: (value: Library) => Library; }

library_find_duplicates
#

library_pipeline.ts view source

(source_json: { [x: string]: unknown; name: string; version: string; modules?: { [x: string]: unknown; path: string; declarations?: { [x: string]: unknown; name: string; kind: "function" | "json" | "type" | "variable" | "class" | "constructor" | "component" | "css"; ... 19 more ...; alias_of?: { ...; } | undefined; }[] | undefined; module_comment?: string | undefined; dependencies?: string[] | undefined; dependents?: string[] | undefined; star_exports?: string[] | undefined; }[] | undefined; }): Map<...>

Find duplicate declaration names across modules.

Returns a Map of declaration names to their full metadata (only includes duplicates). Callers can decide how to handle duplicates (throw, warn, ignore).

source_json

type { [x: string]: unknown; name: string; version: string; modules?: { [x: string]: unknown; path: string; declarations?: { [x: string]: unknown; name: string; kind: "function" | "json" | "type" | "variable" | "class" | "constructor" | "component" | "css"; ... 19 more ...; alias_of?: { ...; } | undefined; }[] | undefine...

returns

Map<string, DuplicateInfo[]>

examples

Example 1

library_gen
#

library_gen.ts view source

(options?: LibraryGenOptions | undefined): Gen

Creates a Gen object for generating library metadata with full TypeScript analysis.

This is the Gro-specific entry point. It handles: - Reading files from Gro's filer - Loading package.json via Gro utilities - Returning output in Gro's Gen format

For build-tool agnostic usage, use library_generate directly.

Usage in a .gen.ts file:

import {library_gen} from '@fuzdev/fuz_ui/library_gen.js'; export const gen = library_gen();

options?

Optional generation options

type LibraryGenOptions | undefined
optional

returns

Gen

library_generate
#

library_generate.ts view source

(input: LibraryGenerateInput): LibraryGenerateResult

Generate library metadata from source files.

This is the main entry point for library generation. It analyzes source files, extracts metadata, and produces both structured data and file contents.

input

returns

LibraryGenerateResult

examples

Example 1

library_generate_output
#

library_output.ts view source

(package_json: { [x: string]: unknown; name: string; version: string; private?: boolean | undefined; description?: string | undefined; motto?: string | undefined; glyph?: string | undefined; logo?: string | undefined; ... 23 more ...; exports?: string | ... 2 more ... | undefined; }, source_json: { ...; }): LibraryOutputResult

Generate the library.json and library.ts file contents. Parses at generation time so runtime only needs the pre-computed result.

Returns JSON + .ts wrapper because: - JSON is natively importable by Node.js and Vite without TypeScript loaders - Works in CI environments that don't have TS compilation - The .ts wrapper validates with zod and exports with proper types (JSON imports get widened types like string instead of literal unions)

package_json

type { [x: string]: unknown; name: string; version: string; private?: boolean | undefined; description?: string | undefined; motto?: string | undefined; glyph?: string | undefined; logo?: string | undefined; ... 23 more ...; exports?: string | ... 2 more ... | undefined; }

source_json

type { [x: string]: unknown; name: string; version: string; modules?: { [x: string]: unknown; path: string; declarations?: { [x: string]: unknown; name: string; kind: "function" | "json" | "type" | "variable" | "class" | "constructor" | "component" | "css"; ... 19 more ...; alias_of?: { ...; } | undefined; }[] | undefine...

returns

LibraryOutputResult

library_merge_re_exports
#

library_pipeline.ts view source

(source_json: { [x: string]: unknown; name: string; version: string; modules?: { [x: string]: unknown; path: string; declarations?: { [x: string]: unknown; name: string; kind: "function" | "json" | "type" | "variable" | "class" | "constructor" | "component" | "css"; ... 19 more ...; alias_of?: { ...; } | undefined; }[] | undefined; module_comment?: string | undefined; dependencies?: string[] | undefined; dependents?: string[] | undefined; star_exports?: string[] | undefined; }[] | undefined; }, collected_re_exports: CollectedReExport[]): void

Build also_exported_from arrays from collected re-export data.

This function resolves the two-phase re-export problem:

Problem: When module A re-exports from module B, we discover this while analyzing A, but need to update B's declarations. However, B may already be processed or may be processed later.

Solution: Collect all re-exports in phase 1, then merge them in phase 2 after all modules are analyzed.

source_json

The source JSON with all modules (will be mutated)

type { [x: string]: unknown; name: string; version: string; modules?: { [x: string]: unknown; path: string; declarations?: { [x: string]: unknown; name: string; kind: "function" | "json" | "type" | "variable" | "class" | "constructor" | "component" | "css"; ... 19 more ...; alias_of?: { ...; } | undefined; }[] | undefine...

collected_re_exports

Array of re-exports collected during phase 1

type CollectedReExport[]

returns

void

examples

Example 1

library_sort_modules
#

library_pipeline.ts view source

(modules: { [x: string]: unknown; path: string; declarations?: { [x: string]: unknown; name: string; kind: "function" | "json" | "type" | "variable" | "class" | "constructor" | "component" | "css"; doc_comment?: string | undefined; ... 18 more ...; alias_of?: { ...; } | undefined; }[] | undefined; module_comment?: string | undefined; dependencies?: string[] | undefined; dependents?: string[] | undefined; star_exports?: string[] | undefined; }[]): { ...; }[]

Sort modules alphabetically by path for deterministic output and cleaner diffs.

modules

type { [x: string]: unknown; path: string; declarations?: { [x: string]: unknown; name: string; kind: "function" | "json" | "type" | "variable" | "class" | "constructor" | "component" | "css"; doc_comment?: string | undefined; ... 18 more ...; alias_of?: { ...; } | undefined; }[] | undefined; module_comment?: string | un...

returns

{ [x: string]: unknown; path: string; declarations?: { [x: string]: unknown; name: string; kind: "function" | "json" | "type" | "variable" | "class" | "constructor" | "component" | "css"; doc_comment?: string | undefined; ... 18 more ...; alias_of?: { ...; } | undefined; }[] | undefined; module_comment?: string | un...

library_throw_on_duplicates
#

library_generate.ts view source

(duplicates: Map<string, DuplicateInfo[]>, log: { error: (...args: unknown[]) => void; }): void

Strict duplicate handler that throws on any duplicate declaration names.

Use this callback with library_generate({ on_duplicates: library_throw_on_duplicates }) to enforce a flat namespace where all declaration names must be unique.

duplicates

type Map<string, DuplicateInfo[]>

log

type { error: (...args: unknown[]) => void; }

returns

void

throws

  • Error - if any duplicate declaration names are found

LibraryDetail
#

LibraryDetail.svelte view source

library

type Library

repo_name?

type Snippet<[repo_name: string]>
optional

description?

type Snippet<[description: string]>
optional

motto?

type Snippet<[description: string]>
optional

npm_url?

type Snippet<[npm_url: string]>
optional

homepage_url?

type Snippet<[homepage_url: string]>
optional

children?

type Snippet<[library: Library]>
optional

LibraryGenerateInput
#

library_generate.ts view source

LibraryGenerateInput

Input for library metadata generation.

source_files

Source files to analyze (must have content loaded).

type Array<SourceFileInfo>

package_json

Package metadata (name, version).

type PackageJson

source_options

Module source options for path extraction.

program

Optional TypeScript program. If not provided, one will be created. Pass an existing program to reuse across multiple calls.

type ts.Program

on_duplicates

Optional callback for handling duplicate declaration names.

log

Optional logger for status and diagnostic messages.

type Logger

LibraryGenerateResult
#

library_generate.ts view source

LibraryGenerateResult

Result of library metadata generation.

source_json

The generated source metadata.

type SourceJson

json_content

JSON file content string.

type string

ts_content

TypeScript wrapper file content string.

type string

LibraryGenOptions
#

library_gen.ts view source

LibraryGenOptions

Options for Gro library generation.

source

Module source options for filtering and path extraction.

Can provide full ModuleSourceOptions or partial options that will be merged with defaults. The project_root is automatically set to process.cwd() if not provided.

type ModuleSourceOptions | Partial<ModuleSourcePartial>

on_duplicates

Callback invoked when duplicate declaration names are found.

Consumers decide how to handle duplicates: throw, warn, or ignore. Use library_throw_on_duplicates for strict flat namespace enforcement.

LibraryOutputResult
#

library_output.ts view source

LibraryOutputResult

Result of generating library output files. Contains both the JSON data and the TypeScript wrapper file.

json_content

JSON content for library.json

type string

ts_content

TypeScript wrapper content for library.ts

type string

LibrarySummary
#

LibrarySummary.svelte view source

library

type Library

repo_name?

type Snippet<[repo_name: string]>
optional

logo?

type Snippet<[logo_url: string, logo_alt: string]>
optional

motto?

type Snippet<[motto: string, glyph?: string]>
optional

description?

type Snippet<[description: string, glyph?: string]>
optional

npm_url?

type Snippet<[npm_url: string]>
optional

homepage_url?

type Snippet<[homepage_url: string]>
optional

children?

type Snippet
optional

load_color_scheme
#

themer.svelte.ts view source

(fallback?: ColorScheme, key?: string): ColorScheme

fallback

type ColorScheme
default 'auto'

key

type string
default COLOR_SCHEME_STORAGE_KEY

returns

ColorScheme

load_from_storage
#

storage.ts view source

<T>(key: string, is_json?: boolean, parse_fn?: ((value: unknown) => T | null) | undefined): T | null

Utility function to load a value from localStorage with optional parsing

key

The localStorage key

type string

is_json

Whether to parse the value as JSON

type boolean
default false

parse_fn?

Optional custom parsing function to transform the value

type ((value: unknown) => T | null) | undefined
optional

returns

T | null

The parsed value or null if not found or parsing fails

load_theme
#

themer.svelte.ts view source

(fallback?: Theme, key?: string): Theme

fallback

type Theme
default default_themes[0]!

key

type string
default THEME_STORAGE_KEY

returns

Theme

logo_fuz
#

logo_fuz_blog
#

logo_fuz_code
#

logo_fuz_css
#

logo_fuz_gitops
#

logo_fuz_mastodon
#

logo_fuz_template
#

logo_fuz_ui
#

logo_fuz_util
#

logo_github
#

logo_gro
#

logo_mdn
#

MAIN_HEADER_MARGIN_TOP
#

MdnLink
#

Mdz
#

mdz_components_context
#

mdz_components.ts view source

{ get: (error_message?: string | undefined) => MdzComponents; get_maybe: () => MdzComponents | undefined; set: (value: MdzComponents) => MdzComponents; }

Context for providing custom mdz components. Must be set by the application using mdz.

mdz_elements_context
#

mdz_components.ts view source

{ get: (error_message?: string | undefined) => MdzElements; get_maybe: () => MdzElements | undefined; set: (value: MdzElements) => MdzElements; }

Context for providing allowed HTML elements. Must be set by the application using mdz. By default, no HTML elements are allowed.

mdz_is_url
#

mdz_parse
#

MdzBaseNode
#

MdzBoldNode
#

MdzCodeblockNode
#

MdzCodeNode
#

MdzComponentNode
#

MdzComponents
#

mdz_components.ts view source

MdzComponents

Component registry for custom Svelte components that can be used in mdz content.

For example, registering 'Alert' allows using <Alert>...</Alert> in mdz content.

The Map values are the Svelte component constructors.

MdzElementNode
#

MdzElements
#

mdz_components.ts view source

MdzElements

Element registry for HTML elements that can be used in mdz content.

For example, registering 'div' allows using <div>...</div> in mdz content.

The Map values are boolean placeholders for future configuration options.

MdzHeadingNode
#

mdz.ts view source

MdzHeadingNode

inheritance

extends:

type

type 'Heading'

level

type 1 | 2 | 3 | 4 | 5 | 6

children

type Array<MdzNode>

MdzHrNode
#

MdzItalicNode
#

MdzLinkNode
#

mdz.ts view source

MdzLinkNode

inheritance

extends:

type

type 'Link'

reference

type string

children

type Array<MdzNode>

link_type

type 'external' | 'internal'

MdzNode
#

MdzNodeView
#

MdzParagraphNode
#

MdzParser
#

mdz.ts view source

Parser for mdz format. Single-pass lexer/parser with text accumulation for efficiency. Used by mdz_parse, which should be preferred for simple usage.

constructor

type new (template: string): MdzParser

template
type string

parse

Main parse method. Returns flat array of nodes, with paragraph nodes wrapping content between double newlines.

type (): MdzNode[]

returns MdzNode[]

MdzStrikethroughNode
#

MdzTextNode
#

Module
#

module.svelte.ts view source

Rich runtime representation of a module with computed properties.

library

type Library

readonly

module_json

type ModuleJson

readonly

path

Canonical module path (e.g., 'Alert.ts', 'helpers/foo.ts').

path_import

Import-style path with ./ prefix.

module_comment

declarations

Array of Declaration instances. Filters out default exports.

url_api

API documentation URL for this module.

url_github

GitHub source URL.

has_declarations

type boolean

has_module_comment

type boolean

dependencies

Modules this imports (paths relative to src/lib).

dependents

Modules that import this (paths relative to src/lib).

constructor

type new (library: Library, module_json: { [x: string]: unknown; path: string; declarations?: { [x: string]: unknown; name: string; kind: "function" | "json" | "type" | "variable" | "class" | "constructor" | "component" | "css"; ... 19 more ...; alias_of?: { ...; } | undefined; }[] | undefined; module_comment?: string | undefined; dependencies?: string[] | undefined; dependents?: string[] | undefined; star_exports?: string[] | undefined; }): Module

library
type Library
module_json
type { [x: string]: unknown; path: string; declarations?: { [x: string]: unknown; name: string; kind: "function" | "json" | "type" | "variable" | "class" | "constructor" | "component" | "css"; doc_comment?: string | undefined; ... 18 more ...; alias_of?: { ...; } | undefined; }[] | undefined; module_comment?: string | un...

get_declaration_by_name

Look up a declaration by name within this module.

type (name: string): Declaration | undefined

name
type string
returns Declaration | undefined

module_create_source_options
#

module_helpers.ts view source

(project_root: string, overrides?: Partial<ModuleSourcePartial> | undefined): ModuleSourceOptions

Create complete source options from project root and optional overrides.

project_root

Absolute path to project root (typically process.cwd())

type string

overrides?

Optional overrides for default options

type Partial<ModuleSourcePartial> | undefined
optional

returns

ModuleSourceOptions

examples

Example 1
Example 2
Example 3

module_extract_dependencies
#

module_helpers.ts view source

(source_file: SourceFileInfo, options: ModuleSourceOptions): { dependencies: string[]; dependents: string[]; }

Extract dependencies and dependents for a module from source file info.

Filters to only include source modules (excludes external packages, node_modules, tests). Returns sorted arrays of module paths (relative to source_root) for deterministic output.

source_file

The source file info to extract dependencies from

options

Module source options for filtering and path extraction

returns

{ dependencies: string[]; dependents: string[]; }

module_extract_path
#

module_helpers.ts view source

(source_id: string, options: ModuleSourceOptions): string

Extract module path relative to source root from absolute source ID.

Uses proper path semantics: strips project_root/source_root/ prefix.

source_id

Absolute path to the source file

type string

options

Module source options for path extraction

returns

string

examples

Example 1
Example 2

module_get_analyzer_default
#

module_helpers.ts view source

(path: string): AnalyzerType | null

Default analyzer resolver based on file extension.

- .svelte → 'svelte' - .ts, .js → 'typescript' - Other extensions → null (skip)

path

type string

returns

AnalyzerType | null

module_get_component_name
#

module_helpers.ts view source

(module_path: string): string

Extract component name from a Svelte module path.

module_path

type string

returns

string

examples

Example 1

module_get_key
#

module_helpers.ts view source

(module_path: string): string

Convert module path to module key format (with ./ prefix).

module_path

type string

returns

string

examples

Example 1

module_get_source_root
#

module_helpers.ts view source

(options: ModuleSourceOptions): string

Get the effective source_root from options.

Returns source_root if provided, otherwise returns source_paths[0] for single-path configs.

options

returns

string

throws

  • Error - if source_root is required but not provided (multiple source_paths)

module_is_css
#

module_is_json
#

module_is_source
#

module_helpers.ts view source

(path: string, options: ModuleSourceOptions): boolean

Check if a path is an analyzable source file.

Combines all filtering: exclusion patterns, source directory paths, and analyzer availability. This is the single check for whether a file should be included in library analysis.

Uses proper path semantics with startsWith matching against project_root/source_path/. No heuristics needed - nested directories are correctly excluded by the prefix check.

path

Full absolute path to check

type string

options

Module source options for filtering

returns

boolean

True if the path is an analyzable source file

examples

Example 1

module_is_svelte
#

module_is_test
#

module_is_typescript
#

module_helpers.ts view source

(path: string): boolean

Check if a path is a TypeScript or JS file.

Includes both .ts and .js files since JS files are valid in TS projects. Excludes .d.ts declaration files - use a custom get_analyzer to include them.

path

type string

returns

boolean

MODULE_SOURCE_PARTIAL
#

module_helpers.ts view source

ModuleSourcePartial

Default partial options for standard SvelteKit library structure.

Does not include project_root - use module_create_source_options() to create complete options with your project root.

module_validate_source_options
#

module_helpers.ts view source

(options: ModuleSourceOptions): void

Validate ModuleSourceOptions format and consistency.

Checks: 1. project_root is an absolute path (starts with /) 2. source_paths entries don't have leading/trailing slashes 3. source_root (if provided) doesn't have leading/trailing slashes 4. Multiple source_paths require explicit source_root 5. source_root is a prefix of all source_paths

options

returns

void

throws

  • Error - if validation fails

examples

Example 1
Example 2
Example 3

ModuleAnalysis
#

library_analysis.ts view source

ModuleAnalysis

Result of analyzing a module (TypeScript or Svelte). Both analyzers return this same structure for uniform handling.

path

Module path relative to source root.

type string

module_comment

Module-level documentation comment.

type string

declarations

All declarations with nodocs flags - consumer filters based on policy.

type Array<DeclarationAnalysis>

dependencies

Dependencies (other source modules this module imports). Empty if none.

type Array<string>

dependents

Dependents (other source modules that import this module). Empty if none.

type Array<string>

star_exports

Star exports (export * from './module'). Empty for Svelte components.

type Array<string>

re_exports

Re-exports discovered during analysis. Empty for Svelte components.

type Array<ReExportInfo>

ModuleExportsAnalysis
#

ts_helpers.ts view source

ModuleExportsAnalysis

Result of analyzing a module's exports.

module_comment

Module-level documentation comment.

type string

declarations

All exported declarations with nodocs flags - consumer filters based on policy.

type Array<DeclarationAnalysis>

re_exports

Same-name re-exports (for building also_exported_from in post-processing).

type Array<ReExportInfo>

star_exports

Star exports (export * from './module') - module paths that are fully re-exported.

type Array<string>

ModuleLink
#

ModuleSkippedDiagnostic
#

analysis_context.ts view source

ModuleSkippedDiagnostic

Module was skipped during analysis. Could be due to missing source file in program or no analyzer available.

inheritance

kind

type 'module_skipped'

reason

Reason the module was skipped.

type 'not_in_program' | 'no_analyzer'

ModuleSourceOptions
#

module_helpers.ts view source

ModuleSourceOptions

Configuration for module source detection and path extraction.

Uses proper path semantics with project_root as the base for all path operations. Paths are matched using startsWith rather than substring search, which correctly handles nested directories without special heuristics.

examples

Example 1

project_root

Absolute path to the project root directory.

All source_paths are relative to this. Typically process.cwd() when running from the project root via Gro, Vite, or other build tools.

type string

source_paths

Source directory paths to include, relative to project_root.

Paths should not have leading or trailing slashes - they are added internally for correct matching.

type Array<string>

source_root

Source root for extracting relative module paths, relative to project_root.

When omitted: - Single source_path: defaults to that path - Multiple source_paths: required (no auto-derivation)

type string

exclude_patterns

Patterns to exclude (matched against full path).

type Array<RegExp>

get_analyzer

Determine which analyzer to use for a file path.

Called for files in source directories. Return 'typescript', 'svelte', or null to skip the file. This is the single source of truth for which files are analyzable and how to analyze them.

type (path: string) => AnalyzerType | null

ModuleSourcePartial
#

OnDisconnect
#

OnDuplicatesCallback
#

OnIntersect
#

package_is_published
#

package_helpers.ts view source

(package_json: { [x: string]: unknown; name: string; version: string; private?: boolean | undefined; description?: string | undefined; motto?: string | undefined; glyph?: string | undefined; logo?: string | undefined; ... 23 more ...; exports?: string | ... 2 more ... | undefined; }): boolean

Check if a package is published to npm.

A package is considered published if: - It's not marked as private - It has exports defined - Its version is not the initial '0.0.1'

package_json

The package.json object to check

type { [x: string]: unknown; name: string; version: string; private?: boolean | undefined; description?: string | undefined; motto?: string | undefined; glyph?: string | undefined; logo?: string | undefined; ... 23 more ...; exports?: string | ... 2 more ... | undefined; }

returns

boolean

True if the package appears to be published

parse_csp_directive
#

csp.ts view source

(directive: unknown): keyof CspDirectives | null

directive

type unknown

returns

keyof CspDirectives | null

parse_csp_trust_level
#

csp.ts view source

(trust: unknown): "low" | "medium" | "high" | null

Validates and extracts a CSP trust level from an unknown value.

trust

type unknown

returns

"low" | "medium" | "high" | null

PasteFromClipboard
#

PendingAnimation
#

PendingAnimation.svelte view source

inline?

type boolean
optional

running?

type boolean
optional

item_attrs?

type SvelteHTMLElements['span']
optional

children?

type Snippet<[index: number]>
optional

PendingButton
#

PendingButton.svelte view source

pending

type boolean

onclick

type () => void

running?

type boolean
optional

title?

type string
optional

disabled?

type boolean
optional

animation?

type Snippet
optional

children

type Snippet

ProjectLinks
#

Redirect
#

Redirect.svelte view source

host?

The target host to redirect to. Defaults to the current location.host.

type string
optional

path?

The target path to redirect to. Defaults to the current location.pathname.

type string
optional

auto?

Should the redirect happen automatically without user input? Defaults to true.

type boolean
optional

children?

type Snippet<[url: string]>
optional

ReExportInfo
#

library_analysis.ts view source

ReExportInfo

Information about a same-name re-export. Used for post-processing to build also_exported_from arrays.

name

Name of the re-exported declaration.

type string

original_module

Module path (relative to src/lib) where the declaration is originally declared.

type string

render_value_to_string
#

repo_name_parse
#

package_helpers.ts view source

(name: string): string

Extract repository name without scope from package name.

name

Package name (can be scoped like '@org/package')

type string

returns

string

Repository name without scope

throws

  • Error - if scoped package name is malformed

examples

Example 1
Example 2

repo_url_github_owner
#

repo_url_parse
#

package_helpers.ts view source

(repository: string | { [x: string]: unknown; type: string; url: string; directory?: string | undefined; } | undefined): string | null

Parse repository URL from package.json format.

Handles both string format and object format with url property. Strips common prefixes ('git+') and suffixes ('.git', '/').

repository

The repository field from package.json

type string | { [x: string]: unknown; type: string; url: string; directory?: string | undefined; } | undefined

returns

string | null

Clean repository URL, or null if not provided

examples

Example 1
Example 2
Example 3

RootMenuState
#

save_color_scheme
#

themer.svelte.ts view source

(color_scheme: ColorScheme | null, key?: string): void

color_scheme

type ColorScheme | null

key

type string
default COLOR_SCHEME_STORAGE_KEY

returns

void

save_theme
#

themer.svelte.ts view source

(theme: Theme | null, key?: string): void

theme

type Theme | null

key

type string
default THEME_STORAGE_KEY

returns

void

save_to_storage
#

storage.ts view source

(key: string, value: any, is_json?: boolean): void

Utility function to save a value to localStorage.

key

type string

value

type any

is_json

type boolean
default false

returns

void

SignatureAnalysisDiagnostic
#

analysis_context.ts view source

SignatureAnalysisDiagnostic

Function/method signature analysis failed.

inheritance

kind

type 'signature_analysis_failed'

function_name

Name of the function or method.

type string

source_file_from_disknode
#

library_gen.ts view source

(disknode: Disknode): SourceFileInfo

Convert Gro's Disknode to the build-tool agnostic SourceFileInfo interface.

Use this when you want to analyze files using Gro's filer directly.

disknode

type Disknode

returns

SourceFileInfo

throws

  • Error - if disknode has no content (should be loaded by Gro filer)

SourceFileInfo
#

module_helpers.ts view source

SourceFileInfo

File information for source analysis.

Can be constructed from Gro's Disknode or from plain file system access. This abstraction enables non-Gro usage while keeping Gro support via adapter.

Note: content is required to keep analysis functions pure (no hidden I/O). Callers are responsible for reading file content before analysis.

id

Absolute path to the file.

type string

content

File content (required - analysis functions don't read from disk).

type string

dependencies

Absolute file paths of modules this file imports (optional). Only include resolved local imports, not node_modules. Order should be declaration order in source for deterministic output.

type ReadonlyArray<string>

dependents

Absolute file paths of modules that import this file (optional). Only include resolved local imports, not node_modules.

type ReadonlyArray<string>

Spiders
#

Spiders.svelte view source

spiders?

type Array<string>
optional

seed?

type unknown
optional

random?

type typeof Math.random
optional

SubmenuState
#

svelte_analyze_component
#

svelte_helpers.ts view source

(ts_code: string, source_file: SourceFile, checker: TypeChecker, component_name: string, file_path: string, source_map: TraceMap | null, ctx: AnalysisContext): { ...; }

Analyze a Svelte component from its svelte2tsx transformation.

ts_code

type string

source_file

type SourceFile

checker

type TypeChecker

component_name

type string

file_path

type string

source_map

type TraceMap | null

ctx

returns

{ [x: string]: unknown; name: string; kind: "function" | "json" | "type" | "variable" | "class" | "constructor" | "component" | "css"; doc_comment?: string | undefined; type_signature?: string | undefined; ... 17 more ...; alias_of?: { ...; } | undefined; }

svelte_analyze_file
#

svelte_helpers.ts view source

(source_file: SourceFileInfo, module_path: string, checker: TypeChecker, ctx: AnalysisContext): SvelteFileAnalysis

Analyze a Svelte component file.

This is a high-level function that handles the complete workflow: 1. Transform Svelte source to TypeScript via svelte2tsx 2. Extract component metadata (props, documentation) 3. Extract module-level documentation

Suitable for use in documentation generators, build tools, and analysis.

source_file

Source file info with path and content

module_path

Module path relative to source root (e.g., 'Alert.svelte')

type string

checker

TypeScript type checker for type resolution

type TypeChecker

ctx

Analysis context for collecting diagnostics

returns

SvelteFileAnalysis

Component declaration and optional module-level comment

svelte_analyze_module
#

svelte_helpers.ts view source

(source_file: SourceFileInfo, module_path: string, checker: TypeChecker, options: ModuleSourceOptions, ctx: AnalysisContext): ModuleAnalysis

Analyze a Svelte component file and extract module metadata.

Wraps svelte_analyze_file and adds dependency information from the source file info if available.

This is a high-level function suitable for building documentation or library metadata. For lower-level analysis, use svelte_analyze_file directly.

Returns raw analysis data matching ModuleAnalysis structure. Consumer decides filtering policy (Svelte components are never nodocs).

source_file

The source file info (from Gro filer, file system, or other source)

module_path

The module path (relative to source root)

type string

checker

TypeScript type checker

type TypeChecker

options

Module source options for path extraction

ctx

Analysis context for collecting diagnostics

returns

ModuleAnalysis

Module analysis matching ModuleAnalysis structure

svelte_extract_module_comment
#

svelte_helpers.ts view source

(script_content: string): string | undefined

Extract module-level comment from Svelte script content.

Requires @module tag to identify module comments. The tag line is stripped from the output.

script_content

- The content of the <script> tag.

type string

returns

string | undefined

The cleaned module comment text, or undefined if none found.

svelte_extract_script_content
#

svelte_helpers.ts view source

(svelte_source: string): string | undefined

Extract the content of the main <script> tag from Svelte source.

Matches <script> or <script lang="ts"> but not <script module>. Returns undefined if no matching script tag is found.

svelte_source

type string

returns

string | undefined

SvelteFileAnalysis
#

svelte_helpers.ts view source

SvelteFileAnalysis

Result of analyzing a Svelte file.

declaration

The component declaration metadata.

type DeclarationJson

module_comment

Module-level documentation comment, if present.

type string

SveltePropDiagnostic
#

analysis_context.ts view source

SveltePropDiagnostic

Svelte prop type resolution failed.

inheritance

kind

type 'svelte_prop_failed'

component_name

Name of the component.

type string

prop_name

Name of the prop.

type string

Svg
#

Svg.svelte view source

data

type SvgData

fill?

Overrides data.fill.

type string | null
optional

size?

Sets both the width and height of the svg. Overridden by the width and height props.

type string
optional

width?

Sets the width of the svg. Overrides size.

type string
optional

height?

Sets the height of the svg. Overrides size.

type string
optional

label?

type string
optional

inline?

Renders the SVG as an inline block with spacing appropriate for text. Defaults to false.

type boolean
optional

shrink?

type boolean
optional

sync_color_scheme
#

Teleport
#

Teleport.svelte view source

to?

Defaults to undefined to lessen friction with SSR. We may want to change this to optionally accept a string selector, but that didn't seem to be the best API for the Dialog.

type HTMLElement | undefined | null
optional

onmove?

type (el: HTMLElement, to: HTMLElement) => void
optional

children

type Snippet

THEME_STORAGE_KEY
#

Themed
#

Themed.svelte view source

sync_color_scheme?

type typeof default_sync_color_scheme
optional

load_color_scheme?

type typeof default_load_color_scheme
optional

save_color_scheme?

type typeof default_save_color_scheme
optional

load_theme?

type typeof default_load_theme
optional

save_theme?

type typeof default_save_theme
optional

theme_fallback?

type Theme | undefined
optional

themer?

A reactive class containing the selected theme and color scheme. Defaults to the first default theme. The class reference is not reactive because it's set in context without a wrapper, use {#key theme} if it changes.

type Themer
optional

children

type Snippet<[themer: Themer, style: string | null, theme_style_html: string | null]>

ThemeInput
#

ThemeInput.svelte view source

selected_theme?

type {theme: Theme}
optional

themes?

type Array<Theme>
optional

enable_editing?

type boolean
optional

select?

type ((theme: Theme) => void | boolean) | null
optional

onselect?

type (theme: Theme) => void
optional

onedit?

type (theme: Theme) => void
optional

Themer
#

themer.svelte.ts view source

theme

type Theme

color_scheme

type ColorScheme

constructor

type new (options?: Partial<ThemerJson> | undefined): Themer

options?
type Partial<ThemerJson> | undefined
optional

toJSON

type (): ThemerJson

returns ThemerJson

themer_context
#

themer.svelte.ts view source

{ get: (error_message?: string | undefined) => Themer; get_maybe: () => Themer | undefined; set: (value: Themer) => Themer; }

ThemerJson
#

ThemerOptions
#

to_dialog_params
#

dialog.ts view source

<T extends Component<any>>(Component: T, props: ComponentProps<T>, dialog_props?: Partial<Record<string, any>> | undefined): DialogParams<T>

This helper function is needed to construct DialogParams with type safety. It uses TypeScript's inferred generics for functions, which do not work for plain objects as of v5.0.4. * ContextmenuParams uses a similar strategy.

Component

type T

props

type ComponentProps<T>

dialog_props?

type Partial<Record<string, any>> | undefined
optional

returns

DialogParams<T>

to_docs_path_info
#

docs_helpers.svelte.ts view source

(path_slug: string, pathname: string, root_path?: string): { path: string; path_is_selected: boolean; path_segment: string | undefined; }

path_slug

type string

pathname

type string

root_path

type string
default DOCS_PATH_DEFAULT

returns

{ path: string; path_is_selected: boolean; path_segment: string | undefined; }

to_tome_pathname
#

tome.ts view source

(item: string | { name: string; category: string; Component: Component<any, any, string>; related_tomes: string[]; related_modules: string[]; related_declarations: string[]; }, docs_path?: string, hash?: string | undefined): string

item

type string | { name: string; category: string; Component: Component<any, any, string>; related_tomes: string[]; related_modules: string[]; related_declarations: string[]; }

docs_path

type string
default DOCS_PATH_DEFAULT

hash?

- URL fragment to append, with or without the #.

type string | undefined
optional

returns

string

Tome
#

tome.ts view source

ZodObject<{ name: ZodString; category: ZodString; Component: ZodCustom<Component<any, any, string>, Component<any, any, string>>; related_tomes: ZodArray<...>; related_modules: ZodArray<...>; related_declarations: ZodArray<...>; }, $strip>

tome_context
#

tome.ts view source

{ get: (error_message?: string | undefined) => { name: string; category: string; Component: Component<any, any, string>; related_tomes: string[]; related_modules: string[]; related_declarations: string[]; }; get_maybe: () => { ...; } | undefined; set: (value: { ...; }) => { ...; }; }

TomeContent
#

TomeHeader
#

TomeLink
#

tomes_context
#

tome.ts view source

{ get: (error_message?: string | undefined) => Map<string, { name: string; category: string; Component: Component<any, any, string>; related_tomes: string[]; related_modules: string[]; related_declarations: string[]; }>; get_maybe: () => Map<...> | undefined; set: (value: Map<...>) => Map<...>; }

TomeSection
#

TomeSectionHeader
#

ts_analyze_declaration
#

ts_helpers.ts view source

(symbol: Symbol, source_file: SourceFile, checker: TypeChecker, ctx: AnalysisContext): DeclarationAnalysis

Analyze a TypeScript symbol and extract rich metadata.

This is a high-level function that combines TSDoc parsing with TypeScript type analysis to produce complete declaration metadata. Suitable for use in documentation generators, IDE integrations, and other tooling.

symbol

The TypeScript symbol to analyze

type Symbol

source_file

The source file containing the symbol

type SourceFile

checker

The TypeScript type checker

type TypeChecker

ctx

Optional analysis context for collecting diagnostics

returns

DeclarationAnalysis

Complete declaration metadata including docs, types, and parameters, plus nodocs flag

ts_analyze_module
#

ts_helpers.ts view source

(source_file_info: SourceFileInfo, ts_source_file: SourceFile, module_path: string, checker: TypeChecker, options: ModuleSourceOptions, ctx: AnalysisContext): ModuleAnalysis

Analyze a TypeScript file and extract module metadata.

Wraps ts_analyze_module_exports and adds dependency information from the source file info if available.

This is a high-level function suitable for building documentation or library metadata. For lower-level analysis, use ts_analyze_module_exports directly.

source_file_info

The source file info (from Gro filer, file system, or other source)

ts_source_file

TypeScript source file from the program

type SourceFile

module_path

The module path (relative to source root)

type string

checker

TypeScript type checker

type TypeChecker

options

Module source options for path extraction

ctx

Analysis context for collecting diagnostics

returns

ModuleAnalysis

Module metadata and re-export information

ts_analyze_module_exports
#

ts_helpers.ts view source

(source_file: SourceFile, checker: TypeChecker, options: ModuleSourceOptions, ctx: AnalysisContext): ModuleExportsAnalysis

Analyze all exports from a TypeScript source file.

Extracts the module-level comment and all exported declarations with complete metadata. Handles re-exports by: - Same-name re-exports: tracked in re_exports for also_exported_from building - Renamed re-exports: included as new declarations with alias_of metadata - Star exports (export * from): tracked in star_exports for namespace-level info

This is a mid-level function (above ts_extract_*, below library_gen) suitable for building documentation, API explorers, or analysis tools. For standard SvelteKit library layouts, use module_create_source_options(process.cwd()).

source_file

The TypeScript source file to analyze

type SourceFile

checker

The TypeScript type checker

type TypeChecker

options

Module source options for path extraction in re-exports

ctx

Analysis context for collecting diagnostics

returns

ModuleExportsAnalysis

Module comment, declarations, re-exports, and star exports

ts_create_program
#

ts_helpers.ts view source

(options?: TsProgramOptions | undefined, log?: Logger | undefined): TsProgram

Create TypeScript program for analysis.

options?

Configuration options for program creation

type TsProgramOptions | undefined
optional

log?

Optional logger for info messages

type Logger | undefined
optional

returns

TsProgram

The program and type checker

throws

  • Error - if tsconfig.json is not found

ts_extract_class_info
#

ts_helpers.ts view source

(node: Node, _symbol: Symbol, checker: TypeChecker, declaration: { [x: string]: unknown; name: string; kind: "function" | "json" | "type" | "variable" | "class" | "constructor" | "component" | "css"; ... 19 more ...; alias_of?: { ...; } | undefined; }, ctx: AnalysisContext): void

Extract class information with rich member metadata.

node

type Node

_symbol

type Symbol

checker

type TypeChecker

declaration

type { [x: string]: unknown; name: string; kind: "function" | "json" | "type" | "variable" | "class" | "constructor" | "component" | "css"; doc_comment?: string | undefined; type_signature?: string | undefined; ... 17 more ...; alias_of?: { ...; } | undefined; }

ctx

returns

void

ts_extract_function_info
#

ts_helpers.ts view source

(node: Node, symbol: Symbol, checker: TypeChecker, declaration: { [x: string]: unknown; name: string; kind: "function" | "json" | "type" | "variable" | "class" | "constructor" | "component" | "css"; ... 19 more ...; alias_of?: { ...; } | undefined; }, tsdoc: TsdocParsedComment | undefined, ctx: AnalysisContext): void

Extract function/method information including parameters with descriptions and default values.

node

type Node

symbol

type Symbol

checker

type TypeChecker

declaration

type { [x: string]: unknown; name: string; kind: "function" | "json" | "type" | "variable" | "class" | "constructor" | "component" | "css"; doc_comment?: string | undefined; type_signature?: string | undefined; ... 17 more ...; alias_of?: { ...; } | undefined; }

tsdoc

type TsdocParsedComment | undefined

ctx

returns

void

ts_extract_module_comment
#

ts_helpers.ts view source

(source_file: SourceFile): string | undefined

Extract module-level comment.

Requires @module tag to identify module comments. The tag line is stripped from the output. Supports optional module renaming: @module custom-name.

source_file

type SourceFile

returns

string | undefined

see also

ts_extract_signature_parameters
#

ts_helpers.ts view source

(sig: Signature, checker: TypeChecker, tsdoc_params: Map<string, string> | undefined): { name: string; type: string; optional?: boolean | undefined; description?: string | undefined; default_value?: string | undefined; }[]

Extract parameters from a TypeScript signature with TSDoc descriptions and default values.

Shared helper for extracting parameter information from both standalone functions and class methods/constructors.

sig

The TypeScript signature to extract parameters from

type Signature

checker

TypeScript type checker for type resolution

type TypeChecker

tsdoc_params

Map of parameter names to TSDoc descriptions (from tsdoc.params)

type Map<string, string> | undefined

returns

{ name: string; type: string; optional?: boolean | undefined; description?: string | undefined; default_value?: string | undefined; }[]

Array of parameter info objects

ts_extract_type_info
#

ts_helpers.ts view source

(node: Node, _symbol: Symbol, checker: TypeChecker, declaration: { [x: string]: unknown; name: string; kind: "function" | "json" | "type" | "variable" | "class" | "constructor" | "component" | "css"; ... 19 more ...; alias_of?: { ...; } | undefined; }, ctx: AnalysisContext): void

Extract type/interface information with rich property metadata.

node

type Node

_symbol

type Symbol

checker

type TypeChecker

declaration

type { [x: string]: unknown; name: string; kind: "function" | "json" | "type" | "variable" | "class" | "constructor" | "component" | "css"; doc_comment?: string | undefined; type_signature?: string | undefined; ... 17 more ...; alias_of?: { ...; } | undefined; }

ctx

returns

void

ts_extract_variable_info
#

ts_helpers.ts view source

(node: Node, symbol: Symbol, checker: TypeChecker, declaration: { [x: string]: unknown; name: string; kind: "function" | "json" | "type" | "variable" | "class" | "constructor" | "component" | "css"; ... 19 more ...; alias_of?: { ...; } | undefined; }, ctx: AnalysisContext): void

Extract variable information.

node

type Node

symbol

type Symbol

checker

type TypeChecker

declaration

type { [x: string]: unknown; name: string; kind: "function" | "json" | "type" | "variable" | "class" | "constructor" | "component" | "css"; doc_comment?: string | undefined; type_signature?: string | undefined; ... 17 more ...; alias_of?: { ...; } | undefined; }

ctx

returns

void

ts_infer_declaration_kind
#

ts_helpers.ts view source

(symbol: Symbol, node: Node): "function" | "json" | "type" | "variable" | "class" | "constructor" | "component" | "css"

Infer declaration kind from symbol and node.

Maps TypeScript constructs to DeclarationKind: - Classes → 'class' - Functions (declarations, expressions, arrows) → 'function' - Interfaces, type aliases → 'type' - Enums (regular and const) → 'type' - Variables → 'variable' (unless function-valued → 'function')

symbol

type Symbol

node

type Node

returns

"function" | "json" | "type" | "variable" | "class" | "constructor" | "component" | "css"

tsdoc_apply_to_declaration
#

tsdoc_helpers.ts view source

(declaration: { [x: string]: unknown; name: string; kind: "function" | "json" | "type" | "variable" | "class" | "constructor" | "component" | "css"; doc_comment?: string | undefined; type_signature?: string | undefined; ... 17 more ...; alias_of?: { ...; } | undefined; }, tsdoc: TsdocParsedComment | undefined): void

Apply parsed TSDoc metadata to a declaration.

Consolidates the common pattern of assigning TSDoc fields to declarations, with conditional assignment for array fields (only if non-empty).

declaration

declaration object to update

type { [x: string]: unknown; name: string; kind: "function" | "json" | "type" | "variable" | "class" | "constructor" | "component" | "css"; doc_comment?: string | undefined; type_signature?: string | undefined; ... 17 more ...; alias_of?: { ...; } | undefined; }

tsdoc

parsed TSDoc comment (if available)

type TsdocParsedComment | undefined

returns

void

tsdoc_clean_comment
#

tsdoc_helpers.ts view source

(comment_text: string): string | undefined

Clean raw JSDoc comment text by removing comment markers and leading asterisks.

Transforms /** ... *\/ style comments into clean text.

comment_text

The raw comment text including /** and *\/ markers

type string

returns

string | undefined

Cleaned comment text, or undefined if empty after cleaning

tsdoc_parse
#

tsdoc_helpers.ts view source

(node: Node, source_file: SourceFile): TsdocParsedComment | undefined

Parse JSDoc comment from a TypeScript node.

Extracts and parses all JSDoc tags including:

- @param - parameter descriptions - @returns - return value description - @throws - error documentation - @example - code examples - @deprecated - deprecation warnings - @see - related references - @since - version information - @mutates - mutation documentation (non-standard)

node

The TypeScript node to extract JSDoc from

type Node

source_file

Source file (used for extracting full @see tag text)

type SourceFile

returns

TsdocParsedComment | undefined

tsdoc_see_to_mdz
#

tsdoc_mdz.ts view source

(content: string): string

Convert raw TSDoc @see content to mdz format for rendering.

Handles TSDoc link syntax: - |text → [text](url) (markdown link) - ://... → https://... (bare URL, auto-linked by mdz) - `` → `` identifier `` (code formatting) - Bare URLs → returned as-is - Bare identifiers → wrapped in backticks

content

Raw @see tag content in TSDoc format

type string

returns

string

mdz-formatted string ready for <Mdz> component

examples

Example 1

TsdocParsedComment
#

tsdoc_helpers.ts view source

TsdocParsedComment

Parsed JSDoc/TSDoc comment with structured metadata.

text

Comment text (excluding comment markers)

type string

params

Parameter descriptions mapped by parameter name

type Map<string, string>

returns

Return value description from @returns

type string

throws

Thrown errors from @throws

type Array<{type?: string; description: string}>

examples

Code examples from @example

type Array<string>

deprecated_message

Deprecation message from @deprecated

type string

see_also

Related references from @see

type Array<string>

since

Version information from @since

type string

mutates

Mutation documentation from @mutates (non-standard)

type Array<string>

nodocs

Whether to exclude from documentation. From @nodocs tag.

type boolean

TsModifier
#

ts_helpers.ts view source

TsModifier

TypeScript modifier keywords extracted from declarations.

These are the access modifiers and other keywords that can appear on class members, interface properties, etc.

TsProgram
#

ts_helpers.ts view source

TsProgram

Result of creating a TypeScript program.

program

type ts.Program

checker

type ts.TypeChecker

TsProgramOptions
#

ts_helpers.ts view source

TsProgramOptions

Options for creating a TypeScript program.

root

Project root directory.

type string

tsconfig

Path to tsconfig.json (relative to root).

type string

compiler_options

Override compiler options.

type ts.CompilerOptions

TypeExtractionDiagnostic
#

analysis_context.ts view source

TypeExtractionDiagnostic

Type extraction failed (e.g., complex or recursive types).

inheritance

kind

type 'type_extraction_failed'

symbol_name

Name of the symbol whose type couldn't be extracted.

type string

TypeLink
#

url_api_declaration
#

library_helpers.ts view source

(declaration_name: string): string

Build project-relative API documentation URL with hash anchor.

declaration_name

Name of the declaration to link to

type string

returns

string

URL path like '/docs/api#declaration_name'

url_api_declaration_full
#

url_api_module
#

library_helpers.ts view source

(module_path: string): string

Build project-relative module documentation URL.

module_path

Module path (e.g., 'helpers.ts')

type string

returns

string

URL path like '/docs/api/helpers.ts'

url_github_file
#

package_helpers.ts view source

(repo_url: string, file_path: string, line?: number | undefined): string

Build GitHub file URL for a repository.

repo_url

Repository URL (e.g., 'https://github.com/owner/repo')

type string

file_path

Path to the file (leading './' is stripped)

type string

line?

Optional line number for deep linking

type number | undefined
optional

returns

string

Full GitHub URL to the file on the main branch

examples

Example 1
Example 2

url_github_org
#

package_helpers.ts view source

(repo_url: string, repo_name: string): string | null

Build GitHub organization URL from repo URL and repo name.

repo_url

Repository URL (e.g., 'https://github.com/owner/repo')

type string

repo_name

Repository name to strip from the URL

type string

returns

string | null

Organization URL, or null if repo_url doesn't end with repo_name

examples

Example 1

url_npm_package
#

package_helpers.ts view source

(package_name: string): string

Build npm package URL.

package_name

Package name (can be scoped like '@org/package')

type string

returns

string

Full npm package page URL

examples

Example 1

url_package_logo
#

url_to_root_relative
#

library_helpers.ts view source

(url: string, origin?: string): string

Convert a full URL to root-relative format by removing the origin.

Uses SvelteKit's page state for the current origin by default.

url

Full URL to convert

type string

origin

Origin to strip (defaults to current page origin)

type string
default page.url.origin

returns

string

Root-relative URL starting with '/'

examples

Example 1

url_well_known
#

package_helpers.ts view source

(homepage_url: string, filename: string): string

Build .well-known URL for package metadata files.

homepage_url

Package homepage URL

type string

filename

Filename in .well-known directory

type string

returns

string

Full URL to the .well-known file

examples

Example 1

vite_plugin_library_well_known
#

vite_plugin_library_well_known.ts view source

(options?: VitePluginLibraryWellKnownOptions): Plugin<any>

Vite plugin that publishes package.json and library.json to .well-known/.

Requires a generated library.json file (created by library_gen from gro gen). The plugin reads this JSON file and publishes its metadata to .well-known/ for both dev and production builds.

Note: This plugin respects SvelteKit's base path configuration, so .well-known/ will be served at {base}.well-known/ (e.g., /my-app/.well-known/). This deviates from RFC 8615 which specifies .well-known should be at the domain root. This tradeoff allows the plugin to work correctly when apps are deployed to non-root paths.

Note: CORS headers are only set for the dev server. For production, configure CORS at the server level (nginx, Caddy, etc.) if cross-origin access is needed.

options

default {}

returns

Plugin<any>

examples

Example 1

VitePluginLibraryWellKnownOptions
#