@aquera/nile-elements 0.0.130 → 0.0.132

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.
Files changed (24) hide show
  1. package/README.md +8 -0
  2. package/dist/nile-code-editor/nile-code-editor.cjs.js +1 -1
  3. package/dist/nile-code-editor/nile-code-editor.cjs.js.map +1 -1
  4. package/dist/nile-code-editor/nile-code-editor.esm.js +3 -3
  5. package/dist/nile-error-notification/nile-error-notification.cjs.js +1 -1
  6. package/dist/nile-error-notification/nile-error-notification.cjs.js.map +1 -1
  7. package/dist/nile-error-notification/nile-error-notification.css.cjs.js +1 -1
  8. package/dist/nile-error-notification/nile-error-notification.css.cjs.js.map +1 -1
  9. package/dist/nile-error-notification/nile-error-notification.css.esm.js +5 -4
  10. package/dist/nile-error-notification/nile-error-notification.esm.js +3 -3
  11. package/dist/src/nile-code-editor/nile-code-editor.d.ts +1 -0
  12. package/dist/src/nile-code-editor/nile-code-editor.js +15 -9
  13. package/dist/src/nile-code-editor/nile-code-editor.js.map +1 -1
  14. package/dist/src/nile-error-notification/nile-error-notification.css.js +4 -3
  15. package/dist/src/nile-error-notification/nile-error-notification.css.js.map +1 -1
  16. package/dist/src/nile-error-notification/nile-error-notification.d.ts +2 -0
  17. package/dist/src/nile-error-notification/nile-error-notification.js +11 -1
  18. package/dist/src/nile-error-notification/nile-error-notification.js.map +1 -1
  19. package/dist/tsconfig.tsbuildinfo +1 -1
  20. package/package.json +1 -1
  21. package/src/nile-code-editor/nile-code-editor.ts +15 -10
  22. package/src/nile-error-notification/nile-error-notification.css.ts +4 -3
  23. package/src/nile-error-notification/nile-error-notification.ts +11 -3
  24. package/vscode-html-custom-data.json +10 -2
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.0.130",
6
+ "version": "0.0.132",
7
7
  "main": "dist/src/index.js",
8
8
  "type": "module",
9
9
  "module": "dist/src/index.js",
