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

dock-n-liquid

v0.5.3

Published

Liquid alignment for border-box element

Downloads

22

Readme

DOCK'n'LIQUID - npm dock-n-liquid

This module helps the liquid designing. It aligns the child elements to dock to its parent recursively.

APIs

CLASS

  • dock_n_liquid - enables a simple liquid layout. The instance references a single html element which is the root of docking structure. The static method 'select' creates and returns an instance of this class.

STATIC METHOD

  • dock_n_liquid.init() - initializes all dock classed elements as a dock_n_liquid panel. Those will be aligned the layouts in automatic.
  • dock_n_liquid.select(element) - selects a html element and returns dock_n_liquid instance.
  • dock_n_liquid.requestFullscreen(element) - requests to be a fullscreen mode.
  • dock_n_liquid.exitFullscreen() - exits from the fullscreen mode.
  • dock_n_liquid.detach() - detaches the element from its layout tree.
  • dock_n_liquid.attach() - re-attaches the element to its layout tree.

INSTANCE METHOD

  • dock_n_liquid.show(state) - shows or hides the panel.

AVAILABLE CLASS NAME for HTML ELEMENT

  • dock - declares the element is the panel.
  • top - declares the element docks to the top of the parent element. the height style or attribute must be specified.
  • left - docks to the left. width must be specified.
  • right - to the right. width must be specified.
  • bottom - to the bottom. height required.
  • resizable - The panel could be resized by dragging a handle generated on its edge. After the completion of resizing, a window.resize event will be dispatched.

EXAMPLE

Sorry, too long code....

<html>
    <head>
        <style>
        .dock {
            border-style: solid;
            border-top-color: #eee;
            border-left-color: #eee;
            border-right-color: #444;
            border-bottom-color: #444;
            border-top-width: 1px;
            border-left-width: 1px;
            border-right-width: 1px;
            border-bottom-width: 1px;
            margin:0; padding:0;
            overflow-x:hidden;
            overflow-y:auto;
            color:#ccc;
        }
        .dock.top { background-color: #226; }
        .dock.bottom { background-color: #442; }
        .dock.left { background-color: #244; }
        .dock.right { background-color: #888; }
        .dock.resizer {
            border-width: 0px;
            background-color: #ccc;
        }
        .dock.horizontal.resizer {
            cursor: ew-resize;
        }
        .dock.vertical.resizer {
            cursor: ns-resize;
        }
        .dock.resizer.resizing {
            background-color: #f00;
        }
        </style>
    </head>
    <body onload="main();">
    <div class="dock">
        <div class="dock top resizable" style="height: 60px;">
            <h1>Docking to the top</h1>
        </div>
        <div class="dock left resizable" style="width:120px;">
            <div class="dock top" style="height:20px;">menu#1</div>
            <div class="dock top" style="height:20px;">menu#2</div>
            <div class="dock top" style="height:20px;">menu#3</div>
            <div class="dock top" style="height:20px;">menu#4</div>
            <div class="dock top" style="height:20px;">menu#5</div>
        </div>
        <div id="panelRight" class="dock right resizable"
            style="width:120px;overflow-y:auto">
            <div class="dock top" style="height:20px;">content#1</div>
            <div class="dock top" style="height:20px;">content#2</div>
            <div class="dock top" style="height:20px;">content#3</div>
            <div class="dock top" style="height:20px;">content#4</div>
            <div class="dock top" style="height:20px;">content#5</div>
        </div>
        <div id="fullscrn-panel" class="dock">
            The Content that occupies the rest of client area.
            <button type="button" onclick="hidePanelRight();">hide panel right</button>
            <button type="button" onclick="showPanelRight();">show panel right</button>
        </div>
        <div class="dock bottom resizable" style="height:40px;">
            MIT LICENSE
        </div>
    </div>
    <script src="../dock-n-liquid.js"></script>
    <script src="../node_modules/fullscrn/fullscrn.js"></script>
    <script>
    function main() {
        (function(d) {
            if(d.fullscreenEnabled) {
                var fullscrnPanel = d.getElementById("fullscrn-panel");
                var btnFullscrn = d.createElement("BUTTON");
                var btnFullscrnClick = function(event) {
                    if(d.fullscreenElement !== fullscrnPanel) {
                        dock_n_liquid.requestFullscreen(fullscrnPanel);
                    } else {
                        dock_n_liquid.exitFullscreen();
                    }
                };
                var fullscreenChange = function(event) {
                    if(d.fullscreenElement !== fullscrnPanel) {
                        btnFullscrn.innerHTML = "Request Fullscreen";
                    } else {
                        btnFullscrn.innerHTML = "Exit Fullscreen";
                    }
                };
                btnFullscrn.setAttribute("type", "button");
                btnFullscrn.addEventListener("click", btnFullscrnClick );
                fullscrnPanel.appendChild(btnFullscrn);
                d.addEventListener("fullscreenchange", fullscreenChange);

                fullscreenChange();
            }
        }(document));
        dock_n_liquid.init();
    }
    function hidePanelRight() {
        var panelRight = document.getElementById("panelRight");
        dock_n_liquid.select(panelRight).show(false);
    }
    function showPanelRight() {
        dock_n_liquid.select("#panelRight").show(true);
    }
    </script>
    </body>
</html>

LICENSE

This software is released under the MIT License, see LICENSE