@aquera/nile-elements 0.0.122 → 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 +6 -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 +4 -0
- package/dist/src/nile-code-editor/nile-code-editor.js +18 -11
- 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 +19 -12
- package/vscode-html-custom-data.json +6 -1
package/package.json
CHANGED
@@ -67,6 +67,8 @@ export class NileCodeEditor extends NileElement {
|
|
67
67
|
|
68
68
|
@property({ type: Boolean, reflect: true , attribute: true }) lineNumbers: boolean = false;
|
69
69
|
|
70
|
+
@property({ type: Boolean, reflect: true , attribute: true }) lineNumbersMultiline: boolean = true;
|
71
|
+
|
70
72
|
@property({ type: Boolean, reflect: true , attribute: true }) hasScroller: boolean = true;
|
71
73
|
|
72
74
|
@property({ type: Boolean, reflect: true , attribute: true }) expandable: boolean = true;
|
@@ -76,6 +78,7 @@ export class NileCodeEditor extends NileElement {
|
|
76
78
|
@property({ type: Boolean, reflect: true , attribute: true}) debounce: boolean = false;
|
77
79
|
|
78
80
|
public view: EditorView;
|
81
|
+
public viewState:EditorState;
|
79
82
|
private timeOut: any = null;
|
80
83
|
|
81
84
|
// Compartments for initialiazing and switching extensions
|
@@ -94,6 +97,7 @@ export class NileCodeEditor extends NileElement {
|
|
94
97
|
|
95
98
|
connectedCallback(): void {
|
96
99
|
super.connectedCallback();
|
100
|
+
this.createState()
|
97
101
|
this.emit('nile-init',undefined,false);
|
98
102
|
}
|
99
103
|
|
@@ -134,7 +138,7 @@ export class NileCodeEditor extends NileElement {
|
|
134
138
|
]
|
135
139
|
})
|
136
140
|
}
|
137
|
-
if (changedProperties.has('lineNumbers')) {
|
141
|
+
if (changedProperties.has('lineNumbers') || changedProperties.has('lineNumbersMultiline')) {
|
138
142
|
this.view.dispatch({
|
139
143
|
effects: [
|
140
144
|
this.lineNumbersComp.reconfigure(this.getLineNumbersExension()),
|
@@ -189,6 +193,15 @@ export class NileCodeEditor extends NileElement {
|
|
189
193
|
|
190
194
|
createNewView(emitEvent=true){
|
191
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(){
|
192
205
|
const lineNumbersExtension = this.lineNumbersComp.of(this.getLineNumbersExension());
|
193
206
|
const readOnlyExtension = this.readOnlyComp.of(this.getReadOnlyExtension());
|
194
207
|
const restrictSingleLineExtension = this.restrictSingleLineComp.of(this.getSingleLineExtension())
|
@@ -196,11 +209,11 @@ export class NileCodeEditor extends NileElement {
|
|
196
209
|
autocomplete: scopeCompletionSource(this.customAutoCompletions),
|
197
210
|
}));
|
198
211
|
const language = this.getLanguageExtension()
|
199
|
-
|
212
|
+
this.viewState = EditorState.create({
|
200
213
|
doc: !this.multiline ? this.convertToSingleLine(this.value) : this.value,
|
201
214
|
extensions: [
|
202
215
|
basicSetup({
|
203
|
-
lineNumbers: this.lineNumbers || this.multiline,
|
216
|
+
lineNumbers: (!this.multiline && this.lineNumbers) || (this.multiline && this.lineNumbersMultiline),
|
204
217
|
highlightActiveLine: false,
|
205
218
|
foldGutter: false,
|
206
219
|
}),
|
@@ -222,13 +235,7 @@ export class NileCodeEditor extends NileElement {
|
|
222
235
|
}),
|
223
236
|
],
|
224
237
|
});
|
225
|
-
|
226
|
-
this.view = new EditorView({
|
227
|
-
state: startState,
|
228
|
-
parent: this.codeEditor
|
229
|
-
});
|
230
|
-
|
231
|
-
if(emitEvent) this.emit('nile-after-update',{ createNewView: this.createNewView, codeMirrorInstance: this.view, }, false );
|
238
|
+
return this.viewState
|
232
239
|
}
|
233
240
|
|
234
241
|
singleLineMultiLineToggle() {
|
@@ -264,7 +271,8 @@ export class NileCodeEditor extends NileElement {
|
|
264
271
|
|
265
272
|
//EXTENSION CONFIGURATIONS
|
266
273
|
getLineNumbersExension() {
|
267
|
-
|
274
|
+
|
275
|
+
return (!this.multiline && this.lineNumbers) || (this.multiline && this.lineNumbersMultiline) ? lineNumbers() : [];
|
268
276
|
}
|
269
277
|
|
270
278
|
getLanguageExtension(){
|
@@ -296,7 +304,6 @@ export class NileCodeEditor extends NileElement {
|
|
296
304
|
|
297
305
|
emitNileExpand() {
|
298
306
|
this.emit('nile-expand', { expand: true },false);
|
299
|
-
this.createNewView()
|
300
307
|
}
|
301
308
|
|
302
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 * `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 * `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",
|
@@ -775,6 +775,11 @@
|
|
775
775
|
"description": "`lineNumbers` {`boolean`} - \n\nProperty: lineNumbers\n\nDefault: false",
|
776
776
|
"valueSet": "v"
|
777
777
|
},
|
778
|
+
{
|
779
|
+
"name": "lineNumbersMultiline",
|
780
|
+
"description": "`lineNumbersMultiline` {`boolean`} - \n\nProperty: lineNumbersMultiline\n\nDefault: true",
|
781
|
+
"valueSet": "v"
|
782
|
+
},
|
778
783
|
{
|
779
784
|
"name": "hasScroller",
|
780
785
|
"description": "`hasScroller` {`boolean`} - \n\nProperty: hasScroller\n\nDefault: true",
|