npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@icgcat/layer-tree

v0.0.40

Published

A Svelte Layer Tree component to manage visually multiple layers

Readme

License Version LinkedIn

@icgcat/layer-tree

This component is an implementation of an interactive WMS layer management system using toggles to activate and deactivate layers and sublayers. It is useful for applications that need to manage layer hierarchies, such as map viewers.

Features

  • Support for nested layers: Each main layer can have sublayers that can also be managed with toggles.
  • Highly customizable: Supports configurations for colors, fieldset border radius, and colors for parent and child layer toggles.
  • Interaction with store: Uses a Svelte store to maintain the visibility state of sublayers.
  • Callbacks: Allows a custom onSelect function to manage logic when layers are toggled.

Configurable Properties

This component supports the following configurable properties:

| Property | Description | Default Value | |-------------------------|--------------------------------------------------------------------------|-------------------| | checked | Initial state of the toggle (true/false). | false | | onSelect | Function executed when a toggle changes state. | null | | dataType | Type of data managed (currently only WMS). | "WMS" | | dataFileArray | Array of objects with information about layers and sublayers. | [] | | fontColor | Font color of the labels. | "black" | | fieldsetBorderColor | Border color of the fieldset. | "" | | fieldsetBorderRadius | Corner radius of the fieldset. | "5px" | | parentToggleColor | Color of the toggle for main layers. | "green" | | childrenToggleColor | Color of the toggle for sublayers. | "red" |

Usage Example

<script>
  import { LayerTree } from "@icgcat/layer-tree";

  const dataFileArray = [
    {
      title: "Main Layer",
      layers: [
        {
          title: "Sublayer 1",
          state: true,
          layers: [
            { title: "Sublayer 1.1", state: false },
            { title: "Sublayer 1.2", state: true }
          ]
        },
        {
          title: "Sublayer 2",
          state: false
        }
      ]
    }
  ];

  function handleSelect(state, layer) {
    console.log("Toggle changed:", state, layer);
  }
</script>

<LayerTree
  dataFileArray={dataFileArray}
  fontColor="blue"
  fieldsetBorderColor="gray"
  fieldsetBorderRadius="10px"
  parentToggleColor="green"
  childrenToggleColor="orange"
  onSelect={handleSelect}
/>

Dependencies

This component uses:

  • Svelte: Main framework.
  • @icgcat/ui: Component library for the toggle.
  • Svelte Store: To manage the global visibility state of sublayers.

Customization

Styling

The component supports styling via properties like fontColor, fieldsetBorderColor, and fieldsetBorderRadius. You can also change the colors of toggles for main and sublayers via parentToggleColor and childrenToggleColor.

Interactivity

The onSelect function can be used to execute custom code when toggles change state, providing flexibility to integrate this component into more complex applications.

Developed by:

License

This project is licensed under the MIT License.