@craftsjs/core
v7.0.1
Published
Craftsjs core library for angular
Readme
craftsjs core
Base utilities for CraftsJS: a responsive NgRx feature store and a directive for dynamic component insertion.
Compatibility
Current version: 7.0.1 (compatible with Angular v19)
| Angular | @craftsjs/core | | ------- | -------------- | | 19 | 7.x | | 18 | 6.x | | 15 | 5.x | | 13 | 4.x | | 12 | 3.x | | 11 | 2.x |
Installation
npm i @craftsjs/core --SPeer dependencies: @ngrx/store and @craftsjs/ngrx-action.
npm i @ngrx/store @craftsjs/ngrx-action --SUsage (standalone, Angular 15+/18)
- Provide at bootstrap (registers the
responsivefeature):
// main.ts
import { bootstrapApplication } from '@angular/platform-browser';
import { provideStore } from '@ngrx/store';
import { provideCraftsjsCore } from '@craftsjs/core';
import { AppComponent } from './app/app.component';
bootstrapApplication(AppComponent, {
providers: [
provideStore(),
provideCraftsjsCore()
]
});- Or at route-level (lazy providers):
import { Routes } from '@angular/router';
import { provideCraftsjsCore } from '@craftsjs/core';
export const routes: Routes = [
{
path: 'feature',
loadComponent: () => import('./feature/feature.component').then(m => m.FeatureComponent),
providers: [provideCraftsjsCore()]
}
];- Standalone directive
DynamicDirective:
import { Component } from '@angular/core';
import { DynamicDirective } from '@craftsjs/core';
@Component({
selector: 'example',
standalone: true,
imports: [DynamicDirective],
template: `<ng-container craftsjsDynamic></ng-container>`
})
export class ExampleComponent {}NgModule (compatibility)
import { NgModule } from '@angular/core';
import { StoreModule } from '@ngrx/store';
import { CoreModule } from '@craftsjs/core';
@NgModule({
imports: [
StoreModule.forRoot({}),
CoreModule
]
})
export class AppModule {}Styles (grid)
The Bootstrap-style grid is now shipped as compiled CSS. Add it to your
global styles (or angular.json styles array):
@use '@craftsjs/core/craftsjs-grid.theme.css';If you only need the grid mixins/variables (not the generated classes), the Sass source is still published and can be consumed with the modern module system:
@use '@craftsjs/core/craftsjs-grid.theme' as grid;Note: the legacy
@import '~@craftsjs/core/craftsjs-grid.theme'syntax (with the~prefix) is deprecated. The grid was migrated to the modern Sass module system and no longer emits Sass deprecation warnings under Angular 19.
