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

browser-component

v0.1.2

Published

Components for rendering browser style UIs.

Downloads

2

Readme

Browser-component

Browser component is a web component designed to get a browser into the browser itself. It can be used to extend a headless browser, or give some more features to a web application, such as firefox/xulrunner or chrome/chromium apps. This project comes with sub components, to let you customize the browser of your wish.

Overview

Get it directly by cloning this repository:

git clone https://github.com/jokesterfr/browser-component.git

Or use bower:

bower install browser-component

Import it in your page like so:

<link rel="import" href="./bower_components/browser-component/dist/browser-component.html" />

And use it:

<browser-component defaultPage="https://github.com">
  <browser-tabbar>
    <browser-tab url="https://www.laquadrature.net/en"></browser-tab>
    <browser-tab url="http://lestrans.com"></browser-tab>
    <browser-tab-new></browser-tab-new>
  </browser-tabbar>
  <browser-toolbar>
    <browser-navigation></browser-navigation>
    <browser-location></browser-location>
    <browser-button type="home"></browser-button>
    <browser-button type="zoom-in"></browser-button>
    <browser-button type="zoom-out"></browser-button>
  </browser-toolbar>
</browser-component>

Testing example

If you want to test this component in a chrome app context, simply type:

$ npm run example

Browser compatibility

As of today, web components are not natively supported by Firefox, Chrome and chromium support web components since version 35.

Check browser compatibility.

This browser-component uses the chrome webview tag. A tweak could be made to use the equivalent XUL browser tag, to be supported by Firefox. Therefore, the lack of Web components support does not urge me to do so.

Components API

browser-component

<browser-component defaultPage="https://github.com">
  <!-- y mucho mas aqui -->
</browser-component>

The browser component is the key element of this package. Its main role is to deal with multiple webviews, masking states that does not rely on the selected tab / webview.

Attributes

  • defaultPage the default page to go when a tab with no url is opened, or when the home button is pressed. Defaults to null.
  • controls when the value is "hidden", no controls will be displayed on screen, fullscreen browsing is activated. Defaults to "visible".

Methods

  • go(uri) tells the current tab to go to this uri
  • goHome() tells the current tab to go to the home page (@see defaultPage)
  • zoomIn() zoom in the current tab
  • zoomOut() zoom out the current tab
  • stop() stop loading the current tab
  • reload() reload the current tab
  • back() tells the current tab to go back to last page in history
  • forward() tells the current tab to go forward to the next page in history
  • canGoBack() return true if the current tab can go back
  • canGoForward() return true if the current tab can go forward
  • showControls() displays the browser top controls
  • hideControls() hides the browser top controls

browser-tabbar

The browser tabbar will display all tabs you filled in, you can use the selected attribute to choose the default tab to be selected (or the last one will be by default):

<browser-tabbar>
  <browser-tab url="https://www.laquadrature.net/en"></browser-tab>
  <browser-tab url="http://lestrans.com"></browser-tab>
  <browser-tab-new></browser-tab-new>
</browser-tabbar>

There is no methods nor attributes to use with <browser-tabbar>.

browser-tab

A nice favicon and title are automatically added there. The actual behaviour is that a single tab in the tabbar cannot be closed. Also, only active tabs can be closed.

Attributes

  • url: URL of the content to browse

Methods

  • select: selects this tab (to use the corresponding webview)
  • close: closes the tab (and the corresponding webview)

browser-tab-new

<browser-tab-new></browser-tab-new>

Allows you to dynamically add some more tabs. To be placed right after the <browser-tab> element(s).

browser-tab-separator

<browser-tab></browser-tab>
<browser-tab-separator></browser-tab-separator>
<browser-tab></browser-tab>

A graphical separation between tabs.

browser-toolbar

You may place buttons or location fields in it, feel free to suggest any other components you would like to use here.

<browser-toolbar>
  <browser-navigation></browser-navigation>
  <browser-location></browser-location>
  <browser-button type="home"></browser-button>
  <browser-button type="zoom-in"></browser-button>
  <browser-button type="zoom-out"></browser-button>
</browser-toolbar>

browser-button

<browser-button type="zoom-in"></browser-button>

A simple button, customizable with any icon of your wish:

  • back
  • bookmark
  • download
  • feed
  • forward
  • history
  • home
  • menu
  • new-window
  • print
  • reload
  • zoom-in
  • zoom-out
  • zoom

Feel free to PR a new one. Actions are triggered by the <browser-button> parent.

browser-navigation

<browser-navigation></browser-navigation>

This component is made of a back button and a forward button. The forward button disappear when there is no next page in the browsing history. States are related to current tab. Simple.

browser-location

<browser-location></browser-location>

The input which let you choose how to browse the web! Comes with a go/reload button on its right.

Licence

This work is largely inspired by Firefox Australis UI, therefore the same licence applies here:

Mozilla Public License - Version 2.0