@aquera/nile-elements 0.1.67-beta-2.2 → 0.1.67-beta-2.3

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 (27) hide show
  1. package/dist/index.js +63 -51
  2. package/dist/nile-rich-text-editor/nile-rich-text-editor.cjs.js +1 -1
  3. package/dist/nile-rich-text-editor/nile-rich-text-editor.cjs.js.map +1 -1
  4. package/dist/nile-rich-text-editor/nile-rich-text-editor.css.cjs.js +1 -1
  5. package/dist/nile-rich-text-editor/nile-rich-text-editor.css.cjs.js.map +1 -1
  6. package/dist/nile-rich-text-editor/nile-rich-text-editor.css.esm.js +22 -12
  7. package/dist/nile-rich-text-editor/nile-rich-text-editor.esm.js +1 -1
  8. package/dist/nile-rich-text-editor/nile-rte-select.cjs.js +1 -1
  9. package/dist/nile-rich-text-editor/nile-rte-select.cjs.js.map +1 -1
  10. package/dist/nile-rich-text-editor/nile-rte-select.esm.js +4 -2
  11. package/dist/nile-rich-text-editor/nile-rte-toolbar.cjs.js.map +1 -1
  12. package/dist/src/nile-rich-text-editor/nile-rich-text-editor.css.js +22 -12
  13. package/dist/src/nile-rich-text-editor/nile-rich-text-editor.css.js.map +1 -1
  14. package/dist/src/nile-rich-text-editor/nile-rich-text-editor.d.ts +2 -2
  15. package/dist/src/nile-rich-text-editor/nile-rich-text-editor.js +41 -12
  16. package/dist/src/nile-rich-text-editor/nile-rich-text-editor.js.map +1 -1
  17. package/dist/src/nile-rich-text-editor/nile-rte-select.js +5 -3
  18. package/dist/src/nile-rich-text-editor/nile-rte-select.js.map +1 -1
  19. package/dist/src/nile-rich-text-editor/nile-rte-toolbar.js +2 -2
  20. package/dist/src/nile-rich-text-editor/nile-rte-toolbar.js.map +1 -1
  21. package/dist/tsconfig.tsbuildinfo +1 -1
  22. package/package.json +1 -1
  23. package/src/nile-rich-text-editor/nile-rich-text-editor.css.ts +22 -12
  24. package/src/nile-rich-text-editor/nile-rich-text-editor.ts +53 -15
  25. package/src/nile-rich-text-editor/nile-rte-select.ts +5 -3
  26. package/src/nile-rich-text-editor/nile-rte-toolbar.ts +2 -2
  27. package/vscode-html-custom-data.json +8 -3
