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

laxar-uikit

v2.1.3

Published

User interface controls for LaxarJS

Downloads

107

Readme

LaxarJS UiKit Build Status

Bootstrap 3 compatible base styles for LaxarJS widgets, plus a few i18n-UI helpers

This is the home of the default theme for LaxarJS. Based on the SCSS version of Bootstrap 3.3 together with Font Awesome 4.7, it contains only a small number of additional classes.

Also, this repository contains a number of JavaScript library functions, which are too UI-specific to be included into LaxarJS core. They are mostly related to formatting and parsing of values (numbers, decimals, dates) in i18n applications. Learn what's in there for you, by consulting the API docs.

Of course, the additional JavaScript code will only be bundled as part of your application if it actually imports the laxar-uikit module.

What is the default theme?

Several types of artifacts in a LaxarJS application may be themed, namely widgets, controls and layouts. The CSS and HTML of such an artifact lives in a subfolder named after each theme that the artifacts support. However, to allow for reuse of artifacts in different applications, all artifacts should support at least the so-called "default theme". For example, if a widget called my-widget supports the default theme and the cube theme, it will use two folders (my-widget/default.theme and my-widget/cube.theme), and each folder may contain a CSS file and an HTML file for the widget.

Although it has a few extra classes (those starting with the ax- prefix), you may think of the default theme as just Bootstrap 3. When creating custom themes, it is recommended to use a Bootstrap-compatible set of classes, so that any widget can be themed without having to create new HTML markup. Usually, only the folder default.theme will contain the widget HTML, and the other theme folders just specify custom CSS when needed. If your application is using a custom theme (such as the cube.theme), not all widgets need to specify custom CSS for that theme, because LaxarJS will always fall back to the default theme of a widget. Refer to the LaxarJS manual on themes for more information on themes.

Using LaxarJS UiKit in a project

Including LaxarJS UiKit is currently recommended for any LaxarJS application, except if you're aiming to use a non-standard default theme (see below).

Starting with LaxarJS v2, obtain the UiKit either by starting from the Yeoman generator or by using NPM:

npm install --save laxar-uikit

Using the Library

To use the parser and formatter library functions, import them into a widget or control:

import { formatter } from 'laxar-uikit';

const format = formatter.create( 'decimal', { decimalPlaces: 1 } );
format( Math.PI ); // --> "3.1"

Or, if using CommonJS modules:

var formatter = require( 'laxar-uikit' ).formatter;
// ...

And, to use i18n:

import { localized } from 'laxar-uikit';

const axI18n = // ... obtained by widget injection, depends on the integration technology
const format = localized( axI18n ).formatter.create( 'decimal' );
// assuming the locale is "de"
format( Math.PI ); // --> "3,14"

Using the default.theme

To load the default theme, your loader (webpack) needs to be setup correctly. This is already the case if you project was created using the LaxarJS v2 Yeoman generator.

If creating a project from scratch, first make sure you have the dependencies:

npm install --save-dev laxar-loader sass-loader

Then add a resolve alias and a rule configuration for the default.theme:

// webpack.config.js
resolve: {
   // ...,
   alias: {
      // ...,
      'default.theme': 'laxar-uikit/themes/default.theme'
   }
},
module: {
   rules: [
      // ...,
      {
         test: /[/]default[.]theme[/].*[.]s[ac]ss$/,
         loader: 'sass-loader',
         options: require( 'laxar-uikit/themes/default.theme/sass-options' )
      }
   ]
}

When using webpack and the laxar-loader, the default theme will now be available for use in your application (through the init.js):

// init.js
import { create } from 'laxar';
import artifacts from 'laxar-loader/artifacts?flow=main&theme=default';

create( [ /* ... adapters ... */ ], artifacts, { /* ... configuration ... */ } )
   .flow( 'main', document.querySelector( '[data-ax-page]' ) )
   .bootstrap();

Using a custom default theme

In some cases, your application simply does not work with Bootstrap: For example, if you're working with a legacy code base, your options may be limited. Also, you may be producing a mobile-only application an incompatible CSS-framework such as material design.

You can change to a different default theme by creating a module laxar.config.js in your project root, and by setting its default.theme export to the path of your own default theme (which should be a directory named default.theme containing a folder css and a theme.css inside of that).

Of course, now you need to make sure that all default.theme folders of your project's artifacts are compatible with you own default theme!

Building LaxarJS UiKit from source

Instead of using a pre-compiled library within a project, you can also clone this repository:

git clone https://github.com/LaxarJS/laxar-uikit.git
cd laxar-uikit
npm install

To see changes in your application, configure your project to work with the sources (e.g. by using webpack), or rebuild the bundles:

npm run dist

To run the automated karma tests:

npm test

To generate HTML spec runners for opening in your web browser, so that you can e.g. use the browser's developer tools:

npm start

Now you can run the specs by browsing to http://localhost:8080/dist/lib/spec/laxar-uikit.spec.html.