@nibcss/angular
Every export of the Angular package: the builders, provideNib, the [nib] directive, NibService, the nibClass pipe and nibDarkToggle.
The builders#
Target | Builder |
|---|---|
|
|
|
|
Both accept everything @angular/build:application and @angular/build:dev-server accept, unchanged.
A nib block on the build target covers only where files are:
Option | Default | What it does |
|---|---|---|
|
| where the stylesheet goes |
| auto-detected | path to |
| project sources | globs to scan, or skip |
|
| mount the overlay on |
|
|
|
Providing the runtime#
import { provideNib } from "@nibcss/angular";
export const appConfig: ApplicationConfig = {
providers: [provideNib()], // config comes from the bundle
// providers: [provideNib({ tokens: { color: { accent: "#f0f" } } })], // or override part of it
};Exports#
Export | What it is |
|---|---|
| start the runtime as the environment injector is built |
| a string, a record ( |
|
|
| a class string in a template |
| toggles on click, hides itself when |
| all three, for a standalone component's |
| the injection tokens |
| the string/record/array normaliser the directive uses |
| drop the shared instance (tests) |
| the config helpers the provider uses |
The three binding shapes#
<div [nib]="'p=16px; bdrd=8px'"></div>
<div [nib]="{ 'cl=#b91c1c': invalid(), 'ftw=700': true }"></div>
<div [nib]="['p=16px', condition ? 'bgc=#eef2ff' : '']"></div>NibService in a component#
export class Header {
constructor(private nib: NibService) {}
readonly isDark = this.nib.isDark; // a signal
readonly brand = this.nib.token("color.brand");
highlight(level: string) {
return this.nib.classes(level === "error" ? "cl=#b91c1c; ftw=700" : "cl=#b45309");
}
}