@aquera/nile-elements 1.8.6 → 1.8.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -0
- package/dist/index.js +108 -34
- package/dist/nile-markdown-editor/nile-markdown-editor.cjs.js +1 -1
- package/dist/nile-markdown-editor/nile-markdown-editor.cjs.js.map +1 -1
- package/dist/nile-markdown-editor/nile-markdown-editor.esm.js +1 -1
- package/dist/nile-option/nile-option.cjs.js +1 -1
- package/dist/nile-option/nile-option.cjs.js.map +1 -1
- package/dist/nile-option/nile-option.css.cjs.js +1 -1
- package/dist/nile-option/nile-option.css.cjs.js.map +1 -1
- package/dist/nile-option/nile-option.css.esm.js +22 -1
- package/dist/nile-option/nile-option.esm.js +12 -2
- package/dist/nile-select/nile-select.cjs.js +1 -1
- package/dist/nile-select/nile-select.cjs.js.map +1 -1
- package/dist/nile-select/nile-select.css.cjs.js +1 -1
- package/dist/nile-select/nile-select.css.cjs.js.map +1 -1
- package/dist/nile-select/nile-select.css.esm.js +16 -7
- package/dist/nile-select/nile-select.esm.js +2 -2
- package/dist/nile-select/virtual-scroll-helper.cjs.js +1 -1
- package/dist/nile-select/virtual-scroll-helper.cjs.js.map +1 -1
- package/dist/nile-select/virtual-scroll-helper.esm.js +2 -0
- package/dist/nile-side-bar/nile-side-bar.cjs.js +1 -1
- package/dist/nile-side-bar/nile-side-bar.cjs.js.map +1 -1
- package/dist/nile-side-bar/nile-side-bar.css.cjs.js +1 -1
- package/dist/nile-side-bar/nile-side-bar.css.cjs.js.map +1 -1
- package/dist/nile-side-bar/nile-side-bar.css.esm.js +31 -2
- package/dist/nile-side-bar/nile-side-bar.esm.js +2 -2
- package/dist/nile-side-bar-expand/nile-side-bar-expand.cjs.js +1 -1
- package/dist/nile-side-bar-expand/nile-side-bar-expand.cjs.js.map +1 -1
- package/dist/nile-side-bar-expand/nile-side-bar-expand.esm.js +2 -2
- package/dist/nile-virtual-select/nile-virtual-select.cjs.js +3 -3
- package/dist/nile-virtual-select/nile-virtual-select.cjs.js.map +1 -1
- package/dist/nile-virtual-select/nile-virtual-select.css.cjs.js +1 -1
- package/dist/nile-virtual-select/nile-virtual-select.css.cjs.js.map +1 -1
- package/dist/nile-virtual-select/nile-virtual-select.css.esm.js +4 -3
- package/dist/nile-virtual-select/nile-virtual-select.esm.js +4 -4
- package/dist/nile-virtual-select/renderer.cjs.js +1 -1
- package/dist/nile-virtual-select/renderer.cjs.js.map +1 -1
- package/dist/nile-virtual-select/renderer.esm.js +14 -12
- package/dist/src/nile-markdown-editor/nile-markdown-editor.js +1 -1
- package/dist/src/nile-markdown-editor/nile-markdown-editor.js.map +1 -1
- package/dist/src/nile-option/nile-option.css.js +22 -1
- package/dist/src/nile-option/nile-option.css.js.map +1 -1
- package/dist/src/nile-option/nile-option.d.ts +3 -0
- package/dist/src/nile-option/nile-option.js +21 -0
- package/dist/src/nile-option/nile-option.js.map +1 -1
- package/dist/src/nile-select/nile-select.css.js +16 -7
- package/dist/src/nile-select/nile-select.css.js.map +1 -1
- package/dist/src/nile-select/nile-select.d.ts +7 -0
- package/dist/src/nile-select/nile-select.js +35 -0
- package/dist/src/nile-select/nile-select.js.map +1 -1
- package/dist/src/nile-select/virtual-scroll-helper.js +2 -0
- package/dist/src/nile-select/virtual-scroll-helper.js.map +1 -1
- package/dist/src/nile-side-bar/nile-side-bar.css.js +29 -0
- package/dist/src/nile-side-bar/nile-side-bar.css.js.map +1 -1
- package/dist/src/nile-side-bar/nile-side-bar.d.ts +16 -0
- package/dist/src/nile-side-bar/nile-side-bar.js +30 -0
- package/dist/src/nile-side-bar/nile-side-bar.js.map +1 -1
- package/dist/src/nile-side-bar/nile-side-bar.test.d.ts +2 -0
- package/dist/src/nile-side-bar/nile-side-bar.test.js +96 -0
- package/dist/src/nile-side-bar/nile-side-bar.test.js.map +1 -0
- package/dist/src/nile-side-bar-expand/nile-side-bar-expand.js +4 -6
- package/dist/src/nile-side-bar-expand/nile-side-bar-expand.js.map +1 -1
- package/dist/src/nile-virtual-select/nile-virtual-select.css.js +4 -3
- package/dist/src/nile-virtual-select/nile-virtual-select.css.js.map +1 -1
- package/dist/src/nile-virtual-select/nile-virtual-select.d.ts +4 -0
- package/dist/src/nile-virtual-select/nile-virtual-select.js +11 -1
- package/dist/src/nile-virtual-select/nile-virtual-select.js.map +1 -1
- package/dist/src/nile-virtual-select/renderer.d.ts +2 -2
- package/dist/src/nile-virtual-select/renderer.js +6 -4
- package/dist/src/nile-virtual-select/renderer.js.map +1 -1
- package/dist/src/version.js +1 -1
- package/dist/src/version.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/nile-markdown-editor/nile-markdown-editor.ts +1 -1
- package/src/nile-option/nile-option.css.ts +22 -1
- package/src/nile-option/nile-option.ts +18 -0
- package/src/nile-select/nile-select.css.ts +16 -7
- package/src/nile-select/nile-select.ts +32 -0
- package/src/nile-select/virtual-scroll-helper.ts +2 -0
- package/src/nile-side-bar/nile-side-bar.css.ts +29 -0
- package/src/nile-side-bar/nile-side-bar.test.ts +109 -0
- package/src/nile-side-bar/nile-side-bar.ts +29 -0
- package/src/nile-side-bar-expand/nile-side-bar-expand.ts +7 -8
- package/src/nile-virtual-select/nile-virtual-select.css.ts +4 -3
- package/src/nile-virtual-select/nile-virtual-select.ts +9 -1
- package/src/nile-virtual-select/renderer.ts +9 -3
- package/vscode-html-custom-data.json +43 -4
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
System.register(["lit","../virtualize-b6a2fbe0.cjs.js","lit/directives/unsafe-html.js","lit/directives/class-map.js","lit/directive.js","lit/async-directive.js","lit/directives/repeat.js"],function(_export,_context){"use strict";var t,e,i,s,_templateObject,_templateObject2,_templateObject3,_templateObject4,_templateObject5,_templateObject6,_templateObject7,r;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);}function _defineProperty(e,r,t){return(r=_toPropertyKey(r))in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e;}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);}return{setters:[function(_lit){t=_lit.html;},function(_virtualize002CjsJs){e=_virtualize002CjsJs.v;},function(_litDirectivesUnsafeHtmlJs){i=_litDirectivesUnsafeHtmlJs.unsafeHTML;},function(_litDirectivesClassMapJs){s=_litDirectivesClassMapJs.classMap;},function(_litDirectiveJs){},function(_litAsyncDirectiveJs){},function(_litDirectivesRepeatJs){}],execute:function execute(){_export("V",r=/*#__PURE__*/function(){function r(){_classCallCheck(this,r);}return _createClass(r,null,[{key:"getVirtualizedContent",value:function getVirtualizedContent(i,s,l,o,a,n,
|
|
1
|
+
System.register(["lit","../virtualize-b6a2fbe0.cjs.js","lit/directives/unsafe-html.js","lit/directives/class-map.js","lit/directive.js","lit/async-directive.js","lit/directives/repeat.js"],function(_export,_context){"use strict";var t,e,i,s,_templateObject,_templateObject2,_templateObject3,_templateObject4,_templateObject5,_templateObject6,_templateObject7,r;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);}function _defineProperty(e,r,t){return(r=_toPropertyKey(r))in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e;}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);}return{setters:[function(_lit){t=_lit.html;},function(_virtualize002CjsJs){e=_virtualize002CjsJs.v;},function(_litDirectivesUnsafeHtmlJs){i=_litDirectivesUnsafeHtmlJs.unsafeHTML;},function(_litDirectivesClassMapJs){s=_litDirectivesClassMapJs.classMap;},function(_litDirectiveJs){},function(_litAsyncDirectiveJs){},function(_litDirectivesRepeatJs){}],execute:function execute(){_export("V",r=/*#__PURE__*/function(){function r(){_classCallCheck(this,r);}return _createClass(r,null,[{key:"getVirtualizedContent",value:function getVirtualizedContent(i,s,l,o,c,a,n,d,p,$,u,m,v,_,f,j,g,h){return t(_templateObject||(_templateObject=_taggedTemplateLiteral(["\n <div part=\"select-options\" class=\"select__options "," ","\">\n ","\n </div>"])),s?"select__options__search-enabled":"",v?"loading":"",u&&!v?t(_templateObject2||(_templateObject2=_taggedTemplateLiteral(["\n <div part=\"select-no-results\" class=\"select__no-results\">\n ","\n </div>\n "])),m||"No results found"):t(_templateObject3||(_templateObject3=_taggedTemplateLiteral(["\n <div\n class=\"virtualized\"\n part=\"virtualized\"\n @scroll=","\n >\n ","\n </div>\n "])),_,r.shouldUseVirtualizer(i)?t(_templateObject4||(_templateObject4=_taggedTemplateLiteral(["\n ","\n "])),e({items:i,renderItem:function renderItem(t){return r.getItemRenderFunction(t,l,o,c,a,n,d,p,$,f,j,g,h);},scroller:!0})):t(_templateObject5||(_templateObject5=_taggedTemplateLiteral(["\n ","\n "])),i.map(function(t){return r.getItemRenderFunction(t,l,o,c,a,n,d,p,$,f,j,g,h);}))));}},{key:"getItemRenderFunction",value:function getItemRenderFunction(e,_r,l,o,c,a,n,d,p,$,u,m,v){var _ref,_ref2,_ref3;if(!e)return t(_templateObject6||(_templateObject6=_taggedTemplateLiteral([""])));var _=c||_r,f=a||function(t){return(t===null||t===void 0?void 0:t.value)||t;},j=f(e),g=_(e),h=(e===null||e===void 0?void 0:e.disabled)||!1,z=e===null||e===void 0?void 0:e.className,b=(_ref=n?n(e):e===null||e===void 0?void 0:e.description)!==null&&_ref!==void 0?_ref:"",y=(_ref2=d?d(e):e===null||e===void 0?void 0:e.prefix)!==null&&_ref2!==void 0?_ref2:"",S=(_ref3=p?p(e):e===null||e===void 0?void 0:e.suffix)!==null&&_ref3!==void 0?_ref3:"";var V=!1;return V=o?Array.isArray(l)&&l.some(function(t){return String(t)===String(j);}):(Array.isArray(l)?l[0]:l)===j,t(_templateObject7||(_templateObject7=_taggedTemplateLiteral(["\n <nile-option\n value="," \n .selected="," \n .disabled=","\n .showCheckbox=","\n .tickOnSelect=","\n .legacy=","\n class=","\n .description=","\n .isDescriptionEnabled=","\n >\n ","\n ","\n ","\n </nile-option>\n "])),j,V,h,o,m!==null&&m!==void 0?m:!1,v!==null&&v!==void 0?v:!1,s(_defineProperty({option:u!==null&&u!==void 0?u:!1},z!==null&&z!==void 0?z:"",!!z)),b,u,i(y),$?i(g):g,i(S));}},{key:"shouldUseVirtualizer",value:function shouldUseVirtualizer(t){return t.length>=5;}}]);}());}};});
|
|
2
2
|
//# sourceMappingURL=renderer.cjs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderer.cjs.js","sources":["../../../src/nile-virtual-select/renderer.ts"],"sourcesContent":["/**\n * Copyright Aquera Inc 2025\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 { html, type TemplateResult } from 'lit';\nimport { virtualize } from '@lit-labs/virtualizer/virtualize.js';\nimport { unsafeHTML } from 'lit/directives/unsafe-html.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { classMap } from 'lit/directives/class-map.js';\n\nexport class VirtualSelectRenderer {\n static getVirtualizedContent(\n data: any[], \n searchEnabled: boolean, \n renderItemFunction: (item: any) => string,\n value: string | string[],\n multiple: boolean,\n getDisplayText?: (item: any) => string,\n getItemValue?: (item: any) => string,\n getItemDescription?: (item: any) => string,\n getItemPrefix?: (item: any) => string,\n getItemSuffix?: (item: any) => string,\n showNoResults?: boolean,\n noResultsMessage?: string,\n loading?: boolean,\n onScroll?: (e: Event) => void,\n allowHtmlLabel?: boolean,\n enableDescription?: boolean\n ): TemplateResult {\n return html`\n <div part=\"select-options\" class=\"select__options ${\n searchEnabled ? 'select__options__search-enabled' : ``\n } ${loading ? 'loading' : ''}\">\n ${showNoResults && !loading\n ? html`\n <div part=\"select-no-results\" class=\"select__no-results\">\n ${noResultsMessage || 'No results found'}\n </div>\n `\n : html`\n <div\n class=\"virtualized\"\n part=\"virtualized\"\n @scroll=${onScroll}\n >\n ${VirtualSelectRenderer.shouldUseVirtualizer(data)\n ? html`\n ${virtualize({\n items: data,\n renderItem: (item: any): TemplateResult =>\n VirtualSelectRenderer.getItemRenderFunction(item, renderItemFunction, value, multiple, getDisplayText, getItemValue, getItemDescription, getItemPrefix, getItemSuffix, allowHtmlLabel, enableDescription),\n scroller: true,\n })}\n `\n : html`\n ${data.map((item: any) => \n VirtualSelectRenderer.getItemRenderFunction(item, renderItemFunction, value, multiple, getDisplayText, getItemValue, getItemDescription, getItemPrefix, getItemSuffix, allowHtmlLabel, enableDescription)\n )}\n `}\n </div>\n `}\n </div>`;\n }\n\n static getItemRenderFunction(\n item: any, \n renderItemFunction: (item: any) => string, \n value: string | string[], \n multiple: boolean,\n getDisplayText?: (item: any) => string,\n getItemValue?: (item: any) => string,\n getItemDescription?: (item: any) => string,\n getItemPrefix?: (item: any) => string,\n getItemSuffix?: (item: any) => string,\n allowHtmlLabel?: boolean,\n enableDescription?: boolean,\n ): TemplateResult {\n if(!item) {\n return html``;\n }\n const displayTextFn = getDisplayText || renderItemFunction;\n const valueFn = getItemValue || ((item: any) => item?.value || item);\n \n const optionValue = valueFn(item);\n const displayText = displayTextFn(item);\n const isDisabled = item?.disabled || false;\n const className = item?.className;\n const description = (getItemDescription ? getItemDescription(item) : item?.description) ?? '';\n const prefix = (getItemPrefix ? getItemPrefix(item) : item?.prefix) ?? '';\n const suffix = (getItemSuffix ? getItemSuffix(item) : item?.suffix) ?? '';\n \n let isSelected = false;\n if (multiple) {\n isSelected = Array.isArray(value) && value.some(v => String(v) === String(optionValue));\n } else {\n isSelected = (Array.isArray(value) ? value[0] : value) === optionValue;\n }\n\n return html`\n <nile-option\n value=${optionValue} \n .selected=${isSelected} \n .disabled=${isDisabled}\n .showCheckbox=${multiple}\n class=${classMap({\n option: enableDescription ?? false,\n [className ?? '']: !!className,\n })}\n .description=${description}\n .isDescriptionEnabled=${enableDescription}\n >\n ${unsafeHTML(prefix)}\n ${allowHtmlLabel ? unsafeHTML(displayText) : displayText}\n ${unsafeHTML(suffix)}\n </nile-option>\n `;\n }\n\n /**\n * Determines whether to use virtualizer based on dataset size\n * For small datasets (less than 5 items), use regular rendering for better sizing\n */\n private static shouldUseVirtualizer(data: any[]): boolean {\n return data.length >= 5;\n }\n} \n"],"names":["VirtualSelectRenderer","getVirtualizedContent","data","searchEnabled","renderItemFunction","
|
|
1
|
+
{"version":3,"file":"renderer.cjs.js","sources":["../../../src/nile-virtual-select/renderer.ts"],"sourcesContent":["/**\n * Copyright Aquera Inc 2025\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 { html, type TemplateResult } from 'lit';\nimport { virtualize } from '@lit-labs/virtualizer/virtualize.js';\nimport { unsafeHTML } from 'lit/directives/unsafe-html.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { classMap } from 'lit/directives/class-map.js';\n\nexport class VirtualSelectRenderer {\n static getVirtualizedContent(\n data: any[], \n searchEnabled: boolean, \n renderItemFunction: (item: any) => string,\n value: string | string[],\n multiple: boolean,\n getDisplayText?: (item: any) => string,\n getItemValue?: (item: any) => string,\n getItemDescription?: (item: any) => string,\n getItemPrefix?: (item: any) => string,\n getItemSuffix?: (item: any) => string,\n showNoResults?: boolean,\n noResultsMessage?: string,\n loading?: boolean,\n onScroll?: (e: Event) => void,\n allowHtmlLabel?: boolean,\n enableDescription?: boolean,\n tickOnSelect?: boolean,\n legacy?: boolean\n ): TemplateResult {\n return html`\n <div part=\"select-options\" class=\"select__options ${\n searchEnabled ? 'select__options__search-enabled' : ``\n } ${loading ? 'loading' : ''}\">\n ${showNoResults && !loading\n ? html`\n <div part=\"select-no-results\" class=\"select__no-results\">\n ${noResultsMessage || 'No results found'}\n </div>\n `\n : html`\n <div\n class=\"virtualized\"\n part=\"virtualized\"\n @scroll=${onScroll}\n >\n ${VirtualSelectRenderer.shouldUseVirtualizer(data)\n ? html`\n ${virtualize({\n items: data,\n renderItem: (item: any): TemplateResult =>\n VirtualSelectRenderer.getItemRenderFunction(item, renderItemFunction, value, multiple, getDisplayText, getItemValue, getItemDescription, getItemPrefix, getItemSuffix, allowHtmlLabel, enableDescription, tickOnSelect, legacy),\n scroller: true,\n })}\n `\n : html`\n ${data.map((item: any) => \n VirtualSelectRenderer.getItemRenderFunction(item, renderItemFunction, value, multiple, getDisplayText, getItemValue, getItemDescription, getItemPrefix, getItemSuffix, allowHtmlLabel, enableDescription, tickOnSelect, legacy)\n )}\n `}\n </div>\n `}\n </div>`;\n }\n\n static getItemRenderFunction(\n item: any, \n renderItemFunction: (item: any) => string, \n value: string | string[], \n multiple: boolean,\n getDisplayText?: (item: any) => string,\n getItemValue?: (item: any) => string,\n getItemDescription?: (item: any) => string,\n getItemPrefix?: (item: any) => string,\n getItemSuffix?: (item: any) => string,\n allowHtmlLabel?: boolean,\n enableDescription?: boolean,\n tickOnSelect?: boolean,\n legacy?: boolean,\n ): TemplateResult {\n if(!item) {\n return html``;\n }\n const displayTextFn = getDisplayText || renderItemFunction;\n const valueFn = getItemValue || ((item: any) => item?.value || item);\n \n const optionValue = valueFn(item);\n const displayText = displayTextFn(item);\n const isDisabled = item?.disabled || false;\n const className = item?.className;\n const description = (getItemDescription ? getItemDescription(item) : item?.description) ?? '';\n const prefix = (getItemPrefix ? getItemPrefix(item) : item?.prefix) ?? '';\n const suffix = (getItemSuffix ? getItemSuffix(item) : item?.suffix) ?? '';\n \n let isSelected = false;\n if (multiple) {\n isSelected = Array.isArray(value) && value.some(v => String(v) === String(optionValue));\n } else {\n isSelected = (Array.isArray(value) ? value[0] : value) === optionValue;\n }\n\n return html`\n <nile-option\n value=${optionValue} \n .selected=${isSelected} \n .disabled=${isDisabled}\n .showCheckbox=${multiple}\n .tickOnSelect=${tickOnSelect ?? false}\n .legacy=${legacy ?? false}\n class=${classMap({\n option: enableDescription ?? false,\n [className ?? '']: !!className,\n })}\n .description=${description}\n .isDescriptionEnabled=${enableDescription}\n >\n ${unsafeHTML(prefix)}\n ${allowHtmlLabel ? unsafeHTML(displayText) : displayText}\n ${unsafeHTML(suffix)}\n </nile-option>\n `;\n }\n\n /**\n * Determines whether to use virtualizer based on dataset size\n * For small datasets (less than 5 items), use regular rendering for better sizing\n */\n private static shouldUseVirtualizer(data: any[]): boolean {\n return data.length >= 5;\n }\n} \n"],"names":["VirtualSelectRenderer","r","_classCallCheck","_createClass","key","value","getVirtualizedContent","data","searchEnabled","renderItemFunction","multiple","getDisplayText","getItemValue","getItemDescription","getItemPrefix","getItemSuffix","showNoResults","noResultsMessage","loading","onScroll","allowHtmlLabel","enableDescription","tickOnSelect","legacy","html","_templateObject","_taggedTemplateLiteral","_templateObject2","_templateObject3","shouldUseVirtualizer","_templateObject4","virtualize","items","renderItem","item","getItemRenderFunction","scroller","_templateObject5","map","_templateObject6","displayTextFn","valueFn","optionValue","displayText","isDisabled","disabled","className","description","prefix","_ref2","suffix","isSelected","Array","isArray","some","v","String","_templateObject7","classMap","option","unsafeHTML","length"],"mappings":"kmEAaaA,CACX,kCAAAC,EAAA,EAAAC,eAAA,MAAAD,CAAA,UAAAE,YAAA,CAAAF,CAAA,QAAAG,GAAA,yBAAAC,KAAA,CAAA,QAAA,CAAAC,qBAAOA,CACLC,CACAC,CAAAA,CAAAA,CACAC,CACAJ,CAAAA,CAAAA,CACAK,CACAC,CAAAA,CAAAA,CACAC,CACAC,CAAAA,CAAAA,CACAC,EACAC,CACAC,CAAAA,CAAAA,CACAC,CACAC,CAAAA,CAAAA,CACAC,EACAC,CACAC,CAAAA,CAAAA,CACAC,CACAC,CAAAA,CAAAA,CAAAA,CAEA,MAAOC,CAAAA,CAAI,CAAAC,eAAA,GAAAA,eAAA,CAAAC,sBAAA,0GAEPlB,CAAgB,CAAA,iCAAA,CAAoC,EAClDU,CAAAA,CAAAA,CAAU,SAAY,CAAA,EAAA,CACtBF,CAAAA,EAAAA,CAAkBE,EAChBM,CAAI,CAAAG,gBAAA,GAAAA,gBAAA,CAAAD,sBAAA,8IAEET,CAAoB,EAAA,kBAAA,EAG1BO,CAAI,CAAAI,gBAAA,GAA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AAAA,CACAP,CAAAA,CACIlC,CAAAA,CACAY,CAAgB,SAAhBA,CAAgB,UAAhBA,CAAgB,CAAA,CAAA,CAAA,CACtBC,CAAU,SAAVA,CAAU,UAAVA,CAAU,CAAA,CAAA,CAAA,CACZmC,CAAAA,CAAAA,eAAAA,EACNC,MAAQtC,CAAAA,CAAAA,SAAAA,CAAAA,UAAAA,CAAAA,CAAAA,CAAqB,CAC7B,EAACyB,UAAAA,WAAAA,EAAa,EAAOA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAERC,CAAAA,CACS1B,CAAAA,CAEtBuC,CAAWZ,CAAAA,CAAAA,CAAAA,CACX5B,CAAAA,CAAiBwC,EAAWjB,CAAeA,CAAAA,CAAAA,CAAAA,CAC3CiB,CAAWV,CAAAA,CAAAA,CAAAA,CAGlB,EAMO,GAAA9C,GAAA,wBAAAC,KAAA,8BAAOwB,CAAqBtB,CAAAA,CAAAA,CAClC,MAAOA,CAAAA,CAAKsD,CAAAA,MAAAA,EAAU,CACvB"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{html as t}from"lit";import{v as e}from"../virtualize-a4a40d96.esm.js";import{unsafeHTML as i}from"lit/directives/unsafe-html.js";import{classMap as s}from"lit/directives/class-map.js";import"lit/directive.js";import"lit/async-directive.js";import"lit/directives/repeat.js";class r{static getVirtualizedContent(i,s,l,o,a,n,
|
|
1
|
+
import{html as t}from"lit";import{v as e}from"../virtualize-a4a40d96.esm.js";import{unsafeHTML as i}from"lit/directives/unsafe-html.js";import{classMap as s}from"lit/directives/class-map.js";import"lit/directive.js";import"lit/async-directive.js";import"lit/directives/repeat.js";class r{static getVirtualizedContent(i,s,l,o,a,c,n,d,p,$,m,u,v,_,f,g,j,h){return t`
|
|
2
2
|
<div part="select-options" class="select__options ${s?"select__options__search-enabled":""} ${v?"loading":""}">
|
|
3
3
|
${m&&!v?t`
|
|
4
4
|
<div part="select-no-results" class="select__no-results">
|
|
@@ -11,24 +11,26 @@ import{html as t}from"lit";import{v as e}from"../virtualize-a4a40d96.esm.js";imp
|
|
|
11
11
|
@scroll=${_}
|
|
12
12
|
>
|
|
13
13
|
${r.shouldUseVirtualizer(i)?t`
|
|
14
|
-
${e({items:i,renderItem:t=>r.getItemRenderFunction(t,l,o,a,n,
|
|
14
|
+
${e({items:i,renderItem:t=>r.getItemRenderFunction(t,l,o,a,c,n,d,p,$,f,g,j,h),scroller:!0})}
|
|
15
15
|
`:t`
|
|
16
|
-
${i.map((t=>r.getItemRenderFunction(t,l,o,a,n,
|
|
16
|
+
${i.map((t=>r.getItemRenderFunction(t,l,o,a,c,n,d,p,$,f,g,j,h)))}
|
|
17
17
|
`}
|
|
18
18
|
</div>
|
|
19
19
|
`}
|
|
20
|
-
</div>`}static getItemRenderFunction(e,r,l,o,a,n,
|
|
20
|
+
</div>`}static getItemRenderFunction(e,r,l,o,a,c,n,d,p,$,m,u,v){if(!e)return t``;const _=a||r,f=c||(t=>t?.value||t),g=f(e),j=_(e),h=e?.disabled||!1,z=e?.className,b=(n?n(e):e?.description)??"",y=(d?d(e):e?.prefix)??"",S=(p?p(e):e?.suffix)??"";let V=!1;return V=o?Array.isArray(l)&&l.some((t=>String(t)===String(g))):(Array.isArray(l)?l[0]:l)===g,t`
|
|
21
21
|
<nile-option
|
|
22
|
-
value=${
|
|
23
|
-
.selected=${
|
|
24
|
-
.disabled=${
|
|
22
|
+
value=${g}
|
|
23
|
+
.selected=${V}
|
|
24
|
+
.disabled=${h}
|
|
25
25
|
.showCheckbox=${o}
|
|
26
|
-
|
|
27
|
-
.
|
|
26
|
+
.tickOnSelect=${u??!1}
|
|
27
|
+
.legacy=${v??!1}
|
|
28
|
+
class=${s({option:m??!1,[z??""]:!!z})}
|
|
29
|
+
.description=${b}
|
|
28
30
|
.isDescriptionEnabled=${m}
|
|
29
31
|
>
|
|
30
|
-
${i(
|
|
31
|
-
${$?i(
|
|
32
|
-
${i(
|
|
32
|
+
${i(y)}
|
|
33
|
+
${$?i(j):j}
|
|
34
|
+
${i(S)}
|
|
33
35
|
</nile-option>
|
|
34
36
|
`}static shouldUseVirtualizer(t){return t.length>=5}}export{r as V};
|
|
@@ -473,6 +473,7 @@ let NileMarkdownEditor = class NileMarkdownEditor extends NileElement {
|
|
|
473
473
|
part="base"
|
|
474
474
|
>
|
|
475
475
|
<div class="header" part="header">
|
|
476
|
+
${this.renderToolbar()}
|
|
476
477
|
<nile-button-toggle-group
|
|
477
478
|
class="tabs"
|
|
478
479
|
aria-label="Editor view"
|
|
@@ -495,7 +496,6 @@ let NileMarkdownEditor = class NileMarkdownEditor extends NileElement {
|
|
|
495
496
|
</nile-button-toggle>
|
|
496
497
|
`)}
|
|
497
498
|
</nile-button-toggle-group>
|
|
498
|
-
${this.renderToolbar()}
|
|
499
499
|
</div>
|
|
500
500
|
<div
|
|
501
501
|
class=${classMap({ body: true, 'body--dragging': this.splitDragging })}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nile-markdown-editor.js","sourceRoot":"","sources":["../../../src/nile-markdown-editor/nile-markdown-editor.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;AAEH,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1E,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACpD,OAAO,WAAW,MAAM,0BAA0B,CAAC;AACnD,OAAO,gCAAgC,CAAC;AACxC,OAAO,cAAc,CAAC;AACtB,OAAO,sDAAsD,CAAC;AAC9D,OAAO,0CAA0C,CAAC;AAClD,OAAO,gCAAgC,CAAC;AACxC,OAAO,wBAAwB,CAAC;AAChC,OAAO,kCAAkC,CAAC;AAyD1C,4EAA4E;AAC5E,MAAM,cAAc,GAAsB;IACxC;QACE;YAC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ACH,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;oBACjC,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;wBAC1B,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;oBAC3D,CAAC;gBACH,CAAC;gBAAC,MAAM,CAAC;oBACP,oDAAoD;gBACtD,CAAC;gBACD,OAAO,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;YAC7D,CAAC;YACD,WAAW,EAAE,CAAC,KAAe,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,IAAI,EAAE,CAAC;SAC9D;KACF,CAAC;iDACmB;AAiBM;IAA1B,KAAK,CAAC,UAAU,CAAC;oDAAwC;AAElC;IAAvB,KAAK,CAAC,OAAO,CAAC;kDAA8B;AAO5B;IAAhB,KAAK,EAAE;sDAA0B;AAGjB;IAAhB,KAAK,EAAE;yDAA+B;AA7E5B,kBAAkB;IAD9B,aAAa,CAAC,sBAAsB,CAAC;GACzB,kBAAkB,CA2f9B;;AAED,eAAe,kBAAkB,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 { html, nothing } from 'lit';\nimport { customElement, property, query, state } from 'lit/decorators.js';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { styles } from './nile-markdown-editor.css';\nimport NileElement from '../internal/nile-element';\nimport '../nile-markdown/nile-markdown';\nimport '../nile-icon';\nimport '../nile-button-toggle-group/nile-button-toggle-group';\nimport '../nile-button-toggle/nile-button-toggle';\nimport '../nile-dropdown/nile-dropdown';\nimport '../nile-menu/nile-menu';\nimport '../nile-menu-item/nile-menu-item';\nimport type { CSSResultGroup, TemplateResult } from 'lit';\n\nexport type MarkdownEditorMode = 'write' | 'preview' | 'split';\n\n/** A toolbar action that wraps the selection with markdown delimiters. */\ninterface WrapAction {\n name: string;\n title: string;\n kind: 'wrap';\n prefix: string;\n suffix: string;\n placeholder: string;\n icon?: string;\n glyph?: string;\n}\n\n/** A toolbar action that toggles a prefix on each selected line. */\ninterface LineAction {\n name: string;\n title: string;\n kind: 'line';\n prefix: string;\n numbered?: boolean;\n icon?: string;\n glyph?: string;\n}\n\ninterface LinkAction {\n name: string;\n title: string;\n kind: 'link';\n icon?: string;\n glyph?: string;\n}\n\n/** A single option inside a {@link MenuAction} dropdown. */\ninterface MenuItem {\n label: string;\n /** The line prefix applied when this item is chosen, e.g. `'## '`. */\n prefix: string;\n /** Optional nile-glyph name shown beside the label. */\n glyph?: string;\n}\n\n/** A toolbar action that opens a dropdown of line-prefix choices. */\ninterface MenuAction {\n name: string;\n title: string;\n kind: 'menu';\n items: MenuItem[];\n icon?: string;\n glyph?: string;\n}\n\ntype ToolbarAction = WrapAction | LineAction | LinkAction | MenuAction;\n\n/** Toolbar actions, grouped — groups are separated by vertical dividers. */\nconst TOOLBAR_GROUPS: ToolbarAction[][] = [\n [\n {\n name: 'heading',\n title: 'Heading',\n kind: 'menu',\n glyph: 'ng-heading',\n items: [\n { label: 'Heading 1', prefix: '# ', glyph: 'ng-heading-1' },\n { label: 'Heading 2', prefix: '## ', glyph: 'ng-heading-2' },\n { label: 'Heading 3', prefix: '### ', glyph: 'ng-heading-3' },\n { label: 'Heading 4', prefix: '#### ', glyph: 'ng-heading-4' },\n { label: 'Heading 5', prefix: '##### ', glyph: 'ng-heading-5' },\n { label: 'Heading 6', prefix: '###### ', glyph: 'ng-heading-6' },\n ],\n },\n {\n name: 'bold',\n title: 'Bold (Ctrl+B)',\n kind: 'wrap',\n prefix: '**',\n suffix: '**',\n placeholder: 'bold text',\n icon: 'format_bold',\n },\n {\n name: 'italic',\n title: 'Italic (Ctrl+I)',\n kind: 'wrap',\n prefix: '_',\n suffix: '_',\n placeholder: 'italic text',\n icon: 'format_italic',\n },\n {\n name: 'strikethrough',\n title: 'Strikethrough',\n kind: 'wrap',\n prefix: '~~',\n suffix: '~~',\n placeholder: 'text',\n glyph: 'ng-strikethrough',\n },\n ],\n [\n { name: 'quote', title: 'Quote', kind: 'line', prefix: '> ', glyph: 'ng-quote' },\n {\n name: 'code',\n title: 'Code',\n kind: 'wrap',\n prefix: '`',\n suffix: '`',\n placeholder: 'code',\n glyph: 'ng-code',\n },\n ],\n [\n {\n name: 'ul',\n title: 'Bulleted list',\n kind: 'line',\n prefix: '- ',\n icon: 'format_list_bulleted',\n },\n {\n name: 'ol',\n title: 'Numbered list',\n kind: 'line',\n prefix: '1. ',\n numbered: true,\n icon: 'format_list_numbered',\n },\n ],\n [{ name: 'link', title: 'Link (Ctrl+K)', kind: 'link', icon: 'link_2' }],\n];\n\nconst TOOLBAR_ACTIONS: ToolbarAction[] = TOOLBAR_GROUPS.flat();\n\n/** Glyph shown alongside each view-mode tab label. */\nconst TAB_GLYPHS: Record<MarkdownEditorMode, string> = {\n write: 'ng-pencil',\n preview: 'ng-eye',\n split: 'ng-square-split-horizontal',\n};\n\n/**\n * Nile markdown editor component.\n *\n * @tag nile-markdown-editor\n */\n\n/**\n * @summary A GitHub-style markdown editor with a formatting toolbar and a\n * live preview rendered by `nile-markdown`.\n * @status experimental\n *\n * @dependency nile-markdown\n * @dependency nile-icon\n * @dependency nile-glyph\n * @dependency nile-button-toggle-group\n * @dependency nile-button-toggle\n *\n * @attr {string} tools - JSON-array allowlist of toolbar tools to show, e.g.\n * `tools='[\"bold\",\"italic\",\"link\"]'`. Valid names: heading, bold, italic,\n * strikethrough, quote, code, ul, ol, link. Empty shows all.\n *\n * @event nile-input - Emitted with `{ value }` on every keystroke or toolbar action.\n * @event nile-change - Emitted with `{ value }` when the editor loses focus after an edit.\n * @event nile-mode-change - Emitted with `{ mode }` when the write/preview/split mode changes.\n *\n * @csspart base - The component's base wrapper.\n * @csspart header - The header containing the tabs and toolbar.\n * @csspart toolbar - The formatting toolbar.\n * @csspart textarea - The markdown source textarea.\n * @csspart preview - The rendered preview pane.\n */\n\n@customElement('nile-markdown-editor')\nexport class NileMarkdownEditor extends NileElement {\n static styles: CSSResultGroup = styles;\n\n /** The markdown source. */\n @property() value = '';\n\n /** Placeholder shown when the editor is empty. */\n @property() placeholder = 'Write markdown here…';\n\n /** Disables the editor. */\n @property({ type: Boolean, reflect: true }) disabled = false;\n\n /** Makes the source read-only while still allowing mode switching. */\n @property({ type: Boolean, reflect: true }) readonly = false;\n\n /** Number of visible text rows in write mode. */\n @property({ type: Number }) rows = 8;\n\n /** Active view: `write`, `preview`, or `split`. */\n @property({ reflect: true }) mode: MarkdownEditorMode = 'write';\n\n /** Hides the formatting toolbar. */\n @property({ type: Boolean, attribute: 'hide-toolbar' }) hideToolbar = false;\n\n /**\n * Allowlist of toolbar tool names to show. Accepts a JSON array via the\n * `tools` attribute (e.g. `tools='[\"bold\",\"italic\",\"link\"]'`), a\n * comma-separated string, or an array when set as a property. When empty\n * (default) every tool is shown. Valid names: `heading`, `bold`, `italic`,\n * `strikethrough`, `quote`, `code`, `ul`, `ol`, `link`.\n */\n @property({\n converter: {\n fromAttribute: (value: string | null) => {\n if (!value) return [];\n try {\n const parsed = JSON.parse(value);\n if (Array.isArray(parsed)) {\n return parsed.map(s => String(s).trim()).filter(Boolean);\n }\n } catch {\n // Not JSON — fall back to a comma-separated string.\n }\n return value.split(',').map(s => s.trim()).filter(Boolean);\n },\n toAttribute: (value: string[]) => JSON.stringify(value ?? []),\n },\n })\n tools: string[] = [];\n\n /** Parsed allowlist, or `null` when no allowlist is set (show everything). */\n private get allowedTools(): Set<string> | null {\n const names = (this.tools ?? []).map(s => s.trim()).filter(Boolean);\n return names.length ? new Set(names) : null;\n }\n\n /** Toolbar groups after applying the allowlist; empty groups are dropped. */\n private get visibleGroups(): ToolbarAction[][] {\n const allowed = this.allowedTools;\n if (!allowed) return TOOLBAR_GROUPS;\n return TOOLBAR_GROUPS.map(group =>\n group.filter(action => allowed.has(action.name))\n ).filter(group => group.length > 0);\n }\n\n @query('textarea') private textarea?: HTMLTextAreaElement;\n\n @query('.body') private bodyEl?: HTMLElement;\n\n /**\n * Fraction of the body width given to the write pane in split mode\n * (the rest goes to the preview). Clamped to a sensible range while\n * dragging the splitter.\n */\n @state() private splitRatio = 0.5;\n\n /** Whether the split divider is currently being dragged. */\n @state() private splitDragging = false;\n\n /** Begins a pointer-driven resize of the split divider. */\n private startSplitDrag = (e: PointerEvent) => {\n if (this.mode !== 'split') return;\n const body = this.bodyEl;\n if (!body) return;\n e.preventDefault();\n this.splitDragging = true;\n\n const rect = body.getBoundingClientRect();\n const MIN = 0.15;\n const MAX = 0.85;\n\n const onMove = (ev: PointerEvent) => {\n if (rect.width === 0) return;\n const ratio = (ev.clientX - rect.left) / rect.width;\n this.splitRatio = Math.min(MAX, Math.max(MIN, ratio));\n };\n const onUp = () => {\n this.splitDragging = false;\n window.removeEventListener('pointermove', onMove);\n window.removeEventListener('pointerup', onUp);\n };\n window.addEventListener('pointermove', onMove);\n window.addEventListener('pointerup', onUp);\n };\n\n /** Resets the splitter to a 50/50 layout (double-click affordance). */\n private resetSplit = () => {\n this.splitRatio = 0.5;\n };\n\n /** Moves focus to the textarea. */\n focus(options?: FocusOptions): void {\n this.textarea?.focus(options);\n }\n\n blur(): void {\n this.textarea?.blur();\n }\n\n private setMode(mode: MarkdownEditorMode) {\n if (this.mode === mode) return;\n this.mode = mode;\n this.emit('nile-mode-change', { mode }, true, true);\n }\n\n private handleInput = (e: Event) => {\n this.value = (e.target as HTMLTextAreaElement).value;\n this.emit('nile-input', { value: this.value }, true, true);\n };\n\n private handleChange = () => {\n this.emit('nile-change', { value: this.value }, true, true);\n };\n\n private handleKeydown = (e: KeyboardEvent) => {\n if (!(e.metaKey || e.ctrlKey)) return;\n const key = e.key.toLowerCase();\n const action = { b: 'bold', i: 'italic', k: 'link' }[\n key as 'b' | 'i' | 'k'\n ];\n if (!action) return;\n // Respect the allowlist: a hidden tool's shortcut is disabled too.\n const allowed = this.allowedTools;\n if (allowed && !allowed.has(action)) return;\n e.preventDefault();\n this.runAction(TOOLBAR_ACTIONS.find(a => a.name === action)!);\n };\n\n /** Replaces the current selection and restores focus/selection. */\n private replaceSelection(\n start: number,\n end: number,\n replacement: string,\n selectStart: number,\n selectEnd: number\n ) {\n const ta = this.textarea;\n if (!ta) return;\n ta.focus();\n // Select the range to overwrite, then insert via the browser's editing\n // pipeline so the change is recorded on the native undo/redo stack.\n // Assigning `ta.value` directly would wipe that stack and break Ctrl/Cmd+Z.\n ta.setSelectionRange(start, end);\n const inserted = document.execCommand('insertText', false, replacement);\n if (inserted) {\n // execCommand dispatched a native `input` event, so `handleInput`\n // already synced `value` and emitted `nile-input`; just fix selection.\n ta.setSelectionRange(selectStart, selectEnd);\n return;\n }\n // Fallback for environments without execCommand support.\n ta.value = ta.value.slice(0, start) + replacement + ta.value.slice(end);\n ta.setSelectionRange(selectStart, selectEnd);\n this.value = ta.value;\n this.emit('nile-input', { value: this.value }, true, true);\n }\n\n /** Wraps (or unwraps) the selection with prefix/suffix delimiters. */\n private applyWrap(action: WrapAction) {\n const ta = this.textarea;\n if (!ta) return;\n const { selectionStart: start, selectionEnd: end, value } = ta;\n const { prefix, suffix } = action;\n const selected = value.slice(start, end);\n\n // Toggle off when the selection is already wrapped\n const before = value.slice(Math.max(0, start - prefix.length), start);\n const after = value.slice(end, end + suffix.length);\n if (before === prefix && after === suffix) {\n this.replaceSelection(\n start - prefix.length,\n end + suffix.length,\n selected,\n start - prefix.length,\n end - prefix.length\n );\n return;\n }\n\n const content = selected || action.placeholder;\n this.replaceSelection(\n start,\n end,\n prefix + content + suffix,\n start + prefix.length,\n start + prefix.length + content.length\n );\n }\n\n /** Toggles a markdown prefix on every line in the selection. */\n private applyLinePrefix(action: LineAction) {\n const ta = this.textarea;\n if (!ta) return;\n const { selectionStart: start, selectionEnd: end, value } = ta;\n\n // Expand the selection to whole lines\n const lineStart = value.lastIndexOf('\\n', start - 1) + 1;\n const lineEndIndex = value.indexOf('\\n', end);\n const lineEnd = lineEndIndex === -1 ? value.length : lineEndIndex;\n const block = value.slice(lineStart, lineEnd);\n const lines = block.split('\\n');\n\n const matcher = action.numbered ? /^\\d+\\.\\s/ : undefined;\n const hasPrefix = lines.every(line =>\n matcher ? matcher.test(line) : line.startsWith(action.prefix)\n );\n\n const replaced = lines\n .map((line, i) => {\n if (hasPrefix) {\n return matcher\n ? line.replace(matcher, '')\n : line.slice(action.prefix.length);\n }\n return action.numbered ? `${i + 1}. ${line}` : action.prefix + line;\n })\n .join('\\n');\n\n this.replaceSelection(\n lineStart,\n lineEnd,\n replaced,\n lineStart,\n lineStart + replaced.length\n );\n }\n\n /** Inserts a `[text](url)` link, selecting the URL for quick editing. */\n private insertLink() {\n const ta = this.textarea;\n if (!ta) return;\n const { selectionStart: start, selectionEnd: end, value } = ta;\n const text = value.slice(start, end) || 'text';\n const url = 'url';\n const replacement = `[${text}](${url})`;\n const urlStart = start + text.length + 3; // \"[text](\".length\n this.replaceSelection(\n start,\n end,\n replacement,\n urlStart,\n urlStart + url.length\n );\n }\n\n private runAction(action: ToolbarAction) {\n if (this.readonly || this.disabled) return;\n if (this.mode === 'preview') this.setMode('write');\n switch (action.kind) {\n case 'wrap':\n this.applyWrap(action);\n break;\n case 'line':\n this.applyLinePrefix(action);\n break;\n case 'link':\n this.insertLink();\n break;\n case 'menu':\n // The dropdown items drive the edits via `runMenuItem`; nothing to do\n // when the trigger itself is activated.\n break;\n }\n }\n\n /** Applies a heading-style line prefix chosen from a dropdown menu. */\n private runMenuItem(action: MenuAction, item: MenuItem) {\n if (this.readonly || this.disabled) return;\n if (this.mode === 'preview') this.setMode('write');\n this.applyLinePrefix({\n name: action.name,\n title: action.title,\n kind: 'line',\n prefix: item.prefix,\n });\n }\n\n /** Renders the glyph/icon shown inside a toolbar control. */\n private renderActionContent(action: ToolbarAction): TemplateResult {\n if (action.icon) {\n return html`<nile-icon\n name=${action.icon}\n size=\"20\"\n color=${this.disabled\n ? 'var(--nile-colors-neutral-500, var(--ng-colors-fg-disabled-subtle))'\n : 'var(--nile-colors-dark-900, var(--ng-colors-text-primary-900))'}\n ></nile-icon>`;\n }\n // `ng-*` glyph names map to nile-glyph icons; anything else is plain text.\n if (action.glyph?.startsWith('ng-')) {\n return html`<nile-glyph\n name=${action.glyph}\n method=\"stroke\"\n color=${this.disabled\n ? 'var(--nile-colors-neutral-500, var(--ng-colors-fg-disabled-subtle))'\n : 'var(--nile-colors-dark-900, var(--ng-colors-text-primary-900))'}\n size=\"20\"\n ></nile-glyph>`;\n }\n return html`<span class=\"toolbar__glyph--${action.name}\">\n ${action.glyph}\n </span>`;\n }\n\n /** A standard click-to-apply toolbar button. */\n private renderActionButton(action: ToolbarAction): TemplateResult {\n return html`\n <button\n type=\"button\"\n class=\"toolbar__button\"\n title=${action.title}\n aria-label=${action.title}\n tabindex=\"-1\"\n @mousedown=${(e: MouseEvent) => e.preventDefault()}\n @click=${() => this.runAction(action)}\n >\n ${this.renderActionContent(action)}\n </button>\n `;\n }\n\n /** A toolbar control that opens a dropdown of line-prefix choices. */\n private renderMenuAction(action: MenuAction): TemplateResult {\n return html`\n <nile-dropdown\n class=\"toolbar__menu\"\n placement=\"bottom-start\"\n ?disabled=${this.disabled || this.readonly}\n >\n <button\n slot=\"trigger\"\n type=\"button\"\n class=\"toolbar__button\"\n title=${action.title}\n aria-label=${action.title}\n aria-haspopup=\"menu\"\n tabindex=\"-1\"\n @mousedown=${(e: MouseEvent) => e.preventDefault()}\n >\n ${this.renderActionContent(action)}\n </button>\n <nile-menu>\n ${action.items.map(\n item => html`\n <nile-menu-item\n @click=${() => this.runMenuItem(action, item)}\n >\n ${item.glyph\n ? html`<nile-glyph\n slot=\"prefix\"\n name=${item.glyph}\n method=\"stroke\"\n color=\"currentColor\"\n size=\"18\"\n ></nile-glyph>`\n : nothing}\n ${item.label}\n </nile-menu-item>\n `\n )}\n </nile-menu>\n </nile-dropdown>\n `;\n }\n\n private renderToolbar(): TemplateResult | typeof nothing {\n if (this.hideToolbar || this.mode === 'preview') return nothing;\n const groups = this.visibleGroups;\n if (groups.length === 0) return nothing;\n return html`\n <div\n class=\"toolbar\"\n part=\"toolbar\"\n role=\"toolbar\"\n aria-label=\"Formatting\"\n >\n ${groups.map(\n (group, groupIndex) => html`\n ${groupIndex > 0\n ? html`<span class=\"toolbar__divider\"></span>`\n : nothing}\n ${group.map(action =>\n action.kind === 'menu'\n ? this.renderMenuAction(action)\n : this.renderActionButton(action)\n )}\n `\n )}\n </div>\n `;\n }\n\n render(): TemplateResult {\n const showWrite = this.mode !== 'preview';\n const showPreview = this.mode !== 'write';\n\n return html`\n <div\n class=${classMap({\n editor: true,\n 'editor--disabled': this.disabled,\n 'editor--split': this.mode === 'split',\n })}\n part=\"base\"\n >\n <div class=\"header\" part=\"header\">\n <nile-button-toggle-group\n class=\"tabs\"\n aria-label=\"Editor view\"\n .value=${this.mode}\n @nile-change=${(e: CustomEvent) =>\n this.setMode(e.detail.value as MarkdownEditorMode)}\n >\n ${(['write', 'preview', 'split'] as const).map(\n mode => html`\n <nile-button-toggle\n value=${mode}\n ?active=${this.mode === mode}\n >\n <span class=\"tab__content\">\n <nile-glyph\n name=${TAB_GLYPHS[mode]}\n method=\"stroke\"\n color=\"currentColor\"\n size=\"16\"\n ></nile-glyph>\n </span>\n </nile-button-toggle>\n `\n )}\n </nile-button-toggle-group>\n ${this.renderToolbar()}\n </div>\n <div\n class=${classMap({ body: true, 'body--dragging': this.splitDragging })}\n >\n ${showWrite\n ? html`\n <div\n class=\"pane pane--write\"\n style=${this.mode === 'split'\n ? `flex: 0 0 ${this.splitRatio * 100}%`\n : nothing}\n >\n <textarea\n part=\"textarea\"\n rows=${this.rows}\n placeholder=${this.placeholder}\n ?disabled=${this.disabled}\n ?readonly=${this.readonly}\n .value=${this.value}\n @input=${this.handleInput}\n @change=${this.handleChange}\n @keydown=${this.handleKeydown}\n ></textarea>\n </div>\n `\n : nothing}\n ${this.mode === 'split'\n ? html`\n <div\n class=\"gutter\"\n part=\"gutter\"\n role=\"separator\"\n aria-orientation=\"vertical\"\n aria-label=\"Resize editor and preview\"\n title=\"Drag to resize · double-click to reset\"\n @pointerdown=${this.startSplitDrag}\n @dblclick=${this.resetSplit}\n ></div>\n `\n : nothing}\n ${showPreview\n ? html`\n <div class=\"pane pane--preview\" part=\"preview\">\n ${this.value.trim()\n ? html`<nile-markdown .value=${this.value}></nile-markdown>`\n : html`<span class=\"preview-empty\"\n >Nothing to preview</span\n >`}\n </div>\n `\n : nothing}\n </div>\n </div>\n `;\n }\n}\n\nexport default NileMarkdownEditor;\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nile-markdown-editor': NileMarkdownEditor;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"nile-markdown-editor.js","sourceRoot":"","sources":["../../../src/nile-markdown-editor/nile-markdown-editor.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;AAEH,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1E,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACpD,OAAO,WAAW,MAAM,0BAA0B,CAAC;AACnD,OAAO,gCAAgC,CAAC;AACxC,OAAO,cAAc,CAAC;AACtB,OAAO,sDAAsD,CAAC;AAC9D,OAAO,0CAA0C,CAAC;AAClD,OAAO,gCAAgC,CAAC;AACxC,OAAO,wBAAwB,CAAC;AAChC,OAAO,kCAAkC,CAAC;AAyD1C,4EAA4E;AAC5E,MAAM,c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AAC;gBACtB,IAAI,CAAC;oBACH,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;oBACjC,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;wBAC1B,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;oBAC3D,CAAC;gBACH,CAAC;gBAAC,MAAM,CAAC;oBACP,oDAAoD;gBACtD,CAAC;gBACD,OAAO,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;YAC7D,CAAC;YACD,WAAW,EAAE,CAAC,KAAe,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,IAAI,EAAE,CAAC;SAC9D;KACF,CAAC;iDACmB;AAiBM;IAA1B,KAAK,CAAC,UAAU,CAAC;oDAAwC;AAElC;IAAvB,KAAK,CAAC,OAAO,CAAC;kDAA8B;AAO5B;IAAhB,KAAK,EAAE;sDAA0B;AAGjB;IAAhB,KAAK,EAAE;yDAA+B;AA7E5B,kBAAkB;IAD9B,aAAa,CAAC,sBAAsB,CAAC;GACzB,kBAAkB,CA2f9B;;AAED,eAAe,kBAAkB,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 { html, nothing } from 'lit';\nimport { customElement, property, query, state } from 'lit/decorators.js';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { styles } from './nile-markdown-editor.css';\nimport NileElement from '../internal/nile-element';\nimport '../nile-markdown/nile-markdown';\nimport '../nile-icon';\nimport '../nile-button-toggle-group/nile-button-toggle-group';\nimport '../nile-button-toggle/nile-button-toggle';\nimport '../nile-dropdown/nile-dropdown';\nimport '../nile-menu/nile-menu';\nimport '../nile-menu-item/nile-menu-item';\nimport type { CSSResultGroup, TemplateResult } from 'lit';\n\nexport type MarkdownEditorMode = 'write' | 'preview' | 'split';\n\n/** A toolbar action that wraps the selection with markdown delimiters. */\ninterface WrapAction {\n name: string;\n title: string;\n kind: 'wrap';\n prefix: string;\n suffix: string;\n placeholder: string;\n icon?: string;\n glyph?: string;\n}\n\n/** A toolbar action that toggles a prefix on each selected line. */\ninterface LineAction {\n name: string;\n title: string;\n kind: 'line';\n prefix: string;\n numbered?: boolean;\n icon?: string;\n glyph?: string;\n}\n\ninterface LinkAction {\n name: string;\n title: string;\n kind: 'link';\n icon?: string;\n glyph?: string;\n}\n\n/** A single option inside a {@link MenuAction} dropdown. */\ninterface MenuItem {\n label: string;\n /** The line prefix applied when this item is chosen, e.g. `'## '`. */\n prefix: string;\n /** Optional nile-glyph name shown beside the label. */\n glyph?: string;\n}\n\n/** A toolbar action that opens a dropdown of line-prefix choices. */\ninterface MenuAction {\n name: string;\n title: string;\n kind: 'menu';\n items: MenuItem[];\n icon?: string;\n glyph?: string;\n}\n\ntype ToolbarAction = WrapAction | LineAction | LinkAction | MenuAction;\n\n/** Toolbar actions, grouped — groups are separated by vertical dividers. */\nconst TOOLBAR_GROUPS: ToolbarAction[][] = [\n [\n {\n name: 'heading',\n title: 'Heading',\n kind: 'menu',\n glyph: 'ng-heading',\n items: [\n { label: 'Heading 1', prefix: '# ', glyph: 'ng-heading-1' },\n { label: 'Heading 2', prefix: '## ', glyph: 'ng-heading-2' },\n { label: 'Heading 3', prefix: '### ', glyph: 'ng-heading-3' },\n { label: 'Heading 4', prefix: '#### ', glyph: 'ng-heading-4' },\n { label: 'Heading 5', prefix: '##### ', glyph: 'ng-heading-5' },\n { label: 'Heading 6', prefix: '###### ', glyph: 'ng-heading-6' },\n ],\n },\n {\n name: 'bold',\n title: 'Bold (Ctrl+B)',\n kind: 'wrap',\n prefix: '**',\n suffix: '**',\n placeholder: 'bold text',\n icon: 'format_bold',\n },\n {\n name: 'italic',\n title: 'Italic (Ctrl+I)',\n kind: 'wrap',\n prefix: '_',\n suffix: '_',\n placeholder: 'italic text',\n icon: 'format_italic',\n },\n {\n name: 'strikethrough',\n title: 'Strikethrough',\n kind: 'wrap',\n prefix: '~~',\n suffix: '~~',\n placeholder: 'text',\n glyph: 'ng-strikethrough',\n },\n ],\n [\n { name: 'quote', title: 'Quote', kind: 'line', prefix: '> ', glyph: 'ng-quote' },\n {\n name: 'code',\n title: 'Code',\n kind: 'wrap',\n prefix: '`',\n suffix: '`',\n placeholder: 'code',\n glyph: 'ng-code',\n },\n ],\n [\n {\n name: 'ul',\n title: 'Bulleted list',\n kind: 'line',\n prefix: '- ',\n icon: 'format_list_bulleted',\n },\n {\n name: 'ol',\n title: 'Numbered list',\n kind: 'line',\n prefix: '1. ',\n numbered: true,\n icon: 'format_list_numbered',\n },\n ],\n [{ name: 'link', title: 'Link (Ctrl+K)', kind: 'link', icon: 'link_2' }],\n];\n\nconst TOOLBAR_ACTIONS: ToolbarAction[] = TOOLBAR_GROUPS.flat();\n\n/** Glyph shown alongside each view-mode tab label. */\nconst TAB_GLYPHS: Record<MarkdownEditorMode, string> = {\n write: 'ng-pencil',\n preview: 'ng-eye',\n split: 'ng-square-split-horizontal',\n};\n\n/**\n * Nile markdown editor component.\n *\n * @tag nile-markdown-editor\n */\n\n/**\n * @summary A GitHub-style markdown editor with a formatting toolbar and a\n * live preview rendered by `nile-markdown`.\n * @status experimental\n *\n * @dependency nile-markdown\n * @dependency nile-icon\n * @dependency nile-glyph\n * @dependency nile-button-toggle-group\n * @dependency nile-button-toggle\n *\n * @attr {string} tools - JSON-array allowlist of toolbar tools to show, e.g.\n * `tools='[\"bold\",\"italic\",\"link\"]'`. Valid names: heading, bold, italic,\n * strikethrough, quote, code, ul, ol, link. Empty shows all.\n *\n * @event nile-input - Emitted with `{ value }` on every keystroke or toolbar action.\n * @event nile-change - Emitted with `{ value }` when the editor loses focus after an edit.\n * @event nile-mode-change - Emitted with `{ mode }` when the write/preview/split mode changes.\n *\n * @csspart base - The component's base wrapper.\n * @csspart header - The header containing the tabs and toolbar.\n * @csspart toolbar - The formatting toolbar.\n * @csspart textarea - The markdown source textarea.\n * @csspart preview - The rendered preview pane.\n */\n\n@customElement('nile-markdown-editor')\nexport class NileMarkdownEditor extends NileElement {\n static styles: CSSResultGroup = styles;\n\n /** The markdown source. */\n @property() value = '';\n\n /** Placeholder shown when the editor is empty. */\n @property() placeholder = 'Write markdown here…';\n\n /** Disables the editor. */\n @property({ type: Boolean, reflect: true }) disabled = false;\n\n /** Makes the source read-only while still allowing mode switching. */\n @property({ type: Boolean, reflect: true }) readonly = false;\n\n /** Number of visible text rows in write mode. */\n @property({ type: Number }) rows = 8;\n\n /** Active view: `write`, `preview`, or `split`. */\n @property({ reflect: true }) mode: MarkdownEditorMode = 'write';\n\n /** Hides the formatting toolbar. */\n @property({ type: Boolean, attribute: 'hide-toolbar' }) hideToolbar = false;\n\n /**\n * Allowlist of toolbar tool names to show. Accepts a JSON array via the\n * `tools` attribute (e.g. `tools='[\"bold\",\"italic\",\"link\"]'`), a\n * comma-separated string, or an array when set as a property. When empty\n * (default) every tool is shown. Valid names: `heading`, `bold`, `italic`,\n * `strikethrough`, `quote`, `code`, `ul`, `ol`, `link`.\n */\n @property({\n converter: {\n fromAttribute: (value: string | null) => {\n if (!value) return [];\n try {\n const parsed = JSON.parse(value);\n if (Array.isArray(parsed)) {\n return parsed.map(s => String(s).trim()).filter(Boolean);\n }\n } catch {\n // Not JSON — fall back to a comma-separated string.\n }\n return value.split(',').map(s => s.trim()).filter(Boolean);\n },\n toAttribute: (value: string[]) => JSON.stringify(value ?? []),\n },\n })\n tools: string[] = [];\n\n /** Parsed allowlist, or `null` when no allowlist is set (show everything). */\n private get allowedTools(): Set<string> | null {\n const names = (this.tools ?? []).map(s => s.trim()).filter(Boolean);\n return names.length ? new Set(names) : null;\n }\n\n /** Toolbar groups after applying the allowlist; empty groups are dropped. */\n private get visibleGroups(): ToolbarAction[][] {\n const allowed = this.allowedTools;\n if (!allowed) return TOOLBAR_GROUPS;\n return TOOLBAR_GROUPS.map(group =>\n group.filter(action => allowed.has(action.name))\n ).filter(group => group.length > 0);\n }\n\n @query('textarea') private textarea?: HTMLTextAreaElement;\n\n @query('.body') private bodyEl?: HTMLElement;\n\n /**\n * Fraction of the body width given to the write pane in split mode\n * (the rest goes to the preview). Clamped to a sensible range while\n * dragging the splitter.\n */\n @state() private splitRatio = 0.5;\n\n /** Whether the split divider is currently being dragged. */\n @state() private splitDragging = false;\n\n /** Begins a pointer-driven resize of the split divider. */\n private startSplitDrag = (e: PointerEvent) => {\n if (this.mode !== 'split') return;\n const body = this.bodyEl;\n if (!body) return;\n e.preventDefault();\n this.splitDragging = true;\n\n const rect = body.getBoundingClientRect();\n const MIN = 0.15;\n const MAX = 0.85;\n\n const onMove = (ev: PointerEvent) => {\n if (rect.width === 0) return;\n const ratio = (ev.clientX - rect.left) / rect.width;\n this.splitRatio = Math.min(MAX, Math.max(MIN, ratio));\n };\n const onUp = () => {\n this.splitDragging = false;\n window.removeEventListener('pointermove', onMove);\n window.removeEventListener('pointerup', onUp);\n };\n window.addEventListener('pointermove', onMove);\n window.addEventListener('pointerup', onUp);\n };\n\n /** Resets the splitter to a 50/50 layout (double-click affordance). */\n private resetSplit = () => {\n this.splitRatio = 0.5;\n };\n\n /** Moves focus to the textarea. */\n focus(options?: FocusOptions): void {\n this.textarea?.focus(options);\n }\n\n blur(): void {\n this.textarea?.blur();\n }\n\n private setMode(mode: MarkdownEditorMode) {\n if (this.mode === mode) return;\n this.mode = mode;\n this.emit('nile-mode-change', { mode }, true, true);\n }\n\n private handleInput = (e: Event) => {\n this.value = (e.target as HTMLTextAreaElement).value;\n this.emit('nile-input', { value: this.value }, true, true);\n };\n\n private handleChange = () => {\n this.emit('nile-change', { value: this.value }, true, true);\n };\n\n private handleKeydown = (e: KeyboardEvent) => {\n if (!(e.metaKey || e.ctrlKey)) return;\n const key = e.key.toLowerCase();\n const action = { b: 'bold', i: 'italic', k: 'link' }[\n key as 'b' | 'i' | 'k'\n ];\n if (!action) return;\n // Respect the allowlist: a hidden tool's shortcut is disabled too.\n const allowed = this.allowedTools;\n if (allowed && !allowed.has(action)) return;\n e.preventDefault();\n this.runAction(TOOLBAR_ACTIONS.find(a => a.name === action)!);\n };\n\n /** Replaces the current selection and restores focus/selection. */\n private replaceSelection(\n start: number,\n end: number,\n replacement: string,\n selectStart: number,\n selectEnd: number\n ) {\n const ta = this.textarea;\n if (!ta) return;\n ta.focus();\n // Select the range to overwrite, then insert via the browser's editing\n // pipeline so the change is recorded on the native undo/redo stack.\n // Assigning `ta.value` directly would wipe that stack and break Ctrl/Cmd+Z.\n ta.setSelectionRange(start, end);\n const inserted = document.execCommand('insertText', false, replacement);\n if (inserted) {\n // execCommand dispatched a native `input` event, so `handleInput`\n // already synced `value` and emitted `nile-input`; just fix selection.\n ta.setSelectionRange(selectStart, selectEnd);\n return;\n }\n // Fallback for environments without execCommand support.\n ta.value = ta.value.slice(0, start) + replacement + ta.value.slice(end);\n ta.setSelectionRange(selectStart, selectEnd);\n this.value = ta.value;\n this.emit('nile-input', { value: this.value }, true, true);\n }\n\n /** Wraps (or unwraps) the selection with prefix/suffix delimiters. */\n private applyWrap(action: WrapAction) {\n const ta = this.textarea;\n if (!ta) return;\n const { selectionStart: start, selectionEnd: end, value } = ta;\n const { prefix, suffix } = action;\n const selected = value.slice(start, end);\n\n // Toggle off when the selection is already wrapped\n const before = value.slice(Math.max(0, start - prefix.length), start);\n const after = value.slice(end, end + suffix.length);\n if (before === prefix && after === suffix) {\n this.replaceSelection(\n start - prefix.length,\n end + suffix.length,\n selected,\n start - prefix.length,\n end - prefix.length\n );\n return;\n }\n\n const content = selected || action.placeholder;\n this.replaceSelection(\n start,\n end,\n prefix + content + suffix,\n start + prefix.length,\n start + prefix.length + content.length\n );\n }\n\n /** Toggles a markdown prefix on every line in the selection. */\n private applyLinePrefix(action: LineAction) {\n const ta = this.textarea;\n if (!ta) return;\n const { selectionStart: start, selectionEnd: end, value } = ta;\n\n // Expand the selection to whole lines\n const lineStart = value.lastIndexOf('\\n', start - 1) + 1;\n const lineEndIndex = value.indexOf('\\n', end);\n const lineEnd = lineEndIndex === -1 ? value.length : lineEndIndex;\n const block = value.slice(lineStart, lineEnd);\n const lines = block.split('\\n');\n\n const matcher = action.numbered ? /^\\d+\\.\\s/ : undefined;\n const hasPrefix = lines.every(line =>\n matcher ? matcher.test(line) : line.startsWith(action.prefix)\n );\n\n const replaced = lines\n .map((line, i) => {\n if (hasPrefix) {\n return matcher\n ? line.replace(matcher, '')\n : line.slice(action.prefix.length);\n }\n return action.numbered ? `${i + 1}. ${line}` : action.prefix + line;\n })\n .join('\\n');\n\n this.replaceSelection(\n lineStart,\n lineEnd,\n replaced,\n lineStart,\n lineStart + replaced.length\n );\n }\n\n /** Inserts a `[text](url)` link, selecting the URL for quick editing. */\n private insertLink() {\n const ta = this.textarea;\n if (!ta) return;\n const { selectionStart: start, selectionEnd: end, value } = ta;\n const text = value.slice(start, end) || 'text';\n const url = 'url';\n const replacement = `[${text}](${url})`;\n const urlStart = start + text.length + 3; // \"[text](\".length\n this.replaceSelection(\n start,\n end,\n replacement,\n urlStart,\n urlStart + url.length\n );\n }\n\n private runAction(action: ToolbarAction) {\n if (this.readonly || this.disabled) return;\n if (this.mode === 'preview') this.setMode('write');\n switch (action.kind) {\n case 'wrap':\n this.applyWrap(action);\n break;\n case 'line':\n this.applyLinePrefix(action);\n break;\n case 'link':\n this.insertLink();\n break;\n case 'menu':\n // The dropdown items drive the edits via `runMenuItem`; nothing to do\n // when the trigger itself is activated.\n break;\n }\n }\n\n /** Applies a heading-style line prefix chosen from a dropdown menu. */\n private runMenuItem(action: MenuAction, item: MenuItem) {\n if (this.readonly || this.disabled) return;\n if (this.mode === 'preview') this.setMode('write');\n this.applyLinePrefix({\n name: action.name,\n title: action.title,\n kind: 'line',\n prefix: item.prefix,\n });\n }\n\n /** Renders the glyph/icon shown inside a toolbar control. */\n private renderActionContent(action: ToolbarAction): TemplateResult {\n if (action.icon) {\n return html`<nile-icon\n name=${action.icon}\n size=\"20\"\n color=${this.disabled\n ? 'var(--nile-colors-neutral-500, var(--ng-colors-fg-disabled-subtle))'\n : 'var(--nile-colors-dark-900, var(--ng-colors-text-primary-900))'}\n ></nile-icon>`;\n }\n // `ng-*` glyph names map to nile-glyph icons; anything else is plain text.\n if (action.glyph?.startsWith('ng-')) {\n return html`<nile-glyph\n name=${action.glyph}\n method=\"stroke\"\n color=${this.disabled\n ? 'var(--nile-colors-neutral-500, var(--ng-colors-fg-disabled-subtle))'\n : 'var(--nile-colors-dark-900, var(--ng-colors-text-primary-900))'}\n size=\"20\"\n ></nile-glyph>`;\n }\n return html`<span class=\"toolbar__glyph--${action.name}\">\n ${action.glyph}\n </span>`;\n }\n\n /** A standard click-to-apply toolbar button. */\n private renderActionButton(action: ToolbarAction): TemplateResult {\n return html`\n <button\n type=\"button\"\n class=\"toolbar__button\"\n title=${action.title}\n aria-label=${action.title}\n tabindex=\"-1\"\n @mousedown=${(e: MouseEvent) => e.preventDefault()}\n @click=${() => this.runAction(action)}\n >\n ${this.renderActionContent(action)}\n </button>\n `;\n }\n\n /** A toolbar control that opens a dropdown of line-prefix choices. */\n private renderMenuAction(action: MenuAction): TemplateResult {\n return html`\n <nile-dropdown\n class=\"toolbar__menu\"\n placement=\"bottom-start\"\n ?disabled=${this.disabled || this.readonly}\n >\n <button\n slot=\"trigger\"\n type=\"button\"\n class=\"toolbar__button\"\n title=${action.title}\n aria-label=${action.title}\n aria-haspopup=\"menu\"\n tabindex=\"-1\"\n @mousedown=${(e: MouseEvent) => e.preventDefault()}\n >\n ${this.renderActionContent(action)}\n </button>\n <nile-menu>\n ${action.items.map(\n item => html`\n <nile-menu-item\n @click=${() => this.runMenuItem(action, item)}\n >\n ${item.glyph\n ? html`<nile-glyph\n slot=\"prefix\"\n name=${item.glyph}\n method=\"stroke\"\n color=\"currentColor\"\n size=\"18\"\n ></nile-glyph>`\n : nothing}\n ${item.label}\n </nile-menu-item>\n `\n )}\n </nile-menu>\n </nile-dropdown>\n `;\n }\n\n private renderToolbar(): TemplateResult | typeof nothing {\n if (this.hideToolbar || this.mode === 'preview') return nothing;\n const groups = this.visibleGroups;\n if (groups.length === 0) return nothing;\n return html`\n <div\n class=\"toolbar\"\n part=\"toolbar\"\n role=\"toolbar\"\n aria-label=\"Formatting\"\n >\n ${groups.map(\n (group, groupIndex) => html`\n ${groupIndex > 0\n ? html`<span class=\"toolbar__divider\"></span>`\n : nothing}\n ${group.map(action =>\n action.kind === 'menu'\n ? this.renderMenuAction(action)\n : this.renderActionButton(action)\n )}\n `\n )}\n </div>\n `;\n }\n\n render(): TemplateResult {\n const showWrite = this.mode !== 'preview';\n const showPreview = this.mode !== 'write';\n\n return html`\n <div\n class=${classMap({\n editor: true,\n 'editor--disabled': this.disabled,\n 'editor--split': this.mode === 'split',\n })}\n part=\"base\"\n >\n <div class=\"header\" part=\"header\">\n ${this.renderToolbar()}\n <nile-button-toggle-group\n class=\"tabs\"\n aria-label=\"Editor view\"\n .value=${this.mode}\n @nile-change=${(e: CustomEvent) =>\n this.setMode(e.detail.value as MarkdownEditorMode)}\n >\n ${(['write', 'preview', 'split'] as const).map(\n mode => html`\n <nile-button-toggle\n value=${mode}\n ?active=${this.mode === mode}\n >\n <span class=\"tab__content\">\n <nile-glyph\n name=${TAB_GLYPHS[mode]}\n method=\"stroke\"\n color=\"currentColor\"\n size=\"16\"\n ></nile-glyph>\n </span>\n </nile-button-toggle>\n `\n )}\n </nile-button-toggle-group>\n </div>\n <div\n class=${classMap({ body: true, 'body--dragging': this.splitDragging })}\n >\n ${showWrite\n ? html`\n <div\n class=\"pane pane--write\"\n style=${this.mode === 'split'\n ? `flex: 0 0 ${this.splitRatio * 100}%`\n : nothing}\n >\n <textarea\n part=\"textarea\"\n rows=${this.rows}\n placeholder=${this.placeholder}\n ?disabled=${this.disabled}\n ?readonly=${this.readonly}\n .value=${this.value}\n @input=${this.handleInput}\n @change=${this.handleChange}\n @keydown=${this.handleKeydown}\n ></textarea>\n </div>\n `\n : nothing}\n ${this.mode === 'split'\n ? html`\n <div\n class=\"gutter\"\n part=\"gutter\"\n role=\"separator\"\n aria-orientation=\"vertical\"\n aria-label=\"Resize editor and preview\"\n title=\"Drag to resize · double-click to reset\"\n @pointerdown=${this.startSplitDrag}\n @dblclick=${this.resetSplit}\n ></div>\n `\n : nothing}\n ${showPreview\n ? html`\n <div class=\"pane pane--preview\" part=\"preview\">\n ${this.value.trim()\n ? html`<nile-markdown .value=${this.value}></nile-markdown>`\n : html`<span class=\"preview-empty\"\n >Nothing to preview</span\n >`}\n </div>\n `\n : nothing}\n </div>\n </div>\n `;\n }\n}\n\nexport default NileMarkdownEditor;\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nile-markdown-editor': NileMarkdownEditor;\n }\n}\n"]}
|
|
@@ -30,12 +30,15 @@ export const styles = css `
|
|
|
30
30
|
line-height: var(--nile-line-height-1-8, var(--ng-line-height-text-md));
|
|
31
31
|
letter-spacing: normal;
|
|
32
32
|
color: var(--nile-color-dark-1, var(--ng-colors-text-primary-900));
|
|
33
|
-
padding: var(--nile-spacing-sm, var(--ng-spacing-md)) var(--nile-spacing-none, var(--ng-spacing-
|
|
33
|
+
padding: var(--nile-spacing-sm, var(--ng-spacing-md)) var(--nile-spacing-none, var(--ng-spacing-none));
|
|
34
34
|
transition: 150ms fill;
|
|
35
35
|
font-family: var(--nile-font-family-serif, var(--ng-font-family-body));
|
|
36
36
|
cursor: pointer;
|
|
37
37
|
margin-bottom: var(--nile-spacing-none, var(--ng-spacing-xxs) )
|
|
38
38
|
}
|
|
39
|
+
:host([legacy]) .option {
|
|
40
|
+
padding: var(--nile-spacing-sm, var(--ng-spacing-md)) var(--nile-spacing-none, var(--ng-spacing-md));
|
|
41
|
+
}
|
|
39
42
|
|
|
40
43
|
.option--single-select {
|
|
41
44
|
padding: var(--nile-spacing-9px, var(--ng-spacing-md)) var(--nile-spacing-lg, var(--ng-spacing-md));
|
|
@@ -75,12 +78,17 @@ export const styles = css `
|
|
|
75
78
|
justify-content: center;
|
|
76
79
|
visibility: hidden;
|
|
77
80
|
padding-inline-end: var(--nile-spacing-xs);
|
|
81
|
+
color: var(--nile-colors-primary-600, var(--ng-colors-fg-brand-primary-600));
|
|
78
82
|
}
|
|
79
83
|
|
|
80
84
|
.option--selected .option__check {
|
|
81
85
|
visibility: visible;
|
|
82
86
|
}
|
|
83
87
|
|
|
88
|
+
:host([tickonselect][selected]) .option__check {
|
|
89
|
+
visibility: visible;
|
|
90
|
+
}
|
|
91
|
+
|
|
84
92
|
.option__prefix,
|
|
85
93
|
.option__suffix {
|
|
86
94
|
flex: 0 0 auto;
|
|
@@ -105,9 +113,22 @@ export const styles = css `
|
|
|
105
113
|
margin-left: var(--nile-spacing-lg, var(--ng-spacing-lg));
|
|
106
114
|
margin-right: var(--nile-spacing-lg, var(--ng-spacing-lg));
|
|
107
115
|
width:auto;
|
|
116
|
+
display:var(--nile-display-inline-block, var(--ng-display-inline-block));
|
|
117
|
+
}
|
|
118
|
+
:host([legacy]) .option--checkbox{
|
|
108
119
|
display:var(--nile-display-inline-block, var(--ng-display-none));
|
|
109
120
|
}
|
|
110
121
|
|
|
122
|
+
|
|
123
|
+
:host([tickonselect]) .option--checkbox{
|
|
124
|
+
display: none;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
:host([tickonselect]) .option{
|
|
128
|
+
padding-left: var(--nile-spacing-lg, var(--ng-spacing-lg));
|
|
129
|
+
padding-right: var(--nile-spacing-lg, var(--ng-spacing-lg));
|
|
130
|
+
}
|
|
131
|
+
|
|
111
132
|
|
|
112
133
|
@media (forced-colors: active) {
|
|
113
134
|
:host(:hover:not([aria-disabled='true'])) .option {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nile-option.css.js","sourceRoot":"","sources":["../../../src/nile-option/nile-option.css.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B;;GAEG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA
|
|
1
|
+
{"version":3,"file":"nile-option.css.js","sourceRoot":"","sources":["../../../src/nile-option/nile-option.css.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B;;GAEG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0JxB,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';\n\n/**\n * Option_2 CSS\n */\nexport const styles = css`\n :host {\n display: block;\n user-select: none;\n -webkit-font-smoothing: var(--nile-webkit-font-smoothing, var(--ng-webkit-font-smoothing));\n -moz-osx-font-smoothing: var(--nile-moz-osx-font-smoothing, var(--ng-moz-osx-font-smoothing));\n text-rendering: var(--nile-text-rendering, var(--ng-text-rendering));\n }\n\n :host(:focus) {\n outline: none;\n }\n\n .option {\n position: relative;\n display: flex;\n align-items: center;\n font-size: var(--nile-type-scale-3, var(--ng-font-size-text-md));\n font-weight: var(--nile-font-weight-regular, var(--ng-font-weight-medium));\n line-height: var(--nile-line-height-1-8, var(--ng-line-height-text-md));\n letter-spacing: normal;\n color: var(--nile-color-dark-1, var(--ng-colors-text-primary-900));\n padding: var(--nile-spacing-sm, var(--ng-spacing-md)) var(--nile-spacing-none, var(--ng-spacing-none));\n transition: 150ms fill;\n font-family: var(--nile-font-family-serif, var(--ng-font-family-body));\n cursor: pointer;\n margin-bottom: var(--nile-spacing-none, var(--ng-spacing-xxs) )\n }\n :host([legacy]) .option {\n padding: var(--nile-spacing-sm, var(--ng-spacing-md)) var(--nile-spacing-none, var(--ng-spacing-md));\n }\n\n .option--single-select {\n padding: var(--nile-spacing-9px, var(--ng-spacing-md)) var(--nile-spacing-lg, var(--ng-spacing-md));\n }\n\n .option--hover:not(.option--current):not(.option--disabled) {\n background-color: var(--nile-colors-primary-100, var(--ng-colors-bg-active));\n color: var(--nile-colors-dark-900, var(--ng-colors-text-primary-900));\n border-radius: var(--nile-radius-none, var(--ng-radius-sm));\n }\n\n .option--current,\n .option--current.option--disabled {\n background-color: var(--nile-colors-primary-100, var(--ng-colors-bg-active));\n color: var(--nile-colors-primary-600, var(--ng-colors-text-primary-900));\n opacity: 1;\n border-radius: var(--nile-radius-none, var(--ng-radius-sm));\n }\n\n .option--disabled {\n outline: none;\n opacity: 0.5;\n cursor: not-allowed;\n }\n\n .option__label {\n flex: 1 1 auto;\n display: inline-block;\n line-height: 1.4;\n word-break: break-all;\n }\n\n .option .option__check {\n flex: 0 0 auto;\n display: flex;\n align-items: center;\n justify-content: center;\n visibility: hidden;\n padding-inline-end: var(--nile-spacing-xs);\n color: var(--nile-colors-primary-600, var(--ng-colors-fg-brand-primary-600));\n }\n\n .option--selected .option__check {\n visibility: visible;\n }\n\n :host([tickonselect][selected]) .option__check {\n visibility: visible;\n }\n\n .option__prefix,\n .option__suffix {\n flex: 0 0 auto;\n display: flex;\n align-items: center;\n }\n\n .option__prefix::slotted(*) {\n margin-inline-end: var(--nile-font-size-rem-xsmall, var(--ng-spacing-md));\n }\n\n .option__suffix::slotted(*) {\n margin-inline-start: var(--nile-font-size-rem-xsmall, var(--ng-spacing-md));\n }\n\n :host(:not([aria-selected='true'])) .option .option__suffix{\n display: var(--nile-display-block, var(--ng-display-none));\n }\n\n .option--checkbox{\n pointer-events: none;\n margin-left: var(--nile-spacing-lg, var(--ng-spacing-lg));\n margin-right: var(--nile-spacing-lg, var(--ng-spacing-lg));\n width:auto;\n display:var(--nile-display-inline-block, var(--ng-display-inline-block));\n }\n :host([legacy]) .option--checkbox{\n display:var(--nile-display-inline-block, var(--ng-display-none));\n }\n\n \n :host([tickonselect]) .option--checkbox{\n display: none;\n }\n\n :host([tickonselect]) .option{\n padding-left: var(--nile-spacing-lg, var(--ng-spacing-lg));\n padding-right: var(--nile-spacing-lg, var(--ng-spacing-lg));\n }\n\n\n @media (forced-colors: active) {\n :host(:hover:not([aria-disabled='true'])) .option {\n outline: dashed 1px SelectedItem;\n outline-offset: -1px;\n }\n }\n\n .option__label-container {\n display: flex;\n flex-direction: column;\n }\n\n .option__description {\n font-size: var(--nile-type-scale-2, var(--ng-font-size-text-sm));\n color: var(--nile-colors-dark-500, var(--ng-colors-text-tertiary-600));\n }\n\n .text-ellipsis {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n display: inline-block;\n width: 99%;\n }\n\n .option__label-text-ellipsis {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n display: inline-block;\n width: 99%;\n }\n`;\n\nexport default [styles];\n"]}
|
|
@@ -46,6 +46,9 @@ export declare class NileOption extends NileElement {
|
|
|
46
46
|
*/
|
|
47
47
|
value: string;
|
|
48
48
|
showCheckbox: boolean;
|
|
49
|
+
/** Opt OUT of the enhanced styling (enabled by default). Propagated from the parent nile-select. */
|
|
50
|
+
legacy: boolean;
|
|
51
|
+
tickOnSelect: boolean;
|
|
49
52
|
/** Draws the option in a disabled state, preventing selection. */
|
|
50
53
|
disabled: boolean;
|
|
51
54
|
/** Indicates whether the option is selected. */
|
|
@@ -49,6 +49,9 @@ let NileOption = class NileOption extends NileElement {
|
|
|
49
49
|
*/
|
|
50
50
|
this.value = '';
|
|
51
51
|
this.showCheckbox = false;
|
|
52
|
+
/** Opt OUT of the enhanced styling (enabled by default). Propagated from the parent nile-select. */
|
|
53
|
+
this.legacy = false;
|
|
54
|
+
this.tickOnSelect = false;
|
|
52
55
|
/** Draws the option in a disabled state, preventing selection. */
|
|
53
56
|
this.disabled = false;
|
|
54
57
|
/** Indicates whether the option is selected. */
|
|
@@ -218,6 +221,18 @@ let NileOption = class NileOption extends NileElement {
|
|
|
218
221
|
`}
|
|
219
222
|
|
|
220
223
|
<slot part="suffix" name="suffix" class="option__suffix"></slot>
|
|
224
|
+
|
|
225
|
+
${this.tickOnSelect
|
|
226
|
+
? html `<span part="checked-icon" class="option__check">
|
|
227
|
+
<nile-icon
|
|
228
|
+
name="var(--nile-icon-tick, var(--ng-icon-check))"
|
|
229
|
+
method="var(--nile-svg-method-fill, var(--ng-svg-method-stroke))"
|
|
230
|
+
color="currentColor"
|
|
231
|
+
library="system"
|
|
232
|
+
aria-hidden="true"
|
|
233
|
+
></nile-icon>
|
|
234
|
+
</span>`
|
|
235
|
+
: ''}
|
|
221
236
|
</div>`
|
|
222
237
|
: ''}
|
|
223
238
|
`;
|
|
@@ -245,6 +260,12 @@ __decorate([
|
|
|
245
260
|
__decorate([
|
|
246
261
|
property({ type: Boolean, reflect: true, attribute: true })
|
|
247
262
|
], NileOption.prototype, "showCheckbox", void 0);
|
|
263
|
+
__decorate([
|
|
264
|
+
property({ type: Boolean, reflect: true })
|
|
265
|
+
], NileOption.prototype, "legacy", void 0);
|
|
266
|
+
__decorate([
|
|
267
|
+
property({ type: Boolean, reflect: true, attribute: true })
|
|
268
|
+
], NileOption.prototype, "tickOnSelect", void 0);
|
|
248
269
|
__decorate([
|
|
249
270
|
property({ type: Boolean, reflect: true })
|
|
250
271
|
], NileOption.prototype, "disabled", void 0);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nile-option.js","sourceRoot":"","sources":["../../../src/nile-option/nile-option.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;AAGH,OAAO,EAAE,MAA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O,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;6CAAwB;AAGvB;IAA3D,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;+CAA0B;AAEvD;IAA7B,KAAK,CAAC,qBAAqB,CAAC;8CAA8B;AAE7B;IAA7B,KAAK,CAAC,qBAAqB,CAAC;8CAA8B;AAExB;IAAlC,KAAK,CAAC,0BAA0B,CAAC;kDAA8B;AAEvD;IAAR,KAAK,EAAE;yDAA+B;AAEsB;IAA5D,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;wDAA8B;AA+E1F;IADC,KAAK,CAAC,UAAU,CAAC;sDAGjB;AAGD;IADC,KAAK,CAAC,UAAU,CAAC;sDAGjB;AAGD;IADC,KAAK,CAAC,OAAO,CAAC;mDAed;AAhJU,UAAU;IADtB,aAAa,CAAC,aAAa,CAAC;GAChB,UAAU,CAiOtB;;AAED,eAAe,UAAU,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 { LitElement, CSSResultArray, TemplateResult } from 'lit';\nimport { styles } from './nile-option.css';\nimport '../nile-icon';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { customElement, property, query, state } from 'lit/decorators.js';\nimport { html } from 'lit';\nimport { watch } from '../internal/watch';\nimport type { CSSResultGroup, PropertyValues } from 'lit';\nimport NileElement from '../internal/nile-element';\nimport '../nile-checkbox';\n\n/**\n * Nile icon component.\n *\n * @tag nile-option\n *\n */\n\n/**\n * @summary Options define the selectable items within various form controls such as [select](/components/select).\n * @status stable\n *\n * @dependency nile-icon\n *\n * @slot - The option's label.\n * @slot prefix - Used to prepend an icon or similar element to the menu item.\n * @slot suffix - Used to append an icon or similar element to the menu item.\n *\n * @csspart checked-icon - The checked icon, an `<nile-icon>` element.\n * @csspart base - The component's base wrapper.\n * @csspart label - The option's label.\n * @csspart prefix - The container that wraps the prefix.\n * @csspart suffix - The container that wraps the suffix.\n */\n\n@customElement('nile-option')\nexport class NileOption extends NileElement {\n static styles: CSSResultGroup = styles;\n\n private cachedTextLabel: string;\n\n @query('.option__label') defaultSlot: HTMLSlotElement;\n\n @state() current = false; // the user has keyed into the option, but hasn't selected it yet (shows a highlight)\n @state() hasHover = false; // we need this because Safari doesn't honor :hover styles while dragging\n @property({ type: Boolean, reflect: true, attribute: true }) hidden = false; // the option is hidden\n @state() isMultipleSelect = false;\n\n /**\n * The option's value. When selected, the containing form control will receive this value. The value must be unique\n * from other options in the same group. Values may not contain spaces, as spaces are used as delimiters when listing\n * multiple values.\n */\n @property({ reflect: true }) value = '';\n\n @property({ type: Boolean, reflect: true, attribute: true }) showCheckbox: boolean = false;\n\n /** Draws the option in a disabled state, preventing selection. */\n @property({ type: Boolean, reflect: true }) disabled = false;\n\n /** Indicates whether the option is selected. */\n @property({ type: Boolean, reflect: true }) selected = false;\n\n /* used to pass group name to the option, so that grouped options can be shown */\n @property({ type: String, reflect: true, attribute: true }) groupName: string = '';\n\n /* used to pass description to the option, so that description can be shown */\n @property({ type: String, reflect: true, attribute: true }) description: string = '';\n\n @query('slot[name=\"prefix\"]') prefixSlot!: HTMLSlotElement;\n\n @query('slot[name=\"suffix\"]') suffixSlot!: HTMLSlotElement;\n\n @query('.option__label-container') labelContainer!: HTMLElement;\n\n @state() isParentVirtualSelect = false;\n\n @property({ type: Boolean, reflect: true, attribute: true }) isDescriptionEnabled = false;\n\n connectedCallback() {\n super.connectedCallback();\n this.setAttribute('role', 'option');\n this.setAttribute('aria-selected', 'false');\n\n this.checkIfMultipleSelect();\n }\n\n protected firstUpdated() {\n if (this.parentElement?.tagName === 'NILE-SELECT') {\n return;\n }\n\n this.isParentVirtualSelect = true;\n this.applyWidthToLabelContainer();\n }\n\n applyWidthToLabelContainer() {\n const hasPrefix = (this.prefixSlot?.assignedNodes({ flatten: true }) ?? []).length > 0;\n const hasSuffix = (this.suffixSlot?.assignedNodes({ flatten: true }) ?? []).length > 0;\n\n let totalWidth = 0;\n if (hasPrefix) totalWidth += 30;\n if (hasSuffix) totalWidth += 30;\n if (this.showCheckbox) totalWidth += 50;\n if (this.labelContainer) {\n this.labelContainer.style.width = `calc(100% - ${totalWidth}px)`;\n }\n }\n\n checkIfMultipleSelect() {\n // Find the closest parent 'nile-select' element\n const parentSelect = this.closest('nile-select');\n \n // Check if the parent has the 'multiple' attribute\n if (parentSelect && parentSelect.hasAttribute('multiple')) {\n if(parentSelect.hasAttribute('multiple') && parentSelect.getAttribute('multiple') === '') {\n this.isMultipleSelect = true;\n } else if (parentSelect.getAttribute('multiple') === 'true') {\n this.isMultipleSelect = true;\n } else {\n this.isMultipleSelect = false;\n }\n } else {\n this.isMultipleSelect = this.showCheckbox;\n }\n }\n\n protected updated(_changedProperties: PropertyValues): void {\n this.checkIfMultipleSelect();\n }\n\n private handleDefaultSlotChange() {\n const textLabel = this.getTextLabel();\n\n // Ignore the first time the label is set\n if (typeof this.cachedTextLabel === 'undefined') {\n this.cachedTextLabel = textLabel;\n return;\n }\n\n // When the label changes, emit a slotchange event so parent controls see it\n if (textLabel !== this.cachedTextLabel) {\n this.cachedTextLabel = textLabel;\n this.emit('slotchange');\n }\n }\n\n private handleMouseEnter() {\n this.hasHover = true;\n }\n\n private handleMouseLeave() {\n this.hasHover = false;\n }\n\n @watch('disabled')\n handleDisabledChange() {\n this.setAttribute('aria-disabled', this.disabled ? 'true' : 'false');\n }\n\n @watch('selected')\n handleSelectedChange() {\n this.setAttribute('aria-selected', this.selected ? 'true' : 'false');\n }\n\n @watch('value')\n handleValueChange() {\n // Ensure the value is a string. This ensures the next line doesn't error and allows framework users to pass numbers\n // instead of requiring them to cast the value to a string.\n if (typeof this.value !== 'string') {\n this.value = String(this.value);\n }\n\n // if (this.value.includes(' ')) {\n // console.error(\n // `Option values cannot include a space. All spaces have been replaced with underscores.`,\n // this\n // );\n // this.value = this.value.replace(/ /g, '_');\n // }\n }\n\n /** Returns a plain text label based on the option's content. */\n getTextLabel() {\n // Search for a label element inside the component\n const labelElement = this.querySelector('label');\n\n // If a label element is found, return its text content\n if (labelElement) {\n return labelElement.textContent?.trim() ?? '';\n }\n\n // If no label element is found, return the existing behavior\n return (this.textContent ?? '').trim();\n }\n\n render() {\n return html`\n ${!this.hidden\n ? html` <div\n part=\"base\"\n class=${classMap({\n option: true,\n 'option--single-select': !this.isMultipleSelect,\n 'option--current': this.selected && !this.isMultipleSelect,\n 'option--disabled': this.disabled,\n 'option--selected': this.selected && !this.isMultipleSelect,\n 'option--hover': this.hasHover,\n })}\n @mouseenter=${this.handleMouseEnter}\n @mouseleave=${this.handleMouseLeave}\n >\n\n ${this.isMultipleSelect ? html`<nile-checkbox part=\"checkbox\" class=\"option--checkbox\" .checked=${this.selected}></nile-checkbox>` : ''}\n\n <slot part=\"prefix\" name=\"prefix\" class=\"option__prefix\"></slot>\n ${this.isDescriptionEnabled\n ? html`\n <div\n class=\"option__label-container\"\n part=\"option_label_container\"\n >\n <slot\n part=\"label\"\n class=${classMap({\n 'option__label': true,\n 'option__label-text-ellipsis':\n this.isParentVirtualSelect,\n })}\n @slotchange=${this.handleDefaultSlotChange}\n ></slot>\n \n ${this.description\n ? html`\n <span\n part=\"option_description\"\n class=${classMap({\n option__description: true,\n 'text-ellipsis':\n this.isParentVirtualSelect,\n })}\n >\n ${this.description}\n </span>\n `\n : null}\n </div>\n `\n : html`\n <slot\n part=\"label\"\n class=\"option__label\"\n @slotchange=${this.handleDefaultSlotChange}\n ></slot>\n `}\n \n <slot part=\"suffix\" name=\"suffix\" class=\"option__suffix\"></slot>\n </div>`\n : ''}\n `;\n } \n}\n\nexport default NileOption;\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nile-option': NileOption;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"nile-option.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SD-3-Clause license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport { LitElement, CSSResultArray, TemplateResult } from 'lit';\nimport { styles } from './nile-option.css';\nimport '../nile-icon';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { customElement, property, query, state } from 'lit/decorators.js';\nimport { html } from 'lit';\nimport { watch } from '../internal/watch';\nimport type { CSSResultGroup, PropertyValues } from 'lit';\nimport NileElement from '../internal/nile-element';\nimport '../nile-checkbox';\n\n/**\n * Nile icon component.\n *\n * @tag nile-option\n *\n */\n\n/**\n * @summary Options define the selectable items within various form controls such as [select](/components/select).\n * @status stable\n *\n * @dependency nile-icon\n *\n * @slot - The option's label.\n * @slot prefix - Used to prepend an icon or similar element to the menu item.\n * @slot suffix - Used to append an icon or similar element to the menu item.\n *\n * @csspart checked-icon - The checked icon, an `<nile-icon>` element.\n * @csspart base - The component's base wrapper.\n * @csspart label - The option's label.\n * @csspart prefix - The container that wraps the prefix.\n * @csspart suffix - The container that wraps the suffix.\n */\n\n@customElement('nile-option')\nexport class NileOption extends NileElement {\n static styles: CSSResultGroup = styles;\n\n private cachedTextLabel: string;\n\n @query('.option__label') defaultSlot: HTMLSlotElement;\n\n @state() current = false; // the user has keyed into the option, but hasn't selected it yet (shows a highlight)\n @state() hasHover = false; // we need this because Safari doesn't honor :hover styles while dragging\n @property({ type: Boolean, reflect: true, attribute: true }) hidden = false; // the option is hidden\n @state() isMultipleSelect = false;\n\n /**\n * The option's value. When selected, the containing form control will receive this value. The value must be unique\n * from other options in the same group. Values may not contain spaces, as spaces are used as delimiters when listing\n * multiple values.\n */\n @property({ reflect: true }) value = '';\n\n @property({ type: Boolean, reflect: true, attribute: true }) showCheckbox: boolean = false;\n\n /** Opt OUT of the enhanced styling (enabled by default). Propagated from the parent nile-select. */\n @property({ type: Boolean, reflect: true }) legacy: boolean = false;\n\n \n @property({ type: Boolean, reflect: true, attribute: true }) tickOnSelect: boolean = false;\n\n /** Draws the option in a disabled state, preventing selection. */\n @property({ type: Boolean, reflect: true }) disabled = false;\n\n /** Indicates whether the option is selected. */\n @property({ type: Boolean, reflect: true }) selected = false;\n\n /* used to pass group name to the option, so that grouped options can be shown */\n @property({ type: String, reflect: true, attribute: true }) groupName: string = '';\n\n /* used to pass description to the option, so that description can be shown */\n @property({ type: String, reflect: true, attribute: true }) description: string = '';\n\n @query('slot[name=\"prefix\"]') prefixSlot!: HTMLSlotElement;\n\n @query('slot[name=\"suffix\"]') suffixSlot!: HTMLSlotElement;\n\n @query('.option__label-container') labelContainer!: HTMLElement;\n\n @state() isParentVirtualSelect = false;\n\n @property({ type: Boolean, reflect: true, attribute: true }) isDescriptionEnabled = false;\n\n connectedCallback() {\n super.connectedCallback();\n this.setAttribute('role', 'option');\n this.setAttribute('aria-selected', 'false');\n\n this.checkIfMultipleSelect();\n }\n\n protected firstUpdated() {\n if (this.parentElement?.tagName === 'NILE-SELECT') {\n return;\n }\n\n this.isParentVirtualSelect = true;\n this.applyWidthToLabelContainer();\n }\n\n applyWidthToLabelContainer() {\n const hasPrefix = (this.prefixSlot?.assignedNodes({ flatten: true }) ?? []).length > 0;\n const hasSuffix = (this.suffixSlot?.assignedNodes({ flatten: true }) ?? []).length > 0;\n\n let totalWidth = 0;\n if (hasPrefix) totalWidth += 30;\n if (hasSuffix) totalWidth += 30;\n if (this.showCheckbox) totalWidth += 50;\n if (this.labelContainer) {\n this.labelContainer.style.width = `calc(100% - ${totalWidth}px)`;\n }\n }\n\n checkIfMultipleSelect() {\n // Find the closest parent 'nile-select' element\n const parentSelect = this.closest('nile-select');\n \n // Check if the parent has the 'multiple' attribute\n if (parentSelect && parentSelect.hasAttribute('multiple')) {\n if(parentSelect.hasAttribute('multiple') && parentSelect.getAttribute('multiple') === '') {\n this.isMultipleSelect = true;\n } else if (parentSelect.getAttribute('multiple') === 'true') {\n this.isMultipleSelect = true;\n } else {\n this.isMultipleSelect = false;\n }\n } else {\n this.isMultipleSelect = this.showCheckbox;\n }\n }\n\n protected updated(_changedProperties: PropertyValues): void {\n this.checkIfMultipleSelect();\n }\n\n private handleDefaultSlotChange() {\n const textLabel = this.getTextLabel();\n\n // Ignore the first time the label is set\n if (typeof this.cachedTextLabel === 'undefined') {\n this.cachedTextLabel = textLabel;\n return;\n }\n\n // When the label changes, emit a slotchange event so parent controls see it\n if (textLabel !== this.cachedTextLabel) {\n this.cachedTextLabel = textLabel;\n this.emit('slotchange');\n }\n }\n\n private handleMouseEnter() {\n this.hasHover = true;\n }\n\n private handleMouseLeave() {\n this.hasHover = false;\n }\n\n @watch('disabled')\n handleDisabledChange() {\n this.setAttribute('aria-disabled', this.disabled ? 'true' : 'false');\n }\n\n @watch('selected')\n handleSelectedChange() {\n this.setAttribute('aria-selected', this.selected ? 'true' : 'false');\n }\n\n @watch('value')\n handleValueChange() {\n // Ensure the value is a string. This ensures the next line doesn't error and allows framework users to pass numbers\n // instead of requiring them to cast the value to a string.\n if (typeof this.value !== 'string') {\n this.value = String(this.value);\n }\n\n // if (this.value.includes(' ')) {\n // console.error(\n // `Option values cannot include a space. All spaces have been replaced with underscores.`,\n // this\n // );\n // this.value = this.value.replace(/ /g, '_');\n // }\n }\n\n /** Returns a plain text label based on the option's content. */\n getTextLabel() {\n // Search for a label element inside the component\n const labelElement = this.querySelector('label');\n\n // If a label element is found, return its text content\n if (labelElement) {\n return labelElement.textContent?.trim() ?? '';\n }\n\n // If no label element is found, return the existing behavior\n return (this.textContent ?? '').trim();\n }\n\n render() {\n return html`\n ${!this.hidden\n ? html` <div\n part=\"base\"\n class=${classMap({\n option: true,\n 'option--single-select': !this.isMultipleSelect,\n 'option--current': this.selected && !this.isMultipleSelect,\n 'option--disabled': this.disabled,\n 'option--selected': this.selected && !this.isMultipleSelect,\n 'option--hover': this.hasHover,\n })}\n @mouseenter=${this.handleMouseEnter}\n @mouseleave=${this.handleMouseLeave}\n >\n\n ${this.isMultipleSelect ? html`<nile-checkbox part=\"checkbox\" class=\"option--checkbox\" .checked=${this.selected}></nile-checkbox>` : ''}\n\n <slot part=\"prefix\" name=\"prefix\" class=\"option__prefix\"></slot>\n ${this.isDescriptionEnabled\n ? html`\n <div\n class=\"option__label-container\"\n part=\"option_label_container\"\n >\n <slot\n part=\"label\"\n class=${classMap({\n 'option__label': true,\n 'option__label-text-ellipsis':\n this.isParentVirtualSelect,\n })}\n @slotchange=${this.handleDefaultSlotChange}\n ></slot>\n \n ${this.description\n ? html`\n <span\n part=\"option_description\"\n class=${classMap({\n option__description: true,\n 'text-ellipsis':\n this.isParentVirtualSelect,\n })}\n >\n ${this.description}\n </span>\n `\n : null}\n </div>\n `\n : html`\n <slot\n part=\"label\"\n class=\"option__label\"\n @slotchange=${this.handleDefaultSlotChange}\n ></slot>\n `}\n \n <slot part=\"suffix\" name=\"suffix\" class=\"option__suffix\"></slot>\n\n ${this.tickOnSelect\n ? html`<span part=\"checked-icon\" class=\"option__check\">\n <nile-icon\n name=\"var(--nile-icon-tick, var(--ng-icon-check))\"\n method=\"var(--nile-svg-method-fill, var(--ng-svg-method-stroke))\"\n color=\"currentColor\"\n library=\"system\"\n aria-hidden=\"true\"\n ></nile-icon>\n </span>`\n : ''}\n </div>`\n : ''}\n `;\n } \n}\n\nexport default NileOption;\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nile-option': NileOption;\n }\n}\n"]}
|