@@ -53,6 +53,8 @@ export class NileCodeEditor extends NileElement {
53
53
 
54
54
  @property({ type: String, reflect: true , attribute: true }) value = '';
55
55
 
56
+ @property({ type: String, reflect: true , attribute: true }) expandIcon = "expand-2";
57
+
56
58
  @property({ type: Object, reflect: true , attribute: true }) customAutoCompletions: object | any = {};
57
59
 
58
60
  @property({ type: String, reflect: true , attribute: true}) language: 'javascript' | 'sql' | 'json' = 'javascript';
@@ -99,7 +101,6 @@ export class NileCodeEditor extends NileElement {
99
101
 
100
102
  connectedCallback(): void {
101
103
  super.connectedCallback();
102
- this.createState()
103
104
  this.emit('nile-init',undefined,false);
104
105
  }
105
106
 
@@ -176,7 +177,7 @@ export class NileCodeEditor extends NileElement {
176
177
  ${this.expandable
177
178
  ? html`
178
179
  <nile-icon
179
- name="expand-2"
180
+ name="${this.expandIcon}"
180
181
  class="code-editor__icon__container"
181
182
  size="16"
182
183
  color="black"
@@ -195,6 +196,7 @@ export class NileCodeEditor extends NileElement {
195
196
 
196
197
  createNewView(emitEvent=true){
197
198
  if(this.view) this.view.destroy();
199
+ this.createState()
198
200
  this.view = new EditorView({
199
201
  state: this.viewState,
200
202
  parent: this.codeEditor
@@ -265,7 +267,7 @@ export class NileCodeEditor extends NileElement {
265
267
  public insertBetweenCode=(text: string) => {
266
268
  const transaction = this.view.state.changeByRange(range => {
267
269
  const { from, to } = range;
268
- return { changes: { from, to, insert: text }, range };
270
+ return { changes: { from:from, to, insert: text }, range };
269
271
  });
270
272
  this.view.dispatch(transaction);
271
273
  }
@@ -309,7 +311,10 @@ export class NileCodeEditor extends NileElement {
309
311
  customAutocomplete = (context: CompletionContext): CompletionResult | null => {
310
312
  // Getting the valid last line, last text from the code editor
311
313
  let text = context.state.doc.sliceString(0, context.pos);
312
- const [textBeforeCursor,textAfterSeperation]=this.splitStringAtLastSeparator(text.split('\n').at(-1)?.split(' ').at(-1)+'')
314
+ const [textBeforeCursor,baseTextAfterSeperation]=this.splitStringAtLastSeparator(text.split('\n').at(-1)?.split(' ').at(-1)+'')
315
+ const textAfterSeperation=baseTextAfterSeperation.replace(/["'\[]/g, '')
316
+
317
+ const isSuggestionString=textAfterSeperation!=baseTextAfterSeperation;
313
318
 
314
319
  if (!this.isValidPath(textBeforeCursor)) return { from: context.pos, options: [] };
315
320
  if(['.', '['].includes(textBeforeCursor[textBeforeCursor.length - 1])){
@@ -320,7 +325,7 @@ export class NileCodeEditor extends NileElement {
320
325
  if(textAfterSeperation){
321
326
  const obj:any={}
322
327
  Object.keys(resolved).forEach((key)=>{
323
- if(key.startsWith(textAfterSeperation)){
328
+ if(key.toLowerCase().startsWith(textAfterSeperation.toLowerCase())){
324
329
  obj[key]=resolved[key]
325
330
  }
326
331
  })
@@ -329,12 +334,12 @@ export class NileCodeEditor extends NileElement {
329
334
  // If resolved is an object, provide its keys as suggestions
330
335
  if (resolved && typeof resolved === 'object') {
331
336
  return {
332
- from: context.pos,
337
+ from: context.pos-textAfterSeperation.length,
333
338
  options: Object.keys(resolved).map((key) => ({
334
339
  label: key,
335
340
  type: 'property',
336
341
  info: `Key of ${path[path.length - 1]}`,
337
- apply: key.slice(textAfterSeperation.length),
342
+ apply: key,
338
343
  boost: 999
339
344
  })),
340
345
  };
@@ -345,7 +350,7 @@ export class NileCodeEditor extends NileElement {
345
350
  // Match for top-level object suggestions, e.g., "a"
346
351
  const baseMatch: any = textBeforeCursor.match(/([a-zA-Z_$][\w$]*)$/);
347
352
  if (baseMatch) {
348
- const optionsList=Object.keys(this.customAutoCompletions).filter(key=>key.startsWith(textBeforeCursor));
353
+ const optionsList=Object.keys(this.customAutoCompletions).filter(key=>key.toLowerCase().startsWith(textBeforeCursor.toLowerCase()));
349
354
  return {
350
355
  from: context.pos - baseMatch[1].length,
351
356
  options: optionsList.map((key) => ({
@@ -398,8 +403,8 @@ export class NileCodeEditor extends NileElement {
398
403
 
399
404
  splitStringAtLastSeparator(input:string) {
400
405
  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).replace(/["'\[]/g, '')];
406
+ if (lastSeparatorIndex === -1) return [input, ''];
407
+ return [input.slice(0, lastSeparatorIndex + 1), input.slice(lastSeparatorIndex + 1)];
403
408
  }
404
409
  /* #endregion */
405
410
  }
@@ -12,6 +12,7 @@ import { css } from 'lit-element';
12
12
  */
13
13
  export const styles = css`
14
14
  :host {
15
+ --indication-color: var(--nile-colors-red-500);
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(--nile-colors-red-500);
25
- border-left: 6px solid var(--nile-colors-red-500);
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(--nile-colors-red-500);
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
- errorMessage: string = '';
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="#E5434D"
62
+ color="var(--indication-color)"
55
63
  ></nile-icon>
56
64
  ${this.errorMessage}
57
65
  </div>
@@ -726,12 +726,16 @@
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 * `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 * `suggestionBracketSupport` {`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 * `customAutoCompletions` - \n\n * `language` {`\"javascript\" | \"sql\" | \"json\"`} - \n\n * `errorMessage` {`string`} - \n\n * `error` {`boolean`} - \n\n * `noborder` {`boolean`} - \n\n * `multiline` {`boolean`} - \n\n * `suggestionBracketSupport` {`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 * `insertBetweenCode` - \n\n * `customAutocomplete` - \n\n * `resolveNestedProperties` - \n\n * `BUBBLES` {`boolean`} - \n\n * `COMPOSED` {`boolean`} - \n\n * `CANCELABLE` {`boolean`} - ",
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 * `suggestionBracketSupport` {`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 * `customAutoCompletions` - \n\n * `language` {`\"javascript\" | \"sql\" | \"json\"`} - \n\n * `errorMessage` {`string`} - \n\n * `error` {`boolean`} - \n\n * `noborder` {`boolean`} - \n\n * `multiline` {`boolean`} - \n\n * `suggestionBracketSupport` {`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 * `insertBetweenCode` - \n\n * `customAutocomplete` - \n\n * `resolveNestedProperties` - \n\n * `BUBBLES` {`boolean`} - \n\n * `COMPOSED` {`boolean`} - \n\n * `CANCELABLE` {`boolean`} - ",
730
730
  "attributes": [
731
731
  {
732
732
  "name": "value",
733
733
  "description": "`value` {`string`} - \n\nProperty: value\n\nDefault: "
734
734
  },
735
+ {
736
+ "name": "expandIcon",
737
+ "description": "`expandIcon` {`string`} - \n\nProperty: expandIcon\n\nDefault: expand-2"
738
+ },
735
739
  {
736
740
  "name": "customAutoCompletions",
737
741
  "description": "`customAutoCompletions` - \n\nProperty: customAutoCompletions\n\nDefault: [object Object]"
@@ -1250,11 +1254,15 @@
1250
1254
  },
1251
1255
  {
1252
1256
  "name": "nile-error-notification",
1253
- "description": "Nile icon component.\n\nAttributes:\n\n * `errorMessage` {`string`} - \n\nProperties:\n\n * `errorMessage` {`string`} - ",
1257
+ "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
1258
  "attributes": [
1255
1259
  {
1256
1260
  "name": "errorMessage",
1257
1261
  "description": "`errorMessage` {`string`} - \n\nProperty: errorMessage\n\nDefault: "
1262
+ },
1263
+ {
1264
+ "name": "color",
1265
+ "description": "`color` {`string`} - \n\nProperty: color\n\nDefault: "
1258
1266
  }
1259
1267
  ]
1260
1268
  },