Skip to content

Commit 7f250c1

Browse files
author
danhnguyen
committed
🔧 chore: migrate from Mapbox to Maplibre, updating enums, components, and composables
1 parent 3f7029f commit 7f250c1

30 files changed

Lines changed: 586 additions & 576 deletions

README.md

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Vue3 MapLibre GL
22

3-
[![npm](https://img.shields.io/npm/v/vue3-maplibre-gl)](https://www.npmjs.com/package/vue3-maplibre-gl) [![Downloads](https://img.shields.io/npm/dt/vue3-maplibre-gl)](https://www.npmjs.com/package/vue3-maplibre-gl) [![Stars](https://img.shields.io/github/stars/danh121097/vue-mapbox-gl?style=flat-square)](https://github.com/danh121097/vue-mapbox-gl/stargazers) [![License](https://img.shields.io/npm/l/vue3-maplibre-gl)](https://github.com/danh121097/vue-mapbox-gl/blob/main/LICENSE)
3+
[![npm](https://img.shields.io/npm/v/vue3-maplibre-gl)](https://www.npmjs.com/package/vue3-maplibre-gl) [![Downloads](https://img.shields.io/npm/dt/vue3-maplibre-gl)](https://www.npmjs.com/package/vue3-maplibre-gl) [![Stars](https://img.shields.io/github/stars/danh121097/vue-maplibre-gl?style=flat-square)](https://github.com/danh121097/vue-maplibre-gl/stargazers) [![License](https://img.shields.io/npm/l/vue3-maplibre-gl)](https://github.com/danh121097/vue-maplibre-gl/blob/main/LICENSE)
44

55
> **The most comprehensive Vue 3 library for MapLibre GL JS** - Build interactive maps with 10+ components and 15+ composables
66
@@ -9,7 +9,7 @@ A powerful, feature-rich Vue 3 component library that provides an intuitive, rea
99
## ✨ Features
1010

1111
- 🗺️ **Interactive Maps** - High-performance vector maps with WebGL rendering
12-
- 🧩 **10+ Vue Components** - Mapbox, GeoJsonSource, FillLayer, CircleLayer, LineLayer, SymbolLayer, Marker, PopUp, Image, GeolocateControls
12+
- 🧩 **10+ Vue Components** - Maplibre, GeoJsonSource, FillLayer, CircleLayer, LineLayer, SymbolLayer, Marker, PopUp, Image, GeolocateControls
1313
- 🔧 **15+ Composables** - Complete map management, animations, events, and utilities
1414
- 🎯 **Full TypeScript Support** - Comprehensive type definitions and interfaces
1515
-**High Performance** - Optimized rendering with automatic resource cleanup
@@ -41,7 +41,7 @@ pnpm add vue3-maplibre-gl
4141

4242
```vue
4343
<template>
44-
<Mapbox :options="mapOptions" style="height: 500px" @load="onMapLoad">
44+
<Maplibre :options="mapOptions" style="height: 500px" @load="onMapLoad">
4545
<!-- GeoJSON Data Source -->
4646
<GeoJsonSource :data="geoJsonData">
4747
<FillLayer :style="fillStyle" />
@@ -63,13 +63,13 @@ pnpm add vue3-maplibre-gl
6363
6464
<!-- Geolocation Control -->
6565
<GeolocateControls position="top-right" />
66-
</Mapbox>
66+
</Maplibre>
6767
</template>
6868
6969
<script setup>
7070
import { ref } from 'vue';
7171
import {
72-
Mapbox,
72+
Maplibre,
7373
GeoJsonSource,
7474
FillLayer,
7575
CircleLayer,
@@ -130,7 +130,7 @@ Vue3 MapLibre GL provides 10+ reactive Vue components:
130130

131131
| Component | Description |
132132
| --------------------- | ------------------------------------------------------------- |
133-
| **Mapbox** | Main map container with comprehensive event handling |
133+
| **Maplibre** | Main map container with comprehensive event handling |
134134
| **GeoJsonSource** | Reactive data source for GeoJSON data with clustering support |
135135
| **FillLayer** | Render filled polygons with customizable styling |
136136
| **CircleLayer** | Display point data as circles with dynamic sizing |
@@ -147,8 +147,8 @@ Vue3 MapLibre GL provides 10+ reactive Vue components:
147147

148148
### Map Management
149149

150-
- `useCreateMapbox` - Enhanced map creation with error handling
151-
- `useMapbox` - Simplified map state management
150+
- `useCreateMaplibre` - Enhanced map creation with error handling
151+
- `useMaplibre` - Simplified map state management
152152

153153
### Layer Management
154154

@@ -187,15 +187,15 @@ Vue3 MapLibre GL includes comprehensive TypeScript support:
187187
```typescript
188188
import { ref } from 'vue';
189189
import {
190-
Mapbox,
190+
Maplibre,
191191
GeoJsonSource,
192192
FillLayer,
193-
type MapboxProps,
193+
type MaplibreProps,
194194
type FillLayerStyle,
195195
type GeoJSONSourceSpecification,
196196
} from 'vue3-maplibre-gl';
197197

198-
const mapOptions = ref<MapboxProps['options']>({
198+
const mapOptions = ref<MaplibreProps['options']>({
199199
style: 'https://demotiles.maplibre.org/style.json',
200200
center: [0, 0],
201201
zoom: 2,
@@ -218,7 +218,7 @@ const geoJsonData = ref<GeoJSONSourceSpecification['data']>({
218218
<script setup>
219219
import { ref } from 'vue';
220220
import {
221-
useCreateMapbox,
221+
useCreateMaplibre,
222222
useFlyTo,
223223
useMapEventListener,
224224
useCreateGeoJsonSource,
@@ -228,7 +228,7 @@ const mapContainer = ref();
228228
const mapStyle = ref('https://demotiles.maplibre.org/style.json');
229229
230230
// Create map with enhanced error handling
231-
const { mapInstance, setCenter, setZoom } = useCreateMapbox(
231+
const { mapInstance, setCenter, setZoom } = useCreateMaplibre(
232232
mapContainer,
233233
mapStyle,
234234
{
@@ -265,20 +265,20 @@ useMapEventListener({
265265

266266
## 📚 Documentation
267267

268-
- **[Getting Started](https://danh121097.github.io/vue-mapbox-gl/guide/getting-started)** - Learn the basics and see examples
269-
- **[Installation Guide](https://danh121097.github.io/vue-mapbox-gl/guide/installation)** - Detailed setup instructions
270-
- **[Configuration](https://danh121097.github.io/vue-mapbox-gl/guide/configuration)** - Advanced configuration options
271-
- **[Components API](https://danh121097.github.io/vue-mapbox-gl/api/components)** - Complete component documentation
272-
- **[Composables API](https://danh121097.github.io/vue-mapbox-gl/api/composables)** - Composables reference
273-
- **[TypeScript Types](https://danh121097.github.io/vue-mapbox-gl/api/types)** - Type definitions
274-
- **[Live Examples](https://danh121097.github.io/vue-mapbox-gl/examples/)** - Interactive demos
268+
- **[Getting Started](https://danh121097.github.io/vue-maplibre-gl/guide/getting-started)** - Learn the basics and see examples
269+
- **[Installation Guide](https://danh121097.github.io/vue-maplibre-gl/guide/installation)** - Detailed setup instructions
270+
- **[Configuration](https://danh121097.github.io/vue-maplibre-gl/guide/configuration)** - Advanced configuration options
271+
- **[Components API](https://danh121097.github.io/vue-maplibre-gl/api/components)** - Complete component documentation
272+
- **[Composables API](https://danh121097.github.io/vue-maplibre-gl/api/composables)** - Composables reference
273+
- **[TypeScript Types](https://danh121097.github.io/vue-maplibre-gl/api/types)** - Type definitions
274+
- **[Live Examples](https://danh121097.github.io/vue-maplibre-gl/examples/)** - Interactive demos
275275

276276
## 🛠️ Development
277277

278278
```bash
279279
# Clone the repository
280-
git clone https://github.com/danh121097/vue-mapbox-gl.git
281-
cd vue-mapbox-gl
280+
git clone https://github.com/danh121097/vue-maplibre-gl.git
281+
cd vue-maplibre-gl
282282

283283
# Install dependencies
284284
yarn install
@@ -312,8 +312,8 @@ Contributions are welcome! Please feel free to submit a Pull Request. For major
312312

313313
```bash
314314
# Clone the repository
315-
git clone https://github.com/danh121097/vue-mapbox-gl.git
316-
cd vue-mapbox-gl
315+
git clone https://github.com/danh121097/vue-maplibre-gl.git
316+
cd vue-maplibre-gl
317317

318318
# Install dependencies
319319
yarn install
@@ -343,10 +343,10 @@ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file
343343

344344
## 📞 Support
345345

346-
- 📖 [Documentation](https://danh121097.github.io/vue-mapbox-gl/) - Comprehensive guides and API reference
347-
- 🐛 [Issues](https://github.com/danh121097/vue-mapbox-gl/issues) - Bug reports and feature requests
348-
- 💬 [Discussions](https://github.com/danh121097/vue-mapbox-gl/discussions) - Community discussions and questions
349-
-[GitHub](https://github.com/danh121097/vue-mapbox-gl) - Star the project if you find it useful!
346+
- 📖 [Documentation](https://danh121097.github.io/vue-maplibre-gl/) - Comprehensive guides and API reference
347+
- 🐛 [Issues](https://github.com/danh121097/vue-maplibre-gl/issues) - Bug reports and feature requests
348+
- 💬 [Discussions](https://github.com/danh121097/vue-maplibre-gl/discussions) - Community discussions and questions
349+
-[GitHub](https://github.com/danh121097/vue-maplibre-gl) - Star the project if you find it useful!
350350

351351
---
352352

docs/.vitepress/config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ export default defineConfig({
7373
},
7474

7575
socialLinks: [
76-
{ icon: 'github', link: 'https://github.com/danh121097/vue-mapbox-gl' },
76+
{ icon: 'github', link: 'https://github.com/danh121097/vue-maplibre-gl' },
7777
{
7878
icon: 'npm',
7979
link: 'https://www.npmjs.com/package/vue3-maplibre-gl',

docs/api/components.md

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Vue3 MapLibre GL provides a comprehensive set of Vue 3 components for building interactive maps with MapLibre GL JS. All components are designed with TypeScript support, reactive data binding, and comprehensive error handling.
44

5-
## Mapbox
5+
## Maplibre
66

77
The main map component that renders the MapLibre GL JS map. This is the core component that provides the map container and manages the MapLibre GL instance.
88

@@ -64,7 +64,7 @@ The main map component that renders the MapLibre GL JS map. This is the core com
6464

6565
```vue
6666
<template>
67-
<Mapbox
67+
<Maplibre
6868
:options="mapOptions"
6969
:debug="true"
7070
@load="onMapLoad"
@@ -83,12 +83,12 @@ The main map component that renders the MapLibre GL JS map. This is the core com
8383
<GeoJsonSource :data="geoJsonData">
8484
<FillLayer :style="fillStyle" />
8585
</GeoJsonSource>
86-
</Mapbox>
86+
</Maplibre>
8787
</template>
8888
8989
<script setup>
9090
import { ref } from 'vue';
91-
import { Mapbox, GeoJsonSource, FillLayer } from 'vue3-maplibre-gl';
91+
import { Maplibre, GeoJsonSource, FillLayer } from 'vue3-maplibre-gl';
9292
9393
const mapOptions = ref({
9494
style: 'https://demotiles.maplibre.org/style.json',
@@ -147,7 +147,7 @@ A component for adding GeoJSON data sources to the map. This component provides
147147

148148
```vue
149149
<template>
150-
<Mapbox :options="mapOptions">
150+
<Maplibre :options="mapOptions">
151151
<GeoJsonSource
152152
id="my-source"
153153
:data="geoJsonData"
@@ -157,12 +157,12 @@ A component for adding GeoJSON data sources to the map. This component provides
157157
>
158158
<CircleLayer :style="circleStyle" />
159159
</GeoJsonSource>
160-
</Mapbox>
160+
</Maplibre>
161161
</template>
162162
163163
<script setup>
164164
import { ref } from 'vue';
165-
import { Mapbox, GeoJsonSource, CircleLayer } from 'vue3-maplibre-gl';
165+
import { Maplibre, GeoJsonSource, CircleLayer } from 'vue3-maplibre-gl';
166166
167167
const geoJsonData = ref({
168168
type: 'FeatureCollection',
@@ -229,7 +229,7 @@ A component for rendering filled polygons from a data source. Supports all MapLi
229229

230230
```vue
231231
<template>
232-
<Mapbox :options="mapOptions">
232+
<Maplibre :options="mapOptions">
233233
<GeoJsonSource :data="polygonData">
234234
<FillLayer
235235
id="polygon-fill"
@@ -238,12 +238,12 @@ A component for rendering filled polygons from a data source. Supports all MapLi
238238
@click="onPolygonClick"
239239
/>
240240
</GeoJsonSource>
241-
</Mapbox>
241+
</Maplibre>
242242
</template>
243243
244244
<script setup>
245245
import { ref } from 'vue';
246-
import { Mapbox, GeoJsonSource, FillLayer } from 'vue3-maplibre-gl';
246+
import { Maplibre, GeoJsonSource, FillLayer } from 'vue3-maplibre-gl';
247247
248248
const fillStyle = ref({
249249
'fill-color': [
@@ -288,16 +288,16 @@ Same events as FillLayer (click, mousemove, etc.)
288288

289289
```vue
290290
<template>
291-
<Mapbox :options="mapOptions">
291+
<Maplibre :options="mapOptions">
292292
<GeoJsonSource :data="pointData">
293293
<CircleLayer id="points" :style="circleStyle" @click="onPointClick" />
294294
</GeoJsonSource>
295-
</Mapbox>
295+
</Maplibre>
296296
</template>
297297
298298
<script setup>
299299
import { ref } from 'vue';
300-
import { Mapbox, GeoJsonSource, CircleLayer } from 'vue3-maplibre-gl';
300+
import { Maplibre, GeoJsonSource, CircleLayer } from 'vue3-maplibre-gl';
301301
302302
const circleStyle = ref({
303303
'circle-radius': ['interpolate', ['linear'], ['zoom'], 5, 2, 15, 10],
@@ -349,16 +349,16 @@ Same events as FillLayer (click, mousemove, etc.)
349349

350350
```vue
351351
<template>
352-
<Mapbox :options="mapOptions">
352+
<Maplibre :options="mapOptions">
353353
<GeoJsonSource :data="lineData">
354354
<LineLayer id="routes" :style="lineStyle" @click="onLineClick" />
355355
</GeoJsonSource>
356-
</Mapbox>
356+
</Maplibre>
357357
</template>
358358
359359
<script setup>
360360
import { ref } from 'vue';
361-
import { Mapbox, GeoJsonSource, LineLayer } from 'vue3-maplibre-gl';
361+
import { Maplibre, GeoJsonSource, LineLayer } from 'vue3-maplibre-gl';
362362
363363
const lineStyle = ref({
364364
'line-color': '#007cbf',
@@ -399,16 +399,16 @@ Same events as FillLayer (click, mousemove, etc.)
399399

400400
```vue
401401
<template>
402-
<Mapbox :options="mapOptions">
402+
<Maplibre :options="mapOptions">
403403
<GeoJsonSource :data="pointData">
404404
<SymbolLayer id="labels" :style="symbolStyle" @click="onSymbolClick" />
405405
</GeoJsonSource>
406-
</Mapbox>
406+
</Maplibre>
407407
</template>
408408
409409
<script setup>
410410
import { ref } from 'vue';
411-
import { Mapbox, GeoJsonSource, SymbolLayer } from 'vue3-maplibre-gl';
411+
import { Maplibre, GeoJsonSource, SymbolLayer } from 'vue3-maplibre-gl';
412412
413413
const symbolStyle = ref({
414414
'text-field': ['get', 'name'],
@@ -462,20 +462,20 @@ A component for adding HTML markers to the map. Supports custom HTML content, dr
462462

463463
```vue
464464
<template>
465-
<Mapbox :options="mapOptions">
465+
<Maplibre :options="mapOptions">
466466
<Marker
467467
:lng-lat="markerPosition"
468468
:draggable="true"
469469
@dragend="onMarkerDragEnd"
470470
>
471471
<div class="custom-marker">📍</div>
472472
</Marker>
473-
</Mapbox>
473+
</Maplibre>
474474
</template>
475475
476476
<script setup>
477477
import { ref } from 'vue';
478-
import { Mapbox, Marker } from 'vue3-maplibre-gl';
478+
import { Maplibre, Marker } from 'vue3-maplibre-gl';
479479
480480
const markerPosition = ref([0, 0]);
481481
@@ -524,19 +524,19 @@ A component for displaying popup windows on the map. Supports custom HTML conten
524524

525525
```vue
526526
<template>
527-
<Mapbox :options="mapOptions">
527+
<Maplibre :options="mapOptions">
528528
<PopUp :lng-lat="popupPosition" :close-button="true" @close="onPopupClose">
529529
<div class="popup-content">
530530
<h3>Hello World!</h3>
531531
<p>This is a popup at {{ popupPosition }}.</p>
532532
</div>
533533
</PopUp>
534-
</Mapbox>
534+
</Maplibre>
535535
</template>
536536
537537
<script setup>
538538
import { ref } from 'vue';
539-
import { Mapbox, PopUp } from 'vue3-maplibre-gl';
539+
import { Maplibre, PopUp } from 'vue3-maplibre-gl';
540540
541541
const popupPosition = ref([0, 0]);
542542
@@ -578,17 +578,17 @@ A component for managing and loading images for use in MapLibre GL styles. Suppo
578578

579579
```vue
580580
<template>
581-
<Mapbox :options="mapOptions">
581+
<Maplibre :options="mapOptions">
582582
<Image :images="mapImages" :show-loading="true" />
583583
<GeoJsonSource :data="pointData">
584584
<SymbolLayer :style="symbolStyle" />
585585
</GeoJsonSource>
586-
</Mapbox>
586+
</Maplibre>
587587
</template>
588588
589589
<script setup>
590590
import { ref } from 'vue';
591-
import { Mapbox, Image, GeoJsonSource, SymbolLayer } from 'vue3-maplibre-gl';
591+
import { Maplibre, Image, GeoJsonSource, SymbolLayer } from 'vue3-maplibre-gl';
592592
593593
const mapImages = ref([
594594
{
@@ -638,19 +638,19 @@ A component for adding geolocation controls to the map. Provides user location t
638638

639639
```vue
640640
<template>
641-
<Mapbox :options="mapOptions">
641+
<Maplibre :options="mapOptions">
642642
<GeolocateControls
643643
position="top-right"
644644
:options="geolocateOptions"
645645
@geolocate="onGeolocate"
646646
@error="onGeolocateError"
647647
/>
648-
</Mapbox>
648+
</Maplibre>
649649
</template>
650650
651651
<script setup>
652652
import { ref } from 'vue';
653-
import { Mapbox, GeolocateControls } from 'vue3-maplibre-gl';
653+
import { Maplibre, GeolocateControls } from 'vue3-maplibre-gl';
654654
655655
const geolocateOptions = ref({
656656
positionOptions: {

0 commit comments

Comments
 (0)