@kodaris/krubble-components 1.0.32 → 1.0.34
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/custom-elements.json +20 -3
- package/dist/dialog/dialog.d.ts +3 -0
- package/dist/dialog/dialog.d.ts.map +1 -1
- package/dist/dialog/dialog.js +26 -0
- package/dist/dialog/dialog.js.map +1 -1
- package/dist/krubble-components.bundled.js +26 -0
- package/dist/krubble-components.bundled.js.map +1 -1
- package/dist/krubble-components.bundled.min.js +18 -2
- package/dist/krubble-components.bundled.min.js.map +1 -1
- package/dist/krubble-components.umd.js +26 -0
- package/dist/krubble-components.umd.js.map +1 -1
- package/dist/krubble-components.umd.min.js +18 -2
- package/dist/krubble-components.umd.min.js.map +1 -1
- package/dist/monaco/monaco.d.ts.map +1 -1
- package/dist/monaco/monaco.js +13 -1
- package/dist/monaco/monaco.js.map +1 -1
- package/package.json +1 -1
|
@@ -830,9 +830,10 @@ const Le="important",Re=" !"+Le,je=_e(class extends xe{constructor(e){if(super(e
|
|
|
830
830
|
gap: 12px;
|
|
831
831
|
justify-content: flex-end;
|
|
832
832
|
}
|
|
833
|
-
`,qe=De([ae("kr-dialog-footer")],qe);class Be{constructor(){this._resolvePromise=null,this._dialogElement=null,this._promise=new Promise((e=>{this._resolvePromise=e}))}setDialogElement(e){this._dialogElement=e}close(e){this._resolvePromise&&(this._resolvePromise(e),this._resolvePromise=null),this._dialogElement?.remove()}afterClosed(){return this._promise}}let He=class extends re{constructor(){super(...arguments),this._dialogRef=null,this._contentElement=null,this.opened=!1,this.width="560px",this._handleDocumentKeyDown=e=>{"Escape"===e.key&&this.close()}}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("keydown",this._handleDocumentKeyDown)}updated(e){super.updated(e),e.has("opened")&&(this.opened?document.addEventListener("keydown",this._handleDocumentKeyDown):document.removeEventListener("keydown",this._handleDocumentKeyDown))}open(){this.opened=!0}close(){this._dialogRef?this._dialogRef.close(void 0):(this.opened=!1,this.dispatchEvent(new CustomEvent("close",{bubbles:!0,composed:!0})))}static open(e,t){document.querySelectorAll("kr-dialog").forEach((e=>{e._dialogRef&&e.remove()}));const i=new Be,o=document.createElement("kr-dialog");i.setDialogElement(o),o._dialogRef=i;const s=new e;return s.dialogRef=i,t?.data&&(s.data=t.data),o._contentElement=s,o.opened=!0,document.body.appendChild(o),i}_handleBackdropClick(e){e.target.classList.contains("backdrop")&&this.close()}render(){return H`
|
|
833
|
+
`,qe=De([ae("kr-dialog-footer")],qe);class Be{constructor(){this._resolvePromise=null,this._dialogElement=null,this._promise=new Promise((e=>{this._resolvePromise=e}))}setDialogElement(e){this._dialogElement=e}close(e){this._resolvePromise&&(this._resolvePromise(e),this._resolvePromise=null),this._dialogElement?.remove()}afterClosed(){return this._promise}}let He=class extends re{constructor(){super(...arguments),this._dialogRef=null,this._contentElement=null,this.opened=!1,this.label="",this.width="560px",this._handleDocumentKeyDown=e=>{"Escape"===e.key&&this.close()}}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("keydown",this._handleDocumentKeyDown)}updated(e){super.updated(e),e.has("opened")&&(this.opened?document.addEventListener("keydown",this._handleDocumentKeyDown):document.removeEventListener("keydown",this._handleDocumentKeyDown))}open(){this.opened=!0}close(){this._dialogRef?this._dialogRef.close(void 0):(this.opened=!1,this.dispatchEvent(new CustomEvent("close",{bubbles:!0,composed:!0})))}static open(e,t){document.querySelectorAll("kr-dialog").forEach((e=>{e._dialogRef&&e.remove()}));const i=new Be,o=document.createElement("kr-dialog");i.setDialogElement(o),o._dialogRef=i;const s=new e;return s.dialogRef=i,t?.data&&(s.data=t.data),t?.label&&(o.label=t.label),t?.width&&(o.width=t.width),o._contentElement=s,o.opened=!0,document.body.appendChild(o),i}_handleBackdropClick(e){e.target.classList.contains("backdrop")&&this.close()}render(){return H`
|
|
834
834
|
<div class="backdrop" @click=${this._handleBackdropClick}></div>
|
|
835
835
|
<div class="dialog" style=${je({width:this.width})}>
|
|
836
|
+
${this.label?H`<div class="dialog__header"><div class="dialog__header-label">${this.label}</div></div>`:""}
|
|
836
837
|
${this._contentElement?this._contentElement:H`<slot></slot>`}
|
|
837
838
|
</div>
|
|
838
839
|
`}};He.styles=r`
|
|
@@ -878,7 +879,22 @@ const Le="important",Re=" !"+Le,je=_e(class extends xe{constructor(e){if(super(e
|
|
|
878
879
|
flex: 1 1 auto;
|
|
879
880
|
overflow: auto;
|
|
880
881
|
}
|
|
881
|
-
|
|
882
|
+
|
|
883
|
+
.dialog__header {
|
|
884
|
+
display: flex;
|
|
885
|
+
padding: 0 24px;
|
|
886
|
+
align-items: center;
|
|
887
|
+
height: 64px;
|
|
888
|
+
flex-shrink: 0;
|
|
889
|
+
border-bottom: 1px solid rgba(0, 0, 0, 0.1);
|
|
890
|
+
}
|
|
891
|
+
|
|
892
|
+
.dialog__header-label {
|
|
893
|
+
margin: 0;
|
|
894
|
+
font-size: 18px;
|
|
895
|
+
font-weight: 600;
|
|
896
|
+
}
|
|
897
|
+
`,De([pe()],He.prototype,"_contentElement",void 0),De([he({type:Boolean,reflect:!0})],He.prototype,"opened",void 0),De([he({type:String})],He.prototype,"label",void 0),De([he({type:String})],He.prototype,"width",void 0),He=De([ae("kr-dialog")],He);var Ve,Ue=function(e,t,i,o){var s,r=arguments.length,n=r<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,i,o);else for(var l=e.length-1;l>=0;l--)(s=e[l])&&(n=(r<3?s(n):r>3?s(t,i,n):s(t,i))||n);return r>3&&n&&Object.defineProperty(t,i,n),n};let Ne=Ve=class extends re{constructor(){super(...arguments),this.dismissTimeout=null,this.type="info",this.title="",this.message="",this.duration=5e3}static show(e){const t=document.createElement("kr-snackbar");return t.message=e.message,t.title=e.title??"",t.type=e.type??"info",void 0!==e.duration?t.duration=e.duration:"error"===t.type?t.duration=0:t.duration=5e3,document.body.appendChild(t),t}connectedCallback(){super.connectedCallback(),this.setAttribute("role","alert"),this.classList.add(`kr-snackbar--${this.type}`),this.title&&this.classList.add("kr-snackbar--has-title"),Ve.activeSnackbars.push(this),this.updatePositions(),this.duration>0&&(this.dismissTimeout=window.setTimeout((()=>{this.dismiss()}),this.duration))}disconnectedCallback(){super.disconnectedCallback();const e=Ve.activeSnackbars.indexOf(this);e>-1&&Ve.activeSnackbars.splice(e,1),this.updatePositions(),this.dismissTimeout&&clearTimeout(this.dismissTimeout)}updatePositions(){let e=24;for(const t of Ve.activeSnackbars)t.style.bottom=`${e}px`,e+=t.offsetHeight+8}dismiss(){this.dismissTimeout&&(clearTimeout(this.dismissTimeout),this.dismissTimeout=null),this.classList.add("kr-snackbar--closing"),this.addEventListener("animationend",(()=>{this.dispatchEvent(new CustomEvent("dismiss",{bubbles:!0,composed:!0})),this.remove()}),{once:!0})}render(){const e={info:H`<svg class="icon" viewBox="0 0 20 20" fill="currentColor"><path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z" clip-rule="evenodd"/></svg>`,success:H`<svg class="icon" viewBox="0 0 20 20" fill="currentColor"><path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z" clip-rule="evenodd"/></svg>`,warning:H`<svg class="icon" viewBox="0 0 20 20" fill="currentColor"><path fill-rule="evenodd" d="M8.257 3.099c.765-1.36 2.722-1.36 3.486 0l5.58 9.92c.75 1.334-.213 2.98-1.742 2.98H4.42c-1.53 0-2.493-1.646-1.743-2.98l5.58-9.92zM11 13a1 1 0 11-2 0 1 1 0 012 0zm-1-8a1 1 0 00-1 1v3a1 1 0 002 0V6a1 1 0 00-1-1z" clip-rule="evenodd"/></svg>`,error:H`<svg class="icon" viewBox="0 0 20 20" fill="currentColor"><path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z" clip-rule="evenodd"/></svg>`};return H`
|
|
882
898
|
${e[this.type]}
|
|
883
899
|
<div class="content">
|
|
884
900
|
${this.title?H`<div class="title">${this.title}</div>`:""}
|