(Fuse) Tree-shakable core services, closes #64

This commit is contained in:
Sercan Yemen 2018-07-02 14:30:18 +03:00
parent 4e98ab1682
commit 09d1b1034e
10 changed files with 31 additions and 35 deletions

View File

@ -3,7 +3,9 @@ import { BehaviorSubject, Observable, Subject } from 'rxjs';
import { FuseNavigationItem } from '@fuse/types';
@Injectable()
@Injectable({
providedIn: 'root'
})
export class FuseNavigationService
{
onItemCollapsed: Subject<any>;

View File

@ -2,7 +2,9 @@ import { Injectable } from '@angular/core';
import { FuseSidebarComponent } from './sidebar.component';
@Injectable()
@Injectable({
providedIn: 'root'
})
export class FuseSidebarService
{
// Private

View File

@ -1,7 +1,9 @@
import { Injectable } from '@angular/core';
import { MatSidenav } from '@angular/material';
@Injectable()
@Injectable({
providedIn: 'root'
})
export class FuseMatSidenavHelperService
{
sidenavInstances: MatSidenav[];

View File

@ -1,29 +1,8 @@
import { ModuleWithProviders, NgModule, Optional, SkipSelf } from '@angular/core';
import { FUSE_CONFIG, FuseConfigService } from '@fuse/services/config.service';
import { FuseCopierService } from '@fuse/services/copier.service';
import { FuseLoadingBarService } from '@fuse/services/loading-bar.service';
import { FuseMatchMediaService } from '@fuse/services/match-media.service';
import { FuseMatSidenavHelperService } from '@fuse/directives/fuse-mat-sidenav/fuse-mat-sidenav.service';
import { FuseNavigationService } from '@fuse/components/navigation/navigation.service';
import { FuseSidebarService } from '@fuse/components/sidebar/sidebar.service';
import { FuseSplashScreenService } from '@fuse/services/splash-screen.service';
import { FuseTranslationLoaderService } from '@fuse/services/translation-loader.service';
import { FUSE_CONFIG } from '@fuse/services/config.service';
@NgModule({
entryComponents: [],
providers : [
FuseConfigService,
FuseCopierService,
FuseLoadingBarService,
FuseMatchMediaService,
FuseMatSidenavHelperService,
FuseNavigationService,
FuseSidebarService,
FuseSplashScreenService,
FuseTranslationLoaderService
]
})
@NgModule()
export class FuseModule
{
constructor(@Optional() @SkipSelf() parentModule: FuseModule)

View File

@ -8,7 +8,9 @@ import * as _ from 'lodash';
// Create the injection token for the custom settings
export const FUSE_CONFIG = new InjectionToken('fuseCustomConfig');
@Injectable()
@Injectable({
providedIn: 'root'
})
export class FuseConfigService
{
// Private

View File

@ -1,14 +1,15 @@
/**
* This class is based on the code in the following projects:
*
* - https://github.com/zenorocha/select
* - https://github.com/zenorocha/clipboard.js/
* https://github.com/zenorocha/select
* https://github.com/zenorocha/clipboard.js/
*
* Both released under MIT license - © Zeno Rocha
*/
import { Injectable } from '@angular/core';
@Injectable()
@Injectable({
providedIn: 'root'
})
export class FuseCopierService
{
private textarea: HTMLTextAreaElement;

View File

@ -3,7 +3,9 @@ import { NavigationEnd, NavigationStart, Router } from '@angular/router';
import { BehaviorSubject, Observable } from 'rxjs';
import { filter } from 'rxjs/operators';
@Injectable()
@Injectable({
providedIn: 'root'
})
export class FuseLoadingBarService
{
// Private

View File

@ -2,7 +2,9 @@ import { MediaChange, ObservableMedia } from '@angular/flex-layout';
import { Injectable } from '@angular/core';
import { BehaviorSubject } from 'rxjs';
@Injectable()
@Injectable({
providedIn: 'root'
})
export class FuseMatchMediaService
{
activeMediaQuery: string;

View File

@ -3,7 +3,9 @@ import { DOCUMENT } from '@angular/common';
import { animate, AnimationBuilder, AnimationPlayer, style } from '@angular/animations';
import { NavigationEnd, Router } from '@angular/router';
@Injectable()
@Injectable({
providedIn: 'root'
})
export class FuseSplashScreenService
{
splashScreenEl: any;

View File

@ -7,7 +7,9 @@ export interface Locale
data: Object;
}
@Injectable()
@Injectable({
providedIn: 'root'
})
export class FuseTranslationLoaderService
{
/**