@aquera/nile-elements 0.1.1 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -0
- package/demo/variables.css +0 -556
- package/dist/nile-code-editor/extensionSetup.cjs.js +6 -6
- package/dist/nile-code-editor/extensionSetup.cjs.js.map +1 -1
- package/dist/nile-code-editor/extensionSetup.esm.js +1 -1
- package/dist/nile-code-editor/nile-code-editor.cjs.js +2 -2
- package/dist/nile-code-editor/nile-code-editor.cjs.js.map +1 -1
- package/dist/nile-code-editor/nile-code-editor.esm.js +3 -3
- package/dist/nile-drawer/nile-drawer.css.cjs.js +1 -1
- package/dist/nile-drawer/nile-drawer.css.cjs.js.map +1 -1
- package/dist/nile-drawer/nile-drawer.css.esm.js +1 -1
- package/dist/nile-form-help-text/nile-form-help-text.cjs.js +1 -1
- package/dist/nile-form-help-text/nile-form-help-text.cjs.js.map +1 -1
- package/dist/nile-form-help-text/nile-form-help-text.esm.js +2 -2
- package/dist/src/nile-code-editor/extensionSetup.d.ts +8 -9
- package/dist/src/nile-code-editor/extensionSetup.js +0 -13
- package/dist/src/nile-code-editor/extensionSetup.js.map +1 -1
- package/dist/src/nile-code-editor/nile-code-editor.d.ts +49 -15
- package/dist/src/nile-code-editor/nile-code-editor.js +195 -115
- package/dist/src/nile-code-editor/nile-code-editor.js.map +1 -1
- package/dist/src/nile-drawer/nile-drawer.css.js +1 -1
- package/dist/src/nile-drawer/nile-drawer.css.js.map +1 -1
- package/dist/src/nile-form-help-text/nile-form-help-text.js +32 -2
- package/dist/src/nile-form-help-text/nile-form-help-text.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -1
- package/plop-templates/lit/lit.ts.hbs +2 -2
- package/src/nile-code-editor/extensionSetup.ts +8 -23
- package/src/nile-code-editor/nile-code-editor.ts +209 -124
- package/src/nile-drawer/nile-drawer.css.ts +1 -1
- package/src/nile-form-help-text/nile-form-help-text.ts +37 -3
- package/vscode-html-custom-data.json +13 -2
@@ -1,2 +1,2 @@
|
|
1
|
-
System.register(["lit"],function(_export,_context){"use strict";var e,_templateObject,t;function _taggedTemplateLiteral(strings,raw){if(!raw){raw=strings.slice(0);}return Object.freeze(Object.defineProperties(strings,{raw:{value:Object.freeze(raw)}}));}return{setters:[function(_lit){e=_lit.css;}],execute:function execute(){_export("s",t=[e(_templateObject||(_templateObject=_taggedTemplateLiteral(["\n :host {\n box-sizing: border-box;\n --nile-drawer-remove-icon-color:#000;\n }\n\n :host *,\n :host *::before,\n :host *::after {\n box-sizing: inherit;\n }\n\n [hidden] {\n display: none !important;\n }\n\n :host {\n --size: 25rem;\n --header-spacing: 1.25rem;\n --body-spacing: 1.25rem;\n --footer-spacing: 1.25rem;\n\n display: contents;\n }\n\n .drawer {\n top: 0;\n inset-inline-start: 0;\n width: 100%;\n height: 100%;\n pointer-events: none;\n overflow: hidden;\n }\n\n .drawer--contained {\n position: absolute;\n z-index: initial;\n }\n\n .drawer--fixed {\n position: fixed;\n z-index: 700;\n }\n\n .drawer__panel {\n position: absolute;\n display: flex;\n flex-direction: column;\n z-index: 2;\n max-width: 100%;\n max-height: 100%;\n background-color: hsl(0, 0%, 100%);\n box-shadow: 0 4px 16px hsl(240 3.8% 46.1% / 12%);\n overflow: auto;\n pointer-events: all;\n }\n\n .drawer__panel:focus {\n outline: none;\n }\n\n .drawer--top .drawer__panel {\n top: 0;\n inset-inline-end: auto;\n bottom: auto;\n inset-inline-start: 0;\n width: 100%;\n height: var(--size);\n }\n\n .drawer--end .drawer__panel {\n top: 0;\n inset-inline-end: 0;\n bottom: auto;\n inset-inline-start: auto;\n width: var(--size);\n height: 100%;\n }\n\n .drawer--bottom .drawer__panel {\n top: auto;\n inset-inline-end: auto;\n bottom: 0;\n inset-inline-start: 0;\n width: 100%;\n height: var(--size);\n }\n\n .drawer--start .drawer__panel {\n top: 0;\n inset-inline-end: auto;\n bottom: auto;\n inset-inline-start: 0;\n width: var(--size);\n height: 100%;\n }\n\n .drawer__header {\n display: flex;\n }\n\n .drawer__title {\n flex: 1 1 auto;\n font: inherit;\n font-size: 1.25rem;\n line-height: 1.4;\n padding: var(--header-spacing);\n margin: 0;\n }\n\n .drawer__header-actions {\n flex-shrink: 0;\n display: flex;\n flex-wrap: wrap;\n justify-content: end;\n gap: 0.
|
1
|
+
System.register(["lit"],function(_export,_context){"use strict";var e,_templateObject,t;function _taggedTemplateLiteral(strings,raw){if(!raw){raw=strings.slice(0);}return Object.freeze(Object.defineProperties(strings,{raw:{value:Object.freeze(raw)}}));}return{setters:[function(_lit){e=_lit.css;}],execute:function execute(){_export("s",t=[e(_templateObject||(_templateObject=_taggedTemplateLiteral(["\n :host {\n box-sizing: border-box;\n --nile-drawer-remove-icon-color:#000;\n }\n\n :host *,\n :host *::before,\n :host *::after {\n box-sizing: inherit;\n }\n\n [hidden] {\n display: none !important;\n }\n\n :host {\n --size: 25rem;\n --header-spacing: 1.25rem;\n --body-spacing: 1.25rem;\n --footer-spacing: 1.25rem;\n\n display: contents;\n }\n\n .drawer {\n top: 0;\n inset-inline-start: 0;\n width: 100%;\n height: 100%;\n pointer-events: none;\n overflow: hidden;\n }\n\n .drawer--contained {\n position: absolute;\n z-index: initial;\n }\n\n .drawer--fixed {\n position: fixed;\n z-index: 700;\n }\n\n .drawer__panel {\n position: absolute;\n display: flex;\n flex-direction: column;\n z-index: 2;\n max-width: 100%;\n max-height: 100%;\n background-color: hsl(0, 0%, 100%);\n box-shadow: 0 4px 16px hsl(240 3.8% 46.1% / 12%);\n overflow: auto;\n pointer-events: all;\n }\n\n .drawer__panel:focus {\n outline: none;\n }\n\n .drawer--top .drawer__panel {\n top: 0;\n inset-inline-end: auto;\n bottom: auto;\n inset-inline-start: 0;\n width: 100%;\n height: var(--size);\n }\n\n .drawer--end .drawer__panel {\n top: 0;\n inset-inline-end: 0;\n bottom: auto;\n inset-inline-start: auto;\n width: var(--size);\n height: 100%;\n }\n\n .drawer--bottom .drawer__panel {\n top: auto;\n inset-inline-end: auto;\n bottom: 0;\n inset-inline-start: 0;\n width: 100%;\n height: var(--size);\n }\n\n .drawer--start .drawer__panel {\n top: 0;\n inset-inline-end: auto;\n bottom: auto;\n inset-inline-start: 0;\n width: var(--size);\n height: 100%;\n }\n\n .drawer__header {\n display: flex;\n }\n\n .drawer__title {\n flex: 1 1 auto;\n font: inherit;\n font-size: 1.25rem;\n line-height: 1.4;\n padding: var(--header-spacing);\n margin: 0;\n }\n\n .drawer__header-actions {\n flex-shrink: 0;\n display: flex;\n flex-wrap: wrap;\n justify-content: end;\n gap: 0.5rem;\n padding: 0 var(--header-spacing);\n }\n\n .drawer__header-actions nile-icon-button,\n .drawer__header-actions ::slotted(nile-icon-button) {\n flex: 0 0 auto;\n display: flex;\n align-items: center;\n font-size: 1rem;\n }\n\n .drawer__body {\n flex: 1 1 auto;\n display: block;\n padding: var(--body-spacing);\n overflow: auto;\n -webkit-overflow-scrolling: touch;\n }\n\n .drawer__footer {\n text-align: right;\n padding: var(--footer-spacing);\n }\n\n .drawer__footer ::slotted(nile-button:not(:last-of-type)) {\n margin-inline-end: 0.5rem;\n }\n\n .drawer:not(.drawer--has-footer) .drawer__footer {\n display: none;\n }\n\n .drawer__overlay {\n display: block;\n position: fixed;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n background-color: hsl(240 3.8% 46.1% / 33%);\n pointer-events: all;\n }\n\n .drawer--contained .drawer__overlay {\n display: none;\n }\n\n .drawer__close:hover {\n cursor:pointer;\n }\n\n @media (forced-colors: active) {\n .drawer__panel {\n border: solid 1px hsl(0, 0%, 100%);\n }\n }\n"])))]);}};});
|
2
2
|
//# sourceMappingURL=nile-drawer.css.cjs.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"nile-drawer.css.cjs.js","sources":["../../../src/nile-drawer/nile-drawer.css.ts"],"sourcesContent":["/**\n * Copyright Aquera Inc 2023\n *\n * This source code is licensed under the BSD-3-Clause license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport { css } from 'lit';\n\n/**\n * Drawer CSS\n */\nexport const styles = css`\n :host {\n box-sizing: border-box;\n --nile-drawer-remove-icon-color:#000;\n }\n\n :host *,\n :host *::before,\n :host *::after {\n box-sizing: inherit;\n }\n\n [hidden] {\n display: none !important;\n }\n\n :host {\n --size: 25rem;\n --header-spacing: 1.25rem;\n --body-spacing: 1.25rem;\n --footer-spacing: 1.25rem;\n\n display: contents;\n }\n\n .drawer {\n top: 0;\n inset-inline-start: 0;\n width: 100%;\n height: 100%;\n pointer-events: none;\n overflow: hidden;\n }\n\n .drawer--contained {\n position: absolute;\n z-index: initial;\n }\n\n .drawer--fixed {\n position: fixed;\n z-index: 700;\n }\n\n .drawer__panel {\n position: absolute;\n display: flex;\n flex-direction: column;\n z-index: 2;\n max-width: 100%;\n max-height: 100%;\n background-color: hsl(0, 0%, 100%);\n box-shadow: 0 4px 16px hsl(240 3.8% 46.1% / 12%);\n overflow: auto;\n pointer-events: all;\n }\n\n .drawer__panel:focus {\n outline: none;\n }\n\n .drawer--top .drawer__panel {\n top: 0;\n inset-inline-end: auto;\n bottom: auto;\n inset-inline-start: 0;\n width: 100%;\n height: var(--size);\n }\n\n .drawer--end .drawer__panel {\n top: 0;\n inset-inline-end: 0;\n bottom: auto;\n inset-inline-start: auto;\n width: var(--size);\n height: 100%;\n }\n\n .drawer--bottom .drawer__panel {\n top: auto;\n inset-inline-end: auto;\n bottom: 0;\n inset-inline-start: 0;\n width: 100%;\n height: var(--size);\n }\n\n .drawer--start .drawer__panel {\n top: 0;\n inset-inline-end: auto;\n bottom: auto;\n inset-inline-start: 0;\n width: var(--size);\n height: 100%;\n }\n\n .drawer__header {\n display: flex;\n }\n\n .drawer__title {\n flex: 1 1 auto;\n font: inherit;\n font-size: 1.25rem;\n line-height: 1.4;\n padding: var(--header-spacing);\n margin: 0;\n }\n\n .drawer__header-actions {\n flex-shrink: 0;\n display: flex;\n flex-wrap: wrap;\n justify-content: end;\n gap: 0.
|
1
|
+
{"version":3,"file":"nile-drawer.css.cjs.js","sources":["../../../src/nile-drawer/nile-drawer.css.ts"],"sourcesContent":["/**\n * Copyright Aquera Inc 2023\n *\n * This source code is licensed under the BSD-3-Clause license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport { css } from 'lit';\n\n/**\n * Drawer CSS\n */\nexport const styles = css`\n :host {\n box-sizing: border-box;\n --nile-drawer-remove-icon-color:#000;\n }\n\n :host *,\n :host *::before,\n :host *::after {\n box-sizing: inherit;\n }\n\n [hidden] {\n display: none !important;\n }\n\n :host {\n --size: 25rem;\n --header-spacing: 1.25rem;\n --body-spacing: 1.25rem;\n --footer-spacing: 1.25rem;\n\n display: contents;\n }\n\n .drawer {\n top: 0;\n inset-inline-start: 0;\n width: 100%;\n height: 100%;\n pointer-events: none;\n overflow: hidden;\n }\n\n .drawer--contained {\n position: absolute;\n z-index: initial;\n }\n\n .drawer--fixed {\n position: fixed;\n z-index: 700;\n }\n\n .drawer__panel {\n position: absolute;\n display: flex;\n flex-direction: column;\n z-index: 2;\n max-width: 100%;\n max-height: 100%;\n background-color: hsl(0, 0%, 100%);\n box-shadow: 0 4px 16px hsl(240 3.8% 46.1% / 12%);\n overflow: auto;\n pointer-events: all;\n }\n\n .drawer__panel:focus {\n outline: none;\n }\n\n .drawer--top .drawer__panel {\n top: 0;\n inset-inline-end: auto;\n bottom: auto;\n inset-inline-start: 0;\n width: 100%;\n height: var(--size);\n }\n\n .drawer--end .drawer__panel {\n top: 0;\n inset-inline-end: 0;\n bottom: auto;\n inset-inline-start: auto;\n width: var(--size);\n height: 100%;\n }\n\n .drawer--bottom .drawer__panel {\n top: auto;\n inset-inline-end: auto;\n bottom: 0;\n inset-inline-start: 0;\n width: 100%;\n height: var(--size);\n }\n\n .drawer--start .drawer__panel {\n top: 0;\n inset-inline-end: auto;\n bottom: auto;\n inset-inline-start: 0;\n width: var(--size);\n height: 100%;\n }\n\n .drawer__header {\n display: flex;\n }\n\n .drawer__title {\n flex: 1 1 auto;\n font: inherit;\n font-size: 1.25rem;\n line-height: 1.4;\n padding: var(--header-spacing);\n margin: 0;\n }\n\n .drawer__header-actions {\n flex-shrink: 0;\n display: flex;\n flex-wrap: wrap;\n justify-content: end;\n gap: 0.5rem;\n padding: 0 var(--header-spacing);\n }\n\n .drawer__header-actions nile-icon-button,\n .drawer__header-actions ::slotted(nile-icon-button) {\n flex: 0 0 auto;\n display: flex;\n align-items: center;\n font-size: 1rem;\n }\n\n .drawer__body {\n flex: 1 1 auto;\n display: block;\n padding: var(--body-spacing);\n overflow: auto;\n -webkit-overflow-scrolling: touch;\n }\n\n .drawer__footer {\n text-align: right;\n padding: var(--footer-spacing);\n }\n\n .drawer__footer ::slotted(nile-button:not(:last-of-type)) {\n margin-inline-end: 0.5rem;\n }\n\n .drawer:not(.drawer--has-footer) .drawer__footer {\n display: none;\n }\n\n .drawer__overlay {\n display: block;\n position: fixed;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n background-color: hsl(240 3.8% 46.1% / 33%);\n pointer-events: all;\n }\n\n .drawer--contained .drawer__overlay {\n display: none;\n }\n\n .drawer__close:hover {\n cursor:pointer;\n }\n\n @media (forced-colors: active) {\n .drawer__panel {\n border: solid 1px hsl(0, 0%, 100%);\n }\n }\n`;\n\nexport default [styles];\n"],"names":["styles$1","css","_templateObject","_taggedTemplateLiteral"],"mappings":"iVA0LeA,CAAA,CAAA,CA9KOC,CAAG,CAAAC,eAAA,GAAAA,eAAA,CAAAC,sBAAA"}
|
@@ -1,2 +1,2 @@
|
|
1
|
-
function _typeof(o){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(o){return typeof o;}:function(o){return o&&"function"==typeof Symbol&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o;},_typeof(o);}System.register(["tslib","lit","lit/decorators.js","./nile-form-help-text.css.cjs.js"],function(_export,_context){"use strict";var t,e,i,s,o,r,
|
1
|
+
function _typeof(o){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(o){return typeof o;}:function(o){return o&&"function"==typeof Symbol&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o;},_typeof(o);}System.register(["tslib","lit","lit/decorators.js","./nile-form-help-text.css.cjs.js"],function(_export,_context){"use strict";var t,e,i,s,o,r,n,_templateObject,_templateObject2,l;function _taggedTemplateLiteral(strings,raw){if(!raw){raw=strings.slice(0);}return Object.freeze(Object.defineProperties(strings,{raw:{value:Object.freeze(raw)}}));}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,_toPropertyKey(descriptor.key),descriptor);}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);Object.defineProperty(Constructor,"prototype",{writable:false});return Constructor;}function _toPropertyKey(t){var i=_toPrimitive(t,"string");return"symbol"==_typeof(i)?i:i+"";}function _toPrimitive(t,r){if("object"!=_typeof(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,r||"default");if("object"!=_typeof(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.");}return("string"===r?String:Number)(t);}function _callSuper(t,o,e){return o=_getPrototypeOf(o),_possibleConstructorReturn(t,_isNativeReflectConstruct()?Reflect.construct(o,e||[],_getPrototypeOf(t).constructor):o.apply(t,e));}function _possibleConstructorReturn(self,call){if(call&&(_typeof(call)==="object"||typeof call==="function")){return call;}else if(call!==void 0){throw new TypeError("Derived constructors may only return object or undefined");}return _assertThisInitialized(self);}function _assertThisInitialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return self;}function _isNativeReflectConstruct(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));}catch(t){}return(_isNativeReflectConstruct=function _isNativeReflectConstruct(){return!!t;})();}function _get(){if(typeof Reflect!=="undefined"&&Reflect.get){_get=Reflect.get.bind();}else{_get=function _get(target,property,receiver){var base=_superPropBase(target,property);if(!base)return;var desc=Object.getOwnPropertyDescriptor(base,property);if(desc.get){return desc.get.call(arguments.length<3?target:receiver);}return desc.value;};}return _get.apply(this,arguments);}function _superPropBase(object,property){while(!Object.prototype.hasOwnProperty.call(object,property)){object=_getPrototypeOf(object);if(object===null)break;}return object;}function _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o);};return _getPrototypeOf(o);}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function");}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}});Object.defineProperty(subClass,"prototype",{writable:false});if(superClass)_setPrototypeOf(subClass,superClass);}function _setPrototypeOf(o,p){_setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function _setPrototypeOf(o,p){o.__proto__=p;return o;};return _setPrototypeOf(o,p);}return{setters:[function(_tslib){t=_tslib.__decorate;},function(_lit){e=_lit.LitElement;i=_lit.html;},function(_litDecoratorsJs){s=_litDecoratorsJs.property;o=_litDecoratorsJs.query;r=_litDecoratorsJs.customElement;},function(_nileFormHelpTextCssCjsJs){n=_nileFormHelpTextCssCjsJs.s;}],execute:function execute(){_export("N",l=/*#__PURE__*/function(_e){function l(){var _this;_classCallCheck(this,l);_this=_callSuper(this,l,arguments),_this.isExpanded=!1,_this.fullText="",_this.textLimit=47,_this.displayedText="";return _this;}_inherits(l,_e);return _createClass(l,[{key:"connectedCallback",value:function connectedCallback(){var _this2=this;_get(_getPrototypeOf(l.prototype),"connectedCallback",this).call(this),requestAnimationFrame(function(){var _this2$slotElement;(_this2$slotElement=_this2.slotElement)===null||_this2$slotElement===void 0||_this2$slotElement.addEventListener("slotchange",_this2.handleSlotChange.bind(_this2));});}},{key:"firstUpdated",value:function firstUpdated(){this.handleSlotChange();}},{key:"handleSlotChange",value:function handleSlotChange(){var t=this.slotElement.assignedNodes({flatten:!0}).map(function(t){return t.textContent;}).join("");this.fullText=t.trim(),this.updateDisplayedText();}},{key:"toggleExpanded",value:function toggleExpanded(){this.isExpanded=!this.isExpanded,this.updateDisplayedText();}},{key:"updateDisplayedText",value:function updateDisplayedText(){if(this.isExpanded)this.displayedText=this.fullText;else{var _t=function(t,e){if(e<0||e>t.length)throw new Error("Invalid value of n. It must be between 0 and the sentence length.");if(" "!==t[e]&&0!==e&&e!==t.length){var _i2=e;for(;_i2>0&&" "!==t[_i2-1];)_i2--;var _s=e;for(;_s<t.length&&" "!==t[_s];)_s++;e=e-_i2<=_s-e?_i2:_s;}return e;}(this.fullText,this.textLimit),_e2=this.fullText.slice(0,_t),_i=this.fullText.length>_t?"...":"";this.displayedText="".concat(_e2).concat(_i);}}},{key:"render",value:function render(){var t=this.fullText.length>this.textLimit,e=this.isExpanded?"arrowup":"arrowdown";return i(_templateObject||(_templateObject=_taggedTemplateLiteral(["\n <div class=\"nile-form-help-text\" part=\"container\">\n <slot hidden>","</slot>\n <div part=\"text\">\n <span>","</span>\n ","\n </div>\n </div>\n "])),this.fullText,this.displayedText,t?i(_templateObject2||(_templateObject2=_taggedTemplateLiteral(["\n <span\n class=\"nile-form-help-text__more-button\"\n part=\"toggle-button\"\n @click=","\n >","\n <nile-icon color=\"#005EA6\" part=\"icon\" size=\"14\" name=\"","\"></nile-icon>\n </span>\n "])),this.toggleExpanded,this.isExpanded?"View Less":"View More",e):"");}}],[{key:"styles",get:function get(){return[n];}}]);}(e));t([s({type:Boolean,reflect:!0})],l.prototype,"isExpanded",void 0),t([s({type:String,reflect:!0})],l.prototype,"fullText",void 0),t([s({type:Number,reflect:!0})],l.prototype,"textLimit",void 0),t([s({type:String,reflect:!0})],l.prototype,"displayedText",void 0),t([o("slot")],l.prototype,"slotElement",void 0),_export("N",l=t([r("nile-form-help-text")],l));}};});
|
2
2
|
//# sourceMappingURL=nile-form-help-text.cjs.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"nile-form-help-text.cjs.js","sources":["../../../src/nile-form-help-text/nile-form-help-text.ts"],"sourcesContent":["/**\n * Copyright Aquera Inc 2023\n *\n * This source code is licensed under the BSD-3-Clause license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport {LitElement, html, CSSResultArray, TemplateResult} from 'lit';\nimport { customElement, query, property } from 'lit/decorators.js';\nimport {styles} from './nile-form-help-text.css';\n\n/**\n * Nile icon component.\n *\n * @tag nile-form-help-text\n *\n */\n@customElement('nile-form-help-text')\nexport class NileFormHelpText extends LitElement {\n /**\n * The styles for FormHelpText\n * @remarks If you are extending this class you can extend the base styles with super. Eg `return [super(), myCustomStyles]`\n */\n public static get styles(): CSSResultArray {\n return [styles];\n }\n\n @property({ type: Boolean, reflect: true }) isExpanded: boolean = false;\n\n @property({ type: String, reflect: true }) fullText: string = '';\n\n @property({ type: Number, reflect: true }) textLimit: number = 47;\n\n @property({ type: String, reflect: true }) displayedText: string = '';\n\n @query('slot') slotElement!: HTMLSlotElement;\n\n connectedCallback() {\n super.connectedCallback();\n requestAnimationFrame(() => {\n this.slotElement?.addEventListener('slotchange', this.handleSlotChange.bind(this));\n });\n }\n\n firstUpdated() {\n this.handleSlotChange();\n }\n\n handleSlotChange() {\n const nodes = this.slotElement.assignedNodes({flatten: true});\n const textContent = nodes.map(node => node.textContent).join('');\n this.fullText = textContent.trim();\n this.updateDisplayedText()\n }\n\n toggleExpanded() {\n this.isExpanded = !this.isExpanded;\n this.updateDisplayedText()\n }\n\n updateDisplayedText(){\n this.displayedText = this.
|
1
|
+
{"version":3,"file":"nile-form-help-text.cjs.js","sources":["../../../src/nile-form-help-text/nile-form-help-text.ts"],"sourcesContent":["/**\n * Copyright Aquera Inc 2023\n *\n * This source code is licensed under the BSD-3-Clause license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport {LitElement, html, CSSResultArray, TemplateResult} from 'lit';\nimport { customElement, query, property } from 'lit/decorators.js';\nimport {styles} from './nile-form-help-text.css';\n\n/**\n * Nile icon component.\n *\n * @tag nile-form-help-text\n *\n */\n@customElement('nile-form-help-text')\nexport class NileFormHelpText extends LitElement {\n /**\n * The styles for FormHelpText\n * @remarks If you are extending this class you can extend the base styles with super. Eg `return [super(), myCustomStyles]`\n */\n public static get styles(): CSSResultArray {\n return [styles];\n }\n\n @property({ type: Boolean, reflect: true }) isExpanded: boolean = false;\n\n @property({ type: String, reflect: true }) fullText: string = '';\n\n @property({ type: Number, reflect: true }) textLimit: number = 47;\n\n @property({ type: String, reflect: true }) displayedText: string = '';\n\n @query('slot') slotElement!: HTMLSlotElement;\n\n connectedCallback() {\n super.connectedCallback();\n requestAnimationFrame(() => {\n this.slotElement?.addEventListener('slotchange', this.handleSlotChange.bind(this));\n });\n }\n\n firstUpdated() {\n this.handleSlotChange();\n }\n\n handleSlotChange() {\n const nodes = this.slotElement.assignedNodes({flatten: true});\n const textContent = nodes.map(node => node.textContent).join('');\n this.fullText = textContent.trim();\n this.updateDisplayedText()\n }\n\n toggleExpanded() {\n this.isExpanded = !this.isExpanded;\n this.updateDisplayedText()\n }\n\n updateDisplayedText() {\n if (this.isExpanded) {\n this.displayedText = this.fullText;\n } else {\n const validConcatNumber=concatSentence(this.fullText, this.textLimit)\n const truncatedText = this.fullText.slice(0, validConcatNumber);\n const ellipsis = this.fullText.length > validConcatNumber ? '...' : '';\n this.displayedText = `${truncatedText}${ellipsis}`;\n }\n }\n\n /* #endregion */\n\n /* #region Methods */\n\n /**\n * Render method\n * @slot This is a slot test\n */\n public render(): TemplateResult {\n const showMoreButton = this.fullText.length > this.textLimit;\n const iconName = this.isExpanded ? 'arrowup' : 'arrowdown';\n\n return html`\n <div class=\"nile-form-help-text\" part=\"container\">\n <slot hidden>${this.fullText}</slot>\n <div part=\"text\">\n <span>${this.displayedText}</span>\n ${showMoreButton ? html`\n <span\n class=\"nile-form-help-text__more-button\"\n part=\"toggle-button\"\n @click=${this.toggleExpanded}\n >${this.isExpanded ? 'View Less' : 'View More'}\n <nile-icon color=\"#005EA6\" part=\"icon\" size=\"14\" name=\"${iconName}\"></nile-icon>\n </span>\n ` : ''}\n </div>\n </div>\n `;\n }\n}\n\nexport default NileFormHelpText;\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nile-form-help-text': NileFormHelpText;\n }\n}\n\nfunction concatSentence(sentence:string, n:number) {\n if (n < 0 || n > sentence.length) {\n throw new Error(\"Invalid value of n. It must be between 0 and the sentence length.\");\n }\n\n // Adjust n if it falls in the middle of a word\n if (sentence[n] !== \" \" && n !== 0 && n !== sentence.length) {\n // Move left until the start of the word or the beginning of the sentence\n let left = n;\n while (left > 0 && sentence[left - 1] !== \" \") {\n left--;\n }\n\n // Move right until the end of the word or the end of the sentence\n let right = n;\n while (right < sentence.length && sentence[right] !== \" \") {\n right++;\n }\n\n // Adjust n to the closer boundary\n n = (n - left <= right - n) ? left : right;\n }\n\n // Return the substring from the start to the adjusted n\n return n;\n}\n"],"names":["NileFormHelpText","_e","l","constructor","this","isExpanded","fullText","textLimit","displayedText","_this","_inherits","_createClass","key","value","connectedCallback","super","requestAnimationFrame","slotElement","addEventListener","handleSlotChange","bind","firstUpdated","textContent","assignedNodes","flatten","map","node","join","trim","updateDisplayedText","toggleExpanded","validConcatNumber","sentence","n","length","Error","left","right","concatSentence","truncatedText","slice","ellipsis","render","showMoreButton","iconName","html","_templateObject","_taggedTemplateLiteral","_templateObject2","get","styles","LitElement","__decorate","property","type","Boolean","reflect","prototype","String","Number","query","_export","customElement"],"mappings":"imIAkBaA,CAAN,uBAAAC,EAAA,EAAA,SAAAC,EAAA,CAAAC,KAAAA,KAAAA,CAAAA,eAAAA,MAAAA,CAAAA,mCASwCC,EAAAA,KAAAA,CAAUC,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AA,CAAA,eAAA,CAAA,IAAA,EAAA,CAAA,CAExDL,CAAA,CAAA,CAAdQ,CAAM,CAAA,MAAA,CAAA,CAAA,CAAsC5D,CAAAyD,CAAAA,SAAAA,CAAA,aAAA,CAAA,IAAA,EAAA,CAAA,CAAAI,OAAA,KAjBlC7D,CAAgBoD,CAAAA,CAAAA,CAAA,CAD5BU,CAAAA,CAAc,wBACF9D"}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import{__decorate as t}from"tslib";import{LitElement as e,html as i}from"lit";import{property as s,query as o,customElement as r}from"lit/decorators.js";import{s as
|
1
|
+
import{__decorate as t}from"tslib";import{LitElement as e,html as i}from"lit";import{property as s,query as o,customElement as r}from"lit/decorators.js";import{s as n}from"./nile-form-help-text.css.esm.js";let l=class extends e{constructor(){super(...arguments),this.isExpanded=!1,this.fullText="",this.textLimit=47,this.displayedText=""}static get styles(){return[n]}connectedCallback(){super.connectedCallback(),requestAnimationFrame((()=>{this.slotElement?.addEventListener("slotchange",this.handleSlotChange.bind(this))}))}firstUpdated(){this.handleSlotChange()}handleSlotChange(){const t=this.slotElement.assignedNodes({flatten:!0}).map((t=>t.textContent)).join("");this.fullText=t.trim(),this.updateDisplayedText()}toggleExpanded(){this.isExpanded=!this.isExpanded,this.updateDisplayedText()}updateDisplayedText(){if(this.isExpanded)this.displayedText=this.fullText;else{const t=function(t,e){if(e<0||e>t.length)throw new Error("Invalid value of n. It must be between 0 and the sentence length.");if(" "!==t[e]&&0!==e&&e!==t.length){let i=e;for(;i>0&&" "!==t[i-1];)i--;let s=e;for(;s<t.length&&" "!==t[s];)s++;e=e-i<=s-e?i:s}return e}(this.fullText,this.textLimit),e=this.fullText.slice(0,t),i=this.fullText.length>t?"...":"";this.displayedText=`${e}${i}`}}render(){const t=this.fullText.length>this.textLimit,e=this.isExpanded?"arrowup":"arrowdown";return i`
|
2
2
|
<div class="nile-form-help-text" part="container">
|
3
3
|
<slot hidden>${this.fullText}</slot>
|
4
4
|
<div part="text">
|
@@ -14,4 +14,4 @@ import{__decorate as t}from"tslib";import{LitElement as e,html as i}from"lit";im
|
|
14
14
|
`:""}
|
15
15
|
</div>
|
16
16
|
</div>
|
17
|
-
`}};t([s({type:Boolean,reflect:!0})],
|
17
|
+
`}};t([s({type:Boolean,reflect:!0})],l.prototype,"isExpanded",void 0),t([s({type:String,reflect:!0})],l.prototype,"fullText",void 0),t([s({type:Number,reflect:!0})],l.prototype,"textLimit",void 0),t([s({type:String,reflect:!0})],l.prototype,"displayedText",void 0),t([o("slot")],l.prototype,"slotElement",void 0),l=t([r("nile-form-help-text")],l);export{l as N};
|
@@ -1,4 +1,12 @@
|
|
1
1
|
import { Extension } from '@codemirror/state';
|
2
|
+
export interface MinimalSetupOptions {
|
3
|
+
highlightSpecialChars?: boolean;
|
4
|
+
history?: boolean;
|
5
|
+
drawSelection?: boolean;
|
6
|
+
syntaxHighlighting?: boolean;
|
7
|
+
defaultKeymap?: boolean;
|
8
|
+
historyKeymap?: boolean;
|
9
|
+
}
|
2
10
|
export interface BasicSetupOptions extends MinimalSetupOptions {
|
3
11
|
lineNumbers?: boolean;
|
4
12
|
highlightActiveLineGutter?: boolean;
|
@@ -23,12 +31,3 @@ export interface BasicSetupOptions extends MinimalSetupOptions {
|
|
23
31
|
}
|
24
32
|
export declare const isValidSetup: (item: any) => any;
|
25
33
|
export declare const basicSetup: (options?: BasicSetupOptions) => Extension[];
|
26
|
-
export interface MinimalSetupOptions {
|
27
|
-
highlightSpecialChars?: boolean;
|
28
|
-
history?: boolean;
|
29
|
-
drawSelection?: boolean;
|
30
|
-
syntaxHighlighting?: boolean;
|
31
|
-
defaultKeymap?: boolean;
|
32
|
-
historyKeymap?: boolean;
|
33
|
-
}
|
34
|
-
export declare const minimalSetup: (options?: MinimalSetupOptions) => Extension[];
|
@@ -39,17 +39,4 @@ export const basicSetup = (options = {}) => {
|
|
39
39
|
extensions.push(indentUnit.of(' '.repeat(options.tabSize)));
|
40
40
|
return extensions.concat([keymap.of(keymaps.flat())]).filter(Boolean);
|
41
41
|
};
|
42
|
-
export const minimalSetup = (options = {}) => {
|
43
|
-
let keymaps = [];
|
44
|
-
isValidSetup(options.defaultKeymap) && keymaps.push(...defaultKeymap);
|
45
|
-
isValidSetup(options.historyKeymap) && keymaps.push(...historyKeymap);
|
46
|
-
const extensions = [];
|
47
|
-
isValidSetup(options.highlightSpecialChars) &&
|
48
|
-
extensions.push(highlightSpecialChars());
|
49
|
-
isValidSetup(options.history) && extensions.push(history());
|
50
|
-
isValidSetup(options.drawSelection) && extensions.push(drawSelection());
|
51
|
-
isValidSetup(options.syntaxHighlighting) &&
|
52
|
-
extensions.push(syntaxHighlighting(defaultHighlightStyle, { fallback: true }));
|
53
|
-
return extensions.concat([keymap.of(keymaps.flat())]).filter(Boolean);
|
54
|
-
};
|
55
42
|
//# sourceMappingURL=extensionSetup.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"extensionSetup.js","sourceRoot":"","sources":["../../../src/nile-code-editor/extensionSetup.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,yBAAyB,EACzB,qBAAqB,EACrB,aAAa,EACb,UAAU,EACV,oBAAoB,EACpB,eAAe,EACf,mBAAmB,EACnB,MAAM,GACP,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,WAAW,EAAa,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAC7E,OAAO,EAAE,yBAAyB,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAC7E,OAAO,EACL,aAAa,EACb,cAAc,EACd,mBAAmB,GAEpB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,UAAU,EACV,aAAa,EACb,kBAAkB,EAClB,qBAAqB,EACrB,eAAe,EACf,UAAU,EACV,UAAU,GACX,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;
|
1
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Cursor,\n rectangularSelection,\n crosshairCursor,\n highlightActiveLine,\n keymap,\n} from '@codemirror/view';\nimport { EditorState, Extension } from '@codemirror/state';\nimport { history, defaultKeymap, historyKeymap } from '@codemirror/commands';\nimport { highlightSelectionMatches, searchKeymap } from '@codemirror/search';\nimport {\n closeBrackets,\n autocompletion,\n closeBracketsKeymap,\n completionKeymap,\n} from '@codemirror/autocomplete';\nimport {\n foldGutter,\n indentOnInput,\n syntaxHighlighting,\n defaultHighlightStyle,\n bracketMatching,\n indentUnit,\n foldKeymap,\n} from '@codemirror/language';\n\nimport { lintKeymap } from '@codemirror/lint';\n\nexport interface MinimalSetupOptions {\n highlightSpecialChars?: boolean;\n history?: boolean;\n drawSelection?: boolean;\n syntaxHighlighting?: boolean;\n defaultKeymap?: boolean;\n historyKeymap?: boolean;\n}\nexport interface BasicSetupOptions extends MinimalSetupOptions {\n lineNumbers?: boolean;\n highlightActiveLineGutter?: boolean;\n foldGutter?: boolean;\n dropCursor?: boolean;\n allowMultipleSelections?: boolean;\n indentOnInput?: boolean;\n bracketMatching?: boolean;\n closeBrackets?: boolean;\n autocompletion?: boolean;\n rectangularSelection?: boolean;\n crosshairCursor?: boolean;\n highlightActiveLine?: boolean;\n highlightSelectionMatches?: boolean;\n closeBracketsKeymap?: boolean;\n searchKeymap?: boolean;\n foldKeymap?: boolean;\n completionKeymap?: boolean;\n lintKeymap?: boolean;\n tabSize?: number;\n readonly?: false;\n}\n\nexport const isValidSetup = (item: any) => {\n return typeof item === 'undefined' || item;\n};\n\nexport const basicSetup = (options: BasicSetupOptions = {}): Extension[] => {\n const { crosshairCursor: initCrosshairCursor = false } = options;\n let keymaps: KeyBinding[] = [];\n isValidSetup(options.defaultKeymap) && keymaps.push(...defaultKeymap);\n isValidSetup(options.closeBracketsKeymap) && keymaps.push(...closeBracketsKeymap);\n isValidSetup(options.searchKeymap) && keymaps.push(...searchKeymap);\n isValidSetup(options.historyKeymap) && keymaps.push(...historyKeymap);\n isValidSetup(options.foldKeymap) && keymaps.push(...foldKeymap);\n isValidSetup(options.lintKeymap) && keymaps.push(...lintKeymap);\n const extensions: Extension[] = [];\n isValidSetup(options.highlightActiveLineGutter) && extensions.push(highlightActiveLineGutter());\n isValidSetup(options.highlightSpecialChars) && extensions.push(highlightSpecialChars());\n isValidSetup(options.history) && extensions.push(history());\n isValidSetup(options.foldGutter) && extensions.push(foldGutter());\n isValidSetup(options.drawSelection) && extensions.push(drawSelection());\n isValidSetup(options.dropCursor) && extensions.push(dropCursor());\n isValidSetup(options.allowMultipleSelections) && extensions.push(EditorState.allowMultipleSelections.of(true));\n isValidSetup(options.indentOnInput) && extensions.push(indentOnInput());\n isValidSetup(options.syntaxHighlighting) &&\n extensions.push(\n syntaxHighlighting(defaultHighlightStyle, { fallback: true })\n );\n isValidSetup(options.bracketMatching) && extensions.push(bracketMatching());\n isValidSetup(options.closeBrackets) && extensions.push(closeBrackets());\n isValidSetup(options.autocompletion) && extensions.push(autocompletion());\n isValidSetup(options.rectangularSelection) && extensions.push(rectangularSelection());\n isValidSetup(options.crosshairCursor) && extensions.push(crosshairCursor());\n isValidSetup(options.highlightActiveLine) && extensions.push(highlightActiveLine());\n isValidSetup(options.highlightSelectionMatches) && extensions.push(highlightSelectionMatches());\n if (options.tabSize && typeof options.tabSize === 'number')\n extensions.push(indentUnit.of(' '.repeat(options.tabSize)));\n return extensions.concat([keymap.of(keymaps.flat())]).filter(Boolean);\n};\n\n\n"]}
|
@@ -6,7 +6,7 @@
|
|
6
6
|
*/
|
7
7
|
import { CSSResultArray, TemplateResult, PropertyValueMap } from 'lit';
|
8
8
|
import { EditorView } from 'codemirror';
|
9
|
-
import { EditorState } from '@codemirror/state';
|
9
|
+
import { EditorState, Extension } from '@codemirror/state';
|
10
10
|
import { CompletionContext, CompletionResult } from '@codemirror/autocomplete';
|
11
11
|
import NileElement from '../internal/nile-element';
|
12
12
|
/**
|
@@ -21,7 +21,8 @@ export declare class NileCodeEditor extends NileElement {
|
|
21
21
|
expandIcon: string;
|
22
22
|
placeholder: string;
|
23
23
|
customAutoCompletions: object | any;
|
24
|
-
|
24
|
+
customCompletionsPaths: string[];
|
25
|
+
language: 'javascript' | 'sql' | 'json' | 'html';
|
25
26
|
errorMessage: string;
|
26
27
|
error: boolean;
|
27
28
|
noborder: boolean;
|
@@ -33,6 +34,7 @@ export declare class NileCodeEditor extends NileElement {
|
|
33
34
|
expandable: boolean;
|
34
35
|
readonly: boolean;
|
35
36
|
debounce: boolean;
|
37
|
+
debounceTimeout: number;
|
36
38
|
view: EditorView;
|
37
39
|
viewState: EditorState;
|
38
40
|
private timeOut;
|
@@ -53,21 +55,53 @@ export declare class NileCodeEditor extends NileElement {
|
|
53
55
|
render(): TemplateResult;
|
54
56
|
createNewView(emitEvent?: boolean): void;
|
55
57
|
createState(): EditorState;
|
56
|
-
|
57
|
-
|
58
|
+
/**
|
59
|
+
* Custom autocomplete handler for code editor suggestions
|
60
|
+
* @param context CompletionContext from CodeMirror
|
61
|
+
* @returns CompletionResult with suggestions or null if no suggestions
|
62
|
+
*/
|
63
|
+
customAutocomplete: (context: CompletionContext) => CompletionResult | null;
|
64
|
+
/**
|
65
|
+
* Gets nested property suggestions based on the current path
|
66
|
+
* @param context CompletionContext from CodeMirror
|
67
|
+
* @param textBeforeCursor Text before cursor position
|
68
|
+
* @param baseTextAfterSeperation Text after the last separator (. or [)
|
69
|
+
* @returns CompletionResult with nested suggestions or null
|
70
|
+
*/
|
71
|
+
getNestedSuggestions(context: CompletionContext, textBeforeCursor: string, baseTextAfterSeperation: string): {
|
72
|
+
from: number;
|
73
|
+
options: {
|
74
|
+
label: string;
|
75
|
+
type: string;
|
76
|
+
info: string;
|
77
|
+
apply: string;
|
78
|
+
boost: number;
|
79
|
+
}[];
|
80
|
+
} | null;
|
81
|
+
/**
|
82
|
+
* Gets top level suggestions based on custom completions and paths
|
83
|
+
* @param context CompletionContext from CodeMirror
|
84
|
+
* @param textBeforeCursor Text before cursor position
|
85
|
+
* @returns CompletionResult with top level suggestions or null
|
86
|
+
*/
|
87
|
+
getTopLevelSuggestions(context: CompletionContext, textBeforeCursor: string): {
|
88
|
+
from: number;
|
89
|
+
options: {
|
90
|
+
label: string;
|
91
|
+
type: string;
|
92
|
+
apply: string;
|
93
|
+
boost: number;
|
94
|
+
}[];
|
95
|
+
} | null;
|
58
96
|
emitAfterTimeout(value: any): void;
|
59
97
|
insertBetweenCode: (text: string) => void;
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
resolveNestedProperties: (obj: any, keys: any[]) => any;
|
68
|
-
parsePath(text: string): string[] | null;
|
69
|
-
isValidPath(path: string): boolean;
|
70
|
-
splitStringAtLastSeparator(input: string): string[];
|
98
|
+
singleLineMultiLineToggle(): void;
|
99
|
+
getLineNumbersExension(): Extension;
|
100
|
+
getLanguageExtension(): Extension;
|
101
|
+
getReadOnlyExtension(): Extension;
|
102
|
+
getSingleLineExtension(): Extension;
|
103
|
+
getPlaceholderExtension(): Extension;
|
104
|
+
restrictSingleLine(): Extension;
|
71
105
|
}
|
72
106
|
export default NileCodeEditor;
|
73
107
|
declare global {
|