@@ -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","lit","lit/decorators.js"],function(_export,_context){"use strict";var t,e,n,i,l,r,_templateObject,_templateObject2,_templateObject3,_templateObject4,_templateObject5,_templateObject6,_templateObject7,s,o;function _taggedTemplateLiteral(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}));}function _classCallCheck(a,n){if(!(a instanceof n))throw new TypeError("Cannot call a class as a function");}function _defineProperties(e,r){for(var t=0;t<r.length;t++){var o=r[t];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,_toPropertyKey(o.key),o);}}function _createClass(e,r,t){return r&&_defineProperties(e.prototype,r),t&&_defineProperties(e,t),Object.defineProperty(e,"prototype",{writable:!1}),e;}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(t,e){if(e&&("object"==_typeof(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized(t);}function _assertThisInitialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e;}function _isNativeReflectConstruct(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));}catch(t){}return(_isNativeReflectConstruct=function _isNativeReflectConstruct(){return!!t;})();}function _superPropGet(t,o,e,r){var p=_get(_getPrototypeOf(1&r?t.prototype:t),o,e);return 2&r&&"function"==typeof p?function(t){return p.apply(e,t);}:p;}function _get(){return _get="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,r){var p=_superPropBase(e,t);if(p){var n=Object.getOwnPropertyDescriptor(p,t);return n.get?n.get.call(arguments.length<3?e:r):n.value;}},_get.apply(null,arguments);}function _superPropBase(t,o){for(;!{}.hasOwnProperty.call(t,o)&&null!==(t=_getPrototypeOf(t)););return t;}function _getPrototypeOf(t){return _getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t);},_getPrototypeOf(t);}function _inherits(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&_setPrototypeOf(t,e);}function _setPrototypeOf(t,e){return _setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t;},_setPrototypeOf(t,e);}function a(t){return s.has(t);}return{setters:[function(_tslib){t=_tslib.__decorate;},function(_lit){e=_lit.LitElement;n=_lit.html;},function(_litDecoratorsJs){i=_litDecoratorsJs.property;l=_litDecoratorsJs.state;r=_litDecoratorsJs.customElement;}],execute:function execute(){s=new Set(["p","h1","h2","h3","h4","h5","h6"]);o=/*#__PURE__*/function(_e){function o(){var _this;_classCallCheck(this,o);_this=_callSuper(this,o,arguments),_this.type="",_this.options="[]",_this.label="",_this.selectedValue="";return _this;}_inherits(o,_e);return _createClass(o,[{key:"createRenderRoot",value:function createRenderRoot(){return this;}},{key:"mapAlignIcon",value:function mapAlignIcon(t){return{left:"format_align_left",center:"format_align_middle",right:"format_align_right",justify:"format_align_justify"}[t]||"format_align_left";}},{key:"parsedOptions",get:function get(){var _this$optionsObj,_this2=this;var t=(_this$optionsObj=this.optionsObj)!==null&&_this$optionsObj!==void 0?_this$optionsObj:this.options;var e=function(){if(Array.isArray(t))return t;try{return JSON.parse(String(t));}catch(_unused){return[];}}();"align"===this.type&&0===e.length&&(e=[{value:"left",label:"Align Left"},{value:"center",label:"Align Center"},{value:"right",label:"Align Right"},{value:"justify",label:"Justify"}]);var n=e.map(function(t){var _t$value,_ref,_t$label,_t$icon;var e=(_t$value=t===null||t===void 0?void 0:t.value)!==null&&_t$value!==void 0?_t$value:t;return{value:e,label:(_ref=(_t$label=t===null||t===void 0?void 0:t.label)!==null&&_t$label!==void 0?_t$label:t===null||t===void 0?void 0:t.value)!==null&&_ref!==void 0?_ref:t,icon:(_t$icon=t===null||t===void 0?void 0:t.icon)!==null&&_t$icon!==void 0?_t$icon:"align"===_this2.type?_this2.mapAlignIcon(String(e)):void 0};});if("heading"===this.type){n.length;n=n.filter(function(t){return a(t.value);}),n.length,this.selectedValue&&!a(this.selectedValue)&&(this.selectedValue="");}return n;}},{key:"ensureDefault",value:function ensureDefault(){if(!this.selectedValue){var _t=this.parsedOptions[0];_t&&(this.selectedValue=_t.value);}}},{key:"onSelect",value:function onSelect(t){"heading"!==this.type||a(t)?(this.selectedValue=t,this.dispatchEvent(new CustomEvent("change",{detail:t,bubbles:!0,composed:!0}))):console.warn("[nile-rte-select] Ignoring invalid heading value: ".concat(t));}},{key:"connectedCallback",value:function connectedCallback(){_superPropGet(o,"connectedCallback",this,3)([]),this.injectLocalStyles();}},{key:"injectLocalStyles",value:function injectLocalStyles(){if(this.querySelector("style[data-rte-select-style]"))return;var t=document.createElement("style");t.setAttribute("data-rte-select-style","true"),t.textContent="\n nile-menu.rte-align-menu::part(menu__items-wrapper) {\n display: flex;\n }\n nile-menu.rte-align-menu,\n nile-menu.rte-default-menu {\n margin-top: 0px;\n }\n nile-button.rte-align-trigger::part(base),\n nile-button.rte-default-trigger::part(base) {\n min-width: 32px;\n height: 32px;\n padding: 0px 6px;\n box-shadow: none;\n }\n nile-button.rte-align-trigger::part(base) {\n \n\n border: none;\n}\n ",this.insertBefore(t,this.firstChild);}},{key:"render",value:function render(){var _this3=this;var t=this.parsedOptions;this.ensureDefault();var e=t.find(function(t){return t.value===_this3.selectedValue;});if("align"===this.type){var _i=e!==null&&e!==void 0&&e.icon?n(_templateObject||(_templateObject=_taggedTemplateLiteral(["<nile-icon name=\"","\"></nile-icon>"])),e.icon):this.label||"Align";return n(_templateObject2||(_templateObject2=_taggedTemplateLiteral(["\n <nile-dropdown class=\"rte-align-dd\">\n <nile-button slot=\"trigger\" variant=\"tertiary\" class=\"rte-align-trigger\">\n ","\n </nile-button>\n <nile-menu class=\"rte-align-menu\">\n ","\n </nile-menu>\n </nile-dropdown>\n "])),_i,t.map(function(t){return n(_templateObject3||(_templateObject3=_taggedTemplateLiteral(["\n <nile-menu-item\n class=\"rte-align-item\"\n ?active=","\n @click=",">\n <nile-icon name=\"","\"></nile-icon>\n </nile-menu-item>\n "])),t.value===_this3.selectedValue,function(){return _this3.onSelect(t.value);},t.icon);}));}if("font"===this.type){var _i2=(e===null||e===void 0?void 0:e.label)||this.label||"Font";return n(_templateObject4||(_templateObject4=_taggedTemplateLiteral(["\n <nile-dropdown class=\"rte-default-dd\">\n <nile-button\n slot=\"trigger\"\n variant=\"tertiary\"\n class=\"rte-default-trigger\"\n style=\"font-family: ","\">\n "," <nile-icon name=\"arrowdown\"></nile-icon>\n </nile-button>\n <nile-menu class=\"rte-default-menu\">\n ","\n </nile-menu>\n </nile-dropdown>\n "])),(e===null||e===void 0?void 0:e.value)||"inherit",_i2,t.map(function(t){return n(_templateObject5||(_templateObject5=_taggedTemplateLiteral(["\n <nile-menu-item\n style=\"font-family: ","\"\n ?active=","\n @click=",">\n ","\n </nile-menu-item>\n "])),t.value,t.value===_this3.selectedValue,function(){return _this3.onSelect(t.value);},t.label);}));}var i=(e===null||e===void 0?void 0:e.label)||this.label||"Select";return n(_templateObject6||(_templateObject6=_taggedTemplateLiteral(["\n <nile-dropdown class=\"rte-default-dd\">\n <nile-button slot=\"trigger\" variant=\"tertiary\" class=\"rte-default-trigger\">\n "," <nile-icon name=\"arrowdown\"></nile-icon>\n </nile-button>\n <nile-menu class=\"rte-default-menu\">\n ","\n </nile-menu>\n </nile-dropdown>\n "])),i,t.map(function(t){return n(_templateObject7||(_templateObject7=_taggedTemplateLiteral(["\n <nile-menu-item\n ?active=","\n @click=",">\n ","\n </nile-menu-item>\n "])),t.value===_this3.selectedValue,function(){return _this3.onSelect(t.value);},t.label);}));}}]);}(e);t([i({type:String})],o.prototype,"type",void 0),t([i({type:String})],o.prototype,"options",void 0),t([i({attribute:!1})],o.prototype,"optionsObj",void 0),t([i({type:String})],o.prototype,"label",void 0),t([l()],o.prototype,"selectedValue",void 0),o=t([r("nile-rte-select")],o);}};});
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","lit","lit/decorators.js"],function(_export,_context){"use strict";var t,e,n,i,l,r,_templateObject,_templateObject2,_templateObject3,_templateObject4,_templateObject5,_templateObject6,_templateObject7,s,o;function _taggedTemplateLiteral(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}));}function _classCallCheck(a,n){if(!(a instanceof n))throw new TypeError("Cannot call a class as a function");}function _defineProperties(e,r){for(var t=0;t<r.length;t++){var o=r[t];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,_toPropertyKey(o.key),o);}}function _createClass(e,r,t){return r&&_defineProperties(e.prototype,r),t&&_defineProperties(e,t),Object.defineProperty(e,"prototype",{writable:!1}),e;}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(t,e){if(e&&("object"==_typeof(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized(t);}function _assertThisInitialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e;}function _isNativeReflectConstruct(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));}catch(t){}return(_isNativeReflectConstruct=function _isNativeReflectConstruct(){return!!t;})();}function _superPropGet(t,o,e,r){var p=_get(_getPrototypeOf(1&r?t.prototype:t),o,e);return 2&r&&"function"==typeof p?function(t){return p.apply(e,t);}:p;}function _get(){return _get="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,r){var p=_superPropBase(e,t);if(p){var n=Object.getOwnPropertyDescriptor(p,t);return n.get?n.get.call(arguments.length<3?e:r):n.value;}},_get.apply(null,arguments);}function _superPropBase(t,o){for(;!{}.hasOwnProperty.call(t,o)&&null!==(t=_getPrototypeOf(t)););return t;}function _getPrototypeOf(t){return _getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t);},_getPrototypeOf(t);}function _inherits(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&_setPrototypeOf(t,e);}function _setPrototypeOf(t,e){return _setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t;},_setPrototypeOf(t,e);}function a(t){return s.has(t);}return{setters:[function(_tslib){t=_tslib.__decorate;},function(_lit){e=_lit.LitElement;n=_lit.html;},function(_litDecoratorsJs){i=_litDecoratorsJs.property;l=_litDecoratorsJs.state;r=_litDecoratorsJs.customElement;}],execute:function execute(){s=new Set(["p","h1","h2","h3","h4","h5","h6"]);o=/*#__PURE__*/function(_e){function o(){var _this;_classCallCheck(this,o);_this=_callSuper(this,o,arguments),_this.type="",_this.options="[]",_this.label="",_this.selectedValue="";return _this;}_inherits(o,_e);return _createClass(o,[{key:"createRenderRoot",value:function createRenderRoot(){return this;}},{key:"mapAlignIcon",value:function mapAlignIcon(t){return{left:"format_align_left",center:"format_align_middle",right:"format_align_right",justify:"format_align_justify"}[t]||"format_align_left";}},{key:"parsedOptions",get:function get(){var _this$optionsObj,_this2=this;var t=(_this$optionsObj=this.optionsObj)!==null&&_this$optionsObj!==void 0?_this$optionsObj:this.options;var e=function(){if(Array.isArray(t))return t;try{return JSON.parse(String(t));}catch(_unused){return[];}}();"align"===this.type&&0===e.length&&(e=[{value:"left",label:"Align Left"},{value:"center",label:"Align Center"},{value:"right",label:"Align Right"},{value:"justify",label:"Justify"}]);var n=e.map(function(t){var _t$value,_ref,_t$label,_t$icon;var e=(_t$value=t===null||t===void 0?void 0:t.value)!==null&&_t$value!==void 0?_t$value:t;return{value:e,label:(_ref=(_t$label=t===null||t===void 0?void 0:t.label)!==null&&_t$label!==void 0?_t$label:t===null||t===void 0?void 0:t.value)!==null&&_ref!==void 0?_ref:t,icon:(_t$icon=t===null||t===void 0?void 0:t.icon)!==null&&_t$icon!==void 0?_t$icon:"align"===_this2.type?_this2.mapAlignIcon(String(e)):void 0};});if("heading"===this.type){n.length;n=n.filter(function(t){return a(t.value);}),n.length,this.selectedValue&&!a(this.selectedValue)&&(this.selectedValue="");}return n;}},{key:"ensureDefault",value:function ensureDefault(){if(!this.selectedValue){var _t=this.parsedOptions[0];_t&&(this.selectedValue=_t.value);}}},{key:"onSelect",value:function onSelect(t){"heading"!==this.type||a(t)?(this.selectedValue=t,this.dispatchEvent(new CustomEvent("change",{detail:t,bubbles:!0,composed:!0}))):console.warn("[nile-rte-select] Ignoring invalid heading value: ".concat(t));}},{key:"connectedCallback",value:function connectedCallback(){_superPropGet(o,"connectedCallback",this,3)([]),this.injectLocalStyles();}},{key:"injectLocalStyles",value:function injectLocalStyles(){if(this.querySelector("style[data-rte-select-style]"))return;var t=document.createElement("style");t.setAttribute("data-rte-select-style","true"),t.textContent="\n nile-menu.rte-align-menu::part(menu__items-wrapper) {\n display: flex;\n }\n nile-menu.rte-align-menu,\n nile-menu.rte-default-menu {\n margin-top: 0px;\n }\n nile-button.rte-align-trigger::part(base),\n nile-button.rte-default-trigger::part(base) {\n min-width: 32px;\n height: 32px;\n padding: 0px 6px;\n box-shadow: none;\n }\n nile-button.rte-align-trigger::part(base) {\n\n border: none;\n}\n\n \n ",this.insertBefore(t,this.firstChild);}},{key:"render",value:function render(){var _this3=this;var t=this.parsedOptions;this.ensureDefault();var e=t.find(function(t){return t.value===_this3.selectedValue;});if("align"===this.type){var _i=e!==null&&e!==void 0&&e.icon?n(_templateObject||(_templateObject=_taggedTemplateLiteral(["<nile-icon name=\"","\"></nile-icon>"])),e.icon):this.label||"Align";return n(_templateObject2||(_templateObject2=_taggedTemplateLiteral(["\n <nile-dropdown class=\"rte-align-dd\">\n <nile-button slot=\"trigger\" variant=\"tertiary\" class=\"rte-align-trigger\">\n ","\n </nile-button>\n <nile-menu class=\"rte-align-menu\">\n ","\n </nile-menu>\n </nile-dropdown>\n "])),_i,t.map(function(t){return n(_templateObject3||(_templateObject3=_taggedTemplateLiteral(["\n <nile-menu-item\n class=\"rte-align-item\"\n ?active=","\n @click=",">\n <nile-tooltip hoist content=\"","\">\n <nile-icon name=\"","\"></nile-icon>\n </nile-tooltip>\n </nile-menu-item>\n "])),t.value===_this3.selectedValue,function(){return _this3.onSelect(t.value);},t.label,t.icon);}));}if("font"===this.type){var _i2=(e===null||e===void 0?void 0:e.label)||this.label||"Font";return n(_templateObject4||(_templateObject4=_taggedTemplateLiteral(["\n <nile-dropdown class=\"rte-default-dd\">\n <nile-button\n slot=\"trigger\"\n variant=\"tertiary\"\n class=\"rte-default-trigger\"\n style=\"font-family: ","\">\n "," <nile-icon name=\"arrowdown\"></nile-icon>\n </nile-button>\n <nile-menu class=\"rte-default-menu\">\n ","\n </nile-menu>\n </nile-dropdown>\n "])),(e===null||e===void 0?void 0:e.value)||"inherit",_i2,t.map(function(t){return n(_templateObject5||(_templateObject5=_taggedTemplateLiteral(["\n <nile-menu-item\n style=\"font-family: ","\"\n ?active=","\n @click=",">\n ","\n </nile-menu-item>\n "])),t.value,t.value===_this3.selectedValue,function(){return _this3.onSelect(t.value);},t.label);}));}var i=(e===null||e===void 0?void 0:e.label)||this.label||"Select";return n(_templateObject6||(_templateObject6=_taggedTemplateLiteral(["\n <nile-dropdown class=\"rte-default-dd\">\n <nile-button slot=\"trigger\" variant=\"tertiary\" class=\"rte-default-trigger\">\n "," <nile-icon name=\"arrowdown\"></nile-icon>\n </nile-button>\n <nile-menu class=\"rte-default-menu\">\n ","\n </nile-menu>\n </nile-dropdown>\n "])),i,t.map(function(t){return n(_templateObject7||(_templateObject7=_taggedTemplateLiteral(["\n <nile-menu-item\n ?active=","\n @click=",">\n ","\n </nile-menu-item>\n "])),t.value===_this3.selectedValue,function(){return _this3.onSelect(t.value);},t.label);}));}}]);}(e);t([i({type:String})],o.prototype,"type",void 0),t([i({type:String})],o.prototype,"options",void 0),t([i({attribute:!1})],o.prototype,"optionsObj",void 0),t([i({type:String})],o.prototype,"label",void 0),t([l()],o.prototype,"selectedValue",void 0),o=t([r("nile-rte-select")],o);}};});
2
2
  //# sourceMappingURL=nile-rte-select.cjs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"nile-rte-select.cjs.js","sources":["../../../src/nile-rich-text-editor/nile-rte-select.ts"],"sourcesContent":["// nile-rte-select.ts\nimport { LitElement, html } from 'lit';\nimport { customElement, property, state } from 'lit/decorators.js';\n\ntype HeadingTag = 'p' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';\ntype GenericOption = { value: string; label?: string; icon?: string };\ntype HeadingOption = { value: HeadingTag; label?: string; icon?: string };\ntype NormalizedOption = { value: string; label: string; icon?: string };\n\nconst HEADING_ALLOWLIST: ReadonlySet<HeadingTag> = new Set([\n 'p', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6'\n]);\n\nfunction isHeadingTag(v: string): v is HeadingTag {\n return HEADING_ALLOWLIST.has(v as HeadingTag);\n}\n\n@customElement('nile-rte-select')\nexport class NileRteSelect extends LitElement {\n protected createRenderRoot() { return this; }\n\n /** 'heading' | 'font' | 'align' */\n @property({ type: String }) type = '';\n\n /** JSON: [{ value, label?, icon? }, ...] (attribute-based; runtime-validated) */\n @property({ type: String }) options = '[]';\n\n /** Programmatic options (preferred for TS safety). */\n @property({ attribute: false })\n optionsObj?: Array<GenericOption | HeadingOption>;\n\n /** Fallback label for trigger (e.g., \"Align\") */\n @property({ type: String }) label = '';\n\n @state() private selectedValue = '';\n\n private mapAlignIcon(v: string) {\n const map: Record<string,string> = {\n left: 'format_align_left',\n center: 'format_align_middle',\n right: 'format_align_right',\n justify: 'format_align_justify'\n };\n return map[v] || 'format_align_left';\n }\n private get parsedOptions(): NormalizedOption[] {\n const source: unknown = this.optionsObj ?? this.options;\n \n let rawArray: any[] = (() => {\n if (Array.isArray(source)) return source;\n try { return JSON.parse(String(source)); } catch { return []; }\n })();\n \n \n if (this.type === 'align' && rawArray.length === 0) {\n rawArray = [\n { value: 'left', label: 'Align Left' },\n { value: 'center', label: 'Align Center' },\n { value: 'right', label: 'Align Right' },\n { value: 'justify', label: 'Justify' }\n ];\n }\n \n let items: NormalizedOption[] = rawArray.map((o: any) => {\n const value: string = o?.value ?? o;\n const label: string = o?.label ?? o?.value ?? o;\n const icon: string | undefined =\n o?.icon ?? (this.type === 'align' ? this.mapAlignIcon(String(value)) : undefined);\n return { value, label, icon };\n });\n \n \n if (this.type === 'heading') {\n const before = items.length;\n items = items.filter(i => isHeadingTag(i.value));\n if (items.length !== before) {\n \n }\n if (this.selectedValue && !isHeadingTag(this.selectedValue)) {\n this.selectedValue = '';\n }\n }\n \n return items;\n }\n \n\n private ensureDefault() {\n if (!this.selectedValue) {\n const first = this.parsedOptions[0];\n if (first) this.selectedValue = first.value;\n }\n }\n\n private onSelect(value: string) {\n if (this.type === 'heading' && !isHeadingTag(value)) {\n console.warn(`[nile-rte-select] Ignoring invalid heading value: ${value}`);\n return;\n }\n this.selectedValue = value;\n this.dispatchEvent(new CustomEvent('change', {\n detail: value, bubbles: true, composed: true\n }));\n }\n\n connectedCallback(): void {\n super.connectedCallback();\n this.injectLocalStyles();\n }\n\n private injectLocalStyles() {\n if (this.querySelector('style[data-rte-select-style]')) return;\n\n const style = document.createElement('style');\n style.setAttribute('data-rte-select-style', 'true');\n style.textContent = `\n nile-menu.rte-align-menu::part(menu__items-wrapper) {\n display: flex;\n }\n nile-menu.rte-align-menu,\n nile-menu.rte-default-menu {\n margin-top: 0px;\n }\n nile-button.rte-align-trigger::part(base),\n nile-button.rte-default-trigger::part(base) {\n min-width: 32px;\n height: 32px;\n padding: 0px 6px;\n box-shadow: none;\n }\n nile-button.rte-align-trigger::part(base) {\n \n\n border: none;\n}\n `;\n this.insertBefore(style, this.firstChild);\n }\n\n render() {\n const opts = this.parsedOptions;\n this.ensureDefault();\n const current = opts.find(o => o.value === this.selectedValue);\n\n // ► Align: icon-only items + icon trigger\n if (this.type === 'align') {\n const trigger = current?.icon\n ? html`<nile-icon name=\"${current.icon}\"></nile-icon>`\n : (this.label || 'Align');\n\n return html`\n <nile-dropdown class=\"rte-align-dd\">\n <nile-button slot=\"trigger\" variant=\"tertiary\" class=\"rte-align-trigger\">\n ${trigger}\n </nile-button>\n <nile-menu class=\"rte-align-menu\">\n ${opts.map(o => html`\n <nile-menu-item\n class=\"rte-align-item\"\n ?active=${o.value === this.selectedValue}\n @click=${() => this.onSelect(o.value)}>\n <nile-icon name=\"${o.icon}\"></nile-icon>\n </nile-menu-item>\n `)}\n </nile-menu>\n </nile-dropdown>\n `;\n }\n\n // ► Font: show labels, preview fonts in items and trigger\n if (this.type === 'font') {\n const triggerText = current?.label || this.label || 'Font';\n return html`\n <nile-dropdown class=\"rte-default-dd\">\n <nile-button\n slot=\"trigger\"\n variant=\"tertiary\"\n class=\"rte-default-trigger\"\n style=\"font-family: ${current?.value || 'inherit'}\">\n ${triggerText} <nile-icon name=\"arrowdown\"></nile-icon>\n </nile-button>\n <nile-menu class=\"rte-default-menu\">\n ${opts.map(o => html`\n <nile-menu-item\n style=\"font-family: ${o.value}\"\n ?active=${o.value === this.selectedValue}\n @click=${() => this.onSelect(o.value)}>\n ${o.label}\n </nile-menu-item>\n `)}\n </nile-menu>\n </nile-dropdown>\n `;\n }\n\n // ► Default (e.g., heading): text items; heading values are validated already\n const triggerText = current?.label || this.label || 'Select';\n return html`\n <nile-dropdown class=\"rte-default-dd\">\n <nile-button slot=\"trigger\" variant=\"tertiary\" class=\"rte-default-trigger\">\n ${triggerText} <nile-icon name=\"arrowdown\"></nile-icon>\n </nile-button>\n <nile-menu class=\"rte-default-menu\">\n ${opts.map(o => html`\n <nile-menu-item\n ?active=${o.value === this.selectedValue}\n @click=${() => this.onSelect(o.value)}>\n ${o.label}\n </nile-menu-item>\n `)}\n </nile-menu>\n </nile-dropdown>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nile-rte-select': NileRteSelect;\n }\n}\n"],"names":["isHeadingTag","v","HEADING_ALLOWLIST","has","setters","_tslib","Set","NileRteSelect","o","this","type","options","label","selectedValue","_this","_inherits","_e","_createClass","key","value","createRenderRoot","mapAlignIcon","left","center","right","justify","get","_this$optionsObj","_this2","source","optionsObj","rawArray","Array","isArray","JSON","parse","String","_unused","length","items","map","_t$value","_ref","_t$label","_t$icon","icon","undefined","filter","i","ensureDefault","first","parsedOptions","onSelect","dispatchEvent","CustomEvent","detail","bubbles","composed","console","warn","concat","connectedCallback","super","injectLocalStyles","querySelector","style","document","createElement","setAttribute","textContent","insertBefore","firstChild","render","opts","current","find","trigger","html","_templateObject","_taggedTemplateLiteral","_templateObject2","_templateObject3","triggerText","_templateObject4","_templateObject5","_templateObject6","_templateObject7","__decorate","LitElement","property","prototype","attribute","state","customElement"],"mappings":"i2GAaA,QAASA,CAAAA,CAAAA,CAAaC,GACpB,MAAOC,CAAAA,CAAAA,CAAkBC,GAAIF,CAAAA,CAAAA,CAC/B,EAGO,OAAAG,OAAA,WAAAC,MAAA,sNATDH,CAA6C,CAAA,GAAII,CAAAA,GAAI,CAAA,CACzD,IAAK,IAAM,CAAA,IAAA,CAAM,IAAM,CAAA,IAAA,CAAM,IAAM,CAAA,IAAA,CAAA,CAAA,CAQxBC,CAAAA,uBAAAA,EAAAA,EAAN,SAAAC,EAAA,qEAIuBC,EAAAA,KAAAA,CAAIC,IAAG,CAAA,EAAA,CAGPD,KAAAA,CAAOE,OAAAA,CAAG,KAOVF,KAAAA,CAAKG,KAAAA,CAAG,EAEnBH,CAAAA,KAAAA,CAAaI,cAAG,EAoLlC,QAAAC,KAAA,EAnMWC,SAAA,CAAAP,CAAA,CAAAQ,EAAA,SAAAC,YAAA,CAAAT,CAAA,GAAAU,GAAA,oBAAAC,KAAA,UAAAC,gBAAAA,CAAAA,CAAAA,CAAqB,MAAOX,KAAO,EAiBrC,GAAAS,GAAA,gBAAAC,KAAA,UAAAE,YAAAA,CAAapB,CAOnB,CAAA,CAAA,MANmC,CACjCqB,IAAAA,CAAM,oBACNC,MAAQ,CAAA,qBAAA,CACRC,KAAO,CAAA,oBAAA,CACPC,QAAS,sBAEAxB,CAAAA,CAAAA,CAAAA,CAAAA,EAAM,mB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ts\nimport { LitElement, html } from 'lit';\nimport { customElement, property, state } from 'lit/decorators.js';\n\ntype HeadingTag = 'p' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';\ntype GenericOption = { value: string; label?: string; icon?: string };\ntype HeadingOption = { value: HeadingTag; label?: string; icon?: string };\ntype NormalizedOption = { value: string; label: string; icon?: string };\n\nconst HEADING_ALLOWLIST: ReadonlySet<HeadingTag> = new Set([\n 'p', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6'\n]);\n\nfunction isHeadingTag(v: string): v is HeadingTag {\n return HEADING_ALLOWLIST.has(v as HeadingTag);\n}\n\n@customElement('nile-rte-select')\nexport class NileRteSelect extends LitElement {\n protected createRenderRoot() { return this; }\n\n /** 'heading' | 'font' | 'align' */\n @property({ type: String }) type = '';\n\n /** JSON: [{ value, label?, icon? }, ...] (attribute-based; runtime-validated) */\n @property({ type: String }) options = '[]';\n\n /** Programmatic options (preferred for TS safety). */\n @property({ attribute: false })\n optionsObj?: Array<GenericOption | HeadingOption>;\n\n /** Fallback label for trigger (e.g., \"Align\") */\n @property({ type: String }) label = '';\n\n @state() private selectedValue = '';\n\n private mapAlignIcon(v: string) {\n const map: Record<string,string> = {\n left: 'format_align_left',\n center: 'format_align_middle',\n right: 'format_align_right',\n justify: 'format_align_justify'\n };\n return map[v] || 'format_align_left';\n }\n private get parsedOptions(): NormalizedOption[] {\n const source: unknown = this.optionsObj ?? this.options;\n \n let rawArray: any[] = (() => {\n if (Array.isArray(source)) return source;\n try { return JSON.parse(String(source)); } catch { return []; }\n })();\n \n \n if (this.type === 'align' && rawArray.length === 0) {\n rawArray = [\n { value: 'left', label: 'Align Left' },\n { value: 'center', label: 'Align Center' },\n { value: 'right', label: 'Align Right' },\n { value: 'justify', label: 'Justify' }\n ];\n }\n \n let items: NormalizedOption[] = rawArray.map((o: any) => {\n const value: string = o?.value ?? o;\n const label: string = o?.label ?? o?.value ?? o;\n const icon: string | undefined =\n o?.icon ?? (this.type === 'align' ? this.mapAlignIcon(String(value)) : undefined);\n return { value, label, icon };\n });\n \n \n if (this.type === 'heading') {\n const before = items.length;\n items = items.filter(i => isHeadingTag(i.value));\n if (items.length !== before) {\n \n }\n if (this.selectedValue && !isHeadingTag(this.selectedValue)) {\n this.selectedValue = '';\n }\n }\n \n return items;\n }\n \n\n private ensureDefault() {\n if (!this.selectedValue) {\n const first = this.parsedOptions[0];\n if (first) this.selectedValue = first.value;\n }\n }\n\n private onSelect(value: string) {\n if (this.type === 'heading' && !isHeadingTag(value)) {\n console.warn(`[nile-rte-select] Ignoring invalid heading value: ${value}`);\n return;\n }\n this.selectedValue = value;\n this.dispatchEvent(new CustomEvent('change', {\n detail: value, bubbles: true, composed: true\n }));\n }\n\n connectedCallback(): void {\n super.connectedCallback();\n this.injectLocalStyles();\n }\n\n private injectLocalStyles() {\n if (this.querySelector('style[data-rte-select-style]')) return;\n\n const style = document.createElement('style');\n style.setAttribute('data-rte-select-style', 'true');\n style.textContent = `\n nile-menu.rte-align-menu::part(menu__items-wrapper) {\n display: flex;\n }\n nile-menu.rte-align-menu,\n nile-menu.rte-default-menu {\n margin-top: 0px;\n }\n nile-button.rte-align-trigger::part(base),\n nile-button.rte-default-trigger::part(base) {\n min-width: 32px;\n height: 32px;\n padding: 0px 6px;\n box-shadow: none;\n }\n nile-button.rte-align-trigger::part(base) {\n\n border: none;\n}\n\n \n `;\n this.insertBefore(style, this.firstChild);\n }\n\n render() {\n const opts = this.parsedOptions;\n this.ensureDefault();\n const current = opts.find(o => o.value === this.selectedValue);\n\n // ► Align: icon-only items + icon trigger\n if (this.type === 'align') {\n const trigger = current?.icon\n ? html`<nile-icon name=\"${current.icon}\"></nile-icon>`\n : (this.label || 'Align');\n\n return html`\n <nile-dropdown class=\"rte-align-dd\">\n <nile-button slot=\"trigger\" variant=\"tertiary\" class=\"rte-align-trigger\">\n ${trigger}\n </nile-button>\n <nile-menu class=\"rte-align-menu\">\n ${opts.map(o => html`\n <nile-menu-item\n class=\"rte-align-item\"\n ?active=${o.value === this.selectedValue}\n @click=${() => this.onSelect(o.value)}>\n <nile-tooltip hoist content=\"${o.label}\">\n <nile-icon name=\"${o.icon}\"></nile-icon>\n </nile-tooltip>\n </nile-menu-item>\n `)}\n </nile-menu>\n </nile-dropdown>\n `;\n }\n\n if (this.type === 'font') {\n const triggerText = current?.label || this.label || 'Font';\n return html`\n <nile-dropdown class=\"rte-default-dd\">\n <nile-button\n slot=\"trigger\"\n variant=\"tertiary\"\n class=\"rte-default-trigger\"\n style=\"font-family: ${current?.value || 'inherit'}\">\n ${triggerText} <nile-icon name=\"arrowdown\"></nile-icon>\n </nile-button>\n <nile-menu class=\"rte-default-menu\">\n ${opts.map(o => html`\n <nile-menu-item\n style=\"font-family: ${o.value}\"\n ?active=${o.value === this.selectedValue}\n @click=${() => this.onSelect(o.value)}>\n ${o.label}\n </nile-menu-item>\n `)}\n </nile-menu>\n </nile-dropdown>\n `;\n }\n\n // ► Default (e.g., heading): text items; heading values are validated already\n const triggerText = current?.label || this.label || 'Select';\n return html`\n <nile-dropdown class=\"rte-default-dd\">\n <nile-button slot=\"trigger\" variant=\"tertiary\" class=\"rte-default-trigger\">\n ${triggerText} <nile-icon name=\"arrowdown\"></nile-icon>\n </nile-button>\n <nile-menu class=\"rte-default-menu\">\n ${opts.map(o => html`\n <nile-menu-item\n ?active=${o.value === this.selectedValue}\n @click=${() => this.onSelect(o.value)}>\n ${o.label}\n </nile-menu-item>\n `)}\n </nile-menu>\n </nile-dropdown>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nile-rte-select': NileRteSelect;\n }\n}\n"],"names":["isHeadingTag","v","HEADING_ALLOWLIST","has","setters","_tslib","Set","NileRteSelect","o","this","type","options","label","selectedValue","_this","_inherits","_e","_createClass","key","value","createRenderRoot","mapAlignIcon","left","center","right","justify","get","_this$optionsObj","_this2","source","optionsObj","rawArray","Array","isArray","JSON","parse","String","_unused","length","items","map","_t$value","_ref","_t$label","_t$icon","icon","undefined","filter","i","ensureDefault","first","parsedOptions","onSelect","dispatchEvent","CustomEvent","detail","bubbles","composed","console","warn","concat","connectedCallback","super","injectLocalStyles","querySelector","style","document","createElement","setAttribute","textContent","insertBefore","firstChild","render","opts","current","find","trigger","html","_templateObject","_taggedTemplateLiteral","_templateObject2","_templateObject3","triggerText","_templateObject4","_templateObject5","_templateObject6","_templateObject7","__decorate","LitElement","property","prototype","attribute","state","customElement"],"mappings":"i2GAaA,QAASA,CAAAA,CAAAA,CAAaC,GACpB,MAAOC,CAAAA,CAAAA,CAAkBC,GAAIF,CAAAA,CAAAA,CAC/B,EAGO,OAAAG,OAAA,WAAAC,MAAA,sNATDH,CAA6C,CAAA,GAAII,CAAAA,GAAI,CAAA,CACzD,IAAK,IAAM,CAAA,IAAA,CAAM,IAAM,CAAA,IAAA,CAAM,IAAM,CAAA,IAAA,CAAA,CAAA,CAQxBC,CAAAA,uBAAAA,EAAAA,EAAN,SAAAC,EAAA,qEAIuBC,EAAAA,KAAAA,CAAIC,IAAG,CAAA,EAAA,CAGPD,KAAAA,CAAOE,OAAAA,CAAG,KAOVF,KAAAA,CAAKG,KAAAA,CAAG,EAEnBH,CAAAA,KAAAA,CAAaI,cAAG,EAsLlC,QAAAC,KAAA,EArMWC,SAAA,CAAAP,CAAA,CAAAQ,EAAA,SAAAC,YAAA,CAAAT,CAAA,GAAAU,GAAA,oBAAAC,KAAA,UAAAC,gBAAAA,CAAAA,CAAAA,CAAqB,MAAOX,KAAO,EAiBrC,GAAAS,GAAA,gBAAAC,KAAA,UAAAE,YAAAA,CAAapB,CAOnB,CAAA,CAAA,MANmC,CACjCqB,IAAAA,CAAM,oBACNC,MAAQ,CAAA,qBAAA,CACRC,KAAO,CAAA,oBAAA,CACPC,QAAS,sBAEAxB,CAAAA,CAAAA,CAAAA,CAAAA,EAAM,mBAClB,EACD,GAAAiB,GAAA,iBAAAQ,GAAA,UAAAA,IAAA,CACE,KAAAC,gBAAA,CAAAC,MAAA,MAAA,GA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AA,SAAKqE,CAAAA,CAAI,CAAAS,gBAAA,GAAAA,gBAAA,CAAAP,sBAAA,yJAENvE,CAAAA,CAAEW,QAAUV,MAAKI,CAAAA,aAAAA,CAClB,iBAAMJ,CAAAA,MAAAA,CAAK2C,SAAS5C,CAAEW,CAAAA,KAAAA,CAAAA,GAC7BX,CAAEI,CAAAA,KAAAA,MAMf,CAjM2B2E,MAJKC,CAAAA,EAILD,CAAAA,CAAA,CAA3BE,CAAS,CAAA,CAAE/E,KAAM0B,MAAoB7B,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAmF,SAAA,CAAA,MAAA,CAAA,IAAA,EAGVH,CAAAA,CAAAA,CAAAA,CAAA,CAA3BE,CAAS,CAAA,CAAE/E,IAAM0B,CAAAA,MAAAA,CAAAA,CAAAA,CAAAA,CAAyB7B,CAAAmF,CAAAA,SAAAA,CAAA,cAAA,EAI3CH,CAAAA,CAAAA,CAAAA,CAAA,CADCE,CAAAA,CAAS,CAAEE,SAAAA,CAAAA,CAAW,KAC2BpF,CAAAmF,CAAAA,SAAAA,CAAA,YAAA,CAAA,IAAA,EAAA,CAAA,CAGtBH,CAAA,CAAA,CAA3BE,EAAS,CAAE/E,IAAAA,CAAM0B,MAAqB7B,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAmF,SAAA,CAAA,OAAA,CAAA,IAAA,IAEtBH,CAAA,CAAA,CAAhBK,CAAmCrF,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAmF,SAAA,CAAA,eAAA,CAAA,IAAA,IAhBzBnF,CAAagF,CAAAA,CAAAA,CAAA,CADzBM,CAAAA,CAAc,iBACFtF,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA"}
