kaleidr.js — the loader
One script tag installs window.Kaleidr and defines the
<kaleidr-map> element:
<script src="https://cdn.kaleidr.com/embed/v1/kaleidr.js"></script>
The façade is a thin loader. It owns only: version, config, script loading, the product registry, key passing, doorway selection, mount lifecycle, error normalization, and the dormancy flag. Each product's real behaviour lives in its own bundle, lazy-loaded by URL on first use.
Kaleidr.mount(target, options) → KaleidrHandle
const handle = Kaleidr.mount('#chat', {
product: 'chat',
publishableKey: 'kld_pk_live_…',
map: myMap,
});
Returns a handle synchronously while the product bundle loads in the background; calls before load are queued and flushed on ready.
Options
| Option | Type | Notes |
|---|---|---|
product | 'chat'|'viewer'|'editor'|'tiles' | Required. Selects the bundle + default doorway. |
publishableKey | string | Publishable browser key (kld_pk_live_…). Required for chat/editor/tiles; viewer needs none. The SDK exchanges it for a short-lived session at runtime. |
apiKey | string | Deprecated alias for publishableKey; also accepts a legacy kld_live_… key. |
shareId / mapId | string | Viewer: the published-map id. |
styleId | string | Tiles/editor: a Kaleidr basemap style id (or full style URL for editor). |
map | map instance | Chat: your live in-page map to attach to. |
mapTarget | string | Chat: CSS selector of a host map element (declarative path). |
center zoom pitch bearing | Initial camera. | |
theme | string | object | Named theme or token bag. |
doorway | 'iframe'|'attach' | Escape hatch — overrides the product default. |
base | string | Override the CDN origin (dev / self-host). |
apiBase | string | Platform API origin for the chat product's inference path. |
enabled | boolean | Per-mount dormancy override. |
KaleidrHandle
interface KaleidrHandle {
product: 'chat' | 'viewer' | 'editor' | 'tiles';
setCamera?(camera): void; // present where the product supports it
setTheme?(theme): void;
destroy(): void; // always present
}
Kaleidr.init()
Upgrades any <kaleidr-map> already in the DOM. Called automatically on load;
call it after injecting elements dynamically.
Kaleidr.enable(on = true)
The SDK is inert by default — mount() validates and registers but loads
no bundle until the embed gate is on. Enable it via any of:
window.__KALEIDR_EMBED_ENABLED__ = true(before the script runs), orKaleidr.enable(true)at runtime, or- the
flagattribute /enabledoption per mount.
Kaleidr.version
The loader version string.
CDN base override
For local dev or self-hosting, point the loader at another origin:
<script>window.__KALEIDR_EMBED_BASE__ = 'https://cdn-dev.kaleidr.com';</script>