theme-lib
Version:
This is a simple example Angular Library published to npm.
200 lines • 10.9 kB
JavaScript
/**
* @fileoverview added by tsickle
* @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/*
* @license
* Copyright Akveo. All Rights Reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*/
import { Injectable } from '@angular/core';
import { Subject } from 'rxjs';
import { share } from 'rxjs/operators';
/*
* Sidebar service.
*
* Root module service to control the sidebar from any part of the app.
*
* Allows you to change sidebar state dynamically from any part of the app:
* @stacked-example(Sidebar State, sidebar/sidebar-toggle.component)
*/
var NbSidebarService = /** @class */ (function () {
function NbSidebarService() {
this.toggle$ = new Subject();
this.expand$ = new Subject();
this.collapse$ = new Subject();
}
/*
* Subscribe to toggle events
*
* @returns Observable<{ compact: boolean, tag: string }>
*/
/*
* Subscribe to toggle events
*
* @returns Observable<{ compact: boolean, tag: string }>
*/
/**
* @return {?}
*/
NbSidebarService.prototype.onToggle = /*
* Subscribe to toggle events
*
* @returns Observable<{ compact: boolean, tag: string }>
*/
/**
* @return {?}
*/
function () {
return this.toggle$.pipe(share());
};
/*
* Subscribe to expand events
* @returns Observable<{ tag: string }>
*/
/*
* Subscribe to expand events
* @returns Observable<{ tag: string }>
*/
/**
* @return {?}
*/
NbSidebarService.prototype.onExpand = /*
* Subscribe to expand events
* @returns Observable<{ tag: string }>
*/
/**
* @return {?}
*/
function () {
return this.expand$.pipe(share());
};
/*
* Subscribe to collapse evens
* @returns Observable<{ tag: string }>
*/
/*
* Subscribe to collapse evens
* @returns Observable<{ tag: string }>
*/
/**
* @return {?}
*/
NbSidebarService.prototype.onCollapse = /*
* Subscribe to collapse evens
* @returns Observable<{ tag: string }>
*/
/**
* @return {?}
*/
function () {
return this.collapse$.pipe(share());
};
/*
* Toggle a sidebar
* @param {boolean} compact
* @param {string} tag If you have multiple sidebars on the page, mark them with `tag` input property and pass it here
* to specify which sidebar you want to control
*/
/*
* Toggle a sidebar
* @param {boolean} compact
* @param {string} tag If you have multiple sidebars on the page, mark them with `tag` input property and pass it here
* to specify which sidebar you want to control
*/
/**
* @param {?=} compact
* @param {?=} tag
* @return {?}
*/
NbSidebarService.prototype.toggle = /*
* Toggle a sidebar
* @param {boolean} compact
* @param {string} tag If you have multiple sidebars on the page, mark them with `tag` input property and pass it here
* to specify which sidebar you want to control
*/
/**
* @param {?=} compact
* @param {?=} tag
* @return {?}
*/
function (compact, tag) {
if (compact === void 0) { compact = false; }
this.toggle$.next({ compact: compact, tag: tag });
};
/*
* Expands a sidebar
* @param {string} tag If you have multiple sidebars on the page, mark them with `tag` input property and pass it here
* to specify which sidebar you want to control
*/
/*
* Expands a sidebar
* @param {string} tag If you have multiple sidebars on the page, mark them with `tag` input property and pass it here
* to specify which sidebar you want to control
*/
/**
* @param {?=} tag
* @return {?}
*/
NbSidebarService.prototype.expand = /*
* Expands a sidebar
* @param {string} tag If you have multiple sidebars on the page, mark them with `tag` input property and pass it here
* to specify which sidebar you want to control
*/
/**
* @param {?=} tag
* @return {?}
*/
function (tag) {
this.expand$.next({ tag: tag });
};
/*
* Collapses a sidebar
* @param {string} tag If you have multiple sidebars on the page, mark them with `tag` input property and pass it here
* to specify which sidebar you want to control
*/
/*
* Collapses a sidebar
* @param {string} tag If you have multiple sidebars on the page, mark them with `tag` input property and pass it here
* to specify which sidebar you want to control
*/
/**
* @param {?=} tag
* @return {?}
*/
NbSidebarService.prototype.collapse = /*
* Collapses a sidebar
* @param {string} tag If you have multiple sidebars on the page, mark them with `tag` input property and pass it here
* to specify which sidebar you want to control
*/
/**
* @param {?=} tag
* @return {?}
*/
function (tag) {
this.collapse$.next({ tag: tag });
};
NbSidebarService.decorators = [
{ type: Injectable }
];
return NbSidebarService;
}());
export { NbSidebarService };
if (false) {
/**
* @type {?}
* @private
*/
NbSidebarService.prototype.toggle$;
/**
* @type {?}
* @private
*/
NbSidebarService.prototype.expand$;
/**
* @type {?}
* @private
*/
NbSidebarService.prototype.collapse$;
}
//# sourceMapp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