@covalent/highlight 6.3.0-beta.3 → 6.3.0
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.
- package/_highlight-theme.scss +120 -52
- package/esm2020/lib/copy-code-button/copy-code-button.component.mjs +44 -8
- package/esm2020/lib/highlight.component.mjs +46 -11
- package/esm2020/lib/highlight.module.mjs +8 -1
- package/fesm2015/covalent-highlight.mjs +97 -20
- package/fesm2015/covalent-highlight.mjs.map +1 -1
- package/fesm2020/covalent-highlight.mjs +94 -18
- package/fesm2020/covalent-highlight.mjs.map +1 -1
- package/lib/copy-code-button/copy-code-button.component.d.ts +16 -1
- package/lib/highlight.component.d.ts +16 -2
- package/lib/highlight.module.d.ts +3 -2
- package/package.json +1 -1
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { Component, Input, ViewChild, HostListener,
|
|
2
|
+
import { EventEmitter, Component, Input, Output, ViewChild, HostListener, SecurityContext, NgModule } from '@angular/core';
|
|
3
3
|
import hljs from 'highlight.js';
|
|
4
4
|
import * as i1$1 from '@angular/platform-browser';
|
|
5
|
-
import * as
|
|
5
|
+
import * as i1 from '@angular/common';
|
|
6
6
|
import { CommonModule } from '@angular/common';
|
|
7
|
-
import * as
|
|
7
|
+
import * as i2 from '@angular/cdk/clipboard';
|
|
8
8
|
import { ClipboardModule } from '@angular/cdk/clipboard';
|
|
9
|
-
import * as
|
|
9
|
+
import * as i3 from '@angular/material/icon';
|
|
10
10
|
import { MatIconModule } from '@angular/material/icon';
|
|
11
|
-
import * as
|
|
12
|
-
import {
|
|
13
|
-
import * as
|
|
11
|
+
import * as i4 from '@angular/material/button-toggle';
|
|
12
|
+
import { MatButtonToggleModule } from '@angular/material/button-toggle';
|
|
13
|
+
import * as i5 from '@angular/material/button';
|
|
14
14
|
import { MatButtonModule } from '@angular/material/button';
|
|
15
|
+
import * as i6 from '@angular/material/tooltip';
|
|
16
|
+
import { MatTooltipModule } from '@angular/material/tooltip';
|
|
15
17
|
|
|
16
18
|
class TdCopyCodeButtonComponent {
|
|
17
19
|
constructor() {
|
|
@@ -22,6 +24,10 @@ class TdCopyCodeButtonComponent {
|
|
|
22
24
|
* Tooltips for copy button to copy and upon copying.
|
|
23
25
|
*/
|
|
24
26
|
this.copyCodeTooltips = {};
|
|
27
|
+
this.toggleRawButton = false;
|
|
28
|
+
this.rawToggleLabels = {};
|
|
29
|
+
this.rawToggle = false;
|
|
30
|
+
this.toggleRaw = new EventEmitter();
|
|
25
31
|
}
|
|
26
32
|
get copyTooltip() {
|
|
27
33
|
return (this.copyCodeTooltips && this.copyCodeTooltips.copy) || 'Copy';
|
|
@@ -29,6 +35,15 @@ class TdCopyCodeButtonComponent {
|
|
|
29
35
|
get copiedTooltip() {
|
|
30
36
|
return (this.copyCodeTooltips && this.copyCodeTooltips.copied) || 'Copied';
|
|
31
37
|
}
|
|
38
|
+
get rawToggleText() {
|
|
39
|
+
var _a, _b;
|
|
40
|
+
if (this.rawToggle) {
|
|
41
|
+
return ((_a = this.rawToggleLabels) === null || _a === void 0 ? void 0 : _a.viewCode) || 'View code';
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
return ((_b = this.rawToggleLabels) === null || _b === void 0 ? void 0 : _b.viewRaw) || 'Raw';
|
|
45
|
+
}
|
|
46
|
+
}
|
|
32
47
|
textCopied(event) {
|
|
33
48
|
if (event) {
|
|
34
49
|
this.tooltip.hide();
|
|
@@ -41,18 +56,39 @@ class TdCopyCodeButtonComponent {
|
|
|
41
56
|
this.tooltip.message = this.copyTooltip;
|
|
42
57
|
}, 200);
|
|
43
58
|
}
|
|
59
|
+
toggleRawClicked() {
|
|
60
|
+
this.rawToggle = !this.rawToggle;
|
|
61
|
+
this.toggleRaw.emit();
|
|
62
|
+
this.rawButton.checked = false;
|
|
63
|
+
}
|
|
64
|
+
copyClicked() {
|
|
65
|
+
console.log('copyClicked');
|
|
66
|
+
this.copyButton.checked = false;
|
|
67
|
+
}
|
|
44
68
|
}
|
|
45
69
|
TdCopyCodeButtonComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: TdCopyCodeButtonComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
46
|
-
TdCopyCodeButtonComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.5", type: TdCopyCodeButtonComponent, selector: "td-copy-code-button", inputs: { copiedContent: "copiedContent", copyCodeToClipboard: "copyCodeToClipboard", copyCodeTooltips: "copyCodeTooltips" }, host: { listeners: { "mouseleave": "initializeTooltip()" } }, viewQueries: [{ propertyName: "tooltip", first: true, predicate: ["tooltip"], descendants: true }], ngImport: i0, template: "<button\n mat-icon-button\n [cdkCopyToClipboard]=\"copiedContent\"\n
|
|
70
|
+
TdCopyCodeButtonComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.5", type: TdCopyCodeButtonComponent, selector: "td-copy-code-button", inputs: { copiedContent: "copiedContent", copyCodeToClipboard: "copyCodeToClipboard", copyCodeTooltips: "copyCodeTooltips", toggleRawButton: "toggleRawButton", rawToggleLabels: "rawToggleLabels" }, outputs: { toggleRaw: "toggleRaw" }, host: { listeners: { "mouseleave": "initializeTooltip()" } }, viewQueries: [{ propertyName: "copyButton", first: true, predicate: ["copyButton"], descendants: true }, { propertyName: "rawButton", first: true, predicate: ["rawButton"], descendants: true }, { propertyName: "tooltip", first: true, predicate: ["tooltip"], descendants: true }], ngImport: i0, template: "<mat-button-toggle-group\n multiple\n class=\"raw-and-copy-buttons\"\n *ngIf=\"toggleRawButton; else button\"\n>\n <mat-button-toggle (click)=\"toggleRawClicked()\" #rawButton>{{\n rawToggleText\n }}</mat-button-toggle>\n <mat-button-toggle\n [cdkCopyToClipboard]=\"copiedContent\"\n [matTooltip]=\"copyTooltip\"\n #tooltip=\"matTooltip\"\n #copyButton\n (click)=\"copyClicked()\"\n (cdkCopyToClipboardCopied)=\"textCopied($event)\"\n >\n <mat-icon width>content_copy</mat-icon>\n </mat-button-toggle>\n</mat-button-toggle-group>\n\n<ng-template #button>\n <button\n mat-icon-button\n [cdkCopyToClipboard]=\"copiedContent\"\n class=\"copy-button\"\n [matTooltip]=\"copyTooltip\"\n #tooltip=\"matTooltip\"\n (cdkCopyToClipboardCopied)=\"textCopied($event)\"\n >\n <mat-icon role=\"img\">content_copy</mat-icon>\n </button>\n</ng-template>\n", styles: ["mat-button-toggle-group.raw-and-copy-buttons{margin-top:-8px;margin-right:-8px;margin-left:8px}mat-button-toggle-group.raw-and-copy-buttons ::ng-deep .mat-button-toggle-label-content{font-size:12px;line-height:28px}mat-button-toggle-group.raw-and-copy-buttons ::ng-deep .mat-button-toggle-label-content mat-icon{width:16px;height:16px;font-size:16px}\n"], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.CdkCopyToClipboard, selector: "[cdkCopyToClipboard]", inputs: ["cdkCopyToClipboard", "cdkCopyToClipboardAttempts"], outputs: ["cdkCopyToClipboardCopied"] }, { kind: "component", type: i3.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "directive", type: i4.MatButtonToggleGroup, selector: "mat-button-toggle-group", inputs: ["appearance", "name", "vertical", "value", "multiple", "disabled"], outputs: ["valueChange", "change"], exportAs: ["matButtonToggleGroup"] }, { kind: "component", type: i4.MatButtonToggle, selector: "mat-button-toggle", inputs: ["disableRipple", "aria-label", "aria-labelledby", "id", "name", "value", "tabIndex", "appearance", "checked", "disabled"], outputs: ["change"], exportAs: ["matButtonToggle"] }, { kind: "component", type: i5.MatIconButton, selector: "button[mat-icon-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "directive", type: i6.MatTooltip, selector: "[matTooltip]", exportAs: ["matTooltip"] }] });
|
|
47
71
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: TdCopyCodeButtonComponent, decorators: [{
|
|
48
72
|
type: Component,
|
|
49
|
-
args: [{ selector: 'td-copy-code-button', template: "<button\n mat-icon-button\n [cdkCopyToClipboard]=\"copiedContent\"\n
|
|
73
|
+
args: [{ selector: 'td-copy-code-button', template: "<mat-button-toggle-group\n multiple\n class=\"raw-and-copy-buttons\"\n *ngIf=\"toggleRawButton; else button\"\n>\n <mat-button-toggle (click)=\"toggleRawClicked()\" #rawButton>{{\n rawToggleText\n }}</mat-button-toggle>\n <mat-button-toggle\n [cdkCopyToClipboard]=\"copiedContent\"\n [matTooltip]=\"copyTooltip\"\n #tooltip=\"matTooltip\"\n #copyButton\n (click)=\"copyClicked()\"\n (cdkCopyToClipboardCopied)=\"textCopied($event)\"\n >\n <mat-icon width>content_copy</mat-icon>\n </mat-button-toggle>\n</mat-button-toggle-group>\n\n<ng-template #button>\n <button\n mat-icon-button\n [cdkCopyToClipboard]=\"copiedContent\"\n class=\"copy-button\"\n [matTooltip]=\"copyTooltip\"\n #tooltip=\"matTooltip\"\n (cdkCopyToClipboardCopied)=\"textCopied($event)\"\n >\n <mat-icon role=\"img\">content_copy</mat-icon>\n </button>\n</ng-template>\n", styles: ["mat-button-toggle-group.raw-and-copy-buttons{margin-top:-8px;margin-right:-8px;margin-left:8px}mat-button-toggle-group.raw-and-copy-buttons ::ng-deep .mat-button-toggle-label-content{font-size:12px;line-height:28px}mat-button-toggle-group.raw-and-copy-buttons ::ng-deep .mat-button-toggle-label-content mat-icon{width:16px;height:16px;font-size:16px}\n"] }]
|
|
50
74
|
}], propDecorators: { copiedContent: [{
|
|
51
75
|
type: Input
|
|
52
76
|
}], copyCodeToClipboard: [{
|
|
53
77
|
type: Input
|
|
54
78
|
}], copyCodeTooltips: [{
|
|
55
79
|
type: Input
|
|
80
|
+
}], toggleRawButton: [{
|
|
81
|
+
type: Input
|
|
82
|
+
}], rawToggleLabels: [{
|
|
83
|
+
type: Input
|
|
84
|
+
}], toggleRaw: [{
|
|
85
|
+
type: Output
|
|
86
|
+
}], copyButton: [{
|
|
87
|
+
type: ViewChild,
|
|
88
|
+
args: ['copyButton']
|
|
89
|
+
}], rawButton: [{
|
|
90
|
+
type: ViewChild,
|
|
91
|
+
args: ['rawButton']
|
|
56
92
|
}], tooltip: [{
|
|
57
93
|
type: ViewChild,
|
|
58
94
|
args: ['tooltip']
|
|
@@ -72,6 +108,7 @@ class TdHighlightComponent {
|
|
|
72
108
|
*/
|
|
73
109
|
set content(content) {
|
|
74
110
|
this._content = content;
|
|
111
|
+
console.log(this._content);
|
|
75
112
|
if (this._initialized) {
|
|
76
113
|
this._loadContent(this._content);
|
|
77
114
|
}
|
|
@@ -100,6 +137,7 @@ class TdHighlightComponent {
|
|
|
100
137
|
this.cdr = cdr;
|
|
101
138
|
this._initialized = false;
|
|
102
139
|
this._lang = 'typescript';
|
|
140
|
+
this._showRaw = false;
|
|
103
141
|
/**
|
|
104
142
|
* copyCodeToClipboard?: boolean
|
|
105
143
|
*
|
|
@@ -112,6 +150,18 @@ class TdHighlightComponent {
|
|
|
112
150
|
* Tooltips for copy button to copy and upon copying.
|
|
113
151
|
*/
|
|
114
152
|
this.copyCodeTooltips = {};
|
|
153
|
+
/**
|
|
154
|
+
* toggleRawButton?: boolean
|
|
155
|
+
*
|
|
156
|
+
* Display button to toggle raw code.
|
|
157
|
+
*/
|
|
158
|
+
this.toggleRawButton = false;
|
|
159
|
+
/**
|
|
160
|
+
* rawToggleLabels?: IRawToggleLabels
|
|
161
|
+
*
|
|
162
|
+
* Labels for raw toggle button.
|
|
163
|
+
*/
|
|
164
|
+
this.rawToggleLabels = {};
|
|
115
165
|
/**
|
|
116
166
|
* contentReady?: function
|
|
117
167
|
* Event emitted after the highlight content rendering is finished.
|
|
@@ -123,11 +173,10 @@ class TdHighlightComponent {
|
|
|
123
173
|
}
|
|
124
174
|
ngAfterViewInit() {
|
|
125
175
|
if (!this._content) {
|
|
126
|
-
this.
|
|
127
|
-
|
|
128
|
-
else {
|
|
129
|
-
this._loadContent(this._content);
|
|
176
|
+
this._content =
|
|
177
|
+
this.highlightComp.nativeElement.textContent || '';
|
|
130
178
|
}
|
|
179
|
+
this._loadContent(this._content);
|
|
131
180
|
this._initialized = true;
|
|
132
181
|
}
|
|
133
182
|
setLanguage(lang) {
|
|
@@ -139,6 +188,17 @@ class TdHighlightComponent {
|
|
|
139
188
|
this._loadContent(this._content);
|
|
140
189
|
}
|
|
141
190
|
}
|
|
191
|
+
toggleRawClicked() {
|
|
192
|
+
this._showRaw = !this._showRaw;
|
|
193
|
+
this._elementRef.nativeElement.querySelector('pre').style.display = this
|
|
194
|
+
._showRaw
|
|
195
|
+
? 'none'
|
|
196
|
+
: 'block';
|
|
197
|
+
this._elementRef.nativeElement.querySelector('.raw').style.display = this
|
|
198
|
+
._showRaw
|
|
199
|
+
? 'block'
|
|
200
|
+
: 'none';
|
|
201
|
+
}
|
|
142
202
|
/**
|
|
143
203
|
* General method to parse a string of code into HTML Elements and load them into the container
|
|
144
204
|
*/
|
|
@@ -146,8 +206,7 @@ class TdHighlightComponent {
|
|
|
146
206
|
if (code && code.trim().length > 0) {
|
|
147
207
|
// Clean container
|
|
148
208
|
this._renderer.setProperty(this._elementRef.nativeElement, 'innerHTML', '');
|
|
149
|
-
|
|
150
|
-
this._elementFromString(this._render(code));
|
|
209
|
+
this._elementFromString(code);
|
|
151
210
|
if (this.copyCodeToClipboard) {
|
|
152
211
|
this._renderer.appendChild(this._elementRef.nativeElement, this.copyComp.nativeElement);
|
|
153
212
|
}
|
|
@@ -155,7 +214,7 @@ class TdHighlightComponent {
|
|
|
155
214
|
this.contentReady.emit();
|
|
156
215
|
}
|
|
157
216
|
_elementFromString(codeStr) {
|
|
158
|
-
var _a;
|
|
217
|
+
var _a, _b;
|
|
159
218
|
// Renderer2 doesnt have a parsing method, so we have to sanitize and use [innerHTML]
|
|
160
219
|
// to parse the string into DOM element for now.
|
|
161
220
|
const preElement = this._renderer.createElement('pre');
|
|
@@ -164,9 +223,17 @@ class TdHighlightComponent {
|
|
|
164
223
|
this._renderer.appendChild(preElement, codeElement);
|
|
165
224
|
// Set .highlight class into <code> element
|
|
166
225
|
this._renderer.addClass(codeElement, 'highlight');
|
|
226
|
+
const highlightedCode = this._render(codeStr);
|
|
167
227
|
codeElement.innerHTML =
|
|
168
|
-
(_a = this._domSanitizer.sanitize(SecurityContext.HTML,
|
|
169
|
-
|
|
228
|
+
(_a = this._domSanitizer.sanitize(SecurityContext.HTML, highlightedCode)) !== null && _a !== void 0 ? _a : '';
|
|
229
|
+
if (this.toggleRawButton) {
|
|
230
|
+
const divElement = this._renderer.createElement('div');
|
|
231
|
+
divElement.className = 'raw';
|
|
232
|
+
this._renderer.appendChild(this._elementRef.nativeElement, divElement);
|
|
233
|
+
divElement.innerHTML =
|
|
234
|
+
(_b = this._domSanitizer.sanitize(SecurityContext.HTML, codeStr)) !== null && _b !== void 0 ? _b : '';
|
|
235
|
+
this._renderer.setStyle(divElement, 'display', 'none');
|
|
236
|
+
}
|
|
170
237
|
}
|
|
171
238
|
_render(contents) {
|
|
172
239
|
// Trim leading and trailing newlines
|
|
@@ -205,16 +272,20 @@ class TdHighlightComponent {
|
|
|
205
272
|
}
|
|
206
273
|
}
|
|
207
274
|
TdHighlightComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: TdHighlightComponent, deps: [{ token: i0.Renderer2 }, { token: i0.ElementRef }, { token: i1$1.DomSanitizer }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
208
|
-
TdHighlightComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.5", type: TdHighlightComponent, selector: "td-highlight", inputs: { content: "content", copyCodeToClipboard: "copyCodeToClipboard", copyCodeTooltips: "copyCodeTooltips", codeLang: "codeLang", lang: "lang" }, outputs: { contentReady: "contentReady" }, viewQueries: [{ propertyName: "highlightComp", first: true, predicate: ["highlightComponent"], descendants: true }, { propertyName: "copyComp", first: true, predicate: ["copyComponent"], descendants: true }, { propertyName: "tooltip", first: true, predicate: ["tooltip"], descendants: true }], ngImport: i0, template: "<div>\n <div #highlightComponent>\n <ng-content></ng-content>\n </div>\n\n <div #copyComponent *ngIf=\"copyCodeToClipboard\">\n <td-copy-code-button\n [copiedContent]=\"copyContent\"\n [copyCodeToClipboard]=\"copyCodeToClipboard\"\n [copyCodeTooltips]=\"copyCodeTooltips\"\n ></td-copy-code-button>\n </div>\n</div>\n", styles: [":host ::ng-deep{overflow-x:auto;padding:16px;display:flex}:host ::ng-deep pre,:host ::ng-deep code,:host ::ng-deep .highlight{font-family:Menlo,Monaco,Andale Mono,lucida console,Courier New,monospace}:host ::ng-deep pre{display:block;overflow-x:auto;padding:0;margin:0;background:transparent;font-family:Menlo,Monaco,Andale Mono,lucida console,Courier New,monospace;line-height:1.45;tab-size:2;-webkit-font-smoothing:auto;-webkit-text-size-adjust:none;text-size-adjust:none;position:relative;border-radius:2px;font-size:.8rem;width:100%}:host ::ng-deep code{margin:0;padding:0;overflow-wrap:break-word;white-space:pre-wrap}:host ::ng-deep .highlight{display:block;overflow-wrap:break-word;line-height:1.5;margin:0}:host ::ng-deep .copy-button{border:none;background:inherit;margin-top:-8px;margin-right:-8px}\n"], dependencies: [{ kind: "directive", type:
|
|
275
|
+
TdHighlightComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.5", type: TdHighlightComponent, selector: "td-highlight", inputs: { content: "content", copyCodeToClipboard: "copyCodeToClipboard", copyCodeTooltips: "copyCodeTooltips", toggleRawButton: "toggleRawButton", rawToggleLabels: "rawToggleLabels", codeLang: "codeLang", lang: "lang" }, outputs: { contentReady: "contentReady" }, viewQueries: [{ propertyName: "highlightComp", first: true, predicate: ["highlightComponent"], descendants: true }, { propertyName: "copyComp", first: true, predicate: ["copyComponent"], descendants: true }, { propertyName: "tooltip", first: true, predicate: ["tooltip"], descendants: true }], ngImport: i0, template: "<div>\n <div #highlightComponent>\n <ng-content></ng-content>\n </div>\n\n <div #copyComponent *ngIf=\"copyCodeToClipboard\">\n <td-copy-code-button\n [toggleRawButton]=\"toggleRawButton\"\n [rawToggleLabels]=\"rawToggleLabels\"\n (toggleRaw)=\"toggleRawClicked()\"\n [copiedContent]=\"copyContent\"\n [copyCodeToClipboard]=\"copyCodeToClipboard\"\n [copyCodeTooltips]=\"copyCodeTooltips\"\n ></td-copy-code-button>\n </div>\n</div>\n", styles: [":host ::ng-deep{overflow-x:auto;padding:16px;display:flex;position:relative}:host ::ng-deep pre,:host ::ng-deep code,:host ::ng-deep .highlight{font-family:Menlo,Monaco,Andale Mono,lucida console,Courier New,monospace}:host ::ng-deep pre{display:block;overflow-x:auto;padding:0;margin:0;background:transparent;font-family:Menlo,Monaco,Andale Mono,lucida console,Courier New,monospace;line-height:1.45;tab-size:2;-webkit-font-smoothing:auto;-webkit-text-size-adjust:none;text-size-adjust:none;position:relative;border-radius:2px;font-size:.8rem;width:100%}:host ::ng-deep code{margin:0;padding:0;overflow-wrap:break-word;white-space:pre-wrap}:host ::ng-deep div.raw{flex-grow:1}:host ::ng-deep .highlight{display:block;overflow-wrap:break-word;line-height:1.5;margin:0}:host ::ng-deep .copy-button{border:none;background:inherit;margin-top:-8px;margin-right:-8px}\n"], dependencies: [{ kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: TdCopyCodeButtonComponent, selector: "td-copy-code-button", inputs: ["copiedContent", "copyCodeToClipboard", "copyCodeTooltips", "toggleRawButton", "rawToggleLabels"], outputs: ["toggleRaw"] }] });
|
|
209
276
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: TdHighlightComponent, decorators: [{
|
|
210
277
|
type: Component,
|
|
211
|
-
args: [{ selector: 'td-highlight', template: "<div>\n <div #highlightComponent>\n <ng-content></ng-content>\n </div>\n\n <div #copyComponent *ngIf=\"copyCodeToClipboard\">\n <td-copy-code-button\n [copiedContent]=\"copyContent\"\n [copyCodeToClipboard]=\"copyCodeToClipboard\"\n [copyCodeTooltips]=\"copyCodeTooltips\"\n ></td-copy-code-button>\n </div>\n</div>\n", styles: [":host ::ng-deep{overflow-x:auto;padding:16px;display:flex}:host ::ng-deep pre,:host ::ng-deep code,:host ::ng-deep .highlight{font-family:Menlo,Monaco,Andale Mono,lucida console,Courier New,monospace}:host ::ng-deep pre{display:block;overflow-x:auto;padding:0;margin:0;background:transparent;font-family:Menlo,Monaco,Andale Mono,lucida console,Courier New,monospace;line-height:1.45;tab-size:2;-webkit-font-smoothing:auto;-webkit-text-size-adjust:none;text-size-adjust:none;position:relative;border-radius:2px;font-size:.8rem;width:100%}:host ::ng-deep code{margin:0;padding:0;overflow-wrap:break-word;white-space:pre-wrap}:host ::ng-deep .highlight{display:block;overflow-wrap:break-word;line-height:1.5;margin:0}:host ::ng-deep .copy-button{border:none;background:inherit;margin-top:-8px;margin-right:-8px}\n"] }]
|
|
278
|
+
args: [{ selector: 'td-highlight', template: "<div>\n <div #highlightComponent>\n <ng-content></ng-content>\n </div>\n\n <div #copyComponent *ngIf=\"copyCodeToClipboard\">\n <td-copy-code-button\n [toggleRawButton]=\"toggleRawButton\"\n [rawToggleLabels]=\"rawToggleLabels\"\n (toggleRaw)=\"toggleRawClicked()\"\n [copiedContent]=\"copyContent\"\n [copyCodeToClipboard]=\"copyCodeToClipboard\"\n [copyCodeTooltips]=\"copyCodeTooltips\"\n ></td-copy-code-button>\n </div>\n</div>\n", styles: [":host ::ng-deep{overflow-x:auto;padding:16px;display:flex;position:relative}:host ::ng-deep pre,:host ::ng-deep code,:host ::ng-deep .highlight{font-family:Menlo,Monaco,Andale Mono,lucida console,Courier New,monospace}:host ::ng-deep pre{display:block;overflow-x:auto;padding:0;margin:0;background:transparent;font-family:Menlo,Monaco,Andale Mono,lucida console,Courier New,monospace;line-height:1.45;tab-size:2;-webkit-font-smoothing:auto;-webkit-text-size-adjust:none;text-size-adjust:none;position:relative;border-radius:2px;font-size:.8rem;width:100%}:host ::ng-deep code{margin:0;padding:0;overflow-wrap:break-word;white-space:pre-wrap}:host ::ng-deep div.raw{flex-grow:1}:host ::ng-deep .highlight{display:block;overflow-wrap:break-word;line-height:1.5;margin:0}:host ::ng-deep .copy-button{border:none;background:inherit;margin-top:-8px;margin-right:-8px}\n"] }]
|
|
212
279
|
}], ctorParameters: function () { return [{ type: i0.Renderer2 }, { type: i0.ElementRef }, { type: i1$1.DomSanitizer }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { content: [{
|
|
213
280
|
type: Input
|
|
214
281
|
}], copyCodeToClipboard: [{
|
|
215
282
|
type: Input
|
|
216
283
|
}], copyCodeTooltips: [{
|
|
217
284
|
type: Input
|
|
285
|
+
}], toggleRawButton: [{
|
|
286
|
+
type: Input
|
|
287
|
+
}], rawToggleLabels: [{
|
|
288
|
+
type: Input
|
|
218
289
|
}], codeLang: [{
|
|
219
290
|
type: Input
|
|
220
291
|
}], lang: [{
|
|
@@ -238,11 +309,15 @@ CovalentHighlightModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0",
|
|
|
238
309
|
CovalentHighlightModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.5", ngImport: i0, type: CovalentHighlightModule, declarations: [TdHighlightComponent, TdCopyCodeButtonComponent], imports: [CommonModule,
|
|
239
310
|
ClipboardModule,
|
|
240
311
|
MatIconModule,
|
|
312
|
+
MatButtonToggleModule,
|
|
313
|
+
MatButtonModule,
|
|
241
314
|
MatTooltipModule,
|
|
242
315
|
MatButtonModule], exports: [TdHighlightComponent] });
|
|
243
316
|
CovalentHighlightModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: CovalentHighlightModule, imports: [CommonModule,
|
|
244
317
|
ClipboardModule,
|
|
245
318
|
MatIconModule,
|
|
319
|
+
MatButtonToggleModule,
|
|
320
|
+
MatButtonModule,
|
|
246
321
|
MatTooltipModule,
|
|
247
322
|
MatButtonModule] });
|
|
248
323
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: CovalentHighlightModule, decorators: [{
|
|
@@ -252,6 +327,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.5", ngImpor
|
|
|
252
327
|
CommonModule,
|
|
253
328
|
ClipboardModule,
|
|
254
329
|
MatIconModule,
|
|
330
|
+
MatButtonToggleModule,
|
|
331
|
+
MatButtonModule,
|
|
255
332
|
MatTooltipModule,
|
|
256
333
|
MatButtonModule,
|
|
257
334
|
],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"covalent-highlight.mjs","sources":["../../../../libs/angular-highlight/src/lib/copy-code-button/copy-code-button.component.ts","../../../../libs/angular-highlight/src/lib/copy-code-button/copy-code-button.component.html","../../../../libs/angular-highlight/src/lib/highlight.component.ts","../../../../libs/angular-highlight/src/lib/highlight.component.html","../../../../libs/angular-highlight/src/lib/highlight.module.ts","../../../../libs/angular-highlight/src/covalent-highlight.ts"],"sourcesContent":["import { Component, Input, ViewChild, HostListener } from '@angular/core';\nimport { MatTooltip } from '@angular/material/tooltip';\n\nexport interface ICopyCodeTooltips {\n copy?: string;\n copied?: string;\n}\n\n@Component({\n selector: 'td-copy-code-button',\n templateUrl: './copy-code-button.component.html',\n styleUrls: ['./copy-code-button.component.scss'],\n})\nexport class TdCopyCodeButtonComponent {\n // private _copyCodeTooltips: ICopyCodeTooltips = {};\n @Input() copiedContent!: string;\n @Input() copyCodeToClipboard = false;\n /**\n * copyCodeTooltips?: ICopyCodeTooltips\n *\n * Tooltips for copy button to copy and upon copying.\n */\n @Input() copyCodeTooltips?: ICopyCodeTooltips = {};\n\n get copyTooltip(): string {\n return (this.copyCodeTooltips && this.copyCodeTooltips.copy) || 'Copy';\n }\n\n get copiedTooltip(): string {\n return (this.copyCodeTooltips && this.copyCodeTooltips.copied) || 'Copied';\n }\n\n @ViewChild('tooltip') tooltip!: MatTooltip;\n\n textCopied(event: boolean): void {\n if (event) {\n this.tooltip.hide();\n this.tooltip.message = this.copiedTooltip;\n this.tooltip.show();\n }\n }\n @HostListener('mouseleave')\n initializeTooltip(): void {\n setTimeout(() => {\n this.tooltip.message = this.copyTooltip;\n }, 200);\n }\n}\n","<button\n mat-icon-button\n [cdkCopyToClipboard]=\"copiedContent\"\n class=\"copy-button\"\n [matTooltip]=\"copyTooltip\"\n #tooltip=\"matTooltip\"\n (cdkCopyToClipboardCopied)=\"textCopied($event)\"\n>\n <mat-icon role=\"img\">content_copy</mat-icon>\n</button>\n","import {\n Component,\n AfterViewInit,\n ElementRef,\n Input,\n Output,\n EventEmitter,\n Renderer2,\n SecurityContext,\n ViewChild,\n ChangeDetectorRef,\n AfterViewChecked,\n} from '@angular/core';\nimport { DomSanitizer } from '@angular/platform-browser';\nimport { MatTooltip } from '@angular/material/tooltip';\nimport { ICopyCodeTooltips } from './copy-code-button/copy-code-button.component';\n\nimport hljs from 'highlight.js';\n\n@Component({\n selector: 'td-highlight',\n styleUrls: ['./highlight.component.scss'],\n templateUrl: './highlight.component.html',\n})\nexport class TdHighlightComponent implements AfterViewInit, AfterViewChecked {\n private _initialized = false;\n\n private _content!: string;\n private _lang = 'typescript';\n\n /**\n * content?: string\n *\n * Code content to be parsed as highlighted html.\n * Used to load data dynamically.\n *\n * e.g. `.html`, `.ts` , etc.\n */\n @Input()\n set content(content: string) {\n this._content = content;\n if (this._initialized) {\n this._loadContent(this._content);\n }\n }\n\n /**\n * copyCodeToClipboard?: boolean\n *\n * Display copy button on code snippets to copy code to clipboard.\n */\n @Input() copyCodeToClipboard? = false;\n\n /**\n * copyCodeTooltips?: ICopyCodeTooltips\n *\n * Tooltips for copy button to copy and upon copying.\n */\n @Input() copyCodeTooltips?: ICopyCodeTooltips = {};\n\n /**\n * lang?: string\n *\n * Language of the code content to be parsed as highlighted html.\n * Defaults to `typescript`\n *\n * e.g. `typescript`, `html` , etc.\n */\n\n @Input()\n set codeLang(lang: string) {\n this.setLanguage(lang);\n }\n /** @deprecated - removed completely @4.0.0 */\n @Input()\n set lang(lang: string) {\n // tslint:disable-next-line: no-console\n console.warn(\n 'DEPRECATION WARNING: switch to codeLang attribute as lang attribute is deprecated.'\n );\n this.setLanguage(lang);\n }\n\n copyContent!: string;\n\n /**\n * contentReady?: function\n * Event emitted after the highlight content rendering is finished.\n */\n @Output() contentReady: EventEmitter<void> = new EventEmitter<void>();\n @ViewChild('highlightComponent') highlightComp!: ElementRef;\n @ViewChild('copyComponent') copyComp!: ElementRef;\n\n @ViewChild('tooltip') tooltip!: MatTooltip;\n\n constructor(\n private _renderer: Renderer2,\n private _elementRef: ElementRef,\n private _domSanitizer: DomSanitizer,\n private cdr: ChangeDetectorRef\n ) {}\n\n ngAfterViewChecked(): void {\n this.cdr.detectChanges();\n }\n\n ngAfterViewInit(): void {\n if (!this._content) {\n this._loadContent(\n (<HTMLElement>this.highlightComp.nativeElement).textContent\n );\n } else {\n this._loadContent(this._content);\n }\n this._initialized = true;\n }\n\n setLanguage(lang: string): void {\n if (!lang) {\n throw new Error(\n 'Error: language attribute must be defined in TdHighlightComponent.'\n );\n }\n this._lang = lang;\n if (this._initialized) {\n this._loadContent(this._content);\n }\n }\n\n /**\n * General method to parse a string of code into HTML Elements and load them into the container\n */\n private _loadContent(code: string | null): void {\n if (code && code.trim().length > 0) {\n // Clean container\n this._renderer.setProperty(\n this._elementRef.nativeElement,\n 'innerHTML',\n ''\n );\n // Parse html string into actual HTML elements.\n this._elementFromString(this._render(code));\n if (this.copyCodeToClipboard) {\n this._renderer.appendChild(\n this._elementRef.nativeElement,\n this.copyComp.nativeElement\n );\n }\n }\n this.contentReady.emit();\n }\n\n private _elementFromString(codeStr: string): HTMLPreElement {\n // Renderer2 doesnt have a parsing method, so we have to sanitize and use [innerHTML]\n // to parse the string into DOM element for now.\n const preElement: HTMLPreElement = this._renderer.createElement('pre');\n this._renderer.appendChild(this._elementRef.nativeElement, preElement);\n const codeElement: HTMLElement = this._renderer.createElement('code');\n this._renderer.appendChild(preElement, codeElement);\n // Set .highlight class into <code> element\n this._renderer.addClass(codeElement, 'highlight');\n codeElement.innerHTML =\n this._domSanitizer.sanitize(SecurityContext.HTML, codeStr) ?? '';\n return preElement;\n }\n\n private _render(contents: string): string {\n // Trim leading and trailing newlines\n contents = contents\n .replace(/^(\\s|\\t)*\\n+/g, '')\n .replace(/(\\s|\\t)*\\n+(\\s|\\t)*$/g, '');\n // Split markup by line characters\n let lines: string[] = contents.split('\\n');\n\n // check how much indentation is used by the first actual code line\n const firstLineWhitespaceMatch = lines[0].match(/^(\\s|\\t)*/);\n const firstLineWhitespace = firstLineWhitespaceMatch\n ? firstLineWhitespaceMatch[0]\n : null;\n\n // Remove all indentation spaces so code can be parsed correctly\n const startingWhitespaceRegex = new RegExp('^' + firstLineWhitespace);\n lines = lines.map(function (line: string): string {\n return line\n .replace('=\"\"', '') // remove empty values\n .replace(startingWhitespaceRegex, '')\n .replace(/\\s+$/, ''); // remove trailing white spaces\n });\n\n const codeToParse: string = lines\n .join('\\n')\n .replace(/\\{ \\{/gi, '{{')\n .replace(/\\} \\}/gi, '}}')\n .replace(/</gi, '<')\n .replace(/>/gi, '>'); // replace with < and > to render HTML in Angular\n this.copyContent = codeToParse;\n // Parse code with highlight.js depending on language\n const highlightedCode: any = hljs.highlight(this._lang, codeToParse, true);\n highlightedCode.value = highlightedCode.value\n .replace(/=<span class=\"hljs-value\">\"\"<\\/span>/gi, '')\n .replace('<head>', '')\n .replace('<head/>', '');\n return highlightedCode.value;\n }\n}\n","<div>\n <div #highlightComponent>\n <ng-content></ng-content>\n </div>\n\n <div #copyComponent *ngIf=\"copyCodeToClipboard\">\n <td-copy-code-button\n [copiedContent]=\"copyContent\"\n [copyCodeToClipboard]=\"copyCodeToClipboard\"\n [copyCodeTooltips]=\"copyCodeTooltips\"\n ></td-copy-code-button>\n </div>\n</div>\n","import { NgModule } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { ClipboardModule } from '@angular/cdk/clipboard';\nimport { TdHighlightComponent } from './highlight.component';\nimport { MatIconModule } from '@angular/material/icon';\nimport { MatTooltipModule } from '@angular/material/tooltip';\nimport { MatButtonModule } from '@angular/material/button';\nimport { TdCopyCodeButtonComponent } from './copy-code-button/copy-code-button.component';\n\n@NgModule({\n imports: [\n CommonModule,\n ClipboardModule,\n MatIconModule,\n MatTooltipModule,\n MatButtonModule,\n ],\n declarations: [TdHighlightComponent, TdCopyCodeButtonComponent],\n exports: [TdHighlightComponent],\n})\nexport class CovalentHighlightModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":["i1","i2","i3.TdCopyCodeButtonComponent"],"mappings":";;;;;;;;;;;;;;;MAaa,yBAAyB,CAAA;AALtC,IAAA,WAAA,GAAA;AAQW,QAAA,IAAmB,CAAA,mBAAA,GAAG,KAAK,CAAC;AACrC;;;;AAIG;AACM,QAAA,IAAgB,CAAA,gBAAA,GAAuB,EAAE,CAAC;KAyBpD;AAvBC,IAAA,IAAI,WAAW,GAAA;AACb,QAAA,OAAO,CAAC,IAAI,CAAC,gBAAgB,IAAI,IAAI,CAAC,gBAAgB,CAAC,IAAI,KAAK,MAAM,CAAC;KACxE;AAED,IAAA,IAAI,aAAa,GAAA;AACf,QAAA,OAAO,CAAC,IAAI,CAAC,gBAAgB,IAAI,IAAI,CAAC,gBAAgB,CAAC,MAAM,KAAK,QAAQ,CAAC;KAC5E;AAID,IAAA,UAAU,CAAC,KAAc,EAAA;AACvB,QAAA,IAAI,KAAK,EAAE;AACT,YAAA,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;YACpB,IAAI,CAAC,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC,aAAa,CAAC;AAC1C,YAAA,IAAI,CA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oBAAoB,CAAA;gBACH,QAAQ,EAAA,CAAA;sBAAnC,SAAS;uBAAC,eAAe,CAAA;gBAEJ,OAAO,EAAA,CAAA;sBAA5B,SAAS;uBAAC,SAAS,CAAA;;;MEzET,uBAAuB,CAAA;;oHAAvB,uBAAuB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,QAAA,EAAA,CAAA,CAAA;AAAvB,uBAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,uBAAuB,EAHnB,YAAA,EAAA,CAAA,oBAAoB,EAAE,yBAAyB,aAN5D,YAAY;QACZ,eAAe;QACf,aAAa;QACb,gBAAgB;QAChB,eAAe,aAGP,oBAAoB,CAAA,EAAA,CAAA,CAAA;AAEnB,uBAAA,CAAA,IAAA,GAAA,EAAA,CAAA,mBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,uBAAuB,YAThC,YAAY;QACZ,eAAe;QACf,aAAa;QACb,gBAAgB;QAChB,eAAe,CAAA,EAAA,CAAA,CAAA;2FAKN,uBAAuB,EAAA,UAAA,EAAA,CAAA;kBAXnC,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,OAAO,EAAE;wBACP,YAAY;wBACZ,eAAe;wBACf,aAAa;wBACb,gBAAgB;wBAChB,eAAe;AAChB,qBAAA;AACD,oBAAA,YAAY,EAAE,CAAC,oBAAoB,EAAE,yBAAyB,CAAC;oBAC/D,OAAO,EAAE,CAAC,oBAAoB,CAAC;iBAChC,CAAA;;;ACnBD;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"covalent-highlight.mjs","sources":["../../../../libs/angular-highlight/src/lib/copy-code-button/copy-code-button.component.ts","../../../../libs/angular-highlight/src/lib/copy-code-button/copy-code-button.component.html","../../../../libs/angular-highlight/src/lib/highlight.component.ts","../../../../libs/angular-highlight/src/lib/highlight.component.html","../../../../libs/angular-highlight/src/lib/highlight.module.ts","../../../../libs/angular-highlight/src/covalent-highlight.ts"],"sourcesContent":["import {\n Component,\n Input,\n ViewChild,\n HostListener,\n EventEmitter,\n Output,\n} from '@angular/core';\nimport { MatButtonToggle } from '@angular/material/button-toggle';\nimport { MatTooltip } from '@angular/material/tooltip';\n\nexport interface ICopyCodeTooltips {\n copy?: string;\n copied?: string;\n}\n\nexport interface IRawToggleLabels {\n viewRaw?: string;\n viewCode?: string;\n}\n\n@Component({\n selector: 'td-copy-code-button',\n templateUrl: './copy-code-button.component.html',\n styleUrls: ['./copy-code-button.component.scss'],\n})\nexport class TdCopyCodeButtonComponent {\n // private _copyCodeTooltips: ICopyCodeTooltips = {};\n @Input() copiedContent!: string;\n @Input() copyCodeToClipboard = false;\n /**\n * copyCodeTooltips?: ICopyCodeTooltips\n *\n * Tooltips for copy button to copy and upon copying.\n */\n @Input() copyCodeTooltips?: ICopyCodeTooltips = {};\n\n @Input() toggleRawButton = false;\n @Input() rawToggleLabels?: IRawToggleLabels = {};\n\n rawToggle = false;\n\n @Output() toggleRaw = new EventEmitter<boolean>();\n\n @ViewChild('copyButton') copyButton!: MatButtonToggle;\n @ViewChild('rawButton') rawButton!: MatButtonToggle;\n\n get copyTooltip(): string {\n return (this.copyCodeTooltips && this.copyCodeTooltips.copy) || 'Copy';\n }\n\n get copiedTooltip(): string {\n return (this.copyCodeTooltips && this.copyCodeTooltips.copied) || 'Copied';\n }\n\n get rawToggleText(): string {\n if (this.rawToggle) {\n return this.rawToggleLabels?.viewCode || 'View code';\n } else {\n return this.rawToggleLabels?.viewRaw || 'Raw';\n }\n }\n\n @ViewChild('tooltip') tooltip!: MatTooltip;\n\n textCopied(event: boolean): void {\n if (event) {\n this.tooltip.hide();\n this.tooltip.message = this.copiedTooltip;\n this.tooltip.show();\n }\n }\n @HostListener('mouseleave')\n initializeTooltip(): void {\n setTimeout(() => {\n this.tooltip.message = this.copyTooltip;\n }, 200);\n }\n\n toggleRawClicked(): void {\n this.rawToggle = !this.rawToggle;\n this.toggleRaw.emit();\n this.rawButton.checked = false;\n }\n\n copyClicked(): void {\n console.log('copyClicked');\n this.copyButton.checked = false;\n }\n}\n","<mat-button-toggle-group\n multiple\n class=\"raw-and-copy-buttons\"\n *ngIf=\"toggleRawButton; else button\"\n>\n <mat-button-toggle (click)=\"toggleRawClicked()\" #rawButton>{{\n rawToggleText\n }}</mat-button-toggle>\n <mat-button-toggle\n [cdkCopyToClipboard]=\"copiedContent\"\n [matTooltip]=\"copyTooltip\"\n #tooltip=\"matTooltip\"\n #copyButton\n (click)=\"copyClicked()\"\n (cdkCopyToClipboardCopied)=\"textCopied($event)\"\n >\n <mat-icon width>content_copy</mat-icon>\n </mat-button-toggle>\n</mat-button-toggle-group>\n\n<ng-template #button>\n <button\n mat-icon-button\n [cdkCopyToClipboard]=\"copiedContent\"\n class=\"copy-button\"\n [matTooltip]=\"copyTooltip\"\n #tooltip=\"matTooltip\"\n (cdkCopyToClipboardCopied)=\"textCopied($event)\"\n >\n <mat-icon role=\"img\">content_copy</mat-icon>\n </button>\n</ng-template>\n","import {\n Component,\n AfterViewInit,\n ElementRef,\n Input,\n Output,\n EventEmitter,\n Renderer2,\n SecurityContext,\n ViewChild,\n ChangeDetectorRef,\n AfterViewChecked,\n} from '@angular/core';\nimport { DomSanitizer } from '@angular/platform-browser';\nimport { MatTooltip } from '@angular/material/tooltip';\nimport {\n ICopyCodeTooltips,\n IRawToggleLabels,\n} from './copy-code-button/copy-code-button.component';\n\nimport hljs from 'highlight.js';\n\n@Component({\n selector: 'td-highlight',\n styleUrls: ['./highlight.component.scss'],\n templateUrl: './highlight.component.html',\n})\nexport class TdHighlightComponent implements AfterViewInit, AfterViewChecked {\n private _initialized = false;\n\n private _content!: string;\n private _lang = 'typescript';\n\n private _showRaw = false;\n\n /**\n * content?: string\n *\n * Code content to be parsed as highlighted html.\n * Used to load data dynamically.\n *\n * e.g. `.html`, `.ts` , etc.\n */\n @Input()\n set content(content: string) {\n this._content = content;\n console.log(this._content);\n if (this._initialized) {\n this._loadContent(this._content);\n }\n }\n\n /**\n * copyCodeToClipboard?: boolean\n *\n * Display copy button on code snippets to copy code to clipboard.\n */\n @Input() copyCodeToClipboard? = false;\n\n /**\n * copyCodeTooltips?: ICopyCodeTooltips\n *\n * Tooltips for copy button to copy and upon copying.\n */\n @Input() copyCodeTooltips?: ICopyCodeTooltips = {};\n\n /**\n * toggleRawButton?: boolean\n *\n * Display button to toggle raw code.\n */\n @Input() toggleRawButton = false;\n\n /**\n * rawToggleLabels?: IRawToggleLabels\n *\n * Labels for raw toggle button.\n */\n @Input() rawToggleLabels?: IRawToggleLabels = {};\n\n /**\n * lang?: string\n *\n * Language of the code content to be parsed as highlighted html.\n * Defaults to `typescript`\n *\n * e.g. `typescript`, `html` , etc.\n */\n\n @Input()\n set codeLang(lang: string) {\n this.setLanguage(lang);\n }\n /** @deprecated - removed completely @4.0.0 */\n @Input()\n set lang(lang: string) {\n // tslint:disable-next-line: no-console\n console.warn(\n 'DEPRECATION WARNING: switch to codeLang attribute as lang attribute is deprecated.'\n );\n this.setLanguage(lang);\n }\n\n copyContent!: string;\n\n /**\n * contentReady?: function\n * Event emitted after the highlight content rendering is finished.\n */\n @Output() contentReady: EventEmitter<void> = new EventEmitter<void>();\n @ViewChild('highlightComponent') highlightComp!: ElementRef;\n @ViewChild('copyComponent') copyComp!: ElementRef;\n\n @ViewChild('tooltip') tooltip!: MatTooltip;\n\n constructor(\n private _renderer: Renderer2,\n private _elementRef: ElementRef,\n private _domSanitizer: DomSanitizer,\n private cdr: ChangeDetectorRef\n ) {}\n\n ngAfterViewChecked(): void {\n this.cdr.detectChanges();\n }\n\n ngAfterViewInit(): void {\n if (!this._content) {\n this._content =\n (<HTMLElement>this.highlightComp.nativeElement).textContent || '';\n }\n this._loadContent(this._content);\n\n this._initialized = true;\n }\n\n setLanguage(lang: string): void {\n if (!lang) {\n throw new Error(\n 'Error: language attribute must be defined in TdHighlightComponent.'\n );\n }\n this._lang = lang;\n if (this._initialized) {\n this._loadContent(this._content);\n }\n }\n\n toggleRawClicked(): void {\n this._showRaw = !this._showRaw;\n this._elementRef.nativeElement.querySelector('pre').style.display = this\n ._showRaw\n ? 'none'\n : 'block';\n this._elementRef.nativeElement.querySelector('.raw').style.display = this\n ._showRaw\n ? 'block'\n : 'none';\n }\n\n /**\n * General method to parse a string of code into HTML Elements and load them into the container\n */\n private _loadContent(code: string | null): void {\n if (code && code.trim().length > 0) {\n // Clean container\n this._renderer.setProperty(\n this._elementRef.nativeElement,\n 'innerHTML',\n ''\n );\n\n this._elementFromString(code);\n\n if (this.copyCodeToClipboard) {\n this._renderer.appendChild(\n this._elementRef.nativeElement,\n this.copyComp.nativeElement\n );\n }\n }\n this.contentReady.emit();\n }\n\n private _elementFromString(codeStr: string): void {\n // Renderer2 doesnt have a parsing method, so we have to sanitize and use [innerHTML]\n // to parse the string into DOM element for now.\n const preElement: HTMLPreElement = this._renderer.createElement('pre');\n this._renderer.appendChild(this._elementRef.nativeElement, preElement);\n const codeElement: HTMLElement = this._renderer.createElement('code');\n this._renderer.appendChild(preElement, codeElement);\n // Set .highlight class into <code> element\n this._renderer.addClass(codeElement, 'highlight');\n\n const highlightedCode = this._render(codeStr);\n\n codeElement.innerHTML =\n this._domSanitizer.sanitize(SecurityContext.HTML, highlightedCode) ?? '';\n\n if (this.toggleRawButton) {\n const divElement: HTMLDivElement = this._renderer.createElement('div');\n divElement.className = 'raw';\n this._renderer.appendChild(this._elementRef.nativeElement, divElement);\n divElement.innerHTML =\n this._domSanitizer.sanitize(SecurityContext.HTML, codeStr) ?? '';\n this._renderer.setStyle(divElement, 'display', 'none');\n }\n }\n\n private _render(contents: string): string {\n // Trim leading and trailing newlines\n contents = contents\n .replace(/^(\\s|\\t)*\\n+/g, '')\n .replace(/(\\s|\\t)*\\n+(\\s|\\t)*$/g, '');\n // Split markup by line characters\n let lines: string[] = contents.split('\\n');\n\n // check how much indentation is used by the first actual code line\n const firstLineWhitespaceMatch = lines[0].match(/^(\\s|\\t)*/);\n const firstLineWhitespace = firstLineWhitespaceMatch\n ? firstLineWhitespaceMatch[0]\n : null;\n\n // Remove all indentation spaces so code can be parsed correctly\n const startingWhitespaceRegex = new RegExp('^' + firstLineWhitespace);\n lines = lines.map(function (line: string): string {\n return line\n .replace('=\"\"', '') // remove empty values\n .replace(startingWhitespaceRegex, '')\n .replace(/\\s+$/, ''); // remove trailing white spaces\n });\n\n const codeToParse: string = lines\n .join('\\n')\n .replace(/\\{ \\{/gi, '{{')\n .replace(/\\} \\}/gi, '}}')\n .replace(/</gi, '<')\n .replace(/>/gi, '>'); // replace with < and > to render HTML in Angular\n this.copyContent = codeToParse;\n // Parse code with highlight.js depending on language\n const highlightedCode: any = hljs.highlight(this._lang, codeToParse, true);\n highlightedCode.value = highlightedCode.value\n .replace(/=<span class=\"hljs-value\">\"\"<\\/span>/gi, '')\n .replace('<head>', '')\n .replace('<head/>', '');\n return highlightedCode.value;\n }\n}\n","<div>\n <div #highlightComponent>\n <ng-content></ng-content>\n </div>\n\n <div #copyComponent *ngIf=\"copyCodeToClipboard\">\n <td-copy-code-button\n [toggleRawButton]=\"toggleRawButton\"\n [rawToggleLabels]=\"rawToggleLabels\"\n (toggleRaw)=\"toggleRawClicked()\"\n [copiedContent]=\"copyContent\"\n [copyCodeToClipboard]=\"copyCodeToClipboard\"\n [copyCodeTooltips]=\"copyCodeTooltips\"\n ></td-copy-code-button>\n </div>\n</div>\n","import { NgModule } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { ClipboardModule } from '@angular/cdk/clipboard';\nimport { TdHighlightComponent } from './highlight.component';\nimport { MatIconModule } from '@angular/material/icon';\nimport { MatTooltipModule } from '@angular/material/tooltip';\nimport { MatButtonModule } from '@angular/material/button';\nimport { MatButtonToggleModule } from '@angular/material/button-toggle';\nimport { TdCopyCodeButtonComponent } from './copy-code-button/copy-code-button.component';\n\n@NgModule({\n imports: [\n CommonModule,\n ClipboardModule,\n MatIconModule,\n MatButtonToggleModule,\n MatButtonModule,\n MatTooltipModule,\n MatButtonModule,\n ],\n declarations: [TdHighlightComponent, TdCopyCodeButtonComponent],\n exports: [TdHighlightComponent],\n})\nexport class CovalentHighlightModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"],"names":["i1","i2","i3.TdCopyCodeButtonComponent"],"mappings":";;;;;;;;;;;;;;;;;MA0Ba,yBAAyB,CAAA;AALtC,IAAA,WAAA,GAAA;AAQW,QAAA,IAAmB,CAAA,mBAAA,GAAG,KAAK,CAAC;AACrC;;;;AAIG;AACM,QAAA,IAAgB,CAAA,gBAAA,GAAuB,EAAE,CAAC;AAE1C,QAAA,IAAe,CAAA,eAAA,GAAG,KAAK,CAAC;AACxB,QAAA,IAAe,CAAA,eAAA,GAAsB,EAAE,CAAC;AAEjD,QAAA,IAAS,CAAA,SAAA,GAAG,KAAK,CAAC;AAER,QAAA,IAAA,CAAA,SAAS,GAAG,IAAI,YAAY,EAAW,CAAC;KA+CnD;AA1CC,IAAA,IAAI,WAAW,GAAA;AACb,QAAA,OAAO,CAAC,IAAI,CAAC,gBAAgB,IAAI,IAAI,CAAC,gBAAgB,CAAC,IAAI,KAAK,MAAM,CAAC;KACxE;AAED,IAAA,IAAI,aAAa,GAAA;AACf,QAAA,OAAO,CAAC,IAAI,CAAC,gBAAgB,IAAI,IAAI,CAAC,gBAAgB,CAAC,MAAM,KAAK,QAAQ,CAAC;KAC5E;AAED,IAAA,IAAI,aAAa,GAAA;;QACf,IAAI,IAAI,CAAC,SAAS,EAAE;YAClB,OAAO,CAAA,MAAA,IAAI,CAAC,eAAe,MAAE,IAAA,IAAA,EAAA,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,EAAA,CAAA,QAAQ,KAAI,WAAW,CAAC;AACtD,S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