@aquera/nile-elements 0.1.52-beta-1.6 → 0.1.52

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 CHANGED
@@ -79,8 +79,8 @@ To run a local development server that serves the basic demo located in `demo/in
79
79
 
80
80
  In this section, you can find the updates for each release of `nile-elements`. It's a good practice to maintain detailed release notes to help users and developers understand what changes have been made from one version to another and how these changes might affect their projects.
81
81
 
82
- #### Version 0.1.52-beta-1.5
83
- - Code Editor: New code editor features
82
+ #### Version 0.1.52
83
+ - Code Editor: New code editor features for [UIF-887]
84
84
 
85
85
  #### Version 0.1.51
86
86
  - Icon Addition: column-add icon is added [UIF-874]
package/dist/index.js CHANGED
@@ -6931,7 +6931,7 @@ class tN{constructor(M){this._element=null;const e=M??window;this._node=e,M&&(th
6931
6931
  <nile-form-error-message
6932
6932
  >${this.errorMessage}</nile-form-error-message
6933
6933
  >
6934
- `:""}`}createNewView(M=!0){this.view&&this.view.destroy(),this.createState(),this.view=new su({state:this.viewState,parent:this.codeEditor}),M&&this.emit("nile-after-update",{createNewView:this.createNewView,codeMirrorInstance:this.view},!1)}createState(){const M=this.lineNumbersComp.of(this.getLineNumbersExension()),e=this.readOnlyComp.of(this.getReadOnlyExtension()),t=this.restrictSingleLineComp.of(this.getSingleLineExtension()),i=this.placeholderComp.of(this.getPlaceholderExtension()),N=this.themeComp.of(this.getCustomThemeExtension()),o=this.defaultSyntaxHighlightingComp.of(this.getDefaultSyntaxHighlightingExtension()),s=this.getLanguageExtension(),n=this.customCompletionComp.of(gA.data.of({autocomplete:this.customAutocomplete}));return this.viewState=ws.create({doc:this.multiline?this.value:iL(this.value),extensions:[Kh({highlightActiveLine:!1,foldGutter:this.enableFoldGutters,enableSearch:this.enableSearch}),M,e,t,n,i,o,GO({aboveCursor:this.aboveCursor}),s,N,this.getTabCompletionKeymap(),su.updateListener.of((M=>{M.docChanged&&(this.debounce?this.emitAfterTimeout({value:this.view.state.doc.toString()}):this.emit("nile-change",{value:this.view.state.doc.toString()}))})),su.domEventHandlers({focus:()=>this.dispatchEvent(new Event("nile-focus")),blur:()=>this.dispatchEvent(new Event("nile-blur"))})]}),this.viewState}getNestedSuggestions(M,e,t){if(!function(M){return/^([a-zA-Z_$][\w$]*)(\.[a-zA-Z_$][\w$]*|\[\s*(['"]?[a-zA-Z0-9_$]*['"]?)\s*\])*([\.\[])?$/.test(M)}(e)||![".","["].includes(e.at(-1)))return null;const i=function(M){const e=/([a-zA-Z_$][\w$]*)(\[(?:[^\]]+)\]|\.[a-zA-Z_$][\w$]*)*/g,t=[...M.matchAll(e)];if(t.length>0){const e=[t[0][1]],i=M.match(/\[(.*?)\]|\.(\w+)/g)||[];for(const M of i)M.startsWith("[")?e.push(M.slice(1,-1).replace(/['"]/g,"")):M.startsWith(".")&&e.push(M.slice(1));return e}return null}(e);if(!i)return null;const N=t.replace(/["'\[]/g,""),o=N!==t,s="["===e.at(-1);if("."===e.at(-1)&&o)return null;let n=function(M,e){return e.reduce(((M,e)=>M&&"object"==typeof M?M[e]:null),M)}(this.customAutoCompletions,i);return n&&"object"==typeof n?(N&&(n=Object.fromEntries(Object.entries(n).filter((([M])=>M.toLowerCase().startsWith(N.toLowerCase()))))),{from:M.pos-N.length,options:Object.keys(n).map((M=>({label:M,type:"property",info:`Key of ${i[i.length-1]}`,apply:this.allowVariableInCustomSuggestion||!s||o?M:`'${M}'`,boost:999})))}):null}getTopLevelSuggestions(M,e){const t=e.match(/([a-zA-Z_$][\w$]*)$/);if(!t){if(""===e.trim()){const e=Object.keys(this.customAutoCompletions).filter((M=>Object.keys(this.customAutoCompletions[M]).length)).map((M=>({label:M,type:"property",apply:M,boost:999})));return this.customCompletionsPaths.length&&this.customCompletionsPaths.forEach((M=>{e.push({label:""+M,type:"property",apply:""+M,boost:998})})),{from:M.pos,options:e}}return null}const i=Object.keys(this.customAutoCompletions).filter((M=>Object.keys(this.customAutoCompletions[M]).length&&M.toLowerCase().startsWith(e.toLowerCase()))).map((M=>({label:M,type:"property",apply:M,boost:999})));return this.customCompletionsPaths.length&&this.customCompletionsPaths.filter((M=>M.toLocaleLowerCase().includes(e.toLocaleLowerCase()))).forEach((M=>{i.push({label:""+M,type:"property",apply:""+M,boost:998})})),{from:M.pos-t[1].length,options:i}}emitAfterTimeout(M){this.timeOut&&clearTimeout(this.timeOut),this.timeOut=setTimeout((()=>this.emit("nile-change",M,!1)),this.debounceTimeout)}focusAtPosition(M=this.view.state.doc.toString().length){this.view&&(this.view.dispatch({selection:{anchor:M}}),this.view.focus())}singleLineMultiLineToggle(){this.view.dispatch({changes:{from:0,to:this.view.state.doc.length,insert:this.multiline?this.value:iL(this.value)}})}getLineNumbersExension(){return!this.multiline&&this.lineNumbers||this.multiline&&this.lineNumbersMultiline?function(M={}){return[Pl.of(M),Ul(),Bl]}():[]}getLanguageExtension(){switch(this.language){case"sql":return function(M={}){let e=M.dialect||ed;return new kj(e.language,[Md(M),qA(e,!!M.upperCaseKeywords)])}();case"json":return new kj(Nd);case"html":return function(M={}){let e,t="";!1===M.matchClosingTags&&(t="noMatch"),!0===M.selfClosingTags&&(t=(t?t+" ":"")+"selfClosing"),(M.nestedLanguages&&M.nestedLanguages.length||M.nestedAttributes&&M.nestedAttributes.length)&&(e=kd((M.nestedLanguages||[]).concat(_h),(M.nestedAttributes||[]).concat(Fh)));let i=e?Jh.configure({wrap:e,dialect:t}):t?Xh.configure({dialect:t}):Xh;return new kj(i,[Xh.data.of({autocomplete:Gh(M)}),!1!==M.autoCloseTags?Hh:[],dh().support,new kj(th,th.data.of({autocomplete:eh})).support])}();default:return function(M={}){let e=M.jsx?M.typescript?IA:zA:M.typescript?cA:gA,t=M.typescript?iA.concat(yA):tA.concat(OA);return new kj(e,[gA.data.of({autocomplete:LT(uA,hT(t))}),gA.data.of({autocomplete:lA}),M.jsx?hA:[]])}()}}getReadOnlyExtension(){return this.readonly?ws.readOnly.of(!0):[]}getSingleLineExtension(){return this.multiline?[]:ws.transactionFilter.of((M=>M.newDoc.lines>1?[]:M))}getPlaceholderExtension(){return this.placeholder?function(M){return nr.fromClass(class{constructor(e){this.view=e,this.placeholder=M?uD.set([uD.widget({widget:new $u(M),side:1}).range(0)]):uD.none}get decorations(){return this.view.state.doc.length?uD.none:this.placeholder}},{decorations:M=>M.decorations})}(this.placeholder):[]}getDefaultSyntaxHighlightingExtension(){return this.disableSyntaxHighlighting?[]:function(M,e){let t,i=[dc];return M instanceof Ic&&(M.module&&i.push(su.styleModule.of(M.module)),t=M.themeType),(null==e?void 0:e.fallback)?i.push(Oc.of(M)):t?i.push(Tc.computeN([su.darkTheme],(e=>e.facet(su.darkTheme)==("dark"==t)?[M]:[]))):i.push(Tc.of(M)),i}(hc,{fallback:!0})}getCustomThemeExtension(){return this.customThemeCSS?su.theme(this.customThemeCSS):su.theme(ML)}restrictSingleLine(){return ws.transactionFilter.of((M=>M.newDoc.lines>1?[]:M))}};function iL(M){return M?M.replace(/\s+/g," ").trim():""}M([zM(".code__editor__container")],tL.prototype,"codeEditor",void 0),M([gM({type:String,reflect:!0,attribute:!0})],tL.prototype,"value",void 0),M([gM({type:String,reflect:!0,attribute:!0})],tL.prototype,"expandIcon",void 0),M([gM({type:String,reflect:!0,attribute:!0})],tL.prototype,"placeholder",void 0),M([gM({type:Object,reflect:!0,attribute:!0})],tL.prototype,"customAutoCompletions",void 0),M([gM({type:Array,reflect:!0,attribute:!0})],tL.prototype,"customCompletionsPaths",void 0),M([gM({type:String,reflect:!0,attribute:!0})],tL.prototype,"language",void 0),M([gM({type:String,reflect:!0,attribute:"error-message"})],tL.prototype,"errorMessage",void 0),M([gM({type:Boolean,reflect:!0,attribute:!0})],tL.prototype,"error",void 0),M([gM({type:Boolean,reflect:!0,attribute:!0})],tL.prototype,"enableSearch",void 0),M([gM({type:Boolean,reflect:!0,attribute:!0})],tL.prototype,"noborder",void 0),M([gM({type:Boolean,reflect:!0,attribute:!0})],tL.prototype,"multiline",void 0),M([gM({type:Boolean,reflect:!0,attribute:!0})],tL.prototype,"enableFoldGutters",void 0),M([gM({type:Boolean,reflect:!0,attribute:!0})],tL.prototype,"allowVariableInCustomSuggestion",void 0),M([gM({type:Boolean,reflect:!0,attribute:!0})],tL.prototype,"lineNumbers",void 0),M([gM({type:Boolean,reflect:!0,attribute:!1})],tL.prototype,"disableSyntaxHighlighting",void 0),M([gM({type:Object,attribute:!1})],tL.prototype,"customThemeCSS",void 0),M([gM({type:Boolean,reflect:!0,attribute:!0})],tL.prototype,"lineNumbersMultiline",void 0),M([gM({type:Boolean,reflect:!0,attribute:!0})],tL.prototype,"hasScroller",void 0),M([gM({type:Boolean,reflect:!0,attribute:!0})],tL.prototype,"expandable",void 0),M([gM({type:Boolean,reflect:!0,attribute:!0})],tL.prototype,"readonly",void 0),M([gM({type:Boolean,reflect:!0,attribute:!0})],tL.prototype,"debounce",void 0),M([gM({type:Number,reflect:!0,attribute:!0})],tL.prototype,"debounceTimeout",void 0),M([gM({type:Boolean,reflect:!0,attribute:!0})],tL.prototype,"aboveCursor",void 0),M([gM({type:Boolean,reflect:!0,attribute:!0})],tL.prototype,"tabCompletion",void 0),tL=M([aM("nile-code-editor")],tL);const NL=s`
6934
+ `:""}`}createNewView(M=!0){this.view&&this.view.destroy(),this.createState(),this.view=new su({state:this.viewState,parent:this.codeEditor}),M&&this.emit("nile-after-update",{createNewView:this.createNewView,codeMirrorInstance:this.view},!1)}createState(){const M=this.lineNumbersComp.of(this.getLineNumbersExension()),e=this.readOnlyComp.of(this.getReadOnlyExtension()),t=this.restrictSingleLineComp.of(this.getSingleLineExtension()),i=this.placeholderComp.of(this.getPlaceholderExtension()),N=this.themeComp.of(this.getCustomThemeExtension()),o=this.defaultSyntaxHighlightingComp.of(this.getDefaultSyntaxHighlightingExtension()),s=this.getLanguageExtension(),n=this.customCompletionComp.of(gA.data.of({autocomplete:this.customAutocomplete}));return this.viewState=ws.create({doc:this.multiline?this.value:iL(this.value),extensions:[Kh({highlightActiveLine:!1,foldGutter:this.enableFoldGutters,enableSearch:this.enableSearch}),M,e,t,n,i,o,GO({aboveCursor:this.aboveCursor}),s,N,this.getTabCompletionKeymap(),su.updateListener.of((M=>{M.docChanged&&(this.debounce?this.emitAfterTimeout({value:this.view.state.doc.toString()}):this.emit("nile-change",{value:this.view.state.doc.toString()}))})),su.domEventHandlers({focus:()=>this.dispatchEvent(new Event("nile-focus")),blur:()=>this.dispatchEvent(new Event("nile-blur"))})]}),this.viewState}getNestedSuggestions(M,e,t){if(!function(M){return/^([a-zA-Z_$][\w$]*)(\.[a-zA-Z_$][\w$]*|\[\s*(['"]?[a-zA-Z0-9_$]*['"]?)\s*\])*([\.\[])?$/.test(M)}(e)||![".","["].includes(e.at(-1)))return null;const i=function(M){const e=/([a-zA-Z_$][\w$]*)(\[(?:[^\]]+)\]|\.[a-zA-Z_$][\w$]*)*/g,t=[...M.matchAll(e)];if(t.length>0){const e=[t[0][1]],i=M.match(/\[(.*?)\]|\.(\w+)/g)||[];for(const M of i)M.startsWith("[")?e.push(M.slice(1,-1).replace(/['"]/g,"")):M.startsWith(".")&&e.push(M.slice(1));return e}return null}(e);if(!i)return null;const N=t.replace(/["'\[]/g,""),o=N!==t,s="["===e.at(-1);if("."===e.at(-1)&&o)return null;let n=function(M,e){return e.reduce(((M,e)=>M&&"object"==typeof M?M[e]:null),M)}(this.customAutoCompletions,i);return n&&"object"==typeof n?(N&&(n=Object.fromEntries(Object.entries(n).filter((([M])=>M.toLowerCase().startsWith(N.toLowerCase()))))),{from:M.pos-N.length,options:Object.keys(n).map((M=>({label:M,type:"property",info:`Key of ${i[i.length-1]}`,apply:this.allowVariableInCustomSuggestion||!s||o?M:`'${M}'`,boost:999})))}):null}getTopLevelSuggestions(M,e){const t=e.match(/([a-zA-Z_$][\w$]*)$/);if(!t){if(""===e.trim()){const e=Object.keys(this.customAutoCompletions).filter((M=>Object.keys(this.customAutoCompletions[M]).length)).map((M=>({label:M,type:"property",apply:M,boost:999})));return this.customCompletionsPaths.length&&this.customCompletionsPaths.forEach((M=>{e.push({label:""+M,type:"property",apply:""+M,boost:998})})),{from:M.pos,options:e}}return null}const i=Object.keys(this.customAutoCompletions).filter((M=>Object.keys(this.customAutoCompletions[M]).length&&M.toLowerCase().startsWith(e.toLowerCase()))).map((M=>({label:M,type:"property",apply:M,boost:999})));return this.customCompletionsPaths.length&&this.customCompletionsPaths.filter((M=>M.toLocaleLowerCase().includes(e.toLocaleLowerCase()))).forEach((M=>{i.push({label:""+M,type:"property",apply:""+M,boost:998})})),{from:M.pos-t[1].length,options:i}}emitAfterTimeout(M){this.timeOut&&clearTimeout(this.timeOut),this.timeOut=setTimeout((()=>this.emit("nile-change",M,!1)),this.debounceTimeout)}focusAtPosition(M=this.view.state.doc.toString().length){this.view&&(this.view.dispatch({selection:{anchor:M}}),this.view.focus())}singleLineMultiLineToggle(){this.view.dispatch({changes:{from:0,to:this.view.state.doc.length,insert:this.multiline?this.value:iL(this.value)}})}getLineNumbersExension(){return!this.multiline&&this.lineNumbers||this.multiline&&this.lineNumbersMultiline?function(M={}){return[Pl.of(M),Ul(),Bl]}():[]}getLanguageExtension(){switch(this.language){case"sql":return function(M={}){let e=M.dialect||ed;return new kj(e.language,[Md(M),qA(e,!!M.upperCaseKeywords)])}();case"json":return new kj(Nd);case"html":return function(M={}){let e,t="";!1===M.matchClosingTags&&(t="noMatch"),!0===M.selfClosingTags&&(t=(t?t+" ":"")+"selfClosing"),(M.nestedLanguages&&M.nestedLanguages.length||M.nestedAttributes&&M.nestedAttributes.length)&&(e=kd((M.nestedLanguages||[]).concat(_h),(M.nestedAttributes||[]).concat(Fh)));let i=e?Jh.configure({wrap:e,dialect:t}):t?Xh.configure({dialect:t}):Xh;return new kj(i,[Xh.data.of({autocomplete:Gh(M)}),!1!==M.autoCloseTags?Hh:[],dh().support,new kj(th,th.data.of({autocomplete:eh})).support])}();default:return function(M={}){let e=M.jsx?M.typescript?IA:zA:M.typescript?cA:gA,t=M.typescript?iA.concat(yA):tA.concat(OA);return new kj(e,[gA.data.of({autocomplete:LT(uA,hT(t))}),gA.data.of({autocomplete:lA}),M.jsx?hA:[]])}()}}getReadOnlyExtension(){return this.readonly?ws.readOnly.of(!0):[]}getSingleLineExtension(){return this.multiline?[]:ws.transactionFilter.of((M=>M.newDoc.lines>1?[]:M))}getPlaceholderExtension(){return this.placeholder?function(M){return nr.fromClass(class{constructor(e){this.view=e,this.placeholder=M?uD.set([uD.widget({widget:new $u(M),side:1}).range(0)]):uD.none}get decorations(){return this.view.state.doc.length?uD.none:this.placeholder}},{decorations:M=>M.decorations})}(this.placeholder):[]}getDefaultSyntaxHighlightingExtension(){return this.disableSyntaxHighlighting?[]:function(M,e){let t,i=[dc];return M instanceof Ic&&(M.module&&i.push(su.styleModule.of(M.module)),t=M.themeType),(null==e?void 0:e.fallback)?i.push(Oc.of(M)):t?i.push(Tc.computeN([su.darkTheme],(e=>e.facet(su.darkTheme)==("dark"==t)?[M]:[]))):i.push(Tc.of(M)),i}(hc,{fallback:!0})}getCustomThemeExtension(){return this.customThemeCSS?[su.theme(this.customThemeCSS),su.theme(eL)]:[su.theme(eL),su.theme(ML)]}restrictSingleLine(){return ws.transactionFilter.of((M=>M.newDoc.lines>1?[]:M))}};function iL(M){return M?M.replace(/\s+/g," ").trim():""}M([zM(".code__editor__container")],tL.prototype,"codeEditor",void 0),M([gM({type:String,reflect:!0,attribute:!0})],tL.prototype,"value",void 0),M([gM({type:String,reflect:!0,attribute:!0})],tL.prototype,"expandIcon",void 0),M([gM({type:String,reflect:!0,attribute:!0})],tL.prototype,"placeholder",void 0),M([gM({type:Object,reflect:!0,attribute:!0})],tL.prototype,"customAutoCompletions",void 0),M([gM({type:Array,reflect:!0,attribute:!0})],tL.prototype,"customCompletionsPaths",void 0),M([gM({type:String,reflect:!0,attribute:!0})],tL.prototype,"language",void 0),M([gM({type:String,reflect:!0,attribute:"error-message"})],tL.prototype,"errorMessage",void 0),M([gM({type:Boolean,reflect:!0,attribute:!0})],tL.prototype,"error",void 0),M([gM({type:Boolean,reflect:!0,attribute:!0})],tL.prototype,"enableSearch",void 0),M([gM({type:Boolean,reflect:!0,attribute:!0})],tL.prototype,"noborder",void 0),M([gM({type:Boolean,reflect:!0,attribute:!0})],tL.prototype,"multiline",void 0),M([gM({type:Boolean,reflect:!0,attribute:!0})],tL.prototype,"enableFoldGutters",void 0),M([gM({type:Boolean,reflect:!0,attribute:!0})],tL.prototype,"allowVariableInCustomSuggestion",void 0),M([gM({type:Boolean,reflect:!0,attribute:!0})],tL.prototype,"lineNumbers",void 0),M([gM({type:Boolean,reflect:!0,attribute:!1})],tL.prototype,"disableSyntaxHighlighting",void 0),M([gM({type:Object,attribute:!1})],tL.prototype,"customThemeCSS",void 0),M([gM({type:Boolean,reflect:!0,attribute:!0})],tL.prototype,"lineNumbersMultiline",void 0),M([gM({type:Boolean,reflect:!0,attribute:!0})],tL.prototype,"hasScroller",void 0),M([gM({type:Boolean,reflect:!0,attribute:!0})],tL.prototype,"expandable",void 0),M([gM({type:Boolean,reflect:!0,attribute:!0})],tL.prototype,"readonly",void 0),M([gM({type:Boolean,reflect:!0,attribute:!0})],tL.prototype,"debounce",void 0),M([gM({type:Number,reflect:!0,attribute:!0})],tL.prototype,"debounceTimeout",void 0),M([gM({type:Boolean,reflect:!0,attribute:!0})],tL.prototype,"aboveCursor",void 0),M([gM({type:Boolean,reflect:!0,attribute:!0})],tL.prototype,"tabCompletion",void 0),tL=M([aM("nile-code-editor")],tL);const NL=s`
6935
6935
  :host {
6936
6936
  display: contents;
6937
6937