UNPKG

on-codemerge

Version:

A WYSIWYG editor for on-codemerge is a user-friendly interface that allows users to edit and view their code in real time, exactly as it will appear in the final product

3 lines (2 loc) 1.71 kB
/*! on-codemerge v1.3.1 @author Pavel Kuzmin @license MIT @homepage https://s00d.github.io/on-codemerge/ @repository git+https://github.com/s00d/on-codemerge.git Copyright (c) 2026 Pavel Kuzmin - Built on 2026-07-02T13:39:17.947Z */ "use strict";var h=Object.defineProperty;var m=(n,e,t)=>e in n?h(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var r=(n,e,t)=>m(n,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=class i{constructor(){r(this,"notifications",[])}static getInstance(){return i.instance||(i.instance=new i),i.instance}show(e){const{message:t,type:l="info",duration:o=3e3,position:d="top-right"}=e;let s=document.querySelector(`.notification-container.${d.replace("-","-")}`);s||(s=document.createElement("div"),s.className=`notification-container ${d.replace("-","-")}`,document.body.appendChild(s));const c=document.createElement("div");c.className=`notification ${l}`,c.textContent=t,s.appendChild(c),this.notifications.push(c),o>0&&setTimeout(()=>{this.remove(c)},o)}success(e,t){this.show({...t,message:e,type:"success"})}error(e,t){this.show({...t,message:e,type:"error"})}warning(e,t){this.show({...t,message:e,type:"warning"})}info(e,t){this.show({...t,message:e,type:"info"})}remove(e){e.parentNode&&(e.classList.add("removing"),setTimeout(()=>{e.parentNode&&e.parentNode.removeChild(e);const t=this.notifications.indexOf(e);t>-1&&this.notifications.splice(t,1),document.querySelectorAll(".notification-container").forEach(o=>{o.children.length===0&&o.remove()})},300))}clearAll(){this.notifications.forEach(e=>{this.remove(e)})}destroy(){this.clearAll()}};r(i,"instance");let a=i;exports.NotificationManager=a;