@aquera/nile-elements 0.0.130 → 0.0.131

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.
Files changed (23) hide show
  1. package/README.md +4 -0
  2. package/dist/nile-code-editor/nile-code-editor.cjs.js +1 -1
  3. package/dist/nile-code-editor/nile-code-editor.cjs.js.map +1 -1
  4. package/dist/nile-code-editor/nile-code-editor.esm.js +2 -2
  5. package/dist/nile-error-notification/nile-error-notification.cjs.js +1 -1
  6. package/dist/nile-error-notification/nile-error-notification.cjs.js.map +1 -1
  7. package/dist/nile-error-notification/nile-error-notification.css.cjs.js +1 -1
  8. package/dist/nile-error-notification/nile-error-notification.css.cjs.js.map +1 -1
  9. package/dist/nile-error-notification/nile-error-notification.css.esm.js +5 -4
  10. package/dist/nile-error-notification/nile-error-notification.esm.js +3 -3
  11. package/dist/src/nile-code-editor/nile-code-editor.js +9 -7
  12. package/dist/src/nile-code-editor/nile-code-editor.js.map +1 -1
  13. package/dist/src/nile-error-notification/nile-error-notification.css.js +4 -3
  14. package/dist/src/nile-error-notification/nile-error-notification.css.js.map +1 -1
  15. package/dist/src/nile-error-notification/nile-error-notification.d.ts +2 -0
  16. package/dist/src/nile-error-notification/nile-error-notification.js +11 -1
  17. package/dist/src/nile-error-notification/nile-error-notification.js.map +1 -1
  18. package/dist/tsconfig.tsbuildinfo +1 -1
  19. package/package.json +1 -1
  20. package/src/nile-code-editor/nile-code-editor.ts +11 -8
  21. package/src/nile-error-notification/nile-error-notification.css.ts +4 -3
  22. package/src/nile-error-notification/nile-error-notification.ts +11 -3
  23. package/vscode-html-custom-data.json +5 -1
@@ -1,2 +1,2 @@
1
- function _typeof(o){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(o){return typeof o;}:function(o){return o&&"function"==typeof Symbol&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o;},_typeof(o);}System.register(["tslib","../index-c7ad3b47.cjs.js","lit/decorators.js","./nile-error-notification.css.cjs.js","../property-217fe924.cjs.js"],function(_export,_context){"use strict";var r,i,o,t,e,s,_templateObject,n;function _taggedTemplateLiteral(strings,raw){if(!raw){raw=strings.slice(0);}return Object.freeze(Object.defineProperties(strings,{raw:{value:Object.freeze(raw)}}));}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,_toPropertyKey(descriptor.key),descriptor);}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);Object.defineProperty(Constructor,"prototype",{writable:false});return Constructor;}function _toPropertyKey(t){var i=_toPrimitive(t,"string");return"symbol"==_typeof(i)?i:i+"";}function _toPrimitive(t,r){if("object"!=_typeof(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,r||"default");if("object"!=_typeof(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.");}return("string"===r?String:Number)(t);}function _callSuper(t,o,e){return o=_getPrototypeOf(o),_possibleConstructorReturn(t,_isNativeReflectConstruct()?Reflect.construct(o,e||[],_getPrototypeOf(t).constructor):o.apply(t,e));}function _possibleConstructorReturn(self,call){if(call&&(_typeof(call)==="object"||typeof call==="function")){return call;}else if(call!==void 0){throw new TypeError("Derived constructors may only return object or undefined");}return _assertThisInitialized(self);}function _assertThisInitialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return self;}function _isNativeReflectConstruct(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));}catch(t){}return(_isNativeReflectConstruct=function _isNativeReflectConstruct(){return!!t;})();}function _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o);};return _getPrototypeOf(o);}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function");}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}});Object.defineProperty(subClass,"prototype",{writable:false});if(superClass)_setPrototypeOf(subClass,superClass);}function _setPrototypeOf(o,p){_setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function _setPrototypeOf(o,p){o.__proto__=p;return o;};return _setPrototypeOf(o,p);}return{setters:[function(_tslib){r=_tslib.__decorate;},function(_index001CjsJs){i=_index001CjsJs.s;o=_index001CjsJs.x;},function(_litDecoratorsJs){t=_litDecoratorsJs.customElement;},function(_nileErrorNotificationCssCjsJs){e=_nileErrorNotificationCssCjsJs.s;},function(_property002CjsJs){s=_property002CjsJs.n;}],execute:function execute(){_export("N",n=/*#__PURE__*/function(_i){function n(){var _this;_classCallCheck(this,n);_this=_callSuper(this,n,arguments),_this.errorMessage="";return _this;}_inherits(n,_i);return _createClass(n,[{key:"render",value:function render(){return o(_templateObject||(_templateObject=_taggedTemplateLiteral(["\n <div class=\"nile-error-notification\">\n <nile-icon\n name=\"info2\"\n size=\"14\"\n class=\"nile-error-notification__icon\"\n part=\"icon\"\n color=\"#E5434D\"\n ></nile-icon>\n ","\n </div>\n "])),this.errorMessage);}}],[{key:"styles",get:function get(){return[e];}}]);}(i));r([s({type:String,reflect:!0})],n.prototype,"errorMessage",void 0),_export("N",n=r([t("nile-error-notification")],n));}};});
1
+ function _typeof(o){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(o){return typeof o;}:function(o){return o&&"function"==typeof Symbol&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o;},_typeof(o);}System.register(["tslib","../index-c7ad3b47.cjs.js","lit/decorators.js","./nile-error-notification.css.cjs.js","../property-217fe924.cjs.js"],function(_export,_context){"use strict";var i,r,o,t,e,s,_templateObject,n;function _taggedTemplateLiteral(strings,raw){if(!raw){raw=strings.slice(0);}return Object.freeze(Object.defineProperties(strings,{raw:{value:Object.freeze(raw)}}));}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,_toPropertyKey(descriptor.key),descriptor);}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);Object.defineProperty(Constructor,"prototype",{writable:false});return Constructor;}function _toPropertyKey(t){var i=_toPrimitive(t,"string");return"symbol"==_typeof(i)?i:i+"";}function _toPrimitive(t,r){if("object"!=_typeof(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,r||"default");if("object"!=_typeof(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.");}return("string"===r?String:Number)(t);}function _callSuper(t,o,e){return o=_getPrototypeOf(o),_possibleConstructorReturn(t,_isNativeReflectConstruct()?Reflect.construct(o,e||[],_getPrototypeOf(t).constructor):o.apply(t,e));}function _possibleConstructorReturn(self,call){if(call&&(_typeof(call)==="object"||typeof call==="function")){return call;}else if(call!==void 0){throw new TypeError("Derived constructors may only return object or undefined");}return _assertThisInitialized(self);}function _assertThisInitialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return self;}function _isNativeReflectConstruct(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));}catch(t){}return(_isNativeReflectConstruct=function _isNativeReflectConstruct(){return!!t;})();}function _get(){if(typeof Reflect!=="undefined"&&Reflect.get){_get=Reflect.get.bind();}else{_get=function _get(target,property,receiver){var base=_superPropBase(target,property);if(!base)return;var desc=Object.getOwnPropertyDescriptor(base,property);if(desc.get){return desc.get.call(arguments.length<3?target:receiver);}return desc.value;};}return _get.apply(this,arguments);}function _superPropBase(object,property){while(!Object.prototype.hasOwnProperty.call(object,property)){object=_getPrototypeOf(object);if(object===null)break;}return object;}function _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o);};return _getPrototypeOf(o);}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function");}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}});Object.defineProperty(subClass,"prototype",{writable:false});if(superClass)_setPrototypeOf(subClass,superClass);}function _setPrototypeOf(o,p){_setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function _setPrototypeOf(o,p){o.__proto__=p;return o;};return _setPrototypeOf(o,p);}return{setters:[function(_tslib){i=_tslib.__decorate;},function(_index001CjsJs){r=_index001CjsJs.s;o=_index001CjsJs.x;},function(_litDecoratorsJs){t=_litDecoratorsJs.customElement;},function(_nileErrorNotificationCssCjsJs){e=_nileErrorNotificationCssCjsJs.s;},function(_property002CjsJs){s=_property002CjsJs.n;}],execute:function execute(){_export("N",n=/*#__PURE__*/function(_r){function n(){var _this;_classCallCheck(this,n);_this=_callSuper(this,n,arguments),_this.errorMessage="",_this.color="";return _this;}_inherits(n,_r);return _createClass(n,[{key:"connectedCallback",value:function connectedCallback(){_get(_getPrototypeOf(n.prototype),"connectedCallback",this).call(this),this.color&&this.style.setProperty("--indication-color",this.color);}},{key:"render",value:function render(){return o(_templateObject||(_templateObject=_taggedTemplateLiteral(["\n <div class=\"nile-error-notification\">\n <nile-icon\n name=\"info2\"\n size=\"14\"\n class=\"nile-error-notification__icon\"\n part=\"icon\"\n color=\"var(--indication-color)\"\n ></nile-icon>\n ","\n </div>\n "])),this.errorMessage);}}],[{key:"styles",get:function get(){return[e];}}]);}(r));i([s({type:String,reflect:!0})],n.prototype,"errorMessage",void 0),i([s({type:String,reflect:!0})],n.prototype,"color",void 0),_export("N",n=i([t("nile-error-notification")],n));}};});
2
2
  //# sourceMappingURL=nile-error-notification.cjs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"nile-error-notification.cjs.js","sources":["../../../src/nile-error-notification/nile-error-notification.ts"],"sourcesContent":["/**\n * Copyright Aquera Inc 2023\n *\n * This source code is licensed under the BSD-3-Clause license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport {\n LitElement,\n html,\n property,\n CSSResultArray,\n TemplateResult,\n} from 'lit-element';\nimport { customElement } from 'lit/decorators.js';\nimport { styles } from './nile-error-notification.css';\n\n/**\n * Nile icon component.\n *\n * @tag nile-error-notification\n *\n */\n@customElement('nile-error-notification')\nexport class NileErrorNotification extends LitElement {\n /**\n * The styles for ErrorNotification\n * @remarks If you are extending this class you can extend the base styles with super. Eg `return [super(), myCustomStyles]`\n */\n public static get styles(): CSSResultArray {\n return [styles];\n }\n\n // Represents the error message to be displayed to the user.\n @property({ type: String, reflect: true })\n errorMessage: string = '';\n\n /* #endregion */\n\n /* #region Methods */\n\n /**\n * Render method\n * @slot This is a slot test\n */\n public render(): TemplateResult {\n return html`\n <div class=\"nile-error-notification\">\n <nile-icon\n name=\"info2\"\n size=\"14\"\n class=\"nile-error-notification__icon\"\n part=\"icon\"\n color=\"#E5434D\"\n ></nile-icon>\n ${this.errorMessage}\n </div>\n `;\n }\n\n /* #endregion */\n}\n\nexport default NileErrorNotification;\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nile-error-notification': NileErrorNotification;\n }\n}\n"],"names":["NileErrorNotification","n","this","errorMessage","_this","_inherits","_i","_createClass","key","value","render","html","_templateObject","_taggedTemplateLiteral","get","styles","LitElement","__decorate","property","type","String","reflect","prototype","customElement"],"mappings":"0nHAwBaA,CAAAA,uBAAAA,EAAAA,EAAN,SAAAC,EAAA,qEAWLC,EAAAA,KAAAA,CAAYC,YAAW,CAAA,EA0BxB,QAAAC,KAAA,EAhCQC,SAAA,CAAAJ,CAAA,CAAAK,EAAA,SAAAC,YAAA,CAAAN,CAAA,GAAAO,GAAA,UAAAC,KAAA,CAgBA,SAAAC,OAAA,CAAAA,CACL,MAAOC,CAAAA,CAAI,CAAAC,eAAA,GAAAA,eAAA,CAAAC,sBAAA,6RASLX,IAAKC,CAAAA,YAAAA,EAGZ,CAAA,KAAAK,GAAA,UAAAM,GAAA,CA7BM,SAAAA,IAAA,CAAWC,CAChB,MAAO,CAACA,CACT,CAAA,EAcM,MArBkCC,CAApC,GAWLC,EAAA,CADCC,CAAAA,CAAS,CAAEC,IAAAA,CAAMC,OAAQC,OAAS,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CACTrB,CAAAsB,CAAAA,SAAAA,CAAA,mBAAA,EAXftB,CAAAA,CAAAA,OAAAA,KAAAA,CAAAA,CAAqBiB,EAAA,CADjCM,CAAAA,CAAc,4BACFvB"}
