@konce-pt/map
v0.8.5
Published
Map core for Koncept UI — projection and bounds maths, marker clustering, opening hours, marker markup, plus the Leaflet and Google engine adapters. Framework-free TypeScript, zero runtime dependencies.
Maintainers
Readme
@konce-pt/map
Rdzeń mapy Koncept UI: odwzorowanie i arytmetyka
prostokątów, klastrowanie znaczników, godziny otwarcia, HTML znaczników, formatowanie — oraz
adaptery silników Leaflet i Google. Czysty TypeScript, zero zależności runtime
(leaflet to peer opcjonalny, ładowany dynamicznym import()).
Zwykle nie instalujesz go samodzielnie: używają go @konce-pt/angular/map i @konce-pt/react/map,
i oba re-eksportują jego API. Sięgnij po niego wprost, gdy liczysz klastry po stronie serwera albo
podpinasz własny silnik mapowy.
npm i @konce-pt/mapimport { clusterLocations, zoomForBounds, isOpenAt, createLeafletEngine } from '@konce-pt/map';
// Klastrowanie na siatce pikseli — wynik zależy od zoomu, nie od samych współrzędnych.
clusterLocations(locations, 12, { gridSize: 60 });
// Zoom, przy którym prostokąt mieści się w kontenerze.
zoomForBounds(bounds, { width: 800, height: 480 });
// Godziny otwarcia razem z zakresami przez północ.
isOpenAt(hours, new Date());
// Silnik: jedyne miejsce, które zna typy Leafleta.
const engine = createLeafletEngine({ maxZoom: 19 });API
- Geometria —
project,unproject,boundsOf,boundsCenter,boundsContain,padBounds,isFittableBounds,haversine,metersPerPixel,zoomForBounds,clampLat,normalizeLng - Klastry —
clusterLocations,dominantCategory,countByCategory,isSplittable - Znaczniki —
renderMarkerHtml,renderClusterHtml,renderUserMarkerHtml,colorVarOf,contrastVarOf,foregroundVarOf,clusterTier - Godziny —
parseTime,formatTime,isOpenAt,isAlwaysOpen,nextChange,groupWeek - Kraje i format —
KPT_MAP_COUNTRIES,countryPreset,resolveCountryView,formatDistance,formatLatLng,normalizeUrl,prettyUrl - Silniki —
createLeafletEngine,createGoogleEngine,loadGoogleMapsApi - Typy —
KptMapEngine,KptMapLocation,KptMapCategory,KptMapPoii reszta kontraktu
Pełny opis: llms.txt (EN)
i llms-pl.txt (PL).
Testy
pnpm --filter @konce-pt/map exec node --test "src/**/*.test.ts"Licencja
MIT © konce.pt
