flowbite-angular
Version:
<div align="center"> <h1>:construction: flowbite-angular (unreleased) :construction:</h1> <p> <a href="https://flowbite.com"> <img alt="Flowbite - Tailwind CSS components" width="350" src="https://flowbite.s3.amazonaws.com/github/logo-github
88 lines (82 loc) • 3.17 kB
JavaScript
import { Guid, generateId } from 'flowbite-angular/utils';
import * as i0 from '@angular/core';
import { inject, Injector, signal, computed, afterNextRender, Directive } from '@angular/core';
/**
* This function cast a boolean to the internal flowbute-angular boolean type.
*
* @param value The input to be cast.
* @returns enabled if value is true ; disabled if value is false.
*/
function booleanToFlowbiteBoolean(value) {
return value ? 'enabled' : 'disabled';
}
/**
* Provide an abstract class used in theming system of flowbite-angular.
*/
class FlowbiteThemeService {
}
/**
* Base abstract component.
* Every flowbite-angular components has to extends on this one.
*/
class BaseComponent {
constructor() {
/**
* `Injector` instance injected to be used as an injector context where there is no default one.
*
* @example
* ```
* public ngOnInit(): void {
* afterNextRender(
* () => {},
* { injector: this.injector }
* );
* }
* ```
*/
this.injector = inject(Injector);
/**
* Auto generated GUID for each flowbite-angular component
*
* Its default value is 00000000-0000-0000-0000-000000000000, and is set to a random GUID inside the `afterNextRender` hook
*/
this.flowbiteId = signal(new Guid(Guid.empty));
/**
* Computed signal storing the component classes used in its template
*/
this.contentClasses = computed(() => this.fetchClass());
}
/**
* Initialize component.
*
* A call to verify and init function is done. Then a new Guid is set in the `afterNextRender` hook.
*/
ngOnInit() {
this.init();
afterNextRender(() => {
this.flowbiteId.set(generateId());
}, { injector: this.injector });
}
/**
* Function loaded during `OnInit` lifecycle hook. It initialize requirments for the component.
*/
// eslint-disable-next-line @typescript-eslint/no-empty-function
init() { }
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: BaseComponent, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.0.4", type: BaseComponent, isStandalone: true, host: { properties: { "class": "this.contentClasses().rootClass", "attr.flowbite-id": "this.flowbiteId()" } }, ngImport: i0 }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.4", ngImport: i0, type: BaseComponent, decorators: [{
type: Directive,
args: [{
standalone: true,
host: {
'[class]': 'this.contentClasses().rootClass',
'[attr.flowbite-id]': 'this.flowbiteId()',
},
}]
}] });
/**
* Generated bundle index. Do not edit.
*/
export { BaseComponent, FlowbiteThemeService, booleanToFlowbiteBoolean };
//# sourceMappingURL=flowbite-angular.mjs.map