1
+ {"version":3,"file":"nile-error-notification.cjs.js","sources":["../../../src/nile-error-notification/nile-error-notification.ts"],"sourcesContent":["/**\n * Copyright Aquera Inc 2023\n *\n * This source code is licensed under the BSD-3-Clause license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport {\n LitElement,\n html,\n property,\n CSSResultArray,\n TemplateResult,\n} from 'lit-element';\nimport { customElement } from 'lit/decorators.js';\nimport { styles } from './nile-error-notification.css';\n\n/**\n * Nile icon component.\n *\n * @tag nile-error-notification\n *\n */\n@customElement('nile-error-notification')\nexport class NileErrorNotification extends LitElement {\n /**\n * The styles for ErrorNotification\n * @remarks If you are extending this class you can extend the base styles with super. Eg `return [super(), myCustomStyles]`\n */\n public static get styles(): CSSResultArray {\n return [styles];\n }\n\n // Represents the error message to be displayed to the user.\n @property({ type: String, reflect: true }) errorMessage: string = '';\n\n @property({ type: String, reflect: true }) color: string = '';\n \n connectedCallback(): void {\n super.connectedCallback();\n if(this.color){\n this.style.setProperty('--indication-color',this.color)\n }\n }\n\n /* #endregion */\n\n /* #region Methods */\n\n /**\n * Render method\n * @slot This is a slot test\n */\n public render(): TemplateResult {\n return html`\n <div class=\"nile-error-notification\">\n <nile-icon\n name=\"info2\"\n size=\"14\"\n class=\"nile-error-notification__icon\"\n part=\"icon\"\n color=\"var(--indication-color)\"\n ></nile-icon>\n ${this.errorMessage}\n </div>\n `;\n }\n\n /* #endregion */\n}\n\nexport default NileErrorNotification;\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nile-error-notification': NileErrorNotification;\n }\n}\n"],"names":["NileErrorNotification","_r","n","constructor","this","errorMessage","color","_this","_inherits","_createClass","key","value","connectedCallback","super","style","setProperty","render","html","_templateObject","_taggedTemplateLiteral","get","styles","LitElement","__decorate","property","type","String","reflect","prototype","_export","customElement"],"mappings":"gqIAwBaA,CAAN,uBAAAC,EAAA,EAAA,SAAAC,EAAA,CAAAC,KAAAA,KAAAA,CAAAA,eAAAA,MAAAA,CAAAA,mCAUuCC,EAAAA,KAAAA,CAAYC,YAAW,CAAA,EAAA,CAEvBD,KAAAA,CAAKE,KAAAA,CAAW,EAiC7D,QAAAC,KAAA,EAxCQC,SAAA,CAAAN,CAAA,CAAAD,EAAA,SAAAQ,YAAA,CAAAP,CAAA,GAAAQ,GAAA,qBAAAC,KAAA,CASP,SAAAC,kBAAA,CACEC,CAAAA,IAAAA,CAAAA,eAAAA,CAAAA,CAAAA,CAAAA,SAAAA,4BAAAA,IAAAA,OACGT,IAAAA,CAAKE,OACNF,IAAKU,CAAAA,KAAAA,CAAMC,YAAY,oBAAqBX,CAAAA,IAAAA,CAAKE,MAEpD,EAUM,GAAAI,GAAA,UAAAC,KAAA,UAAAK,OAAA,CACL,CAAA,MAAOC,CAAAA,CAAI,CAAAC,eAAA,GAAAA,eAAA,CAAAC,sBAAA,6SASLf,IAAKC,CAAAA,YAAAA,EAGZ,CAAA,KAAAK,GAAA,UAAAU,GAAA,CArCM,SAAAA,IAAA,EACL,MAAO,CAACC,EACT,EAOD,MAdyCC,IAUGC,CAAA,CAAA,CAA3CC,CAAS,CAAA,CAAEC,IAAMC,CAAAA,MAAAA,CAAQC,OAAS,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAmC3B,CAAA4B,CAAAA,SAAAA,CAAA,cAAA,CAAA,IAAA,EAAA,CAAA,CAE1BL,CAAA,CAAA,CAA3CC,CAAS,CAAA,CAAEC,IAAMC,CAAAA,MAAAA,CAAQC,OAAS,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAA4B3B,CAAA4B,CAAAA,SAAAA,CAAA,OAAA,CAAA,IAAA,EAAA,CAAA,CAAAC,OAAA,KAZpD7B,CAAqBuB,CAAAA,CAAAA,CAAA,CADjCO,CAAAA,CAAc,4BACF9B"}
@@ -1,2 +1,2 @@
1
- System.register(["../index-c7ad3b47.cjs.js"],function(_export,_context){"use strict";var r,_templateObject,o;function _taggedTemplateLiteral(strings,raw){if(!raw){raw=strings.slice(0);}return Object.freeze(Object.defineProperties(strings,{raw:{value:Object.freeze(raw)}}));}return{setters:[function(_index001CjsJs){r=_index001CjsJs.i;}],execute:function execute(){_export("s",o=r(_templateObject||(_templateObject=_taggedTemplateLiteral(["\n :host {\n }\n\n .nile-error-notification {\n font-family: var(--nile-font-family-serif);\n font-size: 12px;\n font-style: normal;\n font-weight: 400;\n line-height: 12px;\n letter-spacing: 0.2px;\n border: 1px solid var(--nile-colors-red-500);\n border-left: 6px solid var(--nile-colors-red-500);\n border-radius: 4px;\n padding: 8px;\n background: var(--nile-colors-neutral-100);\n color: var(--nile-colors-red-500);\n box-sizing: border-box;\n }\n\n .nile-error-notification__icon {\n vertical-align: middle;\n margin-right: 4px;\n }\n"]))));}};});
1
+ System.register(["../index-c7ad3b47.cjs.js"],function(_export,_context){"use strict";var i,_templateObject,o;function _taggedTemplateLiteral(strings,raw){if(!raw){raw=strings.slice(0);}return Object.freeze(Object.defineProperties(strings,{raw:{value:Object.freeze(raw)}}));}return{setters:[function(_index001CjsJs){i=_index001CjsJs.i;}],execute:function execute(){_export("s",o=i(_templateObject||(_templateObject=_taggedTemplateLiteral(["\n :host {\n --indication-color: green;\n }\n\n .nile-error-notification {\n font-family: var(--nile-font-family-serif);\n font-size: 12px;\n font-style: normal;\n font-weight: 400;\n line-height: 12px;\n letter-spacing: 0.2px;\n border: 1px solid var(--indication-color);\n border-left: 6px solid var(--indication-color);\n border-radius: 4px;\n padding: 8px;\n background: var(--nile-colors-neutral-100);\n color: var(--indication-color);\n box-sizing: border-box;\n }\n\n .nile-error-notification__icon {\n vertical-align: middle;\n margin-right: 4px;\n }\n"]))));}};});
2
2
  //# sourceMappingURL=nile-error-notification.css.cjs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"nile-error-notification.css.cjs.js","sources":["../../../src/nile-error-notification/nile-error-notification.css.ts"],"sourcesContent":["/**\n * Copyright Aquera Inc 2023\n *\n * This source code is licensed under the BSD-3-Clause license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport { css } from 'lit-element';\n\n/**\n * ErrorNotification CSS\n */\nexport const styles = css`\n :host {\n }\n\n .nile-error-notification {\n font-family: var(--nile-font-family-serif);\n font-size: 12px;\n font-style: normal;\n font-weight: 400;\n line-height: 12px;\n letter-spacing: 0.2px;\n border: 1px solid var(--nile-colors-red-500);\n border-left: 6px solid var(--nile-colors-red-500);\n border-radius: 4px;\n padding: 8px;\n background: var(--nile-colors-neutral-100);\n color: var(--nile-colors-red-500);\n box-sizing: border-box;\n }\n\n .nile-error-notification__icon {\n vertical-align: middle;\n margin-right: 4px;\n }\n`;\n\nexport default [styles];\n"],"names":["styles","css","_templateObject","_taggedTemplateLiteral"],"mappings":"wXAYaA,CAAAA,CAASC,CAAG,CAAAC,eAAA,GAAAA,eAAA,CAAAC,sBAAA"}
