@eui/core 21.0.0-alpha.9 → 21.0.0-next.1
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/CHANGELOG.md +672 -5333
- package/docs/changelog.html +784 -7639
- package/docs/classes/ActivatedRouteAction.html +18 -0
- package/docs/classes/AddApiQueueItemAction.html +18 -0
- package/docs/classes/AddAppLoadedConfigModulesAction.html +18 -0
- package/docs/classes/ApiQueueServiceMock.html +18 -0
- package/docs/classes/AsyncStorageService.html +18 -0
- package/docs/classes/AsyncStorageServiceMock.html +18 -0
- package/docs/classes/CssUtils.html +45 -0
- package/docs/classes/EmptyApiQueueAction.html +18 -0
- package/docs/classes/ErrorSubClass.html +18 -0
- package/docs/classes/EuiCoreRootGuardClass.html +18 -0
- package/docs/classes/EuiError.html +18 -0
- package/docs/classes/I18nResourceImpl.html +18 -0
- package/docs/classes/InitStoreAction.html +18 -0
- package/docs/classes/LogServiceMock.html +18 -0
- package/docs/classes/RemoveApiQueueItemAction.html +18 -0
- package/docs/classes/StorageService.html +18 -0
- package/docs/classes/StorageServiceMock.html +18 -0
- package/docs/classes/TranslateServiceMock.html +18 -0
- package/docs/classes/UpdateAppConnectionAction.html +18 -0
- package/docs/classes/UpdateAppStatusAction.html +18 -0
- package/docs/classes/UpdateAppVersionAction.html +18 -0
- package/docs/classes/UpdateCurrentModuleAction.html +18 -0
- package/docs/classes/UpdateI18nStateAction.html +18 -0
- package/docs/classes/UpdateLocaleStateAction.html +18 -0
- package/docs/classes/UpdateNotificationsListAction.html +18 -0
- package/docs/classes/UpdateUserDashboardAction.html +18 -0
- package/docs/classes/UpdateUserDetailsAction.html +18 -0
- package/docs/classes/UpdateUserPreferencesAction.html +18 -0
- package/docs/classes/UpdateUserRightsAction.html +18 -0
- package/docs/classes/UpdateUserStateAction.html +18 -0
- package/docs/dependencies.html +18 -0
- package/docs/directives/TranslateMockDirective.html +18 -0
- package/docs/index.html +20 -2
- package/docs/injectables/ApiQueueService.html +18 -0
- package/docs/injectables/EuiAppShellService.html +55 -0
- package/docs/injectables/EuiDynamicComponentService.html +18 -0
- package/docs/injectables/EuiDynamicMenuService.html +18 -0
- package/docs/injectables/EuiGrowlService.html +18 -0
- package/docs/injectables/EuiLoaderService.html +18 -0
- package/docs/injectables/EuiPermissionService.html +18 -0
- package/docs/injectables/EuiThemeService.html +18 -0
- package/docs/injectables/EuiTimezoneService.html +18 -0
- package/docs/injectables/GlobalErrorHandler.html +18 -0
- package/docs/injectables/I18nLoader.html +18 -0
- package/docs/injectables/I18nService.html +18 -0
- package/docs/injectables/I18nServiceMock.html +18 -0
- package/docs/injectables/LocalForageService.html +18 -0
- package/docs/injectables/LocalStorageService.html +18 -0
- package/docs/injectables/LocaleService.html +18 -0
- package/docs/injectables/LocaleServiceMock.html +18 -0
- package/docs/injectables/LogService.html +18 -0
- package/docs/injectables/SessionStorageService.html +18 -0
- package/docs/injectables/StoreService.html +18 -0
- package/docs/injectables/StoreServiceMock.html +18 -0
- package/docs/injectables/UserService.html +18 -0
- package/docs/injectables/UserServiceMock.html +18 -0
- package/docs/interceptors/AddLangParamInterceptor.html +18 -0
- package/docs/interceptors/CachePreventionInterceptor.html +18 -0
- package/docs/interceptors/CorsSecurityInterceptor.html +18 -0
- package/docs/interceptors/CsrfPreventionInterceptor.html +18 -0
- package/docs/interceptors/EuLoginSessionTimeoutHandlingInterceptor.html +18 -0
- package/docs/interceptors/HttpErrorHandlerInterceptor.html +18 -0
- package/docs/interceptors/UxRequestErrorModelInterceptor.html +18 -0
- package/docs/interfaces/Action.html +18 -0
- package/docs/interfaces/ActionReducer.html +18 -0
- package/docs/interfaces/Dependency.html +18 -0
- package/docs/interfaces/EuiTimeZone.html +18 -0
- package/docs/interfaces/IEuiTheme.html +18 -0
- package/docs/interfaces/Library.html +18 -0
- package/docs/interfaces/LoadedResources.html +18 -0
- package/docs/interfaces/LoadedResourcesError.html +18 -0
- package/docs/interfaces/MemoizedSelector.html +18 -0
- package/docs/interfaces/MemoizedSelectorWithProps.html +18 -0
- package/docs/interfaces/ModuleLoadEvent.html +18 -0
- package/docs/interfaces/Policy.html +18 -0
- package/docs/interfaces/ResourceError.html +18 -0
- package/docs/interfaces/ThemeState.html +18 -0
- package/docs/interfaces/TranslationKeys.html +18 -0
- package/docs/interfaces/UIState.html +108 -0
- package/docs/interfaces/body.html +18 -0
- package/docs/js/libs/bootstrap-native.js +1 -1
- package/docs/js/libs/jszip.min.js +13 -0
- package/docs/js/libs/svg-pan-zoom.min.js +3 -3
- package/docs/js/libs/tablesort.min.js +3 -3
- package/docs/js/libs/tablesort.number.min.js +3 -3
- package/docs/js/menu-wc.js +16 -20
- package/docs/js/menu-wc_es5.js +1 -1
- package/docs/js/routes/routes_index.js +1 -0
- package/docs/js/routes.js +15 -8
- package/docs/js/search/search_index.js +2 -2
- package/docs/license.html +20 -2
- package/docs/miscellaneous/enumerations.html +18 -0
- package/docs/miscellaneous/functions.html +18 -0
- package/docs/miscellaneous/typealiases.html +18 -0
- package/docs/miscellaneous/variables.html +48 -53
- package/docs/modules/CoreModule.html +18 -0
- package/docs/modules/I18nModule.html +18 -0
- package/docs/modules/LogModule.html +18 -0
- package/docs/modules/TranslateMockModule.html +18 -0
- package/docs/modules.html +18 -0
- package/docs/overview.html +28 -0
- package/docs/pipes/TranslateMockPipe.html +18 -0
- package/docs/properties.html +19 -1
- package/docs/routes.html +204 -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-core.mjs +150 -110
- package/fesm2022/eui-core.mjs.map +1 -1
- package/package.json +44 -45
- package/{index.d.ts → types/eui-core.d.ts} +13 -1
- package/types/eui-core.d.ts.map +1 -0
- package/index.d.ts.map +0 -1
|
@@ -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
|
+
}
|