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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@financial-times/o-layers

v2.1.6

Published

Namespace for managing modules that make use of the z-axis

Downloads

63

Readme

o-layers MIT licensed

Deprecated: This component was not widely used and therefore did not meet its aim of managing the z-index between components and projects. There is no direct replacement for o-layers. Instead fire component specific events to indicate that a new "layer" such as an overlay has been opened.

This module provides a namespace for managing modules that make use of the z-axis, providing events, css classes and coding conventions that modules must use to interact with other modules that use the z-axis

Usage

Check out how to include Origami components in your project to get started with o-layers.

Terminology and concepts

Layer

A Layer refers to the owned DOM, or portion of owned DOM, of any module that makes use of the z-axis.

Layer context

A Layer context refers to a HTML element where every layer lying within it should only be concerned with other layers if they also lie within it. e.g. Within an interactive graphic any popups only need concern themselves with the state of other popups which also overlay the same graphic; they can safely disregard popups overlaying a different graphic.

document.body is the default layer context.

### o-layers__context class

This class should be added to any element (other than document.body) which needs to behave as a layer context. All layers must either

  • be a descendant of an element with the class o-layers__context and should not overlap any part of the page not contained within this element
  • not be a descendant of any element with the class o-layers__context (in which case document.body provides the default layer context)

In general a new layer context should only be defined if you are very sure any layers it contains will never interfere (either through directly overlapping or by leaving a distracting, no longer needed UI element) with anything outside of it.

CSS

All layer contexts (with the exception of document.body) should have the following css properties defined (o-layers does not provide sass for this as there is considerable variation in acceptable values)

  • position - must not be static
  • z-index - must be 0 or higher (this mitigates problems with z-index of layers in nested layer contexts)

Javascript helper

oLayers#getLayerContext(el) will return the given element's layer context.

Events

The following custom events must be fired on a layer's closest ancestor with the class o-layers__context (or on document.body if no such element exists). The Event.details property must define all the properties from the list below that are truthy for the given layer

  • el - Reference to the layer's DOM node

oLayers.new

This should be fired immediately before any layer is added to the DOM/displayed.

oLayers.close

This should be fired immediately after any layer is removed from the DOM/hidden.

Coding conventions

Any module which controls one or more layers must implement the following patterns:

  • Listen for the event oLayers.new on the layer context of each of its layers and react to these events by either:
    1. closing the layer
    2. inspecting the new layer's owned DOM to determine what action should be taken.

Licence

Copyright (c) 2016 Financial Times Ltd. All rights reserved.

This software is published under the MIT licence.