1
+ {"version":3,"file":"nile-error-notification.css.cjs.js","sources":["../../../src/nile-error-notification/nile-error-notification.css.ts"],"sourcesContent":["/**\n * Copyright Aquera Inc 2023\n *\n * This source code is licensed under the BSD-3-Clause license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport { css } from 'lit-element';\n\n/**\n * ErrorNotification CSS\n */\nexport const styles = css`\n :host {\n --indication-color: green;\n }\n\n .nile-error-notification {\n font-family: var(--nile-font-family-serif);\n font-size: 12px;\n font-style: normal;\n font-weight: 400;\n line-height: 12px;\n letter-spacing: 0.2px;\n border: 1px solid var(--indication-color);\n border-left: 6px solid var(--indication-color);\n border-radius: 4px;\n padding: 8px;\n background: var(--nile-colors-neutral-100);\n color: var(--indication-color);\n box-sizing: border-box;\n }\n\n .nile-error-notification__icon {\n vertical-align: middle;\n margin-right: 4px;\n }\n`;\n\nexport default [styles];\n"],"names":["styles","css","_templateObject","_taggedTemplateLiteral"],"mappings":"wXAYaA,CAAAA,CAASC,CAAG,CAAAC,eAAA,GAAAA,eAAA,CAAAC,sBAAA"}
@@ -1,5 +1,6 @@
1
- import{i as r}from"../index-0a3007c5.esm.js";const o=r`
1
+ import{i}from"../index-0a3007c5.esm.js";const o=i`
2
2
  :host {
3
+ --indication-color: green;
3
4
  }
4
5
 
