Map Core docs โ
Core map functionality and components built on MapLibre GL
๐ Introduction โ
Map Core provides the fundamental components and utilities for building interactive maps: the Map container, navigation controls, settings, coordinates display, fullscreen, geolocate, and more.
๐ฆ Installation โ
Vue โ
bash
npm install @hungpvq/vue-map-coreReact โ
bash
npm install @hungpvq/react-map-core๐ฏ Features โ
- โ
Map container - Main MapLibre GL wrapper component (one instance per
mapId) - โ Navigation controls - Zoom, Home, Fullscreen, Geolocate
- โ Info controls - Mouse coordinates, Settings, map INFO panel, worker monitor, right-click context menu
- โ CRS extras - Optional CRS control and display settings
- โ
Store /
getMap- Scoped stores + map access from@hungpvq/map-coreโ map-store - โ
Composable hooks -
useMap,useShowand more - โ TypeScript support - Full TypeScript types
- โ
Vue 3 / React - Framework wrappers over
@hungpvq/map-core
Styles โ
Import CSS once at the app entry. For map-core only, import both shared core and the framework adapter:
ts
import '@hungpvq/map-core/style.css';
import '@hungpvq/vue-map-core/style.css';ts
import '@hungpvq/map-core/style.css';
import '@hungpvq/react-map-core/style.css';Dataset apps need the full set (map-core + map-dataset + framework adapters + *-draggable) โ see Getting started.
๐ Usage โ
Vue โ
vue
<template>
<Map :mapId="mapId" @map-loaded="onMapLoaded">
<ZoomControl position="top-right" />
<HomeControl position="top-right" />
<FullScreenControl position="top-right" />
<MouseCoordinatesControl position="bottom-right" />
<WorkerControl position="top-left" />
<MapContextMenuControl />
</Map>
<!-- Optional extras -->
<!-- <CrsControl position="bottom-right" /> -->
<!-- <EventManagementControl position="top-right" /> -->
<!-- <ActionControl position="top-right" /> -->
</template>
<script setup lang="ts">
import { ref } from 'vue';
import {
Map,
ZoomControl,
HomeControl,
FullScreenControl,
MouseCoordinatesControl,
MapContextMenuControl,
WorkerControl,
} from '@hungpvq/vue-map-core';
import '@hungpvq/vue-map-core/style.css';
const mapId = ref('map-core');
function onMapLoaded(map: any) {
console.info('Map loaded:', map);
}
</script>React โ
tsx
import {
Map,
ZoomControl,
HomeControl,
FullScreenControl,
MouseCoordinatesControl,
MapContextMenuControl,
WorkerControl,
} from '@hungpvq/react-map-core';
import '@hungpvq/react-map-core/style.css';
function App() {
return (
<Map mapId="map-core" onMapLoaded={(map) => console.info('Map loaded:', map)}>
<ZoomControl position="top-right" />
<HomeControl position="top-right" />
<FullScreenControl position="top-right" />
<MouseCoordinatesControl position="bottom-right" />
<WorkerControl position="top-left" />
<MapContextMenuControl />
</Map>
);
}Open / move / run controls from code: UniversalRegistry controls.
Register menu / UI components: UniversalRegistry components.
Stable allowlist: Stable API.
Demo (Vue / React): Vue #/registry-control ยท React #/registry-control.