lecodes-cli 2.0.2 → 2.0.3

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.
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "c1aed95-2026-09-29",
3
- "commit": "c1aed95",
4
- "date": "2026-09-29T18:24:32.365Z"
2
+ "version": "99cf843-2026-09-29",
3
+ "commit": "99cf843",
4
+ "date": "2026-09-29T19:53:53.471Z"
5
5
  }
@@ -1,2 +1,2 @@
1
- const h=new Map,T=t=>{h.clear();const n=t.ui;globalThis.__lecodesCaptureSites=n?(i,f,c)=>{h.set(n.lastCreated,{site:f,element:new WeakRef(c)})}:void 0},j=(t,n=0)=>{var i;return typeof t=="function"?"ƒ":t===null||typeof t!="object"?t:Array.isArray(t)?n<3?t.map(f=>j(f,n+1)):"[…]":Object.getPrototypeOf(t)!==Object.prototype?`${((i=t.constructor)==null?void 0:i.name)??"object"}`:n>=3?"{…}":Object.fromEntries(Object.entries(t).filter(([,f])=>f!==void 0).map(([f,c])=>[f,j(c,n+1)]))},k=t=>{const n=t==null?void 0:t._style;if(!n||typeof n!="object")return;const i=j(n);return Object.keys(i).length>0?i:void 0},w=t=>"#"+(t>>>0).toString(16).padStart(8,"0"),a=t=>Math.round(t*100)/100,A={opacity:1,dim:0,overflow:"visible",scrollAxis:"y",letterSpacing:0,lineClamp:0,textDecoration:"none",fontStyle:"normal",textAlign:"start",textOverflow:"ellipsis",backgroundSize:"cover",objectFit:"cover",inputType:"text"},_=new Set(["color","fontSize","fontFamily","fontWeight","fontStyle","lineHeight","letterSpacing","textAlign","textDecoration","lineClamp","textOverflow"]),C=new Set(["placeholder","placeholderColor","inputType"]),F=t=>{const n=t;return n.x===50&&n.y===50&&n.xPercent&&n.yPercent},O=t=>Array.isArray(t)?t.map(n=>typeof n=="object"&&n!==null?O(n):String(n)).join(" "):typeof t=="object"&&t!==null?Object.entries(t).map(([n,i])=>`${n}: ${typeof i=="object"&&i!==null?O(i):String(i)}`).join(", "):String(t),P=(t,n)=>{const i={},f=t==="text"||t==="input"||t==="textarea";for(const[c,o]of Object.entries(n))if(!(o==null||o==="")&&A[c]!==o&&!(_.has(c)&&!f)&&!(C.has(c)&&t!=="input"&&t!=="textarea")&&!(c==="objectFit"&&t!=="image"&&t!=="video")&&!(c==="transformOrigin"&&F(o))&&!(typeof o=="number"&&/color$/i.test(c)&&(o&255)===0))if(typeof o=="number"&&/color$/i.test(c))i[c]=w(o);else if(c==="border"&&typeof o=="object"){const e=Object.entries(o).filter(([,r])=>r&&r.width>0).map(([r,l])=>[r,`${a(l.width)}px ${w(l.color)}`]);if(e.length===4&&e.every(([,r])=>r===e[0][1]))i.border=e[0][1];else for(const[r,l]of e)i[`border${r[0].toUpperCase()}${r.slice(1)}`]=l}else if(c==="borderRadius"&&typeof o=="object"){const e=o;(e.tl||e.tr||e.br||e.bl)&&(i[c]=e.tl===e.tr&&e.tr===e.br&&e.br===e.bl?e.tl:[e.tl,e.tr,e.br,e.bl].map(a).join(" "))}else if(c==="backgroundGradients")Array.isArray(o)&&o.length>0&&(i[c]=`${o.length} gradient${o.length>1?"s":""}`);else if(c==="transform"&&Array.isArray(o))i[c]=`matrix(${o.map(e=>a(Number(e))).join(", ")})`;else if(c==="transformOrigin"&&typeof o=="object"){const e=o;i[c]=`${a(e.x)}${e.xPercent?"%":"px"} ${a(e.y)}${e.yPercent?"%":"px"}`}else typeof o=="object"?i[c]=O(o):i[c]=o;return i},x=t=>{const n=t.lines?t.lines.join(`
2
- `):t.text??t.value;return n?n.length>200?n.slice(0,200)+"…":n:void 0},S=t=>({x:a(t.rect.x),y:a(t.rect.y),width:a(t.rect.width),height:a(t.rect.height)}),$=t=>({id:t.id,type:t.type,rect:S(t),...t.name?{name:t.name}:{},...x(t)?{text:x(t).slice(0,40)}:{},children:t.children.map($)}),D=t=>{const n=t.ui;if(!n)return null;const i=()=>n.frame().filter(e=>!e.leaving),f=e=>{const r=(l,u)=>{const s=[...u,l];if(l.id===e)return s;for(const b of l.children){const d=r(b,s);if(d)return d}return null};for(const l of i()){const u=r(l.tree,[]);if(u)return u}return null},c=(e,r)=>{const l=s=>e>=s.rect.x&&e<s.rect.x+s.rect.width&&r>=s.rect.y&&r<s.rect.y+s.rect.height,u=i();for(let s=u.length-1;s>=0;s--){let b=null;const d=y=>{const m=l(y);if(m&&(b=y),!(y.clip&&!m))for(const g of y.children)d(g)};if(d(u[s].tree),b)return b;if(u[s].backdrop)return u[s].tree}return null},o=e=>{const r=e==null?void 0:e[e.length-1];if(!e||!r)return null;const[l,u,s,b]=n.paddingOf(r.id).map(a),d=h.get(r.id),y=d?t.locate(d.site).find(p=>!p.source.includes("__sdk")):void 0,m=k(d==null?void 0:d.element.deref()),g=r.state?Object.entries(r.state).filter(([,p])=>p===!0).map(([p])=>p):[];return{id:r.id,type:r.type,rect:S(r),...r.name?{name:r.name}:{},...x(r)!==void 0?{text:x(r)}:{},padding:{top:u,right:s,bottom:b,left:l},...m?{set:m}:{},style:P(r.type,r.style),...g.length>0?{state:g}:{},...r.scroll?{scroll:{axis:r.scroll.axis,offset:a(r.scroll.offset),content:a(r.scroll.content)}}:{},...y?{source:{file:y.source.replace(/^\//,""),line:y.line,column:y.column}}:{},path:e.map(p=>({id:p.id,type:p.type,...p.name?{name:p.name}:{}}))}};return{answer(e){switch(e.ask){case"tree":return{ask:"tree",layers:i().map(r=>({kind:r.widget?"widget":"screen",tree:$(r.tree)}))};case"at":{const r=c(e.x,e.y);return{ask:"at",node:r?o(f(r.id)):null}}case"node":return{ask:"node",node:o(f(e.node))}}}}};export{D as createInspector,T as recordSites};
1
+ const h=new Map,P=t=>{h.clear();const n=t.ui;globalThis.__lecodesCaptureSites=n?(i,f,c)=>{h.set(n.lastCreated,{site:f,element:new WeakRef(c)})}:void 0},j=(t,n=0)=>{var i;return typeof t=="function"?"ƒ":t===null||typeof t!="object"?t:Array.isArray(t)?n<3?t.map(f=>j(f,n+1)):"[…]":Object.getPrototypeOf(t)!==Object.prototype?`${((i=t.constructor)==null?void 0:i.name)??"object"}`:n>=3?"{…}":Object.fromEntries(Object.entries(t).filter(([,f])=>f!==void 0).map(([f,c])=>[f,j(c,n+1)]))},k=t=>{const n=t==null?void 0:t._style;if(!n||typeof n!="object")return;const i=j(n);return Object.keys(i).length>0?i:void 0},w=t=>"#"+(t>>>0).toString(16).padStart(8,"0"),a=t=>Math.round(t*100)/100,A={opacity:1,dim:0,overflow:"visible",scrollAxis:"y",letterSpacing:0,lineClamp:0,textDecoration:"none",fontStyle:"normal",textAlign:"start",textOverflow:"ellipsis",backgroundSize:"cover",objectFit:"cover",inputType:"text"},_=new Set(["color","fontSize","fontFamily","fontWeight","fontStyle","lineHeight","letterSpacing","textAlign","textDecoration","lineClamp","textOverflow"]),C=new Set(["placeholder","placeholderColor","inputType"]),F=t=>{const n=t;return n.x===50&&n.y===50&&n.xPercent&&n.yPercent},O=t=>Array.isArray(t)?t.map(n=>typeof n=="object"&&n!==null?O(n):String(n)).join(" "):typeof t=="object"&&t!==null?Object.entries(t).map(([n,i])=>`${n}: ${typeof i=="object"&&i!==null?O(i):String(i)}`).join(", "):String(t),T=(t,n)=>{const i={},f=t==="text"||t==="input"||t==="textarea";for(const[c,o]of Object.entries(n))if(!(o==null||o==="")&&A[c]!==o&&!(_.has(c)&&!f)&&!(C.has(c)&&t!=="input"&&t!=="textarea")&&!(c==="objectFit"&&t!=="image"&&t!=="video")&&!(c==="transformOrigin"&&F(o))&&!(typeof o=="number"&&/color$/i.test(c)&&(o&255)===0))if(typeof o=="number"&&/color$/i.test(c))i[c]=w(o);else if(c==="border"&&typeof o=="object"){const e=Object.entries(o).filter(([,r])=>r&&r.width>0).map(([r,l])=>[r,`${a(l.width)}px ${w(l.color)}`]);if(e.length===4&&e.every(([,r])=>r===e[0][1]))i.border=e[0][1];else for(const[r,l]of e)i[`border${r[0].toUpperCase()}${r.slice(1)}`]=l}else if(c==="borderRadius"&&typeof o=="object"){const e=o;(e.tl||e.tr||e.br||e.bl)&&(i[c]=e.tl===e.tr&&e.tr===e.br&&e.br===e.bl?e.tl:[e.tl,e.tr,e.br,e.bl].map(a).join(" "))}else if(c==="backgroundGradients")Array.isArray(o)&&o.length>0&&(i[c]=`${o.length} gradient${o.length>1?"s":""}`);else if(c==="transform"&&Array.isArray(o))i[c]=`matrix(${o.map(e=>a(Number(e))).join(", ")})`;else if(c==="transformOrigin"&&typeof o=="object"){const e=o;i[c]=`${a(e.x)}${e.xPercent?"%":"px"} ${a(e.y)}${e.yPercent?"%":"px"}`}else typeof o=="object"?i[c]=O(o):i[c]=o;return i},x=t=>{const n=t.lines?t.lines.join(`
2
+ `):t.text??t.value;return n?n.length>200?n.slice(0,200)+"…":n:void 0},S=t=>({x:a(t.rect.x),y:a(t.rect.y),width:a(t.rect.width),height:a(t.rect.height)}),$=t=>({id:t.id,type:t.type,rect:S(t),...t.name?{name:t.name}:{},...x(t)?{text:x(t).slice(0,40)}:{},children:t.children.map($)}),D=t=>{const n=t.ui;if(!n)return null;const i=()=>n.frame().filter(e=>!e.leaving),f=e=>{const r=(l,u)=>{const s=[...u,l];if(l.id===e)return s;for(const b of l.children){const d=r(b,s);if(d)return d}return null};for(const l of i()){const u=r(l.tree,[]);if(u)return u}return null},c=(e,r)=>{const l=s=>e>=s.rect.x&&e<s.rect.x+s.rect.width&&r>=s.rect.y&&r<s.rect.y+s.rect.height,u=i();for(let s=u.length-1;s>=0;s--){let b=null;const d=y=>{const m=l(y);if(m&&(b=y),!(y.clip&&!m))for(const g of y.children)d(g)};if(d(u[s].tree),b)return b;if(u[s].backdrop)return u[s].tree}return null},o=e=>{const r=e==null?void 0:e[e.length-1];if(!e||!r)return null;const[l,u,s,b]=n.paddingOf(r.id).map(a),d=h.get(r.id),y=d?t.locate(d.site).find(p=>!p.source.includes("__sdk")):void 0,m=k(d==null?void 0:d.element.deref()),g=r.state?Object.entries(r.state).filter(([,p])=>p===!0).map(([p])=>p):[];return{id:r.id,type:r.type,rect:S(r),...r.name?{name:r.name}:{},...x(r)!==void 0?{text:x(r)}:{},padding:{top:u,right:s,bottom:b,left:l},...m?{set:m}:{},style:T(r.type,r.style),...g.length>0?{state:g}:{},...r.scroll?{scroll:{axis:r.scroll.axis,offset:a(r.scroll.offset),content:a(r.scroll.content)}}:{},...y?{source:{file:y.source.replace(/^\//,""),line:y.line,column:y.column}}:{},path:e.map(p=>({id:p.id,type:p.type,...p.name?{name:p.name}:{}}))}};return{answer(e){switch(e.ask){case"tree":return{ask:"tree",layers:i().map(r=>({kind:r.widget?"widget":"screen",tree:$(r.tree)}))};case"text":return{ask:"text",text:n.toText()};case"at":{const r=c(e.x,e.y);return{ask:"at",node:r?o(f(r.id)):null}}case"node":return{ask:"node",node:o(f(e.node))}}}}};export{D as createInspector,P as recordSites};