@aquera/nile-elements 0.0.123 → 0.0.124
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 +3 -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/src/nile-code-editor/nile-code-editor.d.ts +3 -0
- package/dist/src/nile-code-editor/nile-code-editor.js +11 -8
- package/dist/src/nile-code-editor/nile-code-editor.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/nile-code-editor/nile-code-editor.ts +13 -9
- package/vscode-html-custom-data.json +1 -1
package/package.json
CHANGED
@@ -78,6 +78,7 @@ export class NileCodeEditor extends NileElement {
|
|
78
78
|
@property({ type: Boolean, reflect: true , attribute: true}) debounce: boolean = false;
|
79
79
|
|
80
80
|
public view: EditorView;
|
81
|
+
public viewState:EditorState;
|
81
82
|
private timeOut: any = null;
|
82
83
|
|
83
84
|
// Compartments for initialiazing and switching extensions
|
@@ -96,6 +97,7 @@ export class NileCodeEditor extends NileElement {
|
|
96
97
|
|
97
98
|
connectedCallback(): void {
|
98
99
|
super.connectedCallback();
|
100
|
+
this.createState()
|
99
101
|
this.emit('nile-init',undefined,false);
|
100
102
|
}
|
101
103
|
|
@@ -191,6 +193,15 @@ export class NileCodeEditor extends NileElement {
|
|
191
193
|
|
192
194
|
createNewView(emitEvent=true){
|
193
195
|
if(this.view) this.view.destroy();
|
196
|
+
this.view = new EditorView({
|
197
|
+
state: this.viewState,
|
198
|
+
parent: this.codeEditor
|
199
|
+
});
|
200
|
+
|
201
|
+
if(emitEvent) this.emit('nile-after-update',{ createNewView: this.createNewView, codeMirrorInstance: this.view, }, false );
|
202
|
+
}
|
203
|
+
|
204
|
+
createState(){
|
194
205
|
const lineNumbersExtension = this.lineNumbersComp.of(this.getLineNumbersExension());
|
195
206
|
const readOnlyExtension = this.readOnlyComp.of(this.getReadOnlyExtension());
|
196
207
|
const restrictSingleLineExtension = this.restrictSingleLineComp.of(this.getSingleLineExtension())
|
@@ -198,7 +209,7 @@ export class NileCodeEditor extends NileElement {
|
|
198
209
|
autocomplete: scopeCompletionSource(this.customAutoCompletions),
|
199
210
|
}));
|
200
211
|
const language = this.getLanguageExtension()
|
201
|
-
|
212
|
+
this.viewState = EditorState.create({
|
202
213
|
doc: !this.multiline ? this.convertToSingleLine(this.value) : this.value,
|
203
214
|
extensions: [
|
204
215
|
basicSetup({
|
@@ -224,13 +235,7 @@ export class NileCodeEditor extends NileElement {
|
|
224
235
|
}),
|
225
236
|
],
|
226
237
|
});
|
227
|
-
|
228
|
-
this.view = new EditorView({
|
229
|
-
state: startState,
|
230
|
-
parent: this.codeEditor
|
231
|
-
});
|
232
|
-
|
233
|
-
if(emitEvent) this.emit('nile-after-update',{ createNewView: this.createNewView, codeMirrorInstance: this.view, }, false );
|
238
|
+
return this.viewState
|
234
239
|
}
|
235
240
|
|
236
241
|
singleLineMultiLineToggle() {
|
@@ -299,7 +304,6 @@ export class NileCodeEditor extends NileElement {
|
|
299
304
|
|
300
305
|
emitNileExpand() {
|
301
306
|
this.emit('nile-expand', { expand: true },false);
|
302
|
-
this.createNewView()
|
303
307
|
}
|
304
308
|
|
305
309
|
/* #endregion */
|
@@ -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 * `customAutoCompletions` {`object`} - \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 * `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` {`object`} - \n\n * `language` {`\"javascript\" | \"sql\" | \"json\"`} - \n\n * `errorMessage` {`string`} - \n\n * `error` {`boolean`} - \n\n * `noborder` {`boolean`} - \n\n * `multiline` {`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 * `timeOut` - \n\n * `lineNumbersComp` - \n\n * `restrictSingleLineComp` - \n\n * `readOnlyComp` - \n\n * `customCompletionComp` - \n\n * `insertBetweenCode` - \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 * `customAutoCompletions` {`object`} - \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 * `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` {`object`} - \n\n * `language` {`\"javascript\" | \"sql\" | \"json\"`} - \n\n * `errorMessage` {`string`} - \n\n * `error` {`boolean`} - \n\n * `noborder` {`boolean`} - \n\n * `multiline` {`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 * `BUBBLES` {`boolean`} - \n\n * `COMPOSED` {`boolean`} - \n\n * `CANCELABLE` {`boolean`} - ",
|
730
730
|
"attributes": [
|
731
731
|
{
|
732
732
|
"name": "value",
|