JSPM

  • Created
  • Published
  • Downloads 7
  • Score
    100M100P100Q52959F
  • License MIT

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

Package Exports

    This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@watergis/svelte-maplibre-menu) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

    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.