@covalent/flavored-markdown 4.0.0 → 4.1.0-develop.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/README.md +37 -44
  2. package/_flavored-markdown-theme.scss +1 -0
  3. package/covalent-flavored-markdown.d.ts +2 -2
  4. package/esm2020/covalent-flavored-markdown.mjs +5 -0
  5. package/esm2020/lib/cfm-list/cfm-list.component.mjs +60 -0
  6. package/esm2020/lib/flavored-markdown-loader/flavored-markdown-loader.component.mjs +104 -0
  7. package/esm2020/lib/flavored-markdown.component.mjs +501 -0
  8. package/esm2020/lib/flavored-markdown.module.mjs +69 -0
  9. package/esm2020/public_api.mjs +4 -0
  10. package/fesm2015/covalent-flavored-markdown.mjs +794 -0
  11. package/fesm2015/covalent-flavored-markdown.mjs.map +1 -0
  12. package/fesm2020/covalent-flavored-markdown.mjs +722 -0
  13. package/fesm2020/covalent-flavored-markdown.mjs.map +1 -0
  14. package/lib/cfm-list/cfm-list.component.d.ts +11 -0
  15. package/{flavored-markdown-loader → lib/flavored-markdown-loader}/flavored-markdown-loader.component.d.ts +8 -5
  16. package/{flavored-markdown.component.d.ts → lib/flavored-markdown.component.d.ts} +11 -2
  17. package/lib/flavored-markdown.module.d.ts +18 -0
  18. package/package.json +40 -28
  19. package/public_api.d.ts +3 -3
  20. package/bundles/covalent-flavored-markdown.umd.js +0 -1310
  21. package/bundles/covalent-flavored-markdown.umd.js.map +0 -1
  22. package/bundles/covalent-flavored-markdown.umd.min.js +0 -16
  23. package/bundles/covalent-flavored-markdown.umd.min.js.map +0 -1
  24. package/cfm-list/cfm-list.component.d.ts +0 -8
  25. package/cfm-list/cfm-list.component.scss +0 -0
  26. package/covalent-flavored-markdown.metadata.json +0 -1
  27. package/esm2015/cfm-list/cfm-list.component.js +0 -39
  28. package/esm2015/covalent-flavored-markdown.js +0 -11
  29. package/esm2015/flavored-markdown-loader/flavored-markdown-loader.component.js +0 -159
  30. package/esm2015/flavored-markdown.component.js +0 -754
  31. package/esm2015/flavored-markdown.module.js +0 -45
  32. package/esm2015/index.js +0 -7
  33. package/esm2015/public_api.js +0 -9
  34. package/fesm2015/covalent-flavored-markdown.js +0 -1005
  35. package/fesm2015/covalent-flavored-markdown.js.map +0 -1
  36. package/flavored-markdown-loader/flavored-markdown-loader.component.scss +0 -26
  37. package/flavored-markdown.component.scss +0 -31
  38. package/flavored-markdown.module.d.ts +0 -2
  39. package/index.d.ts +0 -1