5
6
  .nile-error-notification {
@@ -9,12 +10,12 @@ import{i as r}from"../index-0a3007c5.esm.js";const o=r`
9
10
  font-weight: 400;
10
11
  line-height: 12px;
11
12
  letter-spacing: 0.2px;
12
- border: 1px solid var(--nile-colors-red-500);
13
- border-left: 6px solid var(--nile-colors-red-500);
13
+ border: 1px solid var(--indication-color);
14
+ border-left: 6px solid var(--indication-color);
14
15
  border-radius: 4px;
15
16
  padding: 8px;
16
17
  background: var(--nile-colors-neutral-100);
17
- color: var(--nile-colors-red-500);
18
+ color: var(--indication-color);
18
19
  box-sizing: border-box;
19
20
  }
20
21
 
@@ -1,12 +1,12 @@
1
- import{__decorate as r}from"tslib";import{s as i,x as o}from"../index-0a3007c5.esm.js";import{customElement as e}from"lit/decorators.js";import{s as t}from"./nile-error-notification.css.esm.js";import{n as s}from"../property-09139d3c.esm.js";let n=class extends i{constructor(){super(...arguments),this.errorMessage=""}static get styles(){return[t]}render(){return o`
1
+ import{__decorate as i}from"tslib";import{s as r,x as o}from"../index-0a3007c5.esm.js";import{customElement as t}from"lit/decorators.js";import{s as e}from"./nile-error-notification.css.esm.js";import{n as s}from"../property-09139d3c.esm.js";let n=class extends r{constructor(){super(...arguments),this.errorMessage="",this.color=""}static get styles(){return[e]}connectedCallback(){super.connectedCallback(),this.color&&this.style.setProperty("--indication-color",this.color)}render(){return o`
2
2
  <div class="nile-error-notification">
3
3
  <nile-icon
4
4
  name="info2"
5
5
  size="14"
6
6
  class="nile-error-notification__icon"
7
7
  part="icon"
8
- color="#E5434D"
8
+ color="var(--indication-color)"
9
9
  ></nile-icon>
10
10
  ${this.errorMessage}
11
11
  </div>
12
- `}};r([s({type:String,reflect:!0})],n.prototype,"errorMessage",void 0),n=r([e("nile-error-notification")],n);export{n as N};
12
+ `}};i([s({type:String,reflect:!0})],n.prototype,"errorMessage",void 0),i([s({type:String,reflect:!0})],n.prototype,"color",void 0),n=i([t("nile-error-notification")],n);export{n as N};
@@ -53,14 +53,16 @@ let NileCodeEditor = class NileCodeEditor extends NileElement {
53
53
  this.insertBetweenCode = (text) => {
54
54
  const transaction = this.view.state.changeByRange(range => {
55
55
  const { from, to } = range;
56
- return { changes: { from, to, insert: text }, range };
56
+ return { changes: { from: from, to, insert: text }, range };
57
57
  });
58
58
  this.view.dispatch(transaction);
59
59
  };
60
60
  this.customAutocomplete = (context) => {
61
61
  // Getting the valid last line, last text from the code editor
62
62
  let text = context.state.doc.sliceString(0, context.pos);
63
- const [textBeforeCursor, textAfterSeperation] = this.splitStringAtLastSeparator(text.split('\n').at(-1)?.split(' ').at(-1) + '');
63
+ const [textBeforeCursor, baseTextAfterSeperation] = this.splitStringAtLastSeparator(text.split('\n').at(-1)?.split(' ').at(-1) + '');
64
+ const textAfterSeperation = baseTextAfterSeperation.replace(/["'\[]/g, '');
65
+ const isSuggestionString = textAfterSeperation != baseTextAfterSeperation;
64
66
  if (!this.isValidPath(textBeforeCursor))
65
67
  return { from: context.pos, options: [] };
66
68
  if (['.', '['].includes(textBeforeCursor[textBeforeCursor.length - 1])) {
@@ -71,7 +73,7 @@ let NileCodeEditor = class NileCodeEditor extends NileElement {
71
73
  if (textAfterSeperation) {
72
74
  const obj = {};
73
75
  Object.keys(resolved).forEach((key) => {
74
- if (key.startsWith(textAfterSeperation)) {
76
+ if (key.toLowerCase().startsWith(textAfterSeperation.toLowerCase())) {
75
77
  obj[key] = resolved[key];
76
78
  }
77
79
  });
@@ -80,12 +82,12 @@ let NileCodeEditor = class NileCodeEditor extends NileElement {
80
82
  // If resolved is an object, provide its keys as suggestions
81
83
  if (resolved && typeof resolved === 'object') {
82
84
  return {
83
- from: context.pos,
85
+ from: context.pos - textAfterSeperation.length,
84
86
  options: Object.keys(resolved).map((key) => ({
85
87
  label: key,
86
88
  type: 'property',
87
89
  info: `Key of ${path[path.length - 1]}`,
88
- apply: key.slice(textAfterSeperation.length),
90
+ apply: key,
89
91
  boost: 999
90
92
  })),
91
93
  };
@@ -95,7 +97,7 @@ let NileCodeEditor = class NileCodeEditor extends NileElement {
95
97
  // Match for top-level object suggestions, e.g., "a"
96
98
  const baseMatch = textBeforeCursor.match(/([a-zA-Z_$][\w$]*)$/);
97
99
  if (baseMatch) {
98
- const optionsList = Object.keys(this.customAutoCompletions).filter(key => key.startsWith(textBeforeCursor));
100
+ const optionsList = Object.keys(this.customAutoCompletions).filter(key => key.toLowerCase().startsWith(textBeforeCursor.toLowerCase()));
99
101
  return {
100
102
  from: context.pos - baseMatch[1].length,
101
103
  options: optionsList.map((key) => ({
@@ -341,7 +343,7 @@ let NileCodeEditor = class NileCodeEditor extends NileElement {
341
343
  const lastSeparatorIndex = Math.max(input.lastIndexOf('.'), input.lastIndexOf('['));
342
344
  if (lastSeparatorIndex === -1)
343
345
  return [input, ''];
344
- return [input.slice(0, lastSeparatorIndex + 1), input.slice(lastSeparatorIndex + 1).replace(/["'\[]/g, '')];
346
+ return [input.slice(0, lastSeparatorIndex + 1), input.slice(lastSeparatorIndex + 1)];
345
347
  }
346
348
  };
347
349
  __decorate([
@@ -1 +1 @@
1
- {"version":3,"file":"nile-code-editor.js","sourceRoot":"","sources":["../../../src/nile-code-editor/nile-code-editor.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;AAEH,OAAO,EAEL,IAAI,EACJ,QAAQ,GAIT,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAExC,OAAO,EACL,WAAW,EACX,WAAW,GACZ,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EACL,UAAU,EACV,kBAAkB,EAClB,qBAAqB,GACtB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,GAAG,EAAE,MAAM,sBAAsB,CAAC;AAC3C,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAqC,MAAM,0BAA0B,CAAC;AAC7F,OAAO,WAAW,MAAM,0BAA0B,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC,MAAM,iBAAiB,GAAC,GAAG,CAAC;AAC5B,gDAAgD;AAEhD;;;;;GAKG;AAEI,IAAM,cAAc,GAApB,MAAM,cAAe,SAAQ,WAAW;IAAxC;;QAIwD,UAAK,GAAG,EAAE,CAAC;QAEX,0BAAqB,GAAiB,EAAE,CAAC;QAE1C,aAAQ,GAAkC,YAAY,CAAC;QAE3C,iBAAY,GAAW,EAAE,CAAC;QAEjC,UAAK,GAAY,KAAK,CAAC;QAEpB,aAAQ,GAAY,KA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OAAO,EAAE,OAAO,EAAE,IAAI,EAAG,SAAS,EAAE,IAAI,EAAE,CAAC;mDAA8B;AAE7B;IAA7D,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAG,SAAS,EAAE,IAAI,EAAE,CAAC;4DAAsC;AAErC;IAA7D,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAG,SAAS,EAAE,IAAI,EAAE,CAAC;mDAA6B;AAE5B;IAA7D,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAG,SAAS,EAAE,IAAI,EAAE,CAAC;kDAA4B;AAE5B;IAA5D,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAG,SAAS,EAAE,IAAI,EAAC,CAAC;gDAA2B;AAE1B;IAA5D,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAG,SAAS,EAAE,IAAI,EAAC,CAAC;gDAA2B;AA9B5E,cAAc;IAD1B,aAAa,CAAC,kBAAkB,CAAC;GACrB,cAAc,CAmW1B;SAnWY,cAAc;AAqW3B,eAAe,cAAc,CAAC","sourcesContent":["/**\n * Copyright Aquera Inc 2023\n *\n * This source code is licensed under the BSD-3-Clause license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport {\n LitElement,\n html,\n property,\n CSSResultArray,\n TemplateResult,\n PropertyValueMap,\n} from 'lit-element';\n\nimport { customElement, query } from 'lit/decorators.js';\nimport { styles } from './nile-code-editor.css';\nimport { EditorView } from 'codemirror';\nimport { ViewUpdate } from '@codemirror/view';\nimport { \n Compartment,\n EditorState,\n} from '@codemirror/state';\n\nimport { lineNumbers } from '@codemirror/view';\nimport {\n javascript,\n javascriptLanguage,\n scopeCompletionSource,\n} from '@codemirror/lang-javascript';\nimport { sql } from '@codemirror/lang-sql';\nimport { json } from '@codemirror/lang-json';\nimport { autocompletion,CompletionContext,CompletionResult } from '@codemirror/autocomplete';\nimport NileElement from '../internal/nile-element';\nimport { basicSetup } from './extensionSetup';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { Theme } from './theme';\n\nconst TIME_OUT_DURATION=200;\n// Choose the appropriate mode for your use case\n\n/**\n * Nile icon component.\n *\n * @tag nile-code-editor\n *\n */\n@customElement('nile-code-editor')\nexport class NileCodeEditor extends NileElement {\n \n @query('.code-mirror') codeEditor: HTMLInputElement;\n\n @property({ type: String, reflect: true , attribute: true }) value = '';\n\n @property({ type: Object, reflect: true , attribute: true }) customAutoCompletions: object | any = {};\n\n @property({ type: String, reflect: true , attribute: true}) language: 'javascript' | 'sql' | 'json' = 'javascript';\n\n @property({ type: String, reflect: true , attribute: 'error-message' }) errorMessage: string = '';\n\n @property({ type: Boolean, reflect: true , attribute: 'error' }) error: boolean = false;\n\n @property({ type: Boolean, reflect: true , attribute: 'noborder' }) noborder: boolean = false;\n\n @property({ type: Boolean, reflect: true , attribute: true }) multiline: boolean = false;\n\n @property({ type: Boolean, reflect: true , attribute: true }) suggestionBracketSupport: boolean = false;\n\n @property({ type: Boolean, reflect: true , attribute: true }) lineNumbers: boolean = false;\n\n @property({ type: Boolean, reflect: true , attribute: true }) lineNumbersMultiline: boolean = true;\n\n @property({ type: Boolean, reflect: true , attribute: true }) hasScroller: boolean = true;\n\n @property({ type: Boolean, reflect: true , attribute: true }) expandable: boolean = true;\n\n @property({ type: Boolean, reflect: true , attribute: true}) readonly: boolean = false;\n\n @property({ type: Boolean, reflect: true , attribute: true}) debounce: boolean = false;\n\n public view: EditorView;\n public viewState:EditorState;\n private timeOut: any = null;\n\n // Compartments for initialiazing and switching extensions\n private lineNumbersComp = new Compartment();\n private restrictSingleLineComp = new Compartment();\n private readOnlyComp = new Compartment();\n private customCompletionComp = new Compartment();\n\n /**\n * The styles for CodeEditor\n * @remarks If you are extending this class you can extend the base styles with super. Eg `return [super(), myCustomStyles]`\n */\n public static get styles(): CSSResultArray {\n return [styles];\n }\n\n connectedCallback(): void {\n super.connectedCallback();\n this.createState()\n this.emit('nile-init',undefined,false);\n }\n\n disconnectedCallback(): void {\n super.disconnectedCallback();\n this.view.destroy()\n this.emit('nile-destroy',undefined,false);\n }\n\n firstUpdated() {\n this.createNewView()\n this.emit('nile-after-init',{ \n codeMirrorInstance: this.view, \n createNewView: this.createNewView, \n insertAtCursor: this.insertBetweenCode \n }, false )\n }\n\n protected updated(changedProperties: PropertyValueMap<any> | Map<PropertyKey, unknown>): void{\n super.updated(changedProperties);\n if (changedProperties.has('value') && this.view.state.doc.toString()!=this.value) {\n // Editor has already been initialized, update its state\n this.singleLineMultiLineToggle();\n }\n if (changedProperties.has('multiline')) {\n this.view.dispatch({\n effects: [\n this.lineNumbersComp.reconfigure(this.getLineNumbersExension()),\n this.restrictSingleLineComp.reconfigure(this.getSingleLineExtension())\n ],\n })\n this.singleLineMultiLineToggle();\n }\n if (changedProperties.has('readonly')) {\n this.view.dispatch({ \n effects: [\n this.readOnlyComp.reconfigure(this.getReadOnlyExtension()),\n ]\n })\n }\n if (changedProperties.has('lineNumbers') || changedProperties.has('lineNumbersMultiline')) {\n this.view.dispatch({ \n effects: [\n this.lineNumbersComp.reconfigure(this.getLineNumbersExension()),\n ]\n })\n }\n if(changedProperties.has('customAutoCompletions') || changedProperties.has('suggestionBracketSupport') ){\n this.view.dispatch({ \n effects: [\n this.customCompletionComp.reconfigure(javascriptLanguage.data.of({\n autocomplete: this.suggestionBracketSupport?this.customAutocomplete: scopeCompletionSource(this.customAutoCompletions),\n }))\n ]\n })\n }\n }\n\n public render(): TemplateResult {\n const hasErrorMessage = !!this.errorMessage;\n const hasError = !!this.error;\n const noborder = !!this.noborder;\n const noScrollbar = !this.hasScroller\n return html`<div\n part=\"code-editor-base\"\n class=${classMap({\n 'code-mirror': true,\n 'noborder': noborder,\n 'error': hasError || hasErrorMessage,\n 'code-mirror__singleline': !this.multiline,\n 'no-scroller': noScrollbar\n })}\n >\n ${this.expandable\n ? html` \n <nile-icon\n name=\"expand-2\"\n class=\"code-editor__icon__container\"\n size=\"16\"\n color=\"black\"\n @click=\"${(e: CustomEvent) => this.emitNileExpand()}\"\n ></nile-icon>`\n : ''}\n </div>\n ${hasErrorMessage\n ? html`\n <nile-form-error-message\n >${this.errorMessage}</nile-form-error-message\n >\n `\n : ``}`;\n }\n\n createNewView(emitEvent=true){\n if(this.view) this.view.destroy();\n this.view = new EditorView({\n state: this.viewState,\n parent: this.codeEditor\n });\n\n if(emitEvent) this.emit('nile-after-update',{ createNewView: this.createNewView, codeMirrorInstance: this.view, }, false );\n }\n\n createState(){\n const lineNumbersExtension = this.lineNumbersComp.of(this.getLineNumbersExension());\n const readOnlyExtension = this.readOnlyComp.of(this.getReadOnlyExtension());\n const restrictSingleLineExtension = this.restrictSingleLineComp.of(this.getSingleLineExtension())\n const customAutoCompletions = this.customCompletionComp.of(javascriptLanguage.data.of({\n autocomplete: this.suggestionBracketSupport?this.customAutocomplete: scopeCompletionSource(this.customAutoCompletions),\n }));\n const language = this.getLanguageExtension()\n this.viewState = EditorState.create({\n doc: !this.multiline ? this.convertToSingleLine(this.value) : this.value,\n extensions: [\n basicSetup({\n highlightActiveLine: false,\n foldGutter: false,\n }),\n lineNumbersExtension,\n readOnlyExtension,\n restrictSingleLineExtension,\n customAutoCompletions,\n autocompletion(),\n language,\n EditorView.theme(Theme),\n EditorView.updateListener.of((v: ViewUpdate) => {\n if (v.docChanged) {\n this.debounce ? this.emitAfterTimeout({ value: this.view.state.doc.toString() }) : this.emit('nile-change', { value: this.view.state.doc.toString() })\n }\n }),\n EditorView.domEventHandlers({\n focus: () => this.dispatchEvent(new Event('nile-focus')),\n blur: () => this.dispatchEvent(new Event('nile-blur')),\n }),\n ],\n });\n return this.viewState\n }\n\n singleLineMultiLineToggle() {\n this.view.dispatch({\n changes: {\n from: 0,\n to: this.view.state.doc.length,\n insert: !this.multiline\n ? this.convertToSingleLine(this.value)\n : this.value,\n },\n });\n }\n\n convertToSingleLine(code: any) {\n if (!code) return '';\n // Remove line breaks and unnecessary whitespace\n return code.replace(/\\s+/g, ' ').trim();\n }\n\n emitAfterTimeout(value:any){\n if(this.timeOut) clearTimeout(this.timeOut);\n this.timeOut=setTimeout(()=> this.emit('nile-change', value, false), TIME_OUT_DURATION)\n }\n\n public insertBetweenCode=(text: string) => {\n const transaction = this.view.state.changeByRange(range => {\n const { from, to } = range;\n return { changes: { from, to, insert: text }, range };\n });\n this.view.dispatch(transaction);\n }\n \n //EXTENSION CONFIGURATIONS\n getLineNumbersExension() {\n return (!this.multiline && this.lineNumbers) || (this.multiline && this.lineNumbersMultiline) ? lineNumbers() : [];\n }\n \n getLanguageExtension(){\n switch(this.language){\n case 'sql':\n return sql();\n case 'json':\n return json();\n default:\n return javascript(); \n }\n }\n\n getReadOnlyExtension() {\n return this.readonly ? EditorState.readOnly.of(true) : [];\n }\n\n getSingleLineExtension() {\n return !this.multiline ? EditorState.transactionFilter.of(tr =>\n tr.newDoc.lines > 1 ? [] : tr\n ) : [];\n }\n\n restrictSingleLine() {\n return EditorState.transactionFilter.of(tr =>\n tr.newDoc.lines > 1 ? [] : tr\n );\n }\n\n emitNileExpand() {\n this.emit('nile-expand', { expand: true },false);\n }\n\n customAutocomplete = (context: CompletionContext): CompletionResult | null => {\n // Getting the valid last line, last text from the code editor\n let text = context.state.doc.sliceString(0, context.pos);\n const [textBeforeCursor,textAfterSeperation]=this.splitStringAtLastSeparator(text.split('\\n').at(-1)?.split(' ').at(-1)+'')\n\n if (!this.isValidPath(textBeforeCursor)) return { from: context.pos, options: [] };\n if(['.', '['].includes(textBeforeCursor[textBeforeCursor.length - 1])){\n // Parse the path for dot or bracket notation\n const path = this.parsePath(textBeforeCursor);\n if (path) {\n let resolved = this.resolveNestedProperties(this.customAutoCompletions, path);\n if(textAfterSeperation){\n const obj:any={}\n Object.keys(resolved).forEach((key)=>{\n if(key.startsWith(textAfterSeperation)){\n obj[key]=resolved[key]\n }\n })\n resolved=obj\n }\n // If resolved is an object, provide its keys as suggestions\n if (resolved && typeof resolved === 'object') {\n return {\n from: context.pos,\n options: Object.keys(resolved).map((key) => ({\n label: key,\n type: 'property',\n info: `Key of ${path[path.length - 1]}`,\n apply: key.slice(textAfterSeperation.length),\n boost: 999\n })),\n };\n }\n }\n }\n \n // Match for top-level object suggestions, e.g., \"a\"\n const baseMatch: any = textBeforeCursor.match(/([a-zA-Z_$][\\w$]*)$/);\n if (baseMatch) {\n const optionsList=Object.keys(this.customAutoCompletions).filter(key=>key.startsWith(textBeforeCursor));\n return {\n from: context.pos - baseMatch[1].length,\n options: optionsList.map((key) => ({\n label: key,\n type: 'property',\n apply: key,\n boost: 999\n }))\n }\n }\n // Default to an empty list if no match\n return { from: context.pos, options: [] };\n };\n\n resolveNestedProperties = (obj:any, keys:any[]) => {\n return keys.reduce((acc, key) => {\n if (acc && typeof acc === 'object') {\n return acc[key];\n }\n return null;\n }, obj);\n };\n\n parsePath(text: string) {\n const regex = /([a-zA-Z_$][\\w$]*)(\\[(?:[^\\]]+)\\]|\\.[a-zA-Z_$][\\w$]*)*/g;\n const matches = [...text.matchAll(regex)];\n if (matches.length > 0) {\n const base = matches[0][1]; // The base object name\n const keys = [base];\n // Extract keys from dot or bracket notation\n const pathMatches = text.match(/\\[(.*?)\\]|\\.(\\w+)/g) || [];\n for (const match of pathMatches) {\n if (match.startsWith('[')) {\n keys.push(match.slice(1, -1).replace(/['\"]/g, '')); // Remove brackets and quotes\n } else if (match.startsWith('.')) {\n keys.push(match.slice(1));\n }\n }\n return keys;\n }\n return null;\n };\n\n isValidPath(path: string) {\n // Regex to validate the format of the string\n const regex = /^([a-zA-Z_$][\\w$]*)(\\.[a-zA-Z_$][\\w$]*|\\[\\s*(['\"]?[a-zA-Z0-9_$]*['\"]?)\\s*\\])*([\\.\\[])?$/;\n // Test the string against the regex\n return regex.test(path);\n }\n\n splitStringAtLastSeparator(input:string) {\n const lastSeparatorIndex = Math.max(input.lastIndexOf('.'), input.lastIndexOf('['));\n if (lastSeparatorIndex === -1) return [input, '']; \n return [input.slice(0, lastSeparatorIndex + 1), input.slice(lastSeparatorIndex + 1).replace(/[\"'\\[]/g, '')];\n }\n /* #endregion */\n}\n\nexport default NileCodeEditor;\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nile-code-editor': NileCodeEditor;\n }\n}\n"]}
1
+ {"version":3,"file":"nile-code-editor.js","sourceRoot":"","sources":["../../../src/nile-code-editor/nile-code-editor.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;AAEH,OAAO,EAEL,IAAI,EACJ,QAAQ,GAIT,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAExC,OAAO,EACL,WAAW,EACX,WAAW,GACZ,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EACL,UAAU,EACV,kBAAkB,EAClB,qBAAqB,GACtB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,GAAG,EAAE,MAAM,sBAAsB,CAAC;AAC3C,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAqC,MAAM,0BAA0B,CAAC;AAC7F,OAAO,WAAW,MAAM,0BAA0B,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC,MAAM,iBAAiB,GAAC,GAAG,CAAC;AAC5B,gDAAgD;AAEhD;;;;;GAKG;AAEI,IAAM,cAAc,GAApB,MAAM,cAAe,SAAQ,WAAW;IAAxC;;QAI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EAAE,IAAI,EAAG,SAAS,EAAE,UAAU,EAAE,CAAC;gDAA2B;AAEhC;IAA7D,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAG,SAAS,EAAE,IAAI,EAAE,CAAC;iDAA4B;AAE3B;IAA7D,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAG,SAAS,EAAE,IAAI,EAAE,CAAC;gEAA2C;AAE1C;IAA7D,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAG,SAAS,EAAE,IAAI,EAAE,CAAC;mDAA8B;AAE7B;IAA7D,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAG,SAAS,EAAE,IAAI,EAAE,CAAC;4DAAsC;AAErC;IAA7D,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAG,SAAS,EAAE,IAAI,EAAE,CAAC;mDAA6B;AAE5B;IAA7D,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAG,SAAS,EAAE,IAAI,EAAE,CAAC;kDAA4B;AAE5B;IAA5D,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAG,SAAS,EAAE,IAAI,EAAC,CAAC;gDAA2B;AAE1B;IAA5D,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAG,SAAS,EAAE,IAAI,EAAC,CAAC;gDAA2B;AA9B5E,cAAc;IAD1B,aAAa,CAAC,kBAAkB,CAAC;GACrB,cAAc,CAsW1B;SAtWY,cAAc;AAwW3B,eAAe,cAAc,CAAC","sourcesContent":["/**\n * Copyright Aquera Inc 2023\n *\n * This source code is licensed under the BSD-3-Clause license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport {\n LitElement,\n html,\n property,\n CSSResultArray,\n TemplateResult,\n PropertyValueMap,\n} from 'lit-element';\n\nimport { customElement, query } from 'lit/decorators.js';\nimport { styles } from './nile-code-editor.css';\nimport { EditorView } from 'codemirror';\nimport { ViewUpdate } from '@codemirror/view';\nimport { \n Compartment,\n EditorState,\n} from '@codemirror/state';\n\nimport { lineNumbers } from '@codemirror/view';\nimport {\n javascript,\n javascriptLanguage,\n scopeCompletionSource,\n} from '@codemirror/lang-javascript';\nimport { sql } from '@codemirror/lang-sql';\nimport { json } from '@codemirror/lang-json';\nimport { autocompletion,CompletionContext,CompletionResult } from '@codemirror/autocomplete';\nimport NileElement from '../internal/nile-element';\nimport { basicSetup } from './extensionSetup';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { Theme } from './theme';\n\nconst TIME_OUT_DURATION=200;\n// Choose the appropriate mode for your use case\n\n/**\n * Nile icon component.\n *\n * @tag nile-code-editor\n *\n */\n@customElement('nile-code-editor')\nexport class NileCodeEditor extends NileElement {\n \n @query('.code-mirror') codeEditor: HTMLInputElement;\n\n @property({ type: String, reflect: true , attribute: true }) value = '';\n\n @property({ type: Object, reflect: true , attribute: true }) customAutoCompletions: object | any = {};\n\n @property({ type: String, reflect: true , attribute: true}) language: 'javascript' | 'sql' | 'json' = 'javascript';\n\n @property({ type: String, reflect: true , attribute: 'error-message' }) errorMessage: string = '';\n\n @property({ type: Boolean, reflect: true , attribute: 'error' }) error: boolean = false;\n\n @property({ type: Boolean, reflect: true , attribute: 'noborder' }) noborder: boolean = false;\n\n @property({ type: Boolean, reflect: true , attribute: true }) multiline: boolean = false;\n\n @property({ type: Boolean, reflect: true , attribute: true }) suggestionBracketSupport: boolean = false;\n\n @property({ type: Boolean, reflect: true , attribute: true }) lineNumbers: boolean = false;\n\n @property({ type: Boolean, reflect: true , attribute: true }) lineNumbersMultiline: boolean = true;\n\n @property({ type: Boolean, reflect: true , attribute: true }) hasScroller: boolean = true;\n\n @property({ type: Boolean, reflect: true , attribute: true }) expandable: boolean = true;\n\n @property({ type: Boolean, reflect: true , attribute: true}) readonly: boolean = false;\n\n @property({ type: Boolean, reflect: true , attribute: true}) debounce: boolean = false;\n\n public view: EditorView;\n public viewState:EditorState;\n private timeOut: any = null;\n\n // Compartments for initialiazing and switching extensions\n private lineNumbersComp = new Compartment();\n private restrictSingleLineComp = new Compartment();\n private readOnlyComp = new Compartment();\n private customCompletionComp = new Compartment();\n\n /**\n * The styles for CodeEditor\n * @remarks If you are extending this class you can extend the base styles with super. Eg `return [super(), myCustomStyles]`\n */\n public static get styles(): CSSResultArray {\n return [styles];\n }\n\n connectedCallback(): void {\n super.connectedCallback();\n this.createState()\n this.emit('nile-init',undefined,false);\n }\n\n disconnectedCallback(): void {\n super.disconnectedCallback();\n this.view.destroy()\n this.emit('nile-destroy',undefined,false);\n }\n\n firstUpdated() {\n this.createNewView()\n this.emit('nile-after-init',{ \n codeMirrorInstance: this.view, \n createNewView: this.createNewView, \n insertAtCursor: this.insertBetweenCode \n }, false )\n }\n\n protected updated(changedProperties: PropertyValueMap<any> | Map<PropertyKey, unknown>): void{\n super.updated(changedProperties);\n if (changedProperties.has('value') && this.view.state.doc.toString()!=this.value) {\n // Editor has already been initialized, update its state\n this.singleLineMultiLineToggle();\n }\n if (changedProperties.has('multiline')) {\n this.view.dispatch({\n effects: [\n this.lineNumbersComp.reconfigure(this.getLineNumbersExension()),\n this.restrictSingleLineComp.reconfigure(this.getSingleLineExtension())\n ],\n })\n this.singleLineMultiLineToggle();\n }\n if (changedProperties.has('readonly')) {\n this.view.dispatch({ \n effects: [\n this.readOnlyComp.reconfigure(this.getReadOnlyExtension()),\n ]\n })\n }\n if (changedProperties.has('lineNumbers') || changedProperties.has('lineNumbersMultiline')) {\n this.view.dispatch({ \n effects: [\n this.lineNumbersComp.reconfigure(this.getLineNumbersExension()),\n ]\n })\n }\n if(changedProperties.has('customAutoCompletions') || changedProperties.has('suggestionBracketSupport') ){\n this.view.dispatch({ \n effects: [\n this.customCompletionComp.reconfigure(javascriptLanguage.data.of({\n autocomplete: this.suggestionBracketSupport?this.customAutocomplete: scopeCompletionSource(this.customAutoCompletions),\n }))\n ]\n })\n }\n }\n\n public render(): TemplateResult {\n const hasErrorMessage = !!this.errorMessage;\n const hasError = !!this.error;\n const noborder = !!this.noborder;\n const noScrollbar = !this.hasScroller\n return html`<div\n part=\"code-editor-base\"\n class=${classMap({\n 'code-mirror': true,\n 'noborder': noborder,\n 'error': hasError || hasErrorMessage,\n 'code-mirror__singleline': !this.multiline,\n 'no-scroller': noScrollbar\n })}\n >\n ${this.expandable\n ? html` \n <nile-icon\n name=\"expand-2\"\n class=\"code-editor__icon__container\"\n size=\"16\"\n color=\"black\"\n @click=\"${(e: CustomEvent) => this.emitNileExpand()}\"\n ></nile-icon>`\n : ''}\n </div>\n ${hasErrorMessage\n ? html`\n <nile-form-error-message\n >${this.errorMessage}</nile-form-error-message\n >\n `\n : ``}`;\n }\n\n createNewView(emitEvent=true){\n if(this.view) this.view.destroy();\n this.view = new EditorView({\n state: this.viewState,\n parent: this.codeEditor\n });\n\n if(emitEvent) this.emit('nile-after-update',{ createNewView: this.createNewView, codeMirrorInstance: this.view, }, false );\n }\n\n createState(){\n const lineNumbersExtension = this.lineNumbersComp.of(this.getLineNumbersExension());\n const readOnlyExtension = this.readOnlyComp.of(this.getReadOnlyExtension());\n const restrictSingleLineExtension = this.restrictSingleLineComp.of(this.getSingleLineExtension())\n const customAutoCompletions = this.customCompletionComp.of(javascriptLanguage.data.of({\n autocomplete: this.suggestionBracketSupport?this.customAutocomplete: scopeCompletionSource(this.customAutoCompletions),\n }));\n const language = this.getLanguageExtension()\n this.viewState = EditorState.create({\n doc: !this.multiline ? this.convertToSingleLine(this.value) : this.value,\n extensions: [\n basicSetup({\n highlightActiveLine: false,\n foldGutter: false,\n }),\n lineNumbersExtension,\n readOnlyExtension,\n restrictSingleLineExtension,\n customAutoCompletions,\n autocompletion(),\n language,\n EditorView.theme(Theme),\n EditorView.updateListener.of((v: ViewUpdate) => {\n if (v.docChanged) {\n this.debounce ? this.emitAfterTimeout({ value: this.view.state.doc.toString() }) : this.emit('nile-change', { value: this.view.state.doc.toString() })\n }\n }),\n EditorView.domEventHandlers({\n focus: () => this.dispatchEvent(new Event('nile-focus')),\n blur: () => this.dispatchEvent(new Event('nile-blur')),\n }),\n ],\n });\n return this.viewState\n }\n\n singleLineMultiLineToggle() {\n this.view.dispatch({\n changes: {\n from: 0,\n to: this.view.state.doc.length,\n insert: !this.multiline\n ? this.convertToSingleLine(this.value)\n : this.value,\n },\n });\n }\n\n convertToSingleLine(code: any) {\n if (!code) return '';\n // Remove line breaks and unnecessary whitespace\n return code.replace(/\\s+/g, ' ').trim();\n }\n\n emitAfterTimeout(value:any){\n if(this.timeOut) clearTimeout(this.timeOut);\n this.timeOut=setTimeout(()=> this.emit('nile-change', value, false), TIME_OUT_DURATION)\n }\n\n public insertBetweenCode=(text: string) => {\n const transaction = this.view.state.changeByRange(range => {\n const { from, to } = range;\n return { changes: { from:from, to, insert: text }, range };\n });\n this.view.dispatch(transaction);\n }\n \n //EXTENSION CONFIGURATIONS\n getLineNumbersExension() {\n return (!this.multiline && this.lineNumbers) || (this.multiline && this.lineNumbersMultiline) ? lineNumbers() : [];\n }\n \n getLanguageExtension(){\n switch(this.language){\n case 'sql':\n return sql();\n case 'json':\n return json();\n default:\n return javascript(); \n }\n }\n\n getReadOnlyExtension() {\n return this.readonly ? EditorState.readOnly.of(true) : [];\n }\n\n getSingleLineExtension() {\n return !this.multiline ? EditorState.transactionFilter.of(tr =>\n tr.newDoc.lines > 1 ? [] : tr\n ) : [];\n }\n\n restrictSingleLine() {\n return EditorState.transactionFilter.of(tr =>\n tr.newDoc.lines > 1 ? [] : tr\n );\n }\n\n emitNileExpand() {\n this.emit('nile-expand', { expand: true },false);\n }\n\n customAutocomplete = (context: CompletionContext): CompletionResult | null => {\n // Getting the valid last line, last text from the code editor\n let text = context.state.doc.sliceString(0, context.pos);\n const [textBeforeCursor,baseTextAfterSeperation]=this.splitStringAtLastSeparator(text.split('\\n').at(-1)?.split(' ').at(-1)+'')\n const textAfterSeperation=baseTextAfterSeperation.replace(/[\"'\\[]/g, '')\n\n const isSuggestionString=textAfterSeperation!=baseTextAfterSeperation;\n\n if (!this.isValidPath(textBeforeCursor)) return { from: context.pos, options: [] };\n if(['.', '['].includes(textBeforeCursor[textBeforeCursor.length - 1])){\n // Parse the path for dot or bracket notation\n const path = this.parsePath(textBeforeCursor);\n if (path) {\n let resolved = this.resolveNestedProperties(this.customAutoCompletions, path);\n if(textAfterSeperation){\n const obj:any={}\n Object.keys(resolved).forEach((key)=>{\n if(key.toLowerCase().startsWith(textAfterSeperation.toLowerCase())){\n obj[key]=resolved[key]\n }\n })\n resolved=obj\n }\n // If resolved is an object, provide its keys as suggestions\n if (resolved && typeof resolved === 'object') {\n return {\n from: context.pos-textAfterSeperation.length,\n options: Object.keys(resolved).map((key) => ({\n label: key,\n type: 'property',\n info: `Key of ${path[path.length - 1]}`,\n apply: key,\n boost: 999\n })),\n };\n }\n }\n }\n \n // Match for top-level object suggestions, e.g., \"a\"\n const baseMatch: any = textBeforeCursor.match(/([a-zA-Z_$][\\w$]*)$/);\n if (baseMatch) {\n const optionsList=Object.keys(this.customAutoCompletions).filter(key=>key.toLowerCase().startsWith(textBeforeCursor.toLowerCase()));\n return {\n from: context.pos - baseMatch[1].length,\n options: optionsList.map((key) => ({\n label: key,\n type: 'property',\n apply: key,\n boost: 999\n }))\n }\n }\n // Default to an empty list if no match\n return { from: context.pos, options: [] };\n };\n\n resolveNestedProperties = (obj:any, keys:any[]) => {\n return keys.reduce((acc, key) => {\n if (acc && typeof acc === 'object') {\n return acc[key];\n }\n return null;\n }, obj);\n };\n\n parsePath(text: string) {\n const regex = /([a-zA-Z_$][\\w$]*)(\\[(?:[^\\]]+)\\]|\\.[a-zA-Z_$][\\w$]*)*/g;\n const matches = [...text.matchAll(regex)];\n if (matches.length > 0) {\n const base = matches[0][1]; // The base object name\n const keys = [base];\n // Extract keys from dot or bracket notation\n const pathMatches = text.match(/\\[(.*?)\\]|\\.(\\w+)/g) || [];\n for (const match of pathMatches) {\n if (match.startsWith('[')) {\n keys.push(match.slice(1, -1).replace(/['\"]/g, '')); // Remove brackets and quotes\n } else if (match.startsWith('.')) {\n keys.push(match.slice(1));\n }\n }\n return keys;\n }\n return null;\n };\n\n isValidPath(path: string) {\n // Regex to validate the format of the string\n const regex = /^([a-zA-Z_$][\\w$]*)(\\.[a-zA-Z_$][\\w$]*|\\[\\s*(['\"]?[a-zA-Z0-9_$]*['\"]?)\\s*\\])*([\\.\\[])?$/;\n // Test the string against the regex\n return regex.test(path);\n }\n\n splitStringAtLastSeparator(input:string) {\n const lastSeparatorIndex = Math.max(input.lastIndexOf('.'), input.lastIndexOf('['));\n if (lastSeparatorIndex === -1) return [input, ''];\n return [input.slice(0, lastSeparatorIndex + 1), input.slice(lastSeparatorIndex + 1)];\n }\n /* #endregion */\n}\n\nexport default NileCodeEditor;\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nile-code-editor': NileCodeEditor;\n }\n}\n"]}
@@ -10,6 +10,7 @@ import { css } from 'lit-element';
10
10
  */
11
11
  export const styles = css `
12
12
  :host {
13
+ --indication-color: green;
13
14
  }
14
15
 
15
16
  .nile-error-notification {
@@ -19,12 +20,12 @@ export const styles = css `
19
20
  font-weight: 400;
20
21
  line-height: 12px;
21
22
  letter-spacing: 0.2px;
22
- border: 1px solid var(--nile-colors-red-500);
23
- border-left: 6px solid var(--nile-colors-red-500);
23
+ border: 1px solid var(--indication-color);
24
+ border-left: 6px solid var(--indication-color);
24
25
  border-radius: 4px;
25
26
  padding: 8px;
26
27
  background: var(--nile-colors-neutral-100);
27
- color: var(--nile-colors-red-500);
28
+ color: var(--indication-color);
28
29
  box-sizing: border-box;
29
30
  }
