@jokerized/decksmith 0.2.0 → 0.3.1
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 +2 -1
- package/dist/cli.js +679 -132
- package/dist/ds-morph.js +1 -0
- package/dist/index.js +661 -130
- package/dist/mcp.js +374 -39
- package/dist/types/emit/archetypes/equation-morph.d.ts +2 -0
- package/dist/types/emit/archetypes/equation-walk.d.ts +63 -1
- package/dist/types/emit/archetypes/index.d.ts +1 -1
- package/dist/types/emit/archetypes/stack.d.ts +9 -0
- package/dist/types/emit/depth.d.ts +95 -0
- package/dist/types/emit/kit.d.ts +7 -0
- package/dist/types/emit/morph-runtime.d.ts +178 -0
- package/dist/types/index.d.ts +1 -1
- package/dist/types/mcp/tools.d.ts +12 -0
- package/dist/types/plan/arc.d.ts +82 -0
- package/dist/types/plan/codex.d.ts +6 -0
- package/dist/types/prefs.d.ts +1 -0
- package/dist/types/render/ffmpeg.d.ts +0 -14
- package/dist/types/types.d.ts +412 -0
- package/dist/types/verify/apparent.d.ts +123 -0
- package/dist/types/verify/index.d.ts +64 -0
- package/dist/types/verify/typefloor.d.ts +3 -1
- package/package.json +1 -1
package/dist/ds-morph.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(()=>{var G=new Set(["mord","mbin","mrel","mopen","mclose","mpunct","mop","minner","mathnormal","mathrm","mathbf","mathit","mathcal","mathbb","mathsf","mathtt","mathfrak","amsrm","boldsymbol","frac-line","overline-line","underline-line","op-symbol","delimsizing"]),I=".frac-line,.overline-line,.underline-line,.hline,.rule",E="ds-k-";function L(e){let r=[];for(let t of e.classList)G.has(t)&&r.push(t);return r.sort(),`${(e.textContent??"").trim()||"\u2205"} ${r.join(" ")}`}function T(e,r){for(let i=e;i&&i!==r.parentElement;i=i.parentElement)for(let t of i.classList)if(t.startsWith(E))return t.slice(E.length);return""}function P(e){let r=new Set,i=[];for(let t of e.querySelectorAll("*"))t.closest("svg")||t.childElementCount>0||(t.textContent??"").trim()&&(i.push(t),r.add(t));for(let t of e.querySelectorAll(I))r.has(t)||i.push(t);for(let t of e.querySelectorAll("svg"))r.has(t)||i.push(t);return i.sort((t,l)=>t.compareDocumentPosition(l)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1),i}function M(e){let r=document.createElement("i");r.style.cssText="display:inline-block;width:0;height:0;vertical-align:baseline",e.appendChild(r);let i=r.getBoundingClientRect(),t=e.getBoundingClientRect();return r.remove(),[t.left,i.top]}function S(e,r,i){let t=i.getBoundingClientRect(),l=r.offsetWidth?r.getBoundingClientRect().width/r.offsetWidth:1,p=[];for(let n of P(e)){let s=n.getBoundingClientRect();if(s.width===0&&s.height===0)continue;let a=(n.textContent??"").trim(),o=a?M(n):null,u=getComputedStyle(n),m=n.cloneNode(!0);m.removeAttribute("id");let c=m.style;c.position="absolute",c.display="inline-block",c.left=`${(s.left-t.left)/l}px`,c.top=`${(s.top-t.top)/l}px`,c.fontSize=u.fontSize,c.fontFamily=u.fontFamily,c.fontStyle=u.fontStyle,c.fontWeight=u.fontWeight,c.color=u.color,c.lineHeight="1",c.whiteSpace="pre",c.margin="0",c.boxSizing="border-box",a||(c.width=`${s.width/l}px`,c.height=`${s.height/l}px`,c.borderBottomWidth=u.borderBottomWidth,c.borderBottomStyle=u.borderBottomStyle,c.borderBottomColor=u.borderBottomColor,c.background=u.backgroundColor),i.appendChild(m),p.push({el:m,key:T(n,e),sig:L(n),text:a,fs:Number.parseFloat(u.fontSize)||1,cx:0,cy:0,w:s.width/l,h:s.height/l}),o&&(m.__ink=o)}for(let n of p){let s=n.el.__ink;if(!s)continue;let a=M(n.el),o=n.el.style;o.left=`${Number.parseFloat(o.left)+(s[0]-a[0])/l}px`,o.top=`${Number.parseFloat(o.top)+(s[1]-a[1])/l}px`}for(let n of p){let s=n.el.getBoundingClientRect();n.cx=(s.left-t.left+s.width/2)/l,n.cy=(s.top-t.top+s.height/2)/l}return p}function k(e){let r=new Map;e.forEach((t,l)=>{let p=t.key?`k:${t.key}`:`s:${l}`;r.has(p)||r.set(p,{key:t.key,leaves:[]}),r.get(p)?.leaves.push(t)});let i=[];for(let t of r.values()){let l=Number.POSITIVE_INFINITY,p=Number.NEGATIVE_INFINITY,n=Number.POSITIVE_INFINITY,s=Number.NEGATIVE_INFINITY,a=0;for(let o of t.leaves)l=Math.min(l,o.cx-o.w/2),p=Math.max(p,o.cx+o.w/2),n=Math.min(n,o.cy-o.h/2),s=Math.max(s,o.cy+o.h/2),a=Math.max(a,o.fs);i.push({ident:t.key?`k:${t.key}`:`g:${t.leaves[0]?.sig}`,key:t.key,leaves:t.leaves,cx:(l+p)/2,cy:(n+s)/2,w:p-l,h:s-n,fs:a,text:t.leaves.map(o=>o.text).join("")})}return i}function C(e,r){let i=a=>{let o=new Map;return a.forEach((u,m)=>{o.has(u.ident)||o.set(u.ident,[]),o.get(u.ident)?.push(m)}),o},t=i(e),l=i(r),p=[],n=new Set,s=new Set;for(let[a,o]of t){let u=l.get(a);if(!u)continue;let m=o.flatMap(c=>u.map(d=>[c,d])).sort((c,d)=>Math.hypot(e[c[0]].cx-r[c[1]].cx,e[c[0]].cy-r[c[1]].cy)-Math.hypot(e[d[0]].cx-r[d[1]].cx,e[d[0]].cy-r[d[1]].cy));for(let[c,d]of m)n.has(c)||s.has(d)||(p.push([c,d]),n.add(c),s.add(d))}return p.sort((a,o)=>a[0]-o[0]),{pairs:p,dropA:e.map((a,o)=>o).filter(a=>!n.has(a)),addB:r.map((a,o)=>o).filter(a=>!s.has(a))}}var b=e=>Math.round(e*1e3)/1e3;function _(e,r,i,t){let l=t.arc?1:0,p=[],n=(s,a,o,u,m,c,d)=>p.push({el:s,prop:a,from:b(o),to:b(u),at:b(m),dur:b(c),ease:d});for(let[s,a]of i.pairs){let o=e[s],u=r[a],m=u.fs/o.fs,c=u.cx-o.cx,d=u.cy-o.cy,w=o.text===u.text,N=Math.hypot(c,d),y=l&&N>60?-Math.sign(c||1)*Math.min(.62*((o.h+u.h)/2),.8*Math.max(o.fs,u.fs)):0;for(let f of o.leaves){let g=c+(f.cx-o.cx)*(m-1),h=d+(f.cy-o.cy)*(m-1);n(f.el,"x",0,g,0,1,"power2.inOut"),n(f.el,"s",1,m,0,1,"power2.inOut"),y?(n(f.el,"y",0,h/2+y,0,.5,"power2.out"),n(f.el,"y",h/2+y,h,.5,.5,"power2.in")):n(f.el,"y",0,h,0,1,"power2.inOut"),w?n(f.el,"o",1,0,.88,.12,"none"):n(f.el,"o",1,0,.45,.55,"power1.in")}for(let f of u.leaves){let g=-c+(f.cx-u.cx)*(1/m-1),h=-d+(f.cy-u.cy)*(1/m-1);if(w){n(f.el,"o",0,1,.88,.12,"none");continue}n(f.el,"x",g,0,0,1,"power2.inOut"),n(f.el,"s",1/m,1,0,1,"power2.inOut"),y?(n(f.el,"y",h,h/2-y/m,0,.5,"power2.out"),n(f.el,"y",h/2-y/m,0,.5,.5,"power2.in")):n(f.el,"y",h,0,0,1,"power2.inOut"),n(f.el,"o",0,1,.45,.55,"power1.out")}}for(let s of i.dropA)for(let a of e[s].leaves)n(a.el,"o",1,0,0,.45,"power1.in"),n(a.el,"s",1,.55,0,.45,"power1.in");for(let s of i.addB)for(let a of r[s].leaves)n(a.el,"o",0,1,.55,.45,"power1.out"),n(a.el,"s",.55,1,.55,.45,"power1.out");return p.sort((s,a)=>s.at-a.at)}var B={none:e=>e,"power1.in":e=>e*e,"power1.out":e=>1-(1-e)*(1-e),"power2.in":e=>e*e*e,"power2.out":e=>1-(1-e)**3,"power2.inOut":e=>e<.5?4*e*e*e:1-(-2*e+2)**3/2};function x(e,r){let i=new Map;for(let{el:t,side:l}of e.leaves)i.set(t,{x:0,y:0,s:1,o:l==="a"?1:0});for(let t of e.steps){if(r<t.at)continue;let l=t.dur<=0?1:Math.min(1,(r-t.at)/t.dur),p=i.get(t.el);p&&(p[t.prop]=t.from+(t.to-t.from)*B[t.ease](l))}for(let[t,l]of i){let p=b(l.x),n=b(l.y),s=b(l.s);t.style.transform=p===0&&n===0&&s===1?"":`translate(${p}px, ${n}px) scale(${s})`,t.style.opacity=String(b(l.o)),t.style.visibility=l.o<=0?"hidden":""}}var v=new WeakMap;function O(e,r={arc:!0}){let i=e.querySelector('[data-morph="a"]'),t=e.querySelector('[data-morph="b"]');if(!i||!t)throw new Error(`dsMorph: #${e.id} has no data-morph="a"/"b" roots`);let l=document.createElement("div");l.className="ds-morph-layer",e.appendChild(l);let p=S(i,e,l),n=S(t,e,l);i.style.visibility="hidden",t.style.visibility="hidden";let s=k(p),a=k(n),o=C(s,a),u={leaves:[...p.map(m=>({el:m.el,side:"a"})),...n.map(m=>({el:m.el,side:"b"}))],steps:_(s,a,o,r)};return v.set(e,u),x(u,0),{groupsA:s.length,groupsB:a.length,leavesA:p.length,leavesB:n.length,matched:o.pairs.length,dropped:o.dropA.length,added:o.addB.length}}var $={name:"dsMorph",init(e,r){let i=v.get(e);if(!i)throw new Error(`dsMorph: nothing built for #${e.id}; DSMorph.build must run in measure`);this.plan=i,this.end=Number(r)},render(e,r){x(r.plan,r.end*e)}};if(typeof window<"u"){let e=window;e.DSMorph={build:O,evaluate:x},e.DSMorphPlugin=$}})();
|