Chandra
view release on metacpan or search on metacpan
"function dismiss(id){"
"var el=t[id];if(!el)return;"
"el.style.opacity='0';el.style.transform='translateX(100%)';"
"setTimeout(function(){if(el.parentNode)el.parentNode.removeChild(el);delete t[id];},300);}"
"window.__chandraToast={show:show,dismiss:dismiss};"
"})();";
static const char *CHANDRA_MODAL_JS =
"(function(){"
"if(window.__chandraModal)return;"
"var overlay,activeModal;"
"function create(id,opts){"
"overlay=document.createElement('div');"
"overlay.id=id+'_overlay';"
"overlay.style.cssText='position:fixed;top:0;left:0;width:100%;height:100%;background:rgba(0,0,0,0.5);z-index:99990;display:flex;align-items:center;justify-content:center;';"
"if(opts.backdrop!==false)overlay.onclick=function(e){if(e.target===overlay)close(id);};"
"var modal=document.createElement('div');"
"modal.id=id;"
"modal.style.cssText='background:var(--chandra-bg,#fff);border:1px solid var(--chandra-border,#e0e0e0);border-radius:var(--chandra-radius,6px);box-shadow:var(--chandra-shadow,0 4px 16px rgba(0,0,0,0.2));padding:0;min-width:320px;max-width:'+(opts.wid...
/* Title bar */
"if(opts.title){"
"var hdr=document.createElement('div');"
"hdr.style.cssText='padding:16px 20px 12px;display:flex;align-items:center;justify-content:space-between;border-bottom:1px solid var(--chandra-border,#e0e0e0);';"
"var t=document.createElement('h3');"
"t.style.cssText='margin:0;font-size:1.1em;';t.textContent=opts.title;"
"hdr.appendChild(t);"
"btn.className=cls;"
"btn.onclick=function(){"
"if(b.action==='close')close(id);"
"else if(b.handler){"
"var val=null;var inp=document.getElementById(id+'_input');if(inp)val=inp.value;"
"window.chandra.invoke(b.handler,[val]).then(function(){close(id);});"
"}"
"};"
"ftr.appendChild(btn);});"
"modal.appendChild(ftr);}"
"overlay.appendChild(modal);"
"document.body.appendChild(overlay);"
"activeModal=id;"
"requestAnimationFrame(function(){modal.style.opacity='1';modal.style.transform='scale(1)';});"
"var inp=document.getElementById(id+'_input');if(inp)setTimeout(function(){inp.focus();inp.select();},100);"
"}"
"function close(id){"
"var ov=document.getElementById(id+'_overlay');"
"if(!ov)return;"
"var m=document.getElementById(id);"
"if(m){m.style.opacity='0';m.style.transform='scale(0.95)';}"
"setTimeout(function(){if(ov.parentNode)ov.parentNode.removeChild(ov);},200);"
"activeModal=null;}"
"window.__chandraModal={create:create,close:close};"
"})();";
MODULE = Chandra PACKAGE = Chandra
/* Copy outputs */
child->output_count = orig->output_count;
for (i = 0; i < orig->output_count; i++) {
child->outputs[i] = orig->outputs[i];
if (child->outputs[i].path)
SvREFCNT_inc(child->outputs[i].path);
if (child->outputs[i].callback)
SvREFCNT_inc(child->outputs[i].callback);
}
/* Merge context: copy parent context then overlay new key-value pairs */
SvREFCNT_dec((SV *)child->context);
child->context = newHVhv(orig->context);
for (i = 1; i < items - 1; i += 2) {
STRLEN klen;
const char *key = SvPV(ST(i), klen);
(void)hv_store(child->context, key, klen,
newSVsv(ST(i + 1)), 0);
}
(void)hv_stores(self_hv, "_ctx", newSViv(PTR2IV(child)));
( run in 1.608 second using v1.01-cache-2.11-cpan-437f7b0c052 )