@aquera/nile-elements 0.1.67 → 0.1.68

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/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.67",
6
+ "version": "0.1.68",
7
7
  "main": "dist/src/index.js",
8
8
  "type": "module",
9
9
  "module": "dist/src/index.js",
@@ -35,13 +35,12 @@ import {
35
35
  import { sql } from '@codemirror/lang-sql';
36
36
  import { json } from '@codemirror/lang-json';
37
37
  import { html as htmlLang } from '@codemirror/lang-html';
38
- import { autocompletion,closeCompletion,CompletionContext,CompletionResult, completionStatus } from '@codemirror/autocomplete';
38
+ import { autocompletion,acceptCompletion, closeCompletion,CompletionContext,CompletionResult, completionStatus } from '@codemirror/autocomplete';
39
39
  import NileElement from '../internal/nile-element';
40
40
  import { basicSetup } from './extensionSetup';
41
41
  import { classMap } from 'lit/directives/class-map.js';
42
- import { Theme as DefaultTheme, customisedThemeCss } from './theme';
42
+ import { Theme as DefaultTheme, customisedThemeCss, fontFamily } from './theme';
43
43
  import { keymap } from '@codemirror/view';
44
- import { acceptCompletion } from '@codemirror/autocomplete';
45
44
 
46
45
  // Choose the appropriate mode for your use case
47
46
 
@@ -104,6 +103,8 @@ export class NileCodeEditor extends NileElement {
104
103
 
105
104
  @property({ type: Boolean, reflect: true, attribute: true }) tabCompletion: boolean = true;
106
105
 
106
+ @property({ type: Boolean, reflect: true, attribute: true }) defaultFont: boolean = false;
107
+
107
108
  public view: EditorView;
108
109
  public viewState:EditorState;
109
110
  private timeOut: any = null;
@@ -116,6 +117,7 @@ export class NileCodeEditor extends NileElement {
116
117
  private placeholderComp = new Compartment();
117
118
  private defaultSyntaxHighlightingComp = new Compartment();
118
119
  private themeComp = new Compartment();
120
+ private autoCompletionComp = new Compartment();
119
121
 
120
122
  private isSpacePressed:boolean = false;
121
123
  /**
@@ -179,6 +181,15 @@ export class NileCodeEditor extends NileElement {
179
181
  ]
180
182
  })
181
183
  }
184
+ if (changedProperties.has('aboveCursor')) {
185
+ this.view.dispatch({
186
+ effects: [
187
+ this.autoCompletionComp.reconfigure(
188
+ autocompletion({ aboveCursor: this.aboveCursor })
189
+ )
190
+ ]
191
+ });
192
+ }
182
193
  if (changedProperties.has('placeholder')) {
183
194
  this.view.dispatch({
184
195
  effects: [
@@ -310,7 +321,9 @@ export class NileCodeEditor extends NileElement {
310
321
  customAutoCompletions,
311
322
  placeholderExtension,
312
323
  defaultSyntaxHighlightingExtension,
313
- autocompletion({aboveCursor: this.aboveCursor}),
324
+ this.autoCompletionComp.of(
325
+ autocompletion({ aboveCursor: this.aboveCursor })
326
+ ),
314
327
  language,
315
328
  customThemeExtension,
316
329
  this.getTabCompletionKeymap(),
@@ -533,10 +546,16 @@ export class NileCodeEditor extends NileElement {
533
546
  }
534
547
 
535
548
  getCustomThemeExtension(): Extension {
536
- if (this.customThemeCSS) {
549
+ if(this.customThemeCSS) {
550
+ if(this.defaultFont){
551
+ return [EditorView.theme(this.customThemeCSS as { [selector: string]: StyleSpec }), EditorView.theme(customisedThemeCss),EditorView.theme(fontFamily)];
552
+ }
537
553
  return [EditorView.theme(this.customThemeCSS as { [selector: string]: StyleSpec }), EditorView.theme(customisedThemeCss)];
538
554
  }
539
- return [EditorView.theme(customisedThemeCss), EditorView.theme(DefaultTheme)];
555
+ if(this.defaultFont){
556
+ return [EditorView.theme(customisedThemeCss), EditorView.theme(fontFamily)];
557
+ }
558
+ return [EditorView.theme(customisedThemeCss)];
540
559
  }
541
560
 
542
561
  restrictSingleLine() {
@@ -38,6 +38,16 @@ export const CustomTheme = {
38
38
  },
39
39
  };
40
40
 
41
+ export const fontFamily = {
42
+ '.cm-tooltip.cm-tooltip-autocomplete > ul' : {
43
+ fontFamily: 'monospace !important',
44
+ fontWeight: '400',
45
+ },
46
+ '.cm-content' : {
47
+ fontFamily: 'monospace !important',
48
+ }
49
+ }
50
+
41
51
  export const customisedThemeCss = {
42
52
  '.cm-content' : {
43
53
  fontFamily: 'inherit',
@@ -153,4 +163,4 @@ export const customisedThemeCss = {
153
163
  '.cm-completionLabel': {
154
164
  marginLeft: '18px',
155
165
  }
156
- };
166
+ };
@@ -818,7 +818,7 @@
818
818
  },
819
819
  {
820
820
  "name": "nile-code-editor",
821
- "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 * `enableSearch` {`boolean`} - \n\n * `noborder` {`boolean`} - \n\n * `multiline` {`boolean`} - \n\n * `enableFoldGutters` {`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 * `debounceTimeout` {`number`} - \n\n * `aboveCursor` {`boolean`} - \n\n * `tabCompletion` {`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 * `enableSearch` {`boolean`} - \n\n * `noborder` {`boolean`} - \n\n * `multiline` {`boolean`} - \n\n * `enableFoldGutters` {`boolean`} - \n\n * `allowVariableInCustomSuggestion` {`boolean`} - \n\n * `lineNumbers` {`boolean`} - \n\n * `disableSyntaxHighlighting` {`boolean`} - \n\n * `customThemeCSS` {`object | null`} - \n\n * `lineNumbersMultiline` {`boolean`} - \n\n * `hasScroller` {`boolean`} - \n\n * `expandable` {`boolean`} - \n\n * `readonly` {`boolean`} - \n\n * `debounce` {`boolean`} - \n\n * `debounceTimeout` {`number`} - \n\n * `aboveCursor` {`boolean`} - \n\n * `tabCompletion` {`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 * `defaultSyntaxHighlightingComp` - \n\n * `themeComp` - \n\n * `isSpacePressed` {`boolean`} - \n\n * `customAutocomplete` - Custom autocomplete handler for code editor suggestions\n\n * `insertBetweenCode` - \n\n * `BUBBLES` {`boolean`} - \n\n * `COMPOSED` {`boolean`} - \n\n * `CANCELABLE` {`boolean`} - ",
821
+ "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 * `enableSearch` {`boolean`} - \n\n * `noborder` {`boolean`} - \n\n * `multiline` {`boolean`} - \n\n * `enableFoldGutters` {`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 * `debounceTimeout` {`number`} - \n\n * `aboveCursor` {`boolean`} - \n\n * `tabCompletion` {`boolean`} - \n\n * `defaultFont` {`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 * `enableSearch` {`boolean`} - \n\n * `noborder` {`boolean`} - \n\n * `multiline` {`boolean`} - \n\n * `enableFoldGutters` {`boolean`} - \n\n * `allowVariableInCustomSuggestion` {`boolean`} - \n\n * `lineNumbers` {`boolean`} - \n\n * `disableSyntaxHighlighting` {`boolean`} - \n\n * `customThemeCSS` {`object | null`} - \n\n * `lineNumbersMultiline` {`boolean`} - \n\n * `hasScroller` {`boolean`} - \n\n * `expandable` {`boolean`} - \n\n * `readonly` {`boolean`} - \n\n * `debounce` {`boolean`} - \n\n * `debounceTimeout` {`number`} - \n\n * `aboveCursor` {`boolean`} - \n\n * `tabCompletion` {`boolean`} - \n\n * `defaultFont` {`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 * `defaultSyntaxHighlightingComp` - \n\n * `themeComp` - \n\n * `autoCompletionComp` - \n\n * `isSpacePressed` {`boolean`} - \n\n * `customAutocomplete` - Custom autocomplete handler for code editor suggestions\n\n * `insertBetweenCode` - \n\n * `BUBBLES` {`boolean`} - \n\n * `COMPOSED` {`boolean`} - \n\n * `CANCELABLE` {`boolean`} - ",
822
822
  "attributes": [
823
823
  {
824
824
  "name": "value",
@@ -936,6 +936,11 @@
936
936
  "description": "`tabCompletion` {`boolean`} - \n\nProperty: tabCompletion\n\nDefault: true",
937
937
  "valueSet": "v"
938
938
  },
939
+ {
940
+ "name": "defaultFont",
941
+ "description": "`defaultFont` {`boolean`} - \n\nProperty: defaultFont\n\nDefault: false",
942
+ "valueSet": "v"
943
+ },
939
944
  {
940
945
  "name": "onnile-focus",
941
946
  "description": "`nile-focus` {`Event`} - "