nuxt-maplibre-gl 1.0.4 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +67 -21
- package/dist/module.d.mts +1 -1
- package/dist/module.json +3 -2
- package/dist/module.mjs +33 -5
- package/package.json +5 -7
package/README.md
CHANGED
|
@@ -6,21 +6,43 @@
|
|
|
6
6
|
|
|
7
7
|
## Features
|
|
8
8
|
|
|
9
|
-
- Auto-
|
|
10
|
-
- Auto-
|
|
11
|
-
- Auto-
|
|
12
|
-
- SSR-safe — components register client-only,
|
|
9
|
+
- Auto-imports all 10 map components (Maplibre, GeoJsonSource, FillLayer, etc.)
|
|
10
|
+
- Auto-imports all 38 composables (useFlyTo, useMapEventListener, etc.)
|
|
11
|
+
- Auto-imports CSS — both `maplibre-gl/dist/maplibre-gl.css` and `vue3-maplibre-gl/dist/style.css`
|
|
12
|
+
- SSR-safe — components register client-only, `maplibre-gl` is kept out of the server bundle
|
|
13
13
|
- Zero configuration required
|
|
14
14
|
|
|
15
|
+
`vue3-maplibre-gl` and `maplibre-gl` are dependencies of this module, so installing it is enough — there is nothing else to add to your app.
|
|
16
|
+
|
|
15
17
|
## Installation
|
|
16
18
|
|
|
19
|
+
### Using Bun (Recommended)
|
|
20
|
+
|
|
17
21
|
```bash
|
|
18
22
|
bun add nuxt-maplibre-gl
|
|
19
23
|
```
|
|
20
24
|
|
|
25
|
+
### Using npm
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
npm install nuxt-maplibre-gl
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### Using Yarn
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
yarn add nuxt-maplibre-gl
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### Using pnpm
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
pnpm add nuxt-maplibre-gl
|
|
41
|
+
```
|
|
42
|
+
|
|
21
43
|
## Setup
|
|
22
44
|
|
|
23
|
-
Add to `nuxt.config.ts
|
|
45
|
+
Add to `nuxt.config.ts`. The config key is `maplibre`, not the module name:
|
|
24
46
|
|
|
25
47
|
```typescript
|
|
26
48
|
export default defineNuxtConfig({
|
|
@@ -28,8 +50,8 @@ export default defineNuxtConfig({
|
|
|
28
50
|
|
|
29
51
|
// Optional configuration
|
|
30
52
|
maplibre: {
|
|
31
|
-
css: true,
|
|
32
|
-
prefix: '',
|
|
53
|
+
css: true, // auto-import CSS (default: true)
|
|
54
|
+
prefix: '', // composable prefix (default: none)
|
|
33
55
|
},
|
|
34
56
|
});
|
|
35
57
|
```
|
|
@@ -70,23 +92,47 @@ const circleStyle = ref({ 'circle-radius': 6, 'circle-color': '#007cbf' });
|
|
|
70
92
|
|
|
71
93
|
## Auto-imported Components
|
|
72
94
|
|
|
73
|
-
| Component
|
|
74
|
-
|
|
75
|
-
| `Maplibre`
|
|
76
|
-
| `GeoJsonSource`
|
|
77
|
-
| `FillLayer`
|
|
78
|
-
| `CircleLayer`
|
|
79
|
-
| `LineLayer`
|
|
80
|
-
| `SymbolLayer`
|
|
81
|
-
| `Marker`
|
|
82
|
-
| `
|
|
83
|
-
| `Image`
|
|
84
|
-
| `GeolocateControls` | Geolocation
|
|
95
|
+
| Component | Description |
|
|
96
|
+
| ------------------- | ------------------- |
|
|
97
|
+
| `Maplibre` | Main map container |
|
|
98
|
+
| `GeoJsonSource` | GeoJSON data source |
|
|
99
|
+
| `FillLayer` | Fill polygons |
|
|
100
|
+
| `CircleLayer` | Circle points |
|
|
101
|
+
| `LineLayer` | Line features |
|
|
102
|
+
| `SymbolLayer` | Icons and text |
|
|
103
|
+
| `Marker` | HTML markers |
|
|
104
|
+
| `Popup` | Popup windows |
|
|
105
|
+
| `Image` | Map images |
|
|
106
|
+
| `GeolocateControls` | Geolocation |
|
|
85
107
|
|
|
86
108
|
## Auto-imported Composables
|
|
87
109
|
|
|
88
|
-
All
|
|
89
|
-
`
|
|
110
|
+
All 38 composables from vue3-maplibre-gl are auto-imported — `useCreateMaplibre`,
|
|
111
|
+
`useMaplibre`, `useFlyTo`, `useEaseTo`, `useJumpTo`, `useMapEventListener`,
|
|
112
|
+
`useCreateGeoJsonSource` and the rest. Set `prefix` to namespace them: with
|
|
113
|
+
`prefix: 'map'` they are imported as `mapUseFlyTo`, `mapUseMapEventListener`, and
|
|
114
|
+
so on.
|
|
115
|
+
|
|
116
|
+
The full reference lives at
|
|
117
|
+
[vue-maplibre-gl.pages.dev/api/composables](https://vue-maplibre-gl.pages.dev/api/composables).
|
|
118
|
+
|
|
119
|
+
## Documentation
|
|
120
|
+
|
|
121
|
+
- [SSR / Nuxt guide](https://vue-maplibre-gl.pages.dev/guide/ssr-nuxt) — what this module configures, and how to use it without the module
|
|
122
|
+
- [Components API](https://vue-maplibre-gl.pages.dev/api/components)
|
|
123
|
+
- [Composables API](https://vue-maplibre-gl.pages.dev/api/composables)
|
|
124
|
+
- [Examples](https://vue-maplibre-gl.pages.dev/examples/)
|
|
125
|
+
|
|
126
|
+
## Releasing
|
|
127
|
+
|
|
128
|
+
This module depends on `vue3-maplibre-gl` by version range, and both are published from the same repository. Release them in this order, from the repository root:
|
|
129
|
+
|
|
130
|
+
1. `bun run publish:vue` — publishes the root package.
|
|
131
|
+
2. `bun run publish:nuxt` — refuses to run until the `vue3-maplibre-gl` range in `nuxt/package.json` resolves on npm, then refreshes `nuxt/bun.lock`, builds, and publishes.
|
|
132
|
+
|
|
133
|
+
Neither script picks a version. Set `version` in the manifest yourself before releasing, so the bump reflects what actually changed — this module tracks `vue3-maplibre-gl` by major, so a new major there is a new major here.
|
|
134
|
+
|
|
135
|
+
Commit the refreshed `nuxt/bun.lock` afterwards.
|
|
90
136
|
|
|
91
137
|
## License
|
|
92
138
|
|
package/dist/module.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as _nuxt_schema from '@nuxt/schema';
|
|
2
2
|
|
|
3
3
|
interface ModuleOptions {
|
|
4
|
-
/** Auto-import vue3-maplibre-gl
|
|
4
|
+
/** Auto-import the MapLibre GL and vue3-maplibre-gl stylesheets (default: true) */
|
|
5
5
|
css?: boolean;
|
|
6
6
|
/** Prefix for auto-imported composables (default: none) */
|
|
7
7
|
prefix?: string;
|
package/dist/module.json
CHANGED
|
@@ -2,14 +2,15 @@
|
|
|
2
2
|
"name": "nuxt-maplibre-gl",
|
|
3
3
|
"configKey": "maplibre",
|
|
4
4
|
"description": "Nuxt module for vue3-maplibre-gl with auto-import, SSR support, and full TypeScript",
|
|
5
|
+
"docs": "https://vue-maplibre-gl.pages.dev/",
|
|
5
6
|
"links": {
|
|
6
|
-
"documentation": "https://
|
|
7
|
+
"documentation": "https://vue-maplibre-gl.pages.dev/",
|
|
7
8
|
"repository": "https://github.com/danh121097/vue-maplibre-gl"
|
|
8
9
|
},
|
|
9
10
|
"compatibility": {
|
|
10
11
|
"nuxt": ">=3.0.0"
|
|
11
12
|
},
|
|
12
|
-
"version": "
|
|
13
|
+
"version": "2.0.1",
|
|
13
14
|
"builder": {
|
|
14
15
|
"@nuxt/module-builder": "1.0.2",
|
|
15
16
|
"unbuild": "3.6.1"
|
package/dist/module.mjs
CHANGED
|
@@ -5,8 +5,12 @@ const module$1 = defineNuxtModule({
|
|
|
5
5
|
name: "nuxt-maplibre-gl",
|
|
6
6
|
configKey: "maplibre",
|
|
7
7
|
description: "Nuxt module for vue3-maplibre-gl with auto-import, SSR support, and full TypeScript",
|
|
8
|
+
// `docs` is what nuxt.com/modules reads out of the published
|
|
9
|
+
// dist/module.json to link the listing at the documentation site; without
|
|
10
|
+
// it the listing falls back to the GitHub repository.
|
|
11
|
+
docs: "https://vue-maplibre-gl.pages.dev/",
|
|
8
12
|
links: {
|
|
9
|
-
documentation: "https://
|
|
13
|
+
documentation: "https://vue-maplibre-gl.pages.dev/",
|
|
10
14
|
repository: "https://github.com/danh121097/vue-maplibre-gl"
|
|
11
15
|
},
|
|
12
16
|
compatibility: {
|
|
@@ -17,10 +21,13 @@ const module$1 = defineNuxtModule({
|
|
|
17
21
|
css: true,
|
|
18
22
|
prefix: ""
|
|
19
23
|
},
|
|
20
|
-
setup(options, nuxt) {
|
|
21
|
-
const { resolve } = createResolver(import.meta.url);
|
|
24
|
+
async setup(options, nuxt) {
|
|
25
|
+
const { resolve, resolvePath } = createResolver(import.meta.url);
|
|
22
26
|
if (options.css) {
|
|
23
|
-
nuxt.options.css.push(
|
|
27
|
+
nuxt.options.css.push(
|
|
28
|
+
await resolvePath("maplibre-gl/dist/maplibre-gl.css"),
|
|
29
|
+
await resolvePath("vue3-maplibre-gl/dist/style.css")
|
|
30
|
+
);
|
|
24
31
|
}
|
|
25
32
|
nuxt.options.build.transpile.push("vue3-maplibre-gl");
|
|
26
33
|
nuxt.options.vite.optimizeDeps ??= {};
|
|
@@ -33,21 +40,37 @@ const module$1 = defineNuxtModule({
|
|
|
33
40
|
mode: "client"
|
|
34
41
|
});
|
|
35
42
|
const composables = [
|
|
43
|
+
// Map instance
|
|
36
44
|
"useCreateMaplibre",
|
|
37
45
|
"useMaplibre",
|
|
46
|
+
"useMaplibreConfig",
|
|
47
|
+
// Layers
|
|
48
|
+
"useCreateLayer",
|
|
38
49
|
"useCreateFillLayer",
|
|
39
50
|
"useCreateCircleLayer",
|
|
40
51
|
"useCreateLineLayer",
|
|
41
52
|
"useCreateSymbolLayer",
|
|
53
|
+
"useLayer",
|
|
54
|
+
// Sources
|
|
42
55
|
"useCreateGeoJsonSource",
|
|
43
56
|
"useGeoJsonSource",
|
|
57
|
+
// Map objects
|
|
58
|
+
"useCreateMarker",
|
|
59
|
+
"useCreatePopup",
|
|
60
|
+
"useCreateImage",
|
|
61
|
+
// Controls
|
|
62
|
+
"useGeolocateControl",
|
|
63
|
+
// Events
|
|
44
64
|
"useMapEventListener",
|
|
45
65
|
"useLayerEventListener",
|
|
46
66
|
"useGeolocateEventListener",
|
|
67
|
+
"useMapReloadEvent",
|
|
68
|
+
// Camera
|
|
47
69
|
"useFlyTo",
|
|
48
70
|
"useEaseTo",
|
|
49
71
|
"useJumpTo",
|
|
50
72
|
"useFitBounds",
|
|
73
|
+
"useFitScreenCoordinates",
|
|
51
74
|
"useCameraForBounds",
|
|
52
75
|
"useZoomTo",
|
|
53
76
|
"useZoomIn",
|
|
@@ -57,7 +80,12 @@ const module$1 = defineNuxtModule({
|
|
|
57
80
|
"useRotateTo",
|
|
58
81
|
"useResetNorth",
|
|
59
82
|
"useResetNorthPitch",
|
|
60
|
-
"useSnapToNorth"
|
|
83
|
+
"useSnapToNorth",
|
|
84
|
+
// Utilities
|
|
85
|
+
"useDebounce",
|
|
86
|
+
"useDebouncedRef",
|
|
87
|
+
"useDebouncedWatch",
|
|
88
|
+
"useLogger"
|
|
61
89
|
];
|
|
62
90
|
addImports(
|
|
63
91
|
composables.map((name) => ({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nuxt-maplibre-gl",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.1",
|
|
4
4
|
"description": "Nuxt module for vue3-maplibre-gl — auto-import components, composables, CSS, and SSR configuration",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"name": "Danh Nguyen",
|
|
9
9
|
"url": "https://harrynguyen.work"
|
|
10
10
|
},
|
|
11
|
-
"homepage": "https://
|
|
11
|
+
"homepage": "https://vue-maplibre-gl.pages.dev/",
|
|
12
12
|
"bugs": {
|
|
13
13
|
"url": "https://github.com/danh121097/vue-maplibre-gl/issues"
|
|
14
14
|
},
|
|
@@ -46,14 +46,12 @@
|
|
|
46
46
|
"dev:prepare": "nuxt-module-build build --stub && nuxi prepare playground",
|
|
47
47
|
"dev": "nuxi dev playground",
|
|
48
48
|
"build": "nuxt-module-build build",
|
|
49
|
-
"prepack": "nuxt-module-build build"
|
|
50
|
-
"test": "vitest run",
|
|
51
|
-
"publish:manual": "npm publish --provenance --access public",
|
|
52
|
-
"publish:manual:otp": "npm publish --provenance --access public --otp=$NPM_OTP"
|
|
49
|
+
"prepack": "nuxt-module-build build"
|
|
53
50
|
},
|
|
54
51
|
"dependencies": {
|
|
55
52
|
"@nuxt/kit": "^3.15.0",
|
|
56
|
-
"
|
|
53
|
+
"maplibre-gl": "^5.6.1",
|
|
54
|
+
"vue3-maplibre-gl": "^6.0.0"
|
|
57
55
|
},
|
|
58
56
|
"devDependencies": {
|
|
59
57
|
"@nuxt/module-builder": "^1.0.2",
|