Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@bayou/client-bundle

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@bayou/client-bundle

Subcomponent of the Bayou project.

  • 1.3.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
4
increased by300%
Maintainers
1
Weekly downloads
 
Created
Source

The Client Environment

CSS Modules

The Arugula client code makes use of "CSS modules" so that our CSS can be broken up into smaller files. This also gives us the ability to easily control what styles are active in the DOM, and when.

When the CSS loaded processes a .css file it transforms the class names to globally unique values. This is to avoid naming collisions with other modules. When you import the CSS module into JavaScript you end up with an object that maps the class names that were in the CSS file to the unique name.

Basic Usage
/* some-component.css input */

.megaheader {
  font-weight: 900;
  color:       black;
}
/* some-component.css after going through the CSS loader */

._zalksdjflasjfowi4r39485 {
  font-weight: 900;
  color:       black;
}
/* some-component.js */

import styles from './some-component.css';

// `megaheader` class now active in the DOM

const header = document.createElement('p');

/*
  header = {
    megaheader: '_zalksdjflasjfowi4r39485'
  }
*/

header.classList.add(styles.megaheader);
document.body.appendChild(header);
Reference-counted Usage

If the name of the CSS input file ends with .ucss (use()-able CSS) then it will not be automatically added to the DOM. Instead, it will rely on explicit reference counting increments/decrements. If the reference count is greater than zero then the styles are added to the DOM. If the count returns to zero then the styles are removed from the DOM.

/* some-component.ucss input */

.selectedBorder {
  border-color: red;
}

.unselectedBorder {
  border-color: black;
}
/* some-component.js */

import styles from './some-component.ucss';

// Border classes not active in the DOM yet.

export default class SomeComponent {
  ...

  lifecycleBegin() {
    // Increment reference count. If count was zero before the call then
    // the style classes are added to the DOM.
    styles.use();
  }

  lifecycleEnd() {
    // Decrement the reference count. If the count is reduced to zero after
    // the call then the style classes are removed from the DOM.
    styles.unuse();
  }
}

Copyright 2016-2019 the Bayou Authors (Dan Bornstein et alia).
Licensed AS IS and WITHOUT WARRANTY under the Apache License,
Version 2.0. Details: <http://www.apache.org/licenses/LICENSE-2.0>

FAQs

Package last updated on 28 Mar 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc