@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/README.md +9 -0
- package/dist/index.js +2 -2
- package/dist/nile-code-editor/extensionSetup.cjs.js +3 -3
- 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 +2 -2
- package/dist/nile-code-editor/theme.cjs.js +1 -1
- package/dist/nile-code-editor/theme.cjs.js.map +1 -1
- package/dist/nile-code-editor/theme.esm.js +1 -1
- package/dist/src/nile-code-editor/nile-code-editor.d.ts +2 -0
- package/dist/src/nile-code-editor/nile-code-editor.js +22 -5
- package/dist/src/nile-code-editor/nile-code-editor.js.map +1 -1
- package/dist/src/nile-code-editor/theme.d.ts +9 -0
- package/dist/src/nile-code-editor/theme.js +9 -0
- package/dist/src/nile-code-editor/theme.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/nile-code-editor/nile-code-editor.ts +25 -6
- package/src/nile-code-editor/theme.ts +11 -1
- package/vscode-html-custom-data.json +6 -1
package/package.json
CHANGED
@@ -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
|
-
|
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
|
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
|
-
|
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`} - "
|