vex-ui-kit 1.0.0
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 +830 -0
- package/dist/adapters/react.cjs.js +17 -0
- package/dist/adapters/react.cjs.js.map +1 -0
- package/dist/adapters/react.d.mts +37 -0
- package/dist/adapters/react.d.ts +37 -0
- package/dist/adapters/react.esm.js +17 -0
- package/dist/adapters/react.esm.js.map +1 -0
- package/dist/adapters/react.umd.js +63 -0
- package/dist/adapters/react.umd.js.map +1 -0
- package/dist/adapters/svelte.cjs.js +17 -0
- package/dist/adapters/svelte.cjs.js.map +1 -0
- package/dist/adapters/svelte.d.mts +21 -0
- package/dist/adapters/svelte.d.ts +21 -0
- package/dist/adapters/svelte.esm.js +17 -0
- package/dist/adapters/svelte.esm.js.map +1 -0
- package/dist/adapters/svelte.umd.js +44 -0
- package/dist/adapters/svelte.umd.js.map +1 -0
- package/dist/adapters/vue.cjs.js +17 -0
- package/dist/adapters/vue.cjs.js.map +1 -0
- package/dist/adapters/vue.d.mts +35 -0
- package/dist/adapters/vue.d.ts +35 -0
- package/dist/adapters/vue.esm.js +17 -0
- package/dist/adapters/vue.esm.js.map +1 -0
- package/dist/adapters/vue.umd.js +147 -0
- package/dist/adapters/vue.umd.js.map +1 -0
- package/dist/index-CpFq7Lxe.d.mts +213 -0
- package/dist/index-CpFq7Lxe.d.ts +213 -0
- package/dist/themes/flat.css +47 -0
- package/dist/themes/glass.css +22 -0
- package/dist/themes/minimal.css +35 -0
- package/dist/themes/neon.css +45 -0
- package/dist/themes/outline.css +18 -0
- package/dist/themes/pastel.css +21 -0
- package/dist/themes/tokens.css +329 -0
- package/dist/vex-ui-kit.css +329 -0
- package/dist/vexui.cjs.js +17 -0
- package/dist/vexui.cjs.js.map +1 -0
- package/dist/vexui.d.mts +1 -0
- package/dist/vexui.d.ts +1 -0
- package/dist/vexui.esm.js +17 -0
- package/dist/vexui.esm.js.map +1 -0
- package/dist/vexui.umd.js +17 -0
- package/dist/vexui.umd.js.map +1 -0
- package/package.json +63 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";var I=Object.defineProperty;var z=Object.getOwnPropertyDescriptor;var K=Object.getOwnPropertyNames;var W=Object.prototype.hasOwnProperty;var _=(r,e)=>{for(var t in e)I(r,t,{get:e[t],enumerable:!0})},U=(r,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of K(e))!W.call(r,n)&&n!==t&&I(r,n,{get:()=>e[n],enumerable:!(i=z(e,n))||i.enumerable});return r};var X=r=>U(I({},"__esModule",{value:!0}),r);var le={};_(le,{VexProvider:()=>se,useVex:()=>oe});module.exports=X(le);var A=require("react");var H=class{constructor(){this.active=[];this.pending=[];this.maxStack=5}setMaxStack(e){this.maxStack=e}add(e){if(this.active.length<this.maxStack){this.active.push(e),e.show();return}if(e.priority==="critical"){let t=this.active.findIndex(i=>this.getPriorityValue(i.priority)<this.getPriorityValue("critical"));t!==-1?(this.active[t].close(),this.active.splice(t,1),this.pending.unshift(e)):this.pending.unshift(e)}else e.priority==="high"?this.pending.unshift(e):this.pending.push(e);this.sortPending(),this.process()}remove(e){let t=this.active.findIndex(i=>i.id===e);t!==-1&&(this.active.splice(t,1),this.process())}process(){if(this.active.length<this.maxStack&&this.pending.length>0){let e=this.pending.shift();e&&(this.active.push(e),e.show())}}sortPending(){this.pending.sort((e,t)=>this.getPriorityValue(t.priority)-this.getPriorityValue(e.priority))}getPriorityValue(e){switch(e){case"critical":return 4;case"high":return 3;case"normal":return 2;case"low":return 1;default:return 2}}};var $=class{constructor(){this.entries=[];this.limit=100;this.storageKey="vex_history";this.load()}add(e){let t={...e,timestamp:new Date,read:!1};this.entries.unshift(t),this.entries.length>this.limit&&(this.entries=this.entries.slice(0,this.limit)),this.save()}get(){return this.entries}clear(){this.entries=[],this.save()}markAllRead(){this.entries.forEach(e=>e.read=!0),this.save()}markRead(e){let t=this.entries.find(i=>i.id===e);t&&(t.read=!0,this.save())}open(e){if(typeof document>"u")return;let t=document.querySelector(e);if(!t){console.warn(`VexUI: History anchor ${e} not found`);return}let i=document.getElementById("vex-history-dropdown");i&&i.remove();let n=document.createElement("div");n.id="vex-history-dropdown",n.className="vex-history-dropdown";let a=t.getBoundingClientRect();n.style.position="absolute",n.style.top=`${a.bottom+8+window.scrollY}px`,n.style.left=`${a.left+window.scrollX}px`,n.style.zIndex="9999";let c=this.entries.map(s=>`
|
|
2
|
+
<div class="vex-hist-item ${s.read?"read":"unread"}" data-id="${s.id}">
|
|
3
|
+
<div class="vex-hist-icon ${s.type}"></div>
|
|
4
|
+
<div class="vex-hist-content">
|
|
5
|
+
<div class="vex-hist-title">${s.title||s.type}</div>
|
|
6
|
+
<div class="vex-hist-msg">${s.message}</div>
|
|
7
|
+
<div class="vex-hist-time">${s.timestamp.toLocaleTimeString()}</div>
|
|
8
|
+
</div>
|
|
9
|
+
</div>
|
|
10
|
+
`).join("")||'<div class="vex-hist-empty">No notifications</div>';n.innerHTML=`
|
|
11
|
+
<div class="vex-hist-header">
|
|
12
|
+
<span>Notifications</span>
|
|
13
|
+
<button id="vex-hist-clear">Clear</button>
|
|
14
|
+
</div>
|
|
15
|
+
<div class="vex-hist-list">${c}</div>
|
|
16
|
+
`,document.body.appendChild(n);let o=s=>{!n.contains(s.target)&&s.target!==t&&(n.remove(),document.removeEventListener("click",o))};setTimeout(()=>document.addEventListener("click",o),0),n.querySelector("#vex-hist-clear")?.addEventListener("click",()=>{this.clear(),n.remove()})}save(){if(typeof localStorage<"u")try{localStorage.setItem(this.storageKey,JSON.stringify(this.entries))}catch{}}load(){if(typeof localStorage<"u"){let e=localStorage.getItem(this.storageKey);if(e)try{this.entries=JSON.parse(e,(t,i)=>t==="timestamp"?new Date(i):i)}catch(t){console.error("Failed to load VexUI history",t)}}}},O=new $;function Y(r){return Array.from(r.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])')).filter(t=>!t.hasAttribute("disabled")&&!t.getAttribute("aria-hidden"))}function V(r,e){let t=Y(r);if(t.length===0)return;let i=t[0],n=t[t.length-1];e.shiftKey?document.activeElement===i&&(n.focus(),e.preventDefault()):document.activeElement===n&&(i.focus(),e.preventDefault())}var M=null;function k(){typeof document<"u"&&document.activeElement&&(M=document.activeElement)}function S(){M&&typeof document<"u"&&document.body.contains(M)&&(M.focus(),M=null)}function D(r,e){r.setAttribute("role","alert");let t=e==="critical"||e==="high"?"assertive":"polite";r.setAttribute("aria-live",t),r.setAttribute("aria-atomic","true")}function B(r,e,t){r.setAttribute("role","dialog"),r.setAttribute("aria-modal","true"),r.setAttribute("aria-labelledby",e),t&&r.setAttribute("aria-describedby",t)}var P=class{constructor(){this.queue=new H;this.activeAlerts=new Map}success(e,t){return this.create({...t,type:"success",message:e})}error(e,t){return this.create({...t,type:"error",message:e})}warning(e,t){return this.create({...t,type:"warning",message:e})}info(e,t){return this.create({...t,type:"info",message:e})}neutral(e,t){return this.create({...t,type:"neutral",message:e})}loading(e,t){return this.create({...t,type:"loading",message:e,duration:0})}upload(e,t){return this.create({...t,type:"loading",message:e,duration:0,icon:"upload"})}inline(e,t){return this.create({...t,renderer:"inline",selector:e})}fixed(e){return this.create({...e,renderer:"fixed"})}attach(e,t){return this.create({...t,renderer:"attach",selector:e})}show(e){return this.create(e)}create(e){let t=this.generateId(),i=this.processOptions(e);return this.queue.add({id:t,priority:i.priority||"normal",show:()=>this.render(t,i),close:()=>this.dismiss(t)}),O.add({id:t,type:i.type||"info",title:i.title,message:i.message}),t}processOptions(e){return{type:"info",duration:6e3,dismissible:!0,position:"top",align:"center",animate:"slide",priority:"normal",maxStack:5,progress:!0,...e}}render(e,t){if(typeof document>"u")return;let i=document.createElement("div");i.setAttribute("data-id",e),i.className=`vex-alert vex-${t.type}`,D(i,t.priority||"normal");let n=document.createElement("div");n.className="vx-icon",t.type==="loading"?n.innerHTML='<div class="vx-spinner"></div>':n.innerHTML=this.getIcon(t.type||"info",t.icon),i.appendChild(n);let a=document.createElement("div");if(a.className="vx-body",t.title){let o=document.createElement("div");o.className="vx-title",o.textContent=t.title,a.appendChild(o)}let c=document.createElement("div");if(c.className="vx-msg",c.textContent=t.message,a.appendChild(c),t.actions&&t.actions.length>0){let o=document.createElement("div");o.className="vx-actions",t.actions.forEach(s=>{let d=document.createElement("button");d.className=`vx-act-btn vx-${s.variant||"default"}`,d.textContent=s.label,d.onclick=m=>{m.stopPropagation(),s.onClick?s.onClick(()=>this.dismiss(e)):this.dismiss(e)},o.appendChild(d)}),a.appendChild(o)}if(i.appendChild(a),t.dismissible){let o=document.createElement("button");o.className="vx-close",o.ariaLabel="Fechar",o.innerHTML="\u2715",o.onclick=s=>{s.stopPropagation(),this.dismiss(e)},i.appendChild(o)}if(t.progress&&t.duration&&t.duration>0){let o=document.createElement("div");o.className="vx-progress",o.style.animationDuration=`${t.duration}ms`,i.appendChild(o)}if(t.type==="loading"&&t.icon==="upload"){let o=document.createElement("div");o.className="vx-upload-bar",i.appendChild(o)}t.theme&&Object.entries(t.theme).forEach(([o,s])=>{s&&i.style.setProperty(o,s)}),this.mount(i,t),this.activeAlerts.set(e,{element:i,options:t}),t.duration&&t.duration>0&&setTimeout(()=>this.dismiss(e),t.duration)}mount(e,t){if(t.renderer==="inline"&&t.selector){let i=typeof t.selector=="string"?document.querySelector(t.selector):t.selector;if(i instanceof HTMLElement){let n=i.querySelector(".vex-alert");n&&n.remove(),i.appendChild(e)}}else if(t.renderer==="attach"&&t.selector){let i=typeof t.selector=="string"?document.querySelector(t.selector):t.selector;i instanceof HTMLElement&&(document.body.appendChild(e),this.positionAttached(e,i,t.placement||"top"))}else{let i=t.position||"top",n=document.getElementById(`vex-fixed-${i}`);n||(n=document.createElement("div"),n.id=`vex-fixed-${i}`,n.className="vex-fixed-container",n.style.position="fixed",n.style.zIndex="9000",n.style.display="flex",n.style.flexDirection="column",n.style.gap="10px",n.style.pointerEvents="none",n.style.width="100%",n.style.maxWidth="420px",n.style.left="50%",n.style.transform="translateX(-50%)",i==="top"?n.style.top="20px":n.style.bottom="20px",document.body.appendChild(n)),e.style.pointerEvents="all",n.appendChild(e)}}positionAttached(e,t,i){let n=t.getBoundingClientRect(),a=e.getBoundingClientRect();e.style.position="absolute",e.style.zIndex="9000",e.style.width="max-content",e.style.maxWidth="300px";let c=window.scrollX,o=window.scrollY,s=0,d=0;switch(i){case"top":s=n.top+o-e.offsetHeight-8,d=n.left+c+(n.width-e.offsetWidth)/2;break;case"bottom":s=n.bottom+o+8,d=n.left+c+(n.width-e.offsetWidth)/2;break;default:s=n.top+o-50,d=n.left+c}e.style.top=`${s}px`,e.style.left=`${d}px`}dismiss(e){let t=this.activeAlerts.get(e);if(t){let{element:i,options:n}=t;i.classList.add("removing");let a=()=>{i.parentNode&&i.parentNode.removeChild(i),this.activeAlerts.delete(e),this.queue.remove(e),n.onClose&&n.onClose()};i.addEventListener("animationend",a),setTimeout(()=>{this.activeAlerts.has(e)&&a()},400)}}dismissAll(e){let t=[];this.activeAlerts.forEach((i,n)=>{e&&(e.type&&i.options.type!==e.type||e.position&&i.options.position!==e.position)||t.push(n)}),t.forEach(i=>this.dismiss(i))}update(e,t){let i=this.activeAlerts.get(e);if(!i)return;let{element:n,options:a}=i,c={...a,...t};if(t.type&&t.type!==a.type){n.classList.remove(`vex-${a.type}`),n.classList.add(`vex-${t.type}`);let o=n.querySelector(".vx-icon");o&&(t.type==="loading"?o.innerHTML='<div class="vx-spinner"></div>':o.innerHTML=this.getIcon(t.type,t.icon))}if(t.message){let o=n.querySelector(".vx-msg");o&&(o.textContent=t.message)}if(t.title){let o=n.querySelector(".vx-title");o||(o=document.createElement("div"),o.className="vx-title",n.querySelector(".vx-body")?.prepend(o)),o&&(o.textContent=t.title)}this.activeAlerts.set(e,{element:n,options:c})}progress(e,t){let i=this.activeAlerts.get(e);if(!i)return;let n=0;typeof t=="number"?n=t:t.total>0&&(n=t.loaded/t.total*100);let a=i.element.querySelector(".vx-upload-prog");if(!a){let c=document.createElement("div");c.className="vx-upload-bar",c.style.height="4px",c.style.width="100%",c.style.backgroundColor="rgba(255,255,255,0.1)",c.style.borderRadius="2px",c.style.marginTop="8px",c.style.overflow="hidden",a=document.createElement("div"),a.className="vx-upload-prog",a.style.height="100%",a.style.backgroundColor="var(--vex-info-accent, #6366f1)",a.style.transition="width 0.2s linear",c.appendChild(a);let o=i.element.querySelector(".vx-body");o?o.appendChild(c):i.element.appendChild(c)}a.style.width=`${n}%`}generateId(){return typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():Math.random().toString(36).slice(2,9)}getIcon(e,t){if(t)return t;switch(e){case"success":return"\u2713";case"error":return"\u2715";case"warning":return"\u26A0";case"info":return"\u2139";case"neutral":return"\xB7";default:return""}}};var T=class{constructor(){this.activeModals=[]}confirm(e){return new Promise(t=>{this.create({type:"warning",...e,confirmLabel:e.confirmLabel||"Confirmar",cancelLabel:e.cancelLabel||"Cancelar"},()=>t(!0),()=>t(!1))})}alert(e){return new Promise(t=>{this.create({type:"info",...e,confirmLabel:e.confirmLabel||"OK",cancelLabel:void 0},()=>t(),()=>t())})}async form(e){return new Promise(t=>{let i={},n=document.createElement("div");n.className="modal-form",e.fields.forEach(a=>{let c=document.createElement("div");c.className="form-grp";let o=document.createElement("label");o.className="form-lbl",o.textContent=a.label,c.appendChild(o);let s;a.type==="select"?(s=document.createElement("select"),s.className="form-sel",a.options&&a.options.forEach(m=>{let l=document.createElement("option");l.value=m,l.textContent=m,s.appendChild(l)}),a.defaultValue&&(s.value=a.defaultValue)):a.type==="textarea"?(s=document.createElement("textarea"),s.className="form-tex",a.placeholder&&(s.placeholder=a.placeholder),a.defaultValue&&(s.value=a.defaultValue)):a.type==="radio"?(s=document.createElement("div"),s.className="form-radio-grp",a.options&&a.options.forEach(m=>{let l=document.createElement("label");l.style.display="flex",l.style.gap="6px",l.style.alignItems="center";let u=document.createElement("input");u.type="radio",u.name=a.name,u.value=m,a.defaultValue===m&&(u.checked=!0),l.appendChild(u),l.appendChild(document.createTextNode(m)),s.appendChild(l)})):(s=document.createElement("input"),s.className="form-inp",s.type=a.type,a.placeholder&&(s.placeholder=a.placeholder),a.defaultValue&&(s.value=a.defaultValue)),i[a.name]=s,c.appendChild(s);let d=document.createElement("div");d.className="form-err",d.style.color="var(--vex-error-text, #f87171)",d.style.fontSize="11px",d.style.display="none",d.style.marginTop="4px",c.appendChild(d),n.appendChild(c)}),this.create({...e,content:n,confirmLabel:e.submitLabel||"Enviar",cancelLabel:e.cancelLabel||"Cancelar"},()=>{let a=!0,c={};if(e.fields.forEach(o=>{let s=i[o.name],d;if(o.type==="radio"){let u=s.querySelector("input:checked");d=u?u.value:null}else d=s.value;c[o.name]=d;let m=s.parentElement?.querySelector(".form-err");m&&(m.style.display="none");let l=null;o.required&&!d?l="Campo obrigat\xF3rio":o.validate&&(l=o.validate(d)),l&&(a=!1,m&&(m.textContent=l,m.style.display="block"))}),a&&e.validate){let o=e.validate(c);o&&(a=!1,Object.entries(o).forEach(([s,d])=>{let l=i[s]?.parentElement?.querySelector(".form-err");l&&(l.textContent=d,l.style.display="block")}))}return a?(t(c),!0):!1},()=>t(null))})}async prompt(e){let{validate:t,...i}=e,n=await this.form({...i,fields:[{name:"value",label:"",type:"text",defaultValue:e.defaultValue,placeholder:e.placeholder,validate:t,required:!0}],submitLabel:e.confirmLabel||"OK"});return n?n.value:null}preview(e){let t=document.createElement("div");t.className="vx-preview-body",t.style.textAlign="center";let i=document.createElement("img");if(i.src=e.src,i.style.maxWidth="100%",i.style.maxHeight="70vh",i.style.borderRadius="8px",i.style.boxShadow="0 8px 30px rgba(0,0,0,0.5)",t.appendChild(i),e.meta){let n=document.createElement("div");n.className="vx-meta",n.textContent=e.meta.join(" \xB7 "),n.style.marginTop="16px",n.style.color="var(--vex-text-muted, rgba(255,255,255,0.6))",n.style.fontSize="13px",t.appendChild(n)}if(e.gallery){let n=document.createElement("div");n.className="vx-gallery",n.style.display="flex",n.style.gap="8px",n.style.justifyContent="center",n.style.marginTop="16px",e.gallery.forEach(a=>{let c=document.createElement("img");c.src=a,c.style.width="48px",c.style.height="48px",c.style.objectFit="cover",c.style.borderRadius="6px",c.style.cursor="pointer",c.style.opacity=a===e.src?"1":"0.5",c.style.border=a===e.src?"2px solid var(--vex-primary, #6366f1)":"2px solid transparent",c.onclick=()=>{i.src=a,Array.from(n.children).forEach(o=>{o.style.opacity="0.5",o.style.border="2px solid transparent"}),c.style.opacity="1",c.style.border="2px solid var(--vex-primary, #6366f1)"},n.appendChild(c)}),t.appendChild(n)}this.create({...e,content:t,width:e.width||800,footer:!1})}custom(e){return this.create(e)}create(e,t,i){if(typeof document>"u")return{close:()=>{}};k();let n=document.createElement("div");n.className="vex-backdrop";let a=`vex-modal-title-${Math.random().toString(36).slice(2)}`,c=`vex-modal-desc-${Math.random().toString(36).slice(2)}`;B(n,a,c);let o=document.createElement("div");o.className="vex-modal",e.width&&(o.style.maxWidth=`${e.width}px`),e.animate&&o.classList.add(`vex-anim-${e.animate}`);let s=document.createElement("div");if(s.className="modal-hdr",s.appendChild(document.createElement("div")),e.showClose!==!1){let l=document.createElement("button");l.className="modal-x",l.ariaLabel="Fechar",l.innerHTML="\u2715",l.onclick=()=>{i&&i(),this.close(n)},s.appendChild(l)}o.appendChild(s);let d=document.createElement("div");if(d.className="modal-bdy",e.type){let l=document.createElement("div");l.className=`modal-icon ${e.type}`,l.innerHTML=this.getIcon(e.type),d.appendChild(l)}if(e.title){let l=document.createElement("div");l.id=a,l.className="modal-title",l.textContent=e.title,d.appendChild(l)}if(e.message){let l=document.createElement("div");l.id=c,l.className="modal-desc",l.textContent=e.message,d.appendChild(l)}if(e.content){let l=document.createElement("div");l.className="modal-custom",typeof e.content=="string"?l.innerHTML=e.content:l.appendChild(e.content),d.appendChild(l)}if(o.appendChild(d),e.footer!==!1&&(e.confirmLabel||e.cancelLabel)){let l=document.createElement("div");if(l.className="modal-ftr",e.cancelLabel){let u=document.createElement("button");u.className="modal-btn cancel",u.textContent=e.cancelLabel,u.onclick=()=>{i&&i(),this.close(n)},l.appendChild(u)}if(e.confirmLabel){let u=document.createElement("button");if(u.className=`modal-btn ${e.type||"primary"}`,u.textContent=e.confirmLabel,e.confirmDelay&&e.confirmDelay>0){u.disabled=!0;let x=Math.ceil(e.confirmDelay/1e3),C=e.confirmLabel;u.textContent=`${C} (${x})`;let b=setInterval(()=>{x--,x<=0?(clearInterval(b),u.disabled=!1,u.textContent=C):u.textContent=`${C} (${x})`},1e3);n._interval=b}u.onclick=async()=>{t?await t()!==!1&&this.close(n):this.close(n)},l.appendChild(u)}o.appendChild(l)}n.appendChild(o),document.body.appendChild(n),this.activeModals.push(n),e.closeOnBackdrop!==!1&&(n.onclick=l=>{l.target===n&&(i&&i(),this.close(n))});let m=l=>{l.key==="Escape"&&e.closeOnEscape!==!1&&this.activeModals[this.activeModals.length-1]===n&&(i&&i(),this.close(n)),l.key==="Tab"&&V(n,l)};return document.addEventListener("keydown",m),n._cleanup=()=>{document.removeEventListener("keydown",m),n._interval&&clearInterval(n._interval)},e.onOpen&&e.onOpen(),{close:()=>this.close(n,i)}}close(e,t){if(e.classList.contains("closing"))return;e.classList.add("closing");let i=e.querySelector(".vex-modal");i&&i.classList.add("closing");let n=()=>{e._cleanup&&e._cleanup(),e.parentNode&&e.parentNode.removeChild(e),this.activeModals=this.activeModals.filter(a=>a!==e),S()};e.addEventListener("animationend",n),setTimeout(()=>{document.body.contains(e)&&n()},300)}getIcon(e){switch(e){case"danger":return"\u2715";case"warning":return"!";case"success":return"\u2713";case"info":return"i";default:return""}}};function Q(r){if(typeof document>"u")return{close:()=>{}};k();let e=document.createElement("div");e.className=`vex-drawer vex-drawer-${r.position}`,r.className&&e.classList.add(r.className),r.width&&(r.position==="left"||r.position==="right")&&(e.style.width=`${r.width}px`),r.height&&(r.position==="top"||r.position==="bottom")&&(e.style.height=`${r.height}px`);let t=document.createElement("div");if(t.className="drawer-hdr",r.title){let m=document.createElement("div");m.className="drawer-title",m.textContent=r.title,t.appendChild(m)}let i=document.createElement("button");i.className="drawer-close",i.innerHTML="\u2715",i.onclick=()=>s(),t.appendChild(i),e.appendChild(t);let n=document.createElement("div");n.className="drawer-body";let a=null,c=null,o=null;if(typeof r.content=="string")if(r.content.startsWith("#")||r.content.startsWith(".")){let m=document.querySelector(r.content);m?(o=m,a=m.parentNode,c=m.nextSibling,n.appendChild(m),m.style.display="block"):n.innerHTML=r.content}else n.innerHTML=r.content;else o=r.content,a=r.content.parentNode,c=r.content.nextSibling,n.appendChild(r.content),r.content.style.display="block";if(e.appendChild(n),r.footer&&r.footer.length>0){let m=document.createElement("div");m.className="drawer-ftr",r.footer.forEach(l=>{let u=document.createElement("button");u.className=`drawer-btn ${l.variant||"default"}`,u.textContent=l.label,u.onclick=()=>{l.onClick?l.onClick(()=>s()):s()},m.appendChild(u)}),e.appendChild(m)}document.body.appendChild(e),requestAnimationFrame(()=>{e.classList.add("open")});let s=()=>{e.classList.remove("open"),e.addEventListener("transitionend",()=>{o&&a&&(o.style.display="",a.insertBefore(o,c)),e.parentNode&&e.parentNode.removeChild(e),S(),r.onClose&&r.onClose()},{once:!0}),document.removeEventListener("click",d)},d=m=>{r.persistent||e.classList.contains("open")&&!e.contains(m.target)&&s()};return setTimeout(()=>{document.addEventListener("click",d)},100),{close:s}}async function j(r){let e=new T;return new Promise(t=>{let i=0,n={},a=null,c=null,o=l=>{let u=l;for(;u<r.length;){let x=r[u];if(!x.condition||x.condition(n))return u;u++}return-1};if(i=o(0),i===-1){t(n);return}let s=document.createElement("div");s.className="vex-flow-container";let d=()=>{s.innerHTML="";let l=r[i];if(c){let p=c.querySelector(".modal-title");p&&(p.textContent=l.title);let h=c.querySelector(".modal-icon");if(h&&l.type){h.className=`modal-icon ${l.type}`;let y={danger:"\u2715",warning:"!",success:"\u2713",info:"i"};h.innerHTML=y[l.type]||"i"}}let u=document.createElement("div");u.className="modal-steps",r.forEach((p,h)=>{let y=document.createElement("div");y.className="step-dot",h<i&&y.classList.add("done"),h===i&&y.classList.add("active");let f=document.createElement("div");f.className="step-circle",f.textContent=(h+1).toString(),h<i&&(f.textContent="\u2713");let g=document.createElement("div");g.className="step-name",g.textContent=p.title,y.appendChild(f),y.appendChild(g),u.appendChild(y)}),s.appendChild(u);let x=document.createElement("div");if(x.className="flow-content",l.description){let p=document.createElement("div");p.className="modal-desc",p.textContent=l.description,p.style.marginBottom="16px",x.appendChild(p)}let C={};l.fields&&l.fields.forEach(p=>{let h=document.createElement("div");h.className="form-grp";let y=document.createElement("label");y.className="form-lbl",y.textContent=p.label,h.appendChild(y);let f;p.type==="select"?(f=document.createElement("select"),f.className="form-sel",p.options&&p.options.forEach(L=>{let w=document.createElement("option");w.value=L,w.textContent=L,f.appendChild(w)}),n[p.name]&&(f.value=n[p.name])):(f=document.createElement("input"),f.className="form-inp",f.type=p.type,n[p.name]&&(f.value=n[p.name])),C[p.name]=f,h.appendChild(f);let g=document.createElement("div");g.className="form-err",g.style.color="var(--vex-error-text, #f87171)",g.style.fontSize="11px",g.style.display="none",h.appendChild(g),x.appendChild(h)}),s.appendChild(x);let b=document.createElement("div");if(b.className="flow-btns",b.style.marginTop="24px",b.style.display="flex",b.style.justifyContent="flex-end",b.style.gap="10px",i>0){let p=document.createElement("button");p.className="modal-btn cancel",p.textContent="\u2190 Voltar",p.onclick=()=>{let h=i-1;for(;h>=0;){let y=r[h];if(!y.condition||y.condition(n))break;h--}h>=0&&(i=h,d())},b.appendChild(p)}let E=document.createElement("button");E.className="modal-btn primary";let q=o(i+1)===-1;E.textContent=q?"Concluir":"Pr\xF3ximo \u2192",E.onclick=async()=>{let p={},h=!0;if(l.fields&&l.fields.forEach(f=>{let g=C[f.name].value;p[f.name]=g,n[f.name]=g,f.required&&!g&&(h=!1)}),!h)return;if(l.beforeNext){E.disabled=!0,E.textContent="Aguarde...";let f=await l.beforeNext(p);if(E.disabled=!1,E.textContent=q?"Concluir":"Pr\xF3ximo \u2192",f){Object.keys(f).forEach(g=>{let L=C[g];if(L&&L.nextElementSibling){let w=L.nextElementSibling;w.textContent=f[g],w.style.display="block"}});return}}let y=o(i+1);y!==-1?(i=y,d()):(a&&a.close(),t(n))},b.appendChild(E),s.appendChild(b)},m=r[i];a=e.custom({title:m.title,type:m.type||"info",content:s,footer:!1,width:600,onClose:()=>{t(null)}}),setTimeout(()=>{c=document.querySelector(".vex-modal:last-child"),d()},0)})}var F=class{constructor(){this.currentTheme="auto";this.mediaQuery=null;typeof window<"u"&&(this.mediaQuery=window.matchMedia("(prefers-color-scheme: dark)"),this.init())}init(){this.mediaQuery?.addEventListener("change",()=>{this.currentTheme==="auto"&&this.applyTheme()})}setTheme(e){this.currentTheme=e,this.applyTheme()}getTheme(){return this.currentTheme}applyTheme(){if(typeof document>"u")return;let e=document.documentElement,t=this.currentTheme==="dark"||this.currentTheme==="auto"&&this.mediaQuery?.matches;t?(e.classList.add("vex-dark"),e.classList.remove("vex-light")):(e.classList.add("vex-light"),e.classList.remove("vex-dark")),e.setAttribute("data-vex-theme",t?"dark":"light")}setTokens(e){if(typeof document>"u")return;let t=document.documentElement;Object.entries(e).forEach(([i,n])=>{t.style.setProperty(i,n)})}isReducedMotion(){return typeof window>"u"?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches}},R=new F;var N=new P,J=new T,G=O;function Z(r){r.theme&&R.setTheme(r.theme)}function ee(r){R.setTheme(r)}function te(r){N.dismiss(r)}function ne(r){N.dismissAll(r)}function ie(r,e){N.update(r,e)}function re(r,e){N.progress(r,e)}var ae={alert:N,modal:J,drawer:Q,flow:j,history:G,configure:Z,setTheme:ee,dismiss:te,dismissAll:ne,update:ie,progress:re,prompt:{inline:async(r,e)=>{let t=typeof r=="string"?document.querySelector(r):r;if(!t)return null;let i=t.textContent,n=t.style.display,a=document.createElement("input");return a.type="text",a.value=i||"",a.placeholder=e.placeholder||"",a.className="vex-inline-prompt",a.style.fontSize=getComputedStyle(t).fontSize,a.style.fontFamily=getComputedStyle(t).fontFamily,a.style.border="1px solid var(--vex-primary, #6366f1)",a.style.borderRadius="4px",a.style.padding="2px 4px",a.style.background="var(--vex-bg, #000)",a.style.color="var(--vex-text, #fff)",t.style.display="none",t.parentNode?.insertBefore(a,t),a.focus(),new Promise(c=>{let o=s=>{if(s!==null&&e.validate&&e.validate(s)){a.style.borderColor="red";return}a.remove(),t.style.display=n,s!==null&&(t.textContent=s),c(s)};a.onblur=()=>o(a.value),a.onkeydown=s=>{s.key==="Enter"&&o(a.value),s.key==="Escape"&&o(null)}})}}},v=ae;function oe(){let r=(0,A.useRef)([]),e={...v.alert,success:(t,i)=>{let n=v.alert.success(t,i);return r.current.push(n),n},error:(t,i)=>{let n=v.alert.error(t,i);return r.current.push(n),n},warning:(t,i)=>{let n=v.alert.warning(t,i);return r.current.push(n),n},info:(t,i)=>{let n=v.alert.info(t,i);return r.current.push(n),n},neutral:(t,i)=>{let n=v.alert.neutral(t,i);return r.current.push(n),n},loading:(t,i)=>{let n=v.alert.loading(t,i);return r.current.push(n),n},upload:(t,i)=>{let n=v.alert.upload(t,i);return r.current.push(n),n},inline:(t,i)=>{let n=v.alert.inline(t,i);return r.current.push(n),n},fixed:t=>{let i=v.alert.fixed(t);return r.current.push(i),i},attach:(t,i)=>{let n=v.alert.attach(t,i);return r.current.push(n),n},show:t=>{let i=v.alert.show(t);return r.current.push(i),i}};return(0,A.useEffect)(()=>()=>{r.current.forEach(t=>v.dismiss(t))},[]),{...v,alert:e}}var se=({children:r,config:e})=>((0,A.useEffect)(()=>{e&&v.configure(e)},[e]),r);0&&(module.exports={VexProvider,useVex});
|
|
17
|
+
//# sourceMappingURL=react.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/adapters/react.ts","../../src/core/queue.ts","../../src/core/history.ts","../../src/core/a11y.ts","../../src/core/alert.ts","../../src/core/modal.ts","../../src/core/drawer.ts","../../src/core/flow.ts","../../src/core/theme.ts","../../src/index.ts"],"sourcesContent":["import { useEffect, useRef } from 'react'\nimport vex from '../index'\nimport type { AlertOptions } from '../core/alert'\n\nexport function useVex() {\n const ids = useRef<string[]>([])\n \n // Wrap alert methods to track IDs\n const wrappedAlert = {\n ...vex.alert,\n success: (msg: string, opts?: Partial<AlertOptions>) => { const id = vex.alert.success(msg, opts); ids.current.push(id); return id; },\n error: (msg: string, opts?: Partial<AlertOptions>) => { const id = vex.alert.error(msg, opts); ids.current.push(id); return id; },\n warning: (msg: string, opts?: Partial<AlertOptions>) => { const id = vex.alert.warning(msg, opts); ids.current.push(id); return id; },\n info: (msg: string, opts?: Partial<AlertOptions>) => { const id = vex.alert.info(msg, opts); ids.current.push(id); return id; },\n neutral: (msg: string, opts?: Partial<AlertOptions>) => { const id = vex.alert.neutral(msg, opts); ids.current.push(id); return id; },\n loading: (msg: string, opts?: Partial<AlertOptions>) => { const id = vex.alert.loading(msg, opts); ids.current.push(id); return id; },\n upload: (msg: string, opts?: Partial<AlertOptions>) => { const id = vex.alert.upload(msg, opts); ids.current.push(id); return id; },\n inline: (selector: string | HTMLElement, opts: AlertOptions) => { const id = vex.alert.inline(selector, opts); ids.current.push(id); return id; },\n fixed: (opts: AlertOptions) => { const id = vex.alert.fixed(opts); ids.current.push(id); return id; },\n attach: (selector: string | HTMLElement, opts: AlertOptions) => { const id = vex.alert.attach(selector, opts); ids.current.push(id); return id; },\n show: (opts: AlertOptions) => { const id = vex.alert.show(opts); ids.current.push(id); return id; }\n };\n\n useEffect(() => {\n return () => {\n ids.current.forEach(id => vex.dismiss(id));\n }\n }, [])\n\n return {\n ...vex,\n alert: wrappedAlert\n }\n}\n\nexport const VexProvider = ({ children, config }: { children: React.ReactNode, config?: any }) => {\n useEffect(() => {\n if (config) vex.configure(config);\n }, [config]);\n return children; // Logicless provider mostly for config\n}\n","export type Priority = 'critical' | 'high' | 'normal' | 'low';\n\nexport interface QueueItem {\n id: string;\n priority: Priority;\n show: () => void;\n close: () => void;\n}\n\nexport class AlertQueue {\n private active: QueueItem[] = [];\n private pending: QueueItem[] = [];\n private maxStack: number = 5;\n\n public setMaxStack(max: number) {\n this.maxStack = max;\n }\n\n public add(item: QueueItem) {\n // If we have space, show immediately\n if (this.active.length < this.maxStack) {\n this.active.push(item);\n item.show();\n return;\n }\n\n // If full, check priority\n if (item.priority === 'critical') {\n // Find the oldest item with lower priority\n // We sort active by arrival (index) and filter by priority < critical\n const victimIndex = this.active.findIndex(i => this.getPriorityValue(i.priority) < this.getPriorityValue('critical'));\n \n if (victimIndex !== -1) {\n const victim = this.active[victimIndex];\n victim.close();\n \n // Optimistically remove from active to allow immediate show of critical alert\n this.active.splice(victimIndex, 1);\n \n this.pending.unshift(item);\n } else {\n this.pending.unshift(item);\n }\n } else if (item.priority === 'high') {\n // Enqueue at front of pending\n this.pending.unshift(item);\n } else {\n // Enqueue at end\n this.pending.push(item);\n }\n \n // Sort pending to ensure high/critical are always first if multiple are waiting\n this.sortPending();\n this.process();\n }\n\n public remove(id: string) {\n const index = this.active.findIndex(i => i.id === id);\n if (index !== -1) {\n this.active.splice(index, 1);\n this.process();\n }\n }\n\n private process() {\n if (this.active.length < this.maxStack && this.pending.length > 0) {\n const next = this.pending.shift();\n if (next) {\n this.active.push(next);\n next.show();\n }\n }\n }\n \n private sortPending() {\n this.pending.sort((a, b) => this.getPriorityValue(b.priority) - this.getPriorityValue(a.priority));\n }\n\n private getPriorityValue(p: Priority): number {\n switch (p) {\n case 'critical': return 4;\n case 'high': return 3;\n case 'normal': return 2;\n case 'low': return 1;\n default: return 2;\n }\n }\n}\n","export interface HistoryEntry {\n id: string;\n type: string;\n title?: string;\n message: string;\n timestamp: Date;\n read: boolean;\n}\n\nexport class HistoryManager {\n private entries: HistoryEntry[] = [];\n private limit = 100;\n private storageKey = 'vex_history';\n\n constructor() {\n this.load();\n }\n\n public add(entry: Omit<HistoryEntry, 'timestamp' | 'read'>) {\n const fullEntry: HistoryEntry = {\n ...entry,\n timestamp: new Date(),\n read: false\n };\n \n this.entries.unshift(fullEntry);\n if (this.entries.length > this.limit) {\n this.entries = this.entries.slice(0, this.limit);\n }\n this.save();\n }\n\n public get(): HistoryEntry[] {\n return this.entries;\n }\n\n public clear() {\n this.entries = [];\n this.save();\n }\n\n public markAllRead() {\n this.entries.forEach(e => e.read = true);\n this.save();\n }\n\n public markRead(id: string) {\n const entry = this.entries.find(e => e.id === id);\n if (entry) {\n entry.read = true;\n this.save();\n }\n }\n \n // Basic implementation of open - renders a dropdown\n public open(anchorSelector: string) {\n if (typeof document === 'undefined') return;\n \n const anchor = document.querySelector(anchorSelector);\n if (!anchor) {\n console.warn(`VexUI: History anchor ${anchorSelector} not found`);\n return;\n }\n\n // Remove existing if any\n const existing = document.getElementById('vex-history-dropdown');\n if (existing) existing.remove();\n\n const dropdown = document.createElement('div');\n dropdown.id = 'vex-history-dropdown';\n dropdown.className = 'vex-history-dropdown';\n \n // Position it relative to anchor\n const rect = anchor.getBoundingClientRect();\n dropdown.style.position = 'absolute';\n dropdown.style.top = `${rect.bottom + 8 + window.scrollY}px`;\n dropdown.style.left = `${rect.left + window.scrollX}px`;\n dropdown.style.zIndex = '9999';\n \n // Content\n const list = this.entries.map(e => `\n <div class=\"vex-hist-item ${e.read ? 'read' : 'unread'}\" data-id=\"${e.id}\">\n <div class=\"vex-hist-icon ${e.type}\"></div>\n <div class=\"vex-hist-content\">\n <div class=\"vex-hist-title\">${e.title || e.type}</div>\n <div class=\"vex-hist-msg\">${e.message}</div>\n <div class=\"vex-hist-time\">${e.timestamp.toLocaleTimeString()}</div>\n </div>\n </div>\n `).join('') || '<div class=\"vex-hist-empty\">No notifications</div>';\n\n dropdown.innerHTML = `\n <div class=\"vex-hist-header\">\n <span>Notifications</span>\n <button id=\"vex-hist-clear\">Clear</button>\n </div>\n <div class=\"vex-hist-list\">${list}</div>\n `;\n\n document.body.appendChild(dropdown);\n \n // Close on click outside\n const closeHandler = (e: MouseEvent) => {\n if (!dropdown.contains(e.target as Node) && e.target !== anchor) {\n dropdown.remove();\n document.removeEventListener('click', closeHandler);\n }\n };\n setTimeout(() => document.addEventListener('click', closeHandler), 0);\n \n // Clear handler\n dropdown.querySelector('#vex-hist-clear')?.addEventListener('click', () => {\n this.clear();\n dropdown.remove();\n });\n }\n\n private save() {\n if (typeof localStorage !== 'undefined') {\n try {\n localStorage.setItem(this.storageKey, JSON.stringify(this.entries));\n } catch (e) {\n // ignore quota errors\n }\n }\n }\n\n private load() {\n if (typeof localStorage !== 'undefined') {\n const stored = localStorage.getItem(this.storageKey);\n if (stored) {\n try {\n this.entries = JSON.parse(stored, (key, value) => {\n if (key === 'timestamp') return new Date(value);\n return value;\n });\n } catch (e) {\n console.error('Failed to load VexUI history', e);\n }\n }\n }\n }\n}\n\nexport const historyManager = new HistoryManager();\n","/**\n * VexUI Accessibility Utilities\n *\n * Implements focus trapping, focus restoration, and ARIA attributes management\n * for modals, drawers, and alerts.\n */\n\n// Helper to get all focusable elements within a container\nexport function getFocusableElements(container: HTMLElement): HTMLElement[] {\n const selector = 'button, [href], input, select, textarea, [tabindex]:not([tabindex=\"-1\"])';\n return Array.from(container.querySelectorAll<HTMLElement>(selector)).filter(\n (el) => !el.hasAttribute('disabled') && !el.getAttribute('aria-hidden')\n );\n}\n\n// Trap focus within a container\nexport function trapFocus(container: HTMLElement, event: KeyboardEvent): void {\n const focusable = getFocusableElements(container);\n if (focusable.length === 0) return;\n\n const first = focusable[0];\n const last = focusable[focusable.length - 1];\n\n if (event.shiftKey) {\n if (document.activeElement === first) {\n last.focus();\n event.preventDefault();\n }\n } else {\n if (document.activeElement === last) {\n first.focus();\n event.preventDefault();\n }\n }\n}\n\n// Store previously focused element to restore later\nlet previousFocus: HTMLElement | null = null;\n\nexport function saveFocus(): void {\n if (typeof document !== 'undefined' && document.activeElement) {\n previousFocus = document.activeElement as HTMLElement;\n }\n}\n\nexport function restoreFocus(): void {\n if (previousFocus && typeof document !== 'undefined' && document.body.contains(previousFocus)) {\n previousFocus.focus();\n previousFocus = null;\n }\n}\n\n// Set ARIA attributes for alerts\nexport function setupAlertA11y(element: HTMLElement, priority: 'critical' | 'high' | 'normal' | 'low'): void {\n element.setAttribute('role', 'alert');\n // Critical/High should be assertive, others polite\n const liveMode = (priority === 'critical' || priority === 'high') ? 'assertive' : 'polite';\n element.setAttribute('aria-live', liveMode);\n element.setAttribute('aria-atomic', 'true');\n}\n\n// Set ARIA attributes for modals\nexport function setupModalA11y(element: HTMLElement, titleId: string, descId?: string): void {\n element.setAttribute('role', 'dialog');\n element.setAttribute('aria-modal', 'true');\n element.setAttribute('aria-labelledby', titleId);\n if (descId) {\n element.setAttribute('aria-describedby', descId);\n }\n}\n","import { AlertQueue, QueueItem } from './queue';\nimport { historyManager } from './history';\nimport { setupAlertA11y } from './a11y';\nimport { themeManager, ThemeTokens } from './theme';\n\nexport interface AlertAction {\n label: string;\n variant?: 'primary' | 'danger' | 'default';\n onClick?: (close: () => void) => void;\n}\n\nexport interface AlertOptions {\n type?: 'success' | 'error' | 'warning' | 'info' | 'neutral' | 'loading' | 'upload';\n title?: string;\n message: string;\n duration?: number; // ms, 0 = permanent\n dismissible?: boolean;\n icon?: string | null;\n progress?: boolean; // time bar\n actions?: AlertAction[];\n priority?: 'critical' | 'high' | 'normal' | 'low';\n position?: 'top' | 'bottom';\n align?: 'center' | 'left' | 'right';\n animate?: 'slide' | 'fade' | 'scale' | 'bounce';\n maxStack?: number;\n theme?: Partial<ThemeTokens>;\n onClose?: () => void;\n // Internal/Advanced\n renderer?: 'fixed' | 'inline' | 'attach';\n selector?: string | HTMLElement;\n placement?: 'top' | 'bottom' | 'left' | 'right' | 'auto';\n // Upload specific\n total?: number;\n}\n\nexport class AlertEngine {\n private queue = new AlertQueue();\n private activeAlerts = new Map<string, { element: HTMLElement, options: AlertOptions }>();\n\n constructor() {\n // Lazy init\n }\n\n // Public API methods\n public success(message: string, opts?: Partial<AlertOptions>) { return this.create({ ...opts, type: 'success', message }); }\n public error(message: string, opts?: Partial<AlertOptions>) { return this.create({ ...opts, type: 'error', message }); }\n public warning(message: string, opts?: Partial<AlertOptions>) { return this.create({ ...opts, type: 'warning', message }); }\n public info(message: string, opts?: Partial<AlertOptions>) { return this.create({ ...opts, type: 'info', message }); }\n public neutral(message: string, opts?: Partial<AlertOptions>) { return this.create({ ...opts, type: 'neutral', message }); }\n public loading(message: string, opts?: Partial<AlertOptions>) { return this.create({ ...opts, type: 'loading', message, duration: 0 }); }\n \n public upload(message: string, opts?: Partial<AlertOptions>) {\n return this.create({ ...opts, type: 'loading', message, duration: 0, icon: 'upload' });\n }\n\n public inline(selector: string | HTMLElement, opts: AlertOptions) {\n return this.create({ ...opts, renderer: 'inline', selector });\n }\n\n public fixed(opts: AlertOptions) {\n return this.create({ ...opts, renderer: 'fixed' });\n }\n\n public attach(selector: string | HTMLElement, opts: AlertOptions) {\n return this.create({ ...opts, renderer: 'attach', selector });\n }\n \n public show(opts: AlertOptions) {\n return this.create(opts);\n }\n\n // Main create method\n private create(opts: AlertOptions): string {\n const id = this.generateId();\n const fullOpts = this.processOptions(opts);\n \n // Add to queue\n this.queue.add({\n id,\n priority: fullOpts.priority || 'normal',\n show: () => this.render(id, fullOpts),\n close: () => this.dismiss(id)\n });\n\n // Log to history\n historyManager.add({\n id,\n type: fullOpts.type || 'info',\n title: fullOpts.title,\n message: fullOpts.message\n });\n\n return id;\n }\n\n private processOptions(opts: AlertOptions): AlertOptions {\n return {\n type: 'info',\n duration: 6000,\n dismissible: true,\n position: 'top',\n align: 'center',\n animate: 'slide',\n priority: 'normal',\n maxStack: 5,\n progress: true,\n ...opts\n };\n }\n\n private render(id: string, opts: AlertOptions) {\n if (typeof document === 'undefined') return;\n\n // Create element\n const el = document.createElement('div');\n el.setAttribute('data-id', id);\n el.className = `vex-alert vex-${opts.type}`;\n setupAlertA11y(el, opts.priority || 'normal');\n \n // Icon\n const iconEl = document.createElement('div');\n iconEl.className = 'vx-icon';\n if (opts.type === 'loading') {\n iconEl.innerHTML = '<div class=\"vx-spinner\"></div>';\n } else {\n iconEl.innerHTML = this.getIcon(opts.type || 'info', opts.icon);\n }\n el.appendChild(iconEl);\n\n // Body\n const body = document.createElement('div');\n body.className = 'vx-body';\n \n if (opts.title) {\n const title = document.createElement('div');\n title.className = 'vx-title';\n title.textContent = opts.title;\n body.appendChild(title);\n }\n\n const msg = document.createElement('div');\n msg.className = 'vx-msg';\n msg.textContent = opts.message;\n body.appendChild(msg);\n\n // Actions\n if (opts.actions && opts.actions.length > 0) {\n const actionsEl = document.createElement('div');\n actionsEl.className = 'vx-actions';\n opts.actions.forEach(action => {\n const btn = document.createElement('button');\n btn.className = `vx-act-btn vx-${action.variant || 'default'}`;\n btn.textContent = action.label;\n btn.onclick = (e) => {\n e.stopPropagation();\n if (action.onClick) action.onClick(() => this.dismiss(id));\n else this.dismiss(id);\n };\n actionsEl.appendChild(btn);\n });\n body.appendChild(actionsEl);\n }\n el.appendChild(body);\n\n // Close button\n if (opts.dismissible) {\n const closeBtn = document.createElement('button');\n closeBtn.className = 'vx-close';\n closeBtn.ariaLabel = 'Fechar';\n closeBtn.innerHTML = '✕';\n closeBtn.onclick = (e) => {\n e.stopPropagation();\n this.dismiss(id);\n };\n el.appendChild(closeBtn);\n }\n\n // Progress bar (duration)\n if (opts.progress && opts.duration && opts.duration > 0) {\n const prog = document.createElement('div');\n prog.className = 'vx-progress';\n prog.style.animationDuration = `${opts.duration}ms`;\n el.appendChild(prog);\n }\n \n // Upload progress placeholder\n if (opts.type === 'loading' && opts.icon === 'upload') {\n const upProg = document.createElement('div');\n upProg.className = 'vx-upload-bar';\n // hidden initially until updated\n el.appendChild(upProg);\n }\n\n // Theme overrides\n if (opts.theme) {\n Object.entries(opts.theme).forEach(([k, v]) => {\n if (v) el.style.setProperty(k, v);\n });\n }\n\n // Mount\n this.mount(el, opts);\n this.activeAlerts.set(id, { element: el, options: opts });\n\n // Auto dismiss\n if (opts.duration && opts.duration > 0) {\n setTimeout(() => this.dismiss(id), opts.duration);\n }\n }\n\n private mount(el: HTMLElement, opts: AlertOptions) {\n if (opts.renderer === 'inline' && opts.selector) {\n const container = typeof opts.selector === 'string' \n ? document.querySelector(opts.selector) \n : opts.selector;\n if (container instanceof HTMLElement) {\n // Remove previous if needed? Prompt: \"Alerts inline removem o anterior do mesmo container antes de inserir\"\n const existing = container.querySelector('.vex-alert');\n if (existing) existing.remove();\n container.appendChild(el);\n }\n } else if (opts.renderer === 'attach' && opts.selector) {\n const target = typeof opts.selector === 'string' \n ? document.querySelector(opts.selector) \n : opts.selector;\n \n if (target instanceof HTMLElement) {\n document.body.appendChild(el);\n this.positionAttached(el, target, opts.placement || 'top');\n // Handle resize?\n }\n } else {\n // Fixed\n const pos = opts.position || 'top';\n let container = document.getElementById(`vex-fixed-${pos}`);\n if (!container) {\n container = document.createElement('div');\n container.id = `vex-fixed-${pos}`;\n container.className = 'vex-fixed-container'; // For easier styling if needed\n // Inline styles for zero-config\n container.style.position = 'fixed';\n container.style.zIndex = '9000';\n container.style.display = 'flex';\n container.style.flexDirection = 'column';\n container.style.gap = '10px';\n container.style.pointerEvents = 'none';\n container.style.width = '100%';\n container.style.maxWidth = '420px';\n container.style.left = '50%';\n container.style.transform = 'translateX(-50%)';\n \n if (pos === 'top') {\n container.style.top = '20px';\n } else {\n container.style.bottom = '20px';\n }\n document.body.appendChild(container);\n }\n \n el.style.pointerEvents = 'all';\n \n if (pos === 'top') {\n container.appendChild(el);\n } else {\n // For bottom, usually we want new items at the bottom pushing up, or at top of stack?\n // Standard toast behavior: append.\n container.appendChild(el);\n }\n }\n }\n \n private positionAttached(el: HTMLElement, target: HTMLElement, placement: string) {\n const rect = target.getBoundingClientRect();\n const elRect = el.getBoundingClientRect(); // Might be 0 if not rendered yet\n \n el.style.position = 'absolute';\n el.style.zIndex = '9000';\n el.style.width = 'max-content';\n el.style.maxWidth = '300px';\n \n const scrollX = window.scrollX;\n const scrollY = window.scrollY;\n \n // Simple positioning logic\n let top = 0;\n let left = 0;\n \n // We might need to wait for render to get el width/height\n // For now, approximate or assume loaded\n \n switch (placement) {\n case 'top':\n top = rect.top + scrollY - el.offsetHeight - 8;\n left = rect.left + scrollX + (rect.width - el.offsetWidth) / 2;\n break;\n case 'bottom':\n top = rect.bottom + scrollY + 8;\n left = rect.left + scrollX + (rect.width - el.offsetWidth) / 2;\n break;\n // ... others\n default: // auto/top\n top = rect.top + scrollY - 50; // approximate\n left = rect.left + scrollX;\n }\n \n el.style.top = `${top}px`;\n el.style.left = `${left}px`;\n }\n\n public dismiss(id: string) {\n const alert = this.activeAlerts.get(id);\n if (alert) {\n const { element, options } = alert;\n element.classList.add('removing');\n \n const onRemove = () => {\n if (element.parentNode) element.parentNode.removeChild(element);\n this.activeAlerts.delete(id);\n this.queue.remove(id);\n if (options.onClose) options.onClose();\n };\n\n element.addEventListener('animationend', onRemove);\n // Fallback\n setTimeout(() => {\n if (this.activeAlerts.has(id)) onRemove();\n }, 400);\n }\n }\n\n public dismissAll(filter?: { type?: string, position?: string }) {\n // Collect IDs first to avoid iteration issues\n const idsToRemove: string[] = [];\n this.activeAlerts.forEach((val, id) => {\n if (filter) {\n if (filter.type && val.options.type !== filter.type) return;\n if (filter.position && val.options.position !== filter.position) return;\n }\n idsToRemove.push(id);\n });\n idsToRemove.forEach(id => this.dismiss(id));\n }\n\n public update(id: string, opts: Partial<AlertOptions>) {\n const alert = this.activeAlerts.get(id);\n if (!alert) return;\n \n const { element, options } = alert;\n const newOpts = { ...options, ...opts };\n \n // Update classes\n if (opts.type && opts.type !== options.type) {\n element.classList.remove(`vex-${options.type}`);\n element.classList.add(`vex-${opts.type}`);\n \n const iconEl = element.querySelector('.vx-icon');\n if (iconEl) {\n if (opts.type === 'loading') {\n iconEl.innerHTML = '<div class=\"vx-spinner\"></div>';\n } else {\n iconEl.innerHTML = this.getIcon(opts.type, opts.icon);\n }\n }\n }\n \n if (opts.message) {\n const msgEl = element.querySelector('.vx-msg');\n if (msgEl) msgEl.textContent = opts.message;\n }\n \n if (opts.title) {\n let titleEl = element.querySelector('.vx-title');\n if (!titleEl) {\n titleEl = document.createElement('div');\n titleEl.className = 'vx-title';\n element.querySelector('.vx-body')?.prepend(titleEl);\n }\n if (titleEl) titleEl.textContent = opts.title;\n }\n \n this.activeAlerts.set(id, { element, options: newOpts });\n }\n \n public progress(id: string, value: number | { loaded: number, total: number }) {\n const alert = this.activeAlerts.get(id);\n if (!alert) return;\n \n let percent = 0;\n if (typeof value === 'number') percent = value;\n else if (value.total > 0) percent = (value.loaded / value.total) * 100;\n \n let prog = alert.element.querySelector('.vx-upload-prog') as HTMLElement;\n if (!prog) {\n const wrapper = document.createElement('div');\n wrapper.className = 'vx-upload-bar';\n // Style needs to be defined in CSS or here\n wrapper.style.height = '4px';\n wrapper.style.width = '100%';\n wrapper.style.backgroundColor = 'rgba(255,255,255,0.1)';\n wrapper.style.borderRadius = '2px';\n wrapper.style.marginTop = '8px';\n wrapper.style.overflow = 'hidden';\n \n prog = document.createElement('div');\n prog.className = 'vx-upload-prog';\n prog.style.height = '100%';\n prog.style.backgroundColor = 'var(--vex-info-accent, #6366f1)'; // Default color\n prog.style.transition = 'width 0.2s linear';\n \n wrapper.appendChild(prog);\n \n // Append to body or main element?\n // Prompt says \"barra de progresso de upload\".\n // Let's put it in body.\n const body = alert.element.querySelector('.vx-body');\n if (body) body.appendChild(wrapper);\n else alert.element.appendChild(wrapper);\n }\n prog.style.width = `${percent}%`;\n }\n\n private generateId(): string {\n if (typeof crypto !== 'undefined' && crypto.randomUUID) {\n return crypto.randomUUID();\n }\n return Math.random().toString(36).slice(2, 9);\n }\n\n private getIcon(type: string, custom?: string | null): string {\n if (custom) return custom;\n switch (type) {\n case 'success': return '✓';\n case 'error': return '✕';\n case 'warning': return '⚠';\n case 'info': return 'ℹ';\n case 'neutral': return '·';\n default: return '';\n }\n }\n}\n","import { setupModalA11y, trapFocus, saveFocus, restoreFocus } from './a11y';\nimport { themeManager } from './theme';\n\nexport interface ModalOptions {\n type?: 'danger' | 'warning' | 'info' | 'success';\n title?: string;\n message?: string;\n confirmLabel?: string;\n cancelLabel?: string;\n confirmDelay?: number; // ms\n closeOnBackdrop?: boolean;\n closeOnEscape?: boolean;\n width?: number;\n animate?: 'scale' | 'slide' | 'fade';\n showClose?: boolean;\n stackable?: boolean;\n onOpen?: () => void;\n onClose?: () => void;\n \n // Internal/Custom\n content?: string | HTMLElement;\n footer?: boolean; // false to hide footer\n}\n\nexport interface FormField {\n name: string;\n label: string;\n type: 'text'|'email'|'password'|'number'|'textarea'|'select'|'radio'|'checkbox'|'date'|'file'|'range'|'color';\n options?: string[];\n required?: boolean;\n placeholder?: string;\n defaultValue?: any;\n validate?: (value: any) => string | null;\n}\n\nexport interface FormOptions extends ModalOptions {\n fields: FormField[];\n submitLabel?: string;\n validate?: (data: Record<string, any>) => Record<string, string> | null;\n}\n\ntype ConfirmCallback = () => boolean | Promise<boolean> | void;\n\nexport class ModalEngine {\n private activeModals: HTMLElement[] = [];\n \n public confirm(opts: ModalOptions): Promise<boolean> {\n return new Promise((resolve) => {\n this.create({\n type: 'warning',\n ...opts,\n confirmLabel: opts.confirmLabel || 'Confirmar',\n cancelLabel: opts.cancelLabel || 'Cancelar',\n }, () => resolve(true), () => resolve(false));\n });\n }\n\n public alert(opts: ModalOptions): Promise<void> {\n return new Promise((resolve) => {\n this.create({\n type: 'info',\n ...opts,\n confirmLabel: opts.confirmLabel || 'OK',\n cancelLabel: undefined,\n }, () => resolve(), () => resolve());\n });\n }\n\n public async form(opts: FormOptions): Promise<Record<string, any> | null> {\n return new Promise((resolve) => {\n const inputs: Record<string, HTMLElement> = {};\n \n const formContent = document.createElement('div');\n formContent.className = 'modal-form';\n \n opts.fields.forEach(field => {\n const grp = document.createElement('div');\n grp.className = 'form-grp';\n \n const lbl = document.createElement('label');\n lbl.className = 'form-lbl';\n lbl.textContent = field.label;\n grp.appendChild(lbl);\n \n let input: HTMLElement;\n \n if (field.type === 'select') {\n input = document.createElement('select');\n input.className = 'form-sel';\n // (input as HTMLSelectElement).required = !!field.required;\n if (field.options) {\n field.options.forEach(opt => {\n const op = document.createElement('option');\n op.value = opt;\n op.textContent = opt;\n (input as HTMLSelectElement).appendChild(op);\n });\n }\n if (field.defaultValue) (input as HTMLSelectElement).value = field.defaultValue;\n } else if (field.type === 'textarea') {\n input = document.createElement('textarea');\n input.className = 'form-tex';\n // (input as HTMLTextAreaElement).required = !!field.required;\n if (field.placeholder) (input as HTMLTextAreaElement).placeholder = field.placeholder;\n if (field.defaultValue) (input as HTMLTextAreaElement).value = field.defaultValue;\n } else if (field.type === 'radio') {\n // Special handling for radio group\n input = document.createElement('div');\n input.className = 'form-radio-grp';\n if (field.options) {\n field.options.forEach(opt => {\n const wrap = document.createElement('label');\n wrap.style.display = 'flex';\n wrap.style.gap = '6px';\n wrap.style.alignItems = 'center';\n \n const rad = document.createElement('input');\n rad.type = 'radio';\n rad.name = field.name;\n rad.value = opt;\n if (field.defaultValue === opt) rad.checked = true;\n \n wrap.appendChild(rad);\n wrap.appendChild(document.createTextNode(opt));\n input.appendChild(wrap);\n });\n }\n } else {\n input = document.createElement('input');\n input.className = 'form-inp';\n (input as HTMLInputElement).type = field.type;\n // (input as HTMLInputElement).required = !!field.required;\n if (field.placeholder) (input as HTMLInputElement).placeholder = field.placeholder;\n if (field.defaultValue) (input as HTMLInputElement).value = field.defaultValue;\n }\n \n inputs[field.name] = input;\n grp.appendChild(input);\n \n const err = document.createElement('div');\n err.className = 'form-err';\n err.style.color = 'var(--vex-error-text, #f87171)';\n err.style.fontSize = '11px';\n err.style.display = 'none';\n err.style.marginTop = '4px';\n grp.appendChild(err);\n \n formContent.appendChild(grp);\n });\n\n this.create({\n ...opts,\n content: formContent,\n confirmLabel: opts.submitLabel || 'Enviar',\n cancelLabel: opts.cancelLabel || 'Cancelar',\n }, () => {\n // Validate\n let isValid = true;\n const data: Record<string, any> = {};\n \n opts.fields.forEach(field => {\n const inputEl = inputs[field.name];\n let val: any;\n \n if (field.type === 'radio') {\n const checked = inputEl.querySelector('input:checked') as HTMLInputElement;\n val = checked ? checked.value : null;\n } else {\n val = (inputEl as HTMLInputElement).value;\n }\n \n data[field.name] = val;\n \n // Reset error\n const errEl = inputEl.parentElement?.querySelector('.form-err') as HTMLElement;\n if (errEl) errEl.style.display = 'none';\n\n let error = null;\n if (field.required && !val) error = 'Campo obrigatório';\n else if (field.validate) error = field.validate(val);\n \n if (error) {\n isValid = false;\n if (errEl) {\n errEl.textContent = error;\n errEl.style.display = 'block';\n }\n }\n });\n\n if (isValid && opts.validate) {\n const errors = opts.validate(data);\n if (errors) {\n isValid = false;\n Object.entries(errors).forEach(([key, msg]) => {\n const inputEl = inputs[key];\n const errEl = inputEl?.parentElement?.querySelector('.form-err') as HTMLElement;\n if (errEl) {\n errEl.textContent = msg;\n errEl.style.display = 'block';\n }\n });\n }\n }\n\n if (isValid) {\n resolve(data);\n return true; // Close\n }\n return false; // Keep open\n }, () => resolve(null));\n });\n }\n\n public async prompt(opts: ModalOptions & { defaultValue?: string, placeholder?: string, validate?: (v: string) => string | null }): Promise<string | null> {\n const { validate, ...restOpts } = opts;\n const data = await this.form({\n ...restOpts,\n fields: [{\n name: 'value',\n label: '',\n type: 'text',\n defaultValue: opts.defaultValue,\n placeholder: opts.placeholder,\n validate: validate,\n required: true\n }],\n submitLabel: opts.confirmLabel || 'OK',\n });\n return data ? data.value : null;\n }\n\n public preview(opts: ModalOptions & { src: string, meta?: string[], gallery?: string[] }) {\n const content = document.createElement('div');\n content.className = 'vx-preview-body';\n content.style.textAlign = 'center';\n \n const img = document.createElement('img');\n img.src = opts.src;\n img.style.maxWidth = '100%';\n img.style.maxHeight = '70vh';\n img.style.borderRadius = '8px';\n img.style.boxShadow = '0 8px 30px rgba(0,0,0,0.5)';\n content.appendChild(img);\n \n if (opts.meta) {\n const meta = document.createElement('div');\n meta.className = 'vx-meta';\n meta.textContent = opts.meta.join(' · ');\n meta.style.marginTop = '16px';\n meta.style.color = 'var(--vex-text-muted, rgba(255,255,255,0.6))';\n meta.style.fontSize = '13px';\n content.appendChild(meta);\n }\n \n // Gallery thumbs?\n if (opts.gallery) {\n const gal = document.createElement('div');\n gal.className = 'vx-gallery';\n gal.style.display = 'flex';\n gal.style.gap = '8px';\n gal.style.justifyContent = 'center';\n gal.style.marginTop = '16px';\n \n opts.gallery.forEach(src => {\n const thumb = document.createElement('img');\n thumb.src = src;\n thumb.style.width = '48px';\n thumb.style.height = '48px';\n thumb.style.objectFit = 'cover';\n thumb.style.borderRadius = '6px';\n thumb.style.cursor = 'pointer';\n thumb.style.opacity = src === opts.src ? '1' : '0.5';\n thumb.style.border = src === opts.src ? '2px solid var(--vex-primary, #6366f1)' : '2px solid transparent';\n thumb.onclick = () => {\n img.src = src;\n // Update active state\n Array.from(gal.children).forEach((c: any) => {\n c.style.opacity = '0.5';\n c.style.border = '2px solid transparent';\n });\n thumb.style.opacity = '1';\n thumb.style.border = '2px solid var(--vex-primary, #6366f1)';\n };\n gal.appendChild(thumb);\n });\n content.appendChild(gal);\n }\n \n this.create({\n ...opts,\n content: content,\n width: opts.width || 800,\n footer: false\n });\n }\n\n public custom(opts: ModalOptions): { close: () => void } {\n return this.create(opts);\n }\n\n // --- Core Implementation ---\n\n private create(opts: ModalOptions, onConfirm?: ConfirmCallback, onCancel?: ConfirmCallback): { close: () => void } {\n if (typeof document === 'undefined') return { close: () => {} };\n\n saveFocus();\n\n const backdrop = document.createElement('div');\n backdrop.className = 'vex-backdrop';\n const titleId = `vex-modal-title-${Math.random().toString(36).slice(2)}`;\n const descId = `vex-modal-desc-${Math.random().toString(36).slice(2)}`;\n setupModalA11y(backdrop, titleId, descId);\n\n const modal = document.createElement('div');\n modal.className = 'vex-modal';\n if (opts.width) modal.style.maxWidth = `${opts.width}px`;\n if (opts.animate) modal.classList.add(`vex-anim-${opts.animate}`);\n \n // Header\n const hdr = document.createElement('div');\n hdr.className = 'modal-hdr';\n hdr.appendChild(document.createElement('div')); // spacer\n \n if (opts.showClose !== false) {\n const closeBtn = document.createElement('button');\n closeBtn.className = 'modal-x';\n closeBtn.ariaLabel = 'Fechar';\n closeBtn.innerHTML = '✕';\n closeBtn.onclick = () => {\n if (onCancel) onCancel();\n this.close(backdrop);\n };\n hdr.appendChild(closeBtn);\n }\n modal.appendChild(hdr);\n\n // Body\n const body = document.createElement('div');\n body.className = 'modal-bdy';\n \n if (opts.type) {\n const icon = document.createElement('div');\n icon.className = `modal-icon ${opts.type}`;\n icon.innerHTML = this.getIcon(opts.type);\n body.appendChild(icon);\n }\n\n if (opts.title) {\n const title = document.createElement('div');\n title.id = titleId;\n title.className = 'modal-title';\n title.textContent = opts.title;\n body.appendChild(title);\n }\n\n if (opts.message) {\n const desc = document.createElement('div');\n desc.id = descId;\n desc.className = 'modal-desc';\n desc.textContent = opts.message;\n body.appendChild(desc);\n }\n \n if (opts.content) {\n const customContent = document.createElement('div');\n customContent.className = 'modal-custom';\n if (typeof opts.content === 'string') customContent.innerHTML = opts.content;\n else customContent.appendChild(opts.content);\n body.appendChild(customContent);\n }\n\n modal.appendChild(body);\n\n // Footer\n if (opts.footer !== false && (opts.confirmLabel || opts.cancelLabel)) {\n const ftr = document.createElement('div');\n ftr.className = 'modal-ftr';\n \n if (opts.cancelLabel) {\n const cancelBtn = document.createElement('button');\n cancelBtn.className = 'modal-btn cancel';\n cancelBtn.textContent = opts.cancelLabel;\n cancelBtn.onclick = () => {\n if (onCancel) onCancel();\n this.close(backdrop);\n };\n ftr.appendChild(cancelBtn);\n }\n \n if (opts.confirmLabel) {\n const confirmBtn = document.createElement('button');\n confirmBtn.className = `modal-btn ${opts.type || 'primary'}`;\n confirmBtn.textContent = opts.confirmLabel;\n \n if (opts.confirmDelay && opts.confirmDelay > 0) {\n confirmBtn.disabled = true;\n let remaining = Math.ceil(opts.confirmDelay / 1000);\n const originalLabel = opts.confirmLabel;\n confirmBtn.textContent = `${originalLabel} (${remaining})`;\n \n const interval = setInterval(() => {\n remaining--;\n if (remaining <= 0) {\n clearInterval(interval);\n confirmBtn.disabled = false;\n confirmBtn.textContent = originalLabel;\n } else {\n confirmBtn.textContent = `${originalLabel} (${remaining})`;\n }\n }, 1000);\n \n // Cleanup interval on close\n (backdrop as any)._interval = interval;\n }\n\n confirmBtn.onclick = async () => {\n if (onConfirm) {\n const shouldClose = await onConfirm();\n if (shouldClose !== false) this.close(backdrop);\n } else {\n this.close(backdrop);\n }\n };\n ftr.appendChild(confirmBtn);\n }\n modal.appendChild(ftr);\n }\n\n backdrop.appendChild(modal);\n document.body.appendChild(backdrop);\n this.activeModals.push(backdrop);\n\n // Events\n if (opts.closeOnBackdrop !== false) {\n backdrop.onclick = (e) => {\n if (e.target === backdrop) {\n if (onCancel) onCancel();\n this.close(backdrop);\n }\n };\n }\n \n const escHandler = (e: KeyboardEvent) => {\n if (e.key === 'Escape' && opts.closeOnEscape !== false) {\n if (this.activeModals[this.activeModals.length - 1] === backdrop) {\n if (onCancel) onCancel();\n this.close(backdrop);\n }\n }\n if (e.key === 'Tab') {\n trapFocus(backdrop, e);\n }\n };\n document.addEventListener('keydown', escHandler);\n \n (backdrop as any)._cleanup = () => {\n document.removeEventListener('keydown', escHandler);\n if ((backdrop as any)._interval) clearInterval((backdrop as any)._interval);\n };\n\n if (opts.onOpen) opts.onOpen();\n\n return {\n close: () => this.close(backdrop, onCancel)\n };\n }\n\n private close(backdrop: HTMLElement, callback?: () => void) {\n if (backdrop.classList.contains('closing')) return; // Already closing\n \n backdrop.classList.add('closing');\n const modal = backdrop.querySelector('.vex-modal');\n if (modal) modal.classList.add('closing');\n \n const onRemove = () => {\n if ((backdrop as any)._cleanup) (backdrop as any)._cleanup();\n if (backdrop.parentNode) backdrop.parentNode.removeChild(backdrop);\n this.activeModals = this.activeModals.filter(m => m !== backdrop);\n restoreFocus();\n // Only call callback if it wasn't called by the trigger action (handled by caller mostly, but for forced close)\n // Actually onCancel/onConfirm are handled before close.\n // options.onClose is what we want here.\n // I didn't pass options.onClose to create.\n // For now, minimal.\n };\n\n backdrop.addEventListener('animationend', onRemove);\n // Fallback\n setTimeout(() => {\n if (document.body.contains(backdrop)) onRemove();\n }, 300);\n }\n\n private getIcon(type: string): string {\n switch (type) {\n case 'danger': return '✕';\n case 'warning': return '!';\n case 'success': return '✓';\n case 'info': return 'i';\n default: return '';\n }\n }\n}\n","import { trapFocus, saveFocus, restoreFocus } from './a11y';\n\nexport interface DrawerAction {\n label: string;\n variant?: 'primary' | 'danger' | 'default';\n onClick?: (close: () => void) => void;\n}\n\nexport interface DrawerOptions {\n title?: string;\n position: 'right' | 'left' | 'top' | 'bottom';\n width?: number; // for right/left\n height?: number; // for top/bottom\n content: string | HTMLElement;\n persistent?: boolean; // false = fecha ao clicar fora\n footer?: DrawerAction[];\n onClose?: () => void;\n // Internal\n className?: string;\n}\n\nexport function drawer(opts: DrawerOptions): { close: () => void } {\n if (typeof document === 'undefined') return { close: () => {} };\n\n saveFocus();\n\n const panel = document.createElement('div');\n panel.className = `vex-drawer vex-drawer-${opts.position}`;\n if (opts.className) panel.classList.add(opts.className);\n \n // Size\n if (opts.width && (opts.position === 'left' || opts.position === 'right')) {\n panel.style.width = `${opts.width}px`;\n }\n if (opts.height && (opts.position === 'top' || opts.position === 'bottom')) {\n panel.style.height = `${opts.height}px`;\n }\n \n // Structure\n const hdr = document.createElement('div');\n hdr.className = 'drawer-hdr';\n if (opts.title) {\n const title = document.createElement('div');\n title.className = 'drawer-title';\n title.textContent = opts.title;\n hdr.appendChild(title);\n }\n \n const closeBtn = document.createElement('button');\n closeBtn.className = 'drawer-close';\n closeBtn.innerHTML = '✕';\n closeBtn.onclick = () => close();\n hdr.appendChild(closeBtn);\n panel.appendChild(hdr);\n \n const body = document.createElement('div');\n body.className = 'drawer-body';\n \n let originalParent: ParentNode | null = null;\n let nextSibling: Node | null = null;\n let contentEl: HTMLElement | null = null;\n\n if (typeof opts.content === 'string') {\n // Check if it's a selector\n if (opts.content.startsWith('#') || opts.content.startsWith('.')) {\n const el = document.querySelector(opts.content) as HTMLElement;\n if (el) {\n contentEl = el;\n originalParent = el.parentNode;\n nextSibling = el.nextSibling;\n body.appendChild(el); \n // Ensure it's visible if it was hidden\n el.style.display = 'block';\n } else {\n body.innerHTML = opts.content;\n }\n } else {\n body.innerHTML = opts.content;\n }\n } else {\n contentEl = opts.content;\n originalParent = opts.content.parentNode;\n nextSibling = opts.content.nextSibling;\n body.appendChild(opts.content);\n opts.content.style.display = 'block';\n }\n panel.appendChild(body);\n \n if (opts.footer && opts.footer.length > 0) {\n const ftr = document.createElement('div');\n ftr.className = 'drawer-ftr';\n opts.footer.forEach(action => {\n const btn = document.createElement('button');\n btn.className = `drawer-btn ${action.variant || 'default'}`;\n btn.textContent = action.label;\n btn.onclick = () => {\n if (action.onClick) action.onClick(() => close());\n else close();\n };\n ftr.appendChild(btn);\n });\n panel.appendChild(ftr);\n }\n \n document.body.appendChild(panel);\n \n // Animate in\n requestAnimationFrame(() => {\n panel.classList.add('open');\n });\n \n const close = () => {\n panel.classList.remove('open');\n panel.addEventListener('transitionend', () => {\n if (contentEl && originalParent) {\n // Restore content to original place\n contentEl.style.display = ''; // Reset display\n originalParent.insertBefore(contentEl, nextSibling);\n }\n \n if (panel.parentNode) panel.parentNode.removeChild(panel);\n restoreFocus();\n if (opts.onClose) opts.onClose();\n }, { once: true });\n \n document.removeEventListener('click', outsideClickHandler);\n };\n \n const outsideClickHandler = (e: MouseEvent) => {\n if (opts.persistent) return;\n // If click is not inside panel and panel is open\n if (panel.classList.contains('open') && !panel.contains(e.target as Node)) {\n close();\n }\n };\n \n setTimeout(() => {\n document.addEventListener('click', outsideClickHandler);\n }, 100);\n \n return { close };\n}\n","import { ModalEngine, FormField } from './modal';\n\nexport interface FlowStep {\n title: string;\n type?: 'info' | 'success' | 'warning' | 'danger';\n description?: string;\n fields?: FormField[];\n condition?: (accumulatedData: Record<string, any>) => boolean;\n beforeNext?: (stepData: Record<string, any>) => Promise<Record<string, string> | null>;\n}\n\nexport async function flow(steps: FlowStep[]): Promise<Record<string, any> | null> {\n const modalEngine = new ModalEngine();\n \n return new Promise((resolve) => {\n let currentStepIndex = 0;\n const data: Record<string, any> = {};\n let modalInstance: { close: () => void } | null = null;\n let modalEl: HTMLElement | null = null;\n\n // Find first valid step\n const findNextValidStep = (start: number): number => {\n let idx = start;\n while (idx < steps.length) {\n const step = steps[idx];\n if (!step.condition || step.condition!(data)) {\n return idx;\n }\n idx++;\n }\n return -1; // End\n };\n \n currentStepIndex = findNextValidStep(0);\n if (currentStepIndex === -1) {\n resolve(data);\n return;\n }\n\n const container = document.createElement('div');\n container.className = 'vex-flow-container';\n \n const renderStep = () => {\n container.innerHTML = '';\n const step = steps[currentStepIndex];\n \n // Update Modal Title if possible\n if (modalEl) {\n const titleEl = modalEl.querySelector('.modal-title');\n if (titleEl) titleEl.textContent = step.title;\n \n // Update Icon if type changes\n const iconEl = modalEl.querySelector('.modal-icon');\n if (iconEl && step.type) {\n iconEl.className = `modal-icon ${step.type}`;\n // We need to update icon content too. \n // This implies we need getIcon logic here or duplication.\n // For simplicity, let's just update class and assume icon content is generic enough or update it manually.\n const icons: Record<string, string> = {\n 'danger': '✕', 'warning': '!', 'success': '✓', 'info': 'i'\n };\n iconEl.innerHTML = icons[step.type] || 'i';\n }\n }\n\n // 1. Steps Bar\n const bar = document.createElement('div');\n bar.className = 'modal-steps';\n \n steps.forEach((s, i) => {\n // Only show if condition matches or if it's past/current?\n // Usually wizards show all steps or at least known ones.\n // If condition depends on future data, we might not know.\n // Let's just show all steps, maybe dim conditional ones?\n // Or just show 1, 2, 3...\n \n const dot = document.createElement('div');\n dot.className = 'step-dot';\n if (i < currentStepIndex) dot.classList.add('done');\n if (i === currentStepIndex) dot.classList.add('active');\n \n const circle = document.createElement('div');\n circle.className = 'step-circle';\n circle.textContent = (i + 1).toString();\n if (i < currentStepIndex) circle.textContent = '✓';\n \n const name = document.createElement('div');\n name.className = 'step-name';\n name.textContent = s.title; // Short title?\n \n dot.appendChild(circle);\n dot.appendChild(name);\n bar.appendChild(dot);\n });\n container.appendChild(bar);\n \n // 2. Content\n const content = document.createElement('div');\n content.className = 'flow-content';\n \n if (step.description) {\n const desc = document.createElement('div');\n desc.className = 'modal-desc';\n desc.textContent = step.description;\n desc.style.marginBottom = '16px';\n content.appendChild(desc);\n }\n \n const inputs: Record<string, HTMLElement> = {};\n \n if (step.fields) {\n step.fields.forEach(field => {\n const grp = document.createElement('div');\n grp.className = 'form-grp';\n \n const lbl = document.createElement('label');\n lbl.className = 'form-lbl';\n lbl.textContent = field.label;\n grp.appendChild(lbl);\n \n let input: HTMLElement;\n // Simplified field creation (duplicated from modal.ts, ideally shared)\n if (field.type === 'select') {\n input = document.createElement('select');\n input.className = 'form-sel';\n if (field.options) {\n field.options.forEach(opt => {\n const op = document.createElement('option');\n op.value = opt;\n op.textContent = opt;\n (input as HTMLSelectElement).appendChild(op);\n });\n }\n if (data[field.name]) (input as HTMLSelectElement).value = data[field.name];\n } else {\n input = document.createElement('input');\n input.className = 'form-inp';\n (input as HTMLInputElement).type = field.type;\n if (data[field.name]) (input as HTMLInputElement).value = data[field.name];\n }\n \n inputs[field.name] = input;\n grp.appendChild(input);\n \n const err = document.createElement('div');\n err.className = 'form-err';\n err.style.color = 'var(--vex-error-text, #f87171)';\n err.style.fontSize = '11px';\n err.style.display = 'none';\n grp.appendChild(err);\n \n content.appendChild(grp);\n });\n }\n container.appendChild(content);\n \n // 3. Footer (Custom)\n const ftr = document.createElement('div');\n ftr.className = 'flow-btns';\n ftr.style.marginTop = '24px';\n ftr.style.display = 'flex';\n ftr.style.justifyContent = 'flex-end';\n ftr.style.gap = '10px';\n \n if (currentStepIndex > 0) {\n const backBtn = document.createElement('button');\n backBtn.className = 'modal-btn cancel';\n backBtn.textContent = '← Voltar';\n backBtn.onclick = () => {\n // Find prev valid step\n let prev = currentStepIndex - 1;\n while (prev >= 0) {\n const prevStep = steps[prev];\n if (!prevStep.condition || prevStep.condition!(data)) break;\n prev--;\n }\n if (prev >= 0) {\n currentStepIndex = prev;\n renderStep();\n }\n };\n ftr.appendChild(backBtn);\n }\n \n const nextBtn = document.createElement('button');\n nextBtn.className = 'modal-btn primary';\n const isLast = findNextValidStep(currentStepIndex + 1) === -1;\n nextBtn.textContent = isLast ? 'Concluir' : 'Próximo →';\n \n nextBtn.onclick = async () => {\n // Collect data\n const stepData: Record<string, any> = {};\n let isValid = true;\n \n if (step.fields) {\n step.fields.forEach(field => {\n const val = (inputs[field.name] as HTMLInputElement).value;\n stepData[field.name] = val;\n data[field.name] = val; // Update global data\n \n if (field.required && !val) {\n isValid = false;\n // Show error...\n }\n });\n }\n \n if (!isValid) return; // Show errors\n \n if (step.beforeNext) {\n nextBtn.disabled = true;\n nextBtn.textContent = 'Aguarde...';\n const errors = await step.beforeNext!(stepData);\n nextBtn.disabled = false;\n nextBtn.textContent = isLast ? 'Concluir' : 'Próximo →';\n \n if (errors) {\n Object.keys(errors).forEach(key => {\n const input = inputs[key];\n if (input && input.nextElementSibling) {\n const err = input.nextElementSibling as HTMLElement;\n err.textContent = errors[key];\n err.style.display = 'block';\n }\n });\n return;\n }\n }\n \n const next = findNextValidStep(currentStepIndex + 1);\n if (next !== -1) {\n currentStepIndex = next;\n renderStep();\n } else {\n // Finish\n if (modalInstance) modalInstance.close();\n resolve(data);\n }\n };\n \n ftr.appendChild(nextBtn);\n container.appendChild(ftr);\n };\n\n // Initialize modal\n const step = steps[currentStepIndex];\n modalInstance = modalEngine.custom({\n title: step.title,\n type: step.type || 'info',\n content: container,\n footer: false,\n width: 600,\n onClose: () => {\n // If closed by user (X or backdrop), resolve null\n // But if closed by code (finish), we already resolved.\n // We can check if resolved? No easy way.\n // We can assume if we didn't resolve data, it's a cancel.\n // For now, simple resolve null.\n // (If logic finished, resolve was called, this secondary resolve(null) is ignored by Promise)\n resolve(null);\n }\n });\n \n // Get element\n setTimeout(() => {\n modalEl = document.querySelector('.vex-modal:last-child') as HTMLElement;\n renderStep();\n }, 0);\n });\n}\n","/**\n * VexUI Theme Manager\n *\n * Handles CSS variables, theme switching (dark/light/auto), and reduced motion.\n */\n\nexport type ThemeMode = 'dark' | 'light' | 'auto';\n\nexport interface ThemeTokens {\n [key: string]: string;\n}\n\nexport class ThemeManager {\n private currentTheme: ThemeMode = 'auto';\n private mediaQuery: MediaQueryList | null = null;\n\n constructor() {\n if (typeof window !== 'undefined') {\n this.mediaQuery = window.matchMedia('(prefers-color-scheme: dark)');\n this.init();\n }\n }\n\n private init() {\n this.mediaQuery?.addEventListener('change', () => {\n if (this.currentTheme === 'auto') {\n this.applyTheme();\n }\n });\n }\n\n public setTheme(theme: ThemeMode) {\n this.currentTheme = theme;\n this.applyTheme();\n }\n\n public getTheme(): ThemeMode {\n return this.currentTheme;\n }\n\n private applyTheme() {\n if (typeof document === 'undefined') return;\n\n const root = document.documentElement;\n const isDark = this.currentTheme === 'dark' || (this.currentTheme === 'auto' && this.mediaQuery?.matches);\n\n // We toggle a class on html element to allow CSS overrides\n if (isDark) {\n root.classList.add('vex-dark');\n root.classList.remove('vex-light');\n } else {\n root.classList.add('vex-light');\n root.classList.remove('vex-dark');\n }\n \n // Also set data-theme attribute for easier styling\n root.setAttribute('data-vex-theme', isDark ? 'dark' : 'light');\n }\n\n public setTokens(tokens: ThemeTokens) {\n if (typeof document === 'undefined') return;\n const root = document.documentElement;\n Object.entries(tokens).forEach(([key, value]) => {\n root.style.setProperty(key, value);\n });\n }\n \n public isReducedMotion(): boolean {\n if (typeof window === 'undefined') return false;\n return window.matchMedia('(prefers-reduced-motion: reduce)').matches;\n }\n}\n\nexport const themeManager = new ThemeManager();\n","import { AlertEngine, AlertOptions } from './core/alert';\r\nimport { ModalEngine, ModalOptions, FormOptions } from './core/modal';\r\nimport { drawer, DrawerOptions } from './core/drawer';\r\nimport { flow, FlowStep } from './core/flow';\r\nimport { historyManager } from './core/history';\r\nimport { themeManager } from './core/theme';\r\n\r\n// Instantiate singletons\r\nexport const alert = new AlertEngine();\r\nexport const modal = new ModalEngine();\r\nexport const history = historyManager;\r\n\r\n// Export types\r\nexport type { AlertOptions, ModalOptions, FormOptions, DrawerOptions, FlowStep };\r\n\r\n// Export standalone functions\r\nexport { drawer, flow };\r\n\r\nexport interface VexConfig {\r\n duration?: number;\r\n position?: 'top' | 'bottom';\r\n maxStack?: number;\r\n theme?: 'dark' | 'light' | 'auto';\r\n // ...\r\n}\r\n\r\n// Global configuration\r\nexport function configure(opts: VexConfig) {\r\n if (opts.theme) themeManager.setTheme(opts.theme);\r\n // Pass config to alert engine if needed\r\n // alert.configure(opts);\r\n}\r\n\r\nexport function setTheme(theme: 'dark' | 'light' | 'auto') {\r\n themeManager.setTheme(theme);\r\n}\r\n\r\nexport function dismiss(id: string) {\r\n alert.dismiss(id);\r\n}\r\n\r\nexport function dismissAll(filter?: { type?: string, position?: string }) {\r\n alert.dismissAll(filter);\r\n}\r\n\r\nexport function update(id: string, opts: Partial<AlertOptions>) {\r\n alert.update(id, opts);\r\n}\r\n\r\nexport function progress(id: string, value: number | { loaded: number, total: number }) {\r\n alert.progress(id, value);\r\n}\r\n\r\n// Default export object\r\nconst vex = {\r\n alert,\r\n modal,\r\n drawer,\r\n flow,\r\n history,\r\n configure,\r\n setTheme,\r\n dismiss,\r\n dismissAll,\r\n update,\r\n progress,\r\n // Helper for inline prompts\r\n prompt: {\r\n inline: async (selector: string | HTMLElement, opts: any) => {\r\n // Implementation of inline prompt\r\n // \"Substitui um elemento de texto por um input diretamente no DOM\"\r\n // This is a \"power feature\".\r\n // I'll implement a basic version here or in a separate file if needed.\r\n // Given \"Phase 2\" includes \"index.ts\", I can add it here.\r\n \r\n const el = typeof selector === 'string' ? document.querySelector(selector) : selector;\r\n if (!el) return null;\r\n \r\n const originalText = el.textContent;\r\n const originalDisplay = (el as HTMLElement).style.display;\r\n \r\n const input = document.createElement('input');\r\n input.type = 'text';\r\n input.value = originalText || '';\r\n input.placeholder = opts.placeholder || '';\r\n input.className = 'vex-inline-prompt';\r\n // Style to match element?\r\n input.style.fontSize = getComputedStyle(el as Element).fontSize;\r\n input.style.fontFamily = getComputedStyle(el as Element).fontFamily;\r\n input.style.border = '1px solid var(--vex-primary, #6366f1)';\r\n input.style.borderRadius = '4px';\r\n input.style.padding = '2px 4px';\r\n input.style.background = 'var(--vex-bg, #000)';\r\n input.style.color = 'var(--vex-text, #fff)';\r\n \r\n (el as HTMLElement).style.display = 'none';\r\n el.parentNode?.insertBefore(input, el);\r\n input.focus();\r\n \r\n return new Promise((resolve) => {\r\n const finish = (val: string | null) => {\r\n if (val !== null && opts.validate) {\r\n const err = opts.validate(val);\r\n if (err) {\r\n // Show error tooltip?\r\n input.style.borderColor = 'red';\r\n return; \r\n }\r\n }\r\n \r\n input.remove();\r\n (el as HTMLElement).style.display = originalDisplay;\r\n if (val !== null) (el as HTMLElement).textContent = val;\r\n resolve(val);\r\n };\r\n \r\n input.onblur = () => finish(input.value); // Confirm on blur? Or cancel? Usually confirm.\r\n input.onkeydown = (e) => {\r\n if (e.key === 'Enter') finish(input.value);\r\n if (e.key === 'Escape') finish(null);\r\n };\r\n });\r\n }\r\n }\r\n};\r\n\r\nexport default vex;\r\n"],"mappings":"yaAAA,IAAAA,GAAA,GAAAC,EAAAD,GAAA,iBAAAE,GAAA,WAAAC,KAAA,eAAAC,EAAAJ,IAAA,IAAAK,EAAkC,iBCS3B,IAAMC,EAAN,KAAiB,CAAjB,cACL,KAAQ,OAAsB,CAAC,EAC/B,KAAQ,QAAuB,CAAC,EAChC,KAAQ,SAAmB,EAEpB,YAAYC,EAAa,CAC9B,KAAK,SAAWA,CAClB,CAEO,IAAIC,EAAiB,CAE1B,GAAI,KAAK,OAAO,OAAS,KAAK,SAAU,CACtC,KAAK,OAAO,KAAKA,CAAI,EACrBA,EAAK,KAAK,EACV,MACF,CAGA,GAAIA,EAAK,WAAa,WAAY,CAGhC,IAAMC,EAAc,KAAK,OAAO,UAAU,GAAK,KAAK,iBAAiB,EAAE,QAAQ,EAAI,KAAK,iBAAiB,UAAU,CAAC,EAEhHA,IAAgB,IACH,KAAK,OAAOA,CAAW,EAC/B,MAAM,EAGb,KAAK,OAAO,OAAOA,EAAa,CAAC,EAEjC,KAAK,QAAQ,QAAQD,CAAI,GAEzB,KAAK,QA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AAKC,CAAI,EAAG,OAAAJ,EAAI,QAAQ,KAAKK,CAAE,EAAUA,CAAI,EAClI,OAAQ,CAACC,EAAgCF,IAAuB,CAAE,IAAMC,EAAKH,EAAI,MAAM,OAAOI,EAAUF,CAAI,EAAG,OAAAJ,EAAI,QAAQ,KAAKK,CAAE,EAAUA,CAAI,EAChJ,MAAQD,GAAuB,CAAE,IAAMC,EAAKH,EAAI,MAAM,MAAME,CAAI,EAAG,OAAAJ,EAAI,QAAQ,KAAKK,CAAE,EAAUA,CAAI,EACpG,OAAQ,CAACC,EAAgCF,IAAuB,CAAE,IAAMC,EAAKH,EAAI,MAAM,OAAOI,EAAUF,CAAI,EAAG,OAAAJ,EAAI,QAAQ,KAAKK,CAAE,EAAUA,CAAI,EAChJ,KAAOD,GAAuB,CAAE,IAAMC,EAAKH,EAAI,MAAM,KAAKE,CAAI,EAAG,OAAAJ,EAAI,QAAQ,KAAKK,CAAE,EAAUA,CAAI,CACpG,EAEA,sBAAU,IACD,IAAM,CACXL,EAAI,QAAQ,QAAQK,GAAMH,EAAI,QAAQG,CAAE,CAAC,CAC3C,EACC,CAAC,CAAC,EAEE,CACL,GAAGH,EACH,MAAOD,CACT,CACF,CAEO,IAAMM,GAAc,CAAC,CAAE,SAAAC,EAAU,OAAAC,CAAO,QAC7C,aAAU,IAAM,CACVA,GAAQP,EAAI,UAAUO,CAAM,CAClC,EAAG,CAACA,CAAM,CAAC,EACJD","names":["react_exports","__export","VexProvider","useVex","__toCommonJS","import_react","AlertQueue","max","item","victimIndex","id","index","next","a","b","p","HistoryManager","entry","fullEntry","id","e","anchorSelector","anchor","existing","dropdown","rect","list","closeHandler","stored","key","value","historyManager","getFocusableElements","container","el","trapFocus","event","focusable","first","last","previousFocus","saveFocus","restoreFocus","setupAlertA11y","element","priority","liveMode","setupModalA11y","titleId","descId","AlertEngine","AlertQueue","message","opts","selector","id","fullOpts","historyManager","el","setupAlertA11y","iconEl","body","title","msg","actionsEl","action","btn","e","closeBtn","prog","upProg","k","v","container","existing","target","pos","placement","rect","elRect","scrollX","scrollY","top","left","alert","element","options","onRemove","filter","idsToRemove","val","newOpts","msgEl","titleEl","value","percent","wrapper","type","custom","ModalEngine","opts","resolve","inputs","formContent","field","grp","lbl","input","opt","op","wrap","rad","err","isValid","data","inputEl","val","checked","errEl","error","errors","key","msg","validate","restOpts","content","img","meta","gal","src","thumb","c","onConfirm","onCancel","saveFocus","backdrop","titleId","descId","setupModalA11y","modal","hdr","closeBtn","body","icon","title","desc","customContent","ftr","cancelBtn","confirmBtn","remaining","originalLabel","interval","e","escHandler","trapFocus","callback","onRemove","m","restoreFocus","type","drawer","opts","saveFocus","panel","hdr","title","closeBtn","close","body","originalParent","nextSibling","contentEl","el","ftr","action","btn","restoreFocus","outsideClickHandler","e","flow","steps","modalEngine","ModalEngine","resolve","currentStepIndex","data","modalInstance","modalEl","findNextValidStep","start","idx","step","container","renderStep","titleEl","iconEl","icons","bar","s","i","dot","circle","name","content","desc","inputs","field","grp","lbl","input","opt","op","err","ftr","backBtn","prev","prevStep","nextBtn","isLast","stepData","isValid","val","errors","key","next","ThemeManager","theme","root","isDark","tokens","key","value","themeManager","alert","AlertEngine","modal","ModalEngine","history","historyManager","configure","opts","themeManager","setTheme","theme","dismiss","id","alert","dismissAll","filter","update","progress","value","vex","modal","drawer","flow","history","selector","el","originalText","originalDisplay","input","resolve","finish","val","e","src_default","useVex","ids","wrappedAlert","src_default","msg","opts","id","selector","VexProvider","children","config"]}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { A as AlertOptions, M as ModalEngine, d as drawer, f as flow, H as HistoryManager, c as configure, s as setTheme, a as dismiss, b as dismissAll, u as update, p as progress } from '../index-CpFq7Lxe.mjs';
|
|
3
|
+
|
|
4
|
+
declare function useVex(): {
|
|
5
|
+
alert: {
|
|
6
|
+
success: (msg: string, opts?: Partial<AlertOptions>) => string;
|
|
7
|
+
error: (msg: string, opts?: Partial<AlertOptions>) => string;
|
|
8
|
+
warning: (msg: string, opts?: Partial<AlertOptions>) => string;
|
|
9
|
+
info: (msg: string, opts?: Partial<AlertOptions>) => string;
|
|
10
|
+
neutral: (msg: string, opts?: Partial<AlertOptions>) => string;
|
|
11
|
+
loading: (msg: string, opts?: Partial<AlertOptions>) => string;
|
|
12
|
+
upload: (msg: string, opts?: Partial<AlertOptions>) => string;
|
|
13
|
+
inline: (selector: string | HTMLElement, opts: AlertOptions) => string;
|
|
14
|
+
fixed: (opts: AlertOptions) => string;
|
|
15
|
+
attach: (selector: string | HTMLElement, opts: AlertOptions) => string;
|
|
16
|
+
show: (opts: AlertOptions) => string;
|
|
17
|
+
};
|
|
18
|
+
modal: ModalEngine;
|
|
19
|
+
drawer: typeof drawer;
|
|
20
|
+
flow: typeof flow;
|
|
21
|
+
history: HistoryManager;
|
|
22
|
+
configure: typeof configure;
|
|
23
|
+
setTheme: typeof setTheme;
|
|
24
|
+
dismiss: typeof dismiss;
|
|
25
|
+
dismissAll: typeof dismissAll;
|
|
26
|
+
update: typeof update;
|
|
27
|
+
progress: typeof progress;
|
|
28
|
+
prompt: {
|
|
29
|
+
inline: (selector: string | HTMLElement, opts: any) => Promise<unknown>;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
declare const VexProvider: ({ children, config }: {
|
|
33
|
+
children: React.ReactNode;
|
|
34
|
+
config?: any;
|
|
35
|
+
}) => react.ReactNode;
|
|
36
|
+
|
|
37
|
+
export { VexProvider, useVex };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { A as AlertOptions, M as ModalEngine, d as drawer, f as flow, H as HistoryManager, c as configure, s as setTheme, a as dismiss, b as dismissAll, u as update, p as progress } from '../index-CpFq7Lxe.js';
|
|
3
|
+
|
|
4
|
+
declare function useVex(): {
|
|
5
|
+
alert: {
|
|
6
|
+
success: (msg: string, opts?: Partial<AlertOptions>) => string;
|
|
7
|
+
error: (msg: string, opts?: Partial<AlertOptions>) => string;
|
|
8
|
+
warning: (msg: string, opts?: Partial<AlertOptions>) => string;
|
|
9
|
+
info: (msg: string, opts?: Partial<AlertOptions>) => string;
|
|
10
|
+
neutral: (msg: string, opts?: Partial<AlertOptions>) => string;
|
|
11
|
+
loading: (msg: string, opts?: Partial<AlertOptions>) => string;
|
|
12
|
+
upload: (msg: string, opts?: Partial<AlertOptions>) => string;
|
|
13
|
+
inline: (selector: string | HTMLElement, opts: AlertOptions) => string;
|
|
14
|
+
fixed: (opts: AlertOptions) => string;
|
|
15
|
+
attach: (selector: string | HTMLElement, opts: AlertOptions) => string;
|
|
16
|
+
show: (opts: AlertOptions) => string;
|
|
17
|
+
};
|
|
18
|
+
modal: ModalEngine;
|
|
19
|
+
drawer: typeof drawer;
|
|
20
|
+
flow: typeof flow;
|
|
21
|
+
history: HistoryManager;
|
|
22
|
+
configure: typeof configure;
|
|
23
|
+
setTheme: typeof setTheme;
|
|
24
|
+
dismiss: typeof dismiss;
|
|
25
|
+
dismissAll: typeof dismissAll;
|
|
26
|
+
update: typeof update;
|
|
27
|
+
progress: typeof progress;
|
|
28
|
+
prompt: {
|
|
29
|
+
inline: (selector: string | HTMLElement, opts: any) => Promise<unknown>;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
declare const VexProvider: ({ children, config }: {
|
|
33
|
+
children: React.ReactNode;
|
|
34
|
+
config?: any;
|
|
35
|
+
}) => react.ReactNode;
|
|
36
|
+
|
|
37
|
+
export { VexProvider, useVex };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import{useEffect as Q,useRef as Z}from"react";var A=class{constructor(){this.active=[];this.pending=[];this.maxStack=5}setMaxStack(e){this.maxStack=e}add(e){if(this.active.length<this.maxStack){this.active.push(e),e.show();return}if(e.priority==="critical"){let t=this.active.findIndex(i=>this.getPriorityValue(i.priority)<this.getPriorityValue("critical"));t!==-1?(this.active[t].close(),this.active.splice(t,1),this.pending.unshift(e)):this.pending.unshift(e)}else e.priority==="high"?this.pending.unshift(e):this.pending.push(e);this.sortPending(),this.process()}remove(e){let t=this.active.findIndex(i=>i.id===e);t!==-1&&(this.active.splice(t,1),this.process())}process(){if(this.active.length<this.maxStack&&this.pending.length>0){let e=this.pending.shift();e&&(this.active.push(e),e.show())}}sortPending(){this.pending.sort((e,t)=>this.getPriorityValue(t.priority)-this.getPriorityValue(e.priority))}getPriorityValue(e){switch(e){case"critical":return 4;case"high":return 3;case"normal":return 2;case"low":return 1;default:return 2}}};var P=class{constructor(){this.entries=[];this.limit=100;this.storageKey="vex_history";this.load()}add(e){let t={...e,timestamp:new Date,read:!1};this.entries.unshift(t),this.entries.length>this.limit&&(this.entries=this.entries.slice(0,this.limit)),this.save()}get(){return this.entries}clear(){this.entries=[],this.save()}markAllRead(){this.entries.forEach(e=>e.read=!0),this.save()}markRead(e){let t=this.entries.find(i=>i.id===e);t&&(t.read=!0,this.save())}open(e){if(typeof document>"u")return;let t=document.querySelector(e);if(!t){console.warn(`VexUI: History anchor ${e} not found`);return}let i=document.getElementById("vex-history-dropdown");i&&i.remove();let n=document.createElement("div");n.id="vex-history-dropdown",n.className="vex-history-dropdown";let r=t.getBoundingClientRect();n.style.position="absolute",n.style.top=`${r.bottom+8+window.scrollY}px`,n.style.left=`${r.left+window.scrollX}px`,n.style.zIndex="9999";let c=this.entries.map(s=>`
|
|
2
|
+
<div class="vex-hist-item ${s.read?"read":"unread"}" data-id="${s.id}">
|
|
3
|
+
<div class="vex-hist-icon ${s.type}"></div>
|
|
4
|
+
<div class="vex-hist-content">
|
|
5
|
+
<div class="vex-hist-title">${s.title||s.type}</div>
|
|
6
|
+
<div class="vex-hist-msg">${s.message}</div>
|
|
7
|
+
<div class="vex-hist-time">${s.timestamp.toLocaleTimeString()}</div>
|
|
8
|
+
</div>
|
|
9
|
+
</div>
|
|
10
|
+
`).join("")||'<div class="vex-hist-empty">No notifications</div>';n.innerHTML=`
|
|
11
|
+
<div class="vex-hist-header">
|
|
12
|
+
<span>Notifications</span>
|
|
13
|
+
<button id="vex-hist-clear">Clear</button>
|
|
14
|
+
</div>
|
|
15
|
+
<div class="vex-hist-list">${c}</div>
|
|
16
|
+
`,document.body.appendChild(n);let o=s=>{!n.contains(s.target)&&s.target!==t&&(n.remove(),document.removeEventListener("click",o))};setTimeout(()=>document.addEventListener("click",o),0),n.querySelector("#vex-hist-clear")?.addEventListener("click",()=>{this.clear(),n.remove()})}save(){if(typeof localStorage<"u")try{localStorage.setItem(this.storageKey,JSON.stringify(this.entries))}catch{}}load(){if(typeof localStorage<"u"){let e=localStorage.getItem(this.storageKey);if(e)try{this.entries=JSON.parse(e,(t,i)=>t==="timestamp"?new Date(i):i)}catch(t){console.error("Failed to load VexUI history",t)}}}},H=new P;function j(a){return Array.from(a.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])')).filter(t=>!t.hasAttribute("disabled")&&!t.getAttribute("aria-hidden"))}function R(a,e){let t=j(a);if(t.length===0)return;let i=t[0],n=t[t.length-1];e.shiftKey?document.activeElement===i&&(n.focus(),e.preventDefault()):document.activeElement===n&&(i.focus(),e.preventDefault())}var M=null;function O(){typeof document<"u"&&document.activeElement&&(M=document.activeElement)}function k(){M&&typeof document<"u"&&document.body.contains(M)&&(M.focus(),M=null)}function q(a,e){a.setAttribute("role","alert");let t=e==="critical"||e==="high"?"assertive":"polite";a.setAttribute("aria-live",t),a.setAttribute("aria-atomic","true")}function V(a,e,t){a.setAttribute("role","dialog"),a.setAttribute("aria-modal","true"),a.setAttribute("aria-labelledby",e),t&&a.setAttribute("aria-describedby",t)}var S=class{constructor(){this.queue=new A;this.activeAlerts=new Map}success(e,t){return this.create({...t,type:"success",message:e})}error(e,t){return this.create({...t,type:"error",message:e})}warning(e,t){return this.create({...t,type:"warning",message:e})}info(e,t){return this.create({...t,type:"info",message:e})}neutral(e,t){return this.create({...t,type:"neutral",message:e})}loading(e,t){return this.create({...t,type:"loading",message:e,duration:0})}upload(e,t){return this.create({...t,type:"loading",message:e,duration:0,icon:"upload"})}inline(e,t){return this.create({...t,renderer:"inline",selector:e})}fixed(e){return this.create({...e,renderer:"fixed"})}attach(e,t){return this.create({...t,renderer:"attach",selector:e})}show(e){return this.create(e)}create(e){let t=this.generateId(),i=this.processOptions(e);return this.queue.add({id:t,priority:i.priority||"normal",show:()=>this.render(t,i),close:()=>this.dismiss(t)}),H.add({id:t,type:i.type||"info",title:i.title,message:i.message}),t}processOptions(e){return{type:"info",duration:6e3,dismissible:!0,position:"top",align:"center",animate:"slide",priority:"normal",maxStack:5,progress:!0,...e}}render(e,t){if(typeof document>"u")return;let i=document.createElement("div");i.setAttribute("data-id",e),i.className=`vex-alert vex-${t.type}`,q(i,t.priority||"normal");let n=document.createElement("div");n.className="vx-icon",t.type==="loading"?n.innerHTML='<div class="vx-spinner"></div>':n.innerHTML=this.getIcon(t.type||"info",t.icon),i.appendChild(n);let r=document.createElement("div");if(r.className="vx-body",t.title){let o=document.createElement("div");o.className="vx-title",o.textContent=t.title,r.appendChild(o)}let c=document.createElement("div");if(c.className="vx-msg",c.textContent=t.message,r.appendChild(c),t.actions&&t.actions.length>0){let o=document.createElement("div");o.className="vx-actions",t.actions.forEach(s=>{let d=document.createElement("button");d.className=`vx-act-btn vx-${s.variant||"default"}`,d.textContent=s.label,d.onclick=m=>{m.stopPropagation(),s.onClick?s.onClick(()=>this.dismiss(e)):this.dismiss(e)},o.appendChild(d)}),r.appendChild(o)}if(i.appendChild(r),t.dismissible){let o=document.createElement("button");o.className="vx-close",o.ariaLabel="Fechar",o.innerHTML="\u2715",o.onclick=s=>{s.stopPropagation(),this.dismiss(e)},i.appendChild(o)}if(t.progress&&t.duration&&t.duration>0){let o=document.createElement("div");o.className="vx-progress",o.style.animationDuration=`${t.duration}ms`,i.appendChild(o)}if(t.type==="loading"&&t.icon==="upload"){let o=document.createElement("div");o.className="vx-upload-bar",i.appendChild(o)}t.theme&&Object.entries(t.theme).forEach(([o,s])=>{s&&i.style.setProperty(o,s)}),this.mount(i,t),this.activeAlerts.set(e,{element:i,options:t}),t.duration&&t.duration>0&&setTimeout(()=>this.dismiss(e),t.duration)}mount(e,t){if(t.renderer==="inline"&&t.selector){let i=typeof t.selector=="string"?document.querySelector(t.selector):t.selector;if(i instanceof HTMLElement){let n=i.querySelector(".vex-alert");n&&n.remove(),i.appendChild(e)}}else if(t.renderer==="attach"&&t.selector){let i=typeof t.selector=="string"?document.querySelector(t.selector):t.selector;i instanceof HTMLElement&&(document.body.appendChild(e),this.positionAttached(e,i,t.placement||"top"))}else{let i=t.position||"top",n=document.getElementById(`vex-fixed-${i}`);n||(n=document.createElement("div"),n.id=`vex-fixed-${i}`,n.className="vex-fixed-container",n.style.position="fixed",n.style.zIndex="9000",n.style.display="flex",n.style.flexDirection="column",n.style.gap="10px",n.style.pointerEvents="none",n.style.width="100%",n.style.maxWidth="420px",n.style.left="50%",n.style.transform="translateX(-50%)",i==="top"?n.style.top="20px":n.style.bottom="20px",document.body.appendChild(n)),e.style.pointerEvents="all",n.appendChild(e)}}positionAttached(e,t,i){let n=t.getBoundingClientRect(),r=e.getBoundingClientRect();e.style.position="absolute",e.style.zIndex="9000",e.style.width="max-content",e.style.maxWidth="300px";let c=window.scrollX,o=window.scrollY,s=0,d=0;switch(i){case"top":s=n.top+o-e.offsetHeight-8,d=n.left+c+(n.width-e.offsetWidth)/2;break;case"bottom":s=n.bottom+o+8,d=n.left+c+(n.width-e.offsetWidth)/2;break;default:s=n.top+o-50,d=n.left+c}e.style.top=`${s}px`,e.style.left=`${d}px`}dismiss(e){let t=this.activeAlerts.get(e);if(t){let{element:i,options:n}=t;i.classList.add("removing");let r=()=>{i.parentNode&&i.parentNode.removeChild(i),this.activeAlerts.delete(e),this.queue.remove(e),n.onClose&&n.onClose()};i.addEventListener("animationend",r),setTimeout(()=>{this.activeAlerts.has(e)&&r()},400)}}dismissAll(e){let t=[];this.activeAlerts.forEach((i,n)=>{e&&(e.type&&i.options.type!==e.type||e.position&&i.options.position!==e.position)||t.push(n)}),t.forEach(i=>this.dismiss(i))}update(e,t){let i=this.activeAlerts.get(e);if(!i)return;let{element:n,options:r}=i,c={...r,...t};if(t.type&&t.type!==r.type){n.classList.remove(`vex-${r.type}`),n.classList.add(`vex-${t.type}`);let o=n.querySelector(".vx-icon");o&&(t.type==="loading"?o.innerHTML='<div class="vx-spinner"></div>':o.innerHTML=this.getIcon(t.type,t.icon))}if(t.message){let o=n.querySelector(".vx-msg");o&&(o.textContent=t.message)}if(t.title){let o=n.querySelector(".vx-title");o||(o=document.createElement("div"),o.className="vx-title",n.querySelector(".vx-body")?.prepend(o)),o&&(o.textContent=t.title)}this.activeAlerts.set(e,{element:n,options:c})}progress(e,t){let i=this.activeAlerts.get(e);if(!i)return;let n=0;typeof t=="number"?n=t:t.total>0&&(n=t.loaded/t.total*100);let r=i.element.querySelector(".vx-upload-prog");if(!r){let c=document.createElement("div");c.className="vx-upload-bar",c.style.height="4px",c.style.width="100%",c.style.backgroundColor="rgba(255,255,255,0.1)",c.style.borderRadius="2px",c.style.marginTop="8px",c.style.overflow="hidden",r=document.createElement("div"),r.className="vx-upload-prog",r.style.height="100%",r.style.backgroundColor="var(--vex-info-accent, #6366f1)",r.style.transition="width 0.2s linear",c.appendChild(r);let o=i.element.querySelector(".vx-body");o?o.appendChild(c):i.element.appendChild(c)}r.style.width=`${n}%`}generateId(){return typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():Math.random().toString(36).slice(2,9)}getIcon(e,t){if(t)return t;switch(e){case"success":return"\u2713";case"error":return"\u2715";case"warning":return"\u26A0";case"info":return"\u2139";case"neutral":return"\xB7";default:return""}}};var T=class{constructor(){this.activeModals=[]}confirm(e){return new Promise(t=>{this.create({type:"warning",...e,confirmLabel:e.confirmLabel||"Confirmar",cancelLabel:e.cancelLabel||"Cancelar"},()=>t(!0),()=>t(!1))})}alert(e){return new Promise(t=>{this.create({type:"info",...e,confirmLabel:e.confirmLabel||"OK",cancelLabel:void 0},()=>t(),()=>t())})}async form(e){return new Promise(t=>{let i={},n=document.createElement("div");n.className="modal-form",e.fields.forEach(r=>{let c=document.createElement("div");c.className="form-grp";let o=document.createElement("label");o.className="form-lbl",o.textContent=r.label,c.appendChild(o);let s;r.type==="select"?(s=document.createElement("select"),s.className="form-sel",r.options&&r.options.forEach(m=>{let l=document.createElement("option");l.value=m,l.textContent=m,s.appendChild(l)}),r.defaultValue&&(s.value=r.defaultValue)):r.type==="textarea"?(s=document.createElement("textarea"),s.className="form-tex",r.placeholder&&(s.placeholder=r.placeholder),r.defaultValue&&(s.value=r.defaultValue)):r.type==="radio"?(s=document.createElement("div"),s.className="form-radio-grp",r.options&&r.options.forEach(m=>{let l=document.createElement("label");l.style.display="flex",l.style.gap="6px",l.style.alignItems="center";let u=document.createElement("input");u.type="radio",u.name=r.name,u.value=m,r.defaultValue===m&&(u.checked=!0),l.appendChild(u),l.appendChild(document.createTextNode(m)),s.appendChild(l)})):(s=document.createElement("input"),s.className="form-inp",s.type=r.type,r.placeholder&&(s.placeholder=r.placeholder),r.defaultValue&&(s.value=r.defaultValue)),i[r.name]=s,c.appendChild(s);let d=document.createElement("div");d.className="form-err",d.style.color="var(--vex-error-text, #f87171)",d.style.fontSize="11px",d.style.display="none",d.style.marginTop="4px",c.appendChild(d),n.appendChild(c)}),this.create({...e,content:n,confirmLabel:e.submitLabel||"Enviar",cancelLabel:e.cancelLabel||"Cancelar"},()=>{let r=!0,c={};if(e.fields.forEach(o=>{let s=i[o.name],d;if(o.type==="radio"){let u=s.querySelector("input:checked");d=u?u.value:null}else d=s.value;c[o.name]=d;let m=s.parentElement?.querySelector(".form-err");m&&(m.style.display="none");let l=null;o.required&&!d?l="Campo obrigat\xF3rio":o.validate&&(l=o.validate(d)),l&&(r=!1,m&&(m.textContent=l,m.style.display="block"))}),r&&e.validate){let o=e.validate(c);o&&(r=!1,Object.entries(o).forEach(([s,d])=>{let l=i[s]?.parentElement?.querySelector(".form-err");l&&(l.textContent=d,l.style.display="block")}))}return r?(t(c),!0):!1},()=>t(null))})}async prompt(e){let{validate:t,...i}=e,n=await this.form({...i,fields:[{name:"value",label:"",type:"text",defaultValue:e.defaultValue,placeholder:e.placeholder,validate:t,required:!0}],submitLabel:e.confirmLabel||"OK"});return n?n.value:null}preview(e){let t=document.createElement("div");t.className="vx-preview-body",t.style.textAlign="center";let i=document.createElement("img");if(i.src=e.src,i.style.maxWidth="100%",i.style.maxHeight="70vh",i.style.borderRadius="8px",i.style.boxShadow="0 8px 30px rgba(0,0,0,0.5)",t.appendChild(i),e.meta){let n=document.createElement("div");n.className="vx-meta",n.textContent=e.meta.join(" \xB7 "),n.style.marginTop="16px",n.style.color="var(--vex-text-muted, rgba(255,255,255,0.6))",n.style.fontSize="13px",t.appendChild(n)}if(e.gallery){let n=document.createElement("div");n.className="vx-gallery",n.style.display="flex",n.style.gap="8px",n.style.justifyContent="center",n.style.marginTop="16px",e.gallery.forEach(r=>{let c=document.createElement("img");c.src=r,c.style.width="48px",c.style.height="48px",c.style.objectFit="cover",c.style.borderRadius="6px",c.style.cursor="pointer",c.style.opacity=r===e.src?"1":"0.5",c.style.border=r===e.src?"2px solid var(--vex-primary, #6366f1)":"2px solid transparent",c.onclick=()=>{i.src=r,Array.from(n.children).forEach(o=>{o.style.opacity="0.5",o.style.border="2px solid transparent"}),c.style.opacity="1",c.style.border="2px solid var(--vex-primary, #6366f1)"},n.appendChild(c)}),t.appendChild(n)}this.create({...e,content:t,width:e.width||800,footer:!1})}custom(e){return this.create(e)}create(e,t,i){if(typeof document>"u")return{close:()=>{}};O();let n=document.createElement("div");n.className="vex-backdrop";let r=`vex-modal-title-${Math.random().toString(36).slice(2)}`,c=`vex-modal-desc-${Math.random().toString(36).slice(2)}`;V(n,r,c);let o=document.createElement("div");o.className="vex-modal",e.width&&(o.style.maxWidth=`${e.width}px`),e.animate&&o.classList.add(`vex-anim-${e.animate}`);let s=document.createElement("div");if(s.className="modal-hdr",s.appendChild(document.createElement("div")),e.showClose!==!1){let l=document.createElement("button");l.className="modal-x",l.ariaLabel="Fechar",l.innerHTML="\u2715",l.onclick=()=>{i&&i(),this.close(n)},s.appendChild(l)}o.appendChild(s);let d=document.createElement("div");if(d.className="modal-bdy",e.type){let l=document.createElement("div");l.className=`modal-icon ${e.type}`,l.innerHTML=this.getIcon(e.type),d.appendChild(l)}if(e.title){let l=document.createElement("div");l.id=r,l.className="modal-title",l.textContent=e.title,d.appendChild(l)}if(e.message){let l=document.createElement("div");l.id=c,l.className="modal-desc",l.textContent=e.message,d.appendChild(l)}if(e.content){let l=document.createElement("div");l.className="modal-custom",typeof e.content=="string"?l.innerHTML=e.content:l.appendChild(e.content),d.appendChild(l)}if(o.appendChild(d),e.footer!==!1&&(e.confirmLabel||e.cancelLabel)){let l=document.createElement("div");if(l.className="modal-ftr",e.cancelLabel){let u=document.createElement("button");u.className="modal-btn cancel",u.textContent=e.cancelLabel,u.onclick=()=>{i&&i(),this.close(n)},l.appendChild(u)}if(e.confirmLabel){let u=document.createElement("button");if(u.className=`modal-btn ${e.type||"primary"}`,u.textContent=e.confirmLabel,e.confirmDelay&&e.confirmDelay>0){u.disabled=!0;let x=Math.ceil(e.confirmDelay/1e3),C=e.confirmLabel;u.textContent=`${C} (${x})`;let b=setInterval(()=>{x--,x<=0?(clearInterval(b),u.disabled=!1,u.textContent=C):u.textContent=`${C} (${x})`},1e3);n._interval=b}u.onclick=async()=>{t?await t()!==!1&&this.close(n):this.close(n)},l.appendChild(u)}o.appendChild(l)}n.appendChild(o),document.body.appendChild(n),this.activeModals.push(n),e.closeOnBackdrop!==!1&&(n.onclick=l=>{l.target===n&&(i&&i(),this.close(n))});let m=l=>{l.key==="Escape"&&e.closeOnEscape!==!1&&this.activeModals[this.activeModals.length-1]===n&&(i&&i(),this.close(n)),l.key==="Tab"&&R(n,l)};return document.addEventListener("keydown",m),n._cleanup=()=>{document.removeEventListener("keydown",m),n._interval&&clearInterval(n._interval)},e.onOpen&&e.onOpen(),{close:()=>this.close(n,i)}}close(e,t){if(e.classList.contains("closing"))return;e.classList.add("closing");let i=e.querySelector(".vex-modal");i&&i.classList.add("closing");let n=()=>{e._cleanup&&e._cleanup(),e.parentNode&&e.parentNode.removeChild(e),this.activeModals=this.activeModals.filter(r=>r!==e),k()};e.addEventListener("animationend",n),setTimeout(()=>{document.body.contains(e)&&n()},300)}getIcon(e){switch(e){case"danger":return"\u2715";case"warning":return"!";case"success":return"\u2713";case"info":return"i";default:return""}}};function D(a){if(typeof document>"u")return{close:()=>{}};O();let e=document.createElement("div");e.className=`vex-drawer vex-drawer-${a.position}`,a.className&&e.classList.add(a.className),a.width&&(a.position==="left"||a.position==="right")&&(e.style.width=`${a.width}px`),a.height&&(a.position==="top"||a.position==="bottom")&&(e.style.height=`${a.height}px`);let t=document.createElement("div");if(t.className="drawer-hdr",a.title){let m=document.createElement("div");m.className="drawer-title",m.textContent=a.title,t.appendChild(m)}let i=document.createElement("button");i.className="drawer-close",i.innerHTML="\u2715",i.onclick=()=>s(),t.appendChild(i),e.appendChild(t);let n=document.createElement("div");n.className="drawer-body";let r=null,c=null,o=null;if(typeof a.content=="string")if(a.content.startsWith("#")||a.content.startsWith(".")){let m=document.querySelector(a.content);m?(o=m,r=m.parentNode,c=m.nextSibling,n.appendChild(m),m.style.display="block"):n.innerHTML=a.content}else n.innerHTML=a.content;else o=a.content,r=a.content.parentNode,c=a.content.nextSibling,n.appendChild(a.content),a.content.style.display="block";if(e.appendChild(n),a.footer&&a.footer.length>0){let m=document.createElement("div");m.className="drawer-ftr",a.footer.forEach(l=>{let u=document.createElement("button");u.className=`drawer-btn ${l.variant||"default"}`,u.textContent=l.label,u.onclick=()=>{l.onClick?l.onClick(()=>s()):s()},m.appendChild(u)}),e.appendChild(m)}document.body.appendChild(e),requestAnimationFrame(()=>{e.classList.add("open")});let s=()=>{e.classList.remove("open"),e.addEventListener("transitionend",()=>{o&&r&&(o.style.display="",r.insertBefore(o,c)),e.parentNode&&e.parentNode.removeChild(e),k(),a.onClose&&a.onClose()},{once:!0}),document.removeEventListener("click",d)},d=m=>{a.persistent||e.classList.contains("open")&&!e.contains(m.target)&&s()};return setTimeout(()=>{document.addEventListener("click",d)},100),{close:s}}async function B(a){let e=new T;return new Promise(t=>{let i=0,n={},r=null,c=null,o=l=>{let u=l;for(;u<a.length;){let x=a[u];if(!x.condition||x.condition(n))return u;u++}return-1};if(i=o(0),i===-1){t(n);return}let s=document.createElement("div");s.className="vex-flow-container";let d=()=>{s.innerHTML="";let l=a[i];if(c){let p=c.querySelector(".modal-title");p&&(p.textContent=l.title);let h=c.querySelector(".modal-icon");if(h&&l.type){h.className=`modal-icon ${l.type}`;let y={danger:"\u2715",warning:"!",success:"\u2713",info:"i"};h.innerHTML=y[l.type]||"i"}}let u=document.createElement("div");u.className="modal-steps",a.forEach((p,h)=>{let y=document.createElement("div");y.className="step-dot",h<i&&y.classList.add("done"),h===i&&y.classList.add("active");let f=document.createElement("div");f.className="step-circle",f.textContent=(h+1).toString(),h<i&&(f.textContent="\u2713");let g=document.createElement("div");g.className="step-name",g.textContent=p.title,y.appendChild(f),y.appendChild(g),u.appendChild(y)}),s.appendChild(u);let x=document.createElement("div");if(x.className="flow-content",l.description){let p=document.createElement("div");p.className="modal-desc",p.textContent=l.description,p.style.marginBottom="16px",x.appendChild(p)}let C={};l.fields&&l.fields.forEach(p=>{let h=document.createElement("div");h.className="form-grp";let y=document.createElement("label");y.className="form-lbl",y.textContent=p.label,h.appendChild(y);let f;p.type==="select"?(f=document.createElement("select"),f.className="form-sel",p.options&&p.options.forEach(L=>{let w=document.createElement("option");w.value=L,w.textContent=L,f.appendChild(w)}),n[p.name]&&(f.value=n[p.name])):(f=document.createElement("input"),f.className="form-inp",f.type=p.type,n[p.name]&&(f.value=n[p.name])),C[p.name]=f,h.appendChild(f);let g=document.createElement("div");g.className="form-err",g.style.color="var(--vex-error-text, #f87171)",g.style.fontSize="11px",g.style.display="none",h.appendChild(g),x.appendChild(h)}),s.appendChild(x);let b=document.createElement("div");if(b.className="flow-btns",b.style.marginTop="24px",b.style.display="flex",b.style.justifyContent="flex-end",b.style.gap="10px",i>0){let p=document.createElement("button");p.className="modal-btn cancel",p.textContent="\u2190 Voltar",p.onclick=()=>{let h=i-1;for(;h>=0;){let y=a[h];if(!y.condition||y.condition(n))break;h--}h>=0&&(i=h,d())},b.appendChild(p)}let E=document.createElement("button");E.className="modal-btn primary";let F=o(i+1)===-1;E.textContent=F?"Concluir":"Pr\xF3ximo \u2192",E.onclick=async()=>{let p={},h=!0;if(l.fields&&l.fields.forEach(f=>{let g=C[f.name].value;p[f.name]=g,n[f.name]=g,f.required&&!g&&(h=!1)}),!h)return;if(l.beforeNext){E.disabled=!0,E.textContent="Aguarde...";let f=await l.beforeNext(p);if(E.disabled=!1,E.textContent=F?"Concluir":"Pr\xF3ximo \u2192",f){Object.keys(f).forEach(g=>{let L=C[g];if(L&&L.nextElementSibling){let w=L.nextElementSibling;w.textContent=f[g],w.style.display="block"}});return}}let y=o(i+1);y!==-1?(i=y,d()):(r&&r.close(),t(n))},b.appendChild(E),s.appendChild(b)},m=a[i];r=e.custom({title:m.title,type:m.type||"info",content:s,footer:!1,width:600,onClose:()=>{t(null)}}),setTimeout(()=>{c=document.querySelector(".vex-modal:last-child"),d()},0)})}var I=class{constructor(){this.currentTheme="auto";this.mediaQuery=null;typeof window<"u"&&(this.mediaQuery=window.matchMedia("(prefers-color-scheme: dark)"),this.init())}init(){this.mediaQuery?.addEventListener("change",()=>{this.currentTheme==="auto"&&this.applyTheme()})}setTheme(e){this.currentTheme=e,this.applyTheme()}getTheme(){return this.currentTheme}applyTheme(){if(typeof document>"u")return;let e=document.documentElement,t=this.currentTheme==="dark"||this.currentTheme==="auto"&&this.mediaQuery?.matches;t?(e.classList.add("vex-dark"),e.classList.remove("vex-light")):(e.classList.add("vex-light"),e.classList.remove("vex-dark")),e.setAttribute("data-vex-theme",t?"dark":"light")}setTokens(e){if(typeof document>"u")return;let t=document.documentElement;Object.entries(e).forEach(([i,n])=>{t.style.setProperty(i,n)})}isReducedMotion(){return typeof window>"u"?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches}},$=new I;var N=new S,z=new T,K=H;function W(a){a.theme&&$.setTheme(a.theme)}function _(a){$.setTheme(a)}function U(a){N.dismiss(a)}function X(a){N.dismissAll(a)}function Y(a,e){N.update(a,e)}function J(a,e){N.progress(a,e)}var G={alert:N,modal:z,drawer:D,flow:B,history:K,configure:W,setTheme:_,dismiss:U,dismissAll:X,update:Y,progress:J,prompt:{inline:async(a,e)=>{let t=typeof a=="string"?document.querySelector(a):a;if(!t)return null;let i=t.textContent,n=t.style.display,r=document.createElement("input");return r.type="text",r.value=i||"",r.placeholder=e.placeholder||"",r.className="vex-inline-prompt",r.style.fontSize=getComputedStyle(t).fontSize,r.style.fontFamily=getComputedStyle(t).fontFamily,r.style.border="1px solid var(--vex-primary, #6366f1)",r.style.borderRadius="4px",r.style.padding="2px 4px",r.style.background="var(--vex-bg, #000)",r.style.color="var(--vex-text, #fff)",t.style.display="none",t.parentNode?.insertBefore(r,t),r.focus(),new Promise(c=>{let o=s=>{if(s!==null&&e.validate&&e.validate(s)){r.style.borderColor="red";return}r.remove(),t.style.display=n,s!==null&&(t.textContent=s),c(s)};r.onblur=()=>o(r.value),r.onkeydown=s=>{s.key==="Enter"&&o(r.value),s.key==="Escape"&&o(null)}})}}},v=G;function ke(){let a=Z([]),e={...v.alert,success:(t,i)=>{let n=v.alert.success(t,i);return a.current.push(n),n},error:(t,i)=>{let n=v.alert.error(t,i);return a.current.push(n),n},warning:(t,i)=>{let n=v.alert.warning(t,i);return a.current.push(n),n},info:(t,i)=>{let n=v.alert.info(t,i);return a.current.push(n),n},neutral:(t,i)=>{let n=v.alert.neutral(t,i);return a.current.push(n),n},loading:(t,i)=>{let n=v.alert.loading(t,i);return a.current.push(n),n},upload:(t,i)=>{let n=v.alert.upload(t,i);return a.current.push(n),n},inline:(t,i)=>{let n=v.alert.inline(t,i);return a.current.push(n),n},fixed:t=>{let i=v.alert.fixed(t);return a.current.push(i),i},attach:(t,i)=>{let n=v.alert.attach(t,i);return a.current.push(n),n},show:t=>{let i=v.alert.show(t);return a.current.push(i),i}};return Q(()=>()=>{a.current.forEach(t=>v.dismiss(t))},[]),{...v,alert:e}}var Se=({children:a,config:e})=>(Q(()=>{e&&v.configure(e)},[e]),a);export{Se as VexProvider,ke as useVex};
|
|
17
|
+
//# sourceMappingURL=react.esm.js.map
|