@graphysdk/theme-comic 0.1.1-beta.1791894562924 → 0.1.1-beta.1791968387850

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 I=require("react"),e=require("@graphysdk/react"),g=require("react/jsx-runtime");var M=(t,r)=>{const o=(0,e.getX)(t),l=(0,e.getY)(t)??(0,e.getYMax)(t);return o===null||l===null?null:{x:(0,e.toViewBoxX)(o)*r.width,y:(0,e.toViewBoxY)(l)*r.height}},Y=(t,r)=>{const o=(0,e.getX)(t),l=(0,e.getY)(t)??(0,e.getRadiusExtent)(t).outerRadius;if(o===null||l===null)return null;const i=(0,e.polarToUnit)(o,l),n=Math.min(r.width,r.height)/2;return{x:r.width/2+i.x*n,y:r.height/2-i.y*n}},z=22,F=Math.PI*2,ke=F/(z*2),$=(t,r,o)=>({x:t.x+Math.sin(o.angle)*o.radius*r,y:t.y-Math.cos(o.angle)*o.radius*r}),E=2,X=({x:t,y:r})=>`${t.toFixed(E)},${r.toFixed(E)}`,_=8,j=.6,G=(t,r)=>{const o=r/2,l=F/(_*2);return`M${Array.from({length:_*2},(i,n)=>$(t,o,{angle:n*l,radius:n%2===0?1:j})).map(X).join(" L")} Z`},D=t=>{const r=(0,e.useGeomStyleReader)(t);return(o,l)=>{const i=r.get("shadow",o,l);return{color:(0,e.toPaintColor)(r.get("fill",o,l)),opacity:r.get("alpha",o,l),fillOpacity:r.get("fillAlpha",o,l),outline:r.get("stroke",o,l),outlineWidth:r.get("strokeWidth",o,l),shadow:i==="none"?null:{offsetX:i.offsetX,offsetY:i.offsetY,color:i.color}}}},U=1.35,K=4,V=1,R=({layer:t,observations:r,panel:o,project:l,state:i})=>{const n=(0,e.useGeomStyleReader)(t),f=D(t),u=(0,I.useMemo)(()=>(0,e.createStableKeyGenerator)(t.data,t.mapping,t.id),[t.data,t.mapping,t.id]),v=i==="hovered";return(0,g.jsx)("g",{"data-geom":"point",children:Array.from(r,p=>{const h=l(p,o);if(h===null)return null;const s=f(p,i),d=G(h,n.get("size",p,i)*U+(v?K:0));return(0,g.jsxs)("g",{opacity:s.opacity,children:[s.shadow!==null&&(0,g.jsx)("path",{d,transform:`translate(${s.shadow.offsetX} ${s.shadow.offsetY})`,fill:s.shadow.color}),(0,g.jsx)("path",{d,fill:s.color,fillOpacity:s.fillOpacity,stroke:s.outline,strokeWidth:s.outlineWidth+(v?V:0),strokeLinejoin:"round"})]},u(p))})})},N=(t,r)=>(0,e.defineGeomRenderer)("point",{coord:t,swatchShape:"circle",render:({layer:o,panelRect:l})=>(0,g.jsx)(R,{layer:o,observations:o.data,panel:l,project:r}),renderHover:({layer:o,primary:l,panelRect:i})=>(0,g.jsx)(R,{layer:o,observations:[l.observation],panel:i,project:r,state:"hovered"}),renderHoverCompanions:()=>null}),q=N("cartesian",M),J=N("polar",Y),Z=2,Q=2,ee=(t,r,o)=>[...t].flatMap(l=>{const{startAngle:i,endAngle:n}=(0,e.getAngleExtent)(l),{innerRadius:f,outerRadius:u}=(0,e.getRadiusExtent)(l);return i===null||n===null||f===null||u===null?[]:n<=i||u<=0?[]:[{key:`${o(l)}-${i}`,paint:r(l),startAngle:i,endAngle:n,innerRadius:f,outerRadius:u}]}),te=(t,r,o)=>(0,e.buildPolarBarArcPath)(t,{centerX:r.x,centerY:r.y,radius:o,digits:Q}),C=({layer:t,observations:r,panel:o,state:l})=>{const i=D(t),n=(0,I.useMemo)(()=>(0,e.createStableKeyGenerator)(t.data,t.mapping,t.id),[t.data,t.mapping,t.id]),f=Math.min(o.width,o.height)/2;if(f<=0)return null;const u={x:o.width/2,y:o.height/2},v=ee(r,h=>i(h,l),n).flatMap(h=>{const s=te(h,u,f);return s===void 0?[]:[{key:h.key,path:s,paint:h.paint}]}),p=l==="hovered";return(0,g.jsxs)("g",{"data-geom":"bar",children:[!p&&v.map(({key:h,path:s,paint:d})=>d.shadow===null?null:(0,g.jsx)("path",{d:s,transform:`translate(${d.shadow.offsetX} ${d.shadow.offsetY})`,fill:d.shadow.color,opacity:d.opacity},`${h}-shadow`)),v.map(({key:h,path:s,paint:d})=>(0,g.jsx)("path",{"data-comic-slice":"sector",d:s,fill:d.color,fillOpacity:d.fillOpacity,fillRule:"evenodd",stroke:d.outline,strokeWidth:d.outlineWidth+(p?Z:0),strokeLinejoin:"round",opacity:d.opacity},h))]})},oe=(0,e.defineGeomRenderer)("bar",{coord:"polar",guideMode:"band",swatchShape:"slice",render:({layer:t,panelRect:r})=>(0,g.jsx)(C,{layer:t,observations:t.data,panel:r}),renderHover:({layer:t,primary:r,panelRect:o})=>(0,g.jsx)(C,{layer:t,observations:[r.observation],panel:o,state:"hovered"}),renderHoverCompanions:()=>null}),re=[oe,q,J],k=10,ae=.42,P=220,le=.6,T=1,ie=()=>{const t=Math.ceil(P/k),r=[];for(let o=0;o<=t;o+=1){const l=o%2===0?0:k/2;for(let i=0;i<=23;i+=1){const n=-(i*k+l),f=o*k,u=k*ae*(1-Math.hypot(n,f)/P);u>=le&&r.push(`<circle cx="${n.toFixed(T)}" cy="${f.toFixed(T)}" r="${u.toFixed(T)}"/>`)}}return r.join("")},ne=(t,r,o)=>{const l=`<svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%"><rect width="100%" height="100%" fill="${t}"/><svg x="100%" y="0" width="1" height="1" overflow="visible"><g fill="${r}" fill-opacity="${o}">${ie()}</g></svg></svg>`;return`data:image/svg+xml,${encodeURIComponent(l)}`},a={paper:"#FBF3DF",bubble:"#FFFDF6",black:"#141414",secondary:"#4A4338",grid:"rgba(20, 20, 20, 0.2)"},w="'Bangers', 'Comic Neue', 'Comic Sans MS', cursive",se="'Comic Neue', 'Comic Sans MS', 'Chalkboard SE', cursive",c={vermillion:"#D9401F",cyan:"#0B85C8",yellow:"#FFD60A",magenta:"#D6247A",green:"#15964B",purple:"#7A3DC8"},de=[c.vermillion,c.cyan,c.yellow,c.magenta,c.green,c.purple],ce=["#FFE45C","#F58A1F","#C4161C"],A={offsetX:4,offsetY:4,blur:0,color:a.black},he={offsetX:6,offsetY:6,blur:0,color:a.black},S={offsetX:2,offsetY:2,blur:0,color:a.black},L={offsetX:4,offsetY:4,blur:0,color:a.black},ge={offsetX:6,offsetY:6,blur:0,color:a.black},fe={offsetX:2,offsetY:2,blur:0,color:c.yellow},ue={pattern:"dots",color:"rgba(20, 20, 20, 0.24)",size:7},pe={image:ne(a.paper,c.vermillion,.18),fit:"stretch",fallback:a.paper},ye={fontFamily:w,fontWeight:400,fontSize:22,lineHeight:1.05,letterSpacing:1.5,textTransform:"uppercase",textColor:a.black},B={fill:c.yellow,stroke:a.black,strokeWidth:3,cornerRadius:0,paddingInline:10,paddingBlock:5,shadow:{offsetX:5,offsetY:5,blur:0,color:c.vermillion}},x={fontFamily:w,fontWeight:400,fontSize:16,lineHeight:1.05,letterSpacing:1,textTransform:"uppercase",textColor:a.black},O={...B,strokeWidth:2.5,paddingInline:7,paddingBlock:3,shadow:{offsetX:3,offsetY:3,blur:0,color:c.vermillion}},W={fontFamily:w,fontWeight:400,letterSpacing:1,textTransform:"uppercase"},y={stroke:a.black,strokeAlpha:1},H={dashArray:[],lineCap:"round",lineJoin:"round"},m={textColor:a.black,fontWeight:700},b={textColor:a.secondary,fontWeight:700},me={tokens:{graphBackground:a.paper,graphBorder:a.black,geom:c.vermillion,geomBorder:a.black,textPrimary:a.black,textSecondary:a.secondary,ruleLine:a.black,gridLine:a.grid,hoverAffordance:a.black,hoverGuideFill:"rgba(20, 20, 20, 0.07)",hoverGuideLine:a.black,tooltipBackground:a.bubble,tooltipBorder:a.black,tooltipPrimaryRow:"rgba(255, 214, 10, 0.35)",annotationShape:c.yellow,annotationArrow:a.black,differenceLabelBackground:a.bubble},defaults:[e.style.graph({fill:pe,strokeWidth:4,cornerRadius:0,fontFamily:se,padding:22,shadow:ge}),e.style.geom({shadow:A,overlay:ue}),e.style.geom({shadow:A},{state:"hovered"}),e.style.geom.bar({...y,strokeWidth:2.5,cornerRadius:0}),e.style.geom.bar({...y,strokeWidth:2.5,shadow:he},{state:"hovered"}),e.style.geom.line({strokeWidth:3.5,...H,shadow:S,overlay:"none"}),e.style.geom.line({shadow:S},{state:"hovered"}),e.style.geom.area({...y,fillAlpha:1,strokeWidth:2.5,...H}),e.style.geom.point({...y,size:13,strokeWidth:2,shadow:S}),e.style.geom.point({...y,strokeWidth:2,shadow:"none"},{state:"hovered"}),e.style.geom.tile({...y,cornerRadius:2,strokeWidth:1.5,shadow:"none"}),e.style.geom.tile({...y,strokeWidth:3,shadow:"none"},{state:"hovered"}),e.style.geom.rule({strokeWidth:2.5,dashArray:[3,3],lineCap:"round",shadow:"none"}),e.style.geom.rule.label({...W,textColor:c.yellow,fontSize:15}),e.style.gridLine({dashArray:[1,5]}),e.style.gridLine.x({strokeWidth:0}),e.style.gridLine.y({strokeWidth:1.5}),e.style.panelBorder({strokeWidth:0}),e.style.panelBorder.bottom({stroke:a.black,strokeWidth:3,dashArray:[]}),e.style.tickLine({strokeWidth:0}),e.style.tickLabel({...b,fontSize:14,lineHeight:1}),e.style.axisLabel({...m,...W,fontSize:18,lineHeight:1}),e.style.heading({...m}),e.style.heading.h1({fontFamily:w,fontWeight:400,fontSize:36,lineHeight:1,letterSpacing:1,textTransform:"uppercase",textShadow:fe}),e.style.heading.h2({...b,fontSize:16,lineHeight:1.2}),e.style.header({margin:{bottom:18}}),e.style.caption({...b,fontWeight:400,fontSize:13}),e.style.source({...b,fontWeight:400,fontSize:13}),e.style.dataLabel({...m,fontSize:14,fill:"transparent"}),e.style.legendItem({...m,...W,fontSize:18,fill:"transparent",stroke:"transparent"}),e.style.legendItem.swatch({size:16}),e.style.directLabel({fontWeight:700,fontSize:14}),e.style.tooltip({strokeWidth:2.5,cornerRadius:10,paddingInline:12,paddingBlock:9,shadow:L}),e.style.tooltip.heading({...m,fontSize:15,lineHeight:1.3}),e.style.tooltip.label({...b,fontSize:14,lineHeight:1.3}),e.style.tooltip.value({...m,fontSize:14,lineHeight:1.3}),e.style.legend.popover({strokeWidth:2.5,cornerRadius:10,shadow:L}),e.style.annotation.text({...ye,...B}),e.style.annotation.shape({fillAlpha:.35,stroke:a.black,strokeWidth:2}),e.style.annotation.arrow({strokeWidth:3.5,dashArray:[]}),e.style.annotation.arrow.outline({stroke:a.paper,strokeWidth:2}),e.style.annotation.pinnedNumber({stroke:a.black,shadow:S}),e.style.annotation.pinnedNumber.label({...x,...O}),e.style.annotation.comment({stroke:a.black,shadow:S}),e.style.annotation.comment.label({...x,...O}),e.style.annotation.differenceArrow({stroke:a.black,strokeWidth:2.5}),e.style.annotation.differenceArrow.label({...x,...O,fontSize:18}),e.style.panelBorder.bottom({strokeWidth:0},{coord:"polar"}),e.style.tickLabel({...m,textOutlineColor:a.paper,textOutlineWidth:3.5},{coord:"polar"}),e.style.geom.area({fillAlpha:.5,shadow:"none"},{coord:"polar"}),e.style.geom.area({shadow:"none"},{coord:"polar",state:"hovered"}),e.style.geom.bar({strokeWidth:2.5,shadow:A},{coord:"polar"}),e.style.geom.bar({strokeWidth:2.5},{coord:"polar",state:"hovered"})]},ve={name:"comic",styles:me,palette:de,colormap:ce,colorScheme:"light",plugins:re};exports.comic=ve;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});let H=require("react"),e=require("@graphysdk/react"),g=require("react/jsx-runtime");var B=(t,r)=>{const o=(0,e.getX)(t),l=(0,e.getY)(t)??(0,e.getYMax)(t);return o===null||l===null?null:{x:(0,e.toViewBoxX)(o)*r.width,y:(0,e.toViewBoxY)(l)*r.height}},Y=(t,r)=>{const o=(0,e.getX)(t),l=(0,e.getY)(t)??(0,e.getRadiusExtent)(t).outerRadius;if(o===null||l===null)return null;const i=(0,e.polarToUnit)(o,l),n=Math.min(r.width,r.height)/2;return{x:r.width/2+i.x*n,y:r.height/2-i.y*n}},z=22,F=Math.PI*2,Se=F/(z*2),$=(t,r,o)=>({x:t.x+Math.sin(o.angle)*o.radius*r,y:t.y-Math.cos(o.angle)*o.radius*r}),W=2,G=({x:t,y:r})=>`${t.toFixed(W)},${r.toFixed(W)}`,_=8,X=.6,j=(t,r)=>{const o=r/2,l=F/(_*2);return`M${Array.from({length:_*2},(i,n)=>$(t,o,{angle:n*l,radius:n%2===0?1:X})).map(G).join(" L")} Z`},D=t=>{const r=(0,e.useGeomStyleReader)(t);return(o,l)=>{const i=r.get("shadow",o,l);return{color:(0,e.toPaintColor)(r.get("fill",o,l)),opacity:r.get("alpha",o,l),fillOpacity:r.get("fillAlpha",o,l),outline:r.get("stroke",o,l),outlineWidth:r.get("strokeWidth",o,l),shadow:i==="none"?null:{offsetX:i.offsetX,offsetY:i.offsetY,color:i.color}}}},U=1.35,K=4,V=1,R=({layer:t,observations:r,panel:o,project:l,state:i})=>{const n=(0,e.useGeomStyleReader)(t),f=D(t),u=(0,H.useMemo)(()=>(0,e.createStableKeyGenerator)(t.data,t.mapping,t.id),[t.data,t.mapping,t.id]),v=i==="hovered";return(0,g.jsx)("g",{"data-geom":"point",children:Array.from(r,p=>{const h=l(p,o);if(h===null)return null;const s=f(p,i),c=j(h,n.get("size",p,i)*U+(v?K:0));return(0,g.jsxs)("g",{opacity:s.opacity,children:[s.shadow!==null&&(0,g.jsx)("path",{d:c,transform:`translate(${s.shadow.offsetX} ${s.shadow.offsetY})`,fill:s.shadow.color}),(0,g.jsx)("path",{d:c,fill:s.color,fillOpacity:s.fillOpacity,stroke:s.outline,strokeWidth:s.outlineWidth+(v?V:0),strokeLinejoin:"round"})]},u(p))})})},N=(t,r)=>(0,e.defineGeomRenderer)("point",{coord:t,swatchShape:"circle",render:({layer:o,panelRect:l})=>(0,g.jsx)(R,{layer:o,observations:o.data,panel:l,project:r}),renderHover:({layer:o,primary:l,panelRect:i})=>(0,g.jsx)(R,{layer:o,observations:[l.observation],panel:i,project:r,state:"hovered"}),renderHoverCompanions:()=>null}),q=N("cartesian",B),J=N("polar",Y),Z=2,Q=2,ee=(t,r,o)=>[...t].flatMap(l=>{const{startAngle:i,endAngle:n}=(0,e.getAngleExtent)(l),{innerRadius:f,outerRadius:u}=(0,e.getRadiusExtent)(l);return i===null||n===null||f===null||u===null?[]:n<=i||u<=0?[]:[{key:`${o(l)}-${i}`,paint:r(l),startAngle:i,endAngle:n,innerRadius:f,outerRadius:u}]}),te=(t,r,o)=>(0,e.buildPolarBarArcPath)(t,{centerX:r.x,centerY:r.y,radius:o,digits:Q}),C=({layer:t,observations:r,panel:o,state:l})=>{const i=D(t),n=(0,H.useMemo)(()=>(0,e.createStableKeyGenerator)(t.data,t.mapping,t.id),[t.data,t.mapping,t.id]),f=Math.min(o.width,o.height)/2;if(f<=0)return null;const u={x:o.width/2,y:o.height/2},v=ee(r,h=>i(h,l),n).flatMap(h=>{const s=te(h,u,f);return s===void 0?[]:[{key:h.key,path:s,paint:h.paint}]}),p=l==="hovered";return(0,g.jsxs)("g",{"data-geom":"bar",children:[!p&&v.map(({key:h,path:s,paint:c})=>c.shadow===null?null:(0,g.jsx)("path",{d:s,transform:`translate(${c.shadow.offsetX} ${c.shadow.offsetY})`,fill:c.shadow.color,opacity:c.opacity},`${h}-shadow`)),v.map(({key:h,path:s,paint:c})=>(0,g.jsx)("path",{"data-comic-slice":"sector",d:s,fill:c.color,fillOpacity:c.fillOpacity,fillRule:"evenodd",stroke:c.outline,strokeWidth:c.outlineWidth+(p?Z:0),strokeLinejoin:"round",opacity:c.opacity},h))]})},oe=(0,e.defineGeomRenderer)("bar",{coord:"polar",guideMode:"band",swatchShape:"slice",render:({layer:t,panelRect:r})=>(0,g.jsx)(C,{layer:t,observations:t.data,panel:r}),renderHover:({layer:t,primary:r,panelRect:o})=>(0,g.jsx)(C,{layer:t,observations:[r.observation],panel:o,state:"hovered"}),renderHoverCompanions:()=>null}),re=[oe,q,J],k=10,ae=.42,P=220,le=.6,T=1,ie=()=>{const t=Math.ceil(P/k),r=[];for(let o=0;o<=t;o+=1){const l=o%2===0?0:k/2;for(let i=0;i<=23;i+=1){const n=-(i*k+l),f=o*k,u=k*ae*(1-Math.hypot(n,f)/P);u>=le&&r.push(`<circle cx="${n.toFixed(T)}" cy="${f.toFixed(T)}" r="${u.toFixed(T)}"/>`)}}return r.join("")},ne=(t,r,o)=>{const l=`<svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%"><rect width="100%" height="100%" fill="${t}"/><svg x="100%" y="0" width="1" height="1" overflow="visible"><g fill="${r}" fill-opacity="${o}">${ie()}</g></svg></svg>`;return`data:image/svg+xml,${encodeURIComponent(l)}`},a={paper:"#FBF3DF",bubble:"#FFFDF6",black:"#141414",secondary:"#4A4338",grid:"rgba(20, 20, 20, 0.2)"},w="'Bangers', 'Comic Neue', 'Comic Sans MS', cursive",se="'Comic Neue', 'Comic Sans MS', 'Chalkboard SE', cursive",d={vermillion:"#D9401F",cyan:"#0B85C8",yellow:"#FFD60A",magenta:"#D6247A",green:"#15964B",purple:"#7A3DC8"},de=[d.vermillion,d.cyan,d.yellow,d.magenta,d.green,d.purple],ce=["#FFE45C","#F58A1F","#C4161C"],he=[d.cyan,"#ECE5D4",d.vermillion],A={offsetX:4,offsetY:4,blur:0,color:a.black},ge={offsetX:6,offsetY:6,blur:0,color:a.black},S={offsetX:2,offsetY:2,blur:0,color:a.black},I={offsetX:4,offsetY:4,blur:0,color:a.black},fe={offsetX:6,offsetY:6,blur:0,color:a.black},ue={offsetX:2,offsetY:2,blur:0,color:d.yellow},pe={pattern:"dots",color:"rgba(20, 20, 20, 0.24)",size:7},ye={image:ne(a.paper,d.vermillion,.18),fit:"stretch",fallback:a.paper},me={fontFamily:w,fontWeight:400,fontSize:22,lineHeight:1.05,letterSpacing:1.5,textTransform:"uppercase",textColor:a.black},M={fill:d.yellow,stroke:a.black,strokeWidth:3,cornerRadius:0,paddingInline:10,paddingBlock:5,shadow:{offsetX:5,offsetY:5,blur:0,color:d.vermillion}},x={fontFamily:w,fontWeight:400,fontSize:16,lineHeight:1.05,letterSpacing:1,textTransform:"uppercase",textColor:a.black},O={...M,strokeWidth:2.5,paddingInline:7,paddingBlock:3,shadow:{offsetX:3,offsetY:3,blur:0,color:d.vermillion}},E={fontFamily:w,fontWeight:400,letterSpacing:1,textTransform:"uppercase"},y={stroke:a.black,strokeAlpha:1},L={dashArray:[],lineCap:"round",lineJoin:"round"},m={textColor:a.black,fontWeight:700},b={textColor:a.secondary,fontWeight:700},ve={tokens:{graphBackground:a.paper,graphBorder:a.black,geomBorder:a.black,textPrimary:a.black,textSecondary:a.secondary,ruleLine:a.black,gridLine:a.grid,hoverAffordance:a.black,hoverGuideFill:"rgba(20, 20, 20, 0.07)",hoverGuideLine:a.black,tooltipBackground:a.bubble,tooltipBorder:a.black,tooltipPrimaryRow:"rgba(255, 214, 10, 0.35)",annotationShape:d.yellow,annotationArrow:a.black,differenceLabelBackground:a.bubble},defaults:[e.style.graph({fill:ye,strokeWidth:4,cornerRadius:0,fontFamily:se,padding:22,shadow:fe}),e.style.geom({shadow:A,overlay:pe}),e.style.geom({shadow:A},{state:"hovered"}),e.style.geom.bar({...y,strokeWidth:2.5,cornerRadius:0}),e.style.geom.bar({...y,strokeWidth:2.5,shadow:ge},{state:"hovered"}),e.style.geom.line({strokeWidth:3.5,...L,shadow:S,overlay:"none"}),e.style.geom.line({shadow:S},{state:"hovered"}),e.style.geom.area({...y,fillAlpha:1,strokeWidth:2.5,...L}),e.style.geom.point({...y,size:13,strokeWidth:2,shadow:S}),e.style.geom.point({...y,strokeWidth:2,shadow:"none"},{state:"hovered"}),e.style.geom.tile({...y,cornerRadius:2,strokeWidth:1.5,shadow:"none"}),e.style.geom.tile({...y,strokeWidth:3,shadow:"none"},{state:"hovered"}),e.style.geom.rule({strokeWidth:2.5,dashArray:[3,3],lineCap:"round",shadow:"none"}),e.style.geom.rule.label({...E,textColor:d.yellow,fontSize:15}),e.style.gridLine({dashArray:[1,5]}),e.style.gridLine.x({strokeWidth:0}),e.style.gridLine.y({strokeWidth:1.5}),e.style.panelBorder({strokeWidth:0}),e.style.panelBorder.bottom({stroke:a.black,strokeWidth:3,dashArray:[]}),e.style.tickLine({strokeWidth:0}),e.style.tickLabel({...b,fontSize:14,lineHeight:1}),e.style.axisLabel({...m,...E,fontSize:18,lineHeight:1}),e.style.heading({...m}),e.style.heading.h1({fontFamily:w,fontWeight:400,fontSize:36,lineHeight:1,letterSpacing:1,textTransform:"uppercase",textShadow:ue}),e.style.heading.h2({...b,fontSize:16,lineHeight:1.2}),e.style.header({margin:{bottom:18}}),e.style.caption({...b,fontWeight:400,fontSize:13}),e.style.source({...b,fontWeight:400,fontSize:13}),e.style.dataLabel({...m,fontSize:14,fill:"transparent"}),e.style.legendItem({...m,...E,fontSize:18,fill:"transparent",stroke:"transparent"}),e.style.legendItem.swatch({size:16}),e.style.directLabel({fontWeight:700,fontSize:14}),e.style.tooltip({strokeWidth:2.5,cornerRadius:10,paddingInline:12,paddingBlock:9,shadow:I}),e.style.tooltip.heading({...m,fontSize:15,lineHeight:1.3}),e.style.tooltip.label({...b,fontSize:14,lineHeight:1.3}),e.style.tooltip.value({...m,fontSize:14,lineHeight:1.3}),e.style.legend.popover({strokeWidth:2.5,cornerRadius:10,shadow:I}),e.style.annotation.text({...me,...M}),e.style.annotation.shape({fillAlpha:.35,stroke:a.black,strokeWidth:2}),e.style.annotation.arrow({strokeWidth:3.5,dashArray:[]}),e.style.annotation.arrow.outline({stroke:a.paper,strokeWidth:2}),e.style.annotation.pinnedNumber({stroke:a.black,shadow:S}),e.style.annotation.pinnedNumber.label({...x,...O}),e.style.annotation.comment({stroke:a.black,shadow:S}),e.style.annotation.comment.label({...x,...O}),e.style.annotation.differenceArrow({stroke:a.black,strokeWidth:2.5}),e.style.annotation.differenceArrow.label({...x,...O,fontSize:18}),e.style.panelBorder.bottom({strokeWidth:0},{coord:"polar"}),e.style.tickLabel({...m,textOutlineColor:a.paper,textOutlineWidth:3.5},{coord:"polar"}),e.style.geom.area({fillAlpha:.5,shadow:"none"},{coord:"polar"}),e.style.geom.area({shadow:"none"},{coord:"polar",state:"hovered"}),e.style.geom.bar({strokeWidth:2.5,shadow:A},{coord:"polar"}),e.style.geom.bar({strokeWidth:2.5},{coord:"polar",state:"hovered"})]},ke={name:"comic",styles:ve,palettes:{categorical:de,sequential:ce,diverging:he},colorScheme:"light",plugins:re};exports.comic=ke;
package/dist/index.mjs CHANGED
@@ -1,26 +1,26 @@
1
- import { useMemo as I } from "react";
2
- import { buildPolarBarArcPath as j, createStableKeyGenerator as F, defineGeomRenderer as D, getAngleExtent as K, getRadiusExtent as N, getX as B, getY as M, getYMax as V, polarToUnit as J, style as e, toPaintColor as Z, toViewBoxX as q, toViewBoxY as Q, useGeomStyleReader as z } from "@graphysdk/react";
1
+ import { useMemo as H } from "react";
2
+ import { buildPolarBarArcPath as j, createStableKeyGenerator as F, defineGeomRenderer as D, getAngleExtent as K, getRadiusExtent as N, getX as B, getY as M, getYMax as V, polarToUnit as q, style as e, toPaintColor as J, toViewBoxX as Z, toViewBoxY as Q, useGeomStyleReader as z } from "@graphysdk/react";
3
3
  import { jsx as p, jsxs as Y } from "react/jsx-runtime";
