From c58c4228ccb9bccfac2845384c937a5aed9db706 Mon Sep 17 00:00:00 2001 From: Gugustinette Date: Mon, 29 Jul 2024 21:47:12 +0200 Subject: [PATCH] Rename composable with Mgl prefix to fit standards --- docs/.vitepress/config.ts | 6 ++++++ docs/composables/introduction.md | 13 +++++++++++++ playground/pages/map/map-basic.client.vue | 2 +- src/module.ts | 2 +- 4 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 docs/composables/introduction.md diff --git a/docs/.vitepress/config.ts b/docs/.vitepress/config.ts index 23ff71d..92c6082 100644 --- a/docs/.vitepress/config.ts +++ b/docs/.vitepress/config.ts @@ -28,6 +28,12 @@ export default defineConfig({ { text: 'Introduction', link: '/components/introduction' }, ] }, + { + text: 'Composables', + items: [ + { text: 'Introduction', link: '/composables/introduction' }, + ] + }, { text: 'About', items: [ diff --git a/docs/composables/introduction.md b/docs/composables/introduction.md new file mode 100644 index 0000000..2112840 --- /dev/null +++ b/docs/composables/introduction.md @@ -0,0 +1,13 @@ +--- +outline: deep +--- + +::: info +For further documentation, you can refer to the [vue-maplibre-gl documentation](https://indoorequal.github.io/vue-maplibre-gl/examples/use-map.html) that already include guides, API references, and examples. + +If you find any errors related the Nuxt module (a composable not available for example), please open an issue on the [GitHub repository](https://github.com/gugustinette/nuxt-maplibre). +::: + +::: tip +Note that composables are exported with the `Mgl` prefix added to the name of the composable. For example, the `useMap` composable is exported as `useMglMap`. +::: diff --git a/playground/pages/map/map-basic.client.vue b/playground/pages/map/map-basic.client.vue index ce1b27c..036c3a2 100644 --- a/playground/pages/map/map-basic.client.vue +++ b/playground/pages/map/map-basic.client.vue @@ -13,7 +13,7 @@ const style = 'https://api.maptiler.com/maps/streets/style.json?key=cQX2iET1gmOW const center = [-1.559482, 47.21322]; const zoom = 8; -const map = useMap(); +const map = useMglMap(); console.log(map.isLoaded) console.log(map.isMounted) console.log(map.instance) diff --git a/src/module.ts b/src/module.ts index 167b47c..1928143 100644 --- a/src/module.ts +++ b/src/module.ts @@ -73,7 +73,7 @@ export default defineNuxtModule({ for (const composable of composables) { addImports({ name: composable, - as: composable, + as: 'useMgl' + composable.slice(3), from: '@indoorequal/vue-maplibre-gl' }) }