@@ -1,1310 +0,0 @@
1
- (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/material/checkbox'), require('@angular/material/sort'), require('@angular/material/table'), require('@covalent/highlight'), require('@covalent/markdown'), require('@angular/common'), require('@angular/material/list'), require('@angular/material/progress-bar'), require('@angular/material/button')) :
3
- typeof define === 'function' && define.amd ? define('@covalent/flavored-markdown', ['exports', '@angular/core', '@angular/material/checkbox', '@angular/material/sort', '@angular/material/table', '@covalent/highlight', '@covalent/markdown', '@angular/common', '@angular/material/list', '@angular/material/progress-bar', '@angular/material/button'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.covalent = global.covalent || {}, global.covalent['flavored-markdown'] = {}), global.ng.core, global.ng.material.checkbox, global.ng.material.sort, global.ng.material.table, global.covalent.highlight, global.covalent.markdown, global.ng.common, global.ng.material.list, global.ng.material.progressBar, global.ng.material.button));
5
- }(this, (function (exports, core, checkbox, sort, table, highlight, markdown, common, list, progressBar, button) { 'use strict';
6
-
7
- /*! *****************************************************************************
8
- Copyright (c) Microsoft Corporation.
9
-
10
- Permission to use, copy, modify, and/or distribute this software for any
11
- purpose with or without fee is hereby granted.
12
-
13
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
14
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
15
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
16
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
17
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
18
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19
- PERFORMANCE OF THIS SOFTWARE.
20
- ***************************************************************************** */
21
- /* global Reflect, Promise */
22
- var extendStatics = function (d, b) {
23
- extendStatics = Object.setPrototypeOf ||
24
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
25
- function (d, b) { for (var p in b)
26
- if (Object.prototype.hasOwnProperty.call(b, p))
27
- d[p] = b[p]; };
28
- return extendStatics(d, b);
29
- };
30
- function __extends(d, b) {
31
- extendStatics(d, b);
32
- function __() { this.constructor = d; }
33
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
34
- }
35
- var __assign = function () {
36
- __assign = Object.assign || function __assign(t) {
37
- for (var s, i = 1, n = arguments.length; i < n; i++) {
38
- s = arguments[i];
39
- for (var p in s)
40
- if (Object.prototype.hasOwnProperty.call(s, p))
41
- t[p] = s[p];
42
- }
43
- return t;
44
- };
45
- return __assign.apply(this, arguments);
46
- };
47
- function __rest(s, e) {
48
- var t = {};
49
- for (var p in s)
50
- if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
51
- t[p] = s[p];
52
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
53
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
54
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
55
- t[p[i]] = s[p[i]];
56
- }
57
- return t;
58
- }
59
- function __decorate(decorators, target, key, desc) {
60
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
61
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
62
- r = Reflect.decorate(decorators, target, key, desc);
63
- else
64
- for (var i = decorators.length - 1; i >= 0; i--)
65
- if (d = decorators[i])
66
- r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
67
- return c > 3 && r && Object.defineProperty(target, key, r), r;
68
- }
69
- function __param(paramIndex, decorator) {
70
- return function (target, key) { decorator(target, key, paramIndex); };
71
- }
72
- function __metadata(metadataKey, metadataValue) {
73
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
74
- return Reflect.metadata(metadataKey, metadataValue);
75
- }
76
- function __awaiter(thisArg, _arguments, P, generator) {
77
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
78
- return new (P || (P = Promise))(function (resolve, reject) {
79
- function fulfilled(value) { try {
80
- step(generator.next(value));
81
- }
82
- catch (e) {
83
- reject(e);
84
- } }
85
- function rejected(value) { try {
86
- step(generator["throw"](value));
87
- }
88
- catch (e) {
89
- reject(e);
90
- } }
91
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
92
- step((generator = generator.apply(thisArg, _arguments || [])).next());
93
- });
94
- }
95
- function __generator(thisArg, body) {
96
- var _ = { label: 0, sent: function () { if (t[0] & 1)
97
- throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
98
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g;
99
- function verb(n) { return function (v) { return step([n, v]); }; }
100
- function step(op) {
101
- if (f)
102
- throw new TypeError("Generator is already executing.");
103
- while (_)
104
- try {
105
- 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)
106
- return t;
107
- if (y = 0, t)
108
- op = [op[0] & 2, t.value];
109
- switch (op[0]) {
110
- case 0:
111
- case 1:
112
- t = op;
113
- break;
114
- case 4:
115
- _.label++;
116
- return { value: op[1], done: false };
117
- case 5:
118
- _.label++;
119
- y = op[1];
120
- op = [0];
121
- continue;
122
- case 7:
123
- op = _.ops.pop();
124
- _.trys.pop();
125
- continue;
126
- default:
127
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
128
- _ = 0;
129
- continue;
130
- }
131
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {
132
- _.label = op[1];
133
- break;
134
- }
135
- if (op[0] === 6 && _.label < t[1]) {
136
- _.label = t[1];
137
- t = op;
138
- break;
139
- }
140
- if (t && _.label < t[2]) {
141
- _.label = t[2];
142
- _.ops.push(op);
143
- break;
144
- }
145
- if (t[2])
146
- _.ops.pop();
147
- _.trys.pop();
148
- continue;
149
- }
150
- op = body.call(thisArg, _);
151
- }
152
- catch (e) {
153
- op = [6, e];
154
- y = 0;
155
- }
156
- finally {
157
- f = t = 0;
158
- }
159
- if (op[0] & 5)
160
- throw op[1];
161
- return { value: op[0] ? op[1] : void 0, done: true };
162
- }
163
- }
164
- var __createBinding = Object.create ? (function (o, m, k, k2) {
165
- if (k2 === undefined)
166
- k2 = k;
167
- Object.defineProperty(o, k2, { enumerable: true, get: function () { return m[k]; } });
168
- }) : (function (o, m, k, k2) {
169
- if (k2 === undefined)
170
- k2 = k;
171
- o[k2] = m[k];
172
- });
173
- function __exportStar(m, o) {
174
- for (var p in m)
175
- if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p))
176
- __createBinding(o, m, p);
177
- }
178
- function __values(o) {
179
- var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
180
- if (m)
181
- return m.call(o);
182
- if (o && typeof o.length === "number")
183
- return {
184
- next: function () {
185
- if (o && i >= o.length)
186
- o = void 0;
187
- return { value: o && o[i++], done: !o };
188
- }
189
- };
190
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
191
- }
192
- function __read(o, n) {
193
- var m = typeof Symbol === "function" && o[Symbol.iterator];
194
- if (!m)
195
- return o;
196
- var i = m.call(o), r, ar = [], e;
197
- try {
198
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
199
- ar.push(r.value);
200
- }
201
- catch (error) {
202
- e = { error: error };
203
- }
204
- finally {
205
- try {
206
- if (r && !r.done && (m = i["return"]))
207
- m.call(i);
208
- }
209
- finally {
210
- if (e)
211
- throw e.error;
212
- }
213
- }
214
- return ar;
215
- }
216
- function __spread() {
217
- for (var ar = [], i = 0; i < arguments.length; i++)
218
- ar = ar.concat(__read(arguments[i]));
219
- return ar;
220
- }
221
- function __spreadArrays() {
222
- for (var s = 0, i = 0, il = arguments.length; i < il; i++)
223
- s += arguments[i].length;
224
- for (var r = Array(s), k = 0, i = 0; i < il; i++)
225
- for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
226
- r[k] = a[j];
227
- return r;
228
- }
229
- ;
230
- function __await(v) {
231
- return this instanceof __await ? (this.v = v, this) : new __await(v);
232
- }
233
- function __asyncGenerator(thisArg, _arguments, generator) {
234
- if (!Symbol.asyncIterator)
235
- throw new TypeError("Symbol.asyncIterator is not defined.");
236
- var g = generator.apply(thisArg, _arguments || []), i, q = [];
237
- return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
238
- function verb(n) { if (g[n])
239
- i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
240
- function resume(n, v) { try {
241
- step(g[n](v));
242
- }
243
- catch (e) {
244
- settle(q[0][3], e);
245
- } }
246
- function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
247
- function fulfill(value) { resume("next", value); }
248
- function reject(value) { resume("throw", value); }
249
- function settle(f, v) { if (f(v), q.shift(), q.length)
250
- resume(q[0][0], q[0][1]); }
251
- }
252
- function __asyncDelegator(o) {
253
- var i, p;
254
- return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
255
- 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; }
256
- }
257
- function __asyncValues(o) {
258
- if (!Symbol.asyncIterator)
259
- throw new TypeError("Symbol.asyncIterator is not defined.");
260
- var m = o[Symbol.asyncIterator], i;
261
- 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);
262
- 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); }); }; }
263
- function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }
264
- }
265
- function __makeTemplateObject(cooked, raw) {
266
- if (Object.defineProperty) {
267
- Object.defineProperty(cooked, "raw", { value: raw });
268
- }
269
- else {
270
- cooked.raw = raw;
271
- }
272
- return cooked;
273
- }
274
- ;
275
- var __setModuleDefault = Object.create ? (function (o, v) {
276
- Object.defineProperty(o, "default", { enumerable: true, value: v });
277
- }) : function (o, v) {
278
- o["default"] = v;
279
- };
280
- function __importStar(mod) {
281
- if (mod && mod.__esModule)
282
- return mod;
283
- var result = {};
284
- if (mod != null)
285
- for (var k in mod)
286
- if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
287
- __createBinding(result, mod, k);
288
- __setModuleDefault(result, mod);
289
- return result;
290
- }
291
- function __importDefault(mod) {
292
- return (mod && mod.__esModule) ? mod : { default: mod };
293
- }
294
- function __classPrivateFieldGet(receiver, privateMap) {
295
- if (!privateMap.has(receiver)) {
296
- throw new TypeError("attempted to get private field on non-instance");
297
- }
298
- return privateMap.get(receiver);
299
- }
300
- function __classPrivateFieldSet(receiver, privateMap, value) {
301
- if (!privateMap.has(receiver)) {
302
- throw new TypeError("attempted to set private field on non-instance");
303
- }
304
- privateMap.set(receiver, value);
305
- return value;
306
- }
307
-
308
- /**
309
- * @fileoverview added by tsickle
310
- * Generated from: cfm-list/cfm-list.component.ts
311
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
312
- */
313
- /**
314
- * @record
315
- */
316
- function IFlavoredListItem() { }
317
- if (false) {
318
- /** @type {?} */
319
- IFlavoredListItem.prototype.line;
320
- /** @type {?|undefined} */
321
- IFlavoredListItem.prototype.sublines;
322
- }
323
- var TdFlavoredListComponent = /** @class */ (function () {
324
- function TdFlavoredListComponent() {
325
- this.dense = false;
326
- }
327
- return TdFlavoredListComponent;
328
- }());
329
- TdFlavoredListComponent.decorators = [
330
- { type: core.Component, args: [{
331
- selector: 'cfm-list',
332
- template: "<mat-list [attr.dense]=\"dense ? true : null\">\n <ng-template let-line let-last=\"last\" ngFor [ngForOf]=\"lines\">\n <mat-list-item>\n <h4 matLine>\n {{ line.line }}\n </h4>\n <p *ngFor=\"let subline of line.sublines\" matLine>\n {{ subline }}\n </p>\n <mat-divider *ngIf=\"!last\"></mat-divider>\n </mat-list-item>\n </ng-template>\n</mat-list>\n",
333
- styles: [""]
334
- }] }
335
- ];
336
- TdFlavoredListComponent.propDecorators = {
337
- lines: [{ type: core.Input }],
338
- dense: [{ type: core.Input }]
339
- };
340
- if (false) {
341
- /** @type {?} */
342
- TdFlavoredListComponent.prototype.lines;
343
- /** @type {?} */
344
- TdFlavoredListComponent.prototype.dense;
345
- }
346
-
347
- /**
348
- * @record
349
- */
350
- function ITdFlavoredMarkdownButtonClickEvent() { }
351
- if (false) {
352
- /** @type {?} */
353
- ITdFlavoredMarkdownButtonClickEvent.prototype.text;
354
- /** @type {?} */
355
- ITdFlavoredMarkdownButtonClickEvent.prototype.data;
356
- }
357
- /**
358
- * @record
359
- */
360
- function ITdFlavoredMarkDownTableColumn() { }
361
- if (false) {
362
- /** @type {?} */
363
- ITdFlavoredMarkDownTableColumn.prototype.label;
364
- /** @type {?} */
365
- ITdFlavoredMarkDownTableColumn.prototype.name;
366
- /** @type {?} */
367
- ITdFlavoredMarkDownTableColumn.prototype.numeric;
368
- }
369
- var TdFlavoredMarkdownTableComponent = /** @class */ (function () {
370
- function TdFlavoredMarkdownTableComponent() {
371
- this.columnDefs = [];
372
- }
373
- /**
374
- * @return {?}
375
- */
376
- TdFlavoredMarkdownTableComponent.prototype.ngOnInit = function () {
377
- this.displayedColumns = this.columnDefs.map(( /**
378
- * @param {?} c
379
- * @return {?}
380
- */function (c) { return c.name; }));
381
- this.dataSource = new table.MatTableDataSource(this.data);
382
- };
383
- /**
384
- * @return {?}
385
- */
386
- TdFlavoredMarkdownTableComponent.prototype.ngAfterViewInit = function () {
387
- this.dataSource.sort = this.sort;
388
- };
389
- return TdFlavoredMarkdownTableComponent;
390
- }());
391
- TdFlavoredMarkdownTableComponent.decorators = [
392
- { type: core.Component, args: [{
393
- template: "\n <mat-table [dataSource]=\"dataSource\" matSort>\n <!-- Column Definition -->\n <ng-template ngFor let-column [ngForOf]=\"columnDefs\">\n <ng-container [matColumnDef]=\"column.name\">\n <mat-header-cell *matHeaderCellDef mat-sort-header>{{ column.label }}</mat-header-cell>\n <mat-cell *matCellDef=\"let row\">{{ row[column.name] }}</mat-cell>\n </ng-container>\n </ng-template>\n <!-- Header and Row Declarations -->\n <mat-header-row *matHeaderRowDef=\"displayedColumns\"></mat-header-row>\n <mat-row *matRowDef=\"let row; columns: displayedColumns\"></mat-row>\n </mat-table>\n "
394
- }] }
395
- ];
396
- TdFlavoredMarkdownTableComponent.propDecorators = {
397
- columnDefs: [{ type: core.Input }],
398
- data: [{ type: core.Input }],
399
- sort: [{ type: core.ViewChild, args: [sort.MatSort,] }]
400
- };
401
- if (false) {
402
- /** @type {?} */
403
- TdFlavoredMarkdownTableComponent.prototype.columnDefs;
404
- /** @type {?} */
405
- TdFlavoredMarkdownTableComponent.prototype.data;
406
- /** @type {?} */
407
- TdFlavoredMarkdownTableComponent.prototype.sort;
408
- /** @type {?} */
409
- TdFlavoredMarkdownTableComponent.prototype.displayedColumns;
410
- /** @type {?} */
411
- TdFlavoredMarkdownTableComponent.prototype.dataSource;
412
- }
413
- var TdFlavoredMarkdownButtonComponent = /** @class */ (function () {
414
- function TdFlavoredMarkdownButtonComponent() {
415
- this.display = 'inline-block';
416
- this.text = '';
417
- this.data = '';
418
- this.clicked = new core.EventEmitter();
419
- }
420
- /**
421
- * @return {?}
422
- */
423
- TdFlavoredMarkdownButtonComponent.prototype.emitClick = function () {
424
- this.clicked.emit({ text: this.text, data: this.data });
425
- };
426
- return TdFlavoredMarkdownButtonComponent;
427
- }());
428
- TdFlavoredMarkdownButtonComponent.decorators = [
429
- { type: core.Component, args: [{
430
- template: "\n <button mat-raised-button (click)=\"emitClick()\">\n {{ text }}\n </button>\n "
431
- }] }
432
- ];
433
- TdFlavoredMarkdownButtonComponent.propDecorators = {
434
- display: [{ type: core.HostBinding, args: ['style.display',] }],
435
- text: [{ type: core.Input }],
436
- data: [{ type: core.Input }],
437
- clicked: [{ type: core.Output }]
438
- };
439
- if (false) {
440
- /** @type {?} */
441
- TdFlavoredMarkdownButtonComponent.prototype.display;
442
- /** @type {?} */
443
- TdFlavoredMarkdownButtonComponent.prototype.text;
444
- /** @type {?} */
445
- TdFlavoredMarkdownButtonComponent.prototype.data;
446
- /** @type {?} */
447
- TdFlavoredMarkdownButtonComponent.prototype.clicked;
448
- }
449
- var TdFlavoredMarkdownContainerDirective = /** @class */ (function () {
450
- /**
451
- * @param {?} viewContainerRef
452
- * @param {?} _renderer
453
- */
454
- function TdFlavoredMarkdownContainerDirective(viewContainerRef, _renderer) {
455
- this.viewContainerRef = viewContainerRef;
456
- this._renderer = _renderer;
457
- }
458
- /**
459
- * @return {?}
460
- */
461
- TdFlavoredMarkdownContainerDirective.prototype.clear = function () {
462
- this._renderer.setProperty(this.viewContainerRef.element.nativeElement, 'innerHTML', '');
463
- this.viewContainerRef.clear();
464
- };
465
- return TdFlavoredMarkdownContainerDirective;
466
- }());
467
- TdFlavoredMarkdownContainerDirective.decorators = [
468
- { type: core.Directive, args: [{
469
- selector: '[tdFlavoredMarkdownContainer]',
470
- },] }
471
- ];
472
- /** @nocollapse */
473
- TdFlavoredMarkdownContainerDirective.ctorParameters = function () { return [
474
- { type: core.ViewContainerRef },
475
- { type: core.Renderer2 }
476
- ]; };
477
- if (false) {
478
- /** @type {?} */
479
- TdFlavoredMarkdownContainerDirective.prototype.viewContainerRef;
480
- /**
481
- * @type {?}
482
- * @private
483
- */
484
- TdFlavoredMarkdownContainerDirective.prototype._renderer;
485
- }
486
- var TdFlavoredMarkdownComponent = /** @class */ (function () {
487
- /**
488
- * @param {?} _componentFactoryResolver
489
- * @param {?} _renderer
490
- * @param {?} _changeDetectorRef
491
- * @param {?} _injector
492
- * @param {?} _elementRef
493
- */
494
- function TdFlavoredMarkdownComponent(_componentFactoryResolver, _renderer, _changeDetectorRef, _injector, _elementRef) {
495
- this._componentFactoryResolver = _componentFactoryResolver;
496
- this._renderer = _renderer;
497
- this._changeDetectorRef = _changeDetectorRef;
498
- this._injector = _injector;
499
- this._elementRef = _elementRef;
500
- this._simpleLineBreaks = false;
501
- this._components = {};
502
- this._viewInit = false;
503
- /**
504
- * copyCodeToClipboard?: boolean
505
- *
506
- * Display copy button on code snippets to copy code to clipboard.
507
- *
508
- */
509
- this.copyCodeToClipboard = false;
510
- /**
511
- * copyCodeTooltips?: ICopyCodeTooltips
512
- *
513
- * Tooltips for copy button to copy and upon copying.
514
- */
515
- this.copyCodeTooltips = {};
516
- /**
517
- * contentReady?: function
518
- * Event emitted after the markdown content rendering is finished.
519
- */
520
- this.contentReady = new core.EventEmitter();
521
- /**
522
- * buttonClicked?: ITdFlavoredMarkdownButtonClickEvent
523
- * Event emitted when a button is clicked
524
- * Is an object containing text and data of button
525
- */
526
- this.buttonClicked = new core.EventEmitter();
527
- }
528
- Object.defineProperty(TdFlavoredMarkdownComponent.prototype, "content", {
529
- /**
530
- * content?: string
531
- *
532
- * Markdown format content to be parsed as material/covalent markup.
533
- *
534
- * e.g. README.md content.
535
- * @param {?} content
536
- * @return {?}
537
- */
538
- set: function (content) {
539
- this._content = content;
540
- },
541
- enumerable: false,
542
- configurable: true
543
- });
544
- Object.defineProperty(TdFlavoredMarkdownComponent.prototype, "simpleLineBreaks", {
545
- /**
546
- * simpleLineBreaks?: string
547
- *
548
- * Sets whether newline characters inside paragraphs and spans are parsed as <br/>.
549
- * Defaults to false.
550
- * @param {?} simpleLineBreaks
551
- * @return {?}
552
- */
553
- set: function (simpleLineBreaks) {
554
- this._simpleLineBreaks = simpleLineBreaks;
555
- },
556
- enumerable: false,
557
- configurable: true
558
- });
559
- Object.defineProperty(TdFlavoredMarkdownComponent.prototype, "hostedUrl", {
560
- /**
561
- * hostedUrl?: string
562
- *
563
- * If markdown contains relative paths, this is required to generate correct urls
564
- *
565
- * @param {?} hostedUrl
566
- * @return {?}
567
- */
568
- set: function (hostedUrl) {
569
- this._hostedUrl = hostedUrl;
570
- },
571
- enumerable: false,
572
- configurable: true
573
- });
574
- Object.defineProperty(TdFlavoredMarkdownComponent.prototype, "anchor", {
575
- /**
576
- * anchor?: string
577
- *
578
- * Anchor to jump to
579
- *
580
- * @param {?} anchor
581
- * @return {?}
582
- */
583
- set: function (anchor) {
584
- this._anchor = anchor;
585
- },
586
- enumerable: false,
587
- configurable: true
588
- });
589
- /**
590
- * @param {?} changes
591
- * @return {?}
592
- */
593
- TdFlavoredMarkdownComponent.prototype.ngOnChanges = function (changes) {
594
- // only anchor changed
595
- if (changes.anchor && !changes.content && !changes.simpleLineBreaks && !changes.hostedUrl) {
596
- markdown.scrollToAnchor(this._elementRef.nativeElement, this._anchor, false);
597
- }
598
- else {
599
- this.refresh();
600
- }
601
- };
602
- /**
603
- * @return {?}
604
- */
605
- TdFlavoredMarkdownComponent.prototype.ngAfterViewInit = function () {
606
- var _this = this;
607
- if (!this._content) {
608
- this._loadContent((( /** @type {?} */(this.container.viewContainerRef.element.nativeElement))).textContent);
609
- Promise.resolve().then(( /**
610
- * @return {?}
611
- */function () {
612
- _this._viewInit = true;
613
- _this._changeDetectorRef.markForCheck();
614
- }));
615
- }
616
- };
617
- /**
618
- * @return {?}
619
- */
620
- TdFlavoredMarkdownComponent.prototype.refresh = function () {
621
- if (this._content) {
622
- this._loadContent(this._content);
623
- }
624
- else if (this._viewInit) {
625
- this._loadContent((( /** @type {?} */(this.container.viewContainerRef.element.nativeElement))).textContent);
626
- }
627
- this._changeDetectorRef.markForCheck();
628
- };
629
- /**
630
- * @private
631
- * @param {?} markdown
632
- * @return {?}
633
- */
634
- TdFlavoredMarkdownComponent.prototype._loadContent = function (markdown$1) {
635
- var _this = this;
636
- if (markdown$1 && markdown$1.trim().length > 0) {
637
- this.container.clear();
638
- markdown$1 = markdown$1.replace(/^(\s|\t)*\n+/g, '').replace(/(\s|\t)*\n+(\s|\t)*$/g, '');
639
- // Split markdown by line characters
640
- /** @type {?} */
641
- var lines = markdown$1.split('\n');
642
- // check how much indentation is used by the first actual markdown line
643
- /** @type {?} */
644
- var firstLineWhitespace = lines[0].match(/^(\s|\t)*/)[0];
645
- // Remove all indentation spaces so markdown can be parsed correctly
646
- /** @type {?} */
647
- var startingWhitespaceRegex_1 = new RegExp('^' + firstLineWhitespace);
648
- lines = lines.map(( /**
649
- * @param {?} line
650
- * @return {?}
651
- */function (line) {
652
- return line.replace(startingWhitespaceRegex_1, '');
653
- }));
654
- // Join lines again with line characters
655
- markdown$1 = __spread(lines, ['', '']).join('\n');
656
- markdown$1 = this._replaceCodeBlocks(markdown$1);
657
- markdown$1 = this._replaceCheckbox(markdown$1);
658
- markdown$1 = this._replaceTables(markdown$1);
659
- markdown$1 = this._replaceLists(markdown$1);
660
- markdown$1 = this._replaceButtons(markdown$1);
661
- /** @type {?} */
662
- var keys = Object.keys(this._components);
663
- // need to sort the placeholders in order of encounter in markdown content
664
- keys.sort(( /**
665
- * @param {?} compA
666
- * @param {?} compB
667
- * @return {?}
668
- */function (compA, compB) {
669
- return markdown$1.indexOf(compA) > markdown$1.indexOf(compB) ? 1 : -1;
670
- }));
671
- this._render(markdown$1, keys[0], keys);
672
- // TODO: timeout required since resizing of html elements occurs which causes a change in the scroll position
673
- setTimeout(( /**
674
- * @return {?}
675
- */function () { return markdown.scrollToAnchor(_this._elementRef.nativeElement, _this._anchor, false); }), 250);
676
- this.contentReady.emit();
677
- Promise.resolve().then(( /**
678
- * @return {?}
679
- */function () {
680
- _this._changeDetectorRef.markForCheck();
681
- }));
682
- }
683
- };
684
- /**
685
- * @private
686
- * @param {?} markdown
687
- * @param {?} key
688
- * @param {?} keys
689
- * @return {?}
690
- */
691
- TdFlavoredMarkdownComponent.prototype._render = function (markdown$1, key, keys) {
692
- if (!markdown$1) {
693
- return;
694
- }
695
- if (key && markdown$1.indexOf(key) > -1) {
696
- /** @type {?} */
697
- var markdownParts = markdown$1.split(key);
698
- keys.shift();
699
- this._render(markdownParts[0], undefined, undefined);
700
- this.container.viewContainerRef.insert(this._components[key].hostView, this.container.viewContainerRef.length);
701
- this._components[key] = undefined;
702
- delete this._components[key];
703
- this._render(markdownParts[1], keys[0], keys);
704
- }
705
- else {
706
- /** @type {?} */
707
- var contentRef = this._componentFactoryResolver
708
- .resolveComponentFactory(markdown.TdMarkdownComponent)
709
- .create(this._injector);
710
- contentRef.instance.content = markdown$1;
711
- contentRef.instance.hostedUrl = this._hostedUrl;
712
- contentRef.instance.simpleLineBreaks = this._simpleLineBreaks;
713
- contentRef.instance.refresh();
714
- this.container.viewContainerRef.insert(contentRef.hostView, this.container.viewContainerRef.length);
715
- }
716
- };
717
- /**
718
- * @private
719
- * @template T
720
- * @param {?} markdown
721
- * @param {?} type
722
- * @param {?} regExp
723
- * @param {?} replacerFunc
724
- * @return {?}
725
- */
726
- TdFlavoredMarkdownComponent.prototype._replaceComponent = function (markdown, type, regExp, replacerFunc) {
727
- var _this = this;
728
- /** @type {?} */
729
- var componentIndex = 0;
730
- return markdown.replace(regExp, ( /**
731
- * @param {...?} args
732
- * @return {?}
733
- */function () {
734
- var args = [];
735
- for (var _i = 0; _i < arguments.length; _i++) {
736
- args[_i] = arguments[_i];
737
- }
738
- /** @type {?} */
739
- var componentFactory = _this._componentFactoryResolver.resolveComponentFactory(type);
740
- /** @type {?} */
741
- var componentRef = componentFactory.create(_this._injector);
742
- replacerFunc.apply(void 0, __spread([componentRef], args));
743
- /** @type {?} */
744
- var key = '[' + componentFactory.selector + '-placeholder-' + componentIndex++ + ']';
745
- _this._components[key] = componentRef;
746
- return key;
747
- }));
748
- };
749
- /**
750
- * @private
751
- * @param {?} markdown
752
- * @return {?}
753
- */
754
- TdFlavoredMarkdownComponent.prototype._replaceCheckbox = function (markdown) {
755
- var _this = this;
756
- /** @type {?} */
757
- var checkboxRegExp = /(?:^|\n)- \[(x| )\](.*)/gi;
758
- return this._replaceComponent(markdown, checkbox.MatCheckbox, checkboxRegExp, ( /**
759
- * @param {?} componentRef
760
- * @param {?} match
761
- * @param {?} checked
762
- * @param {?} label
763
- * @return {?}
764
- */function (componentRef, match, checked, label) {
765
- componentRef.instance.checked = !!checked.trim();
766
- componentRef.instance.disabled = true;
767
- componentRef.instance.labelPosition = 'after';
768
- _this._renderer.setProperty((( /** @type {?} */(componentRef.instance._elementRef.nativeElement))).getElementsByClassName('mat-checkbox-label')[0], 'innerHTML', label);
769
- }));
770
- };
771
- /**
772
- * @private
773
- * @param {?} markdown
774
- * @return {?}
775
- */
776
- TdFlavoredMarkdownComponent.prototype._replaceButtons = function (markdown) {
777
- var _this = this;
778
- /** @type {?} */
779
- var buttonRegExp = /\[([^\[]+)\](\(#data=(.*)\))/i;
780
- /** @type {?} */
781
- var globalButtonRegExp = new RegExp(buttonRegExp.source, buttonRegExp.flags + 'g');
782
- return this._replaceComponent(markdown, TdFlavoredMarkdownButtonComponent, globalButtonRegExp, ( /**
783
- * @param {?} componentRef
784
- * @param {?} match
785
- * @return {?}
786
- */function (componentRef, match) {
787
- /** @type {?} */
788
- var matches = buttonRegExp.exec(match);
789
- /** @type {?} */
790
- var text = matches[1];
791
- /** @type {?} */
792
- var data = matches[3];
793
- componentRef.instance.text = text;
794
- componentRef.instance.data = data;
795
- componentRef.instance.clicked.subscribe(( /**
796
- * @param {?} clickEvent
797
- * @return {?}
798
- */function (clickEvent) { return _this.buttonClicked.emit(clickEvent); }));
799
- }));
800
- };
801
- /**
802
- * @private
803
- * @param {?} markdown
804
- * @return {?}
805
- */
806
- TdFlavoredMarkdownComponent.prototype._replaceCodeBlocks = function (markdown) {
807
- var _this = this;
808
- /** @type {?} */
809
- var codeBlockRegExp = /(?:^|\n)```(.*)\n([\s\S]*?)\n```/g;
810
- return this._replaceComponent(markdown, highlight.TdHighlightComponent, codeBlockRegExp, ( /**
811
- * @param {?} componentRef
812
- * @param {?} match
813
- * @param {?} language
814
- * @param {?} codeblock
815
- * @return {?}
816
- */function (componentRef, match, language, codeblock) {
817
- if (language) {
818
- componentRef.instance.codeLang = language;
819
- }
820
- componentRef.instance.copyCodeToClipboard = _this.copyCodeToClipboard;
821
- componentRef.instance.copyCodeTooltips = _this.copyCodeTooltips;
822
- componentRef.instance.content = codeblock;
823
- }));
824
- };
825
- /**
826
- * @private
827
- * @param {?} markdown
828
- * @return {?}
829
- */
830
- TdFlavoredMarkdownComponent.prototype._replaceTables = function (markdown) {
831
- /** @type {?} */
832
- var tableRgx = /^ {0,3}\|?.+\|.+\n[ \t]{0,3}\|?[ \t]*:?[ \t]*(?:-|=){2,}[ \t]*:?[ \t]*\|[ \t]*:?[ \t]*(?:-|=){2,}[\s\S]+?(?:\n\n|~0)/gm;
833
- return this._replaceComponent(markdown, TdFlavoredMarkdownTableComponent, tableRgx, ( /**
834
- * @param {?} componentRef
835
- * @param {?} match
836
- * @return {?}
837
- */function (componentRef, match) {
838
- /** @type {?} */
839
- var dataTableLines = match.replace(/(\s|\t)*\n+(\s|\t)*$/g, '').split('\n');
840
- /** @type {?} */
841
- var columns = dataTableLines[0]
842
- .split('|')
843
- .filter(( /**
844
- * @param {?} col
845
- * @return {?}
846
- */function (col) {
847
- return col;
848
- }))
849
- .map(( /**
850
- * @param {?} s
851
- * @return {?}
852
- */function (s) {
853
- return s.trim();
854
- }));
855
- /** @type {?} */
856
- var alignment = dataTableLines[1]
857
- .split('|')
858
- .filter(( /**
859
- * @param {?} v
860
- * @return {?}
861
- */function (v) {
862
- return v;
863
- }))
864
- .map(( /**
865
- * @param {?} s
866
- * @return {?}
867
- */function (s) {
868
- return s.trim();
869
- }));
870
- /** @type {?} */
871
- var data = [];
872
- var _loop_1 = function (i) {
873
- /** @type {?} */
874
- var rowSplit = dataTableLines[i]
875
- .split('|')
876
- .filter(( /**
877
- * @param {?} cell
878
- * @return {?}
879
- */function (cell) {
880
- return cell;
881
- }))
882
- .map(( /**
883
- * @param {?} s
884
- * @return {?}
885
- */function (s) {
886
- return s.trim();
887
- }));
888
- /** @type {?} */
889
- var row = {};
890
- columns.forEach(( /**
891
- * @param {?} col
892
- * @param {?} index
893
- * @return {?}
894
- */function (col, index) {
895
- /** @type {?} */
896
- var rowSplitCell = rowSplit[index];
897
- if (rowSplitCell) {
898
- row[col.toLowerCase().trim()] = rowSplitCell.replace(/`(.*)`/, ( /**
899
- * @param {?} m
900
- * @param {?} value
901
- * @return {?}
902
- */function (m, value) {
903
- return value;
904
- }));
905
- }
906
- }));
907
- data.push(row);
908
- };
909
- for (var i = 2; i < dataTableLines.length; i++) {
910
- _loop_1(i);
911
- }
912
- componentRef.instance.columnDefs = columns.map(( /**
913
- * @param {?} col
914
- * @param {?} index
915
- * @return {?}
916
- */function (col, index) {
917
- return {
918
- label: col,
919
- name: col.toLowerCase().trim(),
920
- numeric: /^--*[ \t]*:[ \t]*$/.test(alignment[index]),
921
- };
922
- }));
923
- componentRef.instance.data = data;
924
- }));
925
- };
926
- /**
927
- * @private
928
- * @param {?} markdown
929
- * @return {?}
930
- */
931
- TdFlavoredMarkdownComponent.prototype._replaceLists = function (markdown) {
932
- /** @type {?} */
933
- var listRegExp = /(?:^|\n)(( *\+)[ |\t](.*)\n)+/g;
934
- return this._replaceComponent(markdown, TdFlavoredListComponent, listRegExp, ( /**
935
- * @param {?} componentRef
936
- * @param {?} match
937
- * @return {?}
938
- */function (componentRef, match) {
939
- /** @type {?} */
940
- var lineTexts = match.split(new RegExp('\\n {' + (match.indexOf('+') - 1).toString() + '}\\+[ |\\t]'));
941
- lineTexts.shift();
942
- /** @type {?} */
943
- var lines = [];
944
- lineTexts.forEach(( /**
945
- * @param {?} text
946
- * @param {?} index
947
- * @return {?}
948
- */function (text, index) {
949
- /** @type {?} */
950
- var sublineTexts = text.split(/\n *\+ /);
951
- lines.push({
952
- line: sublineTexts.shift(),
953
- sublines: sublineTexts.map(( /**
954
- * @param {?} subline
955
- * @return {?}
956
- */function (subline) {
957
- return subline.trim();
958
- })),
959
- });
960
- }));
961
- componentRef.instance.lines = lines;
962
- }));
963
- };
964
- return TdFlavoredMarkdownComponent;
965
- }());
966
- TdFlavoredMarkdownComponent.decorators = [
967
- { type: core.Component, args: [{
968
- selector: 'td-flavored-markdown',
969
- template: "<div tdFlavoredMarkdownContainer>\n <ng-content></ng-content>\n</div>\n",
970
- changeDetection: core.ChangeDetectionStrategy.OnPush,
971
- styles: [":host ::ng-deep td-markdown:first-of-type>div:first-of-type>h1:first-of-type,:host ::ng-deep td-markdown:first-of-type>div:first-of-type>h2:first-of-type{margin-top:0}:host ::ng-deep mat-checkbox,:host ::ng-deep td-data-table{display:block}:host ::ng-deep mat-checkbox:last-of-type,:host ::ng-deep td-data-table,:host ::ng-deep td-highlight{margin-bottom:16px}:host ::ng-deep :not(pre)>code{font-family:Menlo,Monaco,Andale Mono,lucida console,Courier New,monospace;padding-left:2px;padding-right:2px}:host ::ng-deep td-highlight{-ms-flex-direction:row;-ms-flex-pack:justify;display:-ms-flexbox;display:flex;flex-direction:row;justify-content:space-between}"]
972
- }] }
973
- ];
974
- /** @nocollapse */
975
- TdFlavoredMarkdownComponent.ctorParameters = function () { return [
976
- { type: core.ComponentFactoryResolver },
977
- { type: core.Renderer2 },
978
- { type: core.ChangeDetectorRef },
979
- { type: core.Injector },
980
- { type: core.ElementRef }
981
- ]; };
982
- TdFlavoredMarkdownComponent.propDecorators = {
983
- content: [{ type: core.Input, args: ['content',] }],
984
- simpleLineBreaks: [{ type: core.Input, args: ['simpleLineBreaks',] }],
985
- hostedUrl: [{ type: core.Input, args: ['hostedUrl',] }],
986
- anchor: [{ type: core.Input, args: ['anchor',] }],
987
- copyCodeToClipboard: [{ type: core.Input }],
988
- copyCodeTooltips: [{ type: core.Input }],
989
- contentReady: [{ type: core.Output }],
990
- buttonClicked: [{ type: core.Output }],
991
- container: [{ type: core.ViewChild, args: [TdFlavoredMarkdownContainerDirective, { static: true },] }]
992
- };
993
- if (false) {
994
- /**
995
- * @type {?}
996
- * @private
997
- */
998
- TdFlavoredMarkdownComponent.prototype._content;
999
- /**
1000
- * @type {?}
1001
- * @private
1002
- */
1003
- TdFlavoredMarkdownComponent.prototype._simpleLineBreaks;
1004
- /**
1005
- * @type {?}
1006
- * @private
1007
- */
1008
- TdFlavoredMarkdownComponent.prototype._hostedUrl;
1009
- /**
1010
- * @type {?}
1011
- * @private
1012
- */
1013
- TdFlavoredMarkdownComponent.prototype._anchor;
1014
- /**
1015
- * @type {?}
1016
- * @private
1017
- */
1018
- TdFlavoredMarkdownComponent.prototype._components;
1019
- /**
1020
- * @type {?}
1021
- * @private
1022
- */
1023
- TdFlavoredMarkdownComponent.prototype._viewInit;
1024
- /**
1025
- * copyCodeToClipboard?: boolean
1026
- *
1027
- * Display copy button on code snippets to copy code to clipboard.
1028
- *
1029
- * @type {?}
1030
- */
1031
- TdFlavoredMarkdownComponent.prototype.copyCodeToClipboard;
1032
- /**
1033
- * copyCodeTooltips?: ICopyCodeTooltips
1034
- *
1035
- * Tooltips for copy button to copy and upon copying.
1036
- * @type {?}
1037
- */
1038
- TdFlavoredMarkdownComponent.prototype.copyCodeTooltips;
1039
- /**
1040
- * contentReady?: function
1041
- * Event emitted after the markdown content rendering is finished.
1042
- * @type {?}
1043
- */
1044
- TdFlavoredMarkdownComponent.prototype.contentReady;
1045
- /**
1046
- * buttonClicked?: ITdFlavoredMarkdownButtonClickEvent
1047
- * Event emitted when a button is clicked
1048
- * Is an object containing text and data of button
1049
- * @type {?}
1050
- */
1051
- TdFlavoredMarkdownComponent.prototype.buttonClicked;
1052
- /** @type {?} */
1053
- TdFlavoredMarkdownComponent.prototype.container;
1054
- /**
1055
- * @type {?}
1056
- * @private
1057
- */
1058
- TdFlavoredMarkdownComponent.prototype._componentFactoryResolver;
1059
- /**
1060
- * @type {?}
1061
- * @private
1062
- */
1063
- TdFlavoredMarkdownComponent.prototype._renderer;
1064
- /**
1065
- * @type {?}
1066
- * @private
1067
- */
1068
- TdFlavoredMarkdownComponent.prototype._changeDetectorRef;
1069
- /**
1070
- * @type {?}
1071
- * @private
1072
- */
1073
- TdFlavoredMarkdownComponent.prototype._injector;
1074
- /**
1075
- * @type {?}
1076
- * @private
1077
- */
1078
- TdFlavoredMarkdownComponent.prototype._elementRef;
1079
- }
1080
-
1081
- // TODO: make a td-markdown-loader component
1082
- var TdFlavoredMarkdownLoaderComponent = /** @class */ (function () {
1083
- /**
1084
- * @param {?} _changeDetectorRef
1085
- * @param {?} _markdownUrlLoaderService
1086
- */
1087
- function TdFlavoredMarkdownLoaderComponent(_changeDetectorRef, _markdownUrlLoaderService) {
1088
- this._changeDetectorRef = _changeDetectorRef;
1089
- this._markdownUrlLoaderService = _markdownUrlLoaderService;
1090
- /**
1091
- * copyCodeToClipboard?: boolean
1092
- *
1093
- * Display copy button on code snippets to copy code to clipboard.
1094
- *
1095
- */
1096
- this.copyCodeToClipboard = false;
1097
- /**
1098
- * copyCodeTooltips?: ICopyCodeTooltips
1099
- *
1100
- * Tooltips for copy button to copy and upon copying.
1101
- */
1102
- this.copyCodeTooltips = {};
1103
- /**
1104
- * contentReady: void
1105
- * Emitted when markdown rendering is finished.
1106
- */
1107
- this.contentReady = new core.EventEmitter();
1108
- /**
1109
- * loadFailed: Error
1110
- * Emitted when loading of markdown file fails.
1111
- */
1112
- this.loadFailed = new core.EventEmitter();
1113
- this.buttonClicked = new core.EventEmitter();
1114
- this.loading = true;
1115
- }
1116
- /**
1117
- * @param {?} changes
1118
- * @return {?}
1119
- */
1120
- TdFlavoredMarkdownLoaderComponent.prototype.ngOnChanges = function (changes) {
1121
- if (changes.url || changes.httpOptions) {
1122
- this.loadMarkdown();
1123
- }
1124
- };
1125
- /**
1126
- * @return {?}
1127
- */
1128
- TdFlavoredMarkdownLoaderComponent.prototype.loadMarkdown = function () {
1129
- return __awaiter(this, void 0, void 0, function () {
1130
- var _a, error_1;
1131
- return __generator(this, function (_b) {
1132
- switch (_b.label) {
1133
- case 0:
1134
- this.loading = true;
1135
- this._changeDetectorRef.markForCheck();
1136
- _b.label = 1;
1137
- case 1:
1138
- _b.trys.push([1, 3, 4, 5]);
1139
- _a = this;
1140
- return [4 /*yield*/, this._markdownUrlLoaderService.load(this.url, this.httpOptions)];
1141
- case 2:
1142
- _a.content = _b.sent();
1143
- return [3 /*break*/, 5];
1144
- case 3:
1145
- error_1 = _b.sent();
1146
- this.loadFailed.emit(error_1);
1147
- return [3 /*break*/, 5];
1148
- case 4:
1149
- this.loading = false;
1150
- this._changeDetectorRef.markForCheck();
1151
- return [7 /*endfinally*/];
1152
- case 5: return [2 /*return*/];
1153
- }
1154
- });
1155
- });
1156
- };
1157
- return TdFlavoredMarkdownLoaderComponent;
1158
- }());
1159
- TdFlavoredMarkdownLoaderComponent.decorators = [
1160
- { type: core.Component, args: [{
1161
- selector: 'td-flavored-markdown-loader',
1162
- template: "<mat-progress-bar\n [ngClass]=\"'delay'\"\n *ngIf=\"loading\"\n mode=\"indeterminate\"\n color=\"accent\"\n class=\"sticky\"\n></mat-progress-bar>\n<td-flavored-markdown\n *ngIf=\"!loading\"\n [content]=\"content\"\n [hostedUrl]=\"url\"\n [anchor]=\"anchor\"\n [copyCodeToClipboard]=\"copyCodeToClipboard\"\n [copyCodeTooltips]=\"copyCodeTooltips\"\n (contentReady)=\"contentReady.emit()\"\n (buttonClicked)=\"buttonClicked.emit($event)\"\n></td-flavored-markdown>\n",
1163
- changeDetection: core.ChangeDetectionStrategy.OnPush,
1164
- styles: [":host{display:block}.sticky{position:absolute;top:0}.delay{animation:delayAnimation;animation-duration:.6s}@keyframes delayAnimation{0%{opacity:0}99%{opacity:0}to{opacity:1}}"]
1165
- }] }
1166
- ];
1167
- /** @nocollapse */
1168
- TdFlavoredMarkdownLoaderComponent.ctorParameters = function () { return [
1169
- { type: core.ChangeDetectorRef },
1170
- { type: markdown.TdMarkdownLoaderService }
1171
- ]; };
1172
- TdFlavoredMarkdownLoaderComponent.propDecorators = {
1173
- url: [{ type: core.Input }],
1174
- httpOptions: [{ type: core.Input }],
1175
- anchor: [{ type: core.Input }],
1176
- copyCodeToClipboard: [{ type: core.Input }],
1177
- copyCodeTooltips: [{ type: core.Input }],
1178
- contentReady: [{ type: core.Output }],
1179
- loadFailed: [{ type: core.Output }],
1180
- buttonClicked: [{ type: core.Output }]
1181
- };
1182
- if (false) {
1183
- /**
1184
- * url: string
1185
- * The url of the markdown file.
1186
- * @type {?}
1187
- */
1188
- TdFlavoredMarkdownLoaderComponent.prototype.url;
1189
- /**
1190
- * httpOptions: object
1191
- * HTTP options that can be part of the request.
1192
- * @type {?}
1193
- */
1194
- TdFlavoredMarkdownLoaderComponent.prototype.httpOptions;
1195
- /**
1196
- * anchor: string
1197
- * Anchor to jump to.
1198
- * @type {?}
1199
- */
1200
- TdFlavoredMarkdownLoaderComponent.prototype.anchor;
1201
- /**
1202
- * copyCodeToClipboard?: boolean
1203
- *
1204
- * Display copy button on code snippets to copy code to clipboard.
1205
- *
1206
- * @type {?}
1207
- */
1208
- TdFlavoredMarkdownLoaderComponent.prototype.copyCodeToClipboard;
1209
- /**
1210
- * copyCodeTooltips?: ICopyCodeTooltips
1211
- *
1212
- * Tooltips for copy button to copy and upon copying.
1213
- * @type {?}
1214
- */
1215
- TdFlavoredMarkdownLoaderComponent.prototype.copyCodeTooltips;
1216
- /**
1217
- * contentReady: void
1218
- * Emitted when markdown rendering is finished.
1219
- * @type {?}
1220
- */
1221
- TdFlavoredMarkdownLoaderComponent.prototype.contentReady;
1222
- /**
1223
- * loadFailed: Error
1224
- * Emitted when loading of markdown file fails.
1225
- * @type {?}
1226
- */
1227
- TdFlavoredMarkdownLoaderComponent.prototype.loadFailed;
1228
- /** @type {?} */
1229
- TdFlavoredMarkdownLoaderComponent.prototype.buttonClicked;
1230
- /** @type {?} */
1231
- TdFlavoredMarkdownLoaderComponent.prototype.content;
1232
- /** @type {?} */
1233
- TdFlavoredMarkdownLoaderComponent.prototype.loading;
1234
- /**
1235
- * @type {?}
1236
- * @private
1237
- */
1238
- TdFlavoredMarkdownLoaderComponent.prototype._changeDetectorRef;
1239
- /**
1240
- * @type {?}
1241
- * @private
1242
- */
1243
- TdFlavoredMarkdownLoaderComponent.prototype._markdownUrlLoaderService;
1244
- }
1245
-
1246
- /**
1247
- * @fileoverview added by tsickle
1248
- * Generated from: flavored-markdown.module.ts
1249
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
1250
- */
1251
- var CovalentFlavoredMarkdownModule = /** @class */ (function () {
1252
- function CovalentFlavoredMarkdownModule() {
1253
- }
1254
- return CovalentFlavoredMarkdownModule;
1255
- }());
1256
- CovalentFlavoredMarkdownModule.decorators = [
1257
- { type: core.NgModule, args: [{
1258
- imports: [
1259
- common.CommonModule,
1260
- checkbox.MatCheckboxModule,
1261
- list.MatListModule,
1262
- progressBar.MatProgressBarModule,
1263
- highlight.CovalentHighlightModule,
1264
- markdown.CovalentMarkdownModule,
1265
- button.MatButtonModule,
1266
- table.MatTableModule,
1267
- sort.MatSortModule,
1268
- ],
1269
- declarations: [
1270
- TdFlavoredListComponent,
1271
- TdFlavoredMarkdownComponent,
1272
- TdFlavoredMarkdownContainerDirective,
1273
- TdFlavoredMarkdownLoaderComponent,
1274
- TdFlavoredMarkdownButtonComponent,
1275
- TdFlavoredMarkdownTableComponent,
1276
- ],
1277
- exports: [TdFlavoredMarkdownComponent, TdFlavoredMarkdownLoaderComponent],
1278
- },] }
1279
- ];
1280
-
1281
- /**
1282
- * @fileoverview added by tsickle
1283
- * Generated from: public_api.ts
1284
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
1285
- */
1286
-
1287
- /**
1288
- * @fileoverview added by tsickle
1289
- * Generated from: index.ts
1290
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
1291
- */
1292
-
1293
- /**
1294
- * @fileoverview added by tsickle
1295
- * Generated from: covalent-flavored-markdown.ts
1296
- * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
1297
- */
1298
-
1299
- exports.CovalentFlavoredMarkdownModule = CovalentFlavoredMarkdownModule;
1300
- exports.TdFlavoredMarkdownButtonComponent = TdFlavoredMarkdownButtonComponent;
1301
- exports.TdFlavoredMarkdownComponent = TdFlavoredMarkdownComponent;
1302
- exports.TdFlavoredMarkdownContainerDirective = TdFlavoredMarkdownContainerDirective;
1303
- exports.TdFlavoredMarkdownLoaderComponent = TdFlavoredMarkdownLoaderComponent;
1304
- exports.TdFlavoredMarkdownTableComponent = TdFlavoredMarkdownTableComponent;
1305
- exports.ɵa = TdFlavoredListComponent;
1306
-
1307
- Object.defineProperty(exports, '__esModule', { value: true });
1308
-
1309
- })));
1310
- //# sourceMappingURL=covalent-flavored-markdown.umd.js.map