4
4
  var ee = (o, r) => {
5
5
  const t = B(o), i = M(o) ?? V(o);
6
6
  return t === null || i === null ? null : {
7
- x: q(t) * r.width,
7
+ x: Z(t) * r.width,
8
8
  y: Q(i) * r.height
9
9
  };
10
10
  }, oe = (o, r) => {
11
11
  const t = B(o), i = M(o) ?? N(o).outerRadius;
12
12
  if (t === null || i === null) return null;
13
- const n = J(t, i), l = Math.min(r.width, r.height) / 2;
13
+ const n = q(t, i), l = Math.min(r.width, r.height) / 2;
14
14
  return {
15
15
  x: r.width / 2 + n.x * l,
16
16
  y: r.height / 2 - n.y * l
17
17
  };
18
- }, te = 22, $ = Math.PI * 2, Ie = $ / (te * 2), re = (o, r, t) => ({
18
+ }, te = 22, $ = Math.PI * 2, Fe = $ / (te * 2), re = (o, r, t) => ({
19
19
  x: o.x + Math.sin(t.angle) * t.radius * r,
20
20
  y: o.y - Math.cos(t.angle) * t.radius * r
21
- }), R = 2, ae = ({ x: o, y: r }) => `${o.toFixed(R)},${r.toFixed(R)}`, _ = 8, ie = 0.6, ne = (o, r) => {
22
- const t = r / 2, i = $ / (_ * 2);
23
- return `M${Array.from({ length: _ * 2 }, (n, l) => re(o, t, {
21
+ }), C = 2, ae = ({ x: o, y: r }) => `${o.toFixed(C)},${r.toFixed(C)}`, R = 8, ie = 0.6, ne = (o, r) => {
22
+ const t = r / 2, i = $ / (R * 2);
23
+ return `M${Array.from({ length: R * 2 }, (n, l) => re(o, t, {
24
24
  angle: l * i,
25
25
  radius: l % 2 === 0 ? 1 : ie
26
26
  })).map(ae).join(" L")} Z`;
@@ -29,7 +29,7 @@ var ee = (o, r) => {
29
29
  return (t, i) => {
30
30
  const n = r.get("shadow", t, i);
31
31
  return {
32
- color: Z(r.get("fill", t, i)),
32
+ color: J(r.get("fill", t, i)),
33
33
  opacity: r.get("alpha", t, i),
34
34
  fillOpacity: r.get("fillAlpha", t, i),
35
35
  outline: r.get("stroke", t, i),
@@ -41,8 +41,8 @@ var ee = (o, r) => {
41
41
  }
42
42
  };
43
43
  };
44
- }, le = 1.35, se = 4, de = 1, C = ({ layer: o, observations: r, panel: t, project: i, state: n }) => {
45
- const l = z(o), f = X(o), g = I(() => F(o.data, o.mapping, o.id), [
44
+ }, le = 1.35, se = 4, de = 1, _ = ({ layer: o, observations: r, panel: t, project: i, state: n }) => {
45
+ const l = z(o), f = X(o), g = H(() => F(o.data, o.mapping, o.id), [
46
46
  o.data,
47
47
  o.mapping,
48
48
  o.id
@@ -52,15 +52,15 @@ var ee = (o, r) => {
52
52
  children: Array.from(r, (u) => {
53
53
  const h = i(u, t);
54
54
  if (h === null) return null;
55
- const s = f(u, n), d = ne(h, l.get("size", u, n) * le + (k ? se : 0));
55
+ const s = f(u, n), c = ne(h, l.get("size", u, n) * le + (k ? se : 0));
56
56
  return /* @__PURE__ */ Y("g", {
57
57
  opacity: s.opacity,
58
58
  children: [s.shadow !== null && /* @__PURE__ */ p("path", {
59
- d,
59
+ d: c,
60
60
  transform: `translate(${s.shadow.offsetX} ${s.shadow.offsetY})`,
61
61
  fill: s.shadow.color
62
62
  }), /* @__PURE__ */ p("path", {
63
- d,
63
+ d: c,
64
64
  fill: s.color,
65
65
  fillOpacity: s.fillOpacity,
66
66
  stroke: s.outline,
@@ -73,13 +73,13 @@ var ee = (o, r) => {
73
73
  }, G = (o, r) => D("point", {
74
74
  coord: o,
75
75
  swatchShape: "circle",
76
- render: ({ layer: t, panelRect: i }) => /* @__PURE__ */ p(C, {
76
+ render: ({ layer: t, panelRect: i }) => /* @__PURE__ */ p(_, {
77
77
  layer: t,
78
78
  observations: t.data,
79
79
  panel: i,
80
80
  project: r
81
81
  }),
82
- renderHover: ({ layer: t, primary: i, panelRect: n }) => /* @__PURE__ */ p(C, {
82
+ renderHover: ({ layer: t, primary: i, panelRect: n }) => /* @__PURE__ */ p(_, {
83
83
  layer: t,
84
84
  observations: [i.observation],
85
85
  panel: n,
@@ -103,7 +103,7 @@ var ee = (o, r) => {
103
103
  radius: t,
104
104
  digits: ge
105
105
  }), x = ({ layer: o, observations: r, panel: t, state: i }) => {
106
- const n = X(o), l = I(() => F(o.data, o.mapping, o.id), [
106
+ const n = X(o), l = H(() => F(o.data, o.mapping, o.id), [
107
107
  o.data,
108
108
  o.mapping,
109
109
  o.id
@@ -122,21 +122,21 @@ var ee = (o, r) => {
122
122
  }), u = i === "hovered";
123
123
  return /* @__PURE__ */ Y("g", {
124
124
  "data-geom": "bar",
125
- children: [!u && k.map(({ key: h, path: s, paint: d }) => d.shadow === null ? null : /* @__PURE__ */ p("path", {
125
+ children: [!u && k.map(({ key: h, path: s, paint: c }) => c.shadow === null ? null : /* @__PURE__ */ p("path", {
126
126
  d: s,
127
- transform: `translate(${d.shadow.offsetX} ${d.shadow.offsetY})`,
128
- fill: d.shadow.color,
129
- opacity: d.opacity
130
- }, `${h}-shadow`)), k.map(({ key: h, path: s, paint: d }) => /* @__PURE__ */ p("path", {
127
+ transform: `translate(${c.shadow.offsetX} ${c.shadow.offsetY})`,
128
+ fill: c.shadow.color,
129
+ opacity: c.opacity
130
+ }, `${h}-shadow`)), k.map(({ key: h, path: s, paint: c }) => /* @__PURE__ */ p("path", {
131
131
  "data-comic-slice": "sector",
132
132
  d: s,
133
- fill: d.color,
134
- fillOpacity: d.fillOpacity,
133
+ fill: c.color,
134
+ fillOpacity: c.fillOpacity,
135
135
  fillRule: "evenodd",
136
- stroke: d.outline,
137
- strokeWidth: d.outlineWidth + (u ? fe : 0),
136
+ stroke: c.outline,
137
+ strokeWidth: c.outlineWidth + (u ? fe : 0),
138
138
  strokeLinejoin: "round",
139
- opacity: d.opacity
139
+ opacity: c.opacity
140
140
  }, h))]
141
141
  });
142
142
  }, me = D("bar", {
@@ -159,12 +159,12 @@ var ee = (o, r) => {
159
159
  me,
160
160
  ce,
161
161
  he
162
- ], b = 10, ke = 0.42, L = 220, be = 0.6, A = 1, Se = () => {
163
- const o = Math.ceil(L / b), r = [];
162
+ ], b = 10, ke = 0.42, I = 220, be = 0.6, A = 1, Se = () => {
163
+ const o = Math.ceil(I / b), r = [];
164
164
  for (let t = 0; t <= o; t += 1) {
165
165
  const i = t % 2 === 0 ? 0 : b / 2;
166
166
  for (let n = 0; n <= 23; n += 1) {
167
- const l = -(n * b + i), f = t * b, g = b * ke * (1 - Math.hypot(l, f) / L);
167
+ const l = -(n * b + i), f = t * b, g = b * ke * (1 - Math.hypot(l, f) / I);
168
168
  g >= be && r.push(`<circle cx="${l.toFixed(A)}" cy="${f.toFixed(A)}" r="${g.toFixed(A)}"/>`);
169
169
  }
170
170
  }
@@ -178,7 +178,7 @@ var ee = (o, r) => {
178
178
  black: "#141414",
179
179
  secondary: "#4A4338",
180
180
  grid: "rgba(20, 20, 20, 0.2)"
181
- }, T = "'Bangers', 'Comic Neue', 'Comic Sans MS', cursive", Te = "'Comic Neue', 'Comic Sans MS', 'Chalkboard SE', cursive", c = {
181
+ }, T = "'Bangers', 'Comic Neue', 'Comic Sans MS', cursive", Te = "'Comic Neue', 'Comic Sans MS', 'Chalkboard SE', cursive", d = {
182
182
  vermillion: "#D9401F",
183
183
  cyan: "#0B85C8",
184
184
  yellow: "#FFD60A",
@@ -186,22 +186,26 @@ var ee = (o, r) => {
186
186
  green: "#15964B",
187
187
  purple: "#7A3DC8"
188
188
  }, Ae = [
189
- c.vermillion,
190
- c.cyan,
191
- c.yellow,
192
- c.magenta,
193
- c.green,
194
- c.purple
189
+ d.vermillion,
190
+ d.cyan,
191
+ d.yellow,
192
+ d.magenta,
193
+ d.green,
194
+ d.purple
195
195
  ], ye = [
196
196
  "#FFE45C",
197
197
  "#F58A1F",
198
198
  "#C4161C"
199
+ ], Oe = [
200
+ d.cyan,
201
+ "#ECE5D4",
202
+ d.vermillion
199
203
  ], y = {
200
204
  offsetX: 4,
201
205
  offsetY: 4,
202
206
  blur: 0,
203
207
  color: a.black
204
- }, Oe = {
208
+ }, Ee = {
205
209
  offsetX: 6,
206
210
  offsetY: 6,
207
211
  blur: 0,
@@ -211,7 +215,7 @@ var ee = (o, r) => {
211
215
  offsetY: 2,
212
216
  blur: 0,
213
217
  color: a.black
214
- }, P = {
218
+ }, L = {
215
219
  offsetX: 4,
216
220
  offsetY: 4,
217
221
  blur: 0,
@@ -221,20 +225,20 @@ var ee = (o, r) => {
221
225
  offsetY: 6,
222
226
  blur: 0,
223
227
  color: a.black
224
- }, Ee = {
228
+ }, Ce = {
225
229
  offsetX: 2,
226
230
  offsetY: 2,
227
231
  blur: 0,
228
- color: c.yellow
232
+ color: d.yellow
229
233
  }, Re = {
230
234
  pattern: "dots",
231
235
  color: "rgba(20, 20, 20, 0.24)",
232
236
  size: 7
233
237
  }, _e = {
234
- image: we(a.paper, c.vermillion, 0.18),
238
+ image: we(a.paper, d.vermillion, 0.18),
235
239
  fit: "stretch",
236
240
  fallback: a.paper
237
- }, Ce = {
241
+ }, xe = {
238
242
  fontFamily: T,
239
243
  fontWeight: 400,
240
244
  fontSize: 22,
@@ -243,7 +247,7 @@ var ee = (o, r) => {
243
247
  textTransform: "uppercase",
244
248
  textColor: a.black
245
249
  }, U = {
246
- fill: c.yellow,
250
+ fill: d.yellow,
247
251
  stroke: a.black,
248
252
  strokeWidth: 3,
249
253
  cornerRadius: 0,
@@ -253,7 +257,7 @@ var ee = (o, r) => {
253
257
  offsetX: 5,
254
258
  offsetY: 5,
255
259
  blur: 0,
256
- color: c.vermillion
260
+ color: d.vermillion
257
261
  }
258
262
  }, O = {
259
263
  fontFamily: T,
@@ -263,7 +267,7 @@ var ee = (o, r) => {
263
267
  letterSpacing: 1,
264
268
  textTransform: "uppercase",
265
269
  textColor: a.black
266
- }, W = {
270
+ }, E = {
267
271
  ...U,
268
272
  strokeWidth: 2.5,
269
273
  paddingInline: 7,
@@ -272,9 +276,9 @@ var ee = (o, r) => {
272
276
  offsetX: 3,
273
277
  offsetY: 3,
274
278
  blur: 0,
275
- color: c.vermillion
279
+ color: d.vermillion
276
280
  }
277
- }, E = {
281
+ }, W = {
278
282
  fontFamily: T,
279
283
  fontWeight: 400,
280
284
  letterSpacing: 1,
@@ -282,7 +286,7 @@ var ee = (o, r) => {
282
286
  }, m = {
283
287
  stroke: a.black,
284
288
  strokeAlpha: 1
285
- }, H = {
289
+ }, P = {
286
290
  dashArray: [],
287
291
  lineCap: "round",
288
292
  lineJoin: "round"
@@ -292,11 +296,10 @@ var ee = (o, r) => {
292
296
  }, w = {
293
297
  textColor: a.secondary,
294
298
  fontWeight: 700
295
- }, xe = {
299
+ }, Ie = {
296
300
  tokens: {
297
301
  graphBackground: a.paper,
298
302
  graphBorder: a.black,
299
- geom: c.vermillion,
300
303
  geomBorder: a.black,
301
304
  textPrimary: a.black,
302
305
  textSecondary: a.secondary,
@@ -308,7 +311,7 @@ var ee = (o, r) => {
308
311
  tooltipBackground: a.bubble,
309
312
  tooltipBorder: a.black,
310
313
  tooltipPrimaryRow: "rgba(255, 214, 10, 0.35)",
311
- annotationShape: c.yellow,
314
+ annotationShape: d.yellow,
312
315
  annotationArrow: a.black,
313
316
  differenceLabelBackground: a.bubble
314
317
  },
@@ -334,11 +337,11 @@ var ee = (o, r) => {
334
337
  e.geom.bar({
335
338
  ...m,
336
339
  strokeWidth: 2.5,
337
- shadow: Oe
340
+ shadow: Ee
338
341
  }, { state: "hovered" }),
339
342
  e.geom.line({
340
343
  strokeWidth: 3.5,
341
- ...H,
344
+ ...P,
342
345
  shadow: S,
343
346
  overlay: "none"
344
347
  }),
@@ -347,7 +350,7 @@ var ee = (o, r) => {
347
350
  ...m,
348
351
  fillAlpha: 1,
349
352
  strokeWidth: 2.5,
350
- ...H
353
+ ...P
351
354
  }),
352
355
  e.geom.point({
353
356
  ...m,
@@ -378,8 +381,8 @@ var ee = (o, r) => {
378
381
  shadow: "none"
379
382
  }),
380
383
  e.geom.rule.label({
381
- ...E,
382
- textColor: c.yellow,
384
+ ...W,
385
+ textColor: d.yellow,
383
386
  fontSize: 15
384
387
  }),
385
388
  e.gridLine({ dashArray: [1, 5] }),
@@ -399,7 +402,7 @@ var ee = (o, r) => {
399
402
  }),
400
403
  e.axisLabel({
401
404
  ...v,
402
- ...E,
405
+ ...W,
403
406
  fontSize: 18,
404
407
  lineHeight: 1
405
408
  }),
@@ -411,7 +414,7 @@ var ee = (o, r) => {
411
414
  lineHeight: 1,
412
415
  letterSpacing: 1,
413
416
  textTransform: "uppercase",
414
- textShadow: Ee
417
+ textShadow: Ce
415
418
  }),
416
419
  e.heading.h2({
417
420
  ...w,
@@ -436,7 +439,7 @@ var ee = (o, r) => {
436
439
  }),
437
440
  e.legendItem({
438
441
  ...v,
439
- ...E,
442
+ ...W,
440
443
  fontSize: 18,
441
444
  fill: "transparent",
442
445
  stroke: "transparent"
@@ -451,7 +454,7 @@ var ee = (o, r) => {
451
454
  cornerRadius: 10,
452
455
  paddingInline: 12,
453
456
  paddingBlock: 9,
454
- shadow: P
457
+ shadow: L
455
458
  }),
456
459
  e.tooltip.heading({
457
460
  ...v,
@@ -471,10 +474,10 @@ var ee = (o, r) => {
471
474
  e.legend.popover({
472
475
  strokeWidth: 2.5,
473
476
  cornerRadius: 10,
474
- shadow: P
477
+ shadow: L
475
478
  }),
476
479
  e.annotation.text({
477
- ...Ce,
480
+ ...xe,
478
481
  ...U
479
482
  }),
480
483
  e.annotation.shape({
@@ -496,7 +499,7 @@ var ee = (o, r) => {
496
499
  }),
497
500
  e.annotation.pinnedNumber.label({
498
501
  ...O,
499
- ...W
502
+ ...E
500
503
  }),
501
504
  e.annotation.comment({
502
505
  stroke: a.black,
@@ -504,7 +507,7 @@ var ee = (o, r) => {
504
507
  }),
505
508
  e.annotation.comment.label({
506
509
  ...O,
507
- ...W
510
+ ...E
508
511
  }),
509
512
  e.annotation.differenceArrow({
510
513
  stroke: a.black,
@@ -512,7 +515,7 @@ var ee = (o, r) => {
512
515
  }),
513
516
  e.annotation.differenceArrow.label({
514
517
  ...O,
515
- ...W,
518
+ ...E,
516
519
  fontSize: 18
517
520
  }),
518
521
  e.panelBorder.bottom({ strokeWidth: 0 }, { coord: "polar" }),
@@ -538,14 +541,17 @@ var ee = (o, r) => {
538
541
  state: "hovered"
539
542
  })
540
543
  ]
541
- }, Fe = {
544
+ }, De = {
542
545
  name: "comic",
543
- styles: xe,
544
- palette: Ae,
545
- colormap: ye,
546
+ styles: Ie,
547
+ palettes: {
548
+ categorical: Ae,
549
+ sequential: ye,
550
+ diverging: Oe
551
+ },
546
552
  colorScheme: "light",
547
553
  plugins: ve
548
554
  };
549
555
  export {
550
- Fe as comic
556
+ De as comic
551
557
  };
package/dist/styles.d.ts CHANGED
@@ -25,6 +25,8 @@ export declare const COMIC_HUES: {
25
25
  export declare const COMIC_PALETTE: readonly string[];
26
26
  /** For a colour that stands for a number: from yellow through orange to a deep red. */
27
27
  export declare const COMIC_COLORMAP: readonly string[];
28
+ /** For a number either side of a midpoint: cyan one way and vermillion the other, through a shade off the paper. */
29
+ export declare const COMIC_DIVERGING: readonly string[];
28
30
  /**
29
31
  * The comic look: newsprint framed in black like a panel, shapes in flat colour under printed dots
30
32
  * with a black outline and a hard black shadow, thick round lines, a black baseline, and boxes
package/package.json CHANGED
@@ -13,7 +13,7 @@
13
13
  "theme",
14
14
  "comic"
15
15
  ],
16
- "version": "0.1.1-beta.1791894562924",
16
+ "version": "0.1.1-beta.1791968387850",
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.1791894562924"
43
+ "@graphysdk/react": "^1.9.0-beta.1791968387850"
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/react": "1.9.0-beta.1791894562924",
56
- "@graphytools/typescript-config": "0.0.1",
57
- "@graphytools/vitest-config": "1.0.0",
55
+ "@graphysdk/react": "1.9.0-beta.1791968387850",
56
+ "@graphysdk/viz-engine": "1.9.0-beta.1791968387850",
58
57
  "@graphytools/eslint-config": "0.0.1",
59
- "@graphysdk/viz-engine": "1.9.0-beta.1791894562924"
58
+ "@graphytools/typescript-config": "0.0.1",
59
+ "@graphytools/vitest-config": "1.0.0"
60
60
  },
61
61
  "publishConfig": {
62
62
  "access": "public"