@graphysdk/theme-comic 0.1.1-beta.1792518514317 → 0.1.1-beta.1792575115573

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/comic.d.ts CHANGED
@@ -3,10 +3,10 @@ import { Theme } from '@graphysdk/react';
3
3
  * Graphs as a panel of a printed comic, by way of the sound effects of the 1960s Batman show: a
4
4
  * square black frame round newsprint with a patch of screen tone in its corner, the flat colours of a
5
5
  * four-colour press under its dots, a black outline and a hard black shadow for every shape, thick
6
- * round lines and a title in capitals. A pie or a donut is the burst a comic letters "POW!" in, each
7
- * slice cut to its jagged edge at exactly its angles; a point is a little burst centred on its
8
- * reading. A text annotation is lettered as a sound effect, red capitals on a yellow plate. Groups take
9
- * vermillion, cyan, yellow, magenta, green and purple. Drawn for the light scheme only.
6
+ * round lines and a title in capitals. A point is a little burst, the shape a comic letters "POW!"
7
+ * in, centred on its reading. A text annotation is lettered as a sound effect, black capitals on a
8
+ * yellow plate. Groups take vermillion, cyan, yellow, magenta, green and purple. Drawn for the light
9
+ * scheme only.
10
10
  *
11
11
  * The faces are Bangers for the title, the sound effects, the axis names and the key, and Comic Neue
12
12
  * for the rest. Import `@graphysdk/theme-comic/fonts.css` once to load them.
@@ -1,5 +1,6 @@
1
1
  /**
2
2
  * The paper as a data URI, for the graph's `fill`: `paper` all over, with a tone of `ink` dots
3
- * fading out of its top right corner, where a title set from the left leaves the paper bare.
3
+ * fading out of its bottom right corner. The title and the legend sit in the top corners, one on
4
+ * each side as the writing direction turns, so the tone stays off both.
4
5
  */
5
6
  export declare const buildHalftonePaper: (paper: string, ink: string, inkOpacity: number) => string;
