@aquera/nile-elements 0.1.0 → 0.1.2
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/README.md +7 -0
- package/demo/variables.css +0 -556
- package/dist/nile-code-editor/extensionSetup.cjs.js +6 -6
- package/dist/nile-code-editor/extensionSetup.cjs.js.map +1 -1
- package/dist/nile-code-editor/extensionSetup.esm.js +1 -1
- package/dist/nile-code-editor/nile-code-editor.cjs.js +2 -2
- package/dist/nile-code-editor/nile-code-editor.cjs.js.map +1 -1
- package/dist/nile-code-editor/nile-code-editor.esm.js +11 -11
- package/dist/nile-error-notification/nile-error-notification.cjs.js +1 -1
- package/dist/nile-error-notification/nile-error-notification.cjs.js.map +1 -1
- package/dist/nile-error-notification/nile-error-notification.esm.js +1 -1
- package/dist/src/nile-code-editor/nile-code-editor.d.ts +33 -16
- package/dist/src/nile-code-editor/nile-code-editor.js +167 -127
- package/dist/src/nile-code-editor/nile-code-editor.js.map +1 -1
- package/dist/src/nile-error-notification/nile-error-notification.d.ts +2 -2
- package/dist/src/nile-error-notification/nile-error-notification.js +2 -3
- package/dist/src/nile-error-notification/nile-error-notification.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -1
- package/plop-templates/lit/lit.ts.hbs +2 -2
- package/src/nile-code-editor/nile-code-editor.ts +184 -139
- package/src/nile-error-notification/nile-error-notification.ts +3 -3
- package/vscode-html-custom-data.json +15 -4
package/package.json
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
"description": "Webcomponent nile-elements following open-wc recommendations",
|
4
4
|
"license": "MIT",
|
5
5
|
"author": "nile-elements",
|
6
|
-
"version": "0.1.
|
6
|
+
"version": "0.1.2",
|
7
7
|
"main": "dist/src/index.js",
|
8
8
|
"type": "module",
|
9
9
|
"module": "dist/src/index.js",
|
@@ -117,6 +117,7 @@
|
|
117
117
|
"@codemirror/lang-javascript": "6.2.1",
|
118
118
|
"@codemirror/lang-sql": "6.7.0",
|
119
119
|
"@codemirror/lang-json": "^6.0.1",
|
120
|
+
"@codemirror/lang-html":"6.4.9",
|
120
121
|
"codemirror": "6.0.1",
|
121
122
|
"chalk": "5.3.0",
|
122
123
|
"figlet": "1.7.0",
|
@@ -5,8 +5,8 @@
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
6
6
|
*/
|
7
7
|
|
8
|
-
import {LitElement, html,
|
9
|
-
import { customElement } from 'lit/decorators.js';
|
8
|
+
import {LitElement, html, CSSResultArray, TemplateResult} from 'lit';
|
9
|
+
import { customElement, property} from 'lit/decorators.js';
|
10
10
|
import {styles} from './nile-{{name}}.css';
|
11
11
|
import NileElement from '../internal/nile-element';
|
12
12
|
|
@@ -6,7 +6,6 @@
|
|
6
6
|
*/
|
7
7
|
|
8
8
|
import {
|
9
|
-
LitElement,
|
10
9
|
html,
|
11
10
|
CSSResultArray,
|
12
11
|
TemplateResult,
|
@@ -16,20 +15,21 @@ import {
|
|
16
15
|
import { customElement, query, property } from 'lit/decorators.js';
|
17
16
|
import { styles } from './nile-code-editor.css';
|
18
17
|
import { EditorView } from 'codemirror';
|
19
|
-
import { ViewUpdate } from '@codemirror/view';
|
18
|
+
import { ViewUpdate, placeholder } from '@codemirror/view';
|
20
19
|
import {
|
21
20
|
Compartment,
|
22
21
|
EditorState,
|
22
|
+
Extension
|
23
23
|
} from '@codemirror/state';
|
24
24
|
|
25
25
|
import { lineNumbers } from '@codemirror/view';
|
26
26
|
import {
|
27
27
|
javascript,
|
28
28
|
javascriptLanguage,
|
29
|
-
scopeCompletionSource,
|
30
29
|
} from '@codemirror/lang-javascript';
|
31
30
|
import { sql } from '@codemirror/lang-sql';
|
32
31
|
import { json } from '@codemirror/lang-json';
|
32
|
+
import { html as htmlLang } from '@codemirror/lang-html';
|
33
33
|
import { autocompletion,CompletionContext,CompletionResult } from '@codemirror/autocomplete';
|
34
34
|
import NileElement from '../internal/nile-element';
|
35
35
|
import { basicSetup } from './extensionSetup';
|
@@ -54,9 +54,13 @@ export class NileCodeEditor extends NileElement {
|
|
54
54
|
|
55
55
|
@property({ type: String, reflect: true , attribute: true }) expandIcon = "expand-2";
|
56
56
|
|
57
|
+
@property({ type: String, reflect: true , attribute: true }) placeholder = "";
|
58
|
+
|
57
59
|
@property({ type: Object, reflect: true , attribute: true }) customAutoCompletions: object | any = {};
|
58
60
|
|
59
|
-
@property({ type:
|
61
|
+
@property({ type: Array, reflect: true , attribute: true }) customCompletionsPaths: string[] = [];
|
62
|
+
|
63
|
+
@property({ type: String, reflect: true , attribute: true}) language: 'javascript' | 'sql' | 'json' | 'html' = 'javascript';
|
60
64
|
|
61
65
|
@property({ type: String, reflect: true , attribute: 'error-message' }) errorMessage: string = '';
|
62
66
|
|
@@ -65,8 +69,8 @@ export class NileCodeEditor extends NileElement {
|
|
65
69
|
@property({ type: Boolean, reflect: true , attribute: 'noborder' }) noborder: boolean = false;
|
66
70
|
|
67
71
|
@property({ type: Boolean, reflect: true , attribute: true }) multiline: boolean = false;
|
68
|
-
|
69
|
-
@property({ type: Boolean, reflect: true , attribute: true })
|
72
|
+
|
73
|
+
@property({ type: Boolean, reflect: true , attribute: true }) allowVariableInCustomSuggestion: boolean = false;
|
70
74
|
|
71
75
|
@property({ type: Boolean, reflect: true , attribute: true }) lineNumbers: boolean = false;
|
72
76
|
|
@@ -89,6 +93,7 @@ export class NileCodeEditor extends NileElement {
|
|
89
93
|
private restrictSingleLineComp = new Compartment();
|
90
94
|
private readOnlyComp = new Compartment();
|
91
95
|
private customCompletionComp = new Compartment();
|
96
|
+
private placeholderComp = new Compartment();
|
92
97
|
|
93
98
|
/**
|
94
99
|
* The styles for CodeEditor
|
@@ -140,6 +145,13 @@ export class NileCodeEditor extends NileElement {
|
|
140
145
|
]
|
141
146
|
})
|
142
147
|
}
|
148
|
+
if (changedProperties.has('placeholder')) {
|
149
|
+
this.view.dispatch({
|
150
|
+
effects: [
|
151
|
+
this.placeholderComp.reconfigure(this.getPlaceholderExtension()),
|
152
|
+
]
|
153
|
+
})
|
154
|
+
}
|
143
155
|
if (changedProperties.has('lineNumbers') || changedProperties.has('lineNumbersMultiline')) {
|
144
156
|
this.view.dispatch({
|
145
157
|
effects: [
|
@@ -147,11 +159,11 @@ export class NileCodeEditor extends NileElement {
|
|
147
159
|
]
|
148
160
|
})
|
149
161
|
}
|
150
|
-
if(changedProperties.has('customAutoCompletions') || changedProperties.has('
|
162
|
+
if(changedProperties.has('customAutoCompletions') || changedProperties.has('customCompletionsPaths')){
|
151
163
|
this.view.dispatch({
|
152
164
|
effects: [
|
153
165
|
this.customCompletionComp.reconfigure(javascriptLanguage.data.of({
|
154
|
-
autocomplete: this.
|
166
|
+
autocomplete: this.customAutocomplete
|
155
167
|
}))
|
156
168
|
]
|
157
169
|
})
|
@@ -173,16 +185,16 @@ export class NileCodeEditor extends NileElement {
|
|
173
185
|
'no-scroller': noScrollbar
|
174
186
|
})}
|
175
187
|
>
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
188
|
+
${this.expandable
|
189
|
+
? html`
|
190
|
+
<nile-icon
|
191
|
+
name="${this.expandIcon}"
|
192
|
+
class="code-editor__icon__container"
|
193
|
+
size="16"
|
194
|
+
color="black"
|
195
|
+
@click="${(e: CustomEvent) => this.emit('nile-expand')}"
|
196
|
+
></nile-icon>`
|
197
|
+
: ''}
|
186
198
|
</div>
|
187
199
|
${hasErrorMessage
|
188
200
|
? html`
|
@@ -208,12 +220,14 @@ export class NileCodeEditor extends NileElement {
|
|
208
220
|
const lineNumbersExtension = this.lineNumbersComp.of(this.getLineNumbersExension());
|
209
221
|
const readOnlyExtension = this.readOnlyComp.of(this.getReadOnlyExtension());
|
210
222
|
const restrictSingleLineExtension = this.restrictSingleLineComp.of(this.getSingleLineExtension())
|
223
|
+
const placeholderExtension = this.placeholderComp.of(this.getPlaceholderExtension())
|
224
|
+
const language = this.getLanguageExtension()
|
211
225
|
const customAutoCompletions = this.customCompletionComp.of(javascriptLanguage.data.of({
|
212
|
-
autocomplete: this.
|
226
|
+
autocomplete: this.customAutocomplete
|
213
227
|
}));
|
214
|
-
|
228
|
+
|
215
229
|
this.viewState = EditorState.create({
|
216
|
-
doc: !this.multiline ?
|
230
|
+
doc: !this.multiline ? convertToSingleLine(this.value) : this.value,
|
217
231
|
extensions: [
|
218
232
|
basicSetup({
|
219
233
|
highlightActiveLine: false,
|
@@ -223,6 +237,7 @@ export class NileCodeEditor extends NileElement {
|
|
223
237
|
readOnlyExtension,
|
224
238
|
restrictSingleLineExtension,
|
225
239
|
customAutoCompletions,
|
240
|
+
placeholderExtension,
|
226
241
|
autocompletion(),
|
227
242
|
language,
|
228
243
|
EditorView.theme(Theme),
|
@@ -240,22 +255,89 @@ export class NileCodeEditor extends NileElement {
|
|
240
255
|
return this.viewState
|
241
256
|
}
|
242
257
|
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
258
|
+
customAutocomplete = (context: CompletionContext): CompletionResult | null => {
|
259
|
+
// Getting the valid last line, last text from the code editor
|
260
|
+
const text = context.state.doc.sliceString(0, context.pos);
|
261
|
+
const lastWord = text.split('\n').at(-1)?.split(' ').at(-1) || '';
|
262
|
+
const [textBeforeCursor, baseTextAfterSeperation] = splitStringAtLastSeparator(lastWord);
|
263
|
+
|
264
|
+
return this.getNestedSuggestions(context, textBeforeCursor, baseTextAfterSeperation)
|
265
|
+
|| this.getTopLevelSuggestions(context, textBeforeCursor);
|
266
|
+
};
|
267
|
+
|
268
|
+
getNestedSuggestions(context: CompletionContext, textBeforeCursor: string, baseTextAfterSeperation: string) {
|
269
|
+
// Return early if not a valid path or not ending with . or [
|
270
|
+
if (!isValidPath(textBeforeCursor) || !['.', '['].includes(textBeforeCursor.at(-1)!)) {
|
271
|
+
return null;
|
272
|
+
}
|
273
|
+
|
274
|
+
const path = parsePath(textBeforeCursor);
|
275
|
+
if (!path) return null;
|
276
|
+
|
277
|
+
const textAfterSeperation = baseTextAfterSeperation.replace(/["'\[]/g, '');
|
278
|
+
const isInString = textAfterSeperation !== baseTextAfterSeperation;
|
279
|
+
const isBracket = textBeforeCursor.at(-1) === '[';
|
280
|
+
|
281
|
+
// Return null if we're in a string after a dot
|
282
|
+
if (textBeforeCursor.at(-1) === '.' && isInString) return null;
|
283
|
+
|
284
|
+
// Get nested properties and filter by text after separation if it exists
|
285
|
+
let resolved = resolveNestedProperties(this.customAutoCompletions, path);
|
286
|
+
if (!resolved || typeof resolved !== 'object') return null;
|
287
|
+
|
288
|
+
if (textAfterSeperation) {
|
289
|
+
resolved = Object.fromEntries(
|
290
|
+
Object.entries(resolved).filter(([key]) =>
|
291
|
+
key.toLowerCase().startsWith(textAfterSeperation.toLowerCase())
|
292
|
+
)
|
293
|
+
);
|
294
|
+
}
|
295
|
+
|
296
|
+
return {
|
297
|
+
from: context.pos - textAfterSeperation.length,
|
298
|
+
options: Object.keys(resolved).map(key => ({
|
299
|
+
label: key,
|
300
|
+
type: 'property',
|
301
|
+
info: `Key of ${path[path.length - 1]}`,
|
302
|
+
apply: !this.allowVariableInCustomSuggestion && (isBracket && !isInString)
|
303
|
+
? `'${key}'`
|
304
|
+
: key,
|
305
|
+
boost: 999
|
306
|
+
}))
|
307
|
+
};
|
253
308
|
}
|
254
309
|
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
310
|
+
getTopLevelSuggestions(context: CompletionContext,textBeforeCursor:string){
|
311
|
+
const baseMatch: any = textBeforeCursor.match(/([a-zA-Z_$][\w$]*)$/);
|
312
|
+
if (!baseMatch) return null;
|
313
|
+
|
314
|
+
const optionsList = Object.keys(this.customAutoCompletions).filter(key =>
|
315
|
+
Object.keys(this.customAutoCompletions[key]).length &&
|
316
|
+
key.toLowerCase().startsWith(textBeforeCursor.toLowerCase())
|
317
|
+
);
|
318
|
+
|
319
|
+
const options=optionsList.map((key) => ({
|
320
|
+
label: key,
|
321
|
+
type: 'property',
|
322
|
+
apply: key,
|
323
|
+
boost: 999
|
324
|
+
}))
|
325
|
+
if(this.customCompletionsPaths.length){
|
326
|
+
this.customCompletionsPaths
|
327
|
+
.filter(path=>path.toLocaleLowerCase().includes(textBeforeCursor.toLocaleLowerCase()))
|
328
|
+
.map(path=>{
|
329
|
+
options.push({
|
330
|
+
label: ''+path,
|
331
|
+
type: 'property',
|
332
|
+
apply: ''+path,
|
333
|
+
boost: 998
|
334
|
+
})
|
335
|
+
})
|
336
|
+
}
|
337
|
+
return {
|
338
|
+
from: context.pos - baseMatch[1].length,
|
339
|
+
options: options
|
340
|
+
}
|
259
341
|
}
|
260
342
|
|
261
343
|
emitAfterTimeout(value:any){
|
@@ -270,18 +352,32 @@ export class NileCodeEditor extends NileElement {
|
|
270
352
|
});
|
271
353
|
this.view.dispatch(transaction);
|
272
354
|
}
|
273
|
-
|
355
|
+
|
356
|
+
singleLineMultiLineToggle() {
|
357
|
+
this.view.dispatch({
|
358
|
+
changes: {
|
359
|
+
from: 0,
|
360
|
+
to: this.view.state.doc.length,
|
361
|
+
insert: !this.multiline
|
362
|
+
? convertToSingleLine(this.value)
|
363
|
+
: this.value,
|
364
|
+
},
|
365
|
+
});
|
366
|
+
}
|
367
|
+
|
274
368
|
//EXTENSION CONFIGURATIONS
|
275
369
|
getLineNumbersExension() {
|
276
370
|
return (!this.multiline && this.lineNumbers) || (this.multiline && this.lineNumbersMultiline) ? lineNumbers() : [];
|
277
371
|
}
|
278
372
|
|
279
|
-
getLanguageExtension(){
|
373
|
+
getLanguageExtension():Extension{
|
280
374
|
switch(this.language){
|
281
375
|
case 'sql':
|
282
376
|
return sql();
|
283
377
|
case 'json':
|
284
378
|
return json();
|
379
|
+
case 'html':
|
380
|
+
return htmlLang();
|
285
381
|
default:
|
286
382
|
return javascript();
|
287
383
|
}
|
@@ -297,121 +393,70 @@ export class NileCodeEditor extends NileElement {
|
|
297
393
|
) : [];
|
298
394
|
}
|
299
395
|
|
396
|
+
getPlaceholderExtension(){
|
397
|
+
return this.placeholder ? placeholder(this.placeholder) : [];
|
398
|
+
}
|
399
|
+
|
300
400
|
restrictSingleLine() {
|
301
401
|
return EditorState.transactionFilter.of(tr =>
|
302
402
|
tr.newDoc.lines > 1 ? [] : tr
|
303
403
|
);
|
304
404
|
}
|
405
|
+
/* #endregion */
|
406
|
+
}
|
407
|
+
|
408
|
+
export default NileCodeEditor;
|
305
409
|
|
306
|
-
|
307
|
-
|
410
|
+
declare global {
|
411
|
+
interface HTMLElementTagNameMap {
|
412
|
+
'nile-code-editor': NileCodeEditor;
|
308
413
|
}
|
414
|
+
}
|
309
415
|
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
const
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
let resolved = this.resolveNestedProperties(this.customAutoCompletions, path);
|
324
|
-
if(textAfterSeperation){
|
325
|
-
const obj:any={}
|
326
|
-
Object.keys(resolved).forEach((key)=>{
|
327
|
-
if(key.toLowerCase().startsWith(textAfterSeperation.toLowerCase())){
|
328
|
-
obj[key]=resolved[key]
|
329
|
-
}
|
330
|
-
})
|
331
|
-
resolved=obj
|
332
|
-
}
|
333
|
-
// If resolved is an object, provide its keys as suggestions
|
334
|
-
if (resolved && typeof resolved === 'object') {
|
335
|
-
return {
|
336
|
-
from: context.pos-textAfterSeperation.length,
|
337
|
-
options: Object.keys(resolved).map((key) => ({
|
338
|
-
label: key,
|
339
|
-
type: 'property',
|
340
|
-
info: `Key of ${path[path.length - 1]}`,
|
341
|
-
apply: key,
|
342
|
-
boost: 999
|
343
|
-
})),
|
344
|
-
};
|
345
|
-
}
|
346
|
-
}
|
347
|
-
}
|
348
|
-
|
349
|
-
// Match for top-level object suggestions, e.g., "a"
|
350
|
-
const baseMatch: any = textBeforeCursor.match(/([a-zA-Z_$][\w$]*)$/);
|
351
|
-
if (baseMatch) {
|
352
|
-
const optionsList=Object.keys(this.customAutoCompletions).filter(key=>key.toLowerCase().startsWith(textBeforeCursor.toLowerCase()));
|
353
|
-
return {
|
354
|
-
from: context.pos - baseMatch[1].length,
|
355
|
-
options: optionsList.map((key) => ({
|
356
|
-
label: key,
|
357
|
-
type: 'property',
|
358
|
-
apply: key,
|
359
|
-
boost: 999
|
360
|
-
}))
|
416
|
+
function parsePath(text: string) {
|
417
|
+
const regex = /([a-zA-Z_$][\w$]*)(\[(?:[^\]]+)\]|\.[a-zA-Z_$][\w$]*)*/g;
|
418
|
+
const matches = [...text.matchAll(regex)];
|
419
|
+
if (matches.length > 0) {
|
420
|
+
const base = matches[0][1]; // The base object name
|
421
|
+
const keys = [base];
|
422
|
+
// Extract keys from dot or bracket notation
|
423
|
+
const pathMatches = text.match(/\[(.*?)\]|\.(\w+)/g) || [];
|
424
|
+
for (const match of pathMatches) {
|
425
|
+
if (match.startsWith('[')) {
|
426
|
+
keys.push(match.slice(1, -1).replace(/['"]/g, '')); // Remove brackets and quotes
|
427
|
+
} else if (match.startsWith('.')) {
|
428
|
+
keys.push(match.slice(1));
|
361
429
|
}
|
362
430
|
}
|
363
|
-
|
364
|
-
|
365
|
-
|
431
|
+
return keys;
|
432
|
+
}
|
433
|
+
return null;
|
434
|
+
};
|
366
435
|
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
return null;
|
373
|
-
}, obj);
|
374
|
-
};
|
436
|
+
function splitStringAtLastSeparator(input:string) {
|
437
|
+
const lastSeparatorIndex = Math.max(input.lastIndexOf('.'), input.lastIndexOf('['));
|
438
|
+
if (lastSeparatorIndex === -1) return [input, ''];
|
439
|
+
return [input.slice(0, lastSeparatorIndex + 1), input.slice(lastSeparatorIndex + 1)];
|
440
|
+
}
|
375
441
|
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
const base = matches[0][1]; // The base object name
|
381
|
-
const keys = [base];
|
382
|
-
// Extract keys from dot or bracket notation
|
383
|
-
const pathMatches = text.match(/\[(.*?)\]|\.(\w+)/g) || [];
|
384
|
-
for (const match of pathMatches) {
|
385
|
-
if (match.startsWith('[')) {
|
386
|
-
keys.push(match.slice(1, -1).replace(/['"]/g, '')); // Remove brackets and quotes
|
387
|
-
} else if (match.startsWith('.')) {
|
388
|
-
keys.push(match.slice(1));
|
389
|
-
}
|
390
|
-
}
|
391
|
-
return keys;
|
442
|
+
function resolveNestedProperties (obj:any, keys:any[]){
|
443
|
+
return keys.reduce((acc, key) => {
|
444
|
+
if (acc && typeof acc === 'object') {
|
445
|
+
return acc[key];
|
392
446
|
}
|
393
447
|
return null;
|
394
|
-
};
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
splitStringAtLastSeparator(input:string) {
|
404
|
-
const lastSeparatorIndex = Math.max(input.lastIndexOf('.'), input.lastIndexOf('['));
|
405
|
-
if (lastSeparatorIndex === -1) return [input, ''];
|
406
|
-
return [input.slice(0, lastSeparatorIndex + 1), input.slice(lastSeparatorIndex + 1)];
|
407
|
-
}
|
408
|
-
/* #endregion */
|
448
|
+
}, obj);
|
449
|
+
};
|
450
|
+
|
451
|
+
function isValidPath(path: string) {
|
452
|
+
// Regex to validate the format of the string
|
453
|
+
const regex = /^([a-zA-Z_$][\w$]*)(\.[a-zA-Z_$][\w$]*|\[\s*(['"]?[a-zA-Z0-9_$]*['"]?)\s*\])*([\.\[])?$/;
|
454
|
+
// Test the string against the regex
|
455
|
+
return regex.test(path);
|
409
456
|
}
|
410
457
|
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
}
|
417
|
-
}
|
458
|
+
function convertToSingleLine(code: string) {
|
459
|
+
if (!code) return '';
|
460
|
+
// Remove line breaks and unnecessary whitespace
|
461
|
+
return code.replace(/\s+/g, ' ').trim();
|
462
|
+
}
|
@@ -10,6 +10,7 @@ import {
|
|
10
10
|
html,
|
11
11
|
CSSResultArray,
|
12
12
|
TemplateResult,
|
13
|
+
PropertyValues,
|
13
14
|
} from 'lit';
|
14
15
|
import { customElement, property } from 'lit/decorators.js';
|
15
16
|
import { styles } from './nile-error-notification.css';
|
@@ -35,9 +36,8 @@ export class NileErrorNotification extends LitElement {
|
|
35
36
|
|
36
37
|
@property({ type: String, reflect: true }) color: string = '';
|
37
38
|
|
38
|
-
|
39
|
-
|
40
|
-
if(this.color){
|
39
|
+
protected updated(_changedProperties: PropertyValues): void {
|
40
|
+
if(_changedProperties.has('color')){
|
41
41
|
this.style.setProperty('--indication-color',this.color)
|
42
42
|
}
|
43
43
|
}
|
@@ -726,7 +726,7 @@
|
|
726
726
|
},
|
727
727
|
{
|
728
728
|
"name": "nile-code-editor",
|
729
|
-
"description": "Nile icon component.\n\nEvents:\n\n * `nile-focus` {`Event`} - \n\n * `nile-blur` {`Event`} - \n\nAttributes:\n\n * `value` {`string`} - \n\n * `expandIcon` {`string`} - \n\n * `customAutoCompletions` - \n\n * `language` {`\"javascript\" | \"sql\" | \"json\"`} - \n\n * `error-message` {`string`} - \n\n * `error` {`boolean`} - \n\n * `noborder` {`boolean`} - \n\n * `multiline` {`boolean`} - \n\n * `
|
729
|
+
"description": "Nile icon component.\n\nEvents:\n\n * `nile-focus` {`Event`} - \n\n * `nile-blur` {`Event`} - \n\nAttributes:\n\n * `value` {`string`} - \n\n * `expandIcon` {`string`} - \n\n * `placeholder` {`string`} - \n\n * `customAutoCompletions` - \n\n * `customCompletionsPaths` {`string[]`} - \n\n * `language` {`\"html\" | \"javascript\" | \"sql\" | \"json\"`} - \n\n * `error-message` {`string`} - \n\n * `error` {`boolean`} - \n\n * `noborder` {`boolean`} - \n\n * `multiline` {`boolean`} - \n\n * `allowVariableInCustomSuggestion` {`boolean`} - \n\n * `lineNumbers` {`boolean`} - \n\n * `lineNumbersMultiline` {`boolean`} - \n\n * `hasScroller` {`boolean`} - \n\n * `expandable` {`boolean`} - \n\n * `readonly` {`boolean`} - \n\n * `debounce` {`boolean`} - \n\nProperties:\n\n * `codeEditor` {`HTMLInputElement`} - \n\n * `value` {`string`} - \n\n * `expandIcon` {`string`} - \n\n * `placeholder` {`string`} - \n\n * `customAutoCompletions` - \n\n * `customCompletionsPaths` {`string[]`} - \n\n * `language` {`\"html\" | \"javascript\" | \"sql\" | \"json\"`} - \n\n * `errorMessage` {`string`} - \n\n * `error` {`boolean`} - \n\n * `noborder` {`boolean`} - \n\n * `multiline` {`boolean`} - \n\n * `allowVariableInCustomSuggestion` {`boolean`} - \n\n * `lineNumbers` {`boolean`} - \n\n * `lineNumbersMultiline` {`boolean`} - \n\n * `hasScroller` {`boolean`} - \n\n * `expandable` {`boolean`} - \n\n * `readonly` {`boolean`} - \n\n * `debounce` {`boolean`} - \n\n * `view` - \n\n * `viewState` - \n\n * `timeOut` - \n\n * `lineNumbersComp` - \n\n * `restrictSingleLineComp` - \n\n * `readOnlyComp` - \n\n * `customCompletionComp` - \n\n * `placeholderComp` - \n\n * `customAutocomplete` - \n\n * `insertBetweenCode` - \n\n * `BUBBLES` {`boolean`} - \n\n * `COMPOSED` {`boolean`} - \n\n * `CANCELABLE` {`boolean`} - ",
|
730
730
|
"attributes": [
|
731
731
|
{
|
732
732
|
"name": "value",
|
@@ -736,14 +736,25 @@
|
|
736
736
|
"name": "expandIcon",
|
737
737
|
"description": "`expandIcon` {`string`} - \n\nProperty: expandIcon\n\nDefault: expand-2"
|
738
738
|
},
|
739
|
+
{
|
740
|
+
"name": "placeholder",
|
741
|
+
"description": "`placeholder` {`string`} - \n\nProperty: placeholder\n\nDefault: "
|
742
|
+
},
|
739
743
|
{
|
740
744
|
"name": "customAutoCompletions",
|
741
745
|
"description": "`customAutoCompletions` - \n\nProperty: customAutoCompletions\n\nDefault: [object Object]"
|
742
746
|
},
|
747
|
+
{
|
748
|
+
"name": "customCompletionsPaths",
|
749
|
+
"description": "`customCompletionsPaths` {`string[]`} - \n\nProperty: customCompletionsPaths\n\nDefault: "
|
750
|
+
},
|
743
751
|
{
|
744
752
|
"name": "language",
|
745
|
-
"description": "`language` {`\"javascript\" | \"sql\" | \"json\"`} - \n\nProperty: language\n\nDefault: javascript",
|
753
|
+
"description": "`language` {`\"html\" | \"javascript\" | \"sql\" | \"json\"`} - \n\nProperty: language\n\nDefault: javascript",
|
746
754
|
"values": [
|
755
|
+
{
|
756
|
+
"name": "html"
|
757
|
+
},
|
747
758
|
{
|
748
759
|
"name": "javascript"
|
749
760
|
},
|
@@ -775,8 +786,8 @@
|
|
775
786
|
"valueSet": "v"
|
776
787
|
},
|
777
788
|
{
|
778
|
-
"name": "
|
779
|
-
"description": "`
|
789
|
+
"name": "allowVariableInCustomSuggestion",
|
790
|
+
"description": "`allowVariableInCustomSuggestion` {`boolean`} - \n\nProperty: allowVariableInCustomSuggestion\n\nDefault: false",
|
780
791
|
"valueSet": "v"
|
781
792
|
},
|
782
793
|
{
|