JSPM

  • Created
  • Published
  • Downloads 96
  • Score
    100M100P100Q62308F
  • License MIT

This is a svelte component to add menu control plugin to maplibre.

Package Exports

  • @watergis/svelte-maplibre-menu

Readme

svelte-maplibre-menu

GitHub npm npm npm bundle size (scoped)

This is a svelte component to make menu for maplibre-gl

Install

npm i @watergis/svelte-maplibre-menu

or

yarn add @watergis/svelte-maplibre-menu

Usage

See Example.

<script>
import { MenuControl } from '@watergis/svelte-maplibre-menu';
const map = new Map
</script>

<MenuControl bind:map={$map} position={'top-left'}>
  <div slot="primary">content</div>
  <div slot="secondary">
    <div class="map" id="map" bind:this={mapContainer} />
  </div>
</MenuControl>

<style>

.map {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}
</style>

create-svelte

Everything you need to build a Svelte project, powered by create-svelte.

Creating a project

If you're seeing this, you've probably already done this step. Congrats!

# create a new project in the current directory
npm create svelte@latest

# create a new project in my-app
npm create svelte@latest my-app

Developing

Once you've created a project and installed dependencies with npm install (or pnpm install or yarn), start a development server:

npm run dev

# or start the server and open the app in a new browser tab
npm run dev -- --open

Building

To create a production version of your app:

npm run build

You can preview the production build with npm run preview.

To deploy your app, you may need to install an adapter for your target environment.