@@ -1,4 +1,4 @@
1
- import{__decorate as t}from"tslib";import{LitElement as e,html as n}from"lit";import{property as i,state as l,customElement as r}from"lit/decorators.js";const s=new Set(["p","h1","h2","h3","h4","h5","h6"]);function a(t){return s.has(t)}let o=class extends e{constructor(){super(...arguments),this.type="",this.options="[]",this.label="",this.selectedValue=""}createRenderRoot(){return this}mapAlignIcon(t){return{left:"format_align_left",center:"format_align_middle",right:"format_align_right",justify:"format_align_justify"}[t]||"format_align_left"}get parsedOptions(){const t=this.optionsObj??this.options;let e=(()=>{if(Array.isArray(t))return t;try{return JSON.parse(String(t))}catch{return[]}})();"align"===this.type&&0===e.length&&(e=[{value:"left",label:"Align Left"},{value:"center",label:"Align Center"},{value:"right",label:"Align Right"},{value:"justify",label:"Justify"}]);let n=e.map((t=>{const e=t?.value??t;return{value:e,label:t?.label??t?.value??t,icon:t?.icon??("align"===this.type?this.mapAlignIcon(String(e)):void 0)}}));if("heading"===this.type){n.length;n=n.filter((t=>a(t.value))),n.length,this.selectedValue&&!a(this.selectedValue)&&(this.selectedValue="")}return n}ensureDefault(){if(!this.selectedValue){const t=this.parsedOptions[0];t&&(this.selectedValue=t.value)}}onSelect(t){"heading"!==this.type||a(t)?(this.selectedValue=t,this.dispatchEvent(new CustomEvent("change",{detail:t,bubbles:!0,composed:!0}))):console.warn(`[nile-rte-select] Ignoring invalid heading value: ${t}`)}connectedCallback(){super.connectedCallback(),this.injectLocalStyles()}injectLocalStyles(){if(this.querySelector("style[data-rte-select-style]"))return;const t=document.createElement("style");t.setAttribute("data-rte-select-style","true"),t.textContent="\n nile-menu.rte-align-menu::part(menu__items-wrapper) {\n display: flex;\n }\n nile-menu.rte-align-menu,\n nile-menu.rte-default-menu {\n margin-top: 0px;\n }\n nile-button.rte-align-trigger::part(base),\n nile-button.rte-default-trigger::part(base) {\n min-width: 32px;\n height: 32px;\n padding: 0px 6px;\n box-shadow: none;\n }\n nile-button.rte-align-trigger::part(base) {\n \n\n border: none;\n}\n ",this.insertBefore(t,this.firstChild)}render(){const t=this.parsedOptions;this.ensureDefault();const e=t.find((t=>t.value===this.selectedValue));if("align"===this.type){const i=e?.icon?n`<nile-icon name="${e.icon}"></nile-icon>`:this.label||"Align";return n`
1
+ import{__decorate as t}from"tslib";import{LitElement as e,html as n}from"lit";import{property as i,state as l,customElement as r}from"lit/decorators.js";const s=new Set(["p","h1","h2","h3","h4","h5","h6"]);function a(t){return s.has(t)}let o=class extends e{constructor(){super(...arguments),this.type="",this.options="[]",this.label="",this.selectedValue=""}createRenderRoot(){return this}mapAlignIcon(t){return{left:"format_align_left",center:"format_align_middle",right:"format_align_right",justify:"format_align_justify"}[t]||"format_align_left"}get parsedOptions(){const t=this.optionsObj??this.options;let e=(()=>{if(Array.isArray(t))return t;try{return JSON.parse(String(t))}catch{return[]}})();"align"===this.type&&0===e.length&&(e=[{value:"left",label:"Align Left"},{value:"center",label:"Align Center"},{value:"right",label:"Align Right"},{value:"justify",label:"Justify"}]);let n=e.map((t=>{const e=t?.value??t;return{value:e,label:t?.label??t?.value??t,icon:t?.icon??("align"===this.type?this.mapAlignIcon(String(e)):void 0)}}));if("heading"===this.type){n.length;n=n.filter((t=>a(t.value))),n.length,this.selectedValue&&!a(this.selectedValue)&&(this.selectedValue="")}return n}ensureDefault(){if(!this.selectedValue){const t=this.parsedOptions[0];t&&(this.selectedValue=t.value)}}onSelect(t){"heading"!==this.type||a(t)?(this.selectedValue=t,this.dispatchEvent(new CustomEvent("change",{detail:t,bubbles:!0,composed:!0}))):console.warn(`[nile-rte-select] Ignoring invalid heading value: ${t}`)}connectedCallback(){super.connectedCallback(),this.injectLocalStyles()}injectLocalStyles(){if(this.querySelector("style[data-rte-select-style]"))return;const t=document.createElement("style");t.setAttribute("data-rte-select-style","true"),t.textContent="\n nile-menu.rte-align-menu::part(menu__items-wrapper) {\n display: flex;\n }\n nile-menu.rte-align-menu,\n nile-menu.rte-default-menu {\n margin-top: 0px;\n }\n nile-button.rte-align-trigger::part(base),\n nile-button.rte-default-trigger::part(base) {\n min-width: 32px;\n height: 32px;\n padding: 0px 6px;\n box-shadow: none;\n }\n nile-button.rte-align-trigger::part(base) {\n\n border: none;\n}\n\n \n ",this.insertBefore(t,this.firstChild)}render(){const t=this.parsedOptions;this.ensureDefault();const e=t.find((t=>t.value===this.selectedValue));if("align"===this.type){const i=e?.icon?n`<nile-icon name="${e.icon}"></nile-icon>`:this.label||"Align";return n`
2
2
  <nile-dropdown class="rte-align-dd">
3
3
  <nile-button slot="trigger" variant="tertiary" class="rte-align-trigger">
4
4
  ${i}
@@ -9,7 +9,9 @@ import{__decorate as t}from"tslib";import{LitElement as e,html as n}from"lit";im
9
9
  class="rte-align-item"
10
10
  ?active=${t.value===this.selectedValue}
11
11
  @click=${()=>this.onSelect(t.value)}>
12
- <nile-icon name="${t.icon}"></nile-icon>
12
+ <nile-tooltip hoist content="${t.label}">
13
+ <nile-icon name="${t.icon}"></nile-icon>
14
+ </nile-tooltip>
13
15
  </nile-menu-item>
14
16
  `))}
15
17
  </nile-menu>
@@ -1 +1 @@
1
- {"version":3,"file":"nile-rte-toolbar.cjs.js","sources":["../../../src/nile-rich-text-editor/nile-rte-toolbar.ts"],"sourcesContent":["import { LitElement } from 'lit';\nimport { customElement } from 'lit/decorators.js';\n\n@customElement('nile-rte-toolbar')\nexport class NileRteToolbar extends LitElement {\n protected createRenderRoot() { return this; } // Light DOM\n protected shouldUpdate() { return false; } // inert, keep children\n}\ndeclare global { interface HTMLElementTagNameMap { 'nile-rte-toolbar': NileRteToolbar; } }"],"names":["NileRteToolbar","createRenderRoot","this","key","value","shouldUpdate","LitElement","__decorate","customElement"],"mappings":"kwFAIaA,CAAAA,uBAAAA,EAAAA,WAAAA,EAAAA,EAAAA,eAAAA,MAAAA,CAAAA,SAAAA,UAAAA,MAAAA,CAAAA,CAAAA,SAAAA,GAAAA,SAAAA,CAAAA,CAAAA,CAAAA,EAAAA,SAAAA,YAAAA,CAAAA,CAAAA,GAAAA,GAAAA,oBAAAA,KAAAA,CACD,SAAAC,gBAAAA,CAAAA,CAAAA,CAAqB,MAAOC,KAAO,EACnC,GAAAC,GAAA,gBAAAC,KAAA,UAAAC,YAAAA,CAAAA,CAAAA,CAAiB,MAAO,CAAA,CAAQ,QAFRC,CAAAA,EAAvBN,CAAcO,CAAAA,CAAAA,CAAA,CAD1BC,CAAAA,CAAc,kBACFR,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA"}
1
+ {"version":3,"file":"nile-rte-toolbar.cjs.js","sources":["../../../src/nile-rich-text-editor/nile-rte-toolbar.ts"],"sourcesContent":["import { LitElement } from 'lit';\nimport { customElement } from 'lit/decorators.js';\n\n@customElement('nile-rte-toolbar')\nexport class NileRteToolbar extends LitElement {\n protected createRenderRoot() { return this; } \n protected shouldUpdate() { return false; } \n}\ndeclare global { interface HTMLElementTagNameMap { 'nile-rte-toolbar': NileRteToolbar; } }"],"names":["NileRteToolbar","createRenderRoot","this","key","value","shouldUpdate","LitElement","__decorate","customElement"],"mappings":"kwFAIaA,CAAAA,uBAAAA,EAAAA,WAAAA,EAAAA,EAAAA,eAAAA,MAAAA,CAAAA,SAAAA,UAAAA,MAAAA,CAAAA,CAAAA,SAAAA,GAAAA,SAAAA,CAAAA,CAAAA,CAAAA,EAAAA,SAAAA,YAAAA,CAAAA,CAAAA,GAAAA,GAAAA,oBAAAA,KAAAA,CACD,SAAAC,gBAAAA,CAAAA,CAAAA,CAAqB,MAAOC,KAAO,EACnC,GAAAC,GAAA,gBAAAC,KAAA,UAAAC,YAAAA,CAAAA,CAAAA,CAAiB,MAAO,CAAA,CAAQ,QAFRC,CAAAA,EAAvBN,CAAcO,CAAAA,CAAAA,CAAA,CAD1BC,CAAAA,CAAc,kBACFR,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA"}
@@ -8,7 +8,7 @@ export const styles = css `
8
8
  nile-rich-text-editor { position: relative; display: block; font-family: inherit; }
9
9
 
10
10
 
11
- nile-rte-toolbar-item > nile-button::part(base) {
11
+ nile-rte-toolbar-item nile-button::part(base) {
12
12
 
13
13
  width:32px; height:32px; padding:0px 6px;
14
14
  border: none;
@@ -20,9 +20,20 @@ nile-rte-preview {
20
20
  }
21
21
 
22
22
 
23
+ .editor.single-line {
24
+ width: 478px;
25
+ min-height: 50px;
26
+ overflow-x: auto;
27
+ white-space: nowrap;
28
+ border-radius: 8px;
29
+ }
30
+
31
+
32
+
33
+
34
+
23
35
 
24
36
  .toolbar, nile-rte-toolbar {
25
-
26
37
  width:486px;
27
38
  display:flex; align-items:center; gap:6px; padding:8px;
28
39
  border:1px solid #e5e7eb; border-bottom:none; border-radius:8px 8px 0 0; background:#fff;
@@ -69,6 +80,13 @@ font-weight: bold;}
69
80
  }
70
81
  nile-rte-preview { display:block; margin-top:10px; padding:10px; border:1px dashed #cbd5e1; border-radius:8px; background:#fafafa; max-width:478px; }
71
82
 
83
+ nile-rte-preview.single-line {
84
+ width: 478px;
85
+ min-height: 50px;
86
+ overflow-x: auto;
87
+ white-space: nowrap;
88
+ }
89
+
72
90
  .rte-color-trigger {
73
91
  display: inline-flex;
74
92
  align-items: center;
@@ -104,7 +122,6 @@ nile-button.rte-color-trigger::part(base){
104
122
  border-radius: 2px;
105
123
  background: currentColor;
106
124
  }
107
-
108
125
 
109
126
  .rte-color-trigger .swatch-box {
110
127
  width: 18px;
@@ -113,20 +130,13 @@ nile-button.rte-color-trigger::part(base){
113
130
  border: 1px solid rgba(0,0,0,0.35);
114
131
  background: currentColor; /* overridden via JS */
115
132
  }
116
-
117
-
118
-
119
-
120
- nile-rte-toolbar-item > nile-button[data-active]::part(base) {
133
+ nile-rte-toolbar-item nile-button[data-active]::part(base) {
121
134
  background-color: var(--nile-colors-primary-400);
122
135
  }
123
136
 
124
- nile-rte-toolbar-item > nile-button[data-active]::part(base):hover {
137
+ nile-rte-toolbar-item nile-button[data-active]::part(base):hover {
125
138
  background-color: var(--nile-colors-primary-500);
126
139
  }
127
-
128
-
129
-
130
140
  `;
131
141
  export default [styles];
132
142
  //# sourceMappingURL=nile-rich-text-editor.css.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"nile-rich-text-editor.css.js","sourceRoot":"","sources":["../../../src/nile-rich-text-editor/nile-rich-text-editor.css.ts"],"names":[],"mappings":"AAAA,gBAAgB;AAChB,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+HxB,CAAC;AAEF,eAAe,CAAC,MAAM,CAAC,CAAC","sourcesContent":["// rte-styles.ts\nimport { css } from 'lit';\n\nexport const styles = css`\n \n \n .editor {all: revert;}\n\n nile-rich-text-editor { position: relative; display: block; font-family: inherit; }\n\n \nnile-rte-toolbar-item > nile-button::part(base) {\n \n width:32px; height:32px; padding:0px 6px;\n border: none;\n}\n \nnile-rte-preview {\n white-space: normal;\n word-break: break-word;\n}\n\n\n\n .toolbar, nile-rte-toolbar {\n \n width:486px; \n display:flex; align-items:center; gap:6px; padding:8px; \n border:1px solid #e5e7eb; border-bottom:none; border-radius:8px 8px 0 0; background:#fff;\n }\n\n nile-rte-toolbar-item > button, .toolbar button, nile-rte-toolbar button {\n border:1px solid #e5e7eb; background:#fff; border-radius:6px;\n cursor:pointer;\n }\n\n \n /* Ensure clicks hit the button (not nested icon internals) */\n nile-rte-toolbar-item > button nile-icon { pointer-events:none; }\n\n nile-rte-toolbar-item > button.active { border-color:#2563eb; background:#eff6ff; }\n nile-rte-select select { height:32px; border:1px solid #e5e7eb; border-radius:6px; background:#fff; }\n nile-rte-color input[type=\"color\"] { height:32px; width:36px; border:1px solid #e5e7eb; padding:0; border-radius:6px; background:#fff; }\n nile-rte-divider { width:1px; height:20px; background:#e5e7eb; display:inline-block; margin:0 4px; }\n\n .editor p { margin:1em 0; }\n .editor h1, .preview h1 { all: revert; font-size:2em, display: block;\nfont-size: 2em;\nmargin-top: 0.67em;\nmargin-bottom: 0.67em;\nmargin-left: 0;\nmargin-right: 0;\nfont-weight: bold; }\n .editor h2, .preview h2 { all: revert;\tdisplay: block;\nfont-size: 1.5em;\nmargin-top: 0.83em;\nmargin-bottom: 0.83em;\nmargin-left: 0;\nmargin-right: 0;\nfont-weight: bold;}\n .editor h3 { font-size:1.17em }\n .editor h4 { font-size:1em }\n .editor h5 { font-size:0.83em }\n .editor h6 { font-size:0.67em }\n\n .editor { min-height:160px; max-width:478px; padding:12px; border:1px solid #e5e7eb; border-radius:0 0 8px 8px; background:#fff; outline:none; \n tab-size: 4; \n -moz-tab-size: 4; \n word-break: break-word; \n }\n nile-rte-preview { display:block; margin-top:10px; padding:10px; border:1px dashed #cbd5e1; border-radius:8px; background:#fafafa; max-width:478px; }\n\n .rte-color-trigger {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n /* border: 1px solid var(--nile-color-border, #d9d9d9); */\n border-radius: 6px;\n background: #fff;\n cursor: pointer;\n border:none;\n \n\n}\nnile-button.rte-color-trigger::part(base){\n width:32px; height:32px; padding:0px 6px;\n}\n.rte-color-trigger .glyph-stack {\n display: grid; /* stack vertically */\n grid-auto-rows: max-content; \n align-items: center;\n justify-items: center;\n line-height: 1;\n}\n\n.rte-color-trigger .glyph {\n font-size: 14px;\n line-height: 1;\n margin-bottom: 2px; \n}\n\n.rte-color-trigger .underline {\n width: 18px;\n height: 3px;\n border-radius: 2px;\n background: currentColor; \n}\n\n \n.rte-color-trigger .swatch-box {\n width: 18px;\n height: 16px;\n border-radius: 4px;\n border: 1px solid rgba(0,0,0,0.35);\n background: currentColor; /* overridden via JS */\n}\n\n \n\n \nnile-rte-toolbar-item > nile-button[data-active]::part(base) {\n background-color: var(--nile-colors-primary-400);\n}\n\nnile-rte-toolbar-item > nile-button[data-active]::part(base):hover {\n background-color: var(--nile-colors-primary-500); \n}\n\n\n\n`;\n\nexport default [styles];"]}
1
+ {"version":3,"file":"nile-rich-text-editor.css.js","sourceRoot":"","sources":["../../../src/nile-rich-text-editor/nile-rich-text-editor.css.ts"],"names":[],"mappings":"AAAA,gBAAgB;AAChB,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyIxB,CAAC;AAEF,eAAe,CAAC,MAAM,CAAC,CAAC","sourcesContent":["// rte-styles.ts\nimport { css } from 'lit';\n\nexport const styles = css`\n \n \n .editor {all: revert;}\n\n nile-rich-text-editor { position: relative; display: block; font-family: inherit; }\n\n \nnile-rte-toolbar-item nile-button::part(base) {\n \n width:32px; height:32px; padding:0px 6px;\n border: none;\n}\n \nnile-rte-preview {\n white-space: normal;\n word-break: break-word;\n}\n\n\n.editor.single-line {\n width: 478px;\n min-height: 50px;\n overflow-x: auto;\n white-space: nowrap;\n border-radius: 8px;\n}\n\n\n\n\n\n\n .toolbar, nile-rte-toolbar {\n width:486px; \n display:flex; align-items:center; gap:6px; padding:8px; \n border:1px solid #e5e7eb; border-bottom:none; border-radius:8px 8px 0 0; background:#fff;\n }\n\n nile-rte-toolbar-item > button, .toolbar button, nile-rte-toolbar button {\n border:1px solid #e5e7eb; background:#fff; border-radius:6px;\n cursor:pointer;\n }\n\n \n /* Ensure clicks hit the button (not nested icon internals) */\n nile-rte-toolbar-item > button nile-icon { pointer-events:none; }\n\n nile-rte-toolbar-item > button.active { border-color:#2563eb; background:#eff6ff; }\n nile-rte-select select { height:32px; border:1px solid #e5e7eb; border-radius:6px; background:#fff; }\n nile-rte-color input[type=\"color\"] { height:32px; width:36px; border:1px solid #e5e7eb; padding:0; border-radius:6px; background:#fff; }\n nile-rte-divider { width:1px; height:20px; background:#e5e7eb; display:inline-block; margin:0 4px; }\n\n .editor p { margin:1em 0; }\n .editor h1, .preview h1 { all: revert; font-size:2em, display: block;\nfont-size: 2em;\nmargin-top: 0.67em;\nmargin-bottom: 0.67em;\nmargin-left: 0;\nmargin-right: 0;\nfont-weight: bold; }\n .editor h2, .preview h2 { all: revert;\tdisplay: block;\nfont-size: 1.5em;\nmargin-top: 0.83em;\nmargin-bottom: 0.83em;\nmargin-left: 0;\nmargin-right: 0;\nfont-weight: bold;}\n .editor h3 { font-size:1.17em }\n .editor h4 { font-size:1em }\n .editor h5 { font-size:0.83em }\n .editor h6 { font-size:0.67em }\n\n .editor { min-height:160px; max-width:478px; padding:12px; border:1px solid #e5e7eb; border-radius:0 0 8px 8px; background:#fff; outline:none; \n tab-size: 4; \n -moz-tab-size: 4; \n word-break: break-word; \n }\n nile-rte-preview { display:block; margin-top:10px; padding:10px; border:1px dashed #cbd5e1; border-radius:8px; background:#fafafa; max-width:478px; }\n\n nile-rte-preview.single-line {\n width: 478px;\n min-height: 50px;\n overflow-x: auto;\n white-space: nowrap;\n}\n\n .rte-color-trigger {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n /* border: 1px solid var(--nile-color-border, #d9d9d9); */\n border-radius: 6px;\n background: #fff;\n cursor: pointer;\n border:none;\n \n\n}\nnile-button.rte-color-trigger::part(base){\n width:32px; height:32px; padding:0px 6px;\n}\n.rte-color-trigger .glyph-stack {\n display: grid; /* stack vertically */\n grid-auto-rows: max-content; \n align-items: center;\n justify-items: center;\n line-height: 1;\n}\n\n.rte-color-trigger .glyph {\n font-size: 14px;\n line-height: 1;\n margin-bottom: 2px; \n}\n\n.rte-color-trigger .underline {\n width: 18px;\n height: 3px;\n border-radius: 2px;\n background: currentColor; \n}\n \n.rte-color-trigger .swatch-box {\n width: 18px;\n height: 16px;\n border-radius: 4px;\n border: 1px solid rgba(0,0,0,0.35);\n background: currentColor; /* overridden via JS */\n}\nnile-rte-toolbar-item nile-button[data-active]::part(base) {\n background-color: var(--nile-colors-primary-400);\n}\n\nnile-rte-toolbar-item nile-button[data-active]::part(base):hover {\n background-color: var(--nile-colors-primary-500); \n}\n`;\n\nexport default [styles];"]}
@@ -14,9 +14,8 @@ type MentionsConfig = Record<string, {
14
14
  export declare class NileRichTextEditor extends LitElement {
15
15
  protected createRenderRoot(): this;
16
16
  protected shouldUpdate(): boolean;
17
- /** Initial HTML content */
18
17
  value: string;
19
- /** Optional mentions config (can also be on <nile-rte-mentions mentions="...">) */
18
+ singleLineEditor: boolean;
20
19
  mentions: MentionsConfig;
21
20
  private content;
22
21
  private editorEl;
@@ -35,6 +34,7 @@ export declare class NileRichTextEditor extends LitElement {
35
34
  connectedCallback(): void;
36
35
  private updateContentWithMention;
37
36
  disconnectedCallback(): void;
37
+ protected updated(changed: Map<string, any>): void;
38
38
  private ensureEditor;
39
39
  private unwrapMention;
40
40
  private scrubBrokenMentions;
@@ -12,10 +12,6 @@ import './nile-rte-mentions';
12
12
  import './nile-rte-link';
13
13
  import { closestBlock, nearestElement, rgbToHex, toggleInlineTag, setBlockTag, setAlignment, setFontFamily, setForeColor, setBackColor, } from './utils';
14
14
  import { styles } from './nile-rich-text-editor.css';
15
- /**
16
- * Map commands → default icon names from your <nile-icon> set.
17
- * Adjust values to match the real names you have.
18
- */
19
15
  const DEFAULT_ICONS = {
20
16
  bold: 'format_bold',
21
17
  italic: 'format_italic',
@@ -32,16 +28,13 @@ const DEFAULT_ICONS = {
32
28
  let NileRichTextEditor = class NileRichTextEditor extends LitElement {
33
29
  constructor() {
34
30
  super(...arguments);
35
- /** Initial HTML content */
36
31
  this.value = '';
37
- /** Optional mentions config (can also be on <nile-rte-mentions mentions="...">) */
32
+ this.singleLineEditor = false;
38
33
  this.mentions = {};
39
- // ----- internal state (no Lit render) -----
40
34
  this.content = '';
41
35
  this.previewEl = null;
42
36
  this.toolbarEl = null;
43
37
  this.lastRange = null;
44
- // map for button active reflections
45
38
  this.buttonMap = new Map();
46
39
  this.headingSelect = null;
47
40
  this.fontSelect = null;
@@ -49,9 +42,22 @@ let NileRichTextEditor = class NileRichTextEditor extends LitElement {
49
42
  this.bgColorInput = null;
50
43
  this.colorSwatchEl = null;
51
44
  this.bgSwatchEl = null;
52
- // Mentions controller (child)
53
45
  this.mentionsEl = null;
54
46
  this.onEditorKeydown = (e) => {
47
+ if (this.singleLineEditor && e.key === 'Enter' && e.shiftKey) {
48
+ e.preventDefault();
49
+ return;
50
+ }
51
+ if (e.ctrlKey && e.key.toLowerCase() === 'i') {
52
+ e.preventDefault();
53
+ toggleInlineTag(this.editorEl, 'em');
54
+ this.updateContent();
55
+ this.updateToolbarState();
56
+ }
57
+ if (this.singleLineEditor && e.key === 'Enter') {
58
+ e.preventDefault();
59
+ return;
60
+ }
55
61
  if (e.key !== 'Tab')
56
62
  return;
57
63
  e.preventDefault();
@@ -118,6 +124,10 @@ let NileRichTextEditor = class NileRichTextEditor extends LitElement {
118
124
  this.injectCss(styles.cssText);
119
125
  this.toolbarEl = this.querySelector('nile-rte-toolbar');
120
126
  this.previewEl = this.querySelector('nile-rte-preview');
127
+ if (this.singleLineEditor) {
128
+ this.editorEl?.classList.add('single-line');
129
+ this.previewEl?.classList.add('single-line');
130
+ }
121
131
  this.ensureEditor();
122
132
  if (this.value && !this.editorEl.innerHTML.trim()) {
123
133
  this.editorEl.innerHTML = this.value;
@@ -158,12 +168,24 @@ let NileRichTextEditor = class NileRichTextEditor extends LitElement {
158
168
  }
159
169
  super.disconnectedCallback();
160
170
  }
171
+ updated(changed) {
172
+ if (changed.has('singleLineEditor')) {
173
+ if (this.editorEl) {
174
+ this.editorEl.classList.toggle('single-line', this.singleLineEditor);
175
+ }
176
+ if (this.previewEl) {
177
+ this.previewEl.classList.toggle('single-line', this.singleLineEditor);
178
+ }
179
+ }
180
+ }
161
181
  ensureEditor() {
162
182
  this.editorEl = this.querySelector('.editor');
163
183
  if (!this.editorEl) {
164
184
  const editor = document.createElement('article');
165
185
  editor.className = 'editor';
166
186
  editor.setAttribute('contenteditable', 'true');
187
+ if (this.singleLineEditor)
188
+ editor.classList.add('single-line');
167
189
  if (this.toolbarEl?.nextSibling) {
168
190
  this.insertBefore(editor, this.toolbarEl.nextSibling);
169
191
  }
@@ -277,9 +299,13 @@ let NileRichTextEditor = class NileRichTextEditor extends LitElement {
277
299
  btn.innerHTML = child.innerHTML;
278
300
  child.innerHTML = '';
279
301
  }
280
- // Mount it
281
- if (!btn.isConnected)
282
- child.appendChild(btn);
302
+ // Mount button inside tooltip
303
+ if (!btn.isConnected) {
304
+ const tooltip = document.createElement('nile-tooltip');
305
+ tooltip.setAttribute('content', label);
306
+ tooltip.appendChild(btn);
307
+ child.appendChild(tooltip);
308
+ }
283
309
  // Interactions
284
310
  btn.setAttribute('aria-label', label);
285
311
  btn.addEventListener('mousedown', e => e.preventDefault());
@@ -621,6 +647,9 @@ let NileRichTextEditor = class NileRichTextEditor extends LitElement {
621
647
  __decorate([
622
648
  property({ type: String })
623
649
  ], NileRichTextEditor.prototype, "value", void 0);
650
+ __decorate([
651
+ property({ type: Boolean, attribute: 'singlelineeditor' })
652
+ ], NileRichTextEditor.prototype, "singleLineEditor", void 0);
624
653
  __decorate([
625
654
  property({
626
655
  attribute: 'mentions',