@territory-kit/adapter-core
v1.2.0
Published
Renderer adapter contracts and shared GeoJSON helpers for TerritoryKit.
Readme
@territory-kit/adapter-core
Renderer-independent contracts for TerritoryKit map adapters.
pnpm add @territory-kit/adapter-coreThis package defines shared adapter capabilities, lifecycle states, render source/state/theme contracts, and small pure helpers. It does not import MapLibre, Leaflet, OpenLayers, React Native, DOM APIs, network APIs, or filesystem APIs.
Contract Policy
attach(target)binds the adapter to a renderer target. Attaching a different target first detaches or replaces the previous target according to the implementation.- Attaching the same target twice must be deterministic and must not register duplicate listeners.
setSource,updateState, andupdateThemerequirelifecycleState === "attached"unless an adapter documents a legacy compatibility method separately.- Unsupported capability calls throw
TerritoryErrorwith codeCAPABILITY_UNSUPPORTED. - Calls after disposal throw
TerritoryErrorwith codeADAPTER_DISPOSED. - Async implementations reject with
TerritoryErroror preserve the original error ascause.
See adapter contract for the architecture notes.
