@w11k/ngx-present
Version:
Angular based Presentation Tool
1,395 lines (1,360 loc) • 172 kB
JavaScript
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/common'), require('@angular/core'), require('@angular/material/button'), require('@angular/material/card'), require('@angular/material/dialog'), require('@angular/material/icon'), require('@angular/material/list'), require('@angular/material/sidenav'), require('@angular/material/slide-toggle'), require('@angular/material/toolbar'), require('@angular/router'), require('@w11k/tydux-angular'), require('@angular/platform-browser'), require('@w11k/tydux'), require('rxjs'), require('@w11k/ngx-componentdestroyed'), require('@w11k/rx-ninja'), require('rxjs/operators')) :
typeof define === 'function' && define.amd ? define('@w11k/ngx-present', ['exports', '@angular/common', '@angular/core', '@angular/material/button', '@angular/material/card', '@angular/material/dialog', '@angular/material/icon', '@angular/material/list', '@angular/material/sidenav', '@angular/material/slide-toggle', '@angular/material/toolbar', '@angular/router', '@w11k/tydux-angular', '@angular/platform-browser', '@w11k/tydux', 'rxjs', '@w11k/ngx-componentdestroyed', '@w11k/rx-ninja', 'rxjs/operators'], factory) :
(global = global || self, factory((global.w11k = global.w11k || {}, global.w11k['ngx-present'] = {}), global.ng.common, global.ng.core, global.ng.material.button, global.ng.material.card, global.ng.material.dialog, global.ng.material.icon, global.ng.material.list, global.ng.material.sidenav, global.ng.material.slideToggle, global.ng.material.toolbar, global.ng.router, global.tyduxAngular, global.ng.platformBrowser, global.tydux, global.rxjs, global.ngxComponentdestroyed, global.rxNinja, global.rxjs.operators));
}(this, (function (exports, common, core, button, card, dialog, icon, list, sidenav, slideToggle, toolbar, router, tyduxAngular, platformBrowser, tydux, rxjs, ngxComponentdestroyed, rxNinja, operators) { 'use strict';
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/* global Reflect, Promise */
var extendStatics = function(d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
function __extends(d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
}
var __assign = function() {
__assign = Object.assign || function __assign(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
function __rest(s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;
}
function __decorate(decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
}
function __param(paramIndex, decorator) {
return function (target, key) { decorator(target, key, paramIndex); }
}
function __metadata(metadataKey, metadataValue) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
}
function __awaiter(thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
}
function __generator(thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
}
function __exportStar(m, exports) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
function __values(o) {
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
if (m) return m.call(o);
if (o && typeof o.length === "number") return {
next: function () {
if (o && i >= o.length) o = void 0;
return { value: o && o[i++], done: !o };
}
};
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
}
function __read(o, n) {
var m = typeof Symbol === "function" && o[Symbol.iterator];
if (!m) return o;
var i = m.call(o), r, ar = [], e;
try {
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
}
catch (error) { e = { error: error }; }
finally {
try {
if (r && !r.done && (m = i["return"])) m.call(i);
}
finally { if (e) throw e.error; }
}
return ar;
}
function __spread() {
for (var ar = [], i = 0; i < arguments.length; i++)
ar = ar.concat(__read(arguments[i]));
return ar;
}
function __spreadArrays() {
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
for (var r = Array(s), k = 0, i = 0; i < il; i++)
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
r[k] = a[j];
return r;
};
function __await(v) {
return this instanceof __await ? (this.v = v, this) : new __await(v);
}
function __asyncGenerator(thisArg, _arguments, generator) {
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
var g = generator.apply(thisArg, _arguments || []), i, q = [];
return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
function fulfill(value) { resume("next", value); }
function reject(value) { resume("throw", value); }
function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
}
function __asyncDelegator(o) {
var i, p;
return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
}
function __asyncValues(o) {
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
var m = o[Symbol.asyncIterator], i;
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
}
function __makeTemplateObject(cooked, raw) {
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
return cooked;
};
function __importStar(mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result.default = mod;
return result;
}
function __importDefault(mod) {
return (mod && mod.__esModule) ? mod : { default: mod };
}
function __classPrivateFieldGet(receiver, privateMap) {
if (!privateMap.has(receiver)) {
throw new TypeError("attempted to get private field on non-instance");
}
return privateMap.get(receiver);
}
function __classPrivateFieldSet(receiver, privateMap, value) {
if (!privateMap.has(receiver)) {
throw new TypeError("attempted to set private field on non-instance");
}
privateMap.set(receiver, value);
return value;
}
/**
* @fileoverview added by tsickle
* Generated from: lib/core/utils.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/**
* @template T
* @param {?} list
* @return {?}
*/
function maxDepth(list) {
if (list.length === 0) {
return 0;
}
/**
* @param {?} value
* @param {?} currentDepth
* @return {?}
*/
function recursive(value, currentDepth) {
return value.reduce((/**
* @param {?} depth
* @param {?} val
* @return {?}
*/
function (depth, val) {
if (Array.isArray(val)) {
/** @type {?} */
var newDepth = recursive(val, currentDepth + 1);
return max(newDepth, depth);
}
return depth;
}), currentDepth + 1);
}
return recursive(list, 0);
}
/**
* @param {?} a
* @param {?} b
* @param {...?} c
* @return {?}
*/
function min(a, b) {
var c = [];
for (var _i = 2; _i < arguments.length; _i++) {
c[_i - 2] = arguments[_i];
}
/** @type {?} */
var values = __spread([a, b], c);
return values.reduce((/**
* @param {?} x
* @param {?} y
* @return {?}
*/
function (x, y) { return x > y ? y : x; }));
}
/**
* @param {?} a
* @param {?} b
* @param {...?} c
* @return {?}
*/
function max(a, b) {
var c = [];
for (var _i = 2; _i < arguments.length; _i++) {
c[_i - 2] = arguments[_i];
}
/** @type {?} */
var values = __spread([a, b], c);
return values.reduce((/**
* @param {?} x
* @param {?} y
* @return {?}
*/
function (x, y) { return x > y ? x : y; }));
}
/**
* @template T
* @param {?} value
* @param {?=} result
* @return {?}
*/
function flattenDeep(value, result) {
var e_1, _a;
if (result === void 0) { result = []; }
try {
for (var value_1 = __values(value), value_1_1 = value_1.next(); !value_1_1.done; value_1_1 = value_1.next()) {
var element = value_1_1.value;
if (Array.isArray(element)) {
flattenDeep(element, result);
}
else {
result.push(element);
}
}
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (value_1_1 && !value_1_1.done && (_a = value_1.return)) _a.call(value_1);
}
finally { if (e_1) throw e_1.error; }
}
return result;
}
/**
* @template T, U
* @param {?} level0
* @param {?} mapper
* @return {?}
*/
function mapDeep(level0, mapper) {
return level0.map((/**
* @param {?} level1
* @return {?}
*/
function (level1) {
if (Array.isArray(level1)) {
return mapDeep(level1, mapper);
}
else {
return mapper(level1);
}
}));
}
/**
* @template T
* @param {?} list
* @param {?} predicate
* @return {?}
*/
function filterDeep(list, predicate) {
/** @type {?} */
var filtered = [];
list.forEach((/**
* @param {?} entry
* @return {?}
*/
function (entry) {
if (Array.isArray(entry)) {
/** @type {?} */
var nestedFiltered = filterDeep(entry, predicate);
if (nestedFiltered.length > 0) {
filtered.push(nestedFiltered);
}
}
else if (predicate(entry)) {
filtered.push(entry);
}
}));
return filtered;
}
/**
* @template S1, S2
* @param {?} s1
* @param {...?} sources
* @return {?}
*/
function mergeDeep(s1) {
var e_2, _a, e_3, _b;
var sources = [];
for (var _i = 1; _i < arguments.length; _i++) {
sources[_i - 1] = arguments[_i];
}
/** @type {?} */
var target = {};
/** @type {?} */
var s1AndSources = __spread([s1], sources);
try {
for (var s1AndSources_1 = __values(s1AndSources), s1AndSources_1_1 = s1AndSources_1.next(); !s1AndSources_1_1.done; s1AndSources_1_1 = s1AndSources_1.next()) {
var source = s1AndSources_1_1.value;
if (source === undefined) {
continue;
}
/** @type {?} */
var keys = Object.keys(source);
try {
for (var keys_1 = (e_3 = void 0, __values(keys)), keys_1_1 = keys_1.next(); !keys_1_1.done; keys_1_1 = keys_1.next()) {
var key = keys_1_1.value;
/** @type {?} */
var sourceVal = source[key];
/** @type {?} */
var targetVal = target[key];
/** @type {?} */
var targetIsObj = typeof targetVal === 'object' && Array.isArray(targetVal) === false;
/** @type {?} */
var sourceIsObj = typeof sourceVal === 'object' && Array.isArray(sourceVal) === false;
if (targetIsObj && sourceIsObj) {
/** @type {?} */
var merged = mergeDeep(targetVal, sourceVal);
target[key] = merged;
}
else if (source.hasOwnProperty(key)) {
target[key] = sourceVal;
}
}
}
catch (e_3_1) { e_3 = { error: e_3_1 }; }
finally {
try {
if (keys_1_1 && !keys_1_1.done && (_b = keys_1.return)) _b.call(keys_1);
}
finally { if (e_3) throw e_3.error; }
}
}
}
catch (e_2_1) { e_2 = { error: e_2_1 }; }
finally {
try {
if (s1AndSources_1_1 && !s1AndSources_1_1.done && (_a = s1AndSources_1.return)) _a.call(s1AndSources_1);
}
finally { if (e_2) throw e_2.error; }
}
return target;
}
/**
* @template T
* @param {?} list
* @return {?}
*/
function flattenDelayedWithAnimationFrame(list) {
/** @type {?} */
var flatList = flattenDeep(list);
/** @type {?} */
var observable = new rxjs.Observable((/**
* @param {?} subscriber
* @return {?}
*/
function (subscriber) {
/** @type {?} */
var k = 5;
/** @type {?} */
var i = k;
/** @type {?} */
var next = (/**
* @return {?}
*/
function () {
subscriber.next(flatList.slice(0, i));
i = i + k;
if (i > flatList.length) {
cancelAnimationFrame(frame);
subscriber.complete();
}
else {
frame = requestAnimationFrame(next);
}
});
/** @type {?} */
var frame = requestAnimationFrame(next);
}));
return observable;
}
/**
* @template T
* @param {?} list
* @param {?} depth
* @return {?}
*/
function limitDepth(list, depth) {
if (depth === undefined || depth < 0) {
return list;
}
return recursive(list, depth);
/**
* @param {?} value
* @param {?} depth_
* @return {?}
*/
function recursive(value, depth_) {
if (depth_ === 0) {
return [];
}
return value
.map((/**
* @param {?} x
* @return {?}
*/
function (x) {
if (Array.isArray(x)) {
return recursive(x, depth_ - 1);
}
return x;
}))
.filter((/**
* @param {?} x
* @return {?}
*/
function (x) { return (Array.isArray(x) && x.length === 0) === false; }));
}
}
/**
* @fileoverview added by tsickle
* Generated from: lib/core/presentation.types.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
var Slide = /** @class */ (function () {
function Slide(component, coordinates, index) {
this.component = component;
this.coordinates = coordinates;
this.index = index;
}
return Slide;
}());
if (false) {
/** @type {?} */
Slide.prototype.component;
/** @type {?} */
Slide.prototype.coordinates;
/** @type {?} */
Slide.prototype.index;
}
/** @type {?} */
var ngxPresentDefaultConfig = {
sidebar: {
tableOfContent: {
enabled: true,
showCoordinates: (/** @type {?} */ (undefined)),
separator: (/** @type {?} */ (undefined)),
depth: (/** @type {?} */ (undefined))
}
},
tableOfContent: {
showCoordinates: false,
separator: ')',
depth: (/** @type {?} */ (undefined)),
},
coordinates: {
separator: '.'
},
title: {
separator: ' / '
},
navigation: {
overview: {
component: (/** @type {?} */ (undefined))
}
},
presenter: {
preview1: {
move: 1,
coordinatesToKeep: (/** @type {?} */ (undefined))
},
preview2: {
move: 2,
coordinatesToKeep: (/** @type {?} */ (undefined))
}
},
code: {
theme: (/** @type {?} */ ('dark'))
}
};
var PresentationState = /** @class */ (function () {
function PresentationState() {
this.config = ngxPresentDefaultConfig;
this.slides = [];
this.sideBar = {
open: false,
expert: false,
settings: false
};
/** @type {?} */
var id = Math.random().toString(36).substr(2, 9);
/** @type {?} */
var chunks = id.match(/.{1,3}/g);
if (!chunks) {
throw new Error("ID generation failed. Couldn't generate chunks from random string");
}
this.id = chunks.join('-');
}
return PresentationState;
}());
if (false) {
/** @type {?} */
PresentationState.prototype.id;
/** @type {?} */
PresentationState.prototype.config;
/** @type {?} */
PresentationState.prototype.slides;
/** @type {?} */
PresentationState.prototype.sideBar;
}
var PresentationCommands = /** @class */ (function (_super) {
__extends(PresentationCommands, _super);
function PresentationCommands() {
return _super.call(this) || this;
}
/**
* @param {?} slides
* @return {?}
*/
PresentationCommands.prototype.setSlides = /**
* @param {?} slides
* @return {?}
*/
function (slides) {
this.state.slides = slides;
};
/**
* @param {?} config
* @return {?}
*/
PresentationCommands.prototype.mergeConfig = /**
* @param {?} config
* @return {?}
*/
function (config) {
this.state.config = mergeDeep(this.state.config, config);
};
/**
* @return {?}
*/
PresentationCommands.prototype.toggleSideBar = /**
* @return {?}
*/
function () {
this.state.sideBar = __assign(__assign({}, this.state.sideBar), { open: !this.state.sideBar.open });
};
/**
* @return {?}
*/
PresentationCommands.prototype.closeSideBar = /**
* @return {?}
*/
function () {
this.state.sideBar = __assign(__assign({}, this.state.sideBar), { open: false });
};
/**
* @return {?}
*/
PresentationCommands.prototype.openSideBar = /**
* @return {?}
*/
function () {
this.state.sideBar = __assign(__assign({}, this.state.sideBar), { open: true });
};
/**
* @return {?}
*/
PresentationCommands.prototype.enableSideBarExpertMode = /**
* @return {?}
*/
function () {
this.state.sideBar = __assign(__assign({}, this.state.sideBar), { expert: true, settings: true });
};
/**
* @param {?} id
* @return {?}
*/
PresentationCommands.prototype.setId = /**
* @param {?} id
* @return {?}
*/
function (id) {
this.state.id = id;
};
/**
* @param {?} theme
* @return {?}
*/
PresentationCommands.prototype.setCodeTheme = /**
* @param {?} theme
* @return {?}
*/
function (theme) {
this.state.config = __assign(__assign({}, this.state.config), { code: __assign(__assign({}, this.state.config.code), { theme: theme }) });
};
return PresentationCommands;
}(tydux.Commands));
/**
* @fileoverview added by tsickle
* Generated from: lib/core/presentation.functions.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/**
* @param {?} component
* @param {?} coordinates
* @param {?} index
* @return {?}
*/
function componentToSlide(component, coordinates, index) {
return new Slide(component, coordinates, index);
}
/**
* @param {?} components
* @param {?} coordinates
* @param {?} counter
* @return {?}
*/
function componentsToSlidesRecursive(components, coordinates, counter) {
if (Array.isArray(components)) {
return components.map((/**
* @param {?} x
* @param {?} i
* @return {?}
*/
function (x, i) {
/** @type {?} */
var newCoordinates = coordinates.slice();
newCoordinates.push(i + 1);
return componentsToSlidesRecursive(x, newCoordinates, counter);
}));
}
counter.index++;
return componentToSlide(components, coordinates, counter.index);
}
/**
* @param {?} slideComponents
* @return {?}
*/
function componentsToSlideTree(slideComponents) {
/** @type {?} */
var counter = {
index: -1
};
return slideComponents.map((/**
* @param {?} x
* @param {?} i
* @return {?}
*/
function (x, i) { return componentsToSlidesRecursive(x, [i + 1], counter); }));
}
/**
* @fileoverview added by tsickle
* Generated from: lib/core/presentation.service.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/** @type {?} */
var NGX_PRESENT_CONFIG = new core.InjectionToken('NgxPresentConfig');
/** @type {?} */
var SLIDES = new core.InjectionToken('SLIDES');
var PresentationService = /** @class */ (function (_super) {
__extends(PresentationService, _super);
function PresentationService(injector) {
var _this = _super.call(this, 'Presentation', new PresentationState(), new PresentationCommands()) || this;
// make mutate public
_this.dispatch = _this.commands;
/** @type {?} */
var slideComponents = injector.get(SLIDES);
/** @type {?} */
var config = injector.get(NGX_PRESENT_CONFIG);
/** @type {?} */
var slides = componentsToSlideTree(slideComponents);
_this.commands.setSlides(slides);
_this.commands.mergeConfig(config);
return _this;
}
/**
* @param {?} event
* @return {?}
*/
PresentationService.prototype.toggleSideBar = /**
* @param {?} event
* @return {?}
*/
function (event) {
if (event.altKey) {
this.commands.enableSideBarExpertMode();
}
this.commands.toggleSideBar();
};
PresentationService.decorators = [
{ type: core.Injectable, args: [{
providedIn: 'root'
},] }
];
/** @nocollapse */
PresentationService.ctorParameters = function () { return [
{ type: core.Injector }
]; };
/** @nocollapse */ PresentationService.ɵprov = core.ɵɵdefineInjectable({ factory: function PresentationService_Factory() { return new PresentationService(core.ɵɵinject(core.INJECTOR)); }, token: PresentationService, providedIn: "root" });
return PresentationService;
}(tydux.Facade));
if (false) {
/** @type {?} */
PresentationService.prototype.dispatch;
}
/**
* @fileoverview added by tsickle
* Generated from: lib/core/title.service.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
var AdvancedTitleService = /** @class */ (function () {
function AdvancedTitleService(title, presentation) {
this.title = title;
this.presentation = presentation;
this.original = title.getTitle();
}
/**
* @param {?} newTitle
* @return {?}
*/
AdvancedTitleService.prototype.setTitle = /**
* @param {?} newTitle
* @return {?}
*/
function (newTitle) {
var _this = this;
/** @type {?} */
var oldTitle = this.title.getTitle();
this.title.setTitle(newTitle);
this.lastReturnedUnset = ((/**
* @return {?}
*/
function () {
/** @type {?} */
var unset = (/**
* @return {?}
*/
function () {
if (_this.lastReturnedUnset === unset) {
_this.title.setTitle(oldTitle);
}
});
return unset;
}))();
return this.lastReturnedUnset;
};
/**
* @param {?} prefix
* @param {?=} separator
* @return {?}
*/
AdvancedTitleService.prototype.prefixTitle = /**
* @param {?} prefix
* @param {?=} separator
* @return {?}
*/
function (prefix, separator) {
if (separator === void 0) { separator = this.presentation.state.config.title.separator; }
return this.setTitle(prefix + separator + this.original);
};
AdvancedTitleService.decorators = [
{ type: core.Injectable, args: [{
providedIn: 'root'
},] }
];
/** @nocollapse */
AdvancedTitleService.ctorParameters = function () { return [
{ type: platformBrowser.Title },
{ type: PresentationService }
]; };
/** @nocollapse */ AdvancedTitleService.ɵprov = core.ɵɵdefineInjectable({ factory: function AdvancedTitleService_Factory() { return new AdvancedTitleService(core.ɵɵinject(platformBrowser.Title), core.ɵɵinject(PresentationService)); }, token: AdvancedTitleService, providedIn: "root" });
return AdvancedTitleService;
}());
if (false) {
/**
* @type {?}
* @private
*/
AdvancedTitleService.prototype.lastReturnedUnset;
/**
* @type {?}
* @private
*/
AdvancedTitleService.prototype.original;
/**
* @type {?}
* @private
*/
AdvancedTitleService.prototype.title;
/**
* @type {?}
* @private
*/
AdvancedTitleService.prototype.presentation;
}
/**
* @fileoverview added by tsickle
* Generated from: lib/core/page-title.directive.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
var PageTitleDirective = /** @class */ (function () {
function PageTitleDirective(title, element) {
this.title = title;
this.element = element;
}
/**
* @return {?}
*/
PageTitleDirective.prototype.ngAfterViewInit = /**
* @return {?}
*/
function () {
/** @type {?} */
var pageTitle = this.element.nativeElement.innerText;
this.unsetTitle = this.title.prefixTitle(pageTitle);
this.element.nativeElement.hidden = true;
};
/**
* @return {?}
*/
PageTitleDirective.prototype.ngOnDestroy = /**
* @return {?}
*/
function () {
if (this.unsetTitle) {
this.unsetTitle();
}
};
PageTitleDirective.decorators = [
{ type: core.Directive, args: [{
selector: '[ngxPresentPageTitle]'
},] }
];
/** @nocollapse */
PageTitleDirective.ctorParameters = function () { return [
{ type: AdvancedTitleService },
{ type: core.ElementRef }
]; };
return PageTitleDirective;
}());
if (false) {
/** @type {?} */
PageTitleDirective.prototype.unsetTitle;
/**
* @type {?}
* @private
*/
PageTitleDirective.prototype.title;
/**
* @type {?}
* @private
*/
PageTitleDirective.prototype.element;
}
/**
* @fileoverview added by tsickle
* Generated from: lib/core/event.service.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/**
* @param {?} event
* @return {?}
*/
function nonNavigationEvent(event) {
return noModifierPressed(event) && isNotEditable(event);
}
/**
* @param {?} event
* @return {?}
*/
function isNotEditable(event) {
/** @type {?} */
var srcElement = event.srcElement;
if (srcElement instanceof HTMLElement) {
/** @type {?} */
var tagName = srcElement.tagName;
if (tagName === 'INPUT' || tagName === 'TEXTAREA' || srcElement.isContentEditable) {
return false;
}
}
return true;
}
/**
* @param {?} event
* @return {?}
*/
function noModifierPressed(event) {
if (event.altKey || event.ctrlKey || event.shiftKey || event.metaKey) {
return false;
}
return true;
}
/**
* @abstract
*/
var /**
* @abstract
*/
KeyboardEventProcessor = /** @class */ (function () {
function KeyboardEventProcessor() {
}
return KeyboardEventProcessor;
}());
if (false) {
/**
* @abstract
* @param {?} events$
* @return {?}
*/
KeyboardEventProcessor.prototype.init = function (events$) { };
}
var ToggleSideNav = /** @class */ (function () {
function ToggleSideNav(service) {
this.service = service;
}
/**
* @param {?} events$
* @return {?}
*/
ToggleSideNav.prototype.init = /**
* @param {?} events$
* @return {?}
*/
function (events$) {
var _this = this;
events$
.pipe(operators.filter(isNotEditable), operators.filter((/**
* @param {?} event
* @return {?}
*/
function (event) { return !(event.ctrlKey || event.metaKey || event.shiftKey); })),
// letter m
operators.filter((/**
* @param {?} event
* @return {?}
*/
function (event) { return event.keyCode === 77; })))
.subscribe((/**
* @param {?} event
* @return {?}
*/
function (event) {
event.preventDefault();
_this.service.toggleSideBar(event);
}));
};
ToggleSideNav.decorators = [
{ type: core.Injectable }
];
/** @nocollapse */
ToggleSideNav.ctorParameters = function () { return [
{ type: PresentationService }
]; };
return ToggleSideNav;
}());
if (false) {
/**
* @type {?}
* @private
*/
ToggleSideNav.prototype.service;
}
/** @type {?} */
var KEYBOARD_EVENT_PROCESSOR_TOKEN = new core.InjectionToken('KEYBOARD_EVENT_PROCESSORS');
var EventService = /** @class */ (function () {
function EventService(injector) {
var e_1, _a;
this.keyboardEvents$ = new rxjs.Subject();
/** @type {?} */
var keyboardEventProcessors = injector.get(KEYBOARD_EVENT_PROCESSOR_TOKEN);
try {
for (var keyboardEventProcessors_1 = __values(keyboardEventProcessors), keyboardEventProcessors_1_1 = keyboardEventProcessors_1.next(); !keyboardEventProcessors_1_1.done; keyboardEventProcessors_1_1 = keyboardEventProcessors_1.next()) {
var processor = keyboardEventProcessors_1_1.value;
processor.init(this.keyboardEvents$);
}
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (keyboardEventProcessors_1_1 && !keyboardEventProcessors_1_1.done && (_a = keyboardEventProcessors_1.return)) _a.call(keyboardEventProcessors_1);
}
finally { if (e_1) throw e_1.error; }
}
}
/**
* @param {?} event
* @return {?}
*/
EventService.prototype.processKeyboardEvent = /**
* @param {?} event
* @return {?}
*/
function (event) {
// console.debug('EventService: emit keyboard event');
this.keyboardEvents$.next(event);
};
EventService.decorators = [
{ type: core.Injectable, args: [{
providedIn: 'root'
},] }
];
/** @nocollapse */
EventService.ctorParameters = function () { return [
{ type: core.Injector }
]; };
/** @nocollapse */ EventService.ɵprov = core.ɵɵdefineInjectable({ factory: function EventService_Factory() { return new EventService(core.ɵɵinject(core.INJECTOR)); }, token: EventService, providedIn: "root" });
return EventService;
}());
if (false) {
/**
* @type {?}
* @private
*/
EventService.prototype.keyboardEvents$;
}
/**
* @fileoverview added by tsickle
* Generated from: lib/theming/table-of-content.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/** @type {?} */
var tableOfContentMetadataKey = Symbol('TableOfContentEntry');
/**
* @record
*/
function DecoratorMetadata() { }
if (false) {
/** @type {?} */
DecoratorMetadata.prototype.linkName;
}
// Decorator
/**
* @param {?} config
* @return {?}
*/
function TableOfContentEntry(config) {
return (/**
* @param {?} constructor
* @return {?}
*/
function (constructor) {
// TODO: get rid of cast to any, include proper Reflect typings
((/** @type {?} */ (Reflect))).defineMetadata(tableOfContentMetadataKey, config, constructor);
});
}
/**
* @param {?} slide
* @return {?}
*/
function tableOfContentMetadata(slide) {
/** @type {?} */
var decoratorMetadata = ((/** @type {?} */ (Reflect))).getMetadata(tableOfContentMetadataKey, slide.component);
return decoratorMetadata;
}
/**
* @param {?} slides
* @return {?}
*/
function tableOfContentSlides(slides) {
return slides.filter((/**
* @param {?} slide
* @return {?}
*/
function (slide) { return tableOfContentMetadata(slide) !== undefined; }));
}
/**
* @fileoverview added by tsickle
* Generated from: lib/slide-by-slide/slide-by-slide.functions.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/**
* @param {?} slides
* @param {?} currentSlide
* @param {?} move
* @param {?} coordinatesToKeep
* @param {?} coordinatesMaxDepth
* @return {?}
*/
function calculateCoordinates(slides, currentSlide, move, coordinatesToKeep, coordinatesMaxDepth) {
if (move === 0) {
return currentSlide;
}
if (coordinatesToKeep === undefined) {
return slides[currentSlide.index + move];
}
/** @type {?} */
var currentCoordinates = currentSlide.coordinates;
/** @type {?} */
var coordinatesToKeepAbs = coordinatesToKeepAbsolute(currentCoordinates, coordinatesToKeep);
/** @type {?} */
var newCoordinates = currentCoordinates.slice(0, coordinatesToKeepAbs);
if (move > 0 && coordinatesToKeepAbs < currentCoordinates.length) {
newCoordinates.push(currentCoordinates[coordinatesToKeepAbs] + move);
}
else if (move > 0) {
newCoordinates.push(move);
}
else if (move < 0 && currentCoordinates[coordinatesToKeepAbs + 1] !== undefined && currentCoordinates[coordinatesToKeepAbs + 1] > 1) {
newCoordinates.push(currentCoordinates[coordinatesToKeepAbs] + move + 1);
}
else if (move < 0 && coordinatesToKeepAbs < currentCoordinates.length) {
newCoordinates.push(max(1, currentCoordinates[coordinatesToKeepAbs] + move));
}
else if (move < 0) {
newCoordinates.push(1);
}
if (move < 0) {
while (newCoordinates.length <= coordinatesMaxDepth) {
newCoordinates.push(1);
}
}
/** @type {?} */
var arrayToSearchIn;
if (move >= 0) {
arrayToSearchIn = slides.slice(currentSlide.index + 1);
}
else {
arrayToSearchIn = slides.slice(0, currentSlide.index).reverse();
}
/** @type {?} */
var nextSlide = arrayToSearchIn.find((/**
* @param {?} slide
* @return {?}
*/
function (slide) {
/** @type {?} */
var compared = compareCoordinates(slide.coordinates, newCoordinates);
if (move < 0) {
return compared <= 0;
}
else {
return compared >= 0;
}
}));
return nextSlide;
}
/**
* @param {?} coordinates
* @param {?} coordinatesToKeepRelative
* @return {?}
*/
function coordinatesToKeepAbsolute(coordinates, coordinatesToKeepRelative) {
if (coordinatesToKeepRelative >= 0) {
return min(coordinatesToKeepRelative, coordinates.length);
}
return max(coordinates.length + coordinatesToKeepRelative, 0);
}
/** @type {?} */
var routerParamsCoordinatePrefix = 'coordinate-';
/**
* @param {?} routeParams
* @return {?}
*/
function routeParamsToCoordinate(routeParams) {
/** @type {?} */
var keys = Object.keys(routeParams);
/** @type {?} */
var coordinates = keys
.filter((/**
* @param {?} key
* @return {?}
*/
function (key) { return key.startsWith(routerParamsCoordinatePrefix); }))
.map((/**
* @param {?} key
* @return {?}
*/
function (key) {
/** @type {?} */
var keyNumber = parseInt(key.substr(routerParamsCoordinatePrefix.length), 10);
return { key: key, keyNumber: keyNumber };
}))
.sort((/**
* @param {?} a
* @param {?} b
* @return {?}
*/
function (a, b) { return compareNumber(a.keyNumber, b.keyNumber); }))
.map((/**
* @param {?} key
* @return {?}
*/
function (key) { return parseInt(routeParams[key.key], 10); }));
return coordinates;
}
/**
* @param {?} a
* @param {?} b
* @return {?}
*/
function compareNumber(a, b) {
if (a !== undefined && b === undefined) {
return 1;
}
if (a === undefined && b !== undefined) {
return -1;
}
if (a === undefined && b === undefined) {
return 0;
}
if (a !== undefined && b !== undefined && a > b) {
return 1;
}
if (a !== undefined && b !== undefined && a < b) {
return -1;
}
return 0;
}
/**
* @param {?} c1
* @param {?} c2
* @return {?}
*/
function equalCoordinates(c1, c2) {
return compareCoordinates(c1, c2) === 0;
}
/**
* @param {?} c1
* @param {?} c2
* @return {?}
*/
function compareCoordinates(c1, c2) {
if (c1 === c2) {
return 0;
}
if (c1 === null || c1 === undefined) {
return -1;
}
if (c2 === null || c2 === undefined) {
return 1;
}
/** @type {?} */
var maxLength = max(c1.length, c2.length);
for (var i = 0; i < maxLength; i++) {
/** @type {?} */
var c1i = c1[i];
/** @type {?} */
var c2i = c2[i];
/** @type {?} */
var iResult = compareNumber(c1i, c2i);
if (iResult !== 0) {
return iResult;
}
}
return 0;
}
/**
* @param {?} slides
* @param {?} coordinates
* @return {?}
*/
function isValidCoordinate(slides, coordinates) {
var e_1, _a;
if (coordinates.length === 0) {
return false;
}
/** @type {?} */
var current = slides;
try {
for (var coordinates_1 = __values(coordinates), coordinates_1_1 = coordinates_1.next(); !coordinates_1_1.done; coordinates_1_1 = coordinates_1.next()) {
var coordinate = coordinates_1_1.value;
/** @type {?} */
var tooLow = coordinate < 1;
/** @type {?} */
var tooHigh = Array.isArray(current) && coordinate - 1 >= current.length;
if (tooLow || tooHigh) {
return false;
}
/** @type {?} */
var next = current[coordinate - 1];
if (Array.isArray(next)) {
current = next;
}
else {
current = [];
}
}
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (coordinates_1_1 && !coordinates_1_1.done && (_a = coordinates_1.return)) _a.call(coordinates_1);
}
finally { if (e_1) throw e_1.error; }
}
return true;
}
/**
* @param {?} coordinates
* @param {?} separator
* @param {?=} length
* @return {?}
*/
function coordinatesToString(coordinates, separator, length) {
return coordinates.slice(0,