GlossaryManager

GlossaryManager

Central glossary manager for ai-unboxed.

Constructor

new GlossaryManager(data, basePath)

Source:
Parameters:
Name Type Description
data Object

Parsed glossary.json data

basePath string

Base path for resolving relative URLs

Members

_aliasIndex :Map.<string, Set.<string>>

Description:
  • alias/term → ID (lowercase)

Source:

alias/term → ID (lowercase)

Type:
  • Map.<string, Set.<string>>

_basePath :string

Source:
Type:
  • string

_byCategory :Map.<string, Array.<Object>>

Description:
  • category → terms

Source:

category → terms

Type:
  • Map.<string, Array.<Object>>

_hoverTimer :number|null

Description:
  • Hover timer

Source:

Hover timer

Type:
  • number | null

_termsById :Map.<string, Object>

Description:
  • ID → term object

Source:

ID → term object

Type:
  • Map.<string, Object>

_tooltipEl :HTMLElement|null

Description:
  • Active tooltip element

Source:

Active tooltip element

Type:
  • HTMLElement | null

categoryLabels :Object.<string, string>

Source:
Type:
  • Object.<string, string>

version :number

Source:
Type:
  • number

Methods

getAllTerms() → {Array.<Object>}

Description:
  • Get all terms.

Source:
Returns:
Type
Array.<Object>

getByCategory(category) → {Array.<Object>}

Description:
  • Get terms by category.

Source:
Parameters:
Name Type Description
category string
Returns:
Type
Array.<Object>

getById(id) → {Object|null}

Description:
  • Get a term by its ID.

Source:
Parameters:
Name Type Description
id string
Returns:
Type
Object | null

getCategories() → {Array.<string>}

Description:
  • Get all category names (sorted).

Source:
Returns:
Type
Array.<string>

initTooltips()

Description:
  • Scan the DOM for [data-glossary] elements and attach tooltip behavior. Call once after page load.

Source:

resolve(text) → {Object|null}

Description:
  • Resolve a term from text (matches against term names and aliases).

Source:
Parameters:
Name Type Description
text string
Returns:
Type
Object | null
Description:
  • Full-text search over terms, aliases, short and long definitions.

Source:
Parameters:
Name Type Description
query string
Returns:

Matching terms, scored by relevance

Type
Array.<Object>

(async, static) load(basePathopt) → {Promise.<GlossaryManager>}

Description:
  • Async factory — loads glossary data and returns singleton.

Source:
Parameters:
Name Type Attributes Default Description
basePath string <optional>
''

Path prefix to config/glossary.json

Returns:
Type
Promise.<GlossaryManager>