@covalent/highlight 4.16.0-beta.1 → 4.16.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 +45 -9
- package/esm2020/lib/highlight.component.mjs +50 -15
- package/esm2020/lib/highlight.module.mjs +18 -9
- package/fesm2015/covalent-highlight.mjs +112 -33
- package/fesm2015/covalent-highlight.mjs.map +1 -1
- package/fesm2020/covalent-highlight.mjs +109 -31
- 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 +8 -8
- /package/{index.d.ts → covalent-highlight.d.ts} +0 -0
|
@@ -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 * as i1$1 from '@angular/platform-browser';
|
|
4
|
-
import * as
|
|
4
|
+
import * as i6 from '@angular/material/tooltip';
|
|
5
5
|
import { MatTooltipModule } from '@angular/material/tooltip';
|
|
6
6
|
import hljs from 'highlight.js';
|
|
7
|
-
import * as
|
|
8
|
-
import {
|
|
9
|
-
import * as i1 from '@angular/cdk/clipboard';
|
|
10
|
-
import { ClipboardModule } from '@angular/cdk/clipboard';
|
|
7
|
+
import * as i1 from '@angular/material/button-toggle';
|
|
8
|
+
import { MatButtonToggleModule } from '@angular/material/button-toggle';
|
|
11
9
|
import * as i2 from '@angular/material/icon';
|
|
12
10
|
import { MatIconModule } from '@angular/material/icon';
|
|
13
|
-
import * as
|
|
11
|
+
import * as i3 from '@angular/material/button';
|
|
14
12
|
import { MatButtonModule } from '@angular/material/button';
|
|
13
|
+
import * as i4 from '@angular/common';
|
|
14
|
+
import { CommonModule } from '@angular/common';
|
|
15
|
+
import * as i5 from '@angular/cdk/clipboard';
|
|
16
|
+
import { ClipboardModule } from '@angular/cdk/clipboard';
|
|
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,14 @@ class TdCopyCodeButtonComponent {
|
|
|
29
35
|
get copiedTooltip() {
|
|
30
36
|
return (this.copyCodeTooltips && this.copyCodeTooltips.copied) || 'Copied';
|
|
31
37
|
}
|
|
38
|
+
get rawToggleText() {
|
|
39
|
+
if (this.rawToggle) {
|
|
40
|
+
return this.rawToggleLabels?.viewCode || 'View code';
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
return this.rawToggleLabels?.viewRaw || 'Raw';
|
|
44
|
+
}
|
|
45
|
+
}
|
|
32
46
|
textCopied(event) {
|
|
33
47
|
if (event) {
|
|
34
48
|
this.tooltip.hide();
|
|
@@ -41,18 +55,39 @@ class TdCopyCodeButtonComponent {
|
|
|
41
55
|
this.tooltip.message = this.copyTooltip;
|
|
42
56
|
}, 200);
|
|
43
57
|
}
|
|
58
|
+
toggleRawClicked() {
|
|
59
|
+
this.rawToggle = !this.rawToggle;
|
|
60
|
+
this.toggleRaw.emit();
|
|
61
|
+
this.rawButton.checked = false;
|
|
62
|
+
}
|
|
63
|
+
copyClicked() {
|
|
64
|
+
console.log('copyClicked');
|
|
65
|
+
this.copyButton.checked = false;
|
|
66
|
+
}
|
|
44
67
|
}
|
|
45
|
-
TdCopyCodeButtonComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
46
|
-
TdCopyCodeButtonComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "
|
|
47
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
68
|
+
TdCopyCodeButtonComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: TdCopyCodeButtonComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
69
|
+
TdCopyCodeButtonComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.2", 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"], components: [{ type: i1.MatButtonToggle, selector: "mat-button-toggle", inputs: ["disableRipple", "aria-label", "aria-labelledby", "id", "name", "value", "tabIndex", "appearance", "checked", "disabled"], outputs: ["change"], exportAs: ["matButtonToggle"] }, { type: i2.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { type: i3.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }], directives: [{ type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i1.MatButtonToggleGroup, selector: "mat-button-toggle-group", inputs: ["appearance", "name", "vertical", "value", "multiple", "disabled"], outputs: ["valueChange", "change"], exportAs: ["matButtonToggleGroup"] }, { type: i5.CdkCopyToClipboard, selector: "[cdkCopyToClipboard]", inputs: ["cdkCopyToClipboard", "cdkCopyToClipboardAttempts"], outputs: ["cdkCopyToClipboardCopied"] }, { type: i6.MatTooltip, selector: "[matTooltip]", exportAs: ["matTooltip"] }] });
|
|
70
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: TdCopyCodeButtonComponent, decorators: [{
|
|
48
71
|
type: Component,
|
|
49
|
-
args: [{ selector: 'td-copy-code-button', template: "<button\n mat-icon-button\n [cdkCopyToClipboard]=\"copiedContent\"\n
|
|
72
|
+
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
73
|
}], propDecorators: { copiedContent: [{
|
|
51
74
|
type: Input
|
|
52
75
|
}], copyCodeToClipboard: [{
|
|
53
76
|
type: Input
|
|
54
77
|
}], copyCodeTooltips: [{
|
|
55
78
|
type: Input
|
|
79
|
+
}], toggleRawButton: [{
|
|
80
|
+
type: Input
|
|
81
|
+
}], rawToggleLabels: [{
|
|
82
|
+
type: Input
|
|
83
|
+
}], toggleRaw: [{
|
|
84
|
+
type: Output
|
|
85
|
+
}], copyButton: [{
|
|
86
|
+
type: ViewChild,
|
|
87
|
+
args: ['copyButton']
|
|
88
|
+
}], rawButton: [{
|
|
89
|
+
type: ViewChild,
|
|
90
|
+
args: ['rawButton']
|
|
56
91
|
}], tooltip: [{
|
|
57
92
|
type: ViewChild,
|
|
58
93
|
args: ['tooltip']
|
|
@@ -69,6 +104,7 @@ class TdHighlightComponent {
|
|
|
69
104
|
this.cdr = cdr;
|
|
70
105
|
this._initialized = false;
|
|
71
106
|
this._lang = 'typescript';
|
|
107
|
+
this._showRaw = false;
|
|
72
108
|
/**
|
|
73
109
|
* copyCodeToClipboard?: boolean
|
|
74
110
|
*
|
|
@@ -81,6 +117,18 @@ class TdHighlightComponent {
|
|
|
81
117
|
* Tooltips for copy button to copy and upon copying.
|
|
82
118
|
*/
|
|
83
119
|
this.copyCodeTooltips = {};
|
|
120
|
+
/**
|
|
121
|
+
* toggleRawButton?: boolean
|
|
122
|
+
*
|
|
123
|
+
* Display button to toggle raw code.
|
|
124
|
+
*/
|
|
125
|
+
this.toggleRawButton = false;
|
|
126
|
+
/**
|
|
127
|
+
* rawToggleLabels?: IRawToggleLabels
|
|
128
|
+
*
|
|
129
|
+
* Labels for raw toggle button.
|
|
130
|
+
*/
|
|
131
|
+
this.rawToggleLabels = {};
|
|
84
132
|
/**
|
|
85
133
|
* contentReady?: function
|
|
86
134
|
* Event emitted after the highlight content rendering is finished.
|
|
@@ -97,6 +145,7 @@ class TdHighlightComponent {
|
|
|
97
145
|
*/
|
|
98
146
|
set content(content) {
|
|
99
147
|
this._content = content;
|
|
148
|
+
console.log(this._content);
|
|
100
149
|
if (this._initialized) {
|
|
101
150
|
this._loadContent(this._content);
|
|
102
151
|
}
|
|
@@ -123,11 +172,10 @@ class TdHighlightComponent {
|
|
|
123
172
|
}
|
|
124
173
|
ngAfterViewInit() {
|
|
125
174
|
if (!this._content) {
|
|
126
|
-
this.
|
|
127
|
-
|
|
128
|
-
else {
|
|
129
|
-
this._loadContent(this._content);
|
|
175
|
+
this._content =
|
|
176
|
+
this.highlightComp.nativeElement.textContent || '';
|
|
130
177
|
}
|
|
178
|
+
this._loadContent(this._content);
|
|
131
179
|
this._initialized = true;
|
|
132
180
|
}
|
|
133
181
|
setLanguage(lang) {
|
|
@@ -139,6 +187,17 @@ class TdHighlightComponent {
|
|
|
139
187
|
this._loadContent(this._content);
|
|
140
188
|
}
|
|
141
189
|
}
|
|
190
|
+
toggleRawClicked() {
|
|
191
|
+
this._showRaw = !this._showRaw;
|
|
192
|
+
this._elementRef.nativeElement.querySelector('pre').style.display = this
|
|
193
|
+
._showRaw
|
|
194
|
+
? 'none'
|
|
195
|
+
: 'block';
|
|
196
|
+
this._elementRef.nativeElement.querySelector('.raw').style.display = this
|
|
197
|
+
._showRaw
|
|
198
|
+
? 'block'
|
|
199
|
+
: 'none';
|
|
200
|
+
}
|
|
142
201
|
/**
|
|
143
202
|
* General method to parse a string of code into HTML Elements and load them into the container
|
|
144
203
|
*/
|
|
@@ -146,8 +205,7 @@ class TdHighlightComponent {
|
|
|
146
205
|
if (code && code.trim().length > 0) {
|
|
147
206
|
// Clean container
|
|
148
207
|
this._renderer.setProperty(this._elementRef.nativeElement, 'innerHTML', '');
|
|
149
|
-
|
|
150
|
-
this._elementFromString(this._render(code));
|
|
208
|
+
this._elementFromString(code);
|
|
151
209
|
if (this.copyCodeToClipboard) {
|
|
152
210
|
this._renderer.appendChild(this._elementRef.nativeElement, this.copyComp.nativeElement);
|
|
153
211
|
}
|
|
@@ -163,9 +221,17 @@ class TdHighlightComponent {
|
|
|
163
221
|
this._renderer.appendChild(preElement, codeElement);
|
|
164
222
|
// Set .highlight class into <code> element
|
|
165
223
|
this._renderer.addClass(codeElement, 'highlight');
|
|
224
|
+
const highlightedCode = this._render(codeStr);
|
|
166
225
|
codeElement.innerHTML =
|
|
167
|
-
this._domSanitizer.sanitize(SecurityContext.HTML,
|
|
168
|
-
|
|
226
|
+
this._domSanitizer.sanitize(SecurityContext.HTML, highlightedCode) ?? '';
|
|
227
|
+
if (this.toggleRawButton) {
|
|
228
|
+
const divElement = this._renderer.createElement('div');
|
|
229
|
+
divElement.className = 'raw';
|
|
230
|
+
this._renderer.appendChild(this._elementRef.nativeElement, divElement);
|
|
231
|
+
divElement.innerHTML =
|
|
232
|
+
this._domSanitizer.sanitize(SecurityContext.HTML, codeStr) ?? '';
|
|
233
|
+
this._renderer.setStyle(divElement, 'display', 'none');
|
|
234
|
+
}
|
|
169
235
|
}
|
|
170
236
|
_render(contents) {
|
|
171
237
|
// Trim leading and trailing newlines
|
|
@@ -203,17 +269,21 @@ class TdHighlightComponent {
|
|
|
203
269
|
return highlightedCode.value;
|
|
204
270
|
}
|
|
205
271
|
}
|
|
206
|
-
TdHighlightComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
207
|
-
TdHighlightComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "
|
|
208
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
272
|
+
TdHighlightComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: TdHighlightComponent, deps: [{ token: i0.Renderer2 }, { token: i0.ElementRef }, { token: i1$1.DomSanitizer }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
273
|
+
TdHighlightComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.2.2", 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"], components: [{ type: TdCopyCodeButtonComponent, selector: "td-copy-code-button", inputs: ["copiedContent", "copyCodeToClipboard", "copyCodeTooltips", "toggleRawButton", "rawToggleLabels"], outputs: ["toggleRaw"] }], directives: [{ type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
|
|
274
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: TdHighlightComponent, decorators: [{
|
|
209
275
|
type: Component,
|
|
210
|
-
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"] }]
|
|
276
|
+
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"] }]
|
|
211
277
|
}], ctorParameters: function () { return [{ type: i0.Renderer2 }, { type: i0.ElementRef }, { type: i1$1.DomSanitizer }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { content: [{
|
|
212
278
|
type: Input
|
|
213
279
|
}], copyCodeToClipboard: [{
|
|
214
280
|
type: Input
|
|
215
281
|
}], copyCodeTooltips: [{
|
|
216
282
|
type: Input
|
|
283
|
+
}], toggleRawButton: [{
|
|
284
|
+
type: Input
|
|
285
|
+
}], rawToggleLabels: [{
|
|
286
|
+
type: Input
|
|
217
287
|
}], codeLang: [{
|
|
218
288
|
type: Input
|
|
219
289
|
}], lang: [{
|
|
@@ -233,24 +303,32 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImpo
|
|
|
233
303
|
|
|
234
304
|
class CovalentHighlightModule {
|
|
235
305
|
}
|
|
236
|
-
CovalentHighlightModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
237
|
-
CovalentHighlightModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "
|
|
306
|
+
CovalentHighlightModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: CovalentHighlightModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
307
|
+
CovalentHighlightModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: CovalentHighlightModule, declarations: [TdHighlightComponent, TdCopyCodeButtonComponent], imports: [CommonModule,
|
|
238
308
|
ClipboardModule,
|
|
239
309
|
MatIconModule,
|
|
310
|
+
MatButtonToggleModule,
|
|
311
|
+
MatButtonModule,
|
|
240
312
|
MatTooltipModule,
|
|
241
313
|
MatButtonModule], exports: [TdHighlightComponent] });
|
|
242
|
-
CovalentHighlightModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
314
|
+
CovalentHighlightModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: CovalentHighlightModule, imports: [[
|
|
315
|
+
CommonModule,
|
|
316
|
+
ClipboardModule,
|
|
317
|
+
MatIconModule,
|
|
318
|
+
MatButtonToggleModule,
|
|
319
|
+
MatButtonModule,
|
|
320
|
+
MatTooltipModule,
|
|
321
|
+
MatButtonModule,
|
|
322
|
+
]] });
|
|
323
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.2.2", ngImport: i0, type: CovalentHighlightModule, decorators: [{
|
|
248
324
|
type: NgModule,
|
|
249
325
|
args: [{
|
|
250
326
|
imports: [
|
|
251
327
|
CommonModule,
|
|
252
328
|
ClipboardModule,
|
|
253
329
|
MatIconModule,
|
|
330
|
+
MatButtonToggleModule,
|
|
331
|
+
MatButtonModule,
|
|
254
332
|
MatTooltipModule,
|
|
255
333
|
MatButtonModule,
|
|
256
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;QAQW,IAAmB,CAAA,mBAAA,GAAG,KAAK,CAAC;AACrC;;;;AAIG;QACM,IAAgB,CAAA,gBAAA,GAAuB,EAAE,CAAC;AAyBpD,KAAA;AAvBC,IAAA,IAAI,WAAW,GAAA;AACb,QAAA,OAAO,CAAC,IAAI,CAAC,gBAAgB,IAAI,IAAI,CAAC,gBAAgB,CAAC,IA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AChB,eAAe;AAChB,qBAAA;AACD,oBAAA,YAAY,EAAE,CAAC,oBAAoB,EAAE,yBAAyB,CAAC;oBAC/D,OAAO,EAAE,CAAC,oBAAoB,CAAC;AAChC,iBAAA,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.TdCopyCodeButtonComponent","i3"],"mappings":";;;;;;;;;;;;;;;;;MA0Ba,yBAAyB,CAAA;AALtC,IAAA,WAAA,GAAA;QAQW,IAAmB,CAAA,mBAAA,GAAG,KAAK,CAAC;AACrC;;;;AAIG;QACM,IAAgB,CAAA,gBAAA,GAAuB,EAAE,CAAC;QAE1C,IAAe,CAAA,eAAA,GAAG,KAAK,CAAC;QACxB,IAAe,CAAA,eAAA,GAAsB,EAAE,CAAC;QAEjD,IAAS,CAAA,SAAA,GAAG,KAAK,CAAC;AAER,QAAA,IAAA,CAAA,SAAS,GAAG,IAAI,YAAY,EAAW,CAAC;AA+CnD,KAAA;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,KAA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eAAe;AAChB,SAAA,CAAA,EAAA,CAAA,CAAA;2FAIU,uBAAuB,EAAA,UAAA,EAAA,CAAA;kBAbnC,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,OAAO,EAAE;wBACP,YAAY;wBACZ,eAAe;wBACf,aAAa;wBACb,qBAAqB;wBACrB,eAAe;wBACf,gBAAgB;wBAChB,eAAe;AAChB,qBAAA;AACD,oBAAA,YAAY,EAAE,CAAC,oBAAoB,EAAE,yBAAyB,CAAC;oBAC/D,OAAO,EAAE,CAAC,oBAAoB,CAAC;AAChC,iBAAA,CAAA;;;ACtBD;;AAEG;;;;"}
|
|
@@ -1,9 +1,15 @@
|
|
|
1
|
+
import { EventEmitter } from '@angular/core';
|
|
2
|
+
import { MatButtonToggle } from '@angular/material/button-toggle';
|
|
1
3
|
import { MatTooltip } from '@angular/material/tooltip';
|
|
2
4
|
import * as i0 from "@angular/core";
|
|
3
5
|
export interface ICopyCodeTooltips {
|
|
4
6
|
copy?: string;
|
|
5
7
|
copied?: string;
|
|
6
8
|
}
|
|
9
|
+
export interface IRawToggleLabels {
|
|
10
|
+
viewRaw?: string;
|
|
11
|
+
viewCode?: string;
|
|
12
|
+
}
|
|
7
13
|
export declare class TdCopyCodeButtonComponent {
|
|
8
14
|
copiedContent: string;
|
|
9
15
|
copyCodeToClipboard: boolean;
|
|
@@ -13,11 +19,20 @@ export declare class TdCopyCodeButtonComponent {
|
|
|
13
19
|
* Tooltips for copy button to copy and upon copying.
|
|
14
20
|
*/
|
|
15
21
|
copyCodeTooltips?: ICopyCodeTooltips;
|
|
22
|
+
toggleRawButton: boolean;
|
|
23
|
+
rawToggleLabels?: IRawToggleLabels;
|
|
24
|
+
rawToggle: boolean;
|
|
25
|
+
toggleRaw: EventEmitter<boolean>;
|
|
26
|
+
copyButton: MatButtonToggle;
|
|
27
|
+
rawButton: MatButtonToggle;
|
|
16
28
|
get copyTooltip(): string;
|
|
17
29
|
get copiedTooltip(): string;
|
|
30
|
+
get rawToggleText(): string;
|
|
18
31
|
tooltip: MatTooltip;
|
|
19
32
|
textCopied(event: boolean): void;
|
|
20
33
|
initializeTooltip(): void;
|
|
34
|
+
toggleRawClicked(): void;
|
|
35
|
+
copyClicked(): void;
|
|
21
36
|
static ɵfac: i0.ɵɵFactoryDeclaration<TdCopyCodeButtonComponent, never>;
|
|
22
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<TdCopyCodeButtonComponent, "td-copy-code-button", never, { "copiedContent": "copiedContent"; "copyCodeToClipboard": "copyCodeToClipboard"; "copyCodeTooltips": "copyCodeTooltips"; }, {}, never, never
|
|
37
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<TdCopyCodeButtonComponent, "td-copy-code-button", never, { "copiedContent": "copiedContent"; "copyCodeToClipboard": "copyCodeToClipboard"; "copyCodeTooltips": "copyCodeTooltips"; "toggleRawButton": "toggleRawButton"; "rawToggleLabels": "rawToggleLabels"; }, { "toggleRaw": "toggleRaw"; }, never, never>;
|
|
23
38
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AfterViewInit, ElementRef, EventEmitter, Renderer2, ChangeDetectorRef, AfterViewChecked } from '@angular/core';
|
|
2
2
|
import { DomSanitizer } from '@angular/platform-browser';
|
|
3
3
|
import { MatTooltip } from '@angular/material/tooltip';
|
|
4
|
-
import { ICopyCodeTooltips } from './copy-code-button/copy-code-button.component';
|
|
4
|
+
import { ICopyCodeTooltips, IRawToggleLabels } from './copy-code-button/copy-code-button.component';
|
|
5
5
|
import * as i0 from "@angular/core";
|
|
6
6
|
export declare class TdHighlightComponent implements AfterViewInit, AfterViewChecked {
|
|
7
7
|
private _renderer;
|
|
@@ -11,6 +11,7 @@ export declare class TdHighlightComponent implements AfterViewInit, AfterViewChe
|
|
|
11
11
|
private _initialized;
|
|
12
12
|
private _content;
|
|
13
13
|
private _lang;
|
|
14
|
+
private _showRaw;
|
|
14
15
|
/**
|
|
15
16
|
* content?: string
|
|
16
17
|
*
|
|
@@ -32,6 +33,18 @@ export declare class TdHighlightComponent implements AfterViewInit, AfterViewChe
|
|
|
32
33
|
* Tooltips for copy button to copy and upon copying.
|
|
33
34
|
*/
|
|
34
35
|
copyCodeTooltips?: ICopyCodeTooltips;
|
|
36
|
+
/**
|
|
37
|
+
* toggleRawButton?: boolean
|
|
38
|
+
*
|
|
39
|
+
* Display button to toggle raw code.
|
|
40
|
+
*/
|
|
41
|
+
toggleRawButton: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* rawToggleLabels?: IRawToggleLabels
|
|
44
|
+
*
|
|
45
|
+
* Labels for raw toggle button.
|
|
46
|
+
*/
|
|
47
|
+
rawToggleLabels?: IRawToggleLabels;
|
|
35
48
|
/**
|
|
36
49
|
* lang?: string
|
|
37
50
|
*
|
|
@@ -56,6 +69,7 @@ export declare class TdHighlightComponent implements AfterViewInit, AfterViewChe
|
|
|
56
69
|
ngAfterViewChecked(): void;
|
|
57
70
|
ngAfterViewInit(): void;
|
|
58
71
|
setLanguage(lang: string): void;
|
|
72
|
+
toggleRawClicked(): void;
|
|
59
73
|
/**
|
|
60
74
|
* General method to parse a string of code into HTML Elements and load them into the container
|
|
61
75
|
*/
|
|
@@ -63,5 +77,5 @@ export declare class TdHighlightComponent implements AfterViewInit, AfterViewChe
|
|
|
63
77
|
private _elementFromString;
|
|
64
78
|
private _render;
|
|
65
79
|
static ɵfac: i0.ɵɵFactoryDeclaration<TdHighlightComponent, never>;
|
|
66
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<TdHighlightComponent, "td-highlight", never, { "content": "content"; "copyCodeToClipboard": "copyCodeToClipboard"; "copyCodeTooltips": "copyCodeTooltips"; "codeLang": "codeLang"; "lang": "lang"; }, { "contentReady": "contentReady"; }, never, ["*"]
|
|
80
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<TdHighlightComponent, "td-highlight", never, { "content": "content"; "copyCodeToClipboard": "copyCodeToClipboard"; "copyCodeTooltips": "copyCodeTooltips"; "toggleRawButton": "toggleRawButton"; "rawToggleLabels": "rawToggleLabels"; "codeLang": "codeLang"; "lang": "lang"; }, { "contentReady": "contentReady"; }, never, ["*"]>;
|
|
67
81
|
}
|
|
@@ -4,10 +4,11 @@ import * as i2 from "./copy-code-button/copy-code-button.component";
|
|
|
4
4
|
import * as i3 from "@angular/common";
|
|
5
5
|
import * as i4 from "@angular/cdk/clipboard";
|
|
6
6
|
import * as i5 from "@angular/material/icon";
|
|
7
|
-
import * as i6 from "@angular/material/
|
|
7
|
+
import * as i6 from "@angular/material/button-toggle";
|
|
8
8
|
import * as i7 from "@angular/material/button";
|
|
9
|
+
import * as i8 from "@angular/material/tooltip";
|
|
9
10
|
export declare class CovalentHighlightModule {
|
|
10
11
|
static ɵfac: i0.ɵɵFactoryDeclaration<CovalentHighlightModule, never>;
|
|
11
|
-
static ɵmod: i0.ɵɵNgModuleDeclaration<CovalentHighlightModule, [typeof i1.TdHighlightComponent, typeof i2.TdCopyCodeButtonComponent], [typeof i3.CommonModule, typeof i4.ClipboardModule, typeof i5.MatIconModule, typeof i6.MatTooltipModule, typeof i7.MatButtonModule], [typeof i1.TdHighlightComponent]>;
|
|
12
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<CovalentHighlightModule, [typeof i1.TdHighlightComponent, typeof i2.TdCopyCodeButtonComponent], [typeof i3.CommonModule, typeof i4.ClipboardModule, typeof i5.MatIconModule, typeof i6.MatButtonToggleModule, typeof i7.MatButtonModule, typeof i8.MatTooltipModule, typeof i7.MatButtonModule], [typeof i1.TdHighlightComponent]>;
|
|
12
13
|
static ɵinj: i0.ɵɵInjectorDeclaration<CovalentHighlightModule>;
|
|
13
14
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@covalent/highlight",
|
|
3
|
-
"version": "4.16.0
|
|
3
|
+
"version": "4.16.0",
|
|
4
4
|
"description": "Teradata UI Platform Highlight Module",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"angular",
|
|
@@ -20,11 +20,11 @@
|
|
|
20
20
|
"author": "Teradata UX",
|
|
21
21
|
"peerDependencies": {
|
|
22
22
|
"highlight.js": "^11.4.0",
|
|
23
|
-
"@angular/common": "^
|
|
24
|
-
"@angular/core": "^
|
|
25
|
-
"@angular/platform-browser": "^
|
|
26
|
-
"@angular/cdk": "^
|
|
27
|
-
"@angular/material": "^
|
|
23
|
+
"@angular/common": "^13.2.0",
|
|
24
|
+
"@angular/core": "^13.2.0",
|
|
25
|
+
"@angular/platform-browser": "^13.2.0",
|
|
26
|
+
"@angular/cdk": "^13.2.0",
|
|
27
|
+
"@angular/material": "^13.2.1"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"tslib": "^2.0.0"
|
|
@@ -34,13 +34,13 @@
|
|
|
34
34
|
"esm2020": "esm2020/covalent-highlight.mjs",
|
|
35
35
|
"fesm2020": "fesm2020/covalent-highlight.mjs",
|
|
36
36
|
"fesm2015": "fesm2015/covalent-highlight.mjs",
|
|
37
|
-
"typings": "
|
|
37
|
+
"typings": "covalent-highlight.d.ts",
|
|
38
38
|
"exports": {
|
|
39
39
|
"./package.json": {
|
|
40
40
|
"default": "./package.json"
|
|
41
41
|
},
|
|
42
42
|
".": {
|
|
43
|
-
"types": "./
|
|
43
|
+
"types": "./covalent-highlight.d.ts",
|
|
44
44
|
"esm2020": "./esm2020/covalent-highlight.mjs",
|
|
45
45
|
"es2020": "./fesm2020/covalent-highlight.mjs",
|
|
46
46
|
"es2015": "./fesm2015/covalent-highlight.mjs",
|
|
File without changes
|