package/dist/index.cjs CHANGED
@@ -1 +1,4 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});let H=require("react"),e=require("@graphysdk/react"),f=require("react/jsx-runtime");var $=(t,o)=>{const r=(0,e.getX)(t),a=(0,e.getY)(t)??(0,e.getYMax)(t);return r===null||a===null?null:{x:(0,e.toViewBoxX)(r)*o.width,y:(0,e.toViewBoxY)(a)*o.height}},G=(t,o)=>{const r=(0,e.getX)(t),a=(0,e.getY)(t)??(0,e.getRadiusExtent)(t).outerRadius;if(r===null||a===null)return null;const i=(0,e.polarToUnit)(r,a),l=Math.min(o.width,o.height)/2;return{x:o.width/2+i.x*l,y:o.height/2-i.y*l}},X=22,F=Math.PI*2,be=F/(X*2),j=(t,o,r)=>({x:t.x+Math.sin(r.angle)*r.radius*o,y:t.y-Math.cos(r.angle)*r.radius*o}),W=2,U=({x:t,y:o})=>`${t.toFixed(W)},${o.toFixed(W)}`,_=8,K=.6,V=(t,o)=>{const r=o/2,a=F/(_*2);return`M${Array.from({length:_*2},(i,l)=>j(t,r,{angle:l*a,radius:l%2===0?1:K})).map(U).join(" L")} Z`},D=t=>{const o=(0,e.useGeomStyleReader)(t);return(r,a)=>{const i=o.get("shadow",r,a);return{color:(0,e.toPaintColor)(o.get("fill",r,a)),opacity:o.get("alpha",r,a),fillOpacity:o.get("fillAlpha",r,a),outline:o.get("stroke",r,a),outlineWidth:o.get("strokeWidth",r,a),shadow:i==="none"?null:{offsetX:i.offsetX,offsetY:i.offsetY,color:i.color}}}},N=1.35,q=4,J=1,C=({layer:t,observations:o,panel:r,project:a,state:i})=>{const l=(0,e.useGeomStyleReader)(t),h=D(t),g=(0,H.useMemo)(()=>(0,e.createStableKeyGenerator)(t.data,t.mapping,t.id),[t.data,t.mapping,t.id]),p=i==="hovered";return(0,f.jsx)("g",{"data-geom":"point",children:Array.from(o,y=>{const u=a(y,r);if(u===null)return null;const s=h(y,i),c=V(u,l.get("size",y,i)*N+(p?q:0));return(0,f.jsxs)("g",{opacity:s.opacity,children:[s.shadow!==null&&(0,f.jsx)("path",{d:c,transform:`translate(${s.shadow.offsetX} ${s.shadow.offsetY})`,fill:s.shadow.color}),(0,f.jsx)("path",{d:c,fill:s.color,fillOpacity:s.fillOpacity,stroke:s.outline,strokeWidth:s.outlineWidth+(p?J:0),strokeLinejoin:"round"})]},g(y))})})},M=(t,o)=>(0,e.defineGeomRenderer)("point",{coord:t,swatchShape:"circle",render:({layer:r,panelRect:a})=>(0,f.jsx)(C,{layer:r,observations:r.data,panel:a,project:o}),renderHover:({layer:r,primary:a,panelRect:i})=>(0,f.jsx)(C,{layer:r,observations:[a.observation],panel:i,project:o,state:"hovered"}),renderHoverCompanions:()=>null,getEditOutlineShapes:({layer:r,panelRect:a,styleReaders:i})=>(0,e.buildDotsEditOutlineShapes)(Array.from(r.data,l=>{const h=o(l,a),g=i.get("size",l);if(h===null||g===void 0)return[];const p=i.get("strokeWidth",l)??0;return[{center:h,size:g*N+p}]}).flat())}),Z=M("cartesian",$),Q=M("polar",G),ee=2,te=2,B=t=>{const{startAngle:o,endAngle:r}=(0,e.getAngleExtent)(t),{innerRadius:a,outerRadius:i}=(0,e.getRadiusExtent)(t);return o===null||r===null||a===null||i===null||r<=o||i<=0?null:{startAngle:o,endAngle:r,innerRadius:a,outerRadius:i}},oe=(t,o,r)=>[...t].flatMap(a=>{const i=B(a);return i===null?[]:[{key:`${r(a)}-${i.startAngle}`,paint:o(a),...i}]}),z=(t,o,r)=>(0,e.buildPolarBarArcPath)(t,{centerX:o.x,centerY:o.y,radius:r,digits:te}),R=({layer:t,observations:o,panel:r,state:a})=>{const i=D(t),l=(0,H.useMemo)(()=>(0,e.createStableKeyGenerator)(t.data,t.mapping,t.id),[t.data,t.mapping,t.id]),h=Math.min(r.width,r.height)/2;if(h<=0)return null;const g={x:r.width/2,y:r.height/2},p=oe(o,u=>i(u,a),l).flatMap(u=>{const s=z(u,g,h);return s===void 0?[]:[{key:u.key,path:s,paint:u.paint}]}),y=a==="hovered";return(0,f.jsxs)("g",{"data-geom":"bar",children:[!y&&p.map(({key:u,path:s,paint:c})=>c.shadow===null?null:(0,f.jsx)("path",{d:s,transform:`translate(${c.shadow.offsetX} ${c.shadow.offsetY})`,fill:c.shadow.color,opacity:c.opacity},`${u}-shadow`)),p.map(({key:u,path:s,paint:c})=>(0,f.jsx)("path",{"data-comic-slice":"sector",d:s,fill:c.color,fillOpacity:c.fillOpacity,fillRule:"evenodd",stroke:c.outline,strokeWidth:c.outlineWidth+(y?ee:0),strokeLinejoin:"round",opacity:c.opacity},u))]})},re=(0,e.defineGeomRenderer)("bar",{coord:"polar",guideMode:"band",swatchShape:"slice",render:({layer:t,panelRect:o})=>(0,f.jsx)(R,{layer:t,observations:t.data,panel:o}),renderHover:({layer:t,primary:o,panelRect:r})=>(0,f.jsx)(R,{layer:t,observations:[o.observation],panel:r,state:"hovered"}),renderHoverCompanions:()=>null,getEditOutlineShapes:({layer:t,panelRect:o,animateTransitions:r})=>{const a=Math.min(o.width,o.height)/2,i={x:o.width/2,y:o.height/2},l=Array.from(t.data,h=>{const g=B(h);return g===null?"":z(g,i,a)??""}).join("");return l===""?[]:[{kind:"region",pathData:l,animateTransitions:r}]}}),ae=[re,Z,Q],k=10,ne=.42,P=220,ie=.6,T=1,le=()=>{const t=Math.ceil(P/k),o=[];for(let r=0;r<=t;r+=1){const a=r%2===0?0:k/2;for(let i=0;i<=23;i+=1){const l=-(i*k+a),h=r*k,g=k*ne*(1-Math.hypot(l,h)/P);g>=ie&&o.push(`<circle cx="${l.toFixed(T)}" cy="${h.toFixed(T)}" r="${g.toFixed(T)}"/>`)}}return o.join("")},se=(t,o,r)=>{const a=`<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="${o}" fill-opacity="${r}">${le()}</g></svg></svg>`;return`data:image/svg+xml,${encodeURIComponent(a)}`},n={paper:"#FBF3DF",bubble:"#FFFDF6",black:"#141414",secondary:"#4A4338",grid:"rgba(20, 20, 20, 0.2)",deepRed:"#C4161C"},w="'Bangers', 'Comic Neue', 'Comic Sans MS', cursive",de="'Comic Neue', 'Comic Sans MS', 'Chalkboard SE', cursive",d={vermillion:"#D9401F",cyan:"#0B85C8",yellow:"#FFD60A",magenta:"#D6247A",green:"#15964B",purple:"#7A3DC8"},ce=[d.vermillion,d.cyan,d.yellow,d.magenta,d.green,d.purple],he=["#FFE45C","#F58A1F","#C4161C"],ge=[d.cyan,"#ECE5D4",d.vermillion],A={offsetX:4,offsetY:4,blur:0,color:n.black},ue={offsetX:6,offsetY:6,blur:0,color:n.black},S={offsetX:2,offsetY:2,blur:0,color:n.black},I={offsetX:4,offsetY:4,blur:0,color:n.black},fe={offsetX:6,offsetY:6,blur:0,color:n.black},pe={offsetX:2,offsetY:2,blur:0,color:d.yellow},ye={pattern:"dots",color:"rgba(20, 20, 20, 0.24)",size:7},me={image:se(n.paper,d.vermillion,.18),fit:"stretch",fallback:n.paper},ve={fontFamily:w,fontWeight:400,fontSize:22,lineHeight:1.05,letterSpacing:1.5,textTransform:"uppercase",textColor:n.black},Y={fill:d.yellow,stroke:n.black,strokeWidth:3,cornerRadius:0,paddingInline:10,paddingBlock:5,shadow:{offsetX:5,offsetY:5,blur:0,color:d.vermillion}},O={fontFamily:w,fontWeight:400,fontSize:16,lineHeight:1.05,letterSpacing:1,textTransform:"uppercase",textColor:n.black},E={...Y,strokeWidth:2.5,paddingInline:7,paddingBlock:3,shadow:{offsetX:3,offsetY:3,blur:0,color:d.vermillion}},x={fontFamily:w,fontWeight:400,letterSpacing:1,textTransform:"uppercase"},m={stroke:n.black,strokeAlpha:1},L={dashArray:[],lineCap:"round",lineJoin:"round"},v={textColor:n.black,fontWeight:700},b={textColor:n.secondary,fontWeight:700},ke={tokens:{graphBackground:n.paper,graphBorder:n.black,geomBorder:n.black,textPrimary:n.black,textSecondary:n.secondary,ruleLine:n.black,gridLine:n.grid,hoverAffordance:n.black,hoverGuideFill:"rgba(20, 20, 20, 0.07)",hoverGuideLine:n.black,tooltipBackground:n.bubble,tooltipBorder:n.black,tooltipPrimaryRow:"rgba(255, 214, 10, 0.35)",annotationShape:d.yellow,annotationArrow:n.black,differenceLabelBackground:n.bubble,trendPositive:d.green,trendNegative:n.deepRed,trendNeutral:n.secondary},defaults:[e.style.graph({fill:me,strokeWidth:4,cornerRadius:0,fontFamily:de,padding:22,shadow:fe}),e.style.geom({shadow:A,overpaint:ye}),e.style.geom({shadow:A},{state:"hovered"}),e.style.geom.bar({...m,strokeWidth:2.5,cornerRadius:0}),e.style.geom.bar({...m,strokeWidth:2.5,shadow:ue},{state:"hovered"}),e.style.geom.line({strokeWidth:3.5,...L,shadow:S,overpaint:"none"}),e.style.geom.line({shadow:S},{state:"hovered"}),e.style.geom.area({...m,fillAlpha:1,strokeWidth:2.5,...L}),e.style.geom.point({...m,size:13,strokeWidth:2,shadow:S}),e.style.geom.point({...m,strokeWidth:2,shadow:"none"},{state:"hovered"}),e.style.geom.tile({...m,cornerRadius:2,strokeWidth:1.5,shadow:"none"}),e.style.geom.tile({...m,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({...x,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:n.black,strokeWidth:3,dashArray:[]}),e.style.tickLine({strokeWidth:0}),e.style.tickLabel({...b,fontSize:14,lineHeight:1}),e.style.axisLabel({...v,...x,fontSize:18,lineHeight:1}),e.style.heading({...v}),e.style.heading.h1({fontFamily:w,fontWeight:400,fontSize:36,lineHeight:1,letterSpacing:1,textTransform:"uppercase",textShadow:pe}),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({...v,fontSize:14,fill:"transparent"}),e.style.legendItem({...v,...x,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({...v,fontSize:15,lineHeight:1.3}),e.style.tooltip.label({...b,fontSize:14,lineHeight:1.3}),e.style.tooltip.value({...v,fontSize:14,lineHeight:1.3}),e.style.legend.popover({strokeWidth:2.5,cornerRadius:10,shadow:I}),e.style.annotation.text({...ve,...Y}),e.style.annotation.shape({fillAlpha:.35,stroke:n.black,strokeWidth:2}),e.style.annotation.arrow({strokeWidth:3.5,dashArray:[]}),e.style.annotation.arrow.outline({stroke:n.paper,strokeWidth:2}),e.style.annotation.pinnedNumber({stroke:n.black,shadow:S}),e.style.annotation.pinnedNumber.label({...O,...E}),e.style.annotation.comment({stroke:n.black,shadow:S}),e.style.annotation.comment.label({...O,...E}),e.style.annotation.differenceArrow({stroke:n.black,strokeWidth:2.5}),e.style.annotation.differenceArrow.label({...O,...E,fontSize:18}),e.style.panelBorder.bottom({strokeWidth:0},{coord:"polar"}),e.style.tickLabel({...v,textOutlineColor:n.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"})]},Se={name:"comic",styles:ke,palettes:{categorical:ce,sequential:he,diverging:ge},colorScheme:"light",plugins:ae};exports.comic=Se;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});let N=require("react"),e=require("@graphysdk/react"),h=require("react/jsx-runtime");var Y=(t,r)=>{const a=(0,e.getX)(t),l=(0,e.getY)(t)??(0,e.getYMax)(t);return a===null||l===null?null:{x:(0,e.toViewBoxX)(a)*r.width,y:(0,e.toViewBoxY)(l)*r.height}},X=(t,r)=>{const a=(0,e.getX)(t),l=(0,e.getY)(t)??(0,e.getRadiusExtent)(t).outerRadius;if(a===null||l===null)return null;const n=(0,e.polarToUnit)(a,l),i=Math.min(r.width,r.height)/2;return{x:r.width/2+n.x*i,y:r.height/2-n.y*i}},P=8,$=.6,G=Math.PI*2,F=2,j=({x:t,y:r})=>`${t.toFixed(F)},${r.toFixed(F)}`,U=(t,r)=>{const a=G/(P*2);return`M${Array.from({length:P*2},(l,n)=>{const i=(n%2===0?1:$)*(r/2);return{x:t.x+Math.sin(n*a)*i,y:t.y-Math.cos(n*a)*i}}).map(j).join(" L")} Z`},K=t=>{const r=(0,e.useGeomStyleReader)(t);return(a,l)=>{const n=r.get("shadow",a,l);return{color:(0,e.toPaintColor)(r.get("fill",a,l)),opacity:r.get("alpha",a,l),fillOpacity:r.get("fillAlpha",a,l),outline:r.get("stroke",a,l),outlineWidth:r.get("strokeWidth",a,l),shadow:n==="none"?null:{offsetX:n.offsetX,offsetY:n.offsetY,color:n.color}}}},q=1.35,V=`
2
+ @keyframes comic-pop { from { transform: scale(0); } to { transform: none; } }
3
+ .comic-pop { animation: comic-pop var(--comic-pop-duration) cubic-bezier(0.34, 1.56, 0.64, 1) var(--comic-pop-delay) both; }
4
+ `,z=t=>t*q,J=(t,r,a)=>{const[l]=(0,N.useState)(()=>t?.type==="grow"&&t.growAxis==="size"?{plan:t,keys:new Set(Array.from(r,a))}:null);return l},Z=(t,r,a)=>({transformOrigin:`${t.x}px ${t.y}px`,"--comic-pop-duration":`${r.durationSeconds}s`,"--comic-pop-delay":`${r.delayByKey[a]??0}s`}),L=({layer:t,observations:r,panel:a,project:l,state:n,intro:i,animateTransitions:d=!1})=>{const f=(0,e.useGeomStyleReader)(t),m=K(t),p=(0,N.useMemo)(()=>(0,e.createStableKeyGenerator)(t.data,t.mapping,t.id),[t.data,t.mapping,t.id]),y=J(i,r,p);return(0,h.jsxs)("g",{"data-geom":"point",children:[y!==null&&(0,h.jsx)("style",{children:V}),Array.from(r,b=>{const x=l(b,a);if(x===null)return null;const A=p(b),c=m(b,n),W=U(x,z(f.get("size",b,n))),_=y!==null&&y.keys.has(A);return(0,h.jsxs)("g",{opacity:c.opacity,strokeLinejoin:"round",className:_?"comic-pop":void 0,style:_?Z(x,y.plan,A):void 0,children:[c.shadow!==null&&(0,h.jsx)("g",{transform:`translate(${c.shadow.offsetX} ${c.shadow.offsetY})`,children:(0,h.jsx)(e.DefaultGeomPath,{d:W,source:t,fill:c.shadow.color,animateTransitions:d})}),(0,h.jsx)(e.DefaultGeomPath,{d:W,source:t,fill:c.color,fillOpacity:c.fillOpacity,stroke:c.outline,strokeWidth:c.outlineWidth,animateTransitions:d})]},A)})]})},B=(t,r)=>(0,e.defineGeomRenderer)("point",{coord:t,swatchShape:"circle",render:({layer:a,panelRect:l,intro:n,animateTransitions:i})=>(0,h.jsx)(L,{layer:a,observations:a.data,panel:l,project:r,intro:n,animateTransitions:i}),renderHover:({layer:a,primary:l,panelRect:n})=>(0,h.jsx)(L,{layer:a,observations:[l.observation],panel:n,project:r,state:"hovered"}),renderHoverCompanions:()=>null,getEditOutlineShapes:({layer:a,panelRect:l,styleReaders:n})=>(0,e.buildDotsEditOutlineShapes)([...a.data].flatMap(i=>{const d=r(i,l),f=n.get("size",i);if(d===null||f===void 0)return[];const m=n.get("shadow",i),p=m==="none"?{x:0,y:0}:{x:m.offsetX,y:m.offsetY},y=z(f)+(n.get("strokeWidth",i)??0);return[{center:{x:d.x+p.x/2,y:d.y+p.y/2},size:y+Math.hypot(p.x,p.y)}]}))}),Q=B("cartesian",Y),ee=B("polar",X),te=[Q,ee],k=10,oe=.42,I=220,re=.6,T=1,ae=()=>{const t=Math.ceil(I/k),r=[];for(let a=0;a<=t;a+=1){const l=a%2===0?0:k/2;for(let n=0;n<=23;n+=1){const i=-(n*k+l),d=-a*k,f=k*oe*(1-Math.hypot(i,d)/I);f>=re&&r.push(`<circle cx="${i.toFixed(T)}" cy="${d.toFixed(T)}" r="${f.toFixed(T)}"/>`)}}return r.join("")},le=(t,r,a)=>{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="100%" width="1" height="1" overflow="visible"><g fill="${r}" fill-opacity="${a}">${ae()}</g></svg></svg>`;return`data:image/svg+xml,${encodeURIComponent(l)}`},o={paper:"#FBF3DF",bubble:"#FFFDF6",black:"#141414",secondary:"#4A4338",grid:"rgba(20, 20, 20, 0.2)",deepRed:"#C4161C"},w="'Bangers', 'Comic Neue', 'Comic Sans MS', cursive",ne="'Comic Neue', 'Comic Sans MS', 'Chalkboard SE', cursive",s={vermillion:"#D9401F",cyan:"#0B85C8",yellow:"#FFD60A",magenta:"#D6247A",green:"#15964B",purple:"#7A3DC8"},ie=[s.vermillion,s.cyan,s.yellow,s.magenta,s.green,s.purple],se=["#FFE45C","#F58A1F","#C4161C"],de=[s.cyan,"#ECE5D4",s.vermillion],R={offsetX:4,offsetY:4,blur:0,color:o.black},ce={offsetX:6,offsetY:6,blur:0,color:o.black},v={offsetX:2,offsetY:2,blur:0,color:o.black},D={offsetX:4,offsetY:4,blur:0,color:o.black},he={offsetX:6,offsetY:6,blur:0,color:o.black},fe={offsetX:2,offsetY:2,blur:0,color:s.yellow},pe={pattern:"dots",color:"rgba(20, 20, 20, 0.24)",size:7},ge={image:le(o.paper,s.vermillion,.18),fit:"stretch",fallback:o.paper},ue={fontFamily:w,fontWeight:400,fontSize:16,lineHeight:1.05,letterSpacing:1,textTransform:"uppercase",textColor:o.black},M={fill:s.yellow,stroke:o.black,strokeWidth:3,cornerRadius:0,paddingInline:7,paddingBlock:4,shadow:{offsetX:5,offsetY:5,blur:0,color:s.vermillion}},E={fontFamily:w,fontWeight:400,fontSize:16,lineHeight:1.05,letterSpacing:1,textTransform:"uppercase",textColor:o.black},C={...M,strokeWidth:2.5,paddingInline:7,paddingBlock:3,shadow:{offsetX:3,offsetY:3,blur:0,color:s.vermillion}},O={fontFamily:w,fontWeight:400,letterSpacing:1,textTransform:"uppercase"},g={stroke:o.black,strokeAlpha:1},H={dashArray:[],lineCap:"round",lineJoin:"round"},u={textColor:o.black,fontWeight:700},S={textColor:o.secondary,fontWeight:700},ye={tokens:{graphBackground:o.paper,graphBorder:o.black,geomBorder:o.black,textPrimary:o.black,textSecondary:o.secondary,ruleLine:o.black,gridLine:o.grid,hoverAffordance:o.black,hoverGuideFill:"rgba(20, 20, 20, 0.07)",hoverGuideLine:o.black,legendFocus:o.black,tooltipBackground:o.bubble,tooltipBorder:o.black,tooltipPrimaryRow:"rgba(255, 214, 10, 0.35)",annotationShape:s.yellow,annotationArrow:o.black,differenceLabelBackground:o.bubble,trendPositive:s.green,trendNegative:o.deepRed,trendNeutral:o.secondary},defaults:[e.style.graph({fill:ge,strokeWidth:4,cornerRadius:0,fontFamily:ne,padding:22,shadow:he}),e.style.geom({shadow:R,overpaint:pe}),e.style.geom({shadow:R},{state:"hovered"}),e.style.geom.bar({...g,strokeWidth:2.5,cornerRadius:0}),e.style.geom.bar({...g,strokeWidth:2.5,shadow:ce},{state:"hovered"}),e.style.geom.line({strokeWidth:4,...H,shadow:v,overpaint:"none"}),e.style.geom.line({shadow:v},{state:"hovered"}),e.style.geom.area({...g,fillAlpha:1,strokeWidth:2.5,...H}),e.style.geom.point({...g,size:10,strokeWidth:2,shadow:v}),e.style.geom.point({...g,strokeWidth:3,shadow:"none"},{state:"hovered"}),e.style.geom.tile({...g,cornerRadius:2,strokeWidth:1.5,shadow:"none"}),e.style.geom.tile({...g,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({...O,textColor:s.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:o.black,strokeWidth:3,dashArray:[]}),e.style.tickLine({strokeWidth:0}),e.style.tickLabel({...S,fontSize:12,lineHeight:1}),e.style.axisLabel({...u,...O,fontSize:18,lineHeight:1}),e.style.heading({...u}),e.style.heading.h1({fontFamily:w,fontWeight:400,fontSize:36,lineHeight:1,letterSpacing:1,textTransform:"uppercase",textShadow:fe}),e.style.heading.h2({...S,fontSize:16,lineHeight:1.2}),e.style.header({margin:{bottom:18}}),e.style.caption({...S,fontWeight:400,fontSize:13}),e.style.source({...S,fontWeight:400,fontSize:13}),e.style.dataLabel({...u,fontSize:14,fill:"transparent"}),e.style.legendItem({...u,...O,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:D}),e.style.tooltip.heading({...u,fontSize:15,lineHeight:1.3}),e.style.tooltip.label({...S,fontSize:14,lineHeight:1.3}),e.style.tooltip.value({...u,fontSize:14,lineHeight:1.3}),e.style.legend.popover({strokeWidth:2.5,cornerRadius:10,shadow:D}),e.style.annotation.text({...ue,...M}),e.style.annotation.shape({fillAlpha:.35,stroke:o.black,strokeWidth:2}),e.style.annotation.arrow({strokeWidth:3.5,dashArray:[]}),e.style.annotation.arrow.outline({stroke:o.paper,strokeWidth:2}),e.style.annotation.pinnedNumber({stroke:o.black,shadow:v}),e.style.annotation.pinnedNumber.label({...E,...C}),e.style.annotation.comment({stroke:o.black,shadow:v}),e.style.annotation.comment.label({...E,...C}),e.style.annotation.differenceArrow({stroke:o.black,strokeWidth:2.5}),e.style.annotation.differenceArrow.label({...E,...C,fontSize:18}),e.style.panelBorder.bottom({strokeWidth:0},{coord:"polar"}),e.style.tickLabel({...u,textOutlineColor:o.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:4.5,shadow:"none"},{coord:"polar",state:"hovered"})]},me={name:"comic",styles:ye,palettes:{categorical:ie,sequential:se,diverging:de},colorScheme:"light",plugins:te};exports.comic=me;
package/dist/index.mjs CHANGED
@@ -1,287 +1,228 @@
1
- import { useMemo as H } from "react";
2
- import { buildDotsEditOutlineShapes as q, buildPolarBarArcPath as J, createStableKeyGenerator as F, defineGeomRenderer as D, getAngleExtent as Z, getRadiusExtent as N, getX as B, getY as M, getYMax as Q, polarToUnit as ee, style as t, toPaintColor as te, toViewBoxX as oe, toViewBoxY as re, useGeomStyleReader as z } from "@graphysdk/react";
3
- import { jsx as u, jsxs as Y } from "react/jsx-runtime";
4
- var ae = (e, o) => {
5
- const r = B(e), a = M(e) ?? Q(e);
6
- return r === null || a === null ? null : {
7
- x: oe(r) * o.width,
8
- y: re(a) * o.height
1
+ import { useMemo as U, useState as K } from "react";
2
+ import { DefaultGeomPath as F, buildDotsEditOutlineShapes as j, createStableKeyGenerator as V, defineGeomRenderer as q, getRadiusExtent as J, getX as B, getY as M, getYMax as Z, polarToUnit as Q, style as e, toPaintColor as ee, toViewBoxX as oe, toViewBoxY as te, useGeomStyleReader as Y } from "@graphysdk/react";
3
+ import { jsx as m, jsxs as L } from "react/jsx-runtime";
4
+ var re = (o, r) => {
5
+ const a = B(o), n = M(o) ?? Z(o);
6
+ return a === null || n === null ? null : {
7
+ x: oe(a) * r.width,
8
+ y: te(n) * r.height
9
9
  };
10
- }, ie = (e, o) => {
11
- const r = B(e), a = M(e) ?? N(e).outerRadius;
12
- if (r === null || a === null) return null;
13
- const n = ee(r, a), l = Math.min(o.width, o.height) / 2;
10
+ }, ae = (o, r) => {
11
+ const a = B(o), n = M(o) ?? J(o).outerRadius;
12
+ if (a === null || n === null) return null;
13
+ const i = Q(a, n), l = Math.min(r.width, r.height) / 2;
14
14
  return {
15
- x: o.width / 2 + n.x * l,
16
- y: o.height / 2 - n.y * l
15
+ x: r.width / 2 + i.x * l,
16
+ y: r.height / 2 - i.y * l
17
17
  };
18
- }, ne = 22, $ = Math.PI * 2, Ne = $ / (ne * 2), le = (e, o, r) => ({
19
- x: e.x + Math.sin(r.angle) * r.radius * o,
20
- y: e.y - Math.cos(r.angle) * r.radius * o
21
- }), C = 2, de = ({ x: e, y: o }) => `${e.toFixed(C)},${o.toFixed(C)}`, _ = 8, se = 0.6, ce = (e, o) => {
22
- const r = o / 2, a = $ / (_ * 2);
23
- return `M${Array.from({ length: _ * 2 }, (n, l) => le(e, r, {
24
- angle: l * a,
25
- radius: l % 2 === 0 ? 1 : se
26
- })).map(de).join(" L")} Z`;
27
- }, X = (e) => {
28
- const o = z(e);
29
- return (r, a) => {
30
- const n = o.get("shadow", r, a);
18
+ }, P = 8, ne = 0.6, ie = Math.PI * 2, I = 2, le = ({ x: o, y: r }) => `${o.toFixed(I)},${r.toFixed(I)}`, se = (o, r) => {
19
+ const a = ie / (P * 2);
20
+ return `M${Array.from({ length: P * 2 }, (n, i) => {
21
+ const l = (i % 2 === 0 ? 1 : ne) * (r / 2);
31
22
  return {
32
- color: te(o.get("fill", r, a)),
33
- opacity: o.get("alpha", r, a),
34
- fillOpacity: o.get("fillAlpha", r, a),
35
- outline: o.get("stroke", r, a),
36
- outlineWidth: o.get("strokeWidth", r, a),
37
- shadow: n === "none" ? null : {
38
- offsetX: n.offsetX,
39
- offsetY: n.offsetY,
40
- color: n.color
23
+ x: o.x + Math.sin(i * a) * l,
24
+ y: o.y - Math.cos(i * a) * l
25
+ };
26
+ }).map(le).join(" L")} Z`;
27
+ }, de = (o) => {
28
+ const r = Y(o);
29
+ return (a, n) => {
30
+ const i = r.get("shadow", a, n);
31
+ return {
32
+ color: ee(r.get("fill", a, n)),
33
+ opacity: r.get("alpha", a, n),
34
+ fillOpacity: r.get("fillAlpha", a, n),
35
+ outline: r.get("stroke", a, n),
36
+ outlineWidth: r.get("strokeWidth", a, n),
37
+ shadow: i === "none" ? null : {
38
+ offsetX: i.offsetX,
39
+ offsetY: i.offsetY,
40
+ color: i.color
41
41
  }
42
42
  };
43
43
  };
44
- }, G = 1.35, he = 4, ge = 1, R = ({ layer: e, observations: o, panel: r, project: a, state: n }) => {
45
- const l = z(e), h = X(e), g = H(() => F(e.data, e.mapping, e.id), [
46
- e.data,
47
- e.mapping,
48
- e.id
49
- ]), p = n === "hovered";
50
- return /* @__PURE__ */ u("g", {
44
+ }, ce = 1.35, he = `
45
+ @keyframes comic-pop { from { transform: scale(0); } to { transform: none; } }
46
+ .comic-pop { animation: comic-pop var(--comic-pop-duration) cubic-bezier(0.34, 1.56, 0.64, 1) var(--comic-pop-delay) both; }
47
+ `, X = (o) => o * ce, fe = (o, r, a) => {
48
+ const [n] = K(() => o?.type === "grow" && o.growAxis === "size" ? {
49
+ plan: o,
50
+ keys: new Set(Array.from(r, a))
51
+ } : null);
52
+ return n;
53
+ }, pe = (o, r, a) => ({
54
+ transformOrigin: `${o.x}px ${o.y}px`,
55
+ "--comic-pop-duration": `${r.durationSeconds}s`,
56
+ "--comic-pop-delay": `${r.delayByKey[a] ?? 0}s`
57
+ }), R = ({ layer: o, observations: r, panel: a, project: n, state: i, intro: l, animateTransitions: d = !1 }) => {
58
+ const h = Y(o), k = de(o), f = U(() => V(o.data, o.mapping, o.id), [
59
+ o.data,
60
+ o.mapping,
61
+ o.id
62
+ ]), u = fe(l, r, f);
63
+ return /* @__PURE__ */ L("g", {
51
64
  "data-geom": "point",
52
- children: Array.from(o, (m) => {
53
- const f = a(m, r);
54
- if (f === null) return null;
55
- const d = h(m, n), c = ce(f, l.get("size", m, n) * G + (p ? he : 0));
56
- return /* @__PURE__ */ Y("g", {
57
- opacity: d.opacity,
58
- children: [d.shadow !== null && /* @__PURE__ */ u("path", {
59
- d: c,
60
- transform: `translate(${d.shadow.offsetX} ${d.shadow.offsetY})`,
61
- fill: d.shadow.color
62
- }), /* @__PURE__ */ u("path", {
63
- d: c,
64
- fill: d.color,
65
- fillOpacity: d.fillOpacity,
66
- stroke: d.outline,
67
- strokeWidth: d.outlineWidth + (p ? ge : 0),
68
- strokeLinejoin: "round"
65
+ children: [u !== null && /* @__PURE__ */ m("style", { children: he }), Array.from(r, (y) => {
66
+ const A = n(y, a);
67
+ if (A === null) return null;
68
+ const T = f(y), c = k(y, i), O = se(A, X(h.get("size", y, i))), _ = u !== null && u.keys.has(T);
69
+ return /* @__PURE__ */ L("g", {
70
+ opacity: c.opacity,
71
+ strokeLinejoin: "round",
72
+ className: _ ? "comic-pop" : void 0,
73
+ style: _ ? pe(A, u.plan, T) : void 0,
74
+ children: [c.shadow !== null && /* @__PURE__ */ m("g", {
75
+ transform: `translate(${c.shadow.offsetX} ${c.shadow.offsetY})`,
76
+ children: /* @__PURE__ */ m(F, {
77
+ d: O,
78
+ source: o,
79
+ fill: c.shadow.color,
80
+ animateTransitions: d
81
+ })
82
+ }), /* @__PURE__ */ m(F, {
83
+ d: O,
84
+ source: o,
85
+ fill: c.color,
86
+ fillOpacity: c.fillOpacity,
87
+ stroke: c.outline,
88
+ strokeWidth: c.outlineWidth,
89
+ animateTransitions: d
69
90
  })]
70
- }, g(m));
71
- })
91
+ }, T);
92
+ })]
72
93
  });
73
- }, U = (e, o) => D("point", {
74
- coord: e,
94
+ }, $ = (o, r) => q("point", {
95
+ coord: o,
75
96
  swatchShape: "circle",
76
- render: ({ layer: r, panelRect: a }) => /* @__PURE__ */ u(R, {
77
- layer: r,
78
- observations: r.data,
79
- panel: a,
80
- project: o
81
- }),
82
- renderHover: ({ layer: r, primary: a, panelRect: n }) => /* @__PURE__ */ u(R, {
83
- layer: r,
84
- observations: [a.observation],
97
+ render: ({ layer: a, panelRect: n, intro: i, animateTransitions: l }) => /* @__PURE__ */ m(R, {
98
+ layer: a,
99
+ observations: a.data,
85
100
  panel: n,
86
- project: o,
87
- state: "hovered"
88
- }),
89
- renderHoverCompanions: () => null,
90
- getEditOutlineShapes: ({ layer: r, panelRect: a, styleReaders: n }) => q(Array.from(r.data, (l) => {
91
- const h = o(l, a), g = n.get("size", l);
92
- if (h === null || g === void 0) return [];
93
- const p = n.get("strokeWidth", l) ?? 0;
94
- return [{
95
- center: h,
96
- size: g * G + p
97
- }];
98
- }).flat())
99
- }), fe = U("cartesian", ae), ue = U("polar", ie), pe = 2, me = 2, j = (e) => {
100
- const { startAngle: o, endAngle: r } = Z(e), { innerRadius: a, outerRadius: n } = N(e);
101
- return o === null || r === null || a === null || n === null || r <= o || n <= 0 ? null : {
102
- startAngle: o,
103
- endAngle: r,
104
- innerRadius: a,
105
- outerRadius: n
106
- };
107
- }, ve = (e, o, r) => [...e].flatMap((a) => {
108
- const n = j(a);
109
- return n === null ? [] : [{
110
- key: `${r(a)}-${n.startAngle}`,
111
- paint: o(a),
112
- ...n
113
- }];
114
- }), K = (e, o, r) => J(e, {
115
- centerX: o.x,
116
- centerY: o.y,
117
- radius: r,
118
- digits: me
119
- }), x = ({ layer: e, observations: o, panel: r, state: a }) => {
120
- const n = X(e), l = H(() => F(e.data, e.mapping, e.id), [
121
- e.data,
122
- e.mapping,
123
- e.id
124
- ]), h = Math.min(r.width, r.height) / 2;
125
- if (h <= 0) return null;
126
- const g = {
127
- x: r.width / 2,
128
- y: r.height / 2
129
- }, p = ve(o, (f) => n(f, a), l).flatMap((f) => {
130
- const d = K(f, g, h);
131
- return d === void 0 ? [] : [{
132
- key: f.key,
133
- path: d,
134
- paint: f.paint
135
- }];
136
- }), m = a === "hovered";
137
- return /* @__PURE__ */ Y("g", {
138
- "data-geom": "bar",
139
- children: [!m && p.map(({ key: f, path: d, paint: c }) => c.shadow === null ? null : /* @__PURE__ */ u("path", {
140
- d,
141
- transform: `translate(${c.shadow.offsetX} ${c.shadow.offsetY})`,
142
- fill: c.shadow.color,
143
- opacity: c.opacity
144
- }, `${f}-shadow`)), p.map(({ key: f, path: d, paint: c }) => /* @__PURE__ */ u("path", {
145
- "data-comic-slice": "sector",
146
- d,
147
- fill: c.color,
148
- fillOpacity: c.fillOpacity,
149
- fillRule: "evenodd",
150
- stroke: c.outline,
151
- strokeWidth: c.outlineWidth + (m ? pe : 0),
152
- strokeLinejoin: "round",
153
- opacity: c.opacity
154
- }, f))]
155
- });
156
- }, ke = D("bar", {
157
- coord: "polar",
158
- guideMode: "band",
159
- swatchShape: "slice",
160
- render: ({ layer: e, panelRect: o }) => /* @__PURE__ */ u(x, {
161
- layer: e,
162
- observations: e.data,
163
- panel: o
101
+ project: r,
102
+ intro: i,
103
+ animateTransitions: l
164
104
  }),
165
- renderHover: ({ layer: e, primary: o, panelRect: r }) => /* @__PURE__ */ u(x, {
166
- layer: e,
167
- observations: [o.observation],
168
- panel: r,
105
+ renderHover: ({ layer: a, primary: n, panelRect: i }) => /* @__PURE__ */ m(R, {
106
+ layer: a,
107
+ observations: [n.observation],
108
+ panel: i,
109
+ project: r,
169
110
  state: "hovered"
170
111
  }),
171
112
  renderHoverCompanions: () => null,
172
- getEditOutlineShapes: ({ layer: e, panelRect: o, animateTransitions: r }) => {
173
- const a = Math.min(o.width, o.height) / 2, n = {
174
- x: o.width / 2,
175
- y: o.height / 2
176
- }, l = Array.from(e.data, (h) => {
177
- const g = j(h);
178
- return g === null ? "" : K(g, n, a) ?? "";
179
- }).join("");
180
- return l === "" ? [] : [{
181
- kind: "region",
182
- pathData: l,
183
- animateTransitions: r
113
+ getEditOutlineShapes: ({ layer: a, panelRect: n, styleReaders: i }) => j([...a.data].flatMap((l) => {
114
+ const d = r(l, n), h = i.get("size", l);
115
+ if (d === null || h === void 0) return [];
116
+ const k = i.get("shadow", l), f = k === "none" ? {
117
+ x: 0,
118
+ y: 0
119
+ } : {
120
+ x: k.offsetX,
121
+ y: k.offsetY
122
+ }, u = X(h) + (i.get("strokeWidth", l) ?? 0);
123
+ return [{
124
+ center: {
125
+ x: d.x + f.x / 2,
126
+ y: d.y + f.y / 2
127
+ },
128
+ size: u + Math.hypot(f.x, f.y)
184
129
  }];
185
- }
186
- }), Se = [
187
- ke,
188
- fe,
189
- ue
190
- ], S = 10, be = 0.42, P = 220, we = 0.6, A = 1, Te = () => {
191
- const e = Math.ceil(P / S), o = [];
192
- for (let r = 0; r <= e; r += 1) {
193
- const a = r % 2 === 0 ? 0 : S / 2;
194
- for (let n = 0; n <= 23; n += 1) {
195
- const l = -(n * S + a), h = r * S, g = S * be * (1 - Math.hypot(l, h) / P);
196
- g >= we && o.push(`<circle cx="${l.toFixed(A)}" cy="${h.toFixed(A)}" r="${g.toFixed(A)}"/>`);
130
+ }))
131
+ }), ge = $("cartesian", re), ue = $("polar", ae), me = [ge, ue], v = 10, ke = 0.42, D = 220, ve = 0.6, x = 1, Se = () => {
132
+ const o = Math.ceil(D / v), r = [];
133
+ for (let a = 0; a <= o; a += 1) {
134
+ const n = a % 2 === 0 ? 0 : v / 2;
135
+ for (let i = 0; i <= 23; i += 1) {
136
+ const l = -(i * v + n), d = -a * v, h = v * ke * (1 - Math.hypot(l, d) / D);
137
+ h >= ve && r.push(`<circle cx="${l.toFixed(x)}" cy="${d.toFixed(x)}" r="${h.toFixed(x)}"/>`);
197
138
  }
198
139
  }
199
- return o.join("");
200
- }, Ae = (e, o, r) => {
201
- const a = `<svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%"><rect width="100%" height="100%" fill="${e}"/><svg x="100%" y="0" width="1" height="1" overflow="visible"><g fill="${o}" fill-opacity="${r}">${Te()}</g></svg></svg>`;
202
- return `data:image/svg+xml,${encodeURIComponent(a)}`;
203
- }, i = {
140
+ return r.join("");
141
+ }, be = (o, r, a) => {
142
+ const n = `<svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%"><rect width="100%" height="100%" fill="${o}"/><svg x="100%" y="100%" width="1" height="1" overflow="visible"><g fill="${r}" fill-opacity="${a}">${Se()}</g></svg></svg>`;
143
+ return `data:image/svg+xml,${encodeURIComponent(n)}`;
144
+ }, t = {
204
145
  paper: "#FBF3DF",
205
146
  bubble: "#FFFDF6",
206
147
  black: "#141414",
207
148
  secondary: "#4A4338",
208
149
  grid: "rgba(20, 20, 20, 0.2)",
209
150
  deepRed: "#C4161C"
210
- }, T = "'Bangers', 'Comic Neue', 'Comic Sans MS', cursive", Oe = "'Comic Neue', 'Comic Sans MS', 'Chalkboard SE', cursive", s = {
151
+ }, w = "'Bangers', 'Comic Neue', 'Comic Sans MS', cursive", ye = "'Comic Neue', 'Comic Sans MS', 'Chalkboard SE', cursive", s = {
211
152
  vermillion: "#D9401F",
212
153
  cyan: "#0B85C8",
213
154
  yellow: "#FFD60A",
214
155
  magenta: "#D6247A",
215
156
  green: "#15964B",
216
157
  purple: "#7A3DC8"
217
- }, Ee = [
158
+ }, we = [
218
159
  s.vermillion,
219
160
  s.cyan,
220
161
  s.yellow,
221
162
  s.magenta,
222
163
  s.green,
223
164
  s.purple
224
- ], ye = [
165
+ ], Ae = [
225
166
  "#FFE45C",
226
167
  "#F58A1F",
227
168
  "#C4161C"
228
- ], We = [
169
+ ], Te = [
229
170
  s.cyan,
230
171
  "#ECE5D4",
231
172
  s.vermillion
232
- ], O = {
173
+ ], H = {
233
174
  offsetX: 4,
234
175
  offsetY: 4,
235
176
  blur: 0,
236
- color: i.black
237
- }, Ce = {
177
+ color: t.black
178
+ }, xe = {
238
179
  offsetX: 6,
239
180
  offsetY: 6,
240
181
  blur: 0,
241
- color: i.black
242
- }, b = {
182
+ color: t.black
183
+ }, S = {
243
184
  offsetX: 2,
244
185
  offsetY: 2,
245
186
  blur: 0,
246
- color: i.black
247
- }, I = {
187
+ color: t.black
188
+ }, N = {
248
189
  offsetX: 4,
249
190
  offsetY: 4,
250
191
  blur: 0,
251
- color: i.black
252
- }, _e = {
192
+ color: t.black
193
+ }, Ee = {
253
194
  offsetX: 6,
254
195
  offsetY: 6,
255
196
  blur: 0,
256
- color: i.black
257
- }, Re = {
197
+ color: t.black
198
+ }, Ce = {
258
199
  offsetX: 2,
259
200
  offsetY: 2,
260
201
  blur: 0,
261
202
  color: s.yellow
262
- }, xe = {
203
+ }, We = {
263
204
  pattern: "dots",
264
205
  color: "rgba(20, 20, 20, 0.24)",
265
206
  size: 7
266
- }, Pe = {
267
- image: Ae(i.paper, s.vermillion, 0.18),
207
+ }, Oe = {
208
+ image: be(t.paper, s.vermillion, 0.18),
268
209
  fit: "stretch",
269
- fallback: i.paper
270
- }, Ie = {
271
- fontFamily: T,
210
+ fallback: t.paper
211
+ }, _e = {
212
+ fontFamily: w,
272
213
  fontWeight: 400,
273
- fontSize: 22,
214
+ fontSize: 16,
274
215
  lineHeight: 1.05,
275
- letterSpacing: 1.5,
216
+ letterSpacing: 1,
276
217
  textTransform: "uppercase",
277
- textColor: i.black
278
- }, V = {
218
+ textColor: t.black
219
+ }, G = {
279
220
  fill: s.yellow,
280
- stroke: i.black,
221
+ stroke: t.black,
281
222
  strokeWidth: 3,
282
223
  cornerRadius: 0,
283
- paddingInline: 10,
284
- paddingBlock: 5,
224
+ paddingInline: 7,
225
+ paddingBlock: 4,
285
226
  shadow: {
286
227
  offsetX: 5,
287
228
  offsetY: 5,
@@ -289,15 +230,15 @@ var ae = (e, o) => {
289
230
  color: s.vermillion
290
231
  }
291
232
  }, E = {
292
- fontFamily: T,
233
+ fontFamily: w,
293
234
  fontWeight: 400,
294
235
  fontSize: 16,
295
236
  lineHeight: 1.05,
296
237
  letterSpacing: 1,
297
238
  textTransform: "uppercase",
298
- textColor: i.black
299
- }, y = {
300
- ...V,
239
+ textColor: t.black
240
+ }, C = {
241
+ ...G,
301
242
  strokeWidth: 2.5,
302
243
  paddingInline: 7,
303
244
  paddingBlock: 3,
@@ -308,282 +249,282 @@ var ae = (e, o) => {
308
249
  color: s.vermillion
309
250
  }
310
251
  }, W = {
311
- fontFamily: T,
252
+ fontFamily: w,
312
253
  fontWeight: 400,
313
254
  letterSpacing: 1,
314
255
  textTransform: "uppercase"
315
- }, v = {
316
- stroke: i.black,
256
+ }, p = {
257
+ stroke: t.black,
317
258
  strokeAlpha: 1
318
- }, L = {
259
+ }, z = {
319
260
  dashArray: [],
320
261
  lineCap: "round",
321
262
  lineJoin: "round"
322
- }, k = {
323
- textColor: i.black,
263
+ }, g = {
264
+ textColor: t.black,
324
265
  fontWeight: 700
325
- }, w = {
326
- textColor: i.secondary,
266
+ }, b = {
267
+ textColor: t.secondary,
327
268
  fontWeight: 700
328
- }, Le = {
269
+ }, Fe = {
329
270
  tokens: {
330
- graphBackground: i.paper,
331
- graphBorder: i.black,
332
- geomBorder: i.black,
333
- textPrimary: i.black,
334
- textSecondary: i.secondary,
335
- ruleLine: i.black,
336
- gridLine: i.grid,
337
- hoverAffordance: i.black,
271
+ graphBackground: t.paper,
272
+ graphBorder: t.black,
273
+ geomBorder: t.black,
274
+ textPrimary: t.black,
275
+ textSecondary: t.secondary,
276
+ ruleLine: t.black,
277
+ gridLine: t.grid,
278
+ hoverAffordance: t.black,
338
279
  hoverGuideFill: "rgba(20, 20, 20, 0.07)",
339
- hoverGuideLine: i.black,
340
- tooltipBackground: i.bubble,
341
- tooltipBorder: i.black,
280
+ hoverGuideLine: t.black,
281
+ legendFocus: t.black,
282
+ tooltipBackground: t.bubble,
283
+ tooltipBorder: t.black,
342
284
  tooltipPrimaryRow: "rgba(255, 214, 10, 0.35)",
343
285
  annotationShape: s.yellow,
344
- annotationArrow: i.black,
345
- differenceLabelBackground: i.bubble,
286
+ annotationArrow: t.black,
287
+ differenceLabelBackground: t.bubble,
346
288
  trendPositive: s.green,
347
- trendNegative: i.deepRed,
348
- trendNeutral: i.secondary
289
+ trendNegative: t.deepRed,
290
+ trendNeutral: t.secondary
349
291
  },
350
292
  defaults: [
351
- t.graph({
352
- fill: Pe,
293
+ e.graph({
294
+ fill: Oe,
353
295
  strokeWidth: 4,
354
296
  cornerRadius: 0,
355
- fontFamily: Oe,
297
+ fontFamily: ye,
356
298
  padding: 22,
357
- shadow: _e
299
+ shadow: Ee
358
300
  }),
359
- t.geom({
360
- shadow: O,
361
- overpaint: xe
301
+ e.geom({
302
+ shadow: H,
303
+ overpaint: We
362
304
  }),
363
- t.geom({ shadow: O }, { state: "hovered" }),
364
- t.geom.bar({
365
- ...v,
305
+ e.geom({ shadow: H }, { state: "hovered" }),
306
+ e.geom.bar({
307
+ ...p,
366
308
  strokeWidth: 2.5,
367
309
  cornerRadius: 0
368
310
  }),
369
- t.geom.bar({
370
- ...v,
311
+ e.geom.bar({
312
+ ...p,
371
313
  strokeWidth: 2.5,
372
- shadow: Ce
314
+ shadow: xe
373
315
  }, { state: "hovered" }),
374
- t.geom.line({
375
- strokeWidth: 3.5,
376
- ...L,
377
- shadow: b,
316
+ e.geom.line({
317
+ strokeWidth: 4,
318
+ ...z,
319
+ shadow: S,
378
320
  overpaint: "none"
379
321
  }),
380
- t.geom.line({ shadow: b }, { state: "hovered" }),
381
- t.geom.area({
382
- ...v,
322
+ e.geom.line({ shadow: S }, { state: "hovered" }),
323
+ e.geom.area({
324
+ ...p,
383
325
  fillAlpha: 1,
384
326
  strokeWidth: 2.5,
385
- ...L
327
+ ...z
386
328
  }),
387
- t.geom.point({
388
- ...v,
389
- size: 13,
329
+ e.geom.point({
330
+ ...p,
331
+ size: 10,
390
332
  strokeWidth: 2,
391
- shadow: b
333
+ shadow: S
392
334
  }),
393
- t.geom.point({
394
- ...v,
395
- strokeWidth: 2,
335
+ e.geom.point({
336
+ ...p,
337
+ strokeWidth: 3,
396
338
  shadow: "none"
397
339
  }, { state: "hovered" }),
398
- t.geom.tile({
399
- ...v,
340
+ e.geom.tile({
341
+ ...p,
400
342
  cornerRadius: 2,
401
343
  strokeWidth: 1.5,
402
344
  shadow: "none"
403
345
  }),
404
- t.geom.tile({
405
- ...v,
346
+ e.geom.tile({
347
+ ...p,
406
348
  strokeWidth: 3,
407
349
  shadow: "none"
408
350
  }, { state: "hovered" }),
409
- t.geom.rule({
351
+ e.geom.rule({
410
352
  strokeWidth: 2.5,
411
353
  dashArray: [3, 3],
412
354
  lineCap: "round",
413
355
  shadow: "none"
414
356
  }),
415
- t.geom.rule.label({
357
+ e.geom.rule.label({
416
358
  ...W,
417
359
  textColor: s.yellow,
418
360
  fontSize: 15
419
361
  }),
420
- t.gridLine({ dashArray: [1, 5] }),
421
- t.gridLine.x({ strokeWidth: 0 }),
422
- t.gridLine.y({ strokeWidth: 1.5 }),
423
- t.panelBorder({ strokeWidth: 0 }),
424
- t.panelBorder.bottom({
425
- stroke: i.black,
362
+ e.gridLine({ dashArray: [1, 5] }),
363
+ e.gridLine.x({ strokeWidth: 0 }),
364
+ e.gridLine.y({ strokeWidth: 1.5 }),
365
+ e.panelBorder({ strokeWidth: 0 }),
366
+ e.panelBorder.bottom({
367
+ stroke: t.black,
426
368
  strokeWidth: 3,
427
369
  dashArray: []
428
370
  }),
429
- t.tickLine({ strokeWidth: 0 }),
430
- t.tickLabel({
431
- ...w,
432
- fontSize: 14,
371
+ e.tickLine({ strokeWidth: 0 }),
372
+ e.tickLabel({
373
+ ...b,
374
+ fontSize: 12,
433
375
  lineHeight: 1
434
376
  }),
435
- t.axisLabel({
436
- ...k,
377
+ e.axisLabel({
378
+ ...g,
437
379
  ...W,
438
380
  fontSize: 18,
439
381
  lineHeight: 1
440
382
  }),
441
- t.heading({ ...k }),
442
- t.heading.h1({
443
- fontFamily: T,
383
+ e.heading({ ...g }),
384
+ e.heading.h1({
385
+ fontFamily: w,
444
386
  fontWeight: 400,
445
387
  fontSize: 36,
446
388
  lineHeight: 1,
447
389
  letterSpacing: 1,
448
390
  textTransform: "uppercase",
449
- textShadow: Re
391
+ textShadow: Ce
450
392
  }),
451
- t.heading.h2({
452
- ...w,
393
+ e.heading.h2({
394
+ ...b,
453
395
  fontSize: 16,
454
396
  lineHeight: 1.2
455
397
  }),
456
- t.header({ margin: { bottom: 18 } }),
457
- t.caption({
458
- ...w,
398
+ e.header({ margin: { bottom: 18 } }),
399
+ e.caption({
400
+ ...b,
459
401
  fontWeight: 400,
460
402
  fontSize: 13
461
403
  }),
462
- t.source({
463
- ...w,
404
+ e.source({
405
+ ...b,
464
406
  fontWeight: 400,
465
407
  fontSize: 13
466
408
  }),
467
- t.dataLabel({
468
- ...k,
409
+ e.dataLabel({
410
+ ...g,
469
411
  fontSize: 14,
470
412
  fill: "transparent"
471
413
  }),
472
- t.legendItem({
473
- ...k,
414
+ e.legendItem({
415
+ ...g,
474
416
  ...W,
475
417
  fontSize: 18,
476
418
  fill: "transparent",
477
419
  stroke: "transparent"
478
420
  }),
479
- t.legendItem.swatch({ size: 16 }),
480
- t.directLabel({
421
+ e.legendItem.swatch({ size: 16 }),
422
+ e.directLabel({
481
423
  fontWeight: 700,
482
424
  fontSize: 14
483
425
  }),
484
- t.tooltip({
426
+ e.tooltip({
485
427
  strokeWidth: 2.5,
486
428
  cornerRadius: 10,
487
429
  paddingInline: 12,
488
430
  paddingBlock: 9,
489
- shadow: I
431
+ shadow: N
490
432
  }),
491
- t.tooltip.heading({
492
- ...k,
433
+ e.tooltip.heading({
434
+ ...g,
493
435
  fontSize: 15,
494
436
  lineHeight: 1.3
495
437
  }),
496
- t.tooltip.label({
497
- ...w,
438
+ e.tooltip.label({
439
+ ...b,
498
440
  fontSize: 14,
499
441
  lineHeight: 1.3
500
442
  }),
501
- t.tooltip.value({
502
- ...k,
443
+ e.tooltip.value({
444
+ ...g,
503
445
  fontSize: 14,
504
446
  lineHeight: 1.3
505
447
  }),
506
- t.legend.popover({
448
+ e.legend.popover({
507
449
  strokeWidth: 2.5,
508
450
  cornerRadius: 10,
509
- shadow: I
451
+ shadow: N
510
452
  }),
511
- t.annotation.text({
512
- ...Ie,
513
- ...V
453
+ e.annotation.text({
454
+ ..._e,
455
+ ...G
514
456
  }),
515
- t.annotation.shape({
457
+ e.annotation.shape({
516
458
  fillAlpha: 0.35,
517
- stroke: i.black,
459
+ stroke: t.black,
518
460
  strokeWidth: 2
519
461
  }),
520
- t.annotation.arrow({
462
+ e.annotation.arrow({
521
463
  strokeWidth: 3.5,
522
464
  dashArray: []
523
465
  }),
524
- t.annotation.arrow.outline({
525
- stroke: i.paper,
466
+ e.annotation.arrow.outline({
467
+ stroke: t.paper,
526
468
  strokeWidth: 2
527
469
  }),
528
- t.annotation.pinnedNumber({
529
- stroke: i.black,
530
- shadow: b
470
+ e.annotation.pinnedNumber({
471
+ stroke: t.black,
472
+ shadow: S
531
473
  }),
532
- t.annotation.pinnedNumber.label({
474
+ e.annotation.pinnedNumber.label({
533
475
  ...E,
534
- ...y
476
+ ...C
535
477
  }),
536
- t.annotation.comment({
537
- stroke: i.black,
538
- shadow: b
478
+ e.annotation.comment({
479
+ stroke: t.black,
480
+ shadow: S
539
481
  }),
540
- t.annotation.comment.label({
482
+ e.annotation.comment.label({
541
483
  ...E,
542
- ...y
484
+ ...C
543
485
  }),
544
- t.annotation.differenceArrow({
545
- stroke: i.black,
486
+ e.annotation.differenceArrow({
487
+ stroke: t.black,
546
488
  strokeWidth: 2.5
547
489
  }),
548
- t.annotation.differenceArrow.label({
490
+ e.annotation.differenceArrow.label({
549
491
  ...E,
550
- ...y,
492
+ ...C,
551
493
  fontSize: 18
552
494
  }),
553
- t.panelBorder.bottom({ strokeWidth: 0 }, { coord: "polar" }),
554
- t.tickLabel({
555
- ...k,
556
- textOutlineColor: i.paper,
495
+ e.panelBorder.bottom({ strokeWidth: 0 }, { coord: "polar" }),
496
+ e.tickLabel({
497
+ ...g,
498
+ textOutlineColor: t.paper,
557
499
  textOutlineWidth: 3.5
558
500
  }, { coord: "polar" }),
559
- t.geom.area({
501
+ e.geom.area({
560
502
  fillAlpha: 0.5,
561
503
  shadow: "none"
562
504
  }, { coord: "polar" }),
563
- t.geom.area({ shadow: "none" }, {
505
+ e.geom.area({ shadow: "none" }, {
564
506
  coord: "polar",
565
507
  state: "hovered"
566
508
  }),
567
- t.geom.bar({
568
- strokeWidth: 2.5,
569
- shadow: O
570
- }, { coord: "polar" }),
571
- t.geom.bar({ strokeWidth: 2.5 }, {
509
+ e.geom.bar({
510
+ strokeWidth: 4.5,
511
+ shadow: "none"
512
+ }, {
572
513
  coord: "polar",
573
514
  state: "hovered"
574
515
  })
575
516
  ]
576
- }, Be = {
517
+ }, Re = {
577
518
  name: "comic",
578
- styles: Le,
519
+ styles: Fe,
579
520
  palettes: {
580
- categorical: Ee,
581
- sequential: ye,
582
- diverging: We
521
+ categorical: we,
522
+ sequential: Ae,
523
+ diverging: Te
583
524
  },
584
525
  colorScheme: "light",
585
- plugins: Se
526
+ plugins: me
586
527
  };
587
528
  export {
588
- Be as comic
529
+ Re as comic
589
530
  };
@@ -1,24 +1,3 @@
1
1
  import { XYPoint } from '@graphysdk/react';
2
- /** A point of the burst's edge in polar terms: the angle clockwise from twelve o'clock, and the radius as a share of the circle's. */
3
- export interface BurstCorner {
4
- angle: number;
5
- radius: number;
6
- }
7
- /**
8
- * The burst's edge from `startAngle` to `endAngle`, clockwise: where it crosses the two angles, and
9
- * every corner between. A slice of a pie drawn as a burst is its sector cut to this edge, so the
10
- * slices of one pie tile the burst exactly, and each keeps its angle. Since the edge repeats every
11
- * two spikes, a slice's share of the burst's area is its share of the turn to within one spike.
12
- */
13
- export declare const traceBurstEdge: (startAngle: number, endAngle: number) => BurstCorner[];
14
- /** A polar point in the panel's pixels, about `centre`, for a circle of `radius` pixels. */
15
- export declare const toPanelPoint: (centre: XYPoint, radius: number, corner: BurstCorner) => XYPoint;
16
- /**
17
- * One slice of a pie or a donut as a burst, in the panel's pixels: its sector, from `startAngle` to
18
- * `endAngle`, cut to the burst's jagged edge outside and to the hole's circle inside. `radius` is the
19
- * burst's in pixels, and `holeRadius` the hole's, 0 for a pie. A slice that is the whole turn is the
20
- * whole burst, its hole cut out against the turn.
21
- */
22
- export declare const buildBurstSlice: (centre: XYPoint, radius: number, holeRadius: number, startAngle: number, endAngle: number) => string;
23
2
  /** A point as a little burst of `size` pixels across, centred exactly on `centre`, with a tip at twelve o'clock. */
24
3
  export declare const buildPointBurst: (centre: XYPoint, size: number) => string;
@@ -15,4 +15,4 @@ export interface ShapePaint {
15
15
  shadow: PrintedShadow | null;
16
16
  }
17
17
  export type ReadShapePaint = (observation: Observation, state?: StyleState) => ShapePaint;
18
- export declare const useShapePaint: (layer: SceneLayerFor<"bar" | "point">) => ReadShapePaint;
18
+ export declare const useShapePaint: (layer: SceneLayerFor<"point">) => ReadShapePaint;
@@ -1,7 +1,7 @@
1
1
  import { ResolvedGeomRenderer } from '@graphysdk/react';
2
2
  /**
3
- * The built-in geoms the theme redraws as bursts: pies, donuts and points. Bars, lines, areas and
4
- * tiles are drawn by the built-in renderers, which the stylesheet already inks as a comic prints them.
3
+ * The built-in geoms the theme redraws: points, as bursts. Bars, pies, lines, areas and tiles are
4
+ * drawn by the built-in renderers, which the stylesheet already inks as a comic prints them.
5
5
  * Positions, scales and axes come from the compiled layer unchanged, and colour, outline and shadow
6
6
  * come from the stylesheet.
7
7
  */
@@ -1,7 +1,8 @@
1
1
  import { ResolvedGeomRenderer } from '@graphysdk/react';
2
2
  /**
3
3
  * Scatter and bubble: each point a little burst in its group's colour, as a comic marks a hit, with
4
- * its centre exactly on the reading, outlined in black over a hard shadow. The hovered burst grows.
4
+ * its centre exactly on the reading, outlined in black over a hard shadow. The hovered burst is outlined more heavily.
5
+ * Bursts pop out of their readings in the intro, and move and resize as the built-in points do.
5
6
  */
6
7
  export declare const comicPoint: ResolvedGeomRenderer;
7
8
  /** A radar's vertices as the same bursts. */
package/package.json CHANGED
@@ -13,7 +13,7 @@
13
13
  "theme",
14
14
  "comic"
15
15
  ],
16
- "version": "0.1.1-beta.1792518514317",
16
+ "version": "0.1.1-beta.1792575115573",
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.1792518514317"
43
+ "@graphysdk/react": "^1.9.0-beta.1792575115573"
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
- "@graphytools/typescript-config": "0.0.1",
56
- "@graphytools/vitest-config": "1.0.0",
57
- "@graphysdk/viz-engine": "1.9.0-beta.1792518514317",
55
+ "@graphysdk/react": "1.9.0-beta.1792575115573",
56
+ "@graphysdk/viz-engine": "1.9.0-beta.1792575115573",
58
57
  "@graphytools/eslint-config": "0.0.1",
59
- "@graphysdk/react": "1.9.0-beta.1792518514317"
58
+ "@graphytools/typescript-config": "0.0.1",
59
+ "@graphytools/vitest-config": "1.0.0"
60
60
  },
61
61
  "publishConfig": {
62
62
  "access": "public"
@@ -1,6 +0,0 @@
1
- import { ResolvedGeomRenderer } from '@graphysdk/react';
2
- /**
3
- * Pie, donut, rose and radial bar as plain sectors, each outlined in black over the one hard shadow of
4
- * the whole shape, so every slice's size is exactly its share. The hovered slice is outlined more heavily.
5
- */
6
- export declare const comicSlice: ResolvedGeomRenderer;