Skip to content

Import paths and assets ​

JavaScript and TypeScript ​

ImportPurpose
@grabm/abmScenario creation, validation, simulation, codecs, persistence
@grabm/abm/playbackReplay layer, clock, controls; requires Three.js
@grabm/abm/playback/headlessClock and controls without importing Three.js
@grabm/abm/analyticsPure analysis, plugins, report-card mount
@grabm/abm/analytics/plotlyOptional browser chart integration

Exact signatures are generated in the API reference. Public imports must use these entry points, not package src or dist paths.

Worker entry ​

@grabm/abm/worker-entry is the module-worker asset. In Vite, import it with ?worker and pass the resulting constructor through createWorker, as shown in browser workers. It is not an ordinary main-thread function export.

Stylesheets ​

Import @grabm/abm/playback/styles.css for playback controls and @grabm/abm/analytics/styles.css for report cards. A bundler must handle CSS imports. Import @grabm/abm/theme.css for the shared light/dark palette. Host overrides use the library's --abm-* properties. grABM's shared theme maps them to semantic tokens for both light and dark appearances.

JSON Schemas ​

See Scenario JSON schema for nodes, edges, facilities, and the complete simulation input.

The library exports these generated assets:

  • @grabm/abm/schemas/graph.schema.json
  • @grabm/abm/schemas/scenario.schema.json
  • @grabm/abm/schemas/simulation-input.schema.json
  • @grabm/abm/schemas/result.schema.json

For Node ESM, import JSON using an import attribute:

js
import scenarioSchema from '@grabm/abm/schemas/scenario.schema.json' with { type: 'json' }

These are Draft 2020-12 schemas for authored graph/scenario/run inputs and the unencoded result, not the segmented storage envelope. Their $id values identify schemas; use the packaged files rather than assuming those URLs host downloads.

JSON Schema describes structural checks. Use simulationInputSchema.parse and validateRunResult at runtime for the package's full validation, including refinements and cross-references that cannot all be expressed in exported JSON Schema.

Input schemas allow fields with defaults to be omitted. Runtime parsing applies those defaults; normalized TypeScript output types include them. Exported JSON Schema does not encode every semantic refinement, so use runtime parsing before execution.

Experiments and datasets ​

  • @grabm/abm/experiments: browser batch execution and seed summaries.
  • @grabm/abm/datasets: portable byte I/O, dataset preparation, memory/HTTP sources.
  • @grabm/abm/node: isolated execution, batch execution, filesystem datasets.
  • @grabm/abm/schemas/dataset-manifest.schema.json: current stored dataset manifest.

Node process/filesystem imports remain isolated to /node; root imports remain safe without a browser, Three.js, or Plotly.

Documentation for the grABM library.