@eui/eds 21.3.4-snapshot-1783677674979
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/docs/classes/EdsChipModel.html +606 -0
- package/docs/classes/EuiChipTooltip.html +425 -0
- package/docs/components/EdsBadge.html +810 -0
- package/docs/components/EdsButton.html +793 -0
- package/docs/components/EdsChip.html +911 -0
- package/docs/components/EdsIcon.html +675 -0
- package/docs/components/EdsIconImage.html +604 -0
- package/docs/directives/EuiBaseColorVariantsDirective.html +1165 -0
- package/docs/directives/EuiBaseSizeVariantsDirective.html +1402 -0
- package/docs/fonts/ionicons.eot +0 -0
- package/docs/fonts/ionicons.svg +2090 -0
- package/docs/fonts/ionicons.ttf +0 -0
- package/docs/fonts/ionicons.woff +0 -0
- package/docs/fonts/ionicons.woff2 +0 -0
- package/docs/fonts/roboto-v15-latin-300.eot +0 -0
- package/docs/fonts/roboto-v15-latin-300.svg +314 -0
- package/docs/fonts/roboto-v15-latin-300.ttf +0 -0
- package/docs/fonts/roboto-v15-latin-300.woff +0 -0
- package/docs/fonts/roboto-v15-latin-300.woff2 +0 -0
- package/docs/fonts/roboto-v15-latin-700.eot +0 -0
- package/docs/fonts/roboto-v15-latin-700.svg +310 -0
- package/docs/fonts/roboto-v15-latin-700.ttf +0 -0
- package/docs/fonts/roboto-v15-latin-700.woff +0 -0
- package/docs/fonts/roboto-v15-latin-700.woff2 +0 -0
- package/docs/fonts/roboto-v15-latin-italic.eot +0 -0
- package/docs/fonts/roboto-v15-latin-italic.svg +323 -0
- package/docs/fonts/roboto-v15-latin-italic.ttf +0 -0
- package/docs/fonts/roboto-v15-latin-italic.woff +0 -0
- package/docs/fonts/roboto-v15-latin-italic.woff2 +0 -0
- package/docs/fonts/roboto-v15-latin-regular.eot +0 -0
- package/docs/fonts/roboto-v15-latin-regular.svg +308 -0
- package/docs/fonts/roboto-v15-latin-regular.ttf +0 -0
- package/docs/fonts/roboto-v15-latin-regular.woff +0 -0
- package/docs/fonts/roboto-v15-latin-regular.woff2 +0 -0
- package/docs/images/compodoc-vectorise-inverted.png +0 -0
- package/docs/images/compodoc-vectorise-inverted.svg +201 -0
- package/docs/images/compodoc-vectorise.png +0 -0
- package/docs/images/compodoc-vectorise.svg +201 -0
- package/docs/images/favicon.ico +0 -0
- package/docs/index.html +2264 -0
- package/docs/js/compodoc.js +14 -0
- package/docs/js/lazy-load-graphs.js +44 -0
- package/docs/js/libs/EventDispatcher.js +5 -0
- package/docs/js/libs/bootstrap-native.js +2 -0
- package/docs/js/libs/clipboard.min.js +7 -0
- package/docs/js/libs/custom-elements-es5-adapter.js +15 -0
- package/docs/js/libs/custom-elements.min.js +38 -0
- package/docs/js/libs/d3.v3.min.js +2 -0
- package/docs/js/libs/deep-iterator.js +2 -0
- package/docs/js/libs/es6-shim.min.js +12 -0
- package/docs/js/libs/htmlparser.js +23 -0
- package/docs/js/libs/innersvg.js +9 -0
- package/docs/js/libs/jszip.min.js +13 -0
- package/docs/js/libs/lit-html.js +1 -0
- package/docs/js/libs/prism.js +46 -0
- package/docs/js/libs/promise.min.js +6 -0
- package/docs/js/libs/svg-pan-zoom.min.js +3 -0
- package/docs/js/libs/tablesort.min.js +6 -0
- package/docs/js/libs/tablesort.number.min.js +6 -0
- package/docs/js/libs/vis-network.min.js +78 -0
- package/docs/js/libs/zepto.min.js +2 -0
- package/docs/js/menu-wc.js +119 -0
- package/docs/js/menu-wc_es5.js +40 -0
- package/docs/js/menu.js +269 -0
- package/docs/js/routes/routes_index.js +1 -0
- package/docs/js/routes.js +308 -0
- package/docs/js/search/lunr.min.js +6 -0
- package/docs/js/search/search-lunr.js +65 -0
- package/docs/js/search/search.js +273 -0
- package/docs/js/search/search_index.js +4 -0
- package/docs/js/sourceCode.js +58 -0
- package/docs/js/svg-pan-zoom.controls.js +53 -0
- package/docs/js/tabs.js +21 -0
- package/docs/js/tree.js +147 -0
- package/docs/json/EdsBadge.md +28 -0
- package/docs/json/EdsButton.md +31 -0
- package/docs/json/EdsChip.md +30 -0
- package/docs/json/EdsIcon.md +32 -0
- package/docs/json/EdsIconImage.md +13 -0
- package/docs/json/EuiBaseColorVariantsDirective.md +20 -0
- package/docs/json/EuiBaseSizeVariantsDirective.md +23 -0
- package/docs/json/HbsRenderService.md +6 -0
- package/docs/json/TemplateEditorService.md +6 -0
- package/docs/json/TemplatePlaygroundComponent.md +8 -0
- package/docs/json/ZipExportService.md +6 -0
- package/docs/json/documentation.json +5209 -0
- package/docs/miscellaneous/variables.html +415 -0
- package/docs/modules.html +201 -0
- package/docs/overview.html +236 -0
- package/docs/routes.html +204 -0
- package/docs/styles/bootstrap-card.css +219 -0
- package/docs/styles/bootstrap.min.css +6 -0
- package/docs/styles/compodoc.css +1124 -0
- package/docs/styles/dark.css +121 -0
- package/docs/styles/ionicons.min.css +11 -0
- package/docs/styles/laravel.css +113 -0
- package/docs/styles/material.css +131 -0
- package/docs/styles/original.css +51 -0
- package/docs/styles/postmark.css +238 -0
- package/docs/styles/prism.css +301 -0
- package/docs/styles/readthedocs.css +117 -0
- package/docs/styles/reset.css +129 -0
- package/docs/styles/stripe.css +106 -0
- package/docs/styles/style.css +7 -0
- package/docs/styles/tablesort.css +33 -0
- package/docs/styles/vagrant.css +130 -0
- package/docs/template-playground/default-templates.json +192 -0
- package/docs/template-playground/hbs-render.service.ts +212 -0
- package/docs/template-playground/main.ts +9 -0
- package/docs/template-playground/template-editor.service.ts +173 -0
- package/docs/template-playground/template-playground.component.ts +614 -0
- package/docs/template-playground/template-playground.module.ts +29 -0
- package/docs/template-playground/zip-export.service.ts +86 -0
- package/docs/template-playground-app/app.js +1389 -0
- package/docs/template-playground-app/index.html +462 -0
- package/fesm2022/eui-eds-eds-badge.mjs +175 -0
- package/fesm2022/eui-eds-eds-badge.mjs.map +1 -0
- package/fesm2022/eui-eds-eds-button.mjs +169 -0
- package/fesm2022/eui-eds-eds-button.mjs.map +1 -0
- package/fesm2022/eui-eds-eds-chip.mjs +196 -0
- package/fesm2022/eui-eds-eds-chip.mjs.map +1 -0
- package/fesm2022/eui-eds-eds-icon-image.mjs +65 -0
- package/fesm2022/eui-eds-eds-icon-image.mjs.map +1 -0
- package/fesm2022/eui-eds-eds-icon.mjs +136 -0
- package/fesm2022/eui-eds-eds-icon.mjs.map +1 -0
- package/fesm2022/eui-eds-shared.mjs +322 -0
- package/fesm2022/eui-eds-shared.mjs.map +1 -0
- package/fesm2022/eui-eds.mjs +6 -0
- package/fesm2022/eui-eds.mjs.map +1 -0
- package/package.json +72 -0
- package/types/eui-eds-eds-badge.d.ts +74 -0
- package/types/eui-eds-eds-badge.d.ts.map +1 -0
- package/types/eui-eds-eds-button.d.ts +75 -0
- package/types/eui-eds-eds-button.d.ts.map +1 -0
- package/types/eui-eds-eds-chip.d.ts +105 -0
- package/types/eui-eds-eds-chip.d.ts.map +1 -0
- package/types/eui-eds-eds-icon-image.d.ts +34 -0
- package/types/eui-eds-eds-icon-image.d.ts.map +1 -0
- package/types/eui-eds-eds-icon.d.ts +50 -0
- package/types/eui-eds-eds-icon.d.ts.map +1 -0
- package/types/eui-eds-shared.d.ts +86 -0
- package/types/eui-eds-shared.d.ts.map +1 -0
- package/types/eui-eds.d.ts +3 -0
- package/types/eui-eds.d.ts.map +1 -0
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
import { Injectable } from '@angular/core';
|
|
2
|
+
|
|
3
|
+
declare const Handlebars: any;
|
|
4
|
+
|
|
5
|
+
@Injectable({
|
|
6
|
+
providedIn: 'root'
|
|
7
|
+
})
|
|
8
|
+
export class HbsRenderService {
|
|
9
|
+
private handlebarsInstance: any;
|
|
10
|
+
|
|
11
|
+
constructor() {
|
|
12
|
+
this.initializeHandlebars();
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
private initializeHandlebars() {
|
|
16
|
+
// Create a new Handlebars instance for the playground
|
|
17
|
+
this.handlebarsInstance = Handlebars.create();
|
|
18
|
+
|
|
19
|
+
// Register common helpers used in Compodoc templates
|
|
20
|
+
this.registerHelpers();
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
private registerHelpers() {
|
|
24
|
+
// Register the 'compare' helper
|
|
25
|
+
this.handlebarsInstance.registerHelper('compare', (left: any, operator: string, right: any, options: any) => {
|
|
26
|
+
let result;
|
|
27
|
+
switch (operator) {
|
|
28
|
+
case '===':
|
|
29
|
+
result = left === right;
|
|
30
|
+
break;
|
|
31
|
+
case '!==':
|
|
32
|
+
result = left !== right;
|
|
33
|
+
break;
|
|
34
|
+
case '<':
|
|
35
|
+
result = left < right;
|
|
36
|
+
break;
|
|
37
|
+
case '>':
|
|
38
|
+
result = left > right;
|
|
39
|
+
break;
|
|
40
|
+
case '<=':
|
|
41
|
+
result = left <= right;
|
|
42
|
+
break;
|
|
43
|
+
case '>=':
|
|
44
|
+
result = left >= right;
|
|
45
|
+
break;
|
|
46
|
+
default:
|
|
47
|
+
result = false;
|
|
48
|
+
}
|
|
49
|
+
return result ? options.fn(this) : options.inverse(this);
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
// Register the 'unless' helper
|
|
53
|
+
this.handlebarsInstance.registerHelper('unless', (conditional: any, options: any) => {
|
|
54
|
+
return !conditional ? options.fn(this) : options.inverse(this);
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
// Register the 'each' helper with index
|
|
58
|
+
this.handlebarsInstance.registerHelper('each', (context: any, options: any) => {
|
|
59
|
+
let ret = '';
|
|
60
|
+
for (let i = 0; i < context.length; i++) {
|
|
61
|
+
ret += options.fn(context[i], { data: { index: i } });
|
|
62
|
+
}
|
|
63
|
+
return ret;
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
// Register the 'if' helper
|
|
67
|
+
this.handlebarsInstance.registerHelper('if', (conditional: any, options: any) => {
|
|
68
|
+
return conditional ? options.fn(this) : options.inverse(this);
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
// Register the 'relativeURL' helper
|
|
72
|
+
this.handlebarsInstance.registerHelper('relativeURL', (depth: number, page?: string) => {
|
|
73
|
+
let url = '';
|
|
74
|
+
for (let i = 0; i < depth; i++) {
|
|
75
|
+
url += '../';
|
|
76
|
+
}
|
|
77
|
+
return url + (page || '');
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
// Register the 't' helper for translations
|
|
81
|
+
this.handlebarsInstance.registerHelper('t', (key: string) => {
|
|
82
|
+
// Simple translation mapping for preview
|
|
83
|
+
const translations: { [key: string]: string } = {
|
|
84
|
+
'info': 'Information',
|
|
85
|
+
'source': 'Source',
|
|
86
|
+
'example': 'Example',
|
|
87
|
+
'template': 'Template',
|
|
88
|
+
'styles': 'Styles',
|
|
89
|
+
'component': 'Component',
|
|
90
|
+
'module': 'Module',
|
|
91
|
+
'overview': 'Overview',
|
|
92
|
+
'components': 'Components',
|
|
93
|
+
'modules': 'Modules',
|
|
94
|
+
'file': 'File',
|
|
95
|
+
'description': 'Description',
|
|
96
|
+
'selector': 'Selector',
|
|
97
|
+
'properties': 'Properties',
|
|
98
|
+
'methods': 'Methods',
|
|
99
|
+
'inputs': 'Inputs',
|
|
100
|
+
'outputs': 'Outputs'
|
|
101
|
+
};
|
|
102
|
+
return translations[key] || key;
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
// Register the 'orLength' helper
|
|
106
|
+
this.handlebarsInstance.registerHelper('orLength', (...args: any[]) => {
|
|
107
|
+
const options = args[args.length - 1];
|
|
108
|
+
const values = args.slice(0, -1);
|
|
109
|
+
|
|
110
|
+
for (const value of values) {
|
|
111
|
+
if (value && value.length && value.length > 0) {
|
|
112
|
+
return options.fn(this);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
return options.inverse(this);
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
// Register the 'isTabEnabled' helper
|
|
119
|
+
this.handlebarsInstance.registerHelper('isTabEnabled', (navTabs: any[], tabId: string, options: any) => {
|
|
120
|
+
const tab = navTabs && navTabs.find((t: any) => t.id === tabId);
|
|
121
|
+
return tab ? options.fn(this) : options.inverse(this);
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
// Register the 'isInitialTab' helper
|
|
125
|
+
this.handlebarsInstance.registerHelper('isInitialTab', (navTabs: any[], tabId: string, options: any) => {
|
|
126
|
+
const isInitial = navTabs && navTabs.length > 0 && navTabs[0].id === tabId;
|
|
127
|
+
return isInitial ? options.fn(this) : options.inverse(this);
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
renderTemplate(templateContent: string, data: any): string {
|
|
132
|
+
try {
|
|
133
|
+
// Create a complete HTML document for preview
|
|
134
|
+
const template = this.handlebarsInstance.compile(templateContent);
|
|
135
|
+
const rendered = template({ data });
|
|
136
|
+
|
|
137
|
+
// Wrap in a basic HTML structure for preview
|
|
138
|
+
return `
|
|
139
|
+
<!DOCTYPE html>
|
|
140
|
+
<html>
|
|
141
|
+
<head>
|
|
142
|
+
<meta charset="utf-8">
|
|
143
|
+
<title>Template Preview</title>
|
|
144
|
+
<style>
|
|
145
|
+
body { font-family: Arial, sans-serif; margin: 20px; }
|
|
146
|
+
.preview-wrapper { border: 1px solid #ddd; padding: 20px; }
|
|
147
|
+
.preview-notice { background: #f0f8ff; padding: 10px; margin-bottom: 20px; border-left: 4px solid #007bff; }
|
|
148
|
+
</style>
|
|
149
|
+
</head>
|
|
150
|
+
<body>
|
|
151
|
+
<div class="preview-notice">
|
|
152
|
+
<strong>Template Preview:</strong> This is a live preview of your template with mock data.
|
|
153
|
+
</div>
|
|
154
|
+
<div class="preview-wrapper">
|
|
155
|
+
${rendered}
|
|
156
|
+
</div>
|
|
157
|
+
</body>
|
|
158
|
+
</html>
|
|
159
|
+
`;
|
|
160
|
+
} catch (error) {
|
|
161
|
+
return `
|
|
162
|
+
<!DOCTYPE html>
|
|
163
|
+
<html>
|
|
164
|
+
<head>
|
|
165
|
+
<meta charset="utf-8">
|
|
166
|
+
<title>Template Preview - Error</title>
|
|
167
|
+
<style>
|
|
168
|
+
body { font-family: Arial, sans-serif; margin: 20px; }
|
|
169
|
+
.error { color: red; background: #fff5f5; padding: 20px; border: 1px solid #red; }
|
|
170
|
+
</style>
|
|
171
|
+
</head>
|
|
172
|
+
<body>
|
|
173
|
+
<div class="error">
|
|
174
|
+
<h3>Template Error</h3>
|
|
175
|
+
<p><strong>Error:</strong> ${error.message}</p>
|
|
176
|
+
<p>Please check your template syntax and try again.</p>
|
|
177
|
+
</div>
|
|
178
|
+
</body>
|
|
179
|
+
</html>
|
|
180
|
+
`;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
getMockData(): any {
|
|
185
|
+
return {
|
|
186
|
+
documentationMainName: 'Sample Documentation',
|
|
187
|
+
depth: 0,
|
|
188
|
+
context: 'component',
|
|
189
|
+
components: [
|
|
190
|
+
{
|
|
191
|
+
name: 'SampleComponent',
|
|
192
|
+
selector: 'app-sample',
|
|
193
|
+
file: 'src/app/sample/sample.component.ts',
|
|
194
|
+
description: 'A sample component for demonstration',
|
|
195
|
+
properties: [
|
|
196
|
+
{ name: 'title', type: 'string', description: 'The component title' },
|
|
197
|
+
{ name: 'isVisible', type: 'boolean', description: 'Whether the component is visible' }
|
|
198
|
+
],
|
|
199
|
+
methods: [
|
|
200
|
+
{ name: 'ngOnInit', description: 'Lifecycle hook', signature: 'ngOnInit(): void' },
|
|
201
|
+
{ name: 'onClick', description: 'Handle click events', signature: 'onClick(event: MouseEvent): void' }
|
|
202
|
+
]
|
|
203
|
+
}
|
|
204
|
+
],
|
|
205
|
+
navTabs: [
|
|
206
|
+
{ id: 'info', label: 'Info', href: '#info' },
|
|
207
|
+
{ id: 'source', label: 'Source', href: '#source' },
|
|
208
|
+
{ id: 'example', label: 'Example', href: '#example' }
|
|
209
|
+
]
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
|
2
|
+
import { TemplatePlaygroundModule } from './template-playground.module';
|
|
3
|
+
|
|
4
|
+
// Bootstrap the Angular application when the DOM is ready
|
|
5
|
+
document.addEventListener('DOMContentLoaded', () => {
|
|
6
|
+
platformBrowserDynamic()
|
|
7
|
+
.bootstrapModule(TemplatePlaygroundModule)
|
|
8
|
+
.catch(err => console.error('Error starting template playground:', err));
|
|
9
|
+
});
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
import { Injectable } from '@angular/core';
|
|
2
|
+
|
|
3
|
+
declare const monaco: any;
|
|
4
|
+
|
|
5
|
+
@Injectable({
|
|
6
|
+
providedIn: 'root'
|
|
7
|
+
})
|
|
8
|
+
export class TemplateEditorService {
|
|
9
|
+
private editor: any;
|
|
10
|
+
private onChangeCallback: ((value: string) => void) | null = null;
|
|
11
|
+
|
|
12
|
+
initializeEditor(container: HTMLElement) {
|
|
13
|
+
// Initialize Monaco Editor
|
|
14
|
+
this.editor = monaco.editor.create(container, {
|
|
15
|
+
value: '',
|
|
16
|
+
language: 'html',
|
|
17
|
+
theme: 'vs-dark',
|
|
18
|
+
automaticLayout: true,
|
|
19
|
+
minimap: {
|
|
20
|
+
enabled: true
|
|
21
|
+
},
|
|
22
|
+
scrollBeyondLastLine: false,
|
|
23
|
+
fontSize: 14,
|
|
24
|
+
wordWrap: 'on',
|
|
25
|
+
lineNumbers: 'on',
|
|
26
|
+
roundedSelection: false,
|
|
27
|
+
scrollbar: {
|
|
28
|
+
horizontal: 'visible',
|
|
29
|
+
vertical: 'visible'
|
|
30
|
+
},
|
|
31
|
+
overviewRulerLanes: 2,
|
|
32
|
+
quickSuggestions: {
|
|
33
|
+
other: true,
|
|
34
|
+
comments: true,
|
|
35
|
+
strings: true
|
|
36
|
+
},
|
|
37
|
+
parameterHints: {
|
|
38
|
+
enabled: true
|
|
39
|
+
},
|
|
40
|
+
autoClosingBrackets: 'always',
|
|
41
|
+
autoClosingQuotes: 'always',
|
|
42
|
+
suggestOnTriggerCharacters: true,
|
|
43
|
+
acceptSuggestionOnEnter: 'on',
|
|
44
|
+
tabCompletion: 'on',
|
|
45
|
+
wordBasedSuggestions: false
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
// Set up change listener
|
|
49
|
+
this.editor.onDidChangeModelContent(() => {
|
|
50
|
+
if (this.onChangeCallback) {
|
|
51
|
+
this.onChangeCallback(this.editor.getValue());
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
// Register custom language definitions
|
|
56
|
+
this.registerHandlebarsLanguage();
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
setEditorContent(content: string, fileType: string) {
|
|
60
|
+
if (this.editor) {
|
|
61
|
+
const language = this.getLanguageFromFileType(fileType);
|
|
62
|
+
const model = monaco.editor.createModel(content, language);
|
|
63
|
+
this.editor.setModel(model);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
setOnChangeCallback(callback: (value: string) => void) {
|
|
68
|
+
this.onChangeCallback = callback;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
private getLanguageFromFileType(fileType: string): string {
|
|
72
|
+
switch (fileType) {
|
|
73
|
+
case 'hbs':
|
|
74
|
+
return 'handlebars';
|
|
75
|
+
case 'css':
|
|
76
|
+
case 'scss':
|
|
77
|
+
return 'css';
|
|
78
|
+
case 'js':
|
|
79
|
+
return 'javascript';
|
|
80
|
+
case 'ts':
|
|
81
|
+
return 'typescript';
|
|
82
|
+
default:
|
|
83
|
+
return 'html';
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
private registerHandlebarsLanguage() {
|
|
88
|
+
// Register Handlebars language for Monaco Editor
|
|
89
|
+
if (monaco.languages.getLanguages().find((lang: any) => lang.id === 'handlebars')) {
|
|
90
|
+
return; // Already registered
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
monaco.languages.register({ id: 'handlebars' });
|
|
94
|
+
|
|
95
|
+
monaco.languages.setMonarchTokensProvider('handlebars', {
|
|
96
|
+
tokenizer: {
|
|
97
|
+
root: [
|
|
98
|
+
[/\{\{\{/, { token: 'keyword', next: '@handlebars_unescaped' }],
|
|
99
|
+
[/\{\{/, { token: 'keyword', next: '@handlebars' }],
|
|
100
|
+
[/<!DOCTYPE/, 'metatag', '@doctype'],
|
|
101
|
+
[/<!--/, 'comment', '@comment'],
|
|
102
|
+
[/(<)(\w+)/, ['delimiter', { token: 'tag', next: '@tag' }]],
|
|
103
|
+
[/(<\/)(\w+)/, ['delimiter', { token: 'tag', next: '@tag' }]],
|
|
104
|
+
[/</, 'delimiter'],
|
|
105
|
+
[/[^<]+/]
|
|
106
|
+
],
|
|
107
|
+
|
|
108
|
+
handlebars_unescaped: [
|
|
109
|
+
[/\}\}\}/, { token: 'keyword', next: '@pop' }],
|
|
110
|
+
[/[^}]+/, 'variable']
|
|
111
|
+
],
|
|
112
|
+
|
|
113
|
+
handlebars: [
|
|
114
|
+
[/\}\}/, { token: 'keyword', next: '@pop' }],
|
|
115
|
+
[/#if|#unless|#each|#with|\/if|\/unless|\/each|\/with/, 'keyword'],
|
|
116
|
+
[/[a-zA-Z_][\w]*/, 'variable'],
|
|
117
|
+
[/[^}]+/, 'variable']
|
|
118
|
+
],
|
|
119
|
+
|
|
120
|
+
comment: [
|
|
121
|
+
[/-->/, 'comment', '@pop'],
|
|
122
|
+
[/[^-]+/, 'comment'],
|
|
123
|
+
[/./, 'comment']
|
|
124
|
+
],
|
|
125
|
+
|
|
126
|
+
doctype: [
|
|
127
|
+
[/[^>]+/, 'metatag.content'],
|
|
128
|
+
[/>/, 'metatag', '@pop']
|
|
129
|
+
],
|
|
130
|
+
|
|
131
|
+
tag: [
|
|
132
|
+
[/[ \t\r\n]+/, 'white'],
|
|
133
|
+
[/(\w+)(\s*=\s*)("([^"]*)")/, ['attribute.name', 'delimiter', 'attribute.value', 'attribute.value']],
|
|
134
|
+
[/(\w+)(\s*=\s*)('([^']*)')/, ['attribute.name', 'delimiter', 'attribute.value', 'attribute.value']],
|
|
135
|
+
[/\w+/, 'attribute.name'],
|
|
136
|
+
[/>/, 'delimiter', '@pop']
|
|
137
|
+
]
|
|
138
|
+
}
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
monaco.languages.setLanguageConfiguration('handlebars', {
|
|
142
|
+
comments: {
|
|
143
|
+
blockComment: ['<!--', '-->']
|
|
144
|
+
},
|
|
145
|
+
brackets: [
|
|
146
|
+
['<', '>'],
|
|
147
|
+
['{{', '}}'],
|
|
148
|
+
['{{{', '}}}']
|
|
149
|
+
],
|
|
150
|
+
autoClosingPairs: [
|
|
151
|
+
{ open: '<', close: '>' },
|
|
152
|
+
{ open: '{{', close: '}}' },
|
|
153
|
+
{ open: '{{{', close: '}}}' },
|
|
154
|
+
{ open: '"', close: '"' },
|
|
155
|
+
{ open: "'", close: "'" }
|
|
156
|
+
],
|
|
157
|
+
surroundingPairs: [
|
|
158
|
+
{ open: '<', close: '>' },
|
|
159
|
+
{ open: '{{', close: '}}' },
|
|
160
|
+
{ open: '{{{', close: '}}}' },
|
|
161
|
+
{ open: '"', close: '"' },
|
|
162
|
+
{ open: "'", close: "'" }
|
|
163
|
+
]
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
destroy() {
|
|
168
|
+
if (this.editor) {
|
|
169
|
+
this.editor.dispose();
|
|
170
|
+
this.editor = null;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
}
|