@graphysdk/theme-typewriter 0.1.1-beta.1793695024668 → 0.1.1-beta.1793700147232
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 +1 -1
- package/dist/index.mjs +171 -176
- package/dist/renderer/bar.d.ts +1 -2
- package/package.json +6 -6
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
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",x={black:"#1F1B16",red:"#B3271E",carbonBlue:"#2F4F8F",pencilGrey:"#6E6A62",stampGreen:"#2E6B4B",duplicatorViolet:"#7B5A9C"},de=[x.black,x.red,x.carbonBlue,x.pencilGrey,x.stampGreen,x.duplicatorViolet],he=["#D6C18B",x.black],ce=[x.carbonBlue,"#DECEA4",x.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},O={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,hoverStroke: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:x.red,annotationArrow:g.text,differenceLabelBackground:g.card,trendPositive:x.black,trendNegative:x.red,trendNeutral:x.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:x.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.axisLine({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({...O}),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({...O,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:x.red,stroke:g.paper,shadow:"none"}),i.style.annotation.pinnedNumber.label({..._}),i.style.annotation.comment({fill:x.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.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}},xe=e=>`${e.map((t,r)=>`${r===0?"M":"L"}${t.x},${t.y}`).join(" ")} Z`,S=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)}}},ye=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},y=e=>Math.round(e*B)/B,Z=(e,t,r,n,a)=>{const o=y(t-n/2),d=y(t+n/2),l=y(r-a/2),c=y(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${y(m-D)},${P}L${y(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},${y(r)}L${d},${y(r)}`;if(e==="|")return`M${y(t)},${l}L${y(t)},${c}`;const p=y(n/2),u=y(a/2);return`M${o},${y(r)}a${p},${u} 0 1,0 ${y(n)},0a${p},${u} 0 1,0 ${-y(n)},0`},W=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}),w=e=>`${e}-${(0,A.useId)().replace(/[^a-zA-Z0-9]/gu,"")}`,k=({strikes:e,color:t,opacity:r=1,width:n=ye,overstruck: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,L=(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:xe(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}),Se=({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,overstruck:!0})})},Q=.55,we=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)),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=S(e),a=w("typewriter-area"),o=(0,A.useMemo)(()=>{if(t===void 0)return L(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 L(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:we,strokeLinejoin:"round",strokeLinecap:"round"})]},d)})})},re=({layer:e,observation:t,panel:r,project:n})=>{const a=S(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}},Le={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",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}},H=(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?H(e.width,8):H(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)}))},He=(e,t)=>{const r=t==="top"||t==="bottom",n=H(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)})},Oe=({layer:e,observation:t,bounds:r,seed:n,mainAxis:a,panel:o,clipId:d,state:l})=>{const c=S(e);if(!r||r.width<=0||r.height<=0)return null;const h=c(t,l),p=Ie[(0,i.getStackRole)(t)],u=We(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?[]:[Le[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,overstruck:l==="hovered"})},ae=({rect:e,edge:t,seed:r,clipId:n,color:a,opacity:o,pressure:d,overstruck: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,overstruck:l})}),(0,s.jsx)(k,{strikes:He(e,t),color:a,width:ne,overstruck:l})]}),K=({layer:e,observations:t,mainAxis:r,panel:n,state:a})=>{const o=w("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)(Oe,{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 L(e,d=>q(d,t),j,t);const o=(0,i.createLinePathGenerator)(e.params);return L(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)(Se,{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=S(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,overstruck: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=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 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=S(e),o=w("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,overstruck: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=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 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=S(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,overstruck: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=w("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=w("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,overstruck:!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=w("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;
|
|
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},C={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,hoverStroke: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.axisLine({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({...C}),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({...C,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.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(" ")},E=(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}},M=(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,T=[.72,.87,1],O=.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},W=(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`},b=e=>{const t=Ae(e);return(r,n,a,o,d,l,c)=>{const h=(W(t,l,c,1)*2-1)*O,p=(W(t,l,c,2)*2-1)*O,u=Math.floor(W(t,l,c,3)*T.length);return{path:Z(r,n+h,a+p,o,d),weight:u}}},j=(e,t,r,n,a)=>({path:Z(e,t,r,n,a),weight:T.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,overstruck:a=!1})=>e.length===0?null:(0,s.jsxs)("g",{fill:"none",stroke:t,strokeWidth:n,strokeLinecap:"round",opacity:r,children:[T.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:T[d]},T[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,je=1.8,L=(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=M(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)},Me=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})=>Me(e)?(0,s.jsx)(k,{strikes:e.map(({x:n,y:a})=>j("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:[j("X",d.x,d.y,N,N)],color:a,opacity:o,width:je,overstruck:!0})})},Q=.55,Se=1.5,ee=(e,t,r={x:0,y:0,...e})=>{const n=b(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 L(e,h=>q(h,r),M,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 L(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},E,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})},Te=(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:E}),renderHoverCompanions:()=>null}),Ee=(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:M}),renderHoverCompanions:()=>null}),Pe=2,ne=1.8,$e=1,_e=3.3,Ie={solo:{base:!0,value:!0},base:{base:!0,value:!1},tip:{base:!1,value:!0},middle:{base:!1,value:!1}},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}},H=(e,t)=>{const r=Math.max(1,Math.round(e/t));return{count:r,size:e/r}},K=(e,t,r)=>{const n=[];for(let a=_e+r/2;a-r/2<e;a+=t)n.push(a);return n},be=(e,t,r)=>{const n=b(r),a=t==="top"||t==="bottom",o=a?H(e.width,8):H(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?K(e.height,12,8):K(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)}))},We=(e,t)=>{const r=t==="top"||t==="bottom",n=H(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"?j("_",e.x+c,e.y+o,a,0):t==="bottom"?j("_",e.x+c,e.y+e.height-o,a,0):j("|",t==="right"?e.x+e.width-o:e.x+o,e.y+c,0,a)})},Ge=({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=(0,i.readTipEdge)(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?[]:[(0,i.readBaseEdge)(t,a)]].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:n,clipId:d,color:h.color,opacity:h.opacity,pressure:h.fillOpacity,overstruck:l==="hovered"})},ae=({rect:e,edge:t,seed:r,clipId:n,color:a,opacity:o,pressure:d,overstruck: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:be(e,t,r),color:a,opacity:d,overstruck:l})}),(0,s.jsx)(k,{strikes:We(e,t),color:a,width:ne,overstruck:l})]}),X=({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)(Ge,{layer:e,observation:h,bounds:c(h),seed:u,mainAxis:r,panel:n,clipId:`${o}-${p}`,state:a},u)})})},He=(0,i.defineGeomRenderer)("bar",{coord:"cartesian",guideMode:"band",swatchShape:"square",render:({layer:e,coordSystem:t,panelRect:r})=>(0,s.jsx)(X,{layer:e,observations:e.data,mainAxis:(0,i.readMainAxis)(t),panel:r}),renderHover:({layer:e,coordSystem:t,primary:r,panelRect:n})=>(0,s.jsx)(X,{layer:e,observations:[r.observation],mainAxis:(0,i.readMainAxis)(t),panel:n,state:"hovered"}),renderHoverCompanions:()=>null}),Ce=({layer:e,panel:t,coord:r})=>{const n=U(e),a=(0,A.useMemo)(()=>{if(r==="polar")return L(e,d=>q(d,t),M,t);const o=(0,i.createLinePathGenerator)(e.params);return L(e,d=>{const l=o((0,i.prepareLineObservations)(d,e.params.missingValues));return l?G(l,t):null},E,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)})})},Oe=({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)(Ce,{layer:r,panel:n,coord:e}),renderHover:({layer:r,primary:n,panelRect:a})=>(0,s.jsx)(Oe,{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}}}),Be=ie("cartesian",E),De=ie("polar",M),ze=.85,Ne=1.6,Ke=4,F=({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?Ke: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:[j("o",u.x,u.y,m*ze,m)],color:f.color,opacity:f.opacity,width:Ne,overstruck:c},l(p))})})},oe=(e,t)=>(0,i.defineGeomRenderer)("point",{coord:e,swatchShape:"circle",render:({layer:r,panelRect:n})=>(0,s.jsx)(F,{layer:r,observations:r.data,panel:n,project:t}),renderHover:({layer:r,primary:n,panelRect:a})=>(0,s.jsx)(F,{layer:r,observations:[n.observation],panel:a,project:t,state:"hovered"}),renderHoverCompanions:()=>null}),Xe=oe("cartesian",E),Fe=oe("polar",M),Ye=4,Ve=1.2,Ue=3,I=Math.PI*2,Ze=.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=Ye/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:Ue});return f===void 0?null:{path:f,startAngle:p,endAngle:u,inner:a*d,outer:o*d}},Je=(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},Qe=(e,t,r)=>{const n=b(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;Je(e,p,u,d)&&l.push(n("/",t.width/2+p,t.height/2+u,5,8,h,c))}return l},Y=({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*Ze}),(0,s.jsx)("g",{clipPath:`url(#${u})`,children:(0,s.jsx)(k,{strikes:Qe(c,r,h),color:p.color,opacity:p.fillOpacity,overstruck:n==="hovered"})})]}),(0,s.jsx)("path",{d:c.path,fill:"none",stroke:p.color,strokeWidth:Ve,strokeLinejoin:"round"})]},h)})})},et=(0,i.defineGeomRenderer)("bar",{coord:"polar",guideMode:"band",swatchShape:"slice",render:({layer:e,panelRect:t})=>(0,s.jsx)(Y,{layer:e,observations:e.data,panel:t}),renderHover:({layer:e,primary:t,panelRect:r})=>(0,s.jsx)(Y,{layer:e,observations:[t.observation],panel:r,state:"hovered"}),renderHoverCompanions:()=>null}),_=2,tt=.2,rt=(e,t)=>{const r=b(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},nt=({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:rt(h,r),color:g.paper,opacity:tt,overstruck: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)(nt,{layer:e,observation:d,seed:c,panel:r,clipId:`${a}-${l}`,state:n},c)})})},at=(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}),it=[He,et,at,Be,De,Te,Ee,Xe,Fe],ot=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,overstruck:!1})})},st=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}},lt=e=>{const t=S("typewriter-path"),r=(0,i.useGeomPanelSize)(),n=(0,A.useMemo)(()=>{const o=st(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})})]})},dt={Rect:ot,Path:lt},ht={name:"typewriter",styles:ue,palettes:{categorical:de,sequential:he,diverging:ce},config:{axes:{y:{position:"left"}}},colorScheme:"light",plugins:it,shapes:dt};exports.typewriter=ht;
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { useId as
|
|
2
|
-
import { DefaultGeomPath as
|
|
1
|
+
import { useId as mt, useMemo as x } from "react";
|
|
2
|
+
import { DefaultGeomPath as yt, DefaultGeomRect as At, GROUP_VARIABLES as kt, buildPolarBarArcPath as xt, createAreaPathGenerators as wt, createBarBoundsReader as Rt, createLinePathGenerator as Tt, createStableCellKeyGenerator as Et, createStableKeyGenerator as C, defineGeomRenderer as T, getAngleExtent as Mt, getPaintedTileRect as St, getRadiusExtent as rt, getStackRole as Pt, getX as O, getY as F, getYMax as $t, polarToUnit as It, prepareAreaObservations as _t, prepareLineObservations as Lt, readBaseEdge as Wt, readMainAxis as K, readRectPixels as Ht, readTipEdge as bt, style as c, toPaintColor as Ct, toStrokeDasharray as Ot, toViewBoxX as Bt, toViewBoxY as Gt, useGeomPanelSize as nt, useGeomStyleReader as B } from "@graphysdk/react";
|
|
3
3
|
import { jsx as s, jsxs as w } from "react/jsx-runtime";
|
|
4
4
|
var g = {
|
|
5
5
|
paper: "#EBD9A9",
|
|
@@ -8,21 +8,21 @@ var g = {
|
|
|
8
8
|
secondary: "#4A443A",
|
|
9
9
|
grid: "rgba(31, 27, 22, 0.4)",
|
|
10
10
|
edge: "#C4AE74"
|
|
11
|
-
},
|
|
11
|
+
}, Dt = "'Special Elite', 'Courier New', ui-monospace, monospace", v = {
|
|
12
12
|
black: "#1F1B16",
|
|
13
13
|
red: "#B3271E",
|
|
14
14
|
carbonBlue: "#2F4F8F",
|
|
15
15
|
pencilGrey: "#6E6A62",
|
|
16
16
|
stampGreen: "#2E6B4B",
|
|
17
17
|
duplicatorViolet: "#7B5A9C"
|
|
18
|
-
},
|
|
18
|
+
}, zt = [
|
|
19
19
|
v.black,
|
|
20
20
|
v.red,
|
|
21
21
|
v.carbonBlue,
|
|
22
22
|
v.pencilGrey,
|
|
23
23
|
v.stampGreen,
|
|
24
24
|
v.duplicatorViolet
|
|
25
|
-
],
|
|
25
|
+
], Nt = ["#D6C18B", v.black], Ft = [
|
|
26
26
|
v.carbonBlue,
|
|
27
27
|
"#DECEA4",
|
|
28
28
|
v.red
|
|
@@ -42,7 +42,7 @@ var g = {
|
|
|
42
42
|
}, A = {
|
|
43
43
|
fontWeight: 400,
|
|
44
44
|
textColor: g.secondary
|
|
45
|
-
},
|
|
45
|
+
}, X = {
|
|
46
46
|
fill: g.card,
|
|
47
47
|
stroke: g.text,
|
|
48
48
|
strokeWidth: 1,
|
|
@@ -74,7 +74,7 @@ var g = {
|
|
|
74
74
|
c.graph({
|
|
75
75
|
strokeWidth: 1,
|
|
76
76
|
cornerRadius: 0,
|
|
77
|
-
fontFamily:
|
|
77
|
+
fontFamily: Dt,
|
|
78
78
|
fontWeight: 400,
|
|
79
79
|
padding: 24
|
|
80
80
|
}),
|
|
@@ -179,7 +179,7 @@ var g = {
|
|
|
179
179
|
fill: "transparent",
|
|
180
180
|
stroke: "transparent"
|
|
181
181
|
}),
|
|
182
|
-
c.legend.popover({ ...
|
|
182
|
+
c.legend.popover({ ...X }),
|
|
183
183
|
c.directLabel({
|
|
184
184
|
fontWeight: 400,
|
|
185
185
|
fontSize: 13
|
|
@@ -189,7 +189,7 @@ var g = {
|
|
|
189
189
|
c.headlineItem.label({ ...A }),
|
|
190
190
|
c.headlineItem.trend({ fontWeight: 400 }),
|
|
191
191
|
c.tooltip({
|
|
192
|
-
...
|
|
192
|
+
...X,
|
|
193
193
|
paddingInline: 12,
|
|
194
194
|
paddingBlock: 9
|
|
195
195
|
}),
|
|
@@ -253,63 +253,63 @@ var g = {
|
|
|
253
253
|
textOutlineWidth: 8
|
|
254
254
|
}, { coord: "polar" })
|
|
255
255
|
]
|
|
256
|
-
},
|
|
256
|
+
}, Xt = /[a-df-zA-DF-Z]|[-+]?(?:\d+\.?\d*|\.\d+)(?:[eE][-+]?\d+)?/gu, Vt = /^[a-zA-Z]$/u, Yt = (t, e) => t === "H" ? "x" : t === "V" ? "y" : e % 2 === 0 ? "x" : "y", z = (t, e) => {
|
|
257
257
|
let r = "", n = 0;
|
|
258
|
-
return (t.match(
|
|
259
|
-
if (
|
|
258
|
+
return (t.match(Xt) ?? []).map((a) => {
|
|
259
|
+
if (Vt.test(a))
|
|
260
260
|
return r = a.toUpperCase(), n = 0, a;
|
|
261
|
-
const i =
|
|
261
|
+
const i = Yt(r, n);
|
|
262
262
|
return n += 1, String(Number(a) * (i === "x" ? e.width : e.height));
|
|
263
263
|
}).join(" ");
|
|
264
264
|
}, I = (t, e) => {
|
|
265
|
-
const r = O(t), n =
|
|
265
|
+
const r = O(t), n = F(t) ?? $t(t);
|
|
266
266
|
return r === null || n === null ? null : {
|
|
267
|
-
x:
|
|
268
|
-
y:
|
|
267
|
+
x: Bt(r) * e.width,
|
|
268
|
+
y: Gt(n) * e.height
|
|
269
269
|
};
|
|
270
|
-
},
|
|
271
|
-
const r = O(t), n =
|
|
270
|
+
}, M = (t, e) => {
|
|
271
|
+
const r = O(t), n = F(t) ?? rt(t).outerRadius;
|
|
272
272
|
if (r === null || n === null) return null;
|
|
273
|
-
const a =
|
|
273
|
+
const a = It(r, n), i = Math.min(e.width, e.height) / 2;
|
|
274
274
|
return {
|
|
275
275
|
x: e.width / 2 + a.x * i,
|
|
276
276
|
y: e.height / 2 - a.y * i
|
|
277
277
|
};
|
|
278
|
-
},
|
|
279
|
-
const e =
|
|
278
|
+
}, jt = (t) => `${t.map((e, r) => `${r === 0 ? "M" : "L"}${e.x},${e.y}`).join(" ")} Z`, S = (t) => {
|
|
279
|
+
const e = B(t);
|
|
280
280
|
return (r, n) => ({
|
|
281
|
-
color:
|
|
281
|
+
color: Ct(e.get("fill", r, n)),
|
|
282
282
|
opacity: e.get("alpha", r, n),
|
|
283
283
|
fillOpacity: e.get("fillAlpha", r, n),
|
|
284
284
|
edge: e.get("stroke", r, n),
|
|
285
285
|
edgeWidth: e.get("strokeWidth", r, n)
|
|
286
286
|
});
|
|
287
|
-
},
|
|
288
|
-
const e =
|
|
287
|
+
}, at = (t) => {
|
|
288
|
+
const e = B(t);
|
|
289
289
|
return (r, n) => {
|
|
290
290
|
const a = e.get("strokeWidth", r, n);
|
|
291
291
|
return {
|
|
292
292
|
color: e.get("stroke", r, n),
|
|
293
293
|
opacity: e.get("alpha", r, n) * e.get("strokeAlpha", r, n),
|
|
294
294
|
width: a,
|
|
295
|
-
dashArray:
|
|
295
|
+
dashArray: Ot(e.get("dashArray", r, n), a)
|
|
296
296
|
};
|
|
297
297
|
};
|
|
298
|
-
},
|
|
298
|
+
}, Ut = 1.3, $ = [
|
|
299
299
|
0.72,
|
|
300
300
|
0.87,
|
|
301
301
|
1
|
|
302
|
-
], V = 0.35,
|
|
302
|
+
], V = 0.35, Zt = 0.7, Y = 100, j = 0.7, qt = 4, Jt = (t) => {
|
|
303
303
|
let e = 2166136261;
|
|
304
304
|
for (let r = 0; r < t.length; r += 1)
|
|
305
305
|
e ^= t.charCodeAt(r), e = Math.imul(e, 16777619);
|
|
306
306
|
return e >>> 0;
|
|
307
|
-
},
|
|
307
|
+
}, D = (t, e, r, n) => {
|
|
308
308
|
let a = Math.imul(t ^ Math.imul(e, 374761393) ^ Math.imul(r, 668265263) ^ n, 1274126177);
|
|
309
309
|
return a = Math.imul(a ^ a >>> 13, 1103515245), ((a ^ a >>> 16) >>> 0) / 4294967296;
|
|
310
|
-
}, m = (t) => Math.round(t * Y) / Y,
|
|
310
|
+
}, m = (t) => Math.round(t * Y) / Y, it = (t, e, r, n, a) => {
|
|
311
311
|
const i = m(e - n / 2), l = m(e + n / 2), o = m(r - a / 2), h = m(r + a / 2), d = `M${i},${o}L${l},${h}M${l},${o}L${i},${h}`;
|
|
312
|
-
if (t === "x" || t === "X" && n <
|
|
312
|
+
if (t === "x" || t === "X" && n < qt) return d;
|
|
313
313
|
if (t === "X") {
|
|
314
314
|
const f = (y, _) => `M${m(y - j)},${_}L${m(y + j)},${_}`;
|
|
315
315
|
return `${d}${f(i, o)}${f(l, o)}${f(i, h)}${f(l, h)}`;
|
|
@@ -319,19 +319,19 @@ var g = {
|
|
|
319
319
|
if (t === "|") return `M${m(e)},${o}L${m(e)},${h}`;
|
|
320
320
|
const p = m(n / 2), u = m(a / 2);
|
|
321
321
|
return `M${i},${m(r)}a${p},${u} 0 1,0 ${m(n)},0a${p},${u} 0 1,0 ${-m(n)},0`;
|
|
322
|
-
},
|
|
323
|
-
const e =
|
|
322
|
+
}, G = (t) => {
|
|
323
|
+
const e = Jt(t);
|
|
324
324
|
return (r, n, a, i, l, o, h) => {
|
|
325
|
-
const d = (
|
|
325
|
+
const d = (D(e, o, h, 1) * 2 - 1) * V, p = (D(e, o, h, 2) * 2 - 1) * V, u = Math.floor(D(e, o, h, 3) * $.length);
|
|
326
326
|
return {
|
|
327
|
-
path:
|
|
327
|
+
path: it(r, n + d, a + p, i, l),
|
|
328
328
|
weight: u
|
|
329
329
|
};
|
|
330
330
|
};
|
|
331
331
|
}, E = (t, e, r, n, a) => ({
|
|
332
|
-
path:
|
|
332
|
+
path: it(t, e, r, n, a),
|
|
333
333
|
weight: $.length - 1
|
|
334
|
-
}), P = (t) => `${t}-${
|
|
334
|
+
}), P = (t) => `${t}-${mt().replace(/[^a-zA-Z0-9]/gu, "")}`, k = ({ strikes: t, color: e, opacity: r = 1, width: n = Ut, overstruck: a = !1 }) => t.length === 0 ? null : /* @__PURE__ */ w("g", {
|
|
335
335
|
fill: "none",
|
|
336
336
|
stroke: e,
|
|
337
337
|
strokeWidth: n,
|
|
@@ -342,9 +342,9 @@ var g = {
|
|
|
342
342
|
strokeOpacity: $[l]
|
|
343
343
|
}, $[l])), a && /* @__PURE__ */ s("path", {
|
|
344
344
|
d: t.map((i) => i.path).join(""),
|
|
345
|
-
transform: `translate(${
|
|
345
|
+
transform: `translate(${Zt},0)`
|
|
346
346
|
})]
|
|
347
|
-
}), U = 6,
|
|
347
|
+
}), U = 6, Qt = 14, te = 1.5, Z = 10, ee = 1.8, b = (t, e, r, n) => {
|
|
348
348
|
const a = C(t.data, t.mapping, t.id), i = [];
|
|
349
349
|
return t.data.groupBy(kt.group).forEach((l) => {
|
|
350
350
|
const o = [...l], [h] = o, d = e(o);
|
|
@@ -357,59 +357,59 @@ var g = {
|
|
|
357
357
|
readings: p
|
|
358
358
|
});
|
|
359
359
|
}), i;
|
|
360
|
-
},
|
|
360
|
+
}, ot = (t, e) => {
|
|
361
361
|
const r = t.flatMap((n) => {
|
|
362
|
-
const a = O(n), i =
|
|
362
|
+
const a = O(n), i = M(n, e);
|
|
363
363
|
return a === null || i === null ? [] : [{
|
|
364
364
|
angle: a,
|
|
365
365
|
point: i
|
|
366
366
|
}];
|
|
367
367
|
}).sort((n, a) => n.angle - a.angle).map(({ point: n }) => n);
|
|
368
|
-
return r.length === 0 ? null :
|
|
369
|
-
},
|
|
368
|
+
return r.length === 0 ? null : jt(r);
|
|
369
|
+
}, re = (t) => t.every((e, r) => {
|
|
370
370
|
const n = t[r + 1];
|
|
371
|
-
return n === void 0 || Math.hypot(n.x - e.x, n.y - e.y) >=
|
|
372
|
-
}),
|
|
371
|
+
return n === void 0 || Math.hypot(n.x - e.x, n.y - e.y) >= Qt;
|
|
372
|
+
}), ne = ({ readings: t, color: e, opacity: r }) => re(t) ? /* @__PURE__ */ s(k, {
|
|
373
373
|
strikes: t.map(({ x: n, y: a }) => E("x", n, a, U, U)),
|
|
374
374
|
color: e,
|
|
375
375
|
opacity: r,
|
|
376
|
-
width:
|
|
377
|
-
}) : null,
|
|
376
|
+
width: te
|
|
377
|
+
}) : null, lt = ({ geom: t, observation: e, panel: r, project: n, color: a, opacity: i }) => {
|
|
378
378
|
const l = n(e, r);
|
|
379
379
|
return l === null ? null : /* @__PURE__ */ s("g", {
|
|
380
380
|
"data-geom": t,
|
|
381
|
-
children: /* @__PURE__ */ s(
|
|
381
|
+
children: /* @__PURE__ */ s(k, {
|
|
382
382
|
strikes: [E("X", l.x, l.y, Z, Z)],
|
|
383
383
|
color: a,
|
|
384
384
|
opacity: i,
|
|
385
|
-
width:
|
|
385
|
+
width: ee,
|
|
386
386
|
overstruck: !0
|
|
387
387
|
})
|
|
388
388
|
});
|
|
389
|
-
},
|
|
389
|
+
}, st = 0.55, ae = 1.5, dt = (t, e, r = {
|
|
390
390
|
x: 0,
|
|
391
391
|
y: 0,
|
|
392
392
|
...t
|
|
393
393
|
}) => {
|
|
394
|
-
const n =
|
|
394
|
+
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)), h = Math.min(Math.ceil(t.width / 8), Math.ceil((r.x + r.width) / 8));
|
|
395
395
|
for (let d = i; d < l; d += 1) {
|
|
396
396
|
const p = t.height - (d + 0.5) * 12;
|
|
397
397
|
for (let u = o; u < h; u += 1) a.push(n("/", (u + 0.5) * 8, p, 5, 8, u, d));
|
|
398
398
|
}
|
|
399
399
|
return a;
|
|
400
|
-
},
|
|
401
|
-
const n = S(t), a = P("typewriter-area"), i =
|
|
402
|
-
if (e === void 0) return b(t, (d) =>
|
|
400
|
+
}, ht = ({ layer: t, coordSystem: e, panel: r }) => {
|
|
401
|
+
const n = S(t), a = P("typewriter-area"), i = x(() => {
|
|
402
|
+
if (e === void 0) return b(t, (d) => ot(d, r), M, r).map((d) => ({
|
|
403
403
|
...d,
|
|
404
404
|
fill: d.path,
|
|
405
405
|
edge: d.path
|
|
406
406
|
}));
|
|
407
|
-
const { areaGenerator: l, lineGenerator: o } =
|
|
407
|
+
const { areaGenerator: l, lineGenerator: o } = wt(e, t.params), h = /* @__PURE__ */ new Map();
|
|
408
408
|
return b(t, (d) => {
|
|
409
|
-
const p =
|
|
409
|
+
const p = _t(d, t.params.missingValues), u = l(p), f = o(p);
|
|
410
410
|
if (!u) return null;
|
|
411
|
-
const y =
|
|
412
|
-
return f && h.set(y,
|
|
411
|
+
const y = z(u, r);
|
|
412
|
+
return f && h.set(y, z(f, r)), y;
|
|
413
413
|
}, I, r).map((d) => ({
|
|
414
414
|
...d,
|
|
415
415
|
fill: d.path,
|
|
@@ -438,12 +438,12 @@ var g = {
|
|
|
438
438
|
/* @__PURE__ */ s("path", {
|
|
439
439
|
d: h,
|
|
440
440
|
fill: u.color,
|
|
441
|
-
fillOpacity: u.fillOpacity *
|
|
441
|
+
fillOpacity: u.fillOpacity * st
|
|
442
442
|
}),
|
|
443
443
|
/* @__PURE__ */ s("g", {
|
|
444
444
|
clipPath: `url(#${a}-${p})`,
|
|
445
|
-
children: /* @__PURE__ */ s(
|
|
446
|
-
strikes:
|
|
445
|
+
children: /* @__PURE__ */ s(k, {
|
|
446
|
+
strikes: dt(r, l),
|
|
447
447
|
color: u.color,
|
|
448
448
|
opacity: u.fillOpacity
|
|
449
449
|
})
|
|
@@ -452,7 +452,7 @@ var g = {
|
|
|
452
452
|
d,
|
|
453
453
|
fill: "none",
|
|
454
454
|
stroke: u.color,
|
|
455
|
-
strokeWidth:
|
|
455
|
+
strokeWidth: ae,
|
|
456
456
|
strokeLinejoin: "round",
|
|
457
457
|
strokeLinecap: "round"
|
|
458
458
|
})
|
|
@@ -460,9 +460,9 @@ var g = {
|
|
|
460
460
|
}, l);
|
|
461
461
|
})
|
|
462
462
|
});
|
|
463
|
-
},
|
|
463
|
+
}, ct = ({ layer: t, observation: e, panel: r, project: n }) => {
|
|
464
464
|
const a = S(t)(e, "hovered");
|
|
465
|
-
return /* @__PURE__ */ s(
|
|
465
|
+
return /* @__PURE__ */ s(lt, {
|
|
466
466
|
geom: "area",
|
|
467
467
|
observation: e,
|
|
468
468
|
panel: r,
|
|
@@ -470,47 +470,47 @@ var g = {
|
|
|
470
470
|
color: a.color,
|
|
471
471
|
opacity: a.opacity
|
|
472
472
|
});
|
|
473
|
-
},
|
|
473
|
+
}, ie = T("area", {
|
|
474
474
|
coord: "cartesian",
|
|
475
475
|
guideMode: "crosshair",
|
|
476
476
|
swatchShape: "area",
|
|
477
|
-
render: ({ layer: t, coordSystem: e, panelRect: r }) => e.type !== "cartesian" ? null : /* @__PURE__ */ s(
|
|
477
|
+
render: ({ layer: t, coordSystem: e, panelRect: r }) => e.type !== "cartesian" ? null : /* @__PURE__ */ s(ht, {
|
|
478
478
|
layer: t,
|
|
479
479
|
coordSystem: e,
|
|
480
480
|
panel: r
|
|
481
481
|
}),
|
|
482
|
-
renderHover: ({ layer: t, primary: e, panelRect: r }) => /* @__PURE__ */ s(
|
|
482
|
+
renderHover: ({ layer: t, primary: e, panelRect: r }) => /* @__PURE__ */ s(ct, {
|
|
483
483
|
layer: t,
|
|
484
484
|
observation: e.observation,
|
|
485
485
|
panel: r,
|
|
486
486
|
project: I
|
|
487
487
|
}),
|
|
488
488
|
renderHoverCompanions: () => null
|
|
489
|
-
}),
|
|
489
|
+
}), oe = T("area", {
|
|
490
490
|
coord: "polar",
|
|
491
491
|
guideMode: "crosshair",
|
|
492
492
|
swatchShape: "area",
|
|
493
|
-
render: ({ layer: t, panelRect: e }) => /* @__PURE__ */ s(
|
|
493
|
+
render: ({ layer: t, panelRect: e }) => /* @__PURE__ */ s(ht, {
|
|
494
494
|
layer: t,
|
|
495
495
|
panel: e
|
|
496
496
|
}),
|
|
497
|
-
renderHover: ({ layer: t, primary: e, panelRect: r }) => /* @__PURE__ */ s(
|
|
497
|
+
renderHover: ({ layer: t, primary: e, panelRect: r }) => /* @__PURE__ */ s(ct, {
|
|
498
498
|
layer: t,
|
|
499
499
|
observation: e.observation,
|
|
500
500
|
panel: r,
|
|
501
|
-
project:
|
|
501
|
+
project: M
|
|
502
502
|
}),
|
|
503
503
|
renderHoverCompanions: () => null
|
|
504
|
-
}),
|
|
504
|
+
}), le = 2, ut = 1.8, se = 1, de = 3.3, he = {
|
|
505
505
|
solo: {
|
|
506
506
|
base: !0,
|
|
507
507
|
value: !0
|
|
508
508
|
},
|
|
509
|
-
|
|
509
|
+
base: {
|
|
510
510
|
base: !0,
|
|
511
511
|
value: !1
|
|
512
512
|
},
|
|
513
|
-
|
|
513
|
+
tip: {
|
|
514
514
|
base: !1,
|
|
515
515
|
value: !0
|
|
516
516
|
},
|
|
@@ -518,12 +518,7 @@ var g = {
|
|
|
518
518
|
base: !1,
|
|
519
519
|
value: !1
|
|
520
520
|
}
|
|
521
|
-
},
|
|
522
|
-
top: "bottom",
|
|
523
|
-
bottom: "top",
|
|
524
|
-
left: "right",
|
|
525
|
-
right: "left"
|
|
526
|
-
}, pe = (t, e) => e === "x" ? (nt(t) ?? B(t) ?? 0) >= (Lt(t) ?? 0) ? "top" : "bottom" : (It(t) ?? 0) >= (_t(t) ?? 0) ? "right" : "left", ge = (t, e, r) => {
|
|
521
|
+
}, ce = (t, e, r) => {
|
|
527
522
|
const n = Math.max(0, t.width - r), a = Math.max(0, t.height - r);
|
|
528
523
|
return e === "top" ? {
|
|
529
524
|
...t,
|
|
@@ -540,7 +535,7 @@ var g = {
|
|
|
540
535
|
...t,
|
|
541
536
|
width: n
|
|
542
537
|
};
|
|
543
|
-
},
|
|
538
|
+
}, N = (t, e) => {
|
|
544
539
|
const r = Math.max(1, Math.round(t / e));
|
|
545
540
|
return {
|
|
546
541
|
count: r,
|
|
@@ -548,10 +543,10 @@ var g = {
|
|
|
548
543
|
};
|
|
549
544
|
}, q = (t, e, r) => {
|
|
550
545
|
const n = [];
|
|
551
|
-
for (let a =
|
|
546
|
+
for (let a = de + r / 2; a - r / 2 < t; a += e) n.push(a);
|
|
552
547
|
return n;
|
|
553
|
-
},
|
|
554
|
-
const n =
|
|
548
|
+
}, ue = (t, e, r) => {
|
|
549
|
+
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));
|
|
555
550
|
return (a ? q(t.height, 12, 8) : q(t.width, 8, 5)).flatMap((h, d) => Array.from({ length: i.count }, (p, u) => {
|
|
556
551
|
const f = (u + 0.5) * i.size;
|
|
557
552
|
if (e === "top") return n("X", t.x + f, t.y + h, l, o, u, d);
|
|
@@ -559,22 +554,22 @@ var g = {
|
|
|
559
554
|
const y = e === "right" ? t.x + t.width - h : t.x + h;
|
|
560
555
|
return n("X", y, t.y + f, l, o, d, u);
|
|
561
556
|
}));
|
|
562
|
-
},
|
|
563
|
-
const r = e === "top" || e === "bottom", n =
|
|
557
|
+
}, pe = (t, e) => {
|
|
558
|
+
const r = e === "top" || e === "bottom", n = N(r ? t.width : t.height, r ? 8 : 12), a = Math.max(1, n.size - se), i = ut / 2;
|
|
564
559
|
return Array.from({ length: n.count }, (l, o) => {
|
|
565
560
|
const h = (o + 0.5) * n.size;
|
|
566
561
|
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);
|
|
567
562
|
});
|
|
568
|
-
},
|
|
563
|
+
}, ge = ({ layer: t, observation: e, bounds: r, seed: n, mainAxis: a, panel: i, clipId: l, state: o }) => {
|
|
569
564
|
const h = S(t);
|
|
570
565
|
if (!r || r.width <= 0 || r.height <= 0) return null;
|
|
571
|
-
const d = h(e, o), p =
|
|
566
|
+
const d = h(e, o), p = he[Pt(e)], u = bt(e, a), f = {
|
|
572
567
|
x: r.x * i.width,
|
|
573
568
|
y: r.y * i.height,
|
|
574
569
|
width: r.width * i.width,
|
|
575
570
|
height: r.height * i.height
|
|
576
|
-
}, y = [p.value ? [] : [u], p.base ? [] : [
|
|
577
|
-
return y.width <= 0 || y.height <= 0 ? null : /* @__PURE__ */ s(
|
|
571
|
+
}, y = [p.value ? [] : [u], p.base ? [] : [Wt(e, a)]].flat().reduce((_, vt) => ce(_, vt, le / 2), f);
|
|
572
|
+
return y.width <= 0 || y.height <= 0 ? null : /* @__PURE__ */ s(pt, {
|
|
578
573
|
rect: y,
|
|
579
574
|
edge: u,
|
|
580
575
|
seed: n,
|
|
@@ -584,7 +579,7 @@ var g = {
|
|
|
584
579
|
pressure: d.fillOpacity,
|
|
585
580
|
overstruck: o === "hovered"
|
|
586
581
|
});
|
|
587
|
-
},
|
|
582
|
+
}, pt = ({ rect: t, edge: e, seed: r, clipId: n, color: a, opacity: i, pressure: l, overstruck: o }) => /* @__PURE__ */ w("g", {
|
|
588
583
|
opacity: i,
|
|
589
584
|
children: [
|
|
590
585
|
/* @__PURE__ */ s("clipPath", {
|
|
@@ -597,26 +592,26 @@ var g = {
|
|
|
597
592
|
}),
|
|
598
593
|
/* @__PURE__ */ s("g", {
|
|
599
594
|
clipPath: `url(#${n})`,
|
|
600
|
-
children: /* @__PURE__ */ s(
|
|
601
|
-
strikes:
|
|
595
|
+
children: /* @__PURE__ */ s(k, {
|
|
596
|
+
strikes: ue(t, e, r),
|
|
602
597
|
color: a,
|
|
603
598
|
opacity: l,
|
|
604
599
|
overstruck: o
|
|
605
600
|
})
|
|
606
601
|
}),
|
|
607
|
-
/* @__PURE__ */ s(
|
|
608
|
-
strikes:
|
|
602
|
+
/* @__PURE__ */ s(k, {
|
|
603
|
+
strikes: pe(t, e),
|
|
609
604
|
color: a,
|
|
610
|
-
width:
|
|
605
|
+
width: ut,
|
|
611
606
|
overstruck: o
|
|
612
607
|
})
|
|
613
608
|
]
|
|
614
609
|
}), J = ({ layer: t, observations: e, mainAxis: r, panel: n, state: a }) => {
|
|
615
|
-
const i = P("typewriter-bar"), l =
|
|
610
|
+
const i = P("typewriter-bar"), l = B(t), o = x(() => C(t.data, t.mapping, t.id), [
|
|
616
611
|
t.data,
|
|
617
612
|
t.mapping,
|
|
618
613
|
t.id
|
|
619
|
-
]), h =
|
|
614
|
+
]), h = x(() => Rt(t, r, l, n), [
|
|
620
615
|
t,
|
|
621
616
|
r,
|
|
622
617
|
l,
|
|
@@ -626,7 +621,7 @@ var g = {
|
|
|
626
621
|
"data-geom": "bar",
|
|
627
622
|
children: Array.from(e, (d, p) => {
|
|
628
623
|
const u = o(d);
|
|
629
|
-
return /* @__PURE__ */ s(
|
|
624
|
+
return /* @__PURE__ */ s(ge, {
|
|
630
625
|
layer: t,
|
|
631
626
|
observation: d,
|
|
632
627
|
bounds: h(d),
|
|
@@ -638,31 +633,31 @@ var g = {
|
|
|
638
633
|
}, u);
|
|
639
634
|
})
|
|
640
635
|
});
|
|
641
|
-
},
|
|
636
|
+
}, fe = T("bar", {
|
|
642
637
|
coord: "cartesian",
|
|
643
638
|
guideMode: "band",
|
|
644
639
|
swatchShape: "square",
|
|
645
640
|
render: ({ layer: t, coordSystem: e, panelRect: r }) => /* @__PURE__ */ s(J, {
|
|
646
641
|
layer: t,
|
|
647
642
|
observations: t.data,
|
|
648
|
-
mainAxis:
|
|
643
|
+
mainAxis: K(e),
|
|
649
644
|
panel: r
|
|
650
645
|
}),
|
|
651
646
|
renderHover: ({ layer: t, coordSystem: e, primary: r, panelRect: n }) => /* @__PURE__ */ s(J, {
|
|
652
647
|
layer: t,
|
|
653
648
|
observations: [r.observation],
|
|
654
|
-
mainAxis:
|
|
649
|
+
mainAxis: K(e),
|
|
655
650
|
panel: n,
|
|
656
651
|
state: "hovered"
|
|
657
652
|
}),
|
|
658
653
|
renderHoverCompanions: () => null
|
|
659
|
-
}),
|
|
660
|
-
const n =
|
|
661
|
-
if (r === "polar") return b(t, (l) =>
|
|
662
|
-
const i =
|
|
654
|
+
}), ve = ({ layer: t, panel: e, coord: r }) => {
|
|
655
|
+
const n = at(t), a = x(() => {
|
|
656
|
+
if (r === "polar") return b(t, (l) => ot(l, e), M, e);
|
|
657
|
+
const i = Tt(t.params);
|
|
663
658
|
return b(t, (l) => {
|
|
664
|
-
const o = i(
|
|
665
|
-
return o ?
|
|
659
|
+
const o = i(Lt(l, t.params.missingValues));
|
|
660
|
+
return o ? z(o, e) : null;
|
|
666
661
|
}, I, e);
|
|
667
662
|
}, [
|
|
668
663
|
t,
|
|
@@ -682,16 +677,16 @@ var g = {
|
|
|
682
677
|
strokeDasharray: d.dashArray,
|
|
683
678
|
strokeLinejoin: "round",
|
|
684
679
|
strokeLinecap: "round"
|
|
685
|
-
}), /* @__PURE__ */ s(
|
|
680
|
+
}), /* @__PURE__ */ s(ne, {
|
|
686
681
|
readings: h,
|
|
687
682
|
color: d.color,
|
|
688
683
|
opacity: d.opacity
|
|
689
684
|
})] }, i);
|
|
690
685
|
})
|
|
691
686
|
});
|
|
692
|
-
},
|
|
693
|
-
const a =
|
|
694
|
-
return /* @__PURE__ */ s(
|
|
687
|
+
}, me = ({ layer: t, observation: e, panel: r, project: n }) => {
|
|
688
|
+
const a = at(t)(e, "hovered");
|
|
689
|
+
return /* @__PURE__ */ s(lt, {
|
|
695
690
|
geom: "line",
|
|
696
691
|
observation: e,
|
|
697
692
|
panel: r,
|
|
@@ -699,16 +694,16 @@ var g = {
|
|
|
699
694
|
color: a.color,
|
|
700
695
|
opacity: a.opacity
|
|
701
696
|
});
|
|
702
|
-
},
|
|
697
|
+
}, gt = (t, e) => T("line", {
|
|
703
698
|
coord: t,
|
|
704
699
|
guideMode: "crosshair",
|
|
705
700
|
swatchShape: "line",
|
|
706
|
-
render: ({ layer: r, panelRect: n }) => /* @__PURE__ */ s(
|
|
701
|
+
render: ({ layer: r, panelRect: n }) => /* @__PURE__ */ s(ve, {
|
|
707
702
|
layer: r,
|
|
708
703
|
panel: n,
|
|
709
704
|
coord: t
|
|
710
705
|
}),
|
|
711
|
-
renderHover: ({ layer: r, primary: n, panelRect: a }) => /* @__PURE__ */ s(
|
|
706
|
+
renderHover: ({ layer: r, primary: n, panelRect: a }) => /* @__PURE__ */ s(me, {
|
|
712
707
|
layer: r,
|
|
713
708
|
observation: n.observation,
|
|
714
709
|
panel: a,
|
|
@@ -716,34 +711,34 @@ var g = {
|
|
|
716
711
|
}),
|
|
717
712
|
renderHoverCompanions: () => null,
|
|
718
713
|
getOverlayAnchor: ({ observation: r }) => {
|
|
719
|
-
const n = O(r), a =
|
|
714
|
+
const n = O(r), a = F(r);
|
|
720
715
|
return n === null || a === null ? null : {
|
|
721
716
|
x: n,
|
|
722
717
|
y: a
|
|
723
718
|
};
|
|
724
719
|
}
|
|
725
|
-
}),
|
|
726
|
-
const i =
|
|
720
|
+
}), ye = gt("cartesian", I), Ae = gt("polar", M), ke = 0.85, xe = 1.6, we = 4, Q = ({ layer: t, observations: e, panel: r, project: n, state: a }) => {
|
|
721
|
+
const i = B(t), l = S(t), o = x(() => C(t.data, t.mapping, t.id), [
|
|
727
722
|
t.data,
|
|
728
723
|
t.mapping,
|
|
729
724
|
t.id
|
|
730
|
-
]), h = a === "hovered", d = h ?
|
|
725
|
+
]), h = a === "hovered", d = h ? we : 0;
|
|
731
726
|
return /* @__PURE__ */ s("g", {
|
|
732
727
|
"data-geom": "point",
|
|
733
728
|
children: Array.from(e, (p) => {
|
|
734
729
|
const u = n(p, r);
|
|
735
730
|
if (u === null) return null;
|
|
736
731
|
const f = l(p, a), y = i.get("size", p, a) + d;
|
|
737
|
-
return /* @__PURE__ */ s(
|
|
738
|
-
strikes: [E("o", u.x, u.y, y *
|
|
732
|
+
return /* @__PURE__ */ s(k, {
|
|
733
|
+
strikes: [E("o", u.x, u.y, y * ke, y)],
|
|
739
734
|
color: f.color,
|
|
740
735
|
opacity: f.opacity,
|
|
741
|
-
width:
|
|
736
|
+
width: xe,
|
|
742
737
|
overstruck: h
|
|
743
738
|
}, o(p));
|
|
744
739
|
})
|
|
745
740
|
});
|
|
746
|
-
},
|
|
741
|
+
}, ft = (t, e) => T("point", {
|
|
747
742
|
coord: t,
|
|
748
743
|
swatchShape: "circle",
|
|
749
744
|
render: ({ layer: r, panelRect: n }) => /* @__PURE__ */ s(Q, {
|
|
@@ -760,12 +755,12 @@ var g = {
|
|
|
760
755
|
state: "hovered"
|
|
761
756
|
}),
|
|
762
757
|
renderHoverCompanions: () => null
|
|
763
|
-
}),
|
|
764
|
-
const { startAngle: r, endAngle: n } =
|
|
758
|
+
}), Re = ft("cartesian", I), Te = ft("polar", M), Ee = 4, Me = 1.2, Se = 3, H = Math.PI * 2, Pe = 0.3, $e = (t, e) => {
|
|
759
|
+
const { startAngle: r, endAngle: n } = Mt(t), { innerRadius: a, outerRadius: i } = rt(t);
|
|
765
760
|
if (r === null || n === null || a === null || i === null) return null;
|
|
766
761
|
const l = Math.min(e.width, e.height) / 2;
|
|
767
762
|
if (l <= 0 || i <= 0) return null;
|
|
768
|
-
const o = Math.max(0, n - r), h =
|
|
763
|
+
const o = Math.max(0, n - r), h = Ee / 2 / (i * l), d = o >= H - 1e-6 ? 0 : Math.min(h, o / 4), p = r + d, u = n - d, f = xt({
|
|
769
764
|
startAngle: p,
|
|
770
765
|
endAngle: u,
|
|
771
766
|
innerRadius: a,
|
|
@@ -774,7 +769,7 @@ var g = {
|
|
|
774
769
|
centerX: e.width / 2,
|
|
775
770
|
centerY: e.height / 2,
|
|
776
771
|
radius: l,
|
|
777
|
-
digits:
|
|
772
|
+
digits: Se
|
|
778
773
|
});
|
|
779
774
|
return f === void 0 ? null : {
|
|
780
775
|
path: f,
|
|
@@ -783,20 +778,20 @@ var g = {
|
|
|
783
778
|
inner: a * l,
|
|
784
779
|
outer: i * l
|
|
785
780
|
};
|
|
786
|
-
},
|
|
781
|
+
}, Ie = (t, e, r, n) => {
|
|
787
782
|
const a = Math.hypot(e, r);
|
|
788
783
|
if (a > t.outer - n || a < t.inner + n) return !1;
|
|
789
784
|
const i = ((Math.atan2(e, -r) - t.startAngle) % H + H) % H, l = n / Math.max(a, 1);
|
|
790
785
|
return i >= l && i <= t.endAngle - t.startAngle - l;
|
|
791
|
-
},
|
|
792
|
-
const n =
|
|
786
|
+
}, _e = (t, e, r) => {
|
|
787
|
+
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 = [];
|
|
793
788
|
for (let h = -i; h <= i; h += 1) for (let d = -a; d <= a; d += 1) {
|
|
794
789
|
const p = d * 8, u = h * 12;
|
|
795
|
-
|
|
790
|
+
Ie(t, p, u, l) && o.push(n("/", e.width / 2 + p, e.height / 2 + u, 5, 8, d, h));
|
|
796
791
|
}
|
|
797
792
|
return o;
|
|
798
793
|
}, tt = ({ layer: t, observations: e, panel: r, state: n }) => {
|
|
799
|
-
const a = S(t), i = P("slice-shading"), l =
|
|
794
|
+
const a = S(t), i = P("slice-shading"), l = x(() => C(t.data, t.mapping, t.id), [
|
|
800
795
|
t.data,
|
|
801
796
|
t.mapping,
|
|
802
797
|
t.id
|
|
@@ -804,7 +799,7 @@ var g = {
|
|
|
804
799
|
return r.width <= 0 || r.height <= 0 ? null : /* @__PURE__ */ s("g", {
|
|
805
800
|
"data-geom": "bar",
|
|
806
801
|
children: Array.from(e, (o) => {
|
|
807
|
-
const h =
|
|
802
|
+
const h = $e(o, r);
|
|
808
803
|
if (h === null) return null;
|
|
809
804
|
const d = l(o), p = a(o, n), u = `${i}-${d.replace(/[^a-zA-Z0-9]/gu, "")}`;
|
|
810
805
|
return /* @__PURE__ */ w("g", {
|
|
@@ -822,12 +817,12 @@ var g = {
|
|
|
822
817
|
/* @__PURE__ */ s("path", {
|
|
823
818
|
d: h.path,
|
|
824
819
|
fill: p.color,
|
|
825
|
-
fillOpacity: p.fillOpacity *
|
|
820
|
+
fillOpacity: p.fillOpacity * Pe
|
|
826
821
|
}),
|
|
827
822
|
/* @__PURE__ */ s("g", {
|
|
828
823
|
clipPath: `url(#${u})`,
|
|
829
|
-
children: /* @__PURE__ */ s(
|
|
830
|
-
strikes:
|
|
824
|
+
children: /* @__PURE__ */ s(k, {
|
|
825
|
+
strikes: _e(h, r, d),
|
|
831
826
|
color: p.color,
|
|
832
827
|
opacity: p.fillOpacity,
|
|
833
828
|
overstruck: n === "hovered"
|
|
@@ -838,14 +833,14 @@ var g = {
|
|
|
838
833
|
d: h.path,
|
|
839
834
|
fill: "none",
|
|
840
835
|
stroke: p.color,
|
|
841
|
-
strokeWidth:
|
|
836
|
+
strokeWidth: Me,
|
|
842
837
|
strokeLinejoin: "round"
|
|
843
838
|
})
|
|
844
839
|
]
|
|
845
840
|
}, d);
|
|
846
841
|
})
|
|
847
842
|
});
|
|
848
|
-
},
|
|
843
|
+
}, Le = T("bar", {
|
|
849
844
|
coord: "polar",
|
|
850
845
|
guideMode: "band",
|
|
851
846
|
swatchShape: "slice",
|
|
@@ -861,15 +856,15 @@ var g = {
|
|
|
861
856
|
state: "hovered"
|
|
862
857
|
}),
|
|
863
858
|
renderHoverCompanions: () => null
|
|
864
|
-
}), W = 2,
|
|
865
|
-
const r =
|
|
859
|
+
}), W = 2, We = 0.2, He = (t, e) => {
|
|
860
|
+
const r = G(e), n = [], a = Math.floor(t.y / 12), i = Math.floor(t.x / 8);
|
|
866
861
|
for (let l = a; l * 12 < t.y + t.height; l += 1) for (let o = i; o * 8 < t.x + t.width; o += 1) {
|
|
867
862
|
const h = (o + 0.5) * 8, d = (l + 0.5) * 12;
|
|
868
863
|
n.push(r("X", h, d, 5, 8, o, l));
|
|
869
864
|
}
|
|
870
865
|
return n;
|
|
871
|
-
},
|
|
872
|
-
const l = S(t), o =
|
|
866
|
+
}, be = ({ layer: t, observation: e, seed: r, panel: n, clipId: a, state: i }) => {
|
|
867
|
+
const l = S(t), o = St(e);
|
|
873
868
|
if (o === null) return null;
|
|
874
869
|
const h = l(e, i), d = {
|
|
875
870
|
x: o.x * n.width + W / 2,
|
|
@@ -891,10 +886,10 @@ var g = {
|
|
|
891
886
|
}),
|
|
892
887
|
/* @__PURE__ */ s("g", {
|
|
893
888
|
clipPath: `url(#${a})`,
|
|
894
|
-
children: /* @__PURE__ */ s(
|
|
895
|
-
strikes:
|
|
889
|
+
children: /* @__PURE__ */ s(k, {
|
|
890
|
+
strikes: He(d, r),
|
|
896
891
|
color: g.paper,
|
|
897
|
-
opacity:
|
|
892
|
+
opacity: We,
|
|
898
893
|
overstruck: i === "hovered"
|
|
899
894
|
})
|
|
900
895
|
}),
|
|
@@ -907,7 +902,7 @@ var g = {
|
|
|
907
902
|
]
|
|
908
903
|
});
|
|
909
904
|
}, et = ({ layer: t, observations: e, panel: r, state: n }) => {
|
|
910
|
-
const a = P("typewriter-tile"), i =
|
|
905
|
+
const a = P("typewriter-tile"), i = x(() => Et(t.data, t.mapping, t.id), [
|
|
911
906
|
t.data,
|
|
912
907
|
t.mapping,
|
|
913
908
|
t.id
|
|
@@ -916,7 +911,7 @@ var g = {
|
|
|
916
911
|
"data-geom": "tile",
|
|
917
912
|
children: Array.from(e, (l, o) => {
|
|
918
913
|
const h = i(l);
|
|
919
|
-
return /* @__PURE__ */ s(
|
|
914
|
+
return /* @__PURE__ */ s(be, {
|
|
920
915
|
layer: t,
|
|
921
916
|
observation: l,
|
|
922
917
|
seed: h,
|
|
@@ -926,7 +921,7 @@ var g = {
|
|
|
926
921
|
}, h);
|
|
927
922
|
})
|
|
928
923
|
});
|
|
929
|
-
},
|
|
924
|
+
}, Ce = T("tile", {
|
|
930
925
|
coord: "cartesian",
|
|
931
926
|
guideMode: null,
|
|
932
927
|
swatchShape: "square",
|
|
@@ -942,21 +937,21 @@ var g = {
|
|
|
942
937
|
state: "hovered"
|
|
943
938
|
}),
|
|
944
939
|
renderHoverCompanions: () => null
|
|
945
|
-
}),
|
|
940
|
+
}), Oe = [
|
|
941
|
+
fe,
|
|
942
|
+
Le,
|
|
943
|
+
Ce,
|
|
946
944
|
ye,
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
ke,
|
|
950
|
-
we,
|
|
945
|
+
Ae,
|
|
946
|
+
ie,
|
|
951
947
|
oe,
|
|
952
|
-
|
|
953
|
-
Te
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
return n === null || t.fill === void 0 ? /* @__PURE__ */ s(xt, { ...t }) : n.width <= 0 || n.height <= 0 ? null : /* @__PURE__ */ s("g", {
|
|
948
|
+
Re,
|
|
949
|
+
Te
|
|
950
|
+
], Be = (t) => {
|
|
951
|
+
const e = P("typewriter-rect"), r = nt(), n = r === null ? null : Ht(t, r);
|
|
952
|
+
return n === null || t.fill === void 0 ? /* @__PURE__ */ s(At, { ...t }) : n.width <= 0 || n.height <= 0 ? null : /* @__PURE__ */ s("g", {
|
|
958
953
|
"data-testid": t["data-testid"],
|
|
959
|
-
children: /* @__PURE__ */ s(
|
|
954
|
+
children: /* @__PURE__ */ s(pt, {
|
|
960
955
|
rect: n,
|
|
961
956
|
edge: "top",
|
|
962
957
|
seed: `${n.x},${n.y}`,
|
|
@@ -967,7 +962,7 @@ var g = {
|
|
|
967
962
|
overstruck: !1
|
|
968
963
|
})
|
|
969
964
|
});
|
|
970
|
-
},
|
|
965
|
+
}, Ge = (t) => {
|
|
971
966
|
const e = (t.match(/-?\d*\.?\d+(?:e-?\d+)?/giu) ?? []).map(Number), r = e.filter((l, o) => o % 2 === 0), n = e.filter((l, o) => o % 2 === 1);
|
|
972
967
|
if (r.length === 0 || n.length === 0) return null;
|
|
973
968
|
const a = Math.min(...r), i = Math.min(...n);
|
|
@@ -977,12 +972,12 @@ var g = {
|
|
|
977
972
|
width: Math.max(...r) - a,
|
|
978
973
|
height: Math.max(...n) - i
|
|
979
974
|
};
|
|
980
|
-
},
|
|
981
|
-
const e = P("typewriter-path"), r =
|
|
982
|
-
const i =
|
|
983
|
-
return r === null || i === null ? null :
|
|
975
|
+
}, De = (t) => {
|
|
976
|
+
const e = P("typewriter-path"), r = nt(), n = x(() => {
|
|
977
|
+
const i = Ge(t.d);
|
|
978
|
+
return r === null || i === null ? null : dt(r, t.d, i);
|
|
984
979
|
}, [r, t.d]);
|
|
985
|
-
if (n === null || t.fill === void 0 || t.fill.startsWith("url(")) return /* @__PURE__ */ s(
|
|
980
|
+
if (n === null || t.fill === void 0 || t.fill.startsWith("url(")) return /* @__PURE__ */ s(yt, { ...t });
|
|
986
981
|
const a = t.fillOpacity ?? 1;
|
|
987
982
|
return /* @__PURE__ */ w("g", {
|
|
988
983
|
"data-testid": t["data-testid"],
|
|
@@ -999,11 +994,11 @@ var g = {
|
|
|
999
994
|
/* @__PURE__ */ s("path", {
|
|
1000
995
|
d: t.d,
|
|
1001
996
|
fill: t.fill,
|
|
1002
|
-
fillOpacity: a *
|
|
997
|
+
fillOpacity: a * st
|
|
1003
998
|
}),
|
|
1004
999
|
/* @__PURE__ */ s("g", {
|
|
1005
1000
|
clipPath: `url(#${e})`,
|
|
1006
|
-
children: /* @__PURE__ */ s(
|
|
1001
|
+
children: /* @__PURE__ */ s(k, {
|
|
1007
1002
|
strikes: n,
|
|
1008
1003
|
color: t.fill,
|
|
1009
1004
|
opacity: a
|
|
@@ -1011,22 +1006,22 @@ var g = {
|
|
|
1011
1006
|
})
|
|
1012
1007
|
]
|
|
1013
1008
|
});
|
|
1014
|
-
},
|
|
1015
|
-
Rect:
|
|
1016
|
-
Path:
|
|
1017
|
-
},
|
|
1009
|
+
}, ze = {
|
|
1010
|
+
Rect: Be,
|
|
1011
|
+
Path: De
|
|
1012
|
+
}, Xe = {
|
|
1018
1013
|
name: "typewriter",
|
|
1019
1014
|
styles: Kt,
|
|
1020
1015
|
palettes: {
|
|
1021
|
-
categorical:
|
|
1022
|
-
sequential:
|
|
1016
|
+
categorical: zt,
|
|
1017
|
+
sequential: Nt,
|
|
1023
1018
|
diverging: Ft
|
|
1024
1019
|
},
|
|
1025
1020
|
config: { axes: { y: { position: "left" } } },
|
|
1026
1021
|
colorScheme: "light",
|
|
1027
|
-
plugins:
|
|
1028
|
-
shapes:
|
|
1022
|
+
plugins: Oe,
|
|
1023
|
+
shapes: ze
|
|
1029
1024
|
};
|
|
1030
1025
|
export {
|
|
1031
|
-
|
|
1026
|
+
Xe as typewriter
|
|
1032
1027
|
};
|
package/dist/renderer/bar.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
import { ResolvedGeomRenderer } from '@graphysdk/react';
|
|
2
|
+
import { Edge, ResolvedGeomRenderer } from '@graphysdk/react';
|
|
3
3
|
import { PixelRect } from './utils/projections';
|
|
4
|
-
export type Edge = 'top' | 'right' | 'bottom' | 'left';
|
|
5
4
|
interface TypedBoxProps {
|
|
6
5
|
rect: PixelRect;
|
|
7
6
|
/** The edge the underscores are typed along and the rows of X's are stepped from. */
|
package/package.json
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"theme",
|
|
14
14
|
"typewriter"
|
|
15
15
|
],
|
|
16
|
-
"version": "0.1.1-beta.
|
|
16
|
+
"version": "0.1.1-beta.1793700147232",
|
|
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.
|
|
43
|
+
"@graphysdk/react": "^1.9.0-beta.1793700147232"
|
|
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
|
-
"@
|
|
55
|
+
"@graphysdk/viz-engine": "1.9.0-beta.1793700147232",
|
|
56
|
+
"@graphytools/vitest-config": "1.0.0",
|
|
56
57
|
"@graphytools/typescript-config": "0.0.1",
|
|
57
|
-
"@graphysdk/
|
|
58
|
-
"@
|
|
59
|
-
"@graphytools/vitest-config": "1.0.0"
|
|
58
|
+
"@graphysdk/react": "1.9.0-beta.1793700147232",
|
|
59
|
+
"@graphytools/eslint-config": "0.0.1"
|
|
60
60
|
},
|
|
61
61
|
"publishConfig": {
|
|
62
62
|
"access": "public"
|