30
31
 
@@ -1 +1 @@
1
- {"version":3,"file":"nile-error-notification.css.js","sourceRoot":"","sources":["../../../src/nile-error-notification/nile-error-notification.css.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAElC;;GAEG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;CAwBxB,CAAC;AAEF,eAAe,CAAC,MAAM,CAAC,CAAC","sourcesContent":["/**\n * Copyright Aquera Inc 2023\n *\n * This source code is licensed under the BSD-3-Clause license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport { css } from 'lit-element';\n\n/**\n * ErrorNotification CSS\n */\nexport const styles = css`\n :host {\n }\n\n .nile-error-notification {\n font-family: var(--nile-font-family-serif);\n font-size: 12px;\n font-style: normal;\n font-weight: 400;\n line-height: 12px;\n letter-spacing: 0.2px;\n border: 1px solid var(--nile-colors-red-500);\n border-left: 6px solid var(--nile-colors-red-500);\n border-radius: 4px;\n padding: 8px;\n background: var(--nile-colors-neutral-100);\n color: var(--nile-colors-red-500);\n box-sizing: border-box;\n }\n\n .nile-error-notification__icon {\n vertical-align: middle;\n margin-right: 4px;\n }\n`;\n\nexport default [styles];\n"]}
1
+ {"version":3,"file":"nile-error-notification.css.js","sourceRoot":"","sources":["../../../src/nile-error-notification/nile-error-notification.css.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAElC;;GAEG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;CAyBxB,CAAC;AAEF,eAAe,CAAC,MAAM,CAAC,CAAC","sourcesContent":["/**\n * Copyright Aquera Inc 2023\n *\n * This source code is licensed under the BSD-3-Clause license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport { css } from 'lit-element';\n\n/**\n * ErrorNotification CSS\n */\nexport const styles = css`\n :host {\n --indication-color: green;\n }\n\n .nile-error-notification {\n font-family: var(--nile-font-family-serif);\n font-size: 12px;\n font-style: normal;\n font-weight: 400;\n line-height: 12px;\n letter-spacing: 0.2px;\n border: 1px solid var(--indication-color);\n border-left: 6px solid var(--indication-color);\n border-radius: 4px;\n padding: 8px;\n background: var(--nile-colors-neutral-100);\n color: var(--indication-color);\n box-sizing: border-box;\n }\n\n .nile-error-notification__icon {\n vertical-align: middle;\n margin-right: 4px;\n }\n`;\n\nexport default [styles];\n"]}
@@ -18,6 +18,8 @@ export declare class NileErrorNotification extends LitElement {
18
18
  */
19
19
  static get styles(): CSSResultArray;
20
20
  errorMessage: string;
21
+ color: string;
22
+ connectedCallback(): void;
21
23
  /**
22
24
  * Render method
23
25
  * @slot This is a slot test
@@ -19,6 +19,7 @@ let NileErrorNotification = class NileErrorNotification extends LitElement {
19
19
  super(...arguments);
20
20
  // Represents the error message to be displayed to the user.
21
21
  this.errorMessage = '';
22
+ this.color = '';
22
23
  /* #endregion */
23
24
  }
24
25
  /**
@@ -28,6 +29,12 @@ let NileErrorNotification = class NileErrorNotification extends LitElement {
28
29
  static get styles() {
29
30
  return [styles];
30
31
  }
32
+ connectedCallback() {
33
+ super.connectedCallback();
34
+ if (this.color) {
35
+ this.style.setProperty('--indication-color', this.color);
36
+ }
37
+ }
31
38
  /* #endregion */
32
39
  /* #region Methods */
33
40
  /**
@@ -42,7 +49,7 @@ let NileErrorNotification = class NileErrorNotification extends LitElement {
42
49
  size="14"
43
50
  class="nile-error-notification__icon"
44
51
  part="icon"
45
- color="#E5434D"
52
+ color="var(--indication-color)"
46
53
  ></nile-icon>
47
54
  ${this.errorMessage}
48
55
  </div>
@@ -52,6 +59,9 @@ let NileErrorNotification = class NileErrorNotification extends LitElement {
52
59
  __decorate([
53
60
  property({ type: String, reflect: true })
54
61
  ], NileErrorNotification.prototype, "errorMessage", void 0);
62
+ __decorate([
63
+ property({ type: String, reflect: true })
64
+ ], NileErrorNotification.prototype, "color", void 0);
55
65
  NileErrorNotification = __decorate([
56
66
  customElement('nile-error-notification')
57
67
  ], NileErrorNotification);
@@ -1 +1 @@
1
- {"version":3,"file":"nile-error-notification.js","sourceRoot":"","sources":["../../../src/nile-error-notification/nile-error-notification.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;AAEH,OAAO,EACL,UAAU,EACV,IAAI,EACJ,QAAQ,GAGT,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,+BAA+B,CAAC;AAEvD;;;;;GAKG;AAEI,IAAM,qBAAqB,GAA3B,MAAM,qBAAsB,SAAQ,UAAU;IAA9C;;QASL,4DAA4D;QAE5D,iBAAY,GAAW,EAAE,CAAC;QAyB1B,gBAAgB;IAClB,CAAC;IApCC;;;OAGG;IACI,MAAM,KAAK,MAAM;QACtB,OAAO,CAAC,MAAM,CAAC,CAAC;IAClB,CAAC;IAMD,gBAAgB;IAEhB,qBAAqB;IAErB;;;OAGG;IACI,MAAM;QACX,OAAO,IAAI,CAAA;;;;;;;;;UASL,IAAI,CAAC,YAAY;;KAEtB,CAAC;IACJ,CAAC;CAGF,CAAA;AA1BC;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAG,CAAC;2DACjB;AAXf,qBAAqB;IADjC,aAAa,CAAC,yBAAyB,CAAC;GAC5B,qBAAqB,CAqCjC;SArCY,qBAAqB;AAuClC,eAAe,qBAAqB,CAAC","sourcesContent":["/**\n * Copyright Aquera Inc 2023\n *\n * This source code is licensed under the BSD-3-Clause license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport {\n LitElement,\n html,\n property,\n CSSResultArray,\n TemplateResult,\n} from 'lit-element';\nimport { customElement } from 'lit/decorators.js';\nimport { styles } from './nile-error-notification.css';\n\n/**\n * Nile icon component.\n *\n * @tag nile-error-notification\n *\n */\n@customElement('nile-error-notification')\nexport class NileErrorNotification extends LitElement {\n /**\n * The styles for ErrorNotification\n * @remarks If you are extending this class you can extend the base styles with super. Eg `return [super(), myCustomStyles]`\n */\n public static get styles(): CSSResultArray {\n return [styles];\n }\n\n // Represents the error message to be displayed to the user.\n @property({ type: String, reflect: true })\n errorMessage: string = '';\n\n /* #endregion */\n\n /* #region Methods */\n\n /**\n * Render method\n * @slot This is a slot test\n */\n public render(): TemplateResult {\n return html`\n <div class=\"nile-error-notification\">\n <nile-icon\n name=\"info2\"\n size=\"14\"\n class=\"nile-error-notification__icon\"\n part=\"icon\"\n color=\"#E5434D\"\n ></nile-icon>\n ${this.errorMessage}\n </div>\n `;\n }\n\n /* #endregion */\n}\n\nexport default NileErrorNotification;\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nile-error-notification': NileErrorNotification;\n }\n}\n"]}
1
+ {"version":3,"file":"nile-error-notification.js","sourceRoot":"","sources":["../../../src/nile-error-notification/nile-error-notification.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;AAEH,OAAO,EACL,UAAU,EACV,IAAI,EACJ,QAAQ,GAGT,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,+BAA+B,CAAC;AAEvD;;;;;GAKG;AAEI,IAAM,qBAAqB,GAA3B,MAAM,qBAAsB,SAAQ,UAAU;IAA9C;;QASL,4DAA4D;QAChB,iBAAY,GAAW,EAAE,CAAC;QAE1B,UAAK,GAAW,EAAE,CAAC;QAgC/D,gBAAgB;IAClB,CAAC;IA5CC;;;OAGG;IACI,MAAM,KAAK,MAAM;QACtB,OAAO,CAAC,MAAM,CAAC,CAAC;IAClB,CAAC;IAOD,iBAAiB;QACf,KAAK,CAAC,iBAAiB,EAAE,CAAC;QAC1B,IAAG,IAAI,CAAC,KAAK,EAAC;YACZ,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,oBAAoB,EAAC,IAAI,CAAC,KAAK,CAAC,CAAA;SACxD;IACH,CAAC;IAED,gBAAgB;IAEhB,qBAAqB;IAErB;;;OAGG;IACI,MAAM;QACX,OAAO,IAAI,CAAA;;;;;;;;;UASL,IAAI,CAAC,YAAY;;KAEtB,CAAC;IACJ,CAAC;CAGF,CAAA;AAnC6C;IAA3C,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAG,CAAC;2DAA2B;AAE1B;IAA3C,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAG,CAAC;oDAAoB;AAZpD,qBAAqB;IADjC,aAAa,CAAC,yBAAyB,CAAC;GAC5B,qBAAqB,CA6CjC;SA7CY,qBAAqB;AA+ClC,eAAe,qBAAqB,CAAC","sourcesContent":["/**\n * Copyright Aquera Inc 2023\n *\n * This source code is licensed under the BSD-3-Clause license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport {\n LitElement,\n html,\n property,\n CSSResultArray,\n TemplateResult,\n} from 'lit-element';\nimport { customElement } from 'lit/decorators.js';\nimport { styles } from './nile-error-notification.css';\n\n/**\n * Nile icon component.\n *\n * @tag nile-error-notification\n *\n */\n@customElement('nile-error-notification')\nexport class NileErrorNotification extends LitElement {\n /**\n * The styles for ErrorNotification\n * @remarks If you are extending this class you can extend the base styles with super. Eg `return [super(), myCustomStyles]`\n */\n public static get styles(): CSSResultArray {\n return [styles];\n }\n\n // Represents the error message to be displayed to the user.\n @property({ type: String, reflect: true }) errorMessage: string = '';\n\n @property({ type: String, reflect: true }) color: string = '';\n \n connectedCallback(): void {\n super.connectedCallback();\n if(this.color){\n this.style.setProperty('--indication-color',this.color)\n }\n }\n\n /* #endregion */\n\n /* #region Methods */\n\n /**\n * Render method\n * @slot This is a slot test\n */\n public render(): TemplateResult {\n return html`\n <div class=\"nile-error-notification\">\n <nile-icon\n name=\"info2\"\n size=\"14\"\n class=\"nile-error-notification__icon\"\n part=\"icon\"\n color=\"var(--indication-color)\"\n ></nile-icon>\n ${this.errorMessage}\n </div>\n `;\n }\n\n /* #endregion */\n}\n\nexport default NileErrorNotification;\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nile-error-notification': NileErrorNotification;\n }\n}\n"]}