@covalent/highlight 5.1.0-beta.1 → 5.1.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 +63 -68
- package/esm2020/lib/copy-code-button/copy-code-button.component.mjs +45 -10
- package/esm2020/lib/highlight.component.mjs +73 -38
- package/esm2020/lib/highlight.module.mjs +12 -5
- package/fesm2015/covalent-highlight.mjs +129 -53
- package/fesm2015/covalent-highlight.mjs.map +1 -1
- package/fesm2020/covalent-highlight.mjs +126 -51
- 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 +6 -6
|
@@ -1,16 +1,18 @@
|
|
|
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
|
|
7
|
+
import * as i1 from '@angular/common';
|
|
8
8
|
import { CommonModule } from '@angular/common';
|
|
9
|
-
import * as
|
|
9
|
+
import * as i4 from '@angular/material/button-toggle';
|
|
10
|
+
import { MatButtonToggleModule } from '@angular/material/button-toggle';
|
|
11
|
+
import * as i2 from '@angular/cdk/clipboard';
|
|
10
12
|
import { ClipboardModule } from '@angular/cdk/clipboard';
|
|
11
|
-
import * as
|
|
13
|
+
import * as i3 from '@angular/material/icon';
|
|
12
14
|
import { MatIconModule } from '@angular/material/icon';
|
|
13
|
-
import * as
|
|
15
|
+
import * as i5 from '@angular/material/button';
|
|
14
16
|
import { MatButtonModule } from '@angular/material/button';
|
|
15
17
|
|
|
16
18
|
class TdCopyCodeButtonComponent {
|
|
@@ -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,38 @@ 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
|
+
this.copyButton.checked = false;
|
|
65
|
+
}
|
|
44
66
|
}
|
|
45
|
-
TdCopyCodeButtonComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
46
|
-
TdCopyCodeButtonComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "
|
|
47
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
67
|
+
TdCopyCodeButtonComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: TdCopyCodeButtonComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
68
|
+
TdCopyCodeButtonComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.12", 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.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"] }, { kind: "directive", type: i6.MatTooltip, selector: "[matTooltip]", exportAs: ["matTooltip"] }] });
|
|
69
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: TdCopyCodeButtonComponent, decorators: [{
|
|
48
70
|
type: Component,
|
|
49
|
-
args: [{ selector: 'td-copy-code-button', template: "<button\n mat-icon-button\n [cdkCopyToClipboard]=\"copiedContent\"\n
|
|
71
|
+
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
72
|
}], propDecorators: { copiedContent: [{
|
|
51
73
|
type: Input
|
|
52
74
|
}], copyCodeToClipboard: [{
|
|
53
75
|
type: Input
|
|
54
76
|
}], copyCodeTooltips: [{
|
|
55
77
|
type: Input
|
|
78
|
+
}], toggleRawButton: [{
|
|
79
|
+
type: Input
|
|
80
|
+
}], rawToggleLabels: [{
|
|
81
|
+
type: Input
|
|
82
|
+
}], toggleRaw: [{
|
|
83
|
+
type: Output
|
|
84
|
+
}], copyButton: [{
|
|
85
|
+
type: ViewChild,
|
|
86
|
+
args: ['copyButton']
|
|
87
|
+
}], rawButton: [{
|
|
88
|
+
type: ViewChild,
|
|
89
|
+
args: ['rawButton']
|
|
56
90
|
}], tooltip: [{
|
|
57
91
|
type: ViewChild,
|
|
58
92
|
args: ['tooltip']
|
|
@@ -62,6 +96,44 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.5", ngImpor
|
|
|
62
96
|
}] } });
|
|
63
97
|
|
|
64
98
|
class TdHighlightComponent {
|
|
99
|
+
constructor(_renderer, _elementRef, _domSanitizer, cdr) {
|
|
100
|
+
this._renderer = _renderer;
|
|
101
|
+
this._elementRef = _elementRef;
|
|
102
|
+
this._domSanitizer = _domSanitizer;
|
|
103
|
+
this.cdr = cdr;
|
|
104
|
+
this._initialized = false;
|
|
105
|
+
this._lang = 'typescript';
|
|
106
|
+
this._showRaw = false;
|
|
107
|
+
/**
|
|
108
|
+
* copyCodeToClipboard?: boolean
|
|
109
|
+
*
|
|
110
|
+
* Display copy button on code snippets to copy code to clipboard.
|
|
111
|
+
*/
|
|
112
|
+
this.copyCodeToClipboard = false;
|
|
113
|
+
/**
|
|
114
|
+
* copyCodeTooltips?: ICopyCodeTooltips
|
|
115
|
+
*
|
|
116
|
+
* Tooltips for copy button to copy and upon copying.
|
|
117
|
+
*/
|
|
118
|
+
this.copyCodeTooltips = {};
|
|
119
|
+
/**
|
|
120
|
+
* toggleRawButton?: boolean
|
|
121
|
+
*
|
|
122
|
+
* Display button to toggle raw code.
|
|
123
|
+
*/
|
|
124
|
+
this.toggleRawButton = false;
|
|
125
|
+
/**
|
|
126
|
+
* rawToggleLabels?: IRawToggleLabels
|
|
127
|
+
*
|
|
128
|
+
* Labels for raw toggle button.
|
|
129
|
+
*/
|
|
130
|
+
this.rawToggleLabels = {};
|
|
131
|
+
/**
|
|
132
|
+
* contentReady?: function
|
|
133
|
+
* Event emitted after the highlight content rendering is finished.
|
|
134
|
+
*/
|
|
135
|
+
this.contentReady = new EventEmitter();
|
|
136
|
+
}
|
|
65
137
|
/**
|
|
66
138
|
* content?: string
|
|
67
139
|
*
|
|
@@ -72,6 +144,7 @@ class TdHighlightComponent {
|
|
|
72
144
|
*/
|
|
73
145
|
set content(content) {
|
|
74
146
|
this._content = content;
|
|
147
|
+
console.log(this._content);
|
|
75
148
|
if (this._initialized) {
|
|
76
149
|
this._loadContent(this._content);
|
|
77
150
|
}
|
|
@@ -93,41 +166,15 @@ class TdHighlightComponent {
|
|
|
93
166
|
console.warn('DEPRECATION WARNING: switch to codeLang attribute as lang attribute is deprecated.');
|
|
94
167
|
this.setLanguage(lang);
|
|
95
168
|
}
|
|
96
|
-
constructor(_renderer, _elementRef, _domSanitizer, cdr) {
|
|
97
|
-
this._renderer = _renderer;
|
|
98
|
-
this._elementRef = _elementRef;
|
|
99
|
-
this._domSanitizer = _domSanitizer;
|
|
100
|
-
this.cdr = cdr;
|
|
101
|
-
this._initialized = false;
|
|
102
|
-
this._lang = 'typescript';
|
|
103
|
-
/**
|
|
104
|
-
* copyCodeToClipboard?: boolean
|
|
105
|
-
*
|
|
106
|
-
* Display copy button on code snippets to copy code to clipboard.
|
|
107
|
-
*/
|
|
108
|
-
this.copyCodeToClipboard = false;
|
|
109
|
-
/**
|
|
110
|
-
* copyCodeTooltips?: ICopyCodeTooltips
|
|
111
|
-
*
|
|
112
|
-
* Tooltips for copy button to copy and upon copying.
|
|
113
|
-
*/
|
|
114
|
-
this.copyCodeTooltips = {};
|
|
115
|
-
/**
|
|
116
|
-
* contentReady?: function
|
|
117
|
-
* Event emitted after the highlight content rendering is finished.
|
|
118
|
-
*/
|
|
119
|
-
this.contentReady = new EventEmitter();
|
|
120
|
-
}
|
|
121
169
|
ngAfterViewChecked() {
|
|
122
170
|
this.cdr.detectChanges();
|
|
123
171
|
}
|
|
124
172
|
ngAfterViewInit() {
|
|
125
173
|
if (!this._content) {
|
|
126
|
-
this.
|
|
127
|
-
|
|
128
|
-
else {
|
|
129
|
-
this._loadContent(this._content);
|
|
174
|
+
this._content =
|
|
175
|
+
this.highlightComp.nativeElement.textContent || '';
|
|
130
176
|
}
|
|
177
|
+
this._loadContent(this._content);
|
|
131
178
|
this._initialized = true;
|
|
132
179
|
}
|
|
133
180
|
setLanguage(lang) {
|
|
@@ -139,6 +186,17 @@ class TdHighlightComponent {
|
|
|
139
186
|
this._loadContent(this._content);
|
|
140
187
|
}
|
|
141
188
|
}
|
|
189
|
+
toggleRawClicked() {
|
|
190
|
+
this._showRaw = !this._showRaw;
|
|
191
|
+
this._elementRef.nativeElement.querySelector('pre').style.display = this
|
|
192
|
+
._showRaw
|
|
193
|
+
? 'none'
|
|
194
|
+
: 'block';
|
|
195
|
+
this._elementRef.nativeElement.querySelector('.raw').style.display = this
|
|
196
|
+
._showRaw
|
|
197
|
+
? 'block'
|
|
198
|
+
: 'none';
|
|
199
|
+
}
|
|
142
200
|
/**
|
|
143
201
|
* General method to parse a string of code into HTML Elements and load them into the container
|
|
144
202
|
*/
|
|
@@ -146,8 +204,7 @@ class TdHighlightComponent {
|
|
|
146
204
|
if (code && code.trim().length > 0) {
|
|
147
205
|
// Clean container
|
|
148
206
|
this._renderer.setProperty(this._elementRef.nativeElement, 'innerHTML', '');
|
|
149
|
-
|
|
150
|
-
this._elementFromString(this._render(code));
|
|
207
|
+
this._elementFromString(code);
|
|
151
208
|
if (this.copyCodeToClipboard) {
|
|
152
209
|
this._renderer.appendChild(this._elementRef.nativeElement, this.copyComp.nativeElement);
|
|
153
210
|
}
|
|
@@ -163,9 +220,17 @@ class TdHighlightComponent {
|
|
|
163
220
|
this._renderer.appendChild(preElement, codeElement);
|
|
164
221
|
// Set .highlight class into <code> element
|
|
165
222
|
this._renderer.addClass(codeElement, 'highlight');
|
|
223
|
+
const highlightedCode = this._render(codeStr);
|
|
166
224
|
codeElement.innerHTML =
|
|
167
|
-
this._domSanitizer.sanitize(SecurityContext.HTML,
|
|
168
|
-
|
|
225
|
+
this._domSanitizer.sanitize(SecurityContext.HTML, highlightedCode) ?? '';
|
|
226
|
+
if (this.toggleRawButton) {
|
|
227
|
+
const divElement = this._renderer.createElement('div');
|
|
228
|
+
divElement.className = 'raw';
|
|
229
|
+
this._renderer.appendChild(this._elementRef.nativeElement, divElement);
|
|
230
|
+
divElement.innerHTML =
|
|
231
|
+
this._domSanitizer.sanitize(SecurityContext.HTML, codeStr) ?? '';
|
|
232
|
+
this._renderer.setStyle(divElement, 'display', 'none');
|
|
233
|
+
}
|
|
169
234
|
}
|
|
170
235
|
_render(contents) {
|
|
171
236
|
// Trim leading and trailing newlines
|
|
@@ -203,17 +268,21 @@ class TdHighlightComponent {
|
|
|
203
268
|
return highlightedCode.value;
|
|
204
269
|
}
|
|
205
270
|
}
|
|
206
|
-
TdHighlightComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
207
|
-
TdHighlightComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "
|
|
208
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
271
|
+
TdHighlightComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: TdHighlightComponent, deps: [{ token: i0.Renderer2 }, { token: i0.ElementRef }, { token: i1$1.DomSanitizer }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
272
|
+
TdHighlightComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.2.12", 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"] }] });
|
|
273
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: TdHighlightComponent, decorators: [{
|
|
209
274
|
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"] }]
|
|
275
|
+
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
276
|
}], ctorParameters: function () { return [{ type: i0.Renderer2 }, { type: i0.ElementRef }, { type: i1$1.DomSanitizer }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { content: [{
|
|
212
277
|
type: Input
|
|
213
278
|
}], copyCodeToClipboard: [{
|
|
214
279
|
type: Input
|
|
215
280
|
}], copyCodeTooltips: [{
|
|
216
281
|
type: Input
|
|
282
|
+
}], toggleRawButton: [{
|
|
283
|
+
type: Input
|
|
284
|
+
}], rawToggleLabels: [{
|
|
285
|
+
type: Input
|
|
217
286
|
}], codeLang: [{
|
|
218
287
|
type: Input
|
|
219
288
|
}], lang: [{
|
|
@@ -233,24 +302,30 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.5", ngImpor
|
|
|
233
302
|
|
|
234
303
|
class CovalentHighlightModule {
|
|
235
304
|
}
|
|
236
|
-
CovalentHighlightModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
237
|
-
CovalentHighlightModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "
|
|
305
|
+
CovalentHighlightModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: CovalentHighlightModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
306
|
+
CovalentHighlightModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.2.12", ngImport: i0, type: CovalentHighlightModule, declarations: [TdHighlightComponent, TdCopyCodeButtonComponent], imports: [CommonModule,
|
|
238
307
|
ClipboardModule,
|
|
239
308
|
MatIconModule,
|
|
309
|
+
MatButtonToggleModule,
|
|
310
|
+
MatButtonModule,
|
|
240
311
|
MatTooltipModule,
|
|
241
312
|
MatButtonModule], exports: [TdHighlightComponent] });
|
|
242
|
-
CovalentHighlightModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "
|
|
313
|
+
CovalentHighlightModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: CovalentHighlightModule, imports: [CommonModule,
|
|
243
314
|
ClipboardModule,
|
|
244
315
|
MatIconModule,
|
|
316
|
+
MatButtonToggleModule,
|
|
317
|
+
MatButtonModule,
|
|
245
318
|
MatTooltipModule,
|
|
246
319
|
MatButtonModule] });
|
|
247
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
320
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.2.12", ngImport: i0, type: CovalentHighlightModule, decorators: [{
|
|
248
321
|
type: NgModule,
|
|
249
322
|
args: [{
|
|
250
323
|
imports: [
|
|
251
324
|
CommonModule,
|
|
252
325
|
ClipboardModule,
|
|
253
326
|
MatIconModule,
|
|
327
|
+
MatButtonToggleModule,
|
|
328
|
+
MatButtonModule,
|
|
254
329
|
MatTooltipModule,
|
|
255
330
|
MatButtonModule,
|
|
256
331
|
],
|
|
@@ -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,IAAI,KAAK,MAAM,CAAC;KACxE;AAED,IAAA,IAAI,a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AAC,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 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;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;AA8CnD,KAAA;AAzCC,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,I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,eAAe;QACf,gBAAgB;QAChB,eAAe,CAAA,EAAA,CAAA,CAAA;4FAKN,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, false
|
|
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, false>;
|
|
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, ["*"], false
|
|
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, ["*"], false>;
|
|
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": "5.1.0
|
|
3
|
+
"version": "5.1.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": "^14.2.12",
|
|
24
|
+
"@angular/core": "^14.2.12",
|
|
25
|
+
"@angular/platform-browser": "^14.2.12",
|
|
26
|
+
"@angular/cdk": "^14.2.7",
|
|
27
|
+
"@angular/material": "^14.2.7"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"tslib": "^2.0.0"
|