@graphysdk/theme-typewriter 0.1.1-beta.1792421638596 → 0.1.1-beta.1792426767391

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/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});let k=require("react"),i=require("@graphysdk/react"),s=require("react/jsx-runtime");var p={paper:"#EBD9A9",card:"#F8F0D8",text:"#1F1B16",secondary:"#4A443A",grid:"rgba(31, 27, 22, 0.4)",edge:"#C4AE74"},le="'Special Elite', 'Courier New', ui-monospace, monospace",y={black:"#1F1B16",red:"#B3271E",carbonBlue:"#2F4F8F",pencilGrey:"#6E6A62",stampGreen:"#2E6B4B",duplicatorViolet:"#7B5A9C"},de=[y.black,y.red,y.carbonBlue,y.pencilGrey,y.stampGreen,y.duplicatorViolet],he=["#D6C18B",y.black],ce=[y.carbonBlue,"#DECEA4",y.red],R={fontWeight:400,textColor:p.text},_={...R,fontSize:13,fill:p.paper,stroke:"transparent",strokeWidth:0,cornerRadius:0,paddingInline:3,paddingBlock:1,shadow:"none"},v={fontWeight:400,textColor:p.secondary},H={fill:p.card,stroke:p.text,strokeWidth:1,cornerRadius:0,shadow:"none"},ue={tokens:{graphBackground:p.paper,graphBorder:p.edge,geomBorder:p.text,textPrimary:p.text,textSecondary:p.secondary,ruleLine:p.text,gridLine:p.grid,hoverAffordance:p.paper,hoverGuideFill:"rgba(31, 27, 22, 0.07)",hoverGuideLine:p.secondary,tooltipBackground:p.card,tooltipBorder:p.text,tooltipPrimaryRow:"rgba(31, 27, 22, 0.08)",annotationShape:y.red,annotationArrow:p.text,differenceLabelBackground:p.card,trendPositive:y.black,trendNegative:y.red,trendNeutral:y.pencilGrey},defaults:[i.style.graph({strokeWidth:1,cornerRadius:0,fontFamily:le,fontWeight:400,padding:24}),i.style.geom({shadow:"none"}),i.style.geom({shadow:"none"},{state:"hovered"}),i.style.geom.bar({stroke:p.text,strokeWidth:1,cornerRadius:"none"}),i.style.geom.line({strokeWidth:2,dashArray:[],lineCap:"butt",lineJoin:"miter"}),i.style.geom.area({fillAlpha:.6,strokeWidth:1.5,dashArray:[],lineCap:"butt",lineJoin:"miter"}),i.style.geom.point({size:9,stroke:p.paper,strokeWidth:1.5}),i.style.geom.tile({cornerRadius:0,stroke:p.paper,strokeWidth:2}),i.style.geom.rule({stroke:y.red,strokeWidth:1.5,dashArray:[5,4]}),i.style.geom.rule.label({...R,fontSize:13}),i.style.gridLine({dashArray:[5,4]}),i.style.panelBorder({strokeWidth:0,cornerRadius:0}),i.style.panelBorder.left({stroke:p.text,strokeWidth:1,dashArray:[]}),i.style.panelBorder.bottom({stroke:p.text,strokeWidth:1,dashArray:[]}),i.style.tickLine({strokeWidth:0}),i.style.tickLabel({...v,fontSize:13,lineHeight:1}),i.style.axisLabel({...v,fontSize:12,lineHeight:1,letterSpacing:1,textTransform:"uppercase"}),i.style.axisLabel.top({margin:{bottom:14}}),i.style.heading({...R}),i.style.heading.h1({fontSize:19,lineHeight:1.15,letterSpacing:1.5,textTransform:"uppercase",textDecoration:"underline"}),i.style.heading.h2({...v,fontSize:15,lineHeight:1.2}),i.style.header({margin:{bottom:18}}),i.style.caption({...v,fontSize:12.5}),i.style.source({...v,fontSize:12.5}),i.style.source.link({...v,fontSize:12.5}),i.style.dataLabel({...R,fontSize:13,fill:"transparent",cornerRadius:0}),i.style.legendItem({...v,fontSize:13,fill:"transparent",stroke:"transparent"}),i.style.legend.popover({...H}),i.style.directLabel({fontWeight:400,fontSize:13}),i.style.headlineItem.number({...R}),i.style.headlineItem.caption({...v}),i.style.headlineItem.label({...v}),i.style.headlineItem.trend({fontWeight:400}),i.style.tooltip({...H,paddingInline:12,paddingBlock:9}),i.style.tooltip.heading({...R,fontSize:13,lineHeight:1.3,letterSpacing:1,textTransform:"uppercase"}),i.style.tooltip.label({...v,fontSize:13,lineHeight:1.4}),i.style.tooltip.value({...R,fontSize:13,lineHeight:1.4}),i.style.annotation.text({..._,paddingInline:4,paddingBlock:2,lineHeight:1.3}),i.style.annotation.pinnedNumber({fill:y.red,stroke:p.paper,shadow:"none"}),i.style.annotation.pinnedNumber.label({..._}),i.style.annotation.comment({fill:y.red,stroke:p.paper,shadow:"none"}),i.style.annotation.comment.label({..._}),i.style.annotation.differenceArrow({stroke:p.text,strokeWidth:1.5}),i.style.annotation.differenceArrow.label({..._}),i.style.annotation.arrow({stroke:p.text,strokeWidth:1.5,dashArray:[]}),i.style.annotation.shape({fill:p.text,fillAlpha:.06,stroke:p.secondary,strokeWidth:.75}),i.style.geom.area({fillAlpha:.45},{coord:"polar"}),i.style.panelBorder.left({strokeWidth:0},{coord:"polar"}),i.style.panelBorder.bottom({strokeWidth:0},{coord:"polar"}),i.style.tickLabel({textColor:p.text,fontSize:14,fontWeight:700,textOutlineColor:p.paper,textOutlineWidth:8},{coord:"polar"})]},pe=/[a-df-zA-DF-Z]|[-+]?(?:\d+\.?\d*|\.\d+)(?:[eE][-+]?\d+)?/gu,ge=/^[a-zA-Z]$/u,fe=(e,t)=>e==="H"?"x":e==="V"?"y":t%2===0?"x":"y",G=(e,t)=>{let r="",n=0;return(e.match(pe)??[]).map(a=>{if(ge.test(a))return r=a.toUpperCase(),n=0,a;const o=fe(r,n);return n+=1,String(Number(a)*(o==="x"?t.width:t.height))}).join(" ")},T=(e,t)=>{const r=(0,i.getX)(e),n=(0,i.getY)(e)??(0,i.getYMax)(e);return r===null||n===null?null:{x:(0,i.toViewBoxX)(r)*t.width,y:(0,i.toViewBoxY)(n)*t.height}},j=(e,t)=>{const r=(0,i.getX)(e),n=(0,i.getY)(e)??(0,i.getRadiusExtent)(e).outerRadius;if(r===null||n===null)return null;const a=(0,i.polarToUnit)(r,n),o=Math.min(t.width,t.height)/2;return{x:t.width/2+a.x*o,y:t.height/2-a.y*o}},ye=e=>`${e.map((t,r)=>`${r===0?"M":"L"}${t.x},${t.y}`).join(" ")} Z`,w=e=>{const t=(0,i.useGeomStyleReader)(e);return(r,n)=>({color:(0,i.toPaintColor)(t.get("fill",r,n)),opacity:t.get("alpha",r,n),fillOpacity:t.get("fillAlpha",r,n),edge:t.get("stroke",r,n),edgeWidth:t.get("strokeWidth",r,n)})},U=e=>{const t=(0,i.useGeomStyleReader)(e);return(r,n)=>{const a=t.get("strokeWidth",r,n);return{color:t.get("stroke",r,n),opacity:t.get("alpha",r,n)*t.get("strokeAlpha",r,n),width:a,dashArray:(0,i.toStrokeDasharray)(t.get("dashArray",r,n),a)}}},xe=1.3,E=[.72,.87,1],C=.35,me=.7,B=100,D=.7,ve=4,Ae=e=>{let t=2166136261;for(let r=0;r<e.length;r+=1)t^=e.charCodeAt(r),t=Math.imul(t,16777619);return t>>>0},L=(e,t,r,n)=>{let a=Math.imul(e^Math.imul(t,374761393)^Math.imul(r,668265263)^n,1274126177);return a=Math.imul(a^a>>>13,1103515245),((a^a>>>16)>>>0)/4294967296},x=e=>Math.round(e*B)/B,Z=(e,t,r,n,a)=>{const o=x(t-n/2),d=x(t+n/2),l=x(r-a/2),h=x(r+a/2),c=`M${o},${l}L${d},${h}M${d},${l}L${o},${h}`;if(e==="x"||e==="X"&&n<ve)return c;if(e==="X"){const f=(m,P)=>`M${x(m-D)},${P}L${x(m+D)},${P}`;return`${c}${f(o,l)}${f(d,l)}${f(o,h)}${f(d,h)}`}if(e==="/")return`M${o},${h}L${d},${l}`;if(e==="_")return`M${o},${x(r)}L${d},${x(r)}`;if(e==="|")return`M${x(t)},${l}L${x(t)},${h}`;const g=x(n/2),u=x(a/2);return`M${o},${x(r)}a${g},${u} 0 1,0 ${x(n)},0a${g},${u} 0 1,0 ${-x(n)},0`},W=e=>{const t=Ae(e);return(r,n,a,o,d,l,h)=>{const c=(L(t,l,h,1)*2-1)*C,g=(L(t,l,h,2)*2-1)*C,u=Math.floor(L(t,l,h,3)*E.length);return{path:Z(r,n+c,a+g,o,d),weight:u}}},M=(e,t,r,n,a)=>({path:Z(e,t,r,n,a),weight:E.length-1}),S=e=>`${e}-${(0,k.useId)().replace(/[^a-zA-Z0-9]/gu,"")}`,A=({strikes:e,color:t,opacity:r=1,width:n=xe,isOverstruck:a=!1})=>e.length===0?null:(0,s.jsxs)("g",{fill:"none",stroke:t,strokeWidth:n,strokeLinecap:"round",opacity:r,children:[E.map((o,d)=>e.filter(l=>l.weight===d).map(l=>l.path).join("")).map((o,d)=>o===""?null:(0,s.jsx)("path",{d:o,strokeOpacity:E[d]},E[d])),a&&(0,s.jsx)("path",{d:e.map(o=>o.path).join(""),transform:`translate(${me},0)`})]}),z=6,ke=14,Re=1.5,N=10,Me=1.8,b=(e,t,r,n)=>{const a=(0,i.createStableKeyGenerator)(e.data,e.mapping,e.id),o=[];return e.data.groupBy(i.GROUP_VARIABLES.group).forEach(d=>{const l=[...d],[h]=l,c=t(l);if(h===void 0||c===null)return;const g=l.flatMap(u=>r(u,n)??[]);o.push({key:a(h),observation:h,path:c,readings:g})}),o},q=(e,t)=>{const r=e.flatMap(n=>{const a=(0,i.getX)(n),o=j(n,t);return a===null||o===null?[]:[{angle:a,point:o}]}).sort((n,a)=>n.angle-a.angle).map(({point:n})=>n);return r.length===0?null:ye(r)},je=e=>e.every((t,r)=>{const n=e[r+1];return n===void 0||Math.hypot(n.x-t.x,n.y-t.y)>=ke}),we=({readings:e,color:t,opacity:r})=>je(e)?(0,s.jsx)(A,{strikes:e.map(({x:n,y:a})=>M("x",n,a,z,z)),color:t,opacity:r,width:Re}):null,J=({geom:e,observation:t,panel:r,project:n,color:a,opacity:o})=>{const d=n(t,r);return d===null?null:(0,s.jsx)("g",{"data-geom":e,children:(0,s.jsx)(A,{strikes:[M("X",d.x,d.y,N,N)],color:a,opacity:o,width:Me,isOverstruck:!0})})},Q=.55,Se=1.5,ee=(e,t,r={x:0,y:0,...e})=>{const n=W(t),a=[],o=Math.max(0,Math.floor((e.height-r.y-r.height)/12-.5)),d=Math.min(Math.ceil(e.height/12),Math.ceil((e.height-r.y)/12)),l=Math.max(0,Math.floor(r.x/8)),h=Math.min(Math.ceil(e.width/8),Math.ceil((r.x+r.width)/8));for(let c=o;c<d;c+=1){const g=e.height-(c+.5)*12;for(let u=l;u<h;u+=1)a.push(n("/",(u+.5)*8,g,5,8,u,c))}return a},te=({layer:e,coordSystem:t,panel:r})=>{const n=w(e),a=S("typewriter-area"),o=(0,k.useMemo)(()=>{if(t===void 0)return b(e,c=>q(c,r),j,r).map(c=>({...c,fill:c.path,edge:c.path}));const{areaGenerator:d,lineGenerator:l}=(0,i.createAreaPathGenerators)(t,e.params),h=new Map;return b(e,c=>{const g=(0,i.prepareAreaObservations)(c,e.params.missingValues),u=d(g),f=l(g);if(!u)return null;const m=G(u,r);return f&&h.set(m,G(f,r)),m},T,r).map(c=>({...c,fill:c.path,edge:h.get(c.path)??""}))},[e,t,r]);return r.width<=0||r.height<=0?null:(0,s.jsx)("g",{"data-geom":"area",children:o.map(({key:d,observation:l,fill:h,edge:c},g)=>{const u=n(l);return(0,s.jsxs)("g",{opacity:u.opacity,children:[(0,s.jsx)("clipPath",{id:`${a}-${g}`,children:(0,s.jsx)("path",{d:h})}),(0,s.jsx)("path",{d:h,fill:p.paper}),(0,s.jsx)("path",{d:h,fill:u.color,fillOpacity:u.fillOpacity*Q}),(0,s.jsx)("g",{clipPath:`url(#${a}-${g})`,children:(0,s.jsx)(A,{strikes:ee(r,d),color:u.color,opacity:u.fillOpacity})}),(0,s.jsx)("path",{d:c,fill:"none",stroke:u.color,strokeWidth:Se,strokeLinejoin:"round",strokeLinecap:"round"})]},d)})})},re=({layer:e,observation:t,panel:r,project:n})=>{const a=w(e)(t,"hovered");return(0,s.jsx)(J,{geom:"area",observation:t,panel:r,project:n,color:a.color,opacity:a.opacity})},Ee=(0,i.defineGeomRenderer)("area",{coord:"cartesian",guideMode:"crosshair",swatchShape:"area",render:({layer:e,coordSystem:t,panelRect:r})=>t.type!=="cartesian"?null:(0,s.jsx)(te,{layer:e,coordSystem:t,panel:r}),renderHover:({layer:e,primary:t,panelRect:r})=>(0,s.jsx)(re,{layer:e,observation:t.observation,panel:r,project:T}),renderHoverCompanions:()=>null}),Te=(0,i.defineGeomRenderer)("area",{coord:"polar",guideMode:"crosshair",swatchShape:"area",render:({layer:e,panelRect:t})=>(0,s.jsx)(te,{layer:e,panel:t}),renderHover:({layer:e,primary:t,panelRect:r})=>(0,s.jsx)(re,{layer:e,observation:t.observation,panel:r,project:j}),renderHoverCompanions:()=>null}),Pe=2,ne=1.8,_e=1,$e=3.3,Ie={solo:{base:!0,value:!0},floor:{base:!0,value:!1},ceiling:{base:!1,value:!0},middle:{base:!1,value:!1}},be={top:"bottom",bottom:"top",left:"right",right:"left"},We=(e,t)=>t==="x"?((0,i.getYMax)(e)??(0,i.getY)(e)??0)>=((0,i.getYMin)(e)??0)?"top":"bottom":((0,i.getXMax)(e)??0)>=((0,i.getXMin)(e)??0)?"right":"left",Le=(e,t,r)=>{const n=Math.max(0,e.width-r),a=Math.max(0,e.height-r);return t==="top"?{...e,y:e.y+e.height-a,height:a}:t==="bottom"?{...e,height:a}:t==="left"?{...e,x:e.x+e.width-n,width:n}:{...e,width:n}},O=(e,t)=>{const r=Math.max(1,Math.round(e/t));return{count:r,size:e/r}},X=(e,t,r)=>{const n=[];for(let a=$e+r/2;a-r/2<e;a+=t)n.push(a);return n},Ge=(e,t,r)=>{const n=W(r),a=t==="top"||t==="bottom",o=a?O(e.width,8):O(e.height,12),d=a?Math.min(5,o.size-2):5,l=a?8:Math.max(1,Math.min(8,o.size-4));return(a?X(e.height,12,8):X(e.width,8,5)).flatMap((h,c)=>Array.from({length:o.count},(g,u)=>{const f=(u+.5)*o.size;if(t==="top")return n("X",e.x+f,e.y+h,d,l,u,c);if(t==="bottom")return n("X",e.x+f,e.y+e.height-h,d,l,u,c);const m=t==="right"?e.x+e.width-h:e.x+h;return n("X",m,e.y+f,d,l,c,u)}))},Oe=(e,t)=>{const r=t==="top"||t==="bottom",n=O(r?e.width:e.height,r?8:12),a=Math.max(1,n.size-_e),o=ne/2;return Array.from({length:n.count},(d,l)=>{const h=(l+.5)*n.size;return t==="top"?M("_",e.x+h,e.y+o,a,0):t==="bottom"?M("_",e.x+h,e.y+e.height-o,a,0):M("|",t==="right"?e.x+e.width-o:e.x+o,e.y+h,0,a)})},He=({layer:e,observation:t,seed:r,mainAxis:n,panel:a,clipId:o,state:d})=>{const l=w(e),h=(0,i.getBarRectBounds)(n,t);if(!h||h.width<=0||h.height<=0)return null;const c=l(t,d),g=Ie[(0,i.getStackRole)(t)],u=We(t,n),f={x:h.x*a.width,y:h.y*a.height,width:h.width*a.width,height:h.height*a.height},m=[g.value?[]:[u],g.base?[]:[be[u]]].flat().reduce((P,se)=>Le(P,se,Pe/2),f);return m.width<=0||m.height<=0?null:(0,s.jsx)(ae,{rect:m,edge:u,seed:r,clipId:o,color:c.color,opacity:c.opacity,pressure:c.fillOpacity,isOverstruck:d==="hovered"})},ae=({rect:e,edge:t,seed:r,clipId:n,color:a,opacity:o,pressure:d,isOverstruck:l})=>(0,s.jsxs)("g",{opacity:o,children:[(0,s.jsx)("clipPath",{id:n,children:(0,s.jsx)("rect",{...e})}),(0,s.jsx)("rect",{...e,fill:p.paper}),(0,s.jsx)("g",{clipPath:`url(#${n})`,children:(0,s.jsx)(A,{strikes:Ge(e,t,r),color:a,opacity:d,isOverstruck:l})}),(0,s.jsx)(A,{strikes:Oe(e,t),color:a,width:ne,isOverstruck:l})]}),K=({layer:e,observations:t,mainAxis:r,panel:n,state:a})=>{const o=S("typewriter-bar"),d=(0,k.useMemo)(()=>(0,i.createStableKeyGenerator)(e.data,e.mapping,e.id),[e.data,e.mapping,e.id]);return n.width<=0||n.height<=0?null:(0,s.jsx)("g",{"data-geom":"bar",children:Array.from(t,(l,h)=>{const c=d(l);return(0,s.jsx)(He,{layer:e,observation:l,seed:c,mainAxis:r,panel:n,clipId:`${o}-${h}`,state:a},c)})})},Ce=(0,i.defineGeomRenderer)("bar",{coord:"cartesian",guideMode:"band",swatchShape:"square",render:({layer:e,coordSystem:t,panelRect:r})=>(0,s.jsx)(K,{layer:e,observations:e.data,mainAxis:(0,i.readMainAxis)(t),panel:r}),renderHover:({layer:e,coordSystem:t,primary:r,panelRect:n})=>(0,s.jsx)(K,{layer:e,observations:[r.observation],mainAxis:(0,i.readMainAxis)(t),panel:n,state:"hovered"}),renderHoverCompanions:()=>null}),Be=({layer:e,panel:t,coord:r})=>{const n=U(e),a=(0,k.useMemo)(()=>{if(r==="polar")return b(e,d=>q(d,t),j,t);const o=(0,i.createLinePathGenerator)(e.params);return b(e,d=>{const l=o((0,i.prepareLineObservations)(d,e.params.missingValues));return l?G(l,t):null},T,t)},[e,t,r]);return t.width<=0||t.height<=0?null:(0,s.jsx)("g",{"data-geom":"line",children:a.map(({key:o,path:d,observation:l,readings:h})=>{const c=n(l);return(0,s.jsxs)("g",{children:[(0,s.jsx)("path",{d,fill:"none",stroke:c.color,strokeOpacity:c.opacity,strokeWidth:c.width,strokeDasharray:c.dashArray,strokeLinejoin:"round",strokeLinecap:"round"}),(0,s.jsx)(we,{readings:h,color:c.color,opacity:c.opacity})]},o)})})},De=({layer:e,observation:t,panel:r,project:n})=>{const a=U(e)(t,"hovered");return(0,s.jsx)(J,{geom:"line",observation:t,panel:r,project:n,color:a.color,opacity:a.opacity})},ie=(e,t)=>(0,i.defineGeomRenderer)("line",{coord:e,guideMode:"crosshair",swatchShape:"line",render:({layer:r,panelRect:n})=>(0,s.jsx)(Be,{layer:r,panel:n,coord:e}),renderHover:({layer:r,primary:n,panelRect:a})=>(0,s.jsx)(De,{layer:r,observation:n.observation,panel:a,project:t}),renderHoverCompanions:()=>null,getOverlayAnchor:({observation:r})=>{const n=(0,i.getX)(r),a=(0,i.getY)(r);return n===null||a===null?null:{x:n,y:a}}}),ze=ie("cartesian",T),Ne=ie("polar",j),Xe=.85,Ke=1.6,Ye=4,Y=({layer:e,observations:t,panel:r,project:n,state:a})=>{const o=(0,i.useGeomStyleReader)(e),d=w(e),l=(0,k.useMemo)(()=>(0,i.createStableKeyGenerator)(e.data,e.mapping,e.id),[e.data,e.mapping,e.id]),h=a==="hovered",c=h?Ye:0;return(0,s.jsx)("g",{"data-geom":"point",children:Array.from(t,g=>{const u=n(g,r);if(u===null)return null;const f=d(g,a),m=o.get("size",g,a)+c;return(0,s.jsx)(A,{strikes:[M("o",u.x,u.y,m*Xe,m)],color:f.color,opacity:f.opacity,width:Ke,isOverstruck:h},l(g))})})},oe=(e,t)=>(0,i.defineGeomRenderer)("point",{coord:e,swatchShape:"circle",render:({layer:r,panelRect:n})=>(0,s.jsx)(Y,{layer:r,observations:r.data,panel:n,project:t}),renderHover:({layer:r,primary:n,panelRect:a})=>(0,s.jsx)(Y,{layer:r,observations:[n.observation],panel:a,project:t,state:"hovered"}),renderHoverCompanions:()=>null}),Fe=oe("cartesian",T),Ve=oe("polar",j),Ue=4,Ze=1.2,qe=3,I=Math.PI*2,Je=.3,Qe=(e,t)=>{const{startAngle:r,endAngle:n}=(0,i.getAngleExtent)(e),{innerRadius:a,outerRadius:o}=(0,i.getRadiusExtent)(e);if(r===null||n===null||a===null||o===null)return null;const d=Math.min(t.width,t.height)/2;if(d<=0||o<=0)return null;const l=Math.max(0,n-r),h=Ue/2/(o*d),c=l>=I-1e-6?0:Math.min(h,l/4),g=r+c,u=n-c,f=(0,i.buildPolarBarArcPath)({startAngle:g,endAngle:u,innerRadius:a,outerRadius:o},{centerX:t.width/2,centerY:t.height/2,radius:d,digits:qe});return f===void 0?null:{path:f,startAngle:g,endAngle:u,inner:a*d,outer:o*d}},et=(e,t,r,n)=>{const a=Math.hypot(t,r);if(a>e.outer-n||a<e.inner+n)return!1;const o=((Math.atan2(t,-r)-e.startAngle)%I+I)%I,d=n/Math.max(a,1);return o>=d&&o<=e.endAngle-e.startAngle-d},tt=(e,t,r)=>{const n=W(r),a=Math.ceil(e.outer/8)+1,o=Math.ceil(e.outer/12)+1,d=-Math.hypot(8,12)/2,l=[];for(let h=-o;h<=o;h+=1)for(let c=-a;c<=a;c+=1){const g=c*8,u=h*12;et(e,g,u,d)&&l.push(n("/",t.width/2+g,t.height/2+u,5,8,c,h))}return l},F=({layer:e,observations:t,panel:r,state:n})=>{const a=w(e),o=S("slice-shading"),d=(0,k.useMemo)(()=>(0,i.createStableKeyGenerator)(e.data,e.mapping,e.id),[e.data,e.mapping,e.id]);return r.width<=0||r.height<=0?null:(0,s.jsx)("g",{"data-geom":"bar",children:Array.from(t,l=>{const h=Qe(l,r);if(h===null)return null;const c=d(l),g=a(l,n),u=`${o}-${c.replace(/[^a-zA-Z0-9]/gu,"")}`;return(0,s.jsxs)("g",{opacity:g.opacity,children:[(0,s.jsx)("path",{d:h.path,fill:p.paper}),(0,s.jsxs)("g",{children:[(0,s.jsx)("clipPath",{id:u,children:(0,s.jsx)("path",{d:h.path})}),(0,s.jsx)("path",{d:h.path,fill:g.color,fillOpacity:g.fillOpacity*Je}),(0,s.jsx)("g",{clipPath:`url(#${u})`,children:(0,s.jsx)(A,{strikes:tt(h,r,c),color:g.color,opacity:g.fillOpacity,isOverstruck:n==="hovered"})})]}),(0,s.jsx)("path",{d:h.path,fill:"none",stroke:g.color,strokeWidth:Ze,strokeLinejoin:"round"})]},c)})})},rt=(0,i.defineGeomRenderer)("bar",{coord:"polar",guideMode:"band",swatchShape:"slice",render:({layer:e,panelRect:t})=>(0,s.jsx)(F,{layer:e,observations:e.data,panel:t}),renderHover:({layer:e,primary:t,panelRect:r})=>(0,s.jsx)(F,{layer:e,observations:[t.observation],panel:r,state:"hovered"}),renderHoverCompanions:()=>null}),$=2,nt=.2,at=(e,t)=>{const r=W(t),n=[],a=Math.floor(e.y/12),o=Math.floor(e.x/8);for(let d=a;d*12<e.y+e.height;d+=1)for(let l=o;l*8<e.x+e.width;l+=1){const h=(l+.5)*8,c=(d+.5)*12;n.push(r("X",h,c,5,8,l,d))}return n},it=({layer:e,observation:t,seed:r,panel:n,clipId:a,state:o})=>{const d=w(e),l=(0,i.getPaintedTileRect)(t);if(l===null)return null;const h=d(t,o),c={x:l.x*n.width+$/2,y:l.y*n.height+$/2,width:Math.max(0,l.width*n.width-$),height:Math.max(0,l.height*n.height-$)};return c.width<=0||c.height<=0?null:(0,s.jsxs)("g",{opacity:h.opacity,children:[(0,s.jsx)("clipPath",{id:a,children:(0,s.jsx)("rect",{...c})}),(0,s.jsx)("rect",{...c,fill:h.color,fillOpacity:h.fillOpacity}),(0,s.jsx)("g",{clipPath:`url(#${a})`,children:(0,s.jsx)(A,{strikes:at(c,r),color:p.paper,opacity:nt,isOverstruck:o==="hovered"})}),o==="hovered"&&(0,s.jsx)("rect",{...c,fill:"none",stroke:p.text,strokeWidth:h.edgeWidth})]})},V=({layer:e,observations:t,panel:r,state:n})=>{const a=S("typewriter-tile"),o=(0,k.useMemo)(()=>(0,i.createStableCellKeyGenerator)(e.data,e.mapping,e.id),[e.data,e.mapping,e.id]);return r.width<=0||r.height<=0?null:(0,s.jsx)("g",{"data-geom":"tile",children:Array.from(t,(d,l)=>{const h=o(d);return(0,s.jsx)(it,{layer:e,observation:d,seed:h,panel:r,clipId:`${a}-${l}`,state:n},h)})})},ot=(0,i.defineGeomRenderer)("tile",{coord:"cartesian",guideMode:null,swatchShape:"square",render:({layer:e,panelRect:t})=>(0,s.jsx)(V,{layer:e,observations:e.data,panel:t}),renderHover:({layer:e,primary:t,panelRect:r})=>(0,s.jsx)(V,{layer:e,observations:[t.observation],panel:r,state:"hovered"}),renderHoverCompanions:()=>null}),st=[Ce,rt,ot,ze,Ne,Ee,Te,Fe,Ve],lt=e=>{const t=S("typewriter-rect"),r=(0,i.useGeomPanelSize)(),n=r===null?null:(0,i.readRectPixels)(e,r);return n===null||e.fill===void 0?(0,s.jsx)(i.DefaultGeomRect,{...e}):n.width<=0||n.height<=0?null:(0,s.jsx)("g",{"data-testid":e["data-testid"],children:(0,s.jsx)(ae,{rect:n,edge:"top",seed:`${n.x},${n.y}`,clipId:t,color:e.fill,opacity:e.opacity??1,pressure:e.fillOpacity??1,isOverstruck:!1})})},dt=e=>{const t=(e.match(/-?\d*\.?\d+(?:e-?\d+)?/giu)??[]).map(Number),r=t.filter((d,l)=>l%2===0),n=t.filter((d,l)=>l%2===1);if(r.length===0||n.length===0)return null;const a=Math.min(...r),o=Math.min(...n);return{x:a,y:o,width:Math.max(...r)-a,height:Math.max(...n)-o}},ht=e=>{const t=S("typewriter-path"),r=(0,i.useGeomPanelSize)(),n=(0,k.useMemo)(()=>{const o=dt(e.d);return r===null||o===null?null:ee(r,e.d,o)},[r,e.d]);if(n===null||e.fill===void 0||e.fill.startsWith("url("))return(0,s.jsx)(i.DefaultGeomPath,{...e});const a=e.fillOpacity??1;return(0,s.jsxs)("g",{"data-testid":e["data-testid"],opacity:e.opacity??1,children:[(0,s.jsx)("clipPath",{id:t,children:(0,s.jsx)("path",{d:e.d})}),(0,s.jsx)("path",{d:e.d,fill:p.paper}),(0,s.jsx)("path",{d:e.d,fill:e.fill,fillOpacity:a*Q}),(0,s.jsx)("g",{clipPath:`url(#${t})`,children:(0,s.jsx)(A,{strikes:n,color:e.fill,opacity:a})})]})},ct={Rect:lt,Path:ht},ut={name:"typewriter",styles:ue,palettes:{categorical:de,sequential:he,diverging:ce},config:{axes:{y:{position:"left"}}},colorScheme:"light",plugins:st,shapes:ct};exports.typewriter=ut;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});let A=require("react"),i=require("@graphysdk/react"),s=require("react/jsx-runtime");var g={paper:"#EBD9A9",card:"#F8F0D8",text:"#1F1B16",secondary:"#4A443A",grid:"rgba(31, 27, 22, 0.4)",edge:"#C4AE74"},le="'Special Elite', 'Courier New', ui-monospace, monospace",y={black:"#1F1B16",red:"#B3271E",carbonBlue:"#2F4F8F",pencilGrey:"#6E6A62",stampGreen:"#2E6B4B",duplicatorViolet:"#7B5A9C"},de=[y.black,y.red,y.carbonBlue,y.pencilGrey,y.stampGreen,y.duplicatorViolet],he=["#D6C18B",y.black],ce=[y.carbonBlue,"#DECEA4",y.red],R={fontWeight:400,textColor:g.text},_={...R,fontSize:13,fill:g.paper,stroke:"transparent",strokeWidth:0,cornerRadius:0,paddingInline:3,paddingBlock:1,shadow:"none"},v={fontWeight:400,textColor:g.secondary},H={fill:g.card,stroke:g.text,strokeWidth:1,cornerRadius:0,shadow:"none"},ue={tokens:{graphBackground:g.paper,graphBorder:g.edge,geomBorder:g.text,textPrimary:g.text,textSecondary:g.secondary,ruleLine:g.text,gridLine:g.grid,hoverAffordance:g.paper,hoverGuideFill:"rgba(31, 27, 22, 0.07)",hoverGuideLine:g.secondary,tooltipBackground:g.card,tooltipBorder:g.text,tooltipPrimaryRow:"rgba(31, 27, 22, 0.08)",annotationShape:y.red,annotationArrow:g.text,differenceLabelBackground:g.card,trendPositive:y.black,trendNegative:y.red,trendNeutral:y.pencilGrey},defaults:[i.style.graph({strokeWidth:1,cornerRadius:0,fontFamily:le,fontWeight:400,padding:24}),i.style.geom({shadow:"none"}),i.style.geom({shadow:"none"},{state:"hovered"}),i.style.geom.bar({stroke:g.text,strokeWidth:1,cornerRadius:"none"}),i.style.geom.line({strokeWidth:2,dashArray:[],lineCap:"butt",lineJoin:"miter"}),i.style.geom.area({fillAlpha:.6,strokeWidth:1.5,dashArray:[],lineCap:"butt",lineJoin:"miter"}),i.style.geom.point({size:9,stroke:g.paper,strokeWidth:1.5}),i.style.geom.tile({cornerRadius:0,stroke:g.paper,strokeWidth:2}),i.style.geom.rule({stroke:y.red,strokeWidth:1.5,dashArray:[5,4]}),i.style.geom.rule.label({...R,fontSize:13}),i.style.gridLine({dashArray:[5,4]}),i.style.panelBorder({strokeWidth:0,cornerRadius:0}),i.style.panelBorder.left({stroke:g.text,strokeWidth:1,dashArray:[]}),i.style.panelBorder.bottom({stroke:g.text,strokeWidth:1,dashArray:[]}),i.style.tickLine({strokeWidth:0}),i.style.tickLabel({...v,fontSize:13,lineHeight:1}),i.style.axisLabel({...v,fontSize:12,lineHeight:1,letterSpacing:1,textTransform:"uppercase"}),i.style.axisLabel.top({margin:{bottom:14}}),i.style.heading({...R}),i.style.heading.h1({fontSize:19,lineHeight:1.15,letterSpacing:1.5,textTransform:"uppercase",textDecoration:"underline"}),i.style.heading.h2({...v,fontSize:15,lineHeight:1.2}),i.style.header({margin:{bottom:18}}),i.style.caption({...v,fontSize:12.5}),i.style.source({...v,fontSize:12.5}),i.style.source.link({...v,fontSize:12.5}),i.style.dataLabel({...R,fontSize:13,fill:"transparent",cornerRadius:0}),i.style.legendItem({...v,fontSize:13,fill:"transparent",stroke:"transparent"}),i.style.legend.popover({...H}),i.style.directLabel({fontWeight:400,fontSize:13}),i.style.headlineItem.number({...R}),i.style.headlineItem.caption({...v}),i.style.headlineItem.label({...v}),i.style.headlineItem.trend({fontWeight:400}),i.style.tooltip({...H,paddingInline:12,paddingBlock:9}),i.style.tooltip.heading({...R,fontSize:13,lineHeight:1.3,letterSpacing:1,textTransform:"uppercase"}),i.style.tooltip.label({...v,fontSize:13,lineHeight:1.4}),i.style.tooltip.value({...R,fontSize:13,lineHeight:1.4}),i.style.annotation.text({..._,paddingInline:4,paddingBlock:2,lineHeight:1.3}),i.style.annotation.pinnedNumber({fill:y.red,stroke:g.paper,shadow:"none"}),i.style.annotation.pinnedNumber.label({..._}),i.style.annotation.comment({fill:y.red,stroke:g.paper,shadow:"none"}),i.style.annotation.comment.label({..._}),i.style.annotation.differenceArrow({stroke:g.text,strokeWidth:1.5}),i.style.annotation.differenceArrow.label({..._}),i.style.annotation.arrow({stroke:g.text,strokeWidth:1.5,dashArray:[]}),i.style.annotation.shape({fill:g.text,fillAlpha:.06,stroke:g.secondary,strokeWidth:.75}),i.style.geom.area({fillAlpha:.45},{coord:"polar"}),i.style.panelBorder.left({strokeWidth:0},{coord:"polar"}),i.style.panelBorder.bottom({strokeWidth:0},{coord:"polar"}),i.style.tickLabel({textColor:g.text,fontSize:14,fontWeight:700,textOutlineColor:g.paper,textOutlineWidth:8},{coord:"polar"})]},pe=/[a-df-zA-DF-Z]|[-+]?(?:\d+\.?\d*|\.\d+)(?:[eE][-+]?\d+)?/gu,ge=/^[a-zA-Z]$/u,fe=(e,t)=>e==="H"?"x":e==="V"?"y":t%2===0?"x":"y",G=(e,t)=>{let r="",n=0;return(e.match(pe)??[]).map(a=>{if(ge.test(a))return r=a.toUpperCase(),n=0,a;const o=fe(r,n);return n+=1,String(Number(a)*(o==="x"?t.width:t.height))}).join(" ")},T=(e,t)=>{const r=(0,i.getX)(e),n=(0,i.getY)(e)??(0,i.getYMax)(e);return r===null||n===null?null:{x:(0,i.toViewBoxX)(r)*t.width,y:(0,i.toViewBoxY)(n)*t.height}},j=(e,t)=>{const r=(0,i.getX)(e),n=(0,i.getY)(e)??(0,i.getRadiusExtent)(e).outerRadius;if(r===null||n===null)return null;const a=(0,i.polarToUnit)(r,n),o=Math.min(t.width,t.height)/2;return{x:t.width/2+a.x*o,y:t.height/2-a.y*o}},ye=e=>`${e.map((t,r)=>`${r===0?"M":"L"}${t.x},${t.y}`).join(" ")} Z`,w=e=>{const t=(0,i.useGeomStyleReader)(e);return(r,n)=>({color:(0,i.toPaintColor)(t.get("fill",r,n)),opacity:t.get("alpha",r,n),fillOpacity:t.get("fillAlpha",r,n),edge:t.get("stroke",r,n),edgeWidth:t.get("strokeWidth",r,n)})},U=e=>{const t=(0,i.useGeomStyleReader)(e);return(r,n)=>{const a=t.get("strokeWidth",r,n);return{color:t.get("stroke",r,n),opacity:t.get("alpha",r,n)*t.get("strokeAlpha",r,n),width:a,dashArray:(0,i.toStrokeDasharray)(t.get("dashArray",r,n),a)}}},xe=1.3,E=[.72,.87,1],C=.35,me=.7,B=100,D=.7,ve=4,Ae=e=>{let t=2166136261;for(let r=0;r<e.length;r+=1)t^=e.charCodeAt(r),t=Math.imul(t,16777619);return t>>>0},b=(e,t,r,n)=>{let a=Math.imul(e^Math.imul(t,374761393)^Math.imul(r,668265263)^n,1274126177);return a=Math.imul(a^a>>>13,1103515245),((a^a>>>16)>>>0)/4294967296},x=e=>Math.round(e*B)/B,Z=(e,t,r,n,a)=>{const o=x(t-n/2),d=x(t+n/2),l=x(r-a/2),c=x(r+a/2),h=`M${o},${l}L${d},${c}M${d},${l}L${o},${c}`;if(e==="x"||e==="X"&&n<ve)return h;if(e==="X"){const f=(m,P)=>`M${x(m-D)},${P}L${x(m+D)},${P}`;return`${h}${f(o,l)}${f(d,l)}${f(o,c)}${f(d,c)}`}if(e==="/")return`M${o},${c}L${d},${l}`;if(e==="_")return`M${o},${x(r)}L${d},${x(r)}`;if(e==="|")return`M${x(t)},${l}L${x(t)},${c}`;const p=x(n/2),u=x(a/2);return`M${o},${x(r)}a${p},${u} 0 1,0 ${x(n)},0a${p},${u} 0 1,0 ${-x(n)},0`},L=e=>{const t=Ae(e);return(r,n,a,o,d,l,c)=>{const h=(b(t,l,c,1)*2-1)*C,p=(b(t,l,c,2)*2-1)*C,u=Math.floor(b(t,l,c,3)*E.length);return{path:Z(r,n+h,a+p,o,d),weight:u}}},M=(e,t,r,n,a)=>({path:Z(e,t,r,n,a),weight:E.length-1}),S=e=>`${e}-${(0,A.useId)().replace(/[^a-zA-Z0-9]/gu,"")}`,k=({strikes:e,color:t,opacity:r=1,width:n=xe,isOverstruck:a=!1})=>e.length===0?null:(0,s.jsxs)("g",{fill:"none",stroke:t,strokeWidth:n,strokeLinecap:"round",opacity:r,children:[E.map((o,d)=>e.filter(l=>l.weight===d).map(l=>l.path).join("")).map((o,d)=>o===""?null:(0,s.jsx)("path",{d:o,strokeOpacity:E[d]},E[d])),a&&(0,s.jsx)("path",{d:e.map(o=>o.path).join(""),transform:`translate(${me},0)`})]}),z=6,ke=14,Re=1.5,N=10,Me=1.8,W=(e,t,r,n)=>{const a=(0,i.createStableKeyGenerator)(e.data,e.mapping,e.id),o=[];return e.data.groupBy(i.GROUP_VARIABLES.group).forEach(d=>{const l=[...d],[c]=l,h=t(l);if(c===void 0||h===null)return;const p=l.flatMap(u=>r(u,n)??[]);o.push({key:a(c),observation:c,path:h,readings:p})}),o},q=(e,t)=>{const r=e.flatMap(n=>{const a=(0,i.getX)(n),o=j(n,t);return a===null||o===null?[]:[{angle:a,point:o}]}).sort((n,a)=>n.angle-a.angle).map(({point:n})=>n);return r.length===0?null:ye(r)},je=e=>e.every((t,r)=>{const n=e[r+1];return n===void 0||Math.hypot(n.x-t.x,n.y-t.y)>=ke}),we=({readings:e,color:t,opacity:r})=>je(e)?(0,s.jsx)(k,{strikes:e.map(({x:n,y:a})=>M("x",n,a,z,z)),color:t,opacity:r,width:Re}):null,J=({geom:e,observation:t,panel:r,project:n,color:a,opacity:o})=>{const d=n(t,r);return d===null?null:(0,s.jsx)("g",{"data-geom":e,children:(0,s.jsx)(k,{strikes:[M("X",d.x,d.y,N,N)],color:a,opacity:o,width:Me,isOverstruck:!0})})},Q=.55,Se=1.5,ee=(e,t,r={x:0,y:0,...e})=>{const n=L(t),a=[],o=Math.max(0,Math.floor((e.height-r.y-r.height)/12-.5)),d=Math.min(Math.ceil(e.height/12),Math.ceil((e.height-r.y)/12)),l=Math.max(0,Math.floor(r.x/8)),c=Math.min(Math.ceil(e.width/8),Math.ceil((r.x+r.width)/8));for(let h=o;h<d;h+=1){const p=e.height-(h+.5)*12;for(let u=l;u<c;u+=1)a.push(n("/",(u+.5)*8,p,5,8,u,h))}return a},te=({layer:e,coordSystem:t,panel:r})=>{const n=w(e),a=S("typewriter-area"),o=(0,A.useMemo)(()=>{if(t===void 0)return W(e,h=>q(h,r),j,r).map(h=>({...h,fill:h.path,edge:h.path}));const{areaGenerator:d,lineGenerator:l}=(0,i.createAreaPathGenerators)(t,e.params),c=new Map;return W(e,h=>{const p=(0,i.prepareAreaObservations)(h,e.params.missingValues),u=d(p),f=l(p);if(!u)return null;const m=G(u,r);return f&&c.set(m,G(f,r)),m},T,r).map(h=>({...h,fill:h.path,edge:c.get(h.path)??""}))},[e,t,r]);return r.width<=0||r.height<=0?null:(0,s.jsx)("g",{"data-geom":"area",children:o.map(({key:d,observation:l,fill:c,edge:h},p)=>{const u=n(l);return(0,s.jsxs)("g",{opacity:u.opacity,children:[(0,s.jsx)("clipPath",{id:`${a}-${p}`,children:(0,s.jsx)("path",{d:c})}),(0,s.jsx)("path",{d:c,fill:g.paper}),(0,s.jsx)("path",{d:c,fill:u.color,fillOpacity:u.fillOpacity*Q}),(0,s.jsx)("g",{clipPath:`url(#${a}-${p})`,children:(0,s.jsx)(k,{strikes:ee(r,d),color:u.color,opacity:u.fillOpacity})}),(0,s.jsx)("path",{d:h,fill:"none",stroke:u.color,strokeWidth:Se,strokeLinejoin:"round",strokeLinecap:"round"})]},d)})})},re=({layer:e,observation:t,panel:r,project:n})=>{const a=w(e)(t,"hovered");return(0,s.jsx)(J,{geom:"area",observation:t,panel:r,project:n,color:a.color,opacity:a.opacity})},Ee=(0,i.defineGeomRenderer)("area",{coord:"cartesian",guideMode:"crosshair",swatchShape:"area",render:({layer:e,coordSystem:t,panelRect:r})=>t.type!=="cartesian"?null:(0,s.jsx)(te,{layer:e,coordSystem:t,panel:r}),renderHover:({layer:e,primary:t,panelRect:r})=>(0,s.jsx)(re,{layer:e,observation:t.observation,panel:r,project:T}),renderHoverCompanions:()=>null}),Te=(0,i.defineGeomRenderer)("area",{coord:"polar",guideMode:"crosshair",swatchShape:"area",render:({layer:e,panelRect:t})=>(0,s.jsx)(te,{layer:e,panel:t}),renderHover:({layer:e,primary:t,panelRect:r})=>(0,s.jsx)(re,{layer:e,observation:t.observation,panel:r,project:j}),renderHoverCompanions:()=>null}),Pe=2,ne=1.8,_e=1,$e=3.3,Ie={solo:{base:!0,value:!0},floor:{base:!0,value:!1},ceiling:{base:!1,value:!0},middle:{base:!1,value:!1}},We={top:"bottom",bottom:"top",left:"right",right:"left"},Le=(e,t)=>t==="x"?((0,i.getYMax)(e)??(0,i.getY)(e)??0)>=((0,i.getYMin)(e)??0)?"top":"bottom":((0,i.getXMax)(e)??0)>=((0,i.getXMin)(e)??0)?"right":"left",be=(e,t,r)=>{const n=Math.max(0,e.width-r),a=Math.max(0,e.height-r);return t==="top"?{...e,y:e.y+e.height-a,height:a}:t==="bottom"?{...e,height:a}:t==="left"?{...e,x:e.x+e.width-n,width:n}:{...e,width:n}},O=(e,t)=>{const r=Math.max(1,Math.round(e/t));return{count:r,size:e/r}},X=(e,t,r)=>{const n=[];for(let a=$e+r/2;a-r/2<e;a+=t)n.push(a);return n},Ge=(e,t,r)=>{const n=L(r),a=t==="top"||t==="bottom",o=a?O(e.width,8):O(e.height,12),d=a?Math.min(5,o.size-2):5,l=a?8:Math.max(1,Math.min(8,o.size-4));return(a?X(e.height,12,8):X(e.width,8,5)).flatMap((c,h)=>Array.from({length:o.count},(p,u)=>{const f=(u+.5)*o.size;if(t==="top")return n("X",e.x+f,e.y+c,d,l,u,h);if(t==="bottom")return n("X",e.x+f,e.y+e.height-c,d,l,u,h);const m=t==="right"?e.x+e.width-c:e.x+c;return n("X",m,e.y+f,d,l,h,u)}))},Oe=(e,t)=>{const r=t==="top"||t==="bottom",n=O(r?e.width:e.height,r?8:12),a=Math.max(1,n.size-_e),o=ne/2;return Array.from({length:n.count},(d,l)=>{const c=(l+.5)*n.size;return t==="top"?M("_",e.x+c,e.y+o,a,0):t==="bottom"?M("_",e.x+c,e.y+e.height-o,a,0):M("|",t==="right"?e.x+e.width-o:e.x+o,e.y+c,0,a)})},He=({layer:e,observation:t,bounds:r,seed:n,mainAxis:a,panel:o,clipId:d,state:l})=>{const c=w(e);if(!r||r.width<=0||r.height<=0)return null;const h=c(t,l),p=Ie[(0,i.getStackRole)(t)],u=Le(t,a),f={x:r.x*o.width,y:r.y*o.height,width:r.width*o.width,height:r.height*o.height},m=[p.value?[]:[u],p.base?[]:[We[u]]].flat().reduce((P,se)=>be(P,se,Pe/2),f);return m.width<=0||m.height<=0?null:(0,s.jsx)(ae,{rect:m,edge:u,seed:n,clipId:d,color:h.color,opacity:h.opacity,pressure:h.fillOpacity,isOverstruck:l==="hovered"})},ae=({rect:e,edge:t,seed:r,clipId:n,color:a,opacity:o,pressure:d,isOverstruck:l})=>(0,s.jsxs)("g",{opacity:o,children:[(0,s.jsx)("clipPath",{id:n,children:(0,s.jsx)("rect",{...e})}),(0,s.jsx)("rect",{...e,fill:g.paper}),(0,s.jsx)("g",{clipPath:`url(#${n})`,children:(0,s.jsx)(k,{strikes:Ge(e,t,r),color:a,opacity:d,isOverstruck:l})}),(0,s.jsx)(k,{strikes:Oe(e,t),color:a,width:ne,isOverstruck:l})]}),K=({layer:e,observations:t,mainAxis:r,panel:n,state:a})=>{const o=S("typewriter-bar"),d=(0,i.useGeomStyleReader)(e),l=(0,A.useMemo)(()=>(0,i.createStableKeyGenerator)(e.data,e.mapping,e.id),[e.data,e.mapping,e.id]),c=(0,A.useMemo)(()=>(0,i.createBarBoundsReader)(e,r,d,n),[e,r,d,n]);return n.width<=0||n.height<=0?null:(0,s.jsx)("g",{"data-geom":"bar",children:Array.from(t,(h,p)=>{const u=l(h);return(0,s.jsx)(He,{layer:e,observation:h,bounds:c(h),seed:u,mainAxis:r,panel:n,clipId:`${o}-${p}`,state:a},u)})})},Ce=(0,i.defineGeomRenderer)("bar",{coord:"cartesian",guideMode:"band",swatchShape:"square",render:({layer:e,coordSystem:t,panelRect:r})=>(0,s.jsx)(K,{layer:e,observations:e.data,mainAxis:(0,i.readMainAxis)(t),panel:r}),renderHover:({layer:e,coordSystem:t,primary:r,panelRect:n})=>(0,s.jsx)(K,{layer:e,observations:[r.observation],mainAxis:(0,i.readMainAxis)(t),panel:n,state:"hovered"}),renderHoverCompanions:()=>null}),Be=({layer:e,panel:t,coord:r})=>{const n=U(e),a=(0,A.useMemo)(()=>{if(r==="polar")return W(e,d=>q(d,t),j,t);const o=(0,i.createLinePathGenerator)(e.params);return W(e,d=>{const l=o((0,i.prepareLineObservations)(d,e.params.missingValues));return l?G(l,t):null},T,t)},[e,t,r]);return t.width<=0||t.height<=0?null:(0,s.jsx)("g",{"data-geom":"line",children:a.map(({key:o,path:d,observation:l,readings:c})=>{const h=n(l);return(0,s.jsxs)("g",{children:[(0,s.jsx)("path",{d,fill:"none",stroke:h.color,strokeOpacity:h.opacity,strokeWidth:h.width,strokeDasharray:h.dashArray,strokeLinejoin:"round",strokeLinecap:"round"}),(0,s.jsx)(we,{readings:c,color:h.color,opacity:h.opacity})]},o)})})},De=({layer:e,observation:t,panel:r,project:n})=>{const a=U(e)(t,"hovered");return(0,s.jsx)(J,{geom:"line",observation:t,panel:r,project:n,color:a.color,opacity:a.opacity})},ie=(e,t)=>(0,i.defineGeomRenderer)("line",{coord:e,guideMode:"crosshair",swatchShape:"line",render:({layer:r,panelRect:n})=>(0,s.jsx)(Be,{layer:r,panel:n,coord:e}),renderHover:({layer:r,primary:n,panelRect:a})=>(0,s.jsx)(De,{layer:r,observation:n.observation,panel:a,project:t}),renderHoverCompanions:()=>null,getOverlayAnchor:({observation:r})=>{const n=(0,i.getX)(r),a=(0,i.getY)(r);return n===null||a===null?null:{x:n,y:a}}}),ze=ie("cartesian",T),Ne=ie("polar",j),Xe=.85,Ke=1.6,Ye=4,Y=({layer:e,observations:t,panel:r,project:n,state:a})=>{const o=(0,i.useGeomStyleReader)(e),d=w(e),l=(0,A.useMemo)(()=>(0,i.createStableKeyGenerator)(e.data,e.mapping,e.id),[e.data,e.mapping,e.id]),c=a==="hovered",h=c?Ye:0;return(0,s.jsx)("g",{"data-geom":"point",children:Array.from(t,p=>{const u=n(p,r);if(u===null)return null;const f=d(p,a),m=o.get("size",p,a)+h;return(0,s.jsx)(k,{strikes:[M("o",u.x,u.y,m*Xe,m)],color:f.color,opacity:f.opacity,width:Ke,isOverstruck:c},l(p))})})},oe=(e,t)=>(0,i.defineGeomRenderer)("point",{coord:e,swatchShape:"circle",render:({layer:r,panelRect:n})=>(0,s.jsx)(Y,{layer:r,observations:r.data,panel:n,project:t}),renderHover:({layer:r,primary:n,panelRect:a})=>(0,s.jsx)(Y,{layer:r,observations:[n.observation],panel:a,project:t,state:"hovered"}),renderHoverCompanions:()=>null}),Fe=oe("cartesian",T),Ve=oe("polar",j),Ue=4,Ze=1.2,qe=3,I=Math.PI*2,Je=.3,Qe=(e,t)=>{const{startAngle:r,endAngle:n}=(0,i.getAngleExtent)(e),{innerRadius:a,outerRadius:o}=(0,i.getRadiusExtent)(e);if(r===null||n===null||a===null||o===null)return null;const d=Math.min(t.width,t.height)/2;if(d<=0||o<=0)return null;const l=Math.max(0,n-r),c=Ue/2/(o*d),h=l>=I-1e-6?0:Math.min(c,l/4),p=r+h,u=n-h,f=(0,i.buildPolarBarArcPath)({startAngle:p,endAngle:u,innerRadius:a,outerRadius:o},{centerX:t.width/2,centerY:t.height/2,radius:d,digits:qe});return f===void 0?null:{path:f,startAngle:p,endAngle:u,inner:a*d,outer:o*d}},et=(e,t,r,n)=>{const a=Math.hypot(t,r);if(a>e.outer-n||a<e.inner+n)return!1;const o=((Math.atan2(t,-r)-e.startAngle)%I+I)%I,d=n/Math.max(a,1);return o>=d&&o<=e.endAngle-e.startAngle-d},tt=(e,t,r)=>{const n=L(r),a=Math.ceil(e.outer/8)+1,o=Math.ceil(e.outer/12)+1,d=-Math.hypot(8,12)/2,l=[];for(let c=-o;c<=o;c+=1)for(let h=-a;h<=a;h+=1){const p=h*8,u=c*12;et(e,p,u,d)&&l.push(n("/",t.width/2+p,t.height/2+u,5,8,h,c))}return l},F=({layer:e,observations:t,panel:r,state:n})=>{const a=w(e),o=S("slice-shading"),d=(0,A.useMemo)(()=>(0,i.createStableKeyGenerator)(e.data,e.mapping,e.id),[e.data,e.mapping,e.id]);return r.width<=0||r.height<=0?null:(0,s.jsx)("g",{"data-geom":"bar",children:Array.from(t,l=>{const c=Qe(l,r);if(c===null)return null;const h=d(l),p=a(l,n),u=`${o}-${h.replace(/[^a-zA-Z0-9]/gu,"")}`;return(0,s.jsxs)("g",{opacity:p.opacity,children:[(0,s.jsx)("path",{d:c.path,fill:g.paper}),(0,s.jsxs)("g",{children:[(0,s.jsx)("clipPath",{id:u,children:(0,s.jsx)("path",{d:c.path})}),(0,s.jsx)("path",{d:c.path,fill:p.color,fillOpacity:p.fillOpacity*Je}),(0,s.jsx)("g",{clipPath:`url(#${u})`,children:(0,s.jsx)(k,{strikes:tt(c,r,h),color:p.color,opacity:p.fillOpacity,isOverstruck:n==="hovered"})})]}),(0,s.jsx)("path",{d:c.path,fill:"none",stroke:p.color,strokeWidth:Ze,strokeLinejoin:"round"})]},h)})})},rt=(0,i.defineGeomRenderer)("bar",{coord:"polar",guideMode:"band",swatchShape:"slice",render:({layer:e,panelRect:t})=>(0,s.jsx)(F,{layer:e,observations:e.data,panel:t}),renderHover:({layer:e,primary:t,panelRect:r})=>(0,s.jsx)(F,{layer:e,observations:[t.observation],panel:r,state:"hovered"}),renderHoverCompanions:()=>null}),$=2,nt=.2,at=(e,t)=>{const r=L(t),n=[],a=Math.floor(e.y/12),o=Math.floor(e.x/8);for(let d=a;d*12<e.y+e.height;d+=1)for(let l=o;l*8<e.x+e.width;l+=1){const c=(l+.5)*8,h=(d+.5)*12;n.push(r("X",c,h,5,8,l,d))}return n},it=({layer:e,observation:t,seed:r,panel:n,clipId:a,state:o})=>{const d=w(e),l=(0,i.getPaintedTileRect)(t);if(l===null)return null;const c=d(t,o),h={x:l.x*n.width+$/2,y:l.y*n.height+$/2,width:Math.max(0,l.width*n.width-$),height:Math.max(0,l.height*n.height-$)};return h.width<=0||h.height<=0?null:(0,s.jsxs)("g",{opacity:c.opacity,children:[(0,s.jsx)("clipPath",{id:a,children:(0,s.jsx)("rect",{...h})}),(0,s.jsx)("rect",{...h,fill:c.color,fillOpacity:c.fillOpacity}),(0,s.jsx)("g",{clipPath:`url(#${a})`,children:(0,s.jsx)(k,{strikes:at(h,r),color:g.paper,opacity:nt,isOverstruck:o==="hovered"})}),o==="hovered"&&(0,s.jsx)("rect",{...h,fill:"none",stroke:g.text,strokeWidth:c.edgeWidth})]})},V=({layer:e,observations:t,panel:r,state:n})=>{const a=S("typewriter-tile"),o=(0,A.useMemo)(()=>(0,i.createStableCellKeyGenerator)(e.data,e.mapping,e.id),[e.data,e.mapping,e.id]);return r.width<=0||r.height<=0?null:(0,s.jsx)("g",{"data-geom":"tile",children:Array.from(t,(d,l)=>{const c=o(d);return(0,s.jsx)(it,{layer:e,observation:d,seed:c,panel:r,clipId:`${a}-${l}`,state:n},c)})})},ot=(0,i.defineGeomRenderer)("tile",{coord:"cartesian",guideMode:null,swatchShape:"square",render:({layer:e,panelRect:t})=>(0,s.jsx)(V,{layer:e,observations:e.data,panel:t}),renderHover:({layer:e,primary:t,panelRect:r})=>(0,s.jsx)(V,{layer:e,observations:[t.observation],panel:r,state:"hovered"}),renderHoverCompanions:()=>null}),st=[Ce,rt,ot,ze,Ne,Ee,Te,Fe,Ve],lt=e=>{const t=S("typewriter-rect"),r=(0,i.useGeomPanelSize)(),n=r===null?null:(0,i.readRectPixels)(e,r);return n===null||e.fill===void 0?(0,s.jsx)(i.DefaultGeomRect,{...e}):n.width<=0||n.height<=0?null:(0,s.jsx)("g",{"data-testid":e["data-testid"],children:(0,s.jsx)(ae,{rect:n,edge:"top",seed:`${n.x},${n.y}`,clipId:t,color:e.fill,opacity:e.opacity??1,pressure:e.fillOpacity??1,isOverstruck:!1})})},dt=e=>{const t=(e.match(/-?\d*\.?\d+(?:e-?\d+)?/giu)??[]).map(Number),r=t.filter((d,l)=>l%2===0),n=t.filter((d,l)=>l%2===1);if(r.length===0||n.length===0)return null;const a=Math.min(...r),o=Math.min(...n);return{x:a,y:o,width:Math.max(...r)-a,height:Math.max(...n)-o}},ht=e=>{const t=S("typewriter-path"),r=(0,i.useGeomPanelSize)(),n=(0,A.useMemo)(()=>{const o=dt(e.d);return r===null||o===null?null:ee(r,e.d,o)},[r,e.d]);if(n===null||e.fill===void 0||e.fill.startsWith("url("))return(0,s.jsx)(i.DefaultGeomPath,{...e});const a=e.fillOpacity??1;return(0,s.jsxs)("g",{"data-testid":e["data-testid"],opacity:e.opacity??1,children:[(0,s.jsx)("clipPath",{id:t,children:(0,s.jsx)("path",{d:e.d})}),(0,s.jsx)("path",{d:e.d,fill:g.paper}),(0,s.jsx)("path",{d:e.d,fill:e.fill,fillOpacity:a*Q}),(0,s.jsx)("g",{clipPath:`url(#${t})`,children:(0,s.jsx)(k,{strikes:n,color:e.fill,opacity:a})})]})},ct={Rect:lt,Path:ht},ut={name:"typewriter",styles:ue,palettes:{categorical:de,sequential:he,diverging:ce},config:{axes:{y:{position:"left"}}},colorScheme:"light",plugins:st,shapes:ct};exports.typewriter=ut;
package/dist/index.mjs CHANGED
@@ -1,7 +1,7 @@
1
- import { useId as yt, useMemo as R } from "react";
2
- import { DefaultGeomPath as At, DefaultGeomRect as kt, GROUP_VARIABLES as xt, buildPolarBarArcPath as wt, createAreaPathGenerators as Rt, createLinePathGenerator as Mt, createStableCellKeyGenerator as Et, createStableKeyGenerator as O, defineGeomRenderer as M, getAngleExtent as Tt, getBarRectBounds as St, getPaintedTileRect as Pt, getRadiusExtent as rt, getStackRole as $t, getX as C, getXMax as It, getXMin as _t, getY as B, getYMax as nt, getYMin as Wt, polarToUnit as bt, prepareAreaObservations as Lt, prepareLineObservations as Ht, readMainAxis as F, readRectPixels as Ot, style as c, toPaintColor as Ct, toStrokeDasharray as Bt, toViewBoxX as Gt, toViewBoxY as Dt, useGeomPanelSize as at, useGeomStyleReader as X } from "@graphysdk/react";
3
- import { jsx as d, jsxs as x } from "react/jsx-runtime";
4
- var p = {
1
+ import { useId as yt, useMemo as x } from "react";
2
+ import { DefaultGeomPath as At, DefaultGeomRect as kt, GROUP_VARIABLES as xt, buildPolarBarArcPath as Rt, createAreaPathGenerators as wt, createBarBoundsReader as Mt, createLinePathGenerator as Et, createStableCellKeyGenerator as Tt, createStableKeyGenerator as b, defineGeomRenderer as M, getAngleExtent as St, getPaintedTileRect as Pt, getRadiusExtent as rt, getStackRole as $t, getX as C, getXMax as It, getXMin as _t, getY as B, getYMax as nt, getYMin as Wt, polarToUnit as Lt, prepareAreaObservations as Ht, prepareLineObservations as Ot, readMainAxis as F, readRectPixels as bt, style as c, toPaintColor as Ct, toStrokeDasharray as Bt, toViewBoxX as Gt, toViewBoxY as Dt, useGeomPanelSize as at, useGeomStyleReader as G } from "@graphysdk/react";
3
+ import { jsx as s, jsxs as R } from "react/jsx-runtime";
4
+ var g = {
5
5
  paper: "#EBD9A9",
6
6
  card: "#F8F0D8",
7
7
  text: "#1F1B16",
@@ -28,11 +28,11 @@ var p = {
28
28
  m.red
29
29
  ], w = {
30
30
  fontWeight: 400,
31
- textColor: p.text
31
+ textColor: g.text
32
32
  }, W = {
33
33
  ...w,
34
34
  fontSize: 13,
35
- fill: p.paper,
35
+ fill: g.paper,
36
36
  stroke: "transparent",
37
37
  strokeWidth: 0,
38
38
  cornerRadius: 0,
@@ -41,31 +41,31 @@ var p = {
41
41
  shadow: "none"
42
42
  }, A = {
43
43
  fontWeight: 400,
44
- textColor: p.secondary
44
+ textColor: g.secondary
45
45
  }, K = {
46
- fill: p.card,
47
- stroke: p.text,
46
+ fill: g.card,
47
+ stroke: g.text,
48
48
  strokeWidth: 1,
49
49
  cornerRadius: 0,
50
50
  shadow: "none"
51
51
  }, Kt = {
52
52
  tokens: {
53
- graphBackground: p.paper,
54
- graphBorder: p.edge,
55
- geomBorder: p.text,
56
- textPrimary: p.text,
57
- textSecondary: p.secondary,
58
- ruleLine: p.text,
59
- gridLine: p.grid,
60
- hoverAffordance: p.paper,
53
+ graphBackground: g.paper,
54
+ graphBorder: g.edge,
55
+ geomBorder: g.text,
56
+ textPrimary: g.text,
57
+ textSecondary: g.secondary,
58
+ ruleLine: g.text,
59
+ gridLine: g.grid,
60
+ hoverAffordance: g.paper,
61
61
  hoverGuideFill: "rgba(31, 27, 22, 0.07)",
62
- hoverGuideLine: p.secondary,
63
- tooltipBackground: p.card,
64
- tooltipBorder: p.text,
62
+ hoverGuideLine: g.secondary,
63
+ tooltipBackground: g.card,
64
+ tooltipBorder: g.text,
65
65
  tooltipPrimaryRow: "rgba(31, 27, 22, 0.08)",
66
66
  annotationShape: m.red,
67
- annotationArrow: p.text,
68
- differenceLabelBackground: p.card,
67
+ annotationArrow: g.text,
68
+ differenceLabelBackground: g.card,
69
69
  trendPositive: m.black,
70
70
  trendNegative: m.red,
71
71
  trendNeutral: m.pencilGrey
@@ -81,7 +81,7 @@ var p = {
81
81
  c.geom({ shadow: "none" }),
82
82
  c.geom({ shadow: "none" }, { state: "hovered" }),
83
83
  c.geom.bar({
84
- stroke: p.text,
84
+ stroke: g.text,
85
85
  strokeWidth: 1,
86
86
  cornerRadius: "none"
87
87
  }),
@@ -100,12 +100,12 @@ var p = {
100
100
  }),
101
101
  c.geom.point({
102
102
  size: 9,
103
- stroke: p.paper,
103
+ stroke: g.paper,
104
104
  strokeWidth: 1.5
105
105
  }),
106
106
  c.geom.tile({
107
107
  cornerRadius: 0,
108
- stroke: p.paper,
108
+ stroke: g.paper,
109
109
  strokeWidth: 2
110
110
  }),
111
111
  c.geom.rule({
@@ -123,12 +123,12 @@ var p = {
123
123
  cornerRadius: 0
124
124
  }),
125
125
  c.panelBorder.left({
126
- stroke: p.text,
126
+ stroke: g.text,
127
127
  strokeWidth: 1,
128
128
  dashArray: []
129
129
  }),
130
130
  c.panelBorder.bottom({
131
- stroke: p.text,
131
+ stroke: g.text,
132
132
  strokeWidth: 1,
133
133
  dashArray: []
134
134
  }),
@@ -223,44 +223,44 @@ var p = {
223
223
  }),
224
224
  c.annotation.pinnedNumber({
225
225
  fill: m.red,
226
- stroke: p.paper,
226
+ stroke: g.paper,
227
227
  shadow: "none"
228
228
  }),
229
229
  c.annotation.pinnedNumber.label({ ...W }),
230
230
  c.annotation.comment({
231
231
  fill: m.red,
232
- stroke: p.paper,
232
+ stroke: g.paper,
233
233
  shadow: "none"
234
234
  }),
235
235
  c.annotation.comment.label({ ...W }),
236
236
  c.annotation.differenceArrow({
237
- stroke: p.text,
237
+ stroke: g.text,
238
238
  strokeWidth: 1.5
239
239
  }),
240
240
  c.annotation.differenceArrow.label({ ...W }),
241
241
  c.annotation.arrow({
242
- stroke: p.text,
242
+ stroke: g.text,
243
243
  strokeWidth: 1.5,
244
244
  dashArray: []
245
245
  }),
246
246
  c.annotation.shape({
247
- fill: p.text,
247
+ fill: g.text,
248
248
  fillAlpha: 0.06,
249
- stroke: p.secondary,
249
+ stroke: g.secondary,
250
250
  strokeWidth: 0.75
251
251
  }),
252
252
  c.geom.area({ fillAlpha: 0.45 }, { coord: "polar" }),
253
253
  c.panelBorder.left({ strokeWidth: 0 }, { coord: "polar" }),
254
254
  c.panelBorder.bottom({ strokeWidth: 0 }, { coord: "polar" }),
255
255
  c.tickLabel({
256
- textColor: p.text,
256
+ textColor: g.text,
257
257
  fontSize: 14,
258
258
  fontWeight: 700,
259
- textOutlineColor: p.paper,
259
+ textOutlineColor: g.paper,
260
260
  textOutlineWidth: 8
261
261
  }, { coord: "polar" })
262
262
  ]
263
- }, Vt = /[a-df-zA-DF-Z]|[-+]?(?:\d+\.?\d*|\.\d+)(?:[eE][-+]?\d+)?/gu, Yt = /^[a-zA-Z]$/u, jt = (t, e) => t === "H" ? "x" : t === "V" ? "y" : e % 2 === 0 ? "x" : "y", z = (t, e) => {
263
+ }, Vt = /[a-df-zA-DF-Z]|[-+]?(?:\d+\.?\d*|\.\d+)(?:[eE][-+]?\d+)?/gu, Yt = /^[a-zA-Z]$/u, jt = (t, e) => t === "H" ? "x" : t === "V" ? "y" : e % 2 === 0 ? "x" : "y", N = (t, e) => {
264
264
  let r = "", n = 0;
265
265
  return (t.match(Vt) ?? []).map((a) => {
266
266
  if (Yt.test(a))
@@ -277,13 +277,13 @@ var p = {
277
277
  }, T = (t, e) => {
278
278
  const r = C(t), n = B(t) ?? rt(t).outerRadius;
279
279
  if (r === null || n === null) return null;
280
- const a = bt(r, n), i = Math.min(e.width, e.height) / 2;
280
+ const a = Lt(r, n), i = Math.min(e.width, e.height) / 2;
281
281
  return {
282
282
  x: e.width / 2 + a.x * i,
283
283
  y: e.height / 2 - a.y * i
284
284
  };
285
285
  }, Ut = (t) => `${t.map((e, r) => `${r === 0 ? "M" : "L"}${e.x},${e.y}`).join(" ")} Z`, S = (t) => {
286
- const e = X(t);
286
+ const e = G(t);
287
287
  return (r, n) => ({
288
288
  color: Ct(e.get("fill", r, n)),
289
289
  opacity: e.get("alpha", r, n),
@@ -292,7 +292,7 @@ var p = {
292
292
  edgeWidth: e.get("strokeWidth", r, n)
293
293
  });
294
294
  }, it = (t) => {
295
- const e = X(t);
295
+ const e = G(t);
296
296
  return (r, n) => {
297
297
  const a = e.get("strokeWidth", r, n);
298
298
  return {
@@ -311,57 +311,57 @@ var p = {
311
311
  for (let r = 0; r < t.length; r += 1)
312
312
  e ^= t.charCodeAt(r), e = Math.imul(e, 16777619);
313
313
  return e >>> 0;
314
- }, D = (t, e, r, n) => {
314
+ }, z = (t, e, r, n) => {
315
315
  let a = Math.imul(t ^ Math.imul(e, 374761393) ^ Math.imul(r, 668265263) ^ n, 1274126177);
316
316
  return a = Math.imul(a ^ a >>> 13, 1103515245), ((a ^ a >>> 16) >>> 0) / 4294967296;
317
317
  }, v = (t) => Math.round(t * Y) / Y, ot = (t, e, r, n, a) => {
318
- const i = v(e - n / 2), l = v(e + n / 2), o = v(r - a / 2), s = v(r + a / 2), h = `M${i},${o}L${l},${s}M${l},${o}L${i},${s}`;
319
- if (t === "x" || t === "X" && n < Jt) return h;
318
+ const i = v(e - n / 2), l = v(e + n / 2), o = v(r - a / 2), h = v(r + a / 2), d = `M${i},${o}L${l},${h}M${l},${o}L${i},${h}`;
319
+ if (t === "x" || t === "X" && n < Jt) return d;
320
320
  if (t === "X") {
321
321
  const f = (y, _) => `M${v(y - j)},${_}L${v(y + j)},${_}`;
322
- return `${h}${f(i, o)}${f(l, o)}${f(i, s)}${f(l, s)}`;
322
+ return `${d}${f(i, o)}${f(l, o)}${f(i, h)}${f(l, h)}`;
323
323
  }
324
- if (t === "/") return `M${i},${s}L${l},${o}`;
324
+ if (t === "/") return `M${i},${h}L${l},${o}`;
325
325
  if (t === "_") return `M${i},${v(r)}L${l},${v(r)}`;
326
- if (t === "|") return `M${v(e)},${o}L${v(e)},${s}`;
327
- const g = v(n / 2), u = v(a / 2);
328
- return `M${i},${v(r)}a${g},${u} 0 1,0 ${v(n)},0a${g},${u} 0 1,0 ${-v(n)},0`;
329
- }, G = (t) => {
326
+ if (t === "|") return `M${v(e)},${o}L${v(e)},${h}`;
327
+ const p = v(n / 2), u = v(a / 2);
328
+ return `M${i},${v(r)}a${p},${u} 0 1,0 ${v(n)},0a${p},${u} 0 1,0 ${-v(n)},0`;
329
+ }, D = (t) => {
330
330
  const e = Qt(t);
331
- return (r, n, a, i, l, o, s) => {
332
- const h = (D(e, o, s, 1) * 2 - 1) * V, g = (D(e, o, s, 2) * 2 - 1) * V, u = Math.floor(D(e, o, s, 3) * $.length);
331
+ return (r, n, a, i, l, o, h) => {
332
+ const d = (z(e, o, h, 1) * 2 - 1) * V, p = (z(e, o, h, 2) * 2 - 1) * V, u = Math.floor(z(e, o, h, 3) * $.length);
333
333
  return {
334
- path: ot(r, n + h, a + g, i, l),
334
+ path: ot(r, n + d, a + p, i, l),
335
335
  weight: u
336
336
  };
337
337
  };
338
338
  }, E = (t, e, r, n, a) => ({
339
339
  path: ot(t, e, r, n, a),
340
340
  weight: $.length - 1
341
- }), P = (t) => `${t}-${yt().replace(/[^a-zA-Z0-9]/gu, "")}`, k = ({ strikes: t, color: e, opacity: r = 1, width: n = Zt, isOverstruck: a = !1 }) => t.length === 0 ? null : /* @__PURE__ */ x("g", {
341
+ }), P = (t) => `${t}-${yt().replace(/[^a-zA-Z0-9]/gu, "")}`, k = ({ strikes: t, color: e, opacity: r = 1, width: n = Zt, isOverstruck: a = !1 }) => t.length === 0 ? null : /* @__PURE__ */ R("g", {
342
342
  fill: "none",
343
343
  stroke: e,
344
344
  strokeWidth: n,
345
345
  strokeLinecap: "round",
346
346
  opacity: r,
347
- children: [$.map((i, l) => t.filter((o) => o.weight === l).map((o) => o.path).join("")).map((i, l) => i === "" ? null : /* @__PURE__ */ d("path", {
347
+ children: [$.map((i, l) => t.filter((o) => o.weight === l).map((o) => o.path).join("")).map((i, l) => i === "" ? null : /* @__PURE__ */ s("path", {
348
348
  d: i,
349
349
  strokeOpacity: $[l]
350
- }, $[l])), a && /* @__PURE__ */ d("path", {
350
+ }, $[l])), a && /* @__PURE__ */ s("path", {
351
351
  d: t.map((i) => i.path).join(""),
352
352
  transform: `translate(${qt},0)`
353
353
  })]
354
- }), U = 6, te = 14, ee = 1.5, Z = 10, re = 1.8, H = (t, e, r, n) => {
355
- const a = O(t.data, t.mapping, t.id), i = [];
354
+ }), U = 6, te = 14, ee = 1.5, Z = 10, re = 1.8, O = (t, e, r, n) => {
355
+ const a = b(t.data, t.mapping, t.id), i = [];
356
356
  return t.data.groupBy(xt.group).forEach((l) => {
357
- const o = [...l], [s] = o, h = e(o);
358
- if (s === void 0 || h === null) return;
359
- const g = o.flatMap((u) => r(u, n) ?? []);
357
+ const o = [...l], [h] = o, d = e(o);
358
+ if (h === void 0 || d === null) return;
359
+ const p = o.flatMap((u) => r(u, n) ?? []);
360
360
  i.push({
361
- key: a(s),
362
- observation: s,
363
- path: h,
364
- readings: g
361
+ key: a(h),
362
+ observation: h,
363
+ path: d,
364
+ readings: p
365
365
  });
366
366
  }), i;
367
367
  }, lt = (t, e) => {
@@ -376,16 +376,16 @@ var p = {
376
376
  }, ne = (t) => t.every((e, r) => {
377
377
  const n = t[r + 1];
378
378
  return n === void 0 || Math.hypot(n.x - e.x, n.y - e.y) >= te;
379
- }), ae = ({ readings: t, color: e, opacity: r }) => ne(t) ? /* @__PURE__ */ d(k, {
379
+ }), ae = ({ readings: t, color: e, opacity: r }) => ne(t) ? /* @__PURE__ */ s(k, {
380
380
  strikes: t.map(({ x: n, y: a }) => E("x", n, a, U, U)),
381
381
  color: e,
382
382
  opacity: r,
383
383
  width: ee
384
384
  }) : null, st = ({ geom: t, observation: e, panel: r, project: n, color: a, opacity: i }) => {
385
385
  const l = n(e, r);
386
- return l === null ? null : /* @__PURE__ */ d("g", {
386
+ return l === null ? null : /* @__PURE__ */ s("g", {
387
387
  "data-geom": t,
388
- children: /* @__PURE__ */ d(k, {
388
+ children: /* @__PURE__ */ s(k, {
389
389
  strikes: [E("X", l.x, l.y, Z, Z)],
390
390
  color: a,
391
391
  opacity: i,
@@ -398,65 +398,65 @@ var p = {
398
398
  y: 0,
399
399
  ...t
400
400
  }) => {
401
- const n = G(e), a = [], i = Math.max(0, Math.floor((t.height - r.y - r.height) / 12 - 0.5)), l = Math.min(Math.ceil(t.height / 12), Math.ceil((t.height - r.y) / 12)), o = Math.max(0, Math.floor(r.x / 8)), s = Math.min(Math.ceil(t.width / 8), Math.ceil((r.x + r.width) / 8));
402
- for (let h = i; h < l; h += 1) {
403
- const g = t.height - (h + 0.5) * 12;
404
- for (let u = o; u < s; u += 1) a.push(n("/", (u + 0.5) * 8, g, 5, 8, u, h));
401
+ const n = D(e), a = [], i = Math.max(0, Math.floor((t.height - r.y - r.height) / 12 - 0.5)), l = Math.min(Math.ceil(t.height / 12), Math.ceil((t.height - r.y) / 12)), o = Math.max(0, Math.floor(r.x / 8)), h = Math.min(Math.ceil(t.width / 8), Math.ceil((r.x + r.width) / 8));
402
+ for (let d = i; d < l; d += 1) {
403
+ const p = t.height - (d + 0.5) * 12;
404
+ for (let u = o; u < h; u += 1) a.push(n("/", (u + 0.5) * 8, p, 5, 8, u, d));
405
405
  }
406
406
  return a;
407
407
  }, ct = ({ layer: t, coordSystem: e, panel: r }) => {
408
- const n = S(t), a = P("typewriter-area"), i = R(() => {
409
- if (e === void 0) return H(t, (h) => lt(h, r), T, r).map((h) => ({
410
- ...h,
411
- fill: h.path,
412
- edge: h.path
408
+ const n = S(t), a = P("typewriter-area"), i = x(() => {
409
+ if (e === void 0) return O(t, (d) => lt(d, r), T, r).map((d) => ({
410
+ ...d,
411
+ fill: d.path,
412
+ edge: d.path
413
413
  }));
414
- const { areaGenerator: l, lineGenerator: o } = Rt(e, t.params), s = /* @__PURE__ */ new Map();
415
- return H(t, (h) => {
416
- const g = Lt(h, t.params.missingValues), u = l(g), f = o(g);
414
+ const { areaGenerator: l, lineGenerator: o } = wt(e, t.params), h = /* @__PURE__ */ new Map();
415
+ return O(t, (d) => {
416
+ const p = Ht(d, t.params.missingValues), u = l(p), f = o(p);
417
417
  if (!u) return null;
418
- const y = z(u, r);
419
- return f && s.set(y, z(f, r)), y;
420
- }, I, r).map((h) => ({
421
- ...h,
422
- fill: h.path,
423
- edge: s.get(h.path) ?? ""
418
+ const y = N(u, r);
419
+ return f && h.set(y, N(f, r)), y;
420
+ }, I, r).map((d) => ({
421
+ ...d,
422
+ fill: d.path,
423
+ edge: h.get(d.path) ?? ""
424
424
  }));
425
425
  }, [
426
426
  t,
427
427
  e,
428
428
  r
429
429
  ]);
430
- return r.width <= 0 || r.height <= 0 ? null : /* @__PURE__ */ d("g", {
430
+ return r.width <= 0 || r.height <= 0 ? null : /* @__PURE__ */ s("g", {
431
431
  "data-geom": "area",
432
- children: i.map(({ key: l, observation: o, fill: s, edge: h }, g) => {
432
+ children: i.map(({ key: l, observation: o, fill: h, edge: d }, p) => {
433
433
  const u = n(o);
434
- return /* @__PURE__ */ x("g", {
434
+ return /* @__PURE__ */ R("g", {
435
435
  opacity: u.opacity,
436
436
  children: [
437
- /* @__PURE__ */ d("clipPath", {
438
- id: `${a}-${g}`,
439
- children: /* @__PURE__ */ d("path", { d: s })
437
+ /* @__PURE__ */ s("clipPath", {
438
+ id: `${a}-${p}`,
439
+ children: /* @__PURE__ */ s("path", { d: h })
440
440
  }),
441
- /* @__PURE__ */ d("path", {
442
- d: s,
443
- fill: p.paper
441
+ /* @__PURE__ */ s("path", {
442
+ d: h,
443
+ fill: g.paper
444
444
  }),
445
- /* @__PURE__ */ d("path", {
446
- d: s,
445
+ /* @__PURE__ */ s("path", {
446
+ d: h,
447
447
  fill: u.color,
448
448
  fillOpacity: u.fillOpacity * dt
449
449
  }),
450
- /* @__PURE__ */ d("g", {
451
- clipPath: `url(#${a}-${g})`,
452
- children: /* @__PURE__ */ d(k, {
450
+ /* @__PURE__ */ s("g", {
451
+ clipPath: `url(#${a}-${p})`,
452
+ children: /* @__PURE__ */ s(k, {
453
453
  strikes: ht(r, l),
454
454
  color: u.color,
455
455
  opacity: u.fillOpacity
456
456
  })
457
457
  }),
458
- /* @__PURE__ */ d("path", {
459
- d: h,
458
+ /* @__PURE__ */ s("path", {
459
+ d,
460
460
  fill: "none",
461
461
  stroke: u.color,
462
462
  strokeWidth: ie,
@@ -469,7 +469,7 @@ var p = {
469
469
  });
470
470
  }, ut = ({ layer: t, observation: e, panel: r, project: n }) => {
471
471
  const a = S(t)(e, "hovered");
472
- return /* @__PURE__ */ d(st, {
472
+ return /* @__PURE__ */ s(st, {
473
473
  geom: "area",
474
474
  observation: e,
475
475
  panel: r,
@@ -481,12 +481,12 @@ var p = {
481
481
  coord: "cartesian",
482
482
  guideMode: "crosshair",
483
483
  swatchShape: "area",
484
- render: ({ layer: t, coordSystem: e, panelRect: r }) => e.type !== "cartesian" ? null : /* @__PURE__ */ d(ct, {
484
+ render: ({ layer: t, coordSystem: e, panelRect: r }) => e.type !== "cartesian" ? null : /* @__PURE__ */ s(ct, {
485
485
  layer: t,
486
486
  coordSystem: e,
487
487
  panel: r
488
488
  }),
489
- renderHover: ({ layer: t, primary: e, panelRect: r }) => /* @__PURE__ */ d(ut, {
489
+ renderHover: ({ layer: t, primary: e, panelRect: r }) => /* @__PURE__ */ s(ut, {
490
490
  layer: t,
491
491
  observation: e.observation,
492
492
  panel: r,
@@ -497,11 +497,11 @@ var p = {
497
497
  coord: "polar",
498
498
  guideMode: "crosshair",
499
499
  swatchShape: "area",
500
- render: ({ layer: t, panelRect: e }) => /* @__PURE__ */ d(ct, {
500
+ render: ({ layer: t, panelRect: e }) => /* @__PURE__ */ s(ct, {
501
501
  layer: t,
502
502
  panel: e
503
503
  }),
504
- renderHover: ({ layer: t, primary: e, panelRect: r }) => /* @__PURE__ */ d(ut, {
504
+ renderHover: ({ layer: t, primary: e, panelRect: r }) => /* @__PURE__ */ s(ut, {
505
505
  layer: t,
506
506
  observation: e.observation,
507
507
  panel: r,
@@ -547,7 +547,7 @@ var p = {
547
547
  ...t,
548
548
  width: n
549
549
  };
550
- }, N = (t, e) => {
550
+ }, X = (t, e) => {
551
551
  const r = Math.max(1, Math.round(t / e));
552
552
  return {
553
553
  count: r,
@@ -558,60 +558,60 @@ var p = {
558
558
  for (let a = he + r / 2; a - r / 2 < t; a += e) n.push(a);
559
559
  return n;
560
560
  }, fe = (t, e, r) => {
561
- const n = G(r), a = e === "top" || e === "bottom", i = a ? N(t.width, 8) : N(t.height, 12), l = a ? Math.min(5, i.size - 2) : 5, o = a ? 8 : Math.max(1, Math.min(8, i.size - 4));
562
- return (a ? q(t.height, 12, 8) : q(t.width, 8, 5)).flatMap((s, h) => Array.from({ length: i.count }, (g, u) => {
561
+ const n = D(r), a = e === "top" || e === "bottom", i = a ? X(t.width, 8) : X(t.height, 12), l = a ? Math.min(5, i.size - 2) : 5, o = a ? 8 : Math.max(1, Math.min(8, i.size - 4));
562
+ return (a ? q(t.height, 12, 8) : q(t.width, 8, 5)).flatMap((h, d) => Array.from({ length: i.count }, (p, u) => {
563
563
  const f = (u + 0.5) * i.size;
564
- if (e === "top") return n("X", t.x + f, t.y + s, l, o, u, h);
565
- if (e === "bottom") return n("X", t.x + f, t.y + t.height - s, l, o, u, h);
566
- const y = e === "right" ? t.x + t.width - s : t.x + s;
567
- return n("X", y, t.y + f, l, o, h, u);
564
+ if (e === "top") return n("X", t.x + f, t.y + h, l, o, u, d);
565
+ if (e === "bottom") return n("X", t.x + f, t.y + t.height - h, l, o, u, d);
566
+ const y = e === "right" ? t.x + t.width - h : t.x + h;
567
+ return n("X", y, t.y + f, l, o, d, u);
568
568
  }));
569
569
  }, me = (t, e) => {
570
- const r = e === "top" || e === "bottom", n = N(r ? t.width : t.height, r ? 8 : 12), a = Math.max(1, n.size - de), i = pt / 2;
570
+ const r = e === "top" || e === "bottom", n = X(r ? t.width : t.height, r ? 8 : 12), a = Math.max(1, n.size - de), i = pt / 2;
571
571
  return Array.from({ length: n.count }, (l, o) => {
572
- const s = (o + 0.5) * n.size;
573
- return e === "top" ? E("_", t.x + s, t.y + i, a, 0) : e === "bottom" ? E("_", t.x + s, t.y + t.height - i, a, 0) : E("|", e === "right" ? t.x + t.width - i : t.x + i, t.y + s, 0, a);
572
+ const h = (o + 0.5) * n.size;
573
+ return e === "top" ? E("_", t.x + h, t.y + i, a, 0) : e === "bottom" ? E("_", t.x + h, t.y + t.height - i, a, 0) : E("|", e === "right" ? t.x + t.width - i : t.x + i, t.y + h, 0, a);
574
574
  });
575
- }, ve = ({ layer: t, observation: e, seed: r, mainAxis: n, panel: a, clipId: i, state: l }) => {
576
- const o = S(t), s = St(n, e);
577
- if (!s || s.width <= 0 || s.height <= 0) return null;
578
- const h = o(e, l), g = ce[$t(e)], u = pe(e, n), f = {
579
- x: s.x * a.width,
580
- y: s.y * a.height,
581
- width: s.width * a.width,
582
- height: s.height * a.height
583
- }, y = [g.value ? [] : [u], g.base ? [] : [ue[u]]].flat().reduce((_, vt) => ge(_, vt, se / 2), f);
584
- return y.width <= 0 || y.height <= 0 ? null : /* @__PURE__ */ d(gt, {
575
+ }, ve = ({ layer: t, observation: e, bounds: r, seed: n, mainAxis: a, panel: i, clipId: l, state: o }) => {
576
+ const h = S(t);
577
+ if (!r || r.width <= 0 || r.height <= 0) return null;
578
+ const d = h(e, o), p = ce[$t(e)], u = pe(e, a), f = {
579
+ x: r.x * i.width,
580
+ y: r.y * i.height,
581
+ width: r.width * i.width,
582
+ height: r.height * i.height
583
+ }, y = [p.value ? [] : [u], p.base ? [] : [ue[u]]].flat().reduce((_, vt) => ge(_, vt, se / 2), f);
584
+ return y.width <= 0 || y.height <= 0 ? null : /* @__PURE__ */ s(gt, {
585
585
  rect: y,
586
586
  edge: u,
587
- seed: r,
588
- clipId: i,
589
- color: h.color,
590
- opacity: h.opacity,
591
- pressure: h.fillOpacity,
592
- isOverstruck: l === "hovered"
587
+ seed: n,
588
+ clipId: l,
589
+ color: d.color,
590
+ opacity: d.opacity,
591
+ pressure: d.fillOpacity,
592
+ isOverstruck: o === "hovered"
593
593
  });
594
- }, gt = ({ rect: t, edge: e, seed: r, clipId: n, color: a, opacity: i, pressure: l, isOverstruck: o }) => /* @__PURE__ */ x("g", {
594
+ }, gt = ({ rect: t, edge: e, seed: r, clipId: n, color: a, opacity: i, pressure: l, isOverstruck: o }) => /* @__PURE__ */ R("g", {
595
595
  opacity: i,
596
596
  children: [
597
- /* @__PURE__ */ d("clipPath", {
597
+ /* @__PURE__ */ s("clipPath", {
598
598
  id: n,
599
- children: /* @__PURE__ */ d("rect", { ...t })
599
+ children: /* @__PURE__ */ s("rect", { ...t })
600
600
  }),
601
- /* @__PURE__ */ d("rect", {
601
+ /* @__PURE__ */ s("rect", {
602
602
  ...t,
603
- fill: p.paper
603
+ fill: g.paper
604
604
  }),
605
- /* @__PURE__ */ d("g", {
605
+ /* @__PURE__ */ s("g", {
606
606
  clipPath: `url(#${n})`,
607
- children: /* @__PURE__ */ d(k, {
607
+ children: /* @__PURE__ */ s(k, {
608
608
  strikes: fe(t, e, r),
609
609
  color: a,
610
610
  opacity: l,
611
611
  isOverstruck: o
612
612
  })
613
613
  }),
614
- /* @__PURE__ */ d(k, {
614
+ /* @__PURE__ */ s(k, {
615
615
  strikes: me(t, e),
616
616
  color: a,
617
617
  width: pt,
@@ -619,37 +619,43 @@ var p = {
619
619
  })
620
620
  ]
621
621
  }), J = ({ layer: t, observations: e, mainAxis: r, panel: n, state: a }) => {
622
- const i = P("typewriter-bar"), l = R(() => O(t.data, t.mapping, t.id), [
622
+ const i = P("typewriter-bar"), l = G(t), o = x(() => b(t.data, t.mapping, t.id), [
623
623
  t.data,
624
624
  t.mapping,
625
625
  t.id
626
+ ]), h = x(() => Mt(t, r, l, n), [
627
+ t,
628
+ r,
629
+ l,
630
+ n
626
631
  ]);
627
- return n.width <= 0 || n.height <= 0 ? null : /* @__PURE__ */ d("g", {
632
+ return n.width <= 0 || n.height <= 0 ? null : /* @__PURE__ */ s("g", {
628
633
  "data-geom": "bar",
629
- children: Array.from(e, (o, s) => {
630
- const h = l(o);
631
- return /* @__PURE__ */ d(ve, {
634
+ children: Array.from(e, (d, p) => {
635
+ const u = o(d);
636
+ return /* @__PURE__ */ s(ve, {
632
637
  layer: t,
633
- observation: o,
634
- seed: h,
638
+ observation: d,
639
+ bounds: h(d),
640
+ seed: u,
635
641
  mainAxis: r,
636
642
  panel: n,
637
- clipId: `${i}-${s}`,
643
+ clipId: `${i}-${p}`,
638
644
  state: a
639
- }, h);
645
+ }, u);
640
646
  })
641
647
  });
642
648
  }, ye = M("bar", {
643
649
  coord: "cartesian",
644
650
  guideMode: "band",
645
651
  swatchShape: "square",
646
- render: ({ layer: t, coordSystem: e, panelRect: r }) => /* @__PURE__ */ d(J, {
652
+ render: ({ layer: t, coordSystem: e, panelRect: r }) => /* @__PURE__ */ s(J, {
647
653
  layer: t,
648
654
  observations: t.data,
649
655
  mainAxis: F(e),
650
656
  panel: r
651
657
  }),
652
- renderHover: ({ layer: t, coordSystem: e, primary: r, panelRect: n }) => /* @__PURE__ */ d(J, {
658
+ renderHover: ({ layer: t, coordSystem: e, primary: r, panelRect: n }) => /* @__PURE__ */ s(J, {
653
659
  layer: t,
654
660
  observations: [r.observation],
655
661
  mainAxis: F(e),
@@ -658,41 +664,41 @@ var p = {
658
664
  }),
659
665
  renderHoverCompanions: () => null
660
666
  }), Ae = ({ layer: t, panel: e, coord: r }) => {
661
- const n = it(t), a = R(() => {
662
- if (r === "polar") return H(t, (l) => lt(l, e), T, e);
663
- const i = Mt(t.params);
664
- return H(t, (l) => {
665
- const o = i(Ht(l, t.params.missingValues));
666
- return o ? z(o, e) : null;
667
+ const n = it(t), a = x(() => {
668
+ if (r === "polar") return O(t, (l) => lt(l, e), T, e);
669
+ const i = Et(t.params);
670
+ return O(t, (l) => {
671
+ const o = i(Ot(l, t.params.missingValues));
672
+ return o ? N(o, e) : null;
667
673
  }, I, e);
668
674
  }, [
669
675
  t,
670
676
  e,
671
677
  r
672
678
  ]);
673
- return e.width <= 0 || e.height <= 0 ? null : /* @__PURE__ */ d("g", {
679
+ return e.width <= 0 || e.height <= 0 ? null : /* @__PURE__ */ s("g", {
674
680
  "data-geom": "line",
675
- children: a.map(({ key: i, path: l, observation: o, readings: s }) => {
676
- const h = n(o);
677
- return /* @__PURE__ */ x("g", { children: [/* @__PURE__ */ d("path", {
681
+ children: a.map(({ key: i, path: l, observation: o, readings: h }) => {
682
+ const d = n(o);
683
+ return /* @__PURE__ */ R("g", { children: [/* @__PURE__ */ s("path", {
678
684
  d: l,
679
685
  fill: "none",
680
- stroke: h.color,
681
- strokeOpacity: h.opacity,
682
- strokeWidth: h.width,
683
- strokeDasharray: h.dashArray,
686
+ stroke: d.color,
687
+ strokeOpacity: d.opacity,
688
+ strokeWidth: d.width,
689
+ strokeDasharray: d.dashArray,
684
690
  strokeLinejoin: "round",
685
691
  strokeLinecap: "round"
686
- }), /* @__PURE__ */ d(ae, {
687
- readings: s,
688
- color: h.color,
689
- opacity: h.opacity
692
+ }), /* @__PURE__ */ s(ae, {
693
+ readings: h,
694
+ color: d.color,
695
+ opacity: d.opacity
690
696
  })] }, i);
691
697
  })
692
698
  });
693
699
  }, ke = ({ layer: t, observation: e, panel: r, project: n }) => {
694
700
  const a = it(t)(e, "hovered");
695
- return /* @__PURE__ */ d(st, {
701
+ return /* @__PURE__ */ s(st, {
696
702
  geom: "line",
697
703
  observation: e,
698
704
  panel: r,
@@ -704,12 +710,12 @@ var p = {
704
710
  coord: t,
705
711
  guideMode: "crosshair",
706
712
  swatchShape: "line",
707
- render: ({ layer: r, panelRect: n }) => /* @__PURE__ */ d(Ae, {
713
+ render: ({ layer: r, panelRect: n }) => /* @__PURE__ */ s(Ae, {
708
714
  layer: r,
709
715
  panel: n,
710
716
  coord: t
711
717
  }),
712
- renderHover: ({ layer: r, primary: n, panelRect: a }) => /* @__PURE__ */ d(ke, {
718
+ renderHover: ({ layer: r, primary: n, panelRect: a }) => /* @__PURE__ */ s(ke, {
713
719
  layer: r,
714
720
  observation: n.observation,
715
721
  panel: a,
@@ -723,37 +729,37 @@ var p = {
723
729
  y: a
724
730
  };
725
731
  }
726
- }), xe = ft("cartesian", I), we = ft("polar", T), Re = 0.85, Me = 1.6, Ee = 4, Q = ({ layer: t, observations: e, panel: r, project: n, state: a }) => {
727
- const i = X(t), l = S(t), o = R(() => O(t.data, t.mapping, t.id), [
732
+ }), xe = ft("cartesian", I), Re = ft("polar", T), we = 0.85, Me = 1.6, Ee = 4, Q = ({ layer: t, observations: e, panel: r, project: n, state: a }) => {
733
+ const i = G(t), l = S(t), o = x(() => b(t.data, t.mapping, t.id), [
728
734
  t.data,
729
735
  t.mapping,
730
736
  t.id
731
- ]), s = a === "hovered", h = s ? Ee : 0;
732
- return /* @__PURE__ */ d("g", {
737
+ ]), h = a === "hovered", d = h ? Ee : 0;
738
+ return /* @__PURE__ */ s("g", {
733
739
  "data-geom": "point",
734
- children: Array.from(e, (g) => {
735
- const u = n(g, r);
740
+ children: Array.from(e, (p) => {
741
+ const u = n(p, r);
736
742
  if (u === null) return null;
737
- const f = l(g, a), y = i.get("size", g, a) + h;
738
- return /* @__PURE__ */ d(k, {
739
- strikes: [E("o", u.x, u.y, y * Re, y)],
743
+ const f = l(p, a), y = i.get("size", p, a) + d;
744
+ return /* @__PURE__ */ s(k, {
745
+ strikes: [E("o", u.x, u.y, y * we, y)],
740
746
  color: f.color,
741
747
  opacity: f.opacity,
742
748
  width: Me,
743
- isOverstruck: s
744
- }, o(g));
749
+ isOverstruck: h
750
+ }, o(p));
745
751
  })
746
752
  });
747
753
  }, mt = (t, e) => M("point", {
748
754
  coord: t,
749
755
  swatchShape: "circle",
750
- render: ({ layer: r, panelRect: n }) => /* @__PURE__ */ d(Q, {
756
+ render: ({ layer: r, panelRect: n }) => /* @__PURE__ */ s(Q, {
751
757
  layer: r,
752
758
  observations: r.data,
753
759
  panel: n,
754
760
  project: e
755
761
  }),
756
- renderHover: ({ layer: r, primary: n, panelRect: a }) => /* @__PURE__ */ d(Q, {
762
+ renderHover: ({ layer: r, primary: n, panelRect: a }) => /* @__PURE__ */ s(Q, {
757
763
  layer: r,
758
764
  observations: [n.observation],
759
765
  panel: a,
@@ -761,13 +767,13 @@ var p = {
761
767
  state: "hovered"
762
768
  }),
763
769
  renderHoverCompanions: () => null
764
- }), Te = mt("cartesian", I), Se = mt("polar", T), Pe = 4, $e = 1.2, Ie = 3, L = Math.PI * 2, _e = 0.3, We = (t, e) => {
765
- const { startAngle: r, endAngle: n } = Tt(t), { innerRadius: a, outerRadius: i } = rt(t);
770
+ }), Te = mt("cartesian", I), Se = mt("polar", T), Pe = 4, $e = 1.2, Ie = 3, H = Math.PI * 2, _e = 0.3, We = (t, e) => {
771
+ const { startAngle: r, endAngle: n } = St(t), { innerRadius: a, outerRadius: i } = rt(t);
766
772
  if (r === null || n === null || a === null || i === null) return null;
767
773
  const l = Math.min(e.width, e.height) / 2;
768
774
  if (l <= 0 || i <= 0) return null;
769
- const o = Math.max(0, n - r), s = Pe / 2 / (i * l), h = o >= L - 1e-6 ? 0 : Math.min(s, o / 4), g = r + h, u = n - h, f = wt({
770
- startAngle: g,
775
+ const o = Math.max(0, n - r), h = Pe / 2 / (i * l), d = o >= H - 1e-6 ? 0 : Math.min(h, o / 4), p = r + d, u = n - d, f = Rt({
776
+ startAngle: p,
771
777
  endAngle: u,
772
778
  innerRadius: a,
773
779
  outerRadius: i
@@ -779,164 +785,164 @@ var p = {
779
785
  });
780
786
  return f === void 0 ? null : {
781
787
  path: f,
782
- startAngle: g,
788
+ startAngle: p,
783
789
  endAngle: u,
784
790
  inner: a * l,
785
791
  outer: i * l
786
792
  };
787
- }, be = (t, e, r, n) => {
793
+ }, Le = (t, e, r, n) => {
788
794
  const a = Math.hypot(e, r);
789
795
  if (a > t.outer - n || a < t.inner + n) return !1;
790
- const i = ((Math.atan2(e, -r) - t.startAngle) % L + L) % L, l = n / Math.max(a, 1);
796
+ const i = ((Math.atan2(e, -r) - t.startAngle) % H + H) % H, l = n / Math.max(a, 1);
791
797
  return i >= l && i <= t.endAngle - t.startAngle - l;
792
- }, Le = (t, e, r) => {
793
- const n = G(r), a = Math.ceil(t.outer / 8) + 1, i = Math.ceil(t.outer / 12) + 1, l = -Math.hypot(8, 12) / 2, o = [];
794
- for (let s = -i; s <= i; s += 1) for (let h = -a; h <= a; h += 1) {
795
- const g = h * 8, u = s * 12;
796
- be(t, g, u, l) && o.push(n("/", e.width / 2 + g, e.height / 2 + u, 5, 8, h, s));
798
+ }, He = (t, e, r) => {
799
+ const n = D(r), a = Math.ceil(t.outer / 8) + 1, i = Math.ceil(t.outer / 12) + 1, l = -Math.hypot(8, 12) / 2, o = [];
800
+ for (let h = -i; h <= i; h += 1) for (let d = -a; d <= a; d += 1) {
801
+ const p = d * 8, u = h * 12;
802
+ Le(t, p, u, l) && o.push(n("/", e.width / 2 + p, e.height / 2 + u, 5, 8, d, h));
797
803
  }
798
804
  return o;
799
805
  }, tt = ({ layer: t, observations: e, panel: r, state: n }) => {
800
- const a = S(t), i = P("slice-shading"), l = R(() => O(t.data, t.mapping, t.id), [
806
+ const a = S(t), i = P("slice-shading"), l = x(() => b(t.data, t.mapping, t.id), [
801
807
  t.data,
802
808
  t.mapping,
803
809
  t.id
804
810
  ]);
805
- return r.width <= 0 || r.height <= 0 ? null : /* @__PURE__ */ d("g", {
811
+ return r.width <= 0 || r.height <= 0 ? null : /* @__PURE__ */ s("g", {
806
812
  "data-geom": "bar",
807
813
  children: Array.from(e, (o) => {
808
- const s = We(o, r);
809
- if (s === null) return null;
810
- const h = l(o), g = a(o, n), u = `${i}-${h.replace(/[^a-zA-Z0-9]/gu, "")}`;
811
- return /* @__PURE__ */ x("g", {
812
- opacity: g.opacity,
814
+ const h = We(o, r);
815
+ if (h === null) return null;
816
+ const d = l(o), p = a(o, n), u = `${i}-${d.replace(/[^a-zA-Z0-9]/gu, "")}`;
817
+ return /* @__PURE__ */ R("g", {
818
+ opacity: p.opacity,
813
819
  children: [
814
- /* @__PURE__ */ d("path", {
815
- d: s.path,
816
- fill: p.paper
820
+ /* @__PURE__ */ s("path", {
821
+ d: h.path,
822
+ fill: g.paper
817
823
  }),
818
- /* @__PURE__ */ x("g", { children: [
819
- /* @__PURE__ */ d("clipPath", {
824
+ /* @__PURE__ */ R("g", { children: [
825
+ /* @__PURE__ */ s("clipPath", {
820
826
  id: u,
821
- children: /* @__PURE__ */ d("path", { d: s.path })
827
+ children: /* @__PURE__ */ s("path", { d: h.path })
822
828
  }),
823
- /* @__PURE__ */ d("path", {
824
- d: s.path,
825
- fill: g.color,
826
- fillOpacity: g.fillOpacity * _e
829
+ /* @__PURE__ */ s("path", {
830
+ d: h.path,
831
+ fill: p.color,
832
+ fillOpacity: p.fillOpacity * _e
827
833
  }),
828
- /* @__PURE__ */ d("g", {
834
+ /* @__PURE__ */ s("g", {
829
835
  clipPath: `url(#${u})`,
830
- children: /* @__PURE__ */ d(k, {
831
- strikes: Le(s, r, h),
832
- color: g.color,
833
- opacity: g.fillOpacity,
836
+ children: /* @__PURE__ */ s(k, {
837
+ strikes: He(h, r, d),
838
+ color: p.color,
839
+ opacity: p.fillOpacity,
834
840
  isOverstruck: n === "hovered"
835
841
  })
836
842
  })
837
843
  ] }),
838
- /* @__PURE__ */ d("path", {
839
- d: s.path,
844
+ /* @__PURE__ */ s("path", {
845
+ d: h.path,
840
846
  fill: "none",
841
- stroke: g.color,
847
+ stroke: p.color,
842
848
  strokeWidth: $e,
843
849
  strokeLinejoin: "round"
844
850
  })
845
851
  ]
846
- }, h);
852
+ }, d);
847
853
  })
848
854
  });
849
- }, He = M("bar", {
855
+ }, Oe = M("bar", {
850
856
  coord: "polar",
851
857
  guideMode: "band",
852
858
  swatchShape: "slice",
853
- render: ({ layer: t, panelRect: e }) => /* @__PURE__ */ d(tt, {
859
+ render: ({ layer: t, panelRect: e }) => /* @__PURE__ */ s(tt, {
854
860
  layer: t,
855
861
  observations: t.data,
856
862
  panel: e
857
863
  }),
858
- renderHover: ({ layer: t, primary: e, panelRect: r }) => /* @__PURE__ */ d(tt, {
864
+ renderHover: ({ layer: t, primary: e, panelRect: r }) => /* @__PURE__ */ s(tt, {
859
865
  layer: t,
860
866
  observations: [e.observation],
861
867
  panel: r,
862
868
  state: "hovered"
863
869
  }),
864
870
  renderHoverCompanions: () => null
865
- }), b = 2, Oe = 0.2, Ce = (t, e) => {
866
- const r = G(e), n = [], a = Math.floor(t.y / 12), i = Math.floor(t.x / 8);
871
+ }), L = 2, be = 0.2, Ce = (t, e) => {
872
+ const r = D(e), n = [], a = Math.floor(t.y / 12), i = Math.floor(t.x / 8);
867
873
  for (let l = a; l * 12 < t.y + t.height; l += 1) for (let o = i; o * 8 < t.x + t.width; o += 1) {
868
- const s = (o + 0.5) * 8, h = (l + 0.5) * 12;
869
- n.push(r("X", s, h, 5, 8, o, l));
874
+ const h = (o + 0.5) * 8, d = (l + 0.5) * 12;
875
+ n.push(r("X", h, d, 5, 8, o, l));
870
876
  }
871
877
  return n;
872
878
  }, Be = ({ layer: t, observation: e, seed: r, panel: n, clipId: a, state: i }) => {
873
879
  const l = S(t), o = Pt(e);
874
880
  if (o === null) return null;
875
- const s = l(e, i), h = {
876
- x: o.x * n.width + b / 2,
877
- y: o.y * n.height + b / 2,
878
- width: Math.max(0, o.width * n.width - b),
879
- height: Math.max(0, o.height * n.height - b)
881
+ const h = l(e, i), d = {
882
+ x: o.x * n.width + L / 2,
883
+ y: o.y * n.height + L / 2,
884
+ width: Math.max(0, o.width * n.width - L),
885
+ height: Math.max(0, o.height * n.height - L)
880
886
  };
881
- return h.width <= 0 || h.height <= 0 ? null : /* @__PURE__ */ x("g", {
882
- opacity: s.opacity,
887
+ return d.width <= 0 || d.height <= 0 ? null : /* @__PURE__ */ R("g", {
888
+ opacity: h.opacity,
883
889
  children: [
884
- /* @__PURE__ */ d("clipPath", {
890
+ /* @__PURE__ */ s("clipPath", {
885
891
  id: a,
886
- children: /* @__PURE__ */ d("rect", { ...h })
892
+ children: /* @__PURE__ */ s("rect", { ...d })
887
893
  }),
888
- /* @__PURE__ */ d("rect", {
889
- ...h,
890
- fill: s.color,
891
- fillOpacity: s.fillOpacity
894
+ /* @__PURE__ */ s("rect", {
895
+ ...d,
896
+ fill: h.color,
897
+ fillOpacity: h.fillOpacity
892
898
  }),
893
- /* @__PURE__ */ d("g", {
899
+ /* @__PURE__ */ s("g", {
894
900
  clipPath: `url(#${a})`,
895
- children: /* @__PURE__ */ d(k, {
896
- strikes: Ce(h, r),
897
- color: p.paper,
898
- opacity: Oe,
901
+ children: /* @__PURE__ */ s(k, {
902
+ strikes: Ce(d, r),
903
+ color: g.paper,
904
+ opacity: be,
899
905
  isOverstruck: i === "hovered"
900
906
  })
901
907
  }),
902
- i === "hovered" && /* @__PURE__ */ d("rect", {
903
- ...h,
908
+ i === "hovered" && /* @__PURE__ */ s("rect", {
909
+ ...d,
904
910
  fill: "none",
905
- stroke: p.text,
906
- strokeWidth: s.edgeWidth
911
+ stroke: g.text,
912
+ strokeWidth: h.edgeWidth
907
913
  })
908
914
  ]
909
915
  });
910
916
  }, et = ({ layer: t, observations: e, panel: r, state: n }) => {
911
- const a = P("typewriter-tile"), i = R(() => Et(t.data, t.mapping, t.id), [
917
+ const a = P("typewriter-tile"), i = x(() => Tt(t.data, t.mapping, t.id), [
912
918
  t.data,
913
919
  t.mapping,
914
920
  t.id
915
921
  ]);
916
- return r.width <= 0 || r.height <= 0 ? null : /* @__PURE__ */ d("g", {
922
+ return r.width <= 0 || r.height <= 0 ? null : /* @__PURE__ */ s("g", {
917
923
  "data-geom": "tile",
918
924
  children: Array.from(e, (l, o) => {
919
- const s = i(l);
920
- return /* @__PURE__ */ d(Be, {
925
+ const h = i(l);
926
+ return /* @__PURE__ */ s(Be, {
921
927
  layer: t,
922
928
  observation: l,
923
- seed: s,
929
+ seed: h,
924
930
  panel: r,
925
931
  clipId: `${a}-${o}`,
926
932
  state: n
927
- }, s);
933
+ }, h);
928
934
  })
929
935
  });
930
936
  }, Ge = M("tile", {
931
937
  coord: "cartesian",
932
938
  guideMode: null,
933
939
  swatchShape: "square",
934
- render: ({ layer: t, panelRect: e }) => /* @__PURE__ */ d(et, {
940
+ render: ({ layer: t, panelRect: e }) => /* @__PURE__ */ s(et, {
935
941
  layer: t,
936
942
  observations: t.data,
937
943
  panel: e
938
944
  }),
939
- renderHover: ({ layer: t, primary: e, panelRect: r }) => /* @__PURE__ */ d(et, {
945
+ renderHover: ({ layer: t, primary: e, panelRect: r }) => /* @__PURE__ */ s(et, {
940
946
  layer: t,
941
947
  observations: [e.observation],
942
948
  panel: r,
@@ -945,19 +951,19 @@ var p = {
945
951
  renderHoverCompanions: () => null
946
952
  }), De = [
947
953
  ye,
948
- He,
954
+ Oe,
949
955
  Ge,
950
956
  xe,
951
- we,
957
+ Re,
952
958
  oe,
953
959
  le,
954
960
  Te,
955
961
  Se
956
962
  ], ze = (t) => {
957
- const e = P("typewriter-rect"), r = at(), n = r === null ? null : Ot(t, r);
958
- return n === null || t.fill === void 0 ? /* @__PURE__ */ d(kt, { ...t }) : n.width <= 0 || n.height <= 0 ? null : /* @__PURE__ */ d("g", {
963
+ const e = P("typewriter-rect"), r = at(), n = r === null ? null : bt(t, r);
964
+ return n === null || t.fill === void 0 ? /* @__PURE__ */ s(kt, { ...t }) : n.width <= 0 || n.height <= 0 ? null : /* @__PURE__ */ s("g", {
959
965
  "data-testid": t["data-testid"],
960
- children: /* @__PURE__ */ d(gt, {
966
+ children: /* @__PURE__ */ s(gt, {
961
967
  rect: n,
962
968
  edge: "top",
963
969
  seed: `${n.x},${n.y}`,
@@ -979,32 +985,32 @@ var p = {
979
985
  height: Math.max(...n) - i
980
986
  };
981
987
  }, Xe = (t) => {
982
- const e = P("typewriter-path"), r = at(), n = R(() => {
988
+ const e = P("typewriter-path"), r = at(), n = x(() => {
983
989
  const i = Ne(t.d);
984
990
  return r === null || i === null ? null : ht(r, t.d, i);
985
991
  }, [r, t.d]);
986
- if (n === null || t.fill === void 0 || t.fill.startsWith("url(")) return /* @__PURE__ */ d(At, { ...t });
992
+ if (n === null || t.fill === void 0 || t.fill.startsWith("url(")) return /* @__PURE__ */ s(At, { ...t });
987
993
  const a = t.fillOpacity ?? 1;
988
- return /* @__PURE__ */ x("g", {
994
+ return /* @__PURE__ */ R("g", {
989
995
  "data-testid": t["data-testid"],
990
996
  opacity: t.opacity ?? 1,
991
997
  children: [
992
- /* @__PURE__ */ d("clipPath", {
998
+ /* @__PURE__ */ s("clipPath", {
993
999
  id: e,
994
- children: /* @__PURE__ */ d("path", { d: t.d })
1000
+ children: /* @__PURE__ */ s("path", { d: t.d })
995
1001
  }),
996
- /* @__PURE__ */ d("path", {
1002
+ /* @__PURE__ */ s("path", {
997
1003
  d: t.d,
998
- fill: p.paper
1004
+ fill: g.paper
999
1005
  }),
1000
- /* @__PURE__ */ d("path", {
1006
+ /* @__PURE__ */ s("path", {
1001
1007
  d: t.d,
1002
1008
  fill: t.fill,
1003
1009
  fillOpacity: a * dt
1004
1010
  }),
1005
- /* @__PURE__ */ d("g", {
1011
+ /* @__PURE__ */ s("g", {
1006
1012
  clipPath: `url(#${e})`,
1007
- children: /* @__PURE__ */ d(k, {
1013
+ children: /* @__PURE__ */ s(k, {
1008
1014
  strikes: n,
1009
1015
  color: t.fill,
1010
1016
  opacity: a
package/package.json CHANGED
@@ -13,7 +13,7 @@
13
13
  "theme",
14
14
  "typewriter"
15
15
  ],
16
- "version": "0.1.1-beta.1792421638596",
16
+ "version": "0.1.1-beta.1792426767391",
17
17
  "type": "module",
18
18
  "sideEffects": [
19
19
  "*.css"
@@ -40,7 +40,7 @@
40
40
  },
41
41
  "peerDependencies": {
42
42
  "react": "^19.0.0",
43
- "@graphysdk/react": "^1.9.0-beta.1792421638596"
43
+ "@graphysdk/react": "^1.9.0-beta.1792426767391"
44
44
  },
45
45
  "devDependencies": {
46
46
  "@testing-library/react": "^16.3.1",
@@ -52,11 +52,11 @@
52
52
  "vite": "^8.1.5",
53
53
  "vite-plugin-dts": "^4.5.4",
54
54
  "vitest": "^4.1.11",
55
- "@graphysdk/viz-engine": "1.9.0-beta.1792421638596",
56
- "@graphytools/eslint-config": "0.0.1",
55
+ "@graphysdk/react": "1.9.0-beta.1792426767391",
56
+ "@graphysdk/viz-engine": "1.9.0-beta.1792426767391",
57
57
  "@graphytools/typescript-config": "0.0.1",
58
58
  "@graphytools/vitest-config": "1.0.0",
59
- "@graphysdk/react": "1.9.0-beta.1792421638596"
59
+ "@graphytools/eslint-config": "0.0.1"
60
60
  },
61
61
  "publishConfig": {
62
62
  "access": "public"