@aquera/nile-elements 0.0.130 → 0.0.131
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 +4 -0
- package/dist/nile-code-editor/nile-code-editor.cjs.js +1 -1
- package/dist/nile-code-editor/nile-code-editor.cjs.js.map +1 -1
- package/dist/nile-code-editor/nile-code-editor.esm.js +2 -2
- 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.css.cjs.js +1 -1
- package/dist/nile-error-notification/nile-error-notification.css.cjs.js.map +1 -1
- package/dist/nile-error-notification/nile-error-notification.css.esm.js +5 -4
- package/dist/nile-error-notification/nile-error-notification.esm.js +3 -3
- package/dist/src/nile-code-editor/nile-code-editor.js +9 -7
- package/dist/src/nile-code-editor/nile-code-editor.js.map +1 -1
- package/dist/src/nile-error-notification/nile-error-notification.css.js +4 -3
- package/dist/src/nile-error-notification/nile-error-notification.css.js.map +1 -1
- package/dist/src/nile-error-notification/nile-error-notification.d.ts +2 -0
- package/dist/src/nile-error-notification/nile-error-notification.js +11 -1
- package/dist/src/nile-error-notification/nile-error-notification.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/nile-code-editor/nile-code-editor.ts +11 -8
- package/src/nile-error-notification/nile-error-notification.css.ts +4 -3
- package/src/nile-error-notification/nile-error-notification.ts +11 -3
- package/vscode-html-custom-data.json +5 -1
package/package.json
CHANGED
@@ -265,7 +265,7 @@ export class NileCodeEditor extends NileElement {
|
|
265
265
|
public insertBetweenCode=(text: string) => {
|
266
266
|
const transaction = this.view.state.changeByRange(range => {
|
267
267
|
const { from, to } = range;
|
268
|
-
return { changes: { from, to, insert: text }, range };
|
268
|
+
return { changes: { from:from, to, insert: text }, range };
|
269
269
|
});
|
270
270
|
this.view.dispatch(transaction);
|
271
271
|
}
|
@@ -309,7 +309,10 @@ export class NileCodeEditor extends NileElement {
|
|
309
309
|
customAutocomplete = (context: CompletionContext): CompletionResult | null => {
|
310
310
|
// Getting the valid last line, last text from the code editor
|
311
311
|
let text = context.state.doc.sliceString(0, context.pos);
|
312
|
-
const [textBeforeCursor,
|
312
|
+
const [textBeforeCursor,baseTextAfterSeperation]=this.splitStringAtLastSeparator(text.split('\n').at(-1)?.split(' ').at(-1)+'')
|
313
|
+
const textAfterSeperation=baseTextAfterSeperation.replace(/["'\[]/g, '')
|
314
|
+
|
315
|
+
const isSuggestionString=textAfterSeperation!=baseTextAfterSeperation;
|
313
316
|
|
314
317
|
if (!this.isValidPath(textBeforeCursor)) return { from: context.pos, options: [] };
|
315
318
|
if(['.', '['].includes(textBeforeCursor[textBeforeCursor.length - 1])){
|
@@ -320,7 +323,7 @@ export class NileCodeEditor extends NileElement {
|
|
320
323
|
if(textAfterSeperation){
|
321
324
|
const obj:any={}
|
322
325
|
Object.keys(resolved).forEach((key)=>{
|
323
|
-
if(key.startsWith(textAfterSeperation)){
|
326
|
+
if(key.toLowerCase().startsWith(textAfterSeperation.toLowerCase())){
|
324
327
|
obj[key]=resolved[key]
|
325
328
|
}
|
326
329
|
})
|
@@ -329,12 +332,12 @@ export class NileCodeEditor extends NileElement {
|
|
329
332
|
// If resolved is an object, provide its keys as suggestions
|
330
333
|
if (resolved && typeof resolved === 'object') {
|
331
334
|
return {
|
332
|
-
from: context.pos,
|
335
|
+
from: context.pos-textAfterSeperation.length,
|
333
336
|
options: Object.keys(resolved).map((key) => ({
|
334
337
|
label: key,
|
335
338
|
type: 'property',
|
336
339
|
info: `Key of ${path[path.length - 1]}`,
|
337
|
-
apply: key
|
340
|
+
apply: key,
|
338
341
|
boost: 999
|
339
342
|
})),
|
340
343
|
};
|
@@ -345,7 +348,7 @@ export class NileCodeEditor extends NileElement {
|
|
345
348
|
// Match for top-level object suggestions, e.g., "a"
|
346
349
|
const baseMatch: any = textBeforeCursor.match(/([a-zA-Z_$][\w$]*)$/);
|
347
350
|
if (baseMatch) {
|
348
|
-
const optionsList=Object.keys(this.customAutoCompletions).filter(key=>key.startsWith(textBeforeCursor));
|
351
|
+
const optionsList=Object.keys(this.customAutoCompletions).filter(key=>key.toLowerCase().startsWith(textBeforeCursor.toLowerCase()));
|
349
352
|
return {
|
350
353
|
from: context.pos - baseMatch[1].length,
|
351
354
|
options: optionsList.map((key) => ({
|
@@ -398,8 +401,8 @@ export class NileCodeEditor extends NileElement {
|
|
398
401
|
|
399
402
|
splitStringAtLastSeparator(input:string) {
|
400
403
|
const lastSeparatorIndex = Math.max(input.lastIndexOf('.'), input.lastIndexOf('['));
|
401
|
-
if (lastSeparatorIndex === -1) return [input, ''];
|
402
|
-
return [input.slice(0, lastSeparatorIndex + 1), input.slice(lastSeparatorIndex + 1)
|
404
|
+
if (lastSeparatorIndex === -1) return [input, ''];
|
405
|
+
return [input.slice(0, lastSeparatorIndex + 1), input.slice(lastSeparatorIndex + 1)];
|
403
406
|
}
|
404
407
|
/* #endregion */
|
405
408
|
}
|
@@ -12,6 +12,7 @@ import { css } from 'lit-element';
|
|
12
12
|
*/
|
13
13
|
export const styles = css`
|
14
14
|
:host {
|
15
|
+
--indication-color: green;
|
15
16
|
}
|
16
17
|
|
17
18
|
.nile-error-notification {
|
@@ -21,12 +22,12 @@ export const styles = css`
|
|
21
22
|
font-weight: 400;
|
22
23
|
line-height: 12px;
|
23
24
|
letter-spacing: 0.2px;
|
24
|
-
border: 1px solid var(--
|
25
|
-
border-left: 6px solid var(--
|
25
|
+
border: 1px solid var(--indication-color);
|
26
|
+
border-left: 6px solid var(--indication-color);
|
26
27
|
border-radius: 4px;
|
27
28
|
padding: 8px;
|
28
29
|
background: var(--nile-colors-neutral-100);
|
29
|
-
color: var(--
|
30
|
+
color: var(--indication-color);
|
30
31
|
box-sizing: border-box;
|
31
32
|
}
|
32
33
|
|
@@ -32,8 +32,16 @@ export class NileErrorNotification extends LitElement {
|
|
32
32
|
}
|
33
33
|
|
34
34
|
// Represents the error message to be displayed to the user.
|
35
|
-
@property({ type: String, reflect: true })
|
36
|
-
|
35
|
+
@property({ type: String, reflect: true }) errorMessage: string = '';
|
36
|
+
|
37
|
+
@property({ type: String, reflect: true }) color: string = '';
|
38
|
+
|
39
|
+
connectedCallback(): void {
|
40
|
+
super.connectedCallback();
|
41
|
+
if(this.color){
|
42
|
+
this.style.setProperty('--indication-color',this.color)
|
43
|
+
}
|
44
|
+
}
|
37
45
|
|
38
46
|
/* #endregion */
|
39
47
|
|
@@ -51,7 +59,7 @@ export class NileErrorNotification extends LitElement {
|
|
51
59
|
size="14"
|
52
60
|
class="nile-error-notification__icon"
|
53
61
|
part="icon"
|
54
|
-
color="
|
62
|
+
color="var(--indication-color)"
|
55
63
|
></nile-icon>
|
56
64
|
${this.errorMessage}
|
57
65
|
</div>
|
@@ -1250,11 +1250,15 @@
|
|
1250
1250
|
},
|
1251
1251
|
{
|
1252
1252
|
"name": "nile-error-notification",
|
1253
|
-
"description": "Nile icon component.\n\nAttributes:\n\n * `errorMessage` {`string`} - \n\nProperties:\n\n * `errorMessage` {`string`} - ",
|
1253
|
+
"description": "Nile icon component.\n\nAttributes:\n\n * `errorMessage` {`string`} - \n\n * `color` {`string`} - \n\nProperties:\n\n * `errorMessage` {`string`} - \n\n * `color` {`string`} - ",
|
1254
1254
|
"attributes": [
|
1255
1255
|
{
|
1256
1256
|
"name": "errorMessage",
|
1257
1257
|
"description": "`errorMessage` {`string`} - \n\nProperty: errorMessage\n\nDefault: "
|
1258
|
+
},
|
1259
|
+
{
|
1260
|
+
"name": "color",
|
1261
|
+
"description": "`color` {`string`} - \n\nProperty: color\n\nDefault: "
|
1258
1262
|
}
|
1259
1263
|
]
|
1260
1264
|
},
|