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

seal-bar

v2.0.1

Published

seal-bar library, a small lib provided to inject the bar component into each app

Downloads

1

Readme

Travis build status shield NPM release version shield NPM Licence shield

Cozy Bar Library

What's Cozy?

Cozy Logo

Cozy is a platform that brings all your web services in the same private space. With it, your webapps and your devices can share data easily, providing you with a new experience. You can install Cozy on your own hardware where no one's tracking you.

What's cozy-bar.js?

cozy-bar.js is a javascript library made by Cozy. It enables the CozyBar component in your application. This component is a banner on the top of your application, responsible of cross-apps navigation, user facilities, intents, etc.

Use

cozy-bar.js is an asset directly served by the cozy-stack. To use it, simply add <script src="/js/cozy-bar.js" defer></script> in the <head> section of the index.html of your application. It exposes an API behind the window.cozy.bar namespace, that let you interact with the CozyBar itself.

The library requires your markup to contain an element with role=application and attributes data-cozy-domain and data-cozy-token. The DOM of the banner will be added before this element.

Once you have the library included in your application, starts by intialize it in your app bootstrap:

window.cozy.bar.init({
  appName: MY_APP_NAME,
  appNamePrefix: MY_APP_NAME_PREFIX
  iconPath: PATH_TO_SVG_ICON,
  lang: LOCALE
})

appName param in hash is mandatory when appNamePrefix, lang and iconPath are optionals. If not passed, their values are detected into the DOM:

  • appNamePrefix is extracted from the manifest. Originally used for apps maintained by Cozy Cloud teams.
  • lang is extracted from the lang attribute of the <html> tag. Defaults to 'en'
  • iconPath uses the favicon 32px. Defaults to a blank GIF

Help link

Help link is defined in your Cozy's configuration file, in the context section. See the cozy.example.yaml file provided by the stack.

Coming Soon application

Coming Soon applications (or apps) are defined in your Cozy's configuration file. See the cozy.example.yaml file provided by the stack.

Claudy actions list

Claudy actions are declared in src/config/claudy.yaml with a slug as property name and some options (icon name and link options for example). The slugs list that will be used for Claudy is defined in your Cozy's configuration file. See the cozy.example.yaml file provided by the stack. If no claudy_actions property is defined in the configuration, Claudy won't be displayed.

Customizing the content of the bar

From within your app, you can decide to take over certain areas of the cozy-bar. This might especially be useful on mobile where the area it occupies is prime real estate — we generally don't recommend to use this option on larger screen resolutions.

The bar is divided in 3 areas that you can control individually : left, center and right:

cozy-bar-triplet

To do this, you need to call one of the 3 exposed functions like this:

const setBarLeft = cozy.bar.setBarLeft
setBarLeft('<div>Hello!</div>')
// there's also cozy.bar.setBarCenter and cozy.bar.setBarRight

If you're using React, you can use the component form instead:

const { BarLeft, BarCenter, BarRight } = cozy.bar

// then, somewhere in a render function
<BarLeft>
  <div>Hello!</div>
</BarLeft>

If you're using Redux and include a connected component in the bar, it might not work as expected since inside <BarLeft> and friends, the redux store is different.

const MyConnectedComponent = connect(mapStateToProps, mapDispatchToProps, MyComponent)

// … in a render function
<BarLeft>
  <MyConnectedComponent /> // … you won't get the expected props from redux
</BarLeft>

Instead, you can do something like this:

const MyWrappedComponent = (props) => (
<BarLeft>
  <MyComponent {...props} />
</BarLeft>
)

const MyConnectedComponent = connect(mapStateToProps, mapDispatchToProps, MyWrappedComponent)

// …in a render function
<MyConnectedComponent />

Contribute

If you want to work on cozy-client-js itself and submit code modifications, feel free to open pull-requests! See the contributing guide for more information about this repository structure, testing, linting and how to properly open pull-requests.

Community

Maintainer

The lead maintainer for cozy-bar.js is @CPatchane, send him/her a :beers: to say hello!

Get in touch

You can reach the Cozy Community by:

Licence

cozy-bar.js is developed by Cozy Cloud and distributed under the MIT.