- Docs
- Entrypoints and module formats
Entrypoints and module formats
Choose the root, Vanilla, core, browser registry, standalone IIFE, or stylesheet export.
Choose Package / ESM for imports or HTML / CDN for a standalone script tag. Both expose the same controller; registry and page-manager APIs are ownership choices, not extra loading modes. Always load the stylesheet explicitly. Loading terms and how they fit together.
Decision table
| Use case | Import | Global side effect | Main surface |
|---|---|---|---|
| ESM/TypeScript app | @samline/ticker | None | Factory, manager, core, and registry singleton. |
| Focused Vanilla integration | @samline/ticker/vanilla | None | Factory and declarative manager. |
| Advanced adapters/tests | @samline/ticker/core | None | Types, defaults, state factories, validators. |
| Registry module | @samline/ticker/browser | None | Default/named id-based registry helpers. |
| HTML / CDN | @samline/ticker/browser/global | Installs globalThis.Ticker. | Self-contained IIFE registry. |
| Runtime styles | @samline/ticker/style.css | CSS only. | Layout, motion, state, reduced motion. |
Root entrypoint
ESM / TypeScript
import { browser, mount, refresh, ticker, Ticker, unmount, validateDuration } from '@samline/ticker'CommonJS
CommonJS consumers receive matching exports:
const { ticker } = require('@samline/ticker')The root re-exports all public core and Vanilla symbols plus browser, Ticker, and registry types. It does not export the individual newTicker/getTicker helper functions; access them through browser or import the browser subpath.
Vanilla entrypoint
import { mount, refresh, ticker, unmount } from '@samline/ticker/vanilla'
It also exports TickerInstance, TickerOptions, TickerTarget, and NormalizedTickerOptions types.
Core entrypoint
import {
DEFAULT_DURATION,
DEFAULT_OPTIONS,
createEmptyTickerState,
validateDuration,
} from '@samline/ticker/core'
See Core utilities for the full surface.
Browser registry module
import BrowserTicker, { newTicker, destroyTicker } from '@samline/ticker/browser'
Default and named registry exports share one module-level registry and do not assign a global.
Standalone IIFE
<script src="https://cdn.jsdelivr.net/npm/@samline/ticker@2.1.0/dist/browser/global.global.js"></script>
<script type="module" src="./main.js"></script>
const news = window.Ticker.ticker('#news')
This is the HTML / CDN script: its IIFE installs window.Ticker. Load it from a CDN or self-host the same file. It cannot be tree-shaken and must run before consumer code. The /browser module above is an importable registry and does not install that global.
CSS is explicit
import { ticker } from '@samline/ticker'
import '@samline/ticker/style.css'
JavaScript entrypoints never import CSS automatically. This keeps server imports and non-CSS build pipelines predictable.
Published formats
Bundler entrypoints ship ESM, CommonJS, source maps, and .d.ts / .d.cts declarations. The global entrypoint ships a single IIFE. The package has no runtime or peer dependencies.