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

foldable-device-configurator

v3.0.3

Published

A simple web component which you can add to emulate various type of foldables devices. It will set the appropriate media queries according to the device and the setup.

Downloads

39

Readme

Foldable Device Configurator

Foldable Device Configurator is a little Web Component which you can drop in your application to test the CSS Viewport Segments Polyfill located here

How to use the foldable configurator in your project?

$ npm install --save-dev foldable-device-configurator

You then need to import the ESM module into your project (which depends on how you import ES modules), here is an example :

    <script type='module' src="../node_modules/foldable-device-configurator/src/foldable-device-configurator.js"></script>

When imported, in your HTML file just add the following lines:

    <foldable-device-configurator></foldable-device-configurator>

Adapting your web application to foldable/dual screen devices

This web component will let you emulate various foldable configurations and will set the foldable polyfills accordingly. Currently there are two polyfills you can use to design or adapt web contents for foldable devices :

  • A JavaScript API called Viewport Segments located here
  • CSS Properties called Viewport Segments located here

Both are proposals from Microsoft. At this time the configurator will only set the viewportsegments media-queries.

:warning: The two aforementioned APIs are early work in progress and are subject to change anytime.

Demo

  • Go here

  • You can also try a more advanced demo here

Working on the foldable configurator component

This project makes use of ECMAScript Modules (ESM) and runs them directly in the browser using Snowpack. If you install new dependencies using npm like npm install --save @material/mwc-button, then please run npx snowpack afterwards to generate the new modules in web_modules folder. Also, the web_modules folder should be committed. Make sure to update the package.json file accordingly.

To install app dependencies and but any further steps, run

$ npm install

ESM compatible modules can be found using pika.dev. Material design web components can be found by searching for @material/mwc-. You can try out the demo page here: Material Web Components demo

Then run

$ npm run build

To test in the browser, run

$ npm run start

To build, run

$ npm run build

The build is then ready to publish to npm (inside the dist/ directory)

This demo is being developed by :