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

ios-action-safe

v0.2.0

Published

iOS bottom bar and urlbar helper

Downloads

7

Readme

IOS Action Safe

Utilize CSS Custom Properties to style your overlay components with binding to window.innerHeight.

How it works

It adds an aside element into the dom with 100vw and 100vh dimensions and read out its width and height in px.

On every resize event, the window.innerWidth and window.innerHeight are gathered and updated into your CSS Custom Properties.

By using the Custom Properties in your overlay/flyout/modal css, your element will always fit in the viewport, without the ios bottom bar come in your way.

Default Custom Properties

You can change any of this options to your needs, by providing a customOption Object in constructor call.

--visibleHeight

stores always the value of window.innerHeight suffixed with px.

--visibleWidth

stores always the value of window.innerHeight suffixed with px.

--visiblePadding

stores the difference from a 100vh element and window.innerHeight suffixed with px.

Setup

Grab your copy of this package:

npm i ios-action-safe --save

Import this package in your project:

ES-6 import IosActionSafe from 'ios-action-safe';new IosActionSafe(<{customOptions}>);

ES-5 You'll find a minified and unminified version in the dist/-folder, to embed in your project: <script src="/vendor/ios-action-safe.min.js" defer></script>

same way as with the ES-6 class: new IosActionSage(<{customOptions}>);

Configuration

For a working example have a look into the index.html in this package.

The key configuration is, to add the following CSS to elements who needs to fit into the viewport:

.modal,
.flyout,
.overlay,
.mobile-nav {
    …
    height: 100vh; /* ie11 */
    height: var(--visibleHeight);
    ..
    padding-bottom: 0; /* ie11 */
    padding-bottom: var(--visiblePadding);
}

You might want to setup only height or padding-bottom. In combination you will end up with a bottom bar height visible padding on your element.

customise custom property names

By calling the constructor, you can provide an object with overrides for every custom property name:

new IosActionSafe({
    visibleHeight: '--visibleHeight',
    visibleWidth: '--visibleWidth',
    visiblePadding: '--visiblePadding',
});

callback

On every resize and measuring event, you can add a callback function too, which will give you all the numbers without px:

{
    "viewportHeight": this.viewportHeight,
    "viewportWidth": this.viewportWidth,
    "visibleHeight": this.visibleHeight,
    "visibleWidth": this.visibleWidth,
    "visiblePadding": this.viewportHeight - visibleHeight
}

to add a callback, add the callback option to the constructor call:

new IosActionsSafe({
    callback: (event, data) => { console.log(event, data); },
});

or

new IosActionsSafe({
    visibleHeight: '--visibleHeight',
    visibleWidth: '--visibleWidth',
    visiblePadding: '--visiblePadding',
    callback: updateSizes
});
…
function updateSizes(event, data) {
    …
}

or in ES-6:

new IosActionsSafe({
    visibleHeight: '--visibleHeight',
    visibleWidth: '--visibleWidth',
    visiblePadding: '--visiblePadding',
    callback: (event, data) => { this.updateSizes(event, data); }),
});

## side fx

this package will add an `<aside>` after your `<body>` element. Do not wonder about it, this is used to measure 100vh and 100vw.

## Package Name

In video editing you have three different viewports, the native resolution (for exmaple 1920x1080) but tv's cut parts of this resolution away, or parts of the signal where used for teletext, and so there is a **action safe** and **title safe** setting, you can enable in every video editing software, to keep your content visible to any recipient. That's where the name for this package comes from.