@graphysdk/react-renderer 1.9.0-beta.1792505847409 → 1.9.0-beta.1792510459918

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"});require('./index.css');const o=require("./history-chords-D9BmYary.cjs");let h=require("@graphysdk/viz-engine"),d=require("react"),i=require("react/jsx-runtime"),F=require("zustand"),O=require("motion/react"),Y=require("zustand/vanilla"),U=require("clsx");U=o.__toESM(U,1);var he="_1a5iqpb0",ge="_1a5iqpb1";var pe="_1a5iqpb3",ve="_1a5iqpb4",fe="_1a5iqpb5";var z=({errors:e})=>{const[t,...r]=e;return(0,i.jsxs)("div",{role:"alert",className:he,children:[(0,i.jsx)("strong",{className:ge,children:"This chart could not be rendered."}),t&&(0,i.jsx)(V,{diagnostic:t}),r.length>0&&(0,i.jsx)("ul",{className:"_1a5iqpb2",children:r.map((n,s)=>(0,i.jsx)("li",{children:(0,i.jsx)(V,{diagnostic:n})},`${n.code}-${s}`))})]})},V=({diagnostic:e})=>(0,i.jsxs)("div",{className:pe,children:[(0,i.jsx)("span",{className:ve,children:e.code}),(0,i.jsx)("p",{className:fe,children:e.message}),e.suggestion&&(0,i.jsx)("p",{className:"_1a5iqpb6",children:e.suggestion})]});function Se(e=[],t=[]){return e.length===t.length&&e.every((r,n)=>Object.is(r,t[n]))}var re=class extends d.Component{constructor(...e){super(...e),this.state={caughtDiagnostic:null}}static getDerivedStateFromError(e){return{caughtDiagnostic:(0,h.buildDiagnostic)(e)}}componentDidCatch(e,t){const r=(0,h.buildDiagnostic)(e);o.logDiagnostics([r]),this.props.onError?.([r]),console.error("Chart render component stack:",t.componentStack)}componentDidUpdate(e){this.state.caughtDiagnostic&&!Se(e.resetKeys,this.props.resetKeys)&&this.setState({caughtDiagnostic:null})}render(){const{caughtDiagnostic:e}=this.state;if(e)return(0,i.jsx)(z,{errors:[e]});const{forcedErrors:t,children:r}=this.props;return t&&t.length>0?(0,i.jsx)(z,{errors:t}):r}},ne=e=>typeof e=="object"&&"geom"in e&&"render"in e,se=e=>{const t=(0,h.resolveDefinition)(e);return t instanceof h.Geom?t:null},oe=(e,t)=>{const r=e.filter(n=>ye(n,t));return r.length===e.length?e:r},ye=(e,t)=>e.kind==="annotation"?(0,h.findAnnotation)(t.annotations,e.id)!==null:e.kind==="observations"||e.kind==="layer"&&e.layerId!==void 0?(0,h.findLayerById)(t.layers,e.layerId)!==void 0:!0,X=[],be=()=>(0,Y.createStore)(e=>({selection:X,setSelection:t=>e(r=>Ge(r.selection,t)?r:{selection:t}),clearSelection:()=>e(t=>t.selection.length===0?t:{selection:X})})),Ge=(e,t)=>e===t?!0:e.length!==t.length?!1:e.every((r,n)=>{const s=t[n];return s!==void 0&&(0,h.areEditTargetsEqual)(r,s)}),xe=process.env.NODE_ENV!=="production",Ee=5,Te=e=>{if(!xe)return{emit:()=>{},subscribe:()=>Pe,getLastTrigger:()=>null,getLastCompile:()=>null,getCacheStats:()=>e.getCacheStats()};const t=new Set;let r=null;return{emit:n=>{const s=e.getLastCompile();if(s){r=n;for(const c of t)c(n,s)}},subscribe:n=>(t.add(n),()=>{t.delete(n)}),getLastTrigger:()=>r,getLastCompile:()=>e.getLastCompile(),getCacheStats:()=>e.getCacheStats()}},Re=()=>(0,Y.createStore)(e=>({lastCompile:null,history:[],nextId:1,lastSnapshot:null,recordCompile:(t,r)=>e(n=>{if(n.lastSnapshot===r)return n;const s={id:n.nextId,label:Ce(t),stages:r.stages,stageDurationsMs:r.stageDurationsMs,durationMs:r.durationMs};return{lastCompile:s,history:je(n.history,s,Ee),nextId:n.nextId+1,lastSnapshot:r}})})),Pe=()=>{},Ce=e=>{switch(e.kind){case"init":return"init";case"spec":return"spec change";case"data":return"data change";case"command":return e.command.metadata.description}},je=(e,t,r)=>{const n=e.length>=r?e.length-(r-1):0;return[...e.slice(n),t]};function Q(e){const t=e.filter(ne),r=new Set([...Object.keys(o.BUILT_IN_GEOM_RENDERERS),...t.map(u=>u.geom)]),n=[],s=new Set;for(const u of e){const m=se(u);m===null||r.has(m.type)||s.has(m.type)||(s.add(m.type),n.push({kind:"user-input",severity:"error",code:"MISSING_GEOM_RENDERER",message:`Custom geom '${m.type}' is registered but has no renderer.`,context:{requested:m.type,kind:"geom-renderer"},suggestion:`Add a render half for it: \`defineGeomRenderer(${m.type}Geom, { coord, render })\`, then include it in \`plugins\`.`}))}const c=new Map;for(const u of t){if("definition"in u)continue;const m=`${u.geom}|${u.coord}`,p=c.get(m);p?p.count+=1:c.set(m,{geom:u.geom,coord:u.coord,count:1})}const l=[];for(const{geom:u,coord:m,count:p}of c.values())p<2||l.push({kind:"user-input",severity:"warning",code:"DUPLICATE_REGISTERED_TYPE",message:`Multiple render-only overrides register ('${u}', '${m}') (${p} entries); the last in the array wins.`,context:{requested:`${u}@${m}`,kind:"geom-renderer"},suggestion:`Keep a single render-only override for ('${u}', '${m}').`});return l.push(...Me(e)),{errors:n,warnings:l}}function Ne(e,t){const{coordSystem:r,layers:n}=e,s=new Set,c=[];for(const l of n)t(l.geom,r.type)!==null||s.has(l.geom)||(s.add(l.geom),c.push({kind:"user-input",severity:"warning",code:"MISSING_GEOM_RENDERER",message:`No renderer for geom '${l.geom}' under ${r.type} coords; the layer is not painted.`,context:{requested:l.geom,kind:"geom-renderer"},suggestion:`Register a renderer for ('${l.geom}', '${r.type}') via \`defineGeomRenderer\`.`}));return c}function De(e,t){const{coordSystem:r,layers:n}=e,s=new Set,c=[];for(const l of n){if(l.interactive===!1||l.spatialKind!=="render-hit-test"||s.has(l.geom))continue;const u=t(l.geom,r.type);u===null||u.hitTest||o.isLiveRender(u)||(s.add(l.geom),c.push({kind:"user-input",severity:"warning",code:"MISSING_RENDER_HIT_TEST",message:`Geom '${l.geom}' declares spatialKind 'render-hit-test' but its renderer provides no hit-test; the layer has no hover.`,context:{requested:l.geom,kind:"geom-renderer"},suggestion:`Add a \`hitTest\` factory (precomputed geometry) or a live render (\`{ fn, options: { live: true } }\`, live simulation) to the renderer for ('${l.geom}', '${r.type}').`}))}return c}function _e(e){const t=new Set,r=[];for(const n of e.layers){const s=n.identityKey;n.interactive!==!1&&(n.spatialKind!=="render-hit-test"||typeof s!="object"||t.has(n.geom)||n.data.hasVariable(s.variable)||(t.add(n.geom),r.push({kind:"user-input",severity:"warning",code:"RENDER_HIT_TEST_IDENTITY",message:`Geom '${n.geom}' keys its identity on '${s.variable}', a column its compile output does not emit; its hover lookup is empty.`,context:{requested:n.geom,kind:"geom-renderer"},suggestion:`Emit the '${s.variable}' column from the geom's \`compile()\`, or point \`identityKey\` at a column it does emit.`})))}return r}function ke(e,t){const{coordSystem:r,layers:n}=e,s=new Set,c=[];for(const l of n){if(l.interactive===!1||l.spatialKind!=="render-hit-test"||s.has(l.geom))continue;const u=t(l.geom,r.type);u===null||!u.hitTest||!o.isLiveRender(u)||(s.add(l.geom),c.push({kind:"user-input",severity:"warning",code:"CONFLICTING_RENDER_HIT_TEST",message:`Geom '${l.geom}' declares both a \`hitTest\` factory and a live render; these are alternatives, so only the live render is used.`,context:{requested:l.geom,kind:"geom-renderer"},suggestion:"Keep one: a `hitTest` factory for precomputed geometry, OR a live render (`{ fn, options: { live: true } }`) for a live simulation."}))}return c}function Ie(e,t){const r=new Set,n=[];for(const s of e.layers)s.interactive!==!1&&(s.spatialKind!=="render-hit-test"||r.has(s.geom)||t.hasCapability(s.geom)||(r.add(s.geom),n.push({kind:"user-input",severity:"warning",code:"MISSING_ANCHOR_CAPABILITY",message:`Geom '${s.geom}' declares no \`resolveAnchorPosition\`; its observations cannot be annotated, so the editor overlay paints no creation trigger on them.`,context:{requested:s.geom,kind:"geom-renderer"},suggestion:"Implement `resolveAnchorPosition(observation, context)` on the geom, returning the normalised panel position an annotation on that observation belongs at."})));return n}function qe(e,t){const{coordSystem:r,layers:n}=e,s=new Set,c=[];for(const l of n){if(l.interactive===!1||l.spatialKind==="render-hit-test"||s.has(l.geom))continue;const u=t(l.geom,r.type);u===null||!o.isLiveRender(u)||(s.add(l.geom),c.push({kind:"user-input",severity:"warning",code:"LIVE_RENDER_REQUIRES_RENDER_HIT_TEST",message:`Geom '${l.geom}' declares a live render but its layer's spatialKind is '${l.spatialKind}', not 'render-hit-test'; its push-path hover resolves to nothing.`,context:{requested:l.geom,kind:"geom-renderer"},suggestion:"Have the geom's manifest yield spatialKind 'render-hit-test' so the scene layer carries the `byKey` index the live render's `pushHover` resolves against."}))}return c}function Le(e,t){let r;return e.layers.flatMap((n,s)=>o.isLiveRender(t(n.geom,e.coordSystem.type))?we(n)?(r??=(0,h.createStyleResolver)().readers(e),(r.geom(n).get("overpaint",void 0,"hovered")?.length??0)===0?[]:[{kind:"user-input",severity:"warning",code:"INVALID_STYLE_RULE",message:`Style 'overpaint' in state 'hovered' is not supported on live geom '${n.geom}' (layer '${n.id}'); it is ignored.`,context:{param:"overpaint",layerIndex:s,requested:n.geom},suggestion:"Remove the hovered overpaint, or paint the hover treatment in the geom's live render."}]):[]:[])}var we=e=>[e.styles.defaults,e.styles.overrides].some(t=>t.some(r=>r.state==="hovered"&&(r.declarations.overpaint?.length??0)>0));function Me(e){const t=new Set,r=[];for(const n of e){const s=se(n);s===null||t.has(s.type)||s.dataLabelCoordTypes.length===0||s.getDataLabelPlacements!==void 0||(t.add(s.type),r.push({kind:"user-input",severity:"warning",code:"MISSING_DATA_LABEL_PLACEMENT",message:`Geom '${s.type}' declares \`dataLabelCoordTypes\` but implements no \`getDataLabelPlacements\`; its layers paint no data labels.`,context:{requested:s.type,kind:"geom-renderer"},suggestion:"Implement `getDataLabelPlacements(context)` on the geom, or drop `dataLabelCoordTypes` so the compiler warns the author off the flag."}))}return r}var He=e=>(0,Y.createStore)(t=>({scene:e,setScene:r=>t(n=>n.scene===r?n:{scene:r})})),$e=({spec:e,data:t,colorScheme:r,plugins:n,theme:s,resolveRenderer:c,anchorResolver:l,onSpecChange:u,onError:m,onWarnings:p})=>{const R=o.useLatestRef(u),P=o.useLatestRef(m),x=o.useLatestRef(p),[{session:f,compileBus:g}]=(0,d.useState)(()=>{const a=(0,h.createCompiler)({plugins:n,theme:s});return{session:new h.GraphCompilationSession(a),compileBus:Te(a)}}),[S]=(0,d.useState)(()=>{const a=Q(n??[]),v=Q(s?.plugins??[]);return{errors:[...v.errors,...a.errors],warnings:[...v.warnings,...a.warnings]}}),E=(0,d.useRef)(null),[y]=(0,d.useState)(Ae),C=(0,d.useRef)(null),D=(0,d.useCallback)(a=>S.errors.length===0?a:[...S.errors,...a??[]],[S]),T=(0,d.useCallback)(a=>{if(!a.ok)return a.errors;if(C.current)C.current.getState().setScene(a.scene);else{const v=He(a.scene);v.subscribe(y.notify),C.current=v,y.notify()}return null},[y]),[M,I]=(0,d.useState)(()=>{const a=f.compile({spec:e,data:t,colorScheme:r});return E.current=a,D(T(a))}),G=(0,d.useCallback)(a=>a.ok?[...a.warnings,...Ne(a.scene,c),...De(a.scene,c),..._e(a.scene),...ke(a.scene,c),...qe(a.scene,c),...Le(a.scene,c),...Ie(a.scene,l)]:a.warnings,[c,l]),j=(0,d.useCallback)(a=>{a.length!==0&&(o.logDiagnostics(a),P.current?.(a))},[P]),N=(0,d.useCallback)(a=>{a.length!==0&&(o.logDiagnostics(a),x.current?.(a))},[x]);(0,d.useEffect)(()=>{const a=E.current;a&&(j([...S.errors,...a.ok?[]:a.errors]),N([...S.warnings,...G(a)]),a.ok&&g.emit({kind:"init"}))},[g,j,N,S,G]),(0,d.useEffect)(()=>{const a=f.update({spec:e,data:t,colorScheme:r});if(!a)return;a.committedSpec&&R.current?.(a.committedSpec);const v=T(a.result);I(D(v)),v&&j(v),N(G(a.result)),v||g.emit({kind:a.specChanged?"spec":"data"})},[e,t,r,f,g,T,j,N,D,G,R]);const q=(0,d.useCallback)(a=>{I(v=>v===null?v:D(null)),N(G(a))},[D,N,G]),H=(0,d.useCallback)(a=>{a.scene&&C.current?.getState().setScene(a.scene),a.result&&q(a.result),a.command&&g.emit({kind:"command",command:a.command}),a.spec&&R.current?.(a.spec),a.errors&&j([...a.errors])},[q,g,R,j]),b=(0,d.useCallback)(a=>{for(const v of a)H(v);return a.some(v=>!!v.scene)},[H]),$=(0,d.useCallback)((a,v)=>{b(f.applyCommand(a,v))},[f,b]),_=(0,d.useCallback)(()=>{b(f.commit())},[f,b]),A=(0,d.useCallback)(()=>b(f.undo()),[f,b]),L=(0,d.useCallback)(()=>b(f.redo()),[f,b]),K=(0,d.useMemo)(()=>({stack:f.history,undo:A,redo:L}),[f,A,L]),me=(0,d.useCallback)(()=>C.current?.getState().scene??null,[]);return{store:C.current,dispatch:$,commit:_,history:K,subscribe:y.subscribe,getScene:me,compileBus:g,compileErrors:M}},Ae=()=>{const e=new Set;return{subscribe:t=>(e.add(t),()=>{e.delete(t)}),notify:()=>e.forEach(t=>t())}},ie=({data:e,spec:t,plugins:r=[],theme:n,formattingLocale:s,handleRef:c,onSpecChange:l,onError:u,onWarnings:m,colorScheme:p="light",children:R})=>{const[P]=(0,d.useState)(()=>n),x=P?.colorScheme??p,[f]=(0,d.useState)(()=>o.createGeomRendererResolver([...P?.plugins??[],...r].filter(ne))),g=(0,d.useId)(),[S]=(0,d.useState)(()=>(0,h.createAnchorResolver)(r)),[E]=(0,d.useState)(()=>(0,h.createDataLabelPlacementResolver)(r)),[y]=(0,d.useState)(()=>be()),[C]=(0,d.useState)(()=>o.createTargetBoundaryStore()),D=(0,d.useMemo)(()=>(0,h.createStyleResolver)({colorScheme:x}),[x]),{store:T,dispatch:M,commit:I,history:G,subscribe:j,getScene:N,compileBus:q,compileErrors:H}=$e({spec:t,data:e,colorScheme:x,plugins:r,theme:P,resolveRenderer:f,anchorResolver:S,onSpecChange:l,onError:u,onWarnings:m});(0,d.useEffect)(()=>{if(T)return T.subscribe((_,A)=>{if(_.scene.spec===A.scene.spec)return;const{selection:L,setSelection:K}=y.getState();L.length!==0&&K(oe(L,_.scene.spec))})},[T,y]);const b=(0,d.useMemo)(()=>({dispatch:M,commit:I}),[M,I]);(0,d.useImperativeHandle)(c,()=>({commands:b,undo:G.undo,redo:G.redo,subscribe:j,getScene:N,getSelection:()=>y.getState().selection,setSelection:_=>y.getState().setSelection(_),subscribeSelection:y.subscribe,canPlaceDataLabels:E.hasCapability,canFormatDataLabelsAsPercentages:E.hasPercentageFormat}),[b,G,j,N,y,E]);const $=(0,d.useMemo)(()=>T?{chartId:g,store:T,selectionStore:y,targetBoundaryStore:C,commands:b,history:G,formattingLocale:s,compileBus:q,colorScheme:x,styleResolver:D,anchorResolver:S}:null,[g,T,y,C,b,G,s,q,x,D,S]);return(0,i.jsx)(re,{forcedErrors:H,onError:u,resetKeys:[t,e],children:$?(0,i.jsx)(o.GraphContext.Provider,{value:$,children:(0,i.jsx)(o.GeomRendererResolverProvider,{value:f,children:(0,i.jsx)(o.DataLabelPlacementResolverProvider,{value:E,children:(0,i.jsx)(o.GeomShapesProvider,{shapes:P?.shapes,children:R})})})}):null})};function Be({theme:e,...t}={}){const r=(0,h.createSpecBuilder)(t);return{...r,GraphProvider:s=>(0,i.jsx)(ie,{...s,plugins:r.plugins,theme:e})}}var k=(e,t)=>{if(typeof e=="number")return Number.isFinite(e)?e:null;if(!e.endsWith("%"))return null;const r=Number.parseFloat(e);return Number.isFinite(r)?r/100*t:null},Oe=({x:e,y:t,width:r,height:n},s)=>{const c=k(e,s.width),l=k(t,s.height),u=k(r,s.width),m=k(n,s.height);return c===null||l===null||u===null||m===null?null:{x:c,y:l,width:u,height:m}},ae=({shouldAnimateTransitions:e,cx:t,cy:r,r:n,effects:s,...c})=>{const l=o.toGeomEffectsStyle(s);return e?(0,i.jsx)(O.motion.circle,{initial:!1,animate:{cx:t,cy:r,r:n},transition:o.DEFAULT_SPRING_TRANSITION,style:l,...c}):(0,i.jsx)("circle",{cx:t,cy:r,r:n,style:l,...c})},le=({shouldAnimateTransitions:e,x1:t,y1:r,x2:n,y2:s,effects:c,...l})=>{const u=o.toGeomEffectsStyle(c);return e?(0,i.jsx)(O.motion.line,{initial:!1,animate:{x1:t,y1:r,x2:n,y2:s},transition:o.DEFAULT_SPRING_TRANSITION,style:u,...l}):(0,i.jsx)("line",{x1:t,y1:r,x2:n,y2:s,style:u,...l})},ce=({shouldAnimateTransitions:e,x:t,y:r,width:n,height:s,rx:c,ry:l,effects:u,...m})=>{const p=o.toGeomEffectsStyle(u);return e?(0,i.jsx)(O.motion.rect,{initial:!1,animate:{attrX:t,attrY:r,width:n,height:s,...c!==void 0&&l!==void 0?{rx:c,ry:l}:{}},transition:o.DEFAULT_SPRING_TRANSITION,style:p,...m}):(0,i.jsx)("rect",{x:t,y:r,width:n,height:s,rx:c,ry:l,style:p,...m})},ue=({shouldAnimateTransitions:e,d:t,source:r,effects:n,...s})=>{const c=o.toGeomEffectsStyle(n);return e?(0,i.jsx)(Ye,{d:t,source:r,style:c,...s}):(0,i.jsx)("path",{d:t,style:c,...s})},Ke=e=>{const{Circle:t}=o.useGeomShapes();return t===void 0?ae(e):(0,i.jsx)(o.GeomShapesProvider,{children:(0,i.jsx)(t,{...e})})},Fe=e=>{const{Line:t}=o.useGeomShapes();return t===void 0?le(e):(0,i.jsx)(o.GeomShapesProvider,{children:(0,i.jsx)(t,{...e})})},Ue=({cornerRadius:e,...t})=>{const{Rect:r}=o.useGeomShapes(),n=o.useGeomPanelPixelSize(),s=o.useGeomPixelsPerUnit(),c={...t,...We(e,t,n,s)};return r===void 0?ce(c):(0,i.jsx)(o.GeomShapesProvider,{children:(0,i.jsx)(r,{...c})})},ze=e=>{const{Path:t}=o.useGeomShapes();return t===void 0?ue(e):(0,i.jsx)(o.GeomShapesProvider,{children:(0,i.jsx)(t,{...e})})},Ye=({d:e,source:t,...r})=>{const n=o.useSvgPathMorph(e,o.DEFAULT_SPRING_TRANSITION,t);return(0,i.jsx)(O.motion.path,{d:n,...r})},We=(e,t,r,n)=>{if(e===void 0)return{};const s=Ve(t,r,n);if(s===null)return e==="full"?{}:Z((0,h.resolveGeomCornerRadiusPx)({cornerRadius:e}),n);const c=Math.min((0,h.resolveGeomCornerRadiusPx)({cornerRadius:e,box:s}),Math.min(s.width,s.height)/2);return Z(c,n)},Ve=(e,t,r)=>{const n=J(e.width,t?.width,r.x),s=J(e.height,t?.height,r.y);return n===null||s===null?null:{width:n,height:s}},J=(e,t,r)=>{if(typeof e=="number")return Number.isFinite(e)?Math.abs(e)*r:null;if(t===void 0)return null;const n=k(e,t);return n===null?null:Math.abs(n)},Z=(e,t)=>t.x<=0||t.y<=0?{rx:0,ry:0}:{rx:e/t.x,ry:e/t.y},Xe=({children:e,...t})=>{const r=o.useGeomPanelPixelSize();return(0,i.jsx)("svg",{viewBox:"0 0 1 1",preserveAspectRatio:"none",width:"100%",height:"100%",pointerEvents:"none",...t,children:(0,i.jsx)(o.GeomPanelSizeProvider,{size:r,space:"unit",children:e})})},Qe=({box:e,children:t})=>{const r=o.useGeomPanelSize(),n=r===null?null:r.width*(e.x1-e.x0),s=r===null?null:r.height*(e.y1-e.y0),c=(0,d.useMemo)(()=>n===null||s===null?null:{width:n,height:s},[n,s]);return(0,i.jsx)("svg",{x:(0,h.toPercent)(e.x0),y:(0,h.toPercent)(e.y0),width:(0,h.toPercent)(e.x1-e.x0),height:(0,h.toPercent)(e.y1-e.y0),overflow:"hidden",pointerEvents:"none",children:(0,i.jsx)(o.GeomPanelSizeProvider,{size:c,children:t})})},Je="drqe3u0",Ze="drqe3u1",et="drqe3u2",tt="drqe3u3",w="drqe3u4",rt="drqe3u5",nt="drqe3u6",st="drqe3u7",B="drqe3u8",ot="drqe3u9",it="drqe3ua";var at="drqe3uc",lt="drqe3ud",ct="drqe3ue",ut="drqe3uf";var dt="drqe3uh",mt="drqe3ui",ee={enabled:"drqe3uk drqe3uj",disabled:"drqe3ul drqe3uj"},te={ran:"drqe3un drqe3um",dim:"drqe3uo drqe3um"},de={ran:"drqe3uq drqe3up",cached:"drqe3ur drqe3up",untouched:"drqe3us drqe3up"},ht=({width:e=440,style:t,className:r}={})=>{const{compileBus:n}=o.useGraphContext(),[s]=(0,d.useState)(()=>Re()),[c,l]=(0,d.useState)(!1),[u,m]=(0,d.useState)(h.isCompilerCachingEnabled);(0,d.useEffect)(()=>{const{recordCompile:g}=s.getState(),S=n.getLastTrigger(),E=n.getLastCompile();return S&&E&&g(S,E),n.subscribe(g)},[s,n]);const p=(0,F.useStore)(s,g=>g.lastCompile),R=(0,F.useStore)(s,g=>g.history),P=n.getCacheStats(),x=p===null&&R.length===0,f=()=>{m(g=>{const S=!g;return(0,h.setCompilerCachingEnabled)(S),S})};return(0,i.jsxs)("div",{className:(0,U.default)(it,r),style:{width:e,...t},children:[(0,i.jsxs)("div",{className:Je,children:[(0,i.jsxs)("div",{children:[(0,i.jsx)("div",{className:Ze,children:"compile cache"}),(0,i.jsx)("div",{className:ct,children:x?"production: stats disabled":p?`last: ${p.label} · ${W(p.durationMs)}`:"awaiting first compile…"})]}),(0,i.jsx)("button",{type:"button",onClick:()=>l(g=>!g),className:ut,children:c?"▾":"▴"})]}),!c&&(0,i.jsxs)("div",{className:"drqe3ub",children:[(0,i.jsxs)("button",{type:"button",onClick:f,className:u?ee.enabled:ee.disabled,"aria-pressed":u,children:["cache ",u?"enabled":"disabled"]}),(0,i.jsx)("span",{className:"drqe3ug",children:"next compile reflects this toggle"})]}),!c&&!x&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(gt,{delta:p?.stages,durations:p?.stageDurationsMs,cumulative:P}),(0,i.jsx)(pt,{entries:R})]})]})},gt=({delta:e,durations:t,cumulative:r})=>(0,i.jsxs)("table",{className:et,children:[(0,i.jsx)("thead",{children:(0,i.jsxs)("tr",{className:dt,children:[(0,i.jsx)("th",{className:tt,children:"stage"}),(0,i.jsx)("th",{className:w,children:"time"}),(0,i.jsx)("th",{className:w,children:"Δ miss"}),(0,i.jsx)("th",{className:w,children:"Δ hit"}),(0,i.jsx)("th",{className:w,children:"total miss"}),(0,i.jsx)("th",{className:w,children:"total hit"})]})}),(0,i.jsx)("tbody",{children:h.COMPILER_STAGE_KEYS.map(n=>{const s=e?.[n],c=vt(s);return(0,i.jsxs)("tr",{className:at,children:[(0,i.jsxs)("td",{className:rt,children:[(0,i.jsx)("span",{className:de[c],"aria-hidden":!0})," ",n]}),(0,i.jsx)("td",{className:B,children:t===void 0||c==="untouched"?"—":W(t[n])}),(0,i.jsx)("td",{className:c==="ran"?te.ran:te.dim,children:s?.misses??0}),(0,i.jsx)("td",{className:B,children:s?.hits??0}),(0,i.jsx)("td",{className:B,children:r[n].misses}),(0,i.jsx)("td",{className:B,children:r[n].hits})]},n)})})]}),pt=({entries:e})=>e.length===0?null:(0,i.jsxs)("div",{className:lt,children:[(0,i.jsx)("div",{className:mt,children:"recent compiles"}),e.map(t=>{const r=ft(t.stages,c=>c.misses>0),n=h.COMPILER_STAGE_KEYS.length,s=r===0?"cached":"ran";return(0,i.jsxs)("div",{className:nt,children:[(0,i.jsx)("span",{className:de[s],"aria-hidden":!0}),(0,i.jsx)("span",{className:st,title:t.label,children:t.label}),(0,i.jsxs)("span",{className:ot,children:[r,"/",n," ran · ",W(t.durationMs)]})]},t.id)})]}),vt=e=>!e||e.hits===0&&e.misses===0?"untouched":e.misses>0?"ran":"cached",ft=(e,t)=>{let r=0;for(const n of h.COMPILER_STAGE_KEYS)t(e[n])&&(r+=1);return r},W=e=>e<.1?"<0.1ms":e>=10?`${e.toFixed(0)}ms`:`${e.toFixed(2)}ms`,St=()=>{const{history:e}=o.useGraphContext(),{stack:t,undo:r,redo:n}=e,s=(0,d.useCallback)(u=>t.subscribe(u),[t]),c=(0,d.useCallback)(()=>t.getSnapshot(),[t]),l=(0,d.useSyncExternalStore)(s,c,c);return(0,d.useMemo)(()=>({...l,undo:r,redo:n}),[l,r,n])},yt=new Set(["button","checkbox","color","file","hidden","image","radio","range","reset","submit"]),bt=(e,t={})=>{const{target:r,enabled:n=!0}=t;(0,d.useEffect)(()=>{const s=Gt(r);if(!n||!s)return;const c=l=>{if(!xt(l)||l.defaultPrevented||Et(l.target))return;const u=o.resolveHistoryStep(l);if(!u)return;const m=e.current;m&&(u==="undo"?m.undo():m.redo())&&l.preventDefault()};return s.addEventListener("keydown",c),()=>s.removeEventListener("keydown",c)},[e,r,n])},Gt=e=>e===void 0?window:e!==null&&"current"in e?e.current:e,xt=e=>"key"in e,Et=e=>e instanceof HTMLInputElement?!yt.has(e.type):e instanceof HTMLElement?e.isContentEditable||e.tagName==="TEXTAREA":!1,Tt=()=>{const{targetBoundaryStore:e}=o.useGraphContext();return(0,F.useStore)(e,t=>t.boundary)};exports.BrandMark=o.BrandMark;exports.CanvasTextMeasurer=o.CanvasTextMeasurer;exports.DefaultFooter=o.DefaultFooter;exports.DefaultGeomCircle=ae;exports.DefaultGeomLine=le;exports.DefaultGeomPath=ue;exports.DefaultGeomRect=ce;exports.DefaultGrid=o.DefaultGrid;exports.DefaultHeader=o.DefaultHeader;exports.DefaultSwatch=o.DefaultSwatch;exports.DefaultTooltip=o.DefaultTooltip;exports.DevToolsPanel=ht;exports.GRAPH_MODES=o.GRAPH_MODES;exports.GeomCircle=Ke;exports.GeomLine=Fe;exports.GeomOverpaint=o.GeomOverpaint;exports.GeomPath=ze;exports.GeomRect=Ue;exports.GraphErrorBoundary=re;exports.GraphErrorPanel=z;exports.GraphProvider=ie;exports.GraphRenderer=o.GraphRenderer;exports.HoverProvider=o.HoverProvider;exports.IntroFade=o.IntroFade;exports.IntroWipeClip=o.IntroWipeClip;exports.TextMeasurerProvider=o.TextMeasurerProvider;exports.ThemeProvider=o.ThemeProvider;exports.UnitBoxSvg=Qe;exports.UnitSpaceSvg=Xe;exports.buildDotsEditOutlineShapes=o.buildDotsEditOutlineShapes;exports.createGraphyKit=Be;exports.darkTheme=o.darkTheme;exports.defineGeomRenderer=o.defineGeomRenderer;exports.lightTheme=o.lightTheme;exports.lightenCss=o.lightenCss;exports.projectPointCartesian=o.projectPointCartesian;exports.pruneSelection=oe;exports.readPositionPixels=k;exports.readRectPixels=Oe;exports.resolveBrandMarkVisual=o.resolveBrandMarkVisual;exports.resolvePathStroke=o.resolvePathStroke;exports.scalePointToPanel=o.scalePointToPanel;exports.stampAxisEditTarget=o.stampAxisEditTarget;exports.stampGridEditTarget=o.stampGridEditTarget;exports.stampLegendEditTarget=o.stampLegendEditTarget;exports.useElementScreenRect=o.useElementScreenRect;exports.useGeomHitTest=o.useGeomHitTest;exports.useGeomHover=o.useGeomHover;exports.useGeomPanelSize=o.useGeomPanelSize;exports.useGeomReaderTree=o.useGeomReaderTree;exports.useGeomStyleReader=o.useGeomStyleReader;exports.useGraphCommands=o.useGraphCommands;exports.useGraphHandle=o.useGraphHandle;exports.useGraphHistory=St;exports.useGraphHistoryShortcuts=bt;exports.useGraphLocale=o.useGraphLocale;exports.useGraphSelection=o.useGraphSelection;exports.useGuidesTakePress=o.useGuidesTakePress;exports.useHandleScene=o.useHandleScene;exports.useHoverState=o.useHoverState;exports.usePaintDefs=o.usePaintDefs;exports.useResolvedStyle=o.useResolvedStyle;exports.useSceneSelector=o.useSceneSelector;exports.useStyleReaderTree=o.useStyleReaderTree;exports.useStyleResolver=o.useStyleResolver;exports.useTargetBoundary=Tt;exports.useTextMeasurer=o.useTextMeasurer;exports.vars=o.vars;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('./index.css');const o=require("./history-chords-CsWrjb9i.cjs");let m=require("@graphysdk/viz-engine"),d=require("react"),i=require("react/jsx-runtime"),F=require("zustand"),O=require("motion/react"),Y=require("zustand/vanilla"),U=require("clsx");U=o.__toESM(U,1);var me="_1a5iqpb0",ge="_1a5iqpb1";var pe="_1a5iqpb3",ve="_1a5iqpb4",fe="_1a5iqpb5";var z=({errors:e})=>{const[t,...r]=e;return(0,i.jsxs)("div",{role:"alert",className:me,children:[(0,i.jsx)("strong",{className:ge,children:"This chart could not be rendered."}),t&&(0,i.jsx)(V,{diagnostic:t}),r.length>0&&(0,i.jsx)("ul",{className:"_1a5iqpb2",children:r.map((n,s)=>(0,i.jsx)("li",{children:(0,i.jsx)(V,{diagnostic:n})},`${n.code}-${s}`))})]})},V=({diagnostic:e})=>(0,i.jsxs)("div",{className:pe,children:[(0,i.jsx)("span",{className:ve,children:e.code}),(0,i.jsx)("p",{className:fe,children:e.message}),e.suggestion&&(0,i.jsx)("p",{className:"_1a5iqpb6",children:e.suggestion})]});function Se(e=[],t=[]){return e.length===t.length&&e.every((r,n)=>Object.is(r,t[n]))}var re=class extends d.Component{constructor(...e){super(...e),this.state={caughtDiagnostic:null}}static getDerivedStateFromError(e){return{caughtDiagnostic:(0,m.buildDiagnostic)(e)}}componentDidCatch(e,t){const r=(0,m.buildDiagnostic)(e);o.logDiagnostics([r]),this.props.onError?.([r]),console.error("Chart render component stack:",t.componentStack)}componentDidUpdate(e){this.state.caughtDiagnostic&&!Se(e.resetKeys,this.props.resetKeys)&&this.setState({caughtDiagnostic:null})}render(){const{caughtDiagnostic:e}=this.state;if(e)return(0,i.jsx)(z,{errors:[e]});const{forcedErrors:t,children:r}=this.props;return t&&t.length>0?(0,i.jsx)(z,{errors:t}):r}},ne=e=>typeof e=="object"&&"geom"in e&&"render"in e,se=e=>{const t=(0,m.resolveDefinition)(e);return t instanceof m.Geom?t:null},oe=(e,t)=>{const r=e.filter(n=>ye(n,t));return r.length===e.length?e:r},ye=(e,t)=>e.kind==="annotation"?(0,m.findAnnotation)(t.annotations,e.id)!==null:e.kind==="observations"||e.kind==="layer"&&e.layerId!==void 0?(0,m.findLayerById)(t.layers,e.layerId)!==void 0:!0,X=[],be=()=>(0,Y.createStore)(e=>({selection:X,setSelection:t=>e(r=>Ge(r.selection,t)?r:{selection:t}),clearSelection:()=>e(t=>t.selection.length===0?t:{selection:X})})),Ge=(e,t)=>e===t?!0:e.length!==t.length?!1:e.every((r,n)=>{const s=t[n];return s!==void 0&&(0,m.areEditTargetsEqual)(r,s)}),xe=process.env.NODE_ENV!=="production",Ee=5,Te=e=>{if(!xe)return{emit:()=>{},subscribe:()=>Pe,getLastTrigger:()=>null,getLastCompile:()=>null,getCacheStats:()=>e.getCacheStats()};const t=new Set;let r=null;return{emit:n=>{const s=e.getLastCompile();if(s){r=n;for(const c of t)c(n,s)}},subscribe:n=>(t.add(n),()=>{t.delete(n)}),getLastTrigger:()=>r,getLastCompile:()=>e.getLastCompile(),getCacheStats:()=>e.getCacheStats()}},Re=()=>(0,Y.createStore)(e=>({lastCompile:null,history:[],nextId:1,lastSnapshot:null,recordCompile:(t,r)=>e(n=>{if(n.lastSnapshot===r)return n;const s={id:n.nextId,label:Ce(t),stages:r.stages,stageDurationsMs:r.stageDurationsMs,durationMs:r.durationMs};return{lastCompile:s,history:je(n.history,s,Ee),nextId:n.nextId+1,lastSnapshot:r}})})),Pe=()=>{},Ce=e=>{switch(e.kind){case"init":return"init";case"spec":return"spec change";case"data":return"data change";case"command":return e.command.metadata.description}},je=(e,t,r)=>{const n=e.length>=r?e.length-(r-1):0;return[...e.slice(n),t]};function Q(e){const t=e.filter(ne),r=new Set([...Object.keys(o.BUILT_IN_GEOM_RENDERERS),...t.map(u=>u.geom)]),n=[],s=new Set;for(const u of e){const h=se(u);h===null||r.has(h.type)||s.has(h.type)||(s.add(h.type),n.push({kind:"user-input",severity:"error",code:"MISSING_GEOM_RENDERER",message:`Custom geom '${h.type}' is registered but has no renderer.`,context:{requested:h.type,kind:"geom-renderer"},suggestion:`Add a render half for it: \`defineGeomRenderer(${h.type}Geom, { coord, render })\`, then include it in \`plugins\`.`}))}const c=new Map;for(const u of t){if("definition"in u)continue;const h=`${u.geom}|${u.coord}`,p=c.get(h);p?p.count+=1:c.set(h,{geom:u.geom,coord:u.coord,count:1})}const l=[];for(const{geom:u,coord:h,count:p}of c.values())p<2||l.push({kind:"user-input",severity:"warning",code:"DUPLICATE_REGISTERED_TYPE",message:`Multiple render-only overrides register ('${u}', '${h}') (${p} entries); the last in the array wins.`,context:{requested:`${u}@${h}`,kind:"geom-renderer"},suggestion:`Keep a single render-only override for ('${u}', '${h}').`});return l.push(...Me(e)),{errors:n,warnings:l}}function Ne(e,t){const{coordSystem:r,layers:n}=e,s=new Set,c=[];for(const l of n)t(l.geom,r.type)!==null||s.has(l.geom)||(s.add(l.geom),c.push({kind:"user-input",severity:"warning",code:"MISSING_GEOM_RENDERER",message:`No renderer for geom '${l.geom}' under ${r.type} coords; the layer is not painted.`,context:{requested:l.geom,kind:"geom-renderer"},suggestion:`Register a renderer for ('${l.geom}', '${r.type}') via \`defineGeomRenderer\`.`}));return c}function De(e,t){const{coordSystem:r,layers:n}=e,s=new Set,c=[];for(const l of n){if(l.interactive===!1||l.spatialKind!=="render-hit-test"||s.has(l.geom))continue;const u=t(l.geom,r.type);u===null||u.hitTest||o.isLiveRender(u)||(s.add(l.geom),c.push({kind:"user-input",severity:"warning",code:"MISSING_RENDER_HIT_TEST",message:`Geom '${l.geom}' declares spatialKind 'render-hit-test' but its renderer provides no hit-test; the layer has no hover.`,context:{requested:l.geom,kind:"geom-renderer"},suggestion:`Add a \`hitTest\` factory (precomputed geometry) or a live render (\`{ fn, options: { live: true } }\`, live simulation) to the renderer for ('${l.geom}', '${r.type}').`}))}return c}function _e(e){const t=new Set,r=[];for(const n of e.layers){const s=n.identityKey;n.interactive!==!1&&(n.spatialKind!=="render-hit-test"||typeof s!="object"||t.has(n.geom)||n.data.hasVariable(s.variable)||(t.add(n.geom),r.push({kind:"user-input",severity:"warning",code:"RENDER_HIT_TEST_IDENTITY",message:`Geom '${n.geom}' keys its identity on '${s.variable}', a column its compile output does not emit; its hover lookup is empty.`,context:{requested:n.geom,kind:"geom-renderer"},suggestion:`Emit the '${s.variable}' column from the geom's \`compile()\`, or point \`identityKey\` at a column it does emit.`})))}return r}function ke(e,t){const{coordSystem:r,layers:n}=e,s=new Set,c=[];for(const l of n){if(l.interactive===!1||l.spatialKind!=="render-hit-test"||s.has(l.geom))continue;const u=t(l.geom,r.type);u===null||!u.hitTest||!o.isLiveRender(u)||(s.add(l.geom),c.push({kind:"user-input",severity:"warning",code:"CONFLICTING_RENDER_HIT_TEST",message:`Geom '${l.geom}' declares both a \`hitTest\` factory and a live render; these are alternatives, so only the live render is used.`,context:{requested:l.geom,kind:"geom-renderer"},suggestion:"Keep one: a `hitTest` factory for precomputed geometry, OR a live render (`{ fn, options: { live: true } }`) for a live simulation."}))}return c}function Ie(e,t){const r=new Set,n=[];for(const s of e.layers)s.interactive!==!1&&(s.spatialKind!=="render-hit-test"||r.has(s.geom)||t.hasCapability(s.geom)||(r.add(s.geom),n.push({kind:"user-input",severity:"warning",code:"MISSING_ANCHOR_CAPABILITY",message:`Geom '${s.geom}' declares no \`resolveAnchorPosition\`; its observations cannot be annotated, so the editor overlay paints no creation trigger on them.`,context:{requested:s.geom,kind:"geom-renderer"},suggestion:"Implement `resolveAnchorPosition(observation, context)` on the geom, returning the normalised panel position an annotation on that observation belongs at."})));return n}function qe(e,t){const{coordSystem:r,layers:n}=e,s=new Set,c=[];for(const l of n){if(l.interactive===!1||l.spatialKind==="render-hit-test"||s.has(l.geom))continue;const u=t(l.geom,r.type);u===null||!o.isLiveRender(u)||(s.add(l.geom),c.push({kind:"user-input",severity:"warning",code:"LIVE_RENDER_REQUIRES_RENDER_HIT_TEST",message:`Geom '${l.geom}' declares a live render but its layer's spatialKind is '${l.spatialKind}', not 'render-hit-test'; its push-path hover resolves to nothing.`,context:{requested:l.geom,kind:"geom-renderer"},suggestion:"Have the geom's manifest yield spatialKind 'render-hit-test' so the scene layer carries the `byKey` index the live render's `pushHover` resolves against."}))}return c}function Le(e,t){let r;return e.layers.flatMap((n,s)=>o.isLiveRender(t(n.geom,e.coordSystem.type))?we(n)?(r??=(0,m.createStyleResolver)().readers(e),(r.geom(n).get("overpaint",void 0,"hovered")?.length??0)===0?[]:[{kind:"user-input",severity:"warning",code:"INVALID_STYLE_RULE",message:`Style 'overpaint' in state 'hovered' is not supported on live geom '${n.geom}' (layer '${n.id}'); it is ignored.`,context:{param:"overpaint",layerIndex:s,requested:n.geom},suggestion:"Remove the hovered overpaint, or paint the hover treatment in the geom's live render."}]):[]:[])}var we=e=>[e.styles.defaults,e.styles.overrides].some(t=>t.some(r=>r.state==="hovered"&&(r.declarations.overpaint?.length??0)>0));function Me(e){const t=new Set,r=[];for(const n of e){const s=se(n);s===null||t.has(s.type)||s.dataLabelCoordTypes.length===0||s.getDataLabelPlacements!==void 0||(t.add(s.type),r.push({kind:"user-input",severity:"warning",code:"MISSING_DATA_LABEL_PLACEMENT",message:`Geom '${s.type}' declares \`dataLabelCoordTypes\` but implements no \`getDataLabelPlacements\`; its layers paint no data labels.`,context:{requested:s.type,kind:"geom-renderer"},suggestion:"Implement `getDataLabelPlacements(context)` on the geom, or drop `dataLabelCoordTypes` so the compiler warns the author off the flag."}))}return r}var He=e=>(0,Y.createStore)(t=>({scene:e,setScene:r=>t(n=>n.scene===r?n:{scene:r})})),$e=({spec:e,data:t,colorScheme:r,plugins:n,theme:s,resolveRenderer:c,anchorResolver:l,onSpecChange:u,onError:h,onWarnings:p})=>{const R=o.useLatestRef(u),P=o.useLatestRef(h),x=o.useLatestRef(p),[{session:f,compileBus:g}]=(0,d.useState)(()=>{const a=(0,m.createCompiler)({plugins:n,theme:s});return{session:new m.GraphCompilationSession(a),compileBus:Te(a)}}),[S]=(0,d.useState)(()=>{const a=Q(n??[]),v=Q(s?.plugins??[]);return{errors:[...v.errors,...a.errors],warnings:[...v.warnings,...a.warnings]}}),E=(0,d.useRef)(null),[y]=(0,d.useState)(Ae),C=(0,d.useRef)(null),D=(0,d.useCallback)(a=>S.errors.length===0?a:[...S.errors,...a??[]],[S]),T=(0,d.useCallback)(a=>{if(!a.ok)return a.errors;if(C.current)C.current.getState().setScene(a.scene);else{const v=He(a.scene);v.subscribe(y.notify),C.current=v,y.notify()}return null},[y]),[M,I]=(0,d.useState)(()=>{const a=f.compile({spec:e,data:t,colorScheme:r});return E.current=a,D(T(a))}),G=(0,d.useCallback)(a=>a.ok?[...a.warnings,...Ne(a.scene,c),...De(a.scene,c),..._e(a.scene),...ke(a.scene,c),...qe(a.scene,c),...Le(a.scene,c),...Ie(a.scene,l)]:a.warnings,[c,l]),j=(0,d.useCallback)(a=>{a.length!==0&&(o.logDiagnostics(a),P.current?.(a))},[P]),N=(0,d.useCallback)(a=>{a.length!==0&&(o.logDiagnostics(a),x.current?.(a))},[x]);(0,d.useEffect)(()=>{const a=E.current;a&&(j([...S.errors,...a.ok?[]:a.errors]),N([...S.warnings,...G(a)]),a.ok&&g.emit({kind:"init"}))},[g,j,N,S,G]),(0,d.useEffect)(()=>{const a=f.update({spec:e,data:t,colorScheme:r});if(!a)return;a.committedSpec&&R.current?.(a.committedSpec);const v=T(a.result);I(D(v)),v&&j(v),N(G(a.result)),v||g.emit({kind:a.hasSpecChange?"spec":"data"})},[e,t,r,f,g,T,j,N,D,G,R]);const q=(0,d.useCallback)(a=>{I(v=>v===null?v:D(null)),N(G(a))},[D,N,G]),H=(0,d.useCallback)(a=>{a.scene&&C.current?.getState().setScene(a.scene),a.result&&q(a.result),a.command&&g.emit({kind:"command",command:a.command}),a.spec&&R.current?.(a.spec),a.errors&&j([...a.errors])},[q,g,R,j]),b=(0,d.useCallback)(a=>{for(const v of a)H(v);return a.some(v=>!!v.scene)},[H]),$=(0,d.useCallback)((a,v)=>{b(f.applyCommand(a,v))},[f,b]),_=(0,d.useCallback)(()=>{b(f.commit())},[f,b]),A=(0,d.useCallback)(()=>b(f.undo()),[f,b]),L=(0,d.useCallback)(()=>b(f.redo()),[f,b]),K=(0,d.useMemo)(()=>({stack:f.history,undo:A,redo:L}),[f,A,L]),he=(0,d.useCallback)(()=>C.current?.getState().scene??null,[]);return{store:C.current,dispatch:$,commit:_,history:K,subscribe:y.subscribe,getScene:he,compileBus:g,compileErrors:M}},Ae=()=>{const e=new Set;return{subscribe:t=>(e.add(t),()=>{e.delete(t)}),notify:()=>e.forEach(t=>t())}},ie=({data:e,spec:t,plugins:r=[],theme:n,formattingLocale:s,handleRef:c,onSpecChange:l,onError:u,onWarnings:h,colorScheme:p="light",children:R})=>{const[P]=(0,d.useState)(()=>n),x=P?.colorScheme??p,[f]=(0,d.useState)(()=>o.createGeomRendererResolver([...P?.plugins??[],...r].filter(ne))),g=(0,d.useId)(),[S]=(0,d.useState)(()=>(0,m.createAnchorResolver)(r)),[E]=(0,d.useState)(()=>(0,m.createDataLabelPlacementResolver)(r)),[y]=(0,d.useState)(()=>be()),[C]=(0,d.useState)(()=>o.createTargetBoundaryStore()),D=(0,d.useMemo)(()=>(0,m.createStyleResolver)({colorScheme:x}),[x]),{store:T,dispatch:M,commit:I,history:G,subscribe:j,getScene:N,compileBus:q,compileErrors:H}=$e({spec:t,data:e,colorScheme:x,plugins:r,theme:P,resolveRenderer:f,anchorResolver:S,onSpecChange:l,onError:u,onWarnings:h});(0,d.useEffect)(()=>{if(T)return T.subscribe((_,A)=>{if(_.scene.spec===A.scene.spec)return;const{selection:L,setSelection:K}=y.getState();L.length!==0&&K(oe(L,_.scene.spec))})},[T,y]);const b=(0,d.useMemo)(()=>({dispatch:M,commit:I}),[M,I]);(0,d.useImperativeHandle)(c,()=>({commands:b,undo:G.undo,redo:G.redo,subscribe:j,getScene:N,getSelection:()=>y.getState().selection,setSelection:_=>y.getState().setSelection(_),subscribeSelection:y.subscribe,canPlaceDataLabels:E.hasCapability,canFormatDataLabelsAsPercentages:E.hasPercentageFormat}),[b,G,j,N,y,E]);const $=(0,d.useMemo)(()=>T?{chartId:g,store:T,selectionStore:y,targetBoundaryStore:C,commands:b,history:G,formattingLocale:s,compileBus:q,colorScheme:x,styleResolver:D,anchorResolver:S}:null,[g,T,y,C,b,G,s,q,x,D,S]);return(0,i.jsx)(re,{forcedErrors:H,onError:u,resetKeys:[t,e],children:$?(0,i.jsx)(o.GraphContext.Provider,{value:$,children:(0,i.jsx)(o.GeomRendererResolverProvider,{value:f,children:(0,i.jsx)(o.DataLabelPlacementResolverProvider,{value:E,children:(0,i.jsx)(o.GeomShapesProvider,{shapes:P?.shapes,children:R})})})}):null})};function Be({theme:e,...t}={}){const r=(0,m.createSpecBuilder)(t);return{...r,GraphProvider:s=>(0,i.jsx)(ie,{...s,plugins:r.plugins,theme:e})}}var k=(e,t)=>{if(typeof e=="number")return Number.isFinite(e)?e:null;if(!e.endsWith("%"))return null;const r=Number.parseFloat(e);return Number.isFinite(r)?r/100*t:null},Oe=({x:e,y:t,width:r,height:n},s)=>{const c=k(e,s.width),l=k(t,s.height),u=k(r,s.width),h=k(n,s.height);return c===null||l===null||u===null||h===null?null:{x:c,y:l,width:u,height:h}},ae=({animateTransitions:e,cx:t,cy:r,r:n,effects:s,...c})=>{const l=o.toGeomEffectsStyle(s);return e?(0,i.jsx)(O.motion.circle,{initial:!1,animate:{cx:t,cy:r,r:n},transition:o.DEFAULT_SPRING_TRANSITION,style:l,...c}):(0,i.jsx)("circle",{cx:t,cy:r,r:n,style:l,...c})},le=({animateTransitions:e,x1:t,y1:r,x2:n,y2:s,effects:c,...l})=>{const u=o.toGeomEffectsStyle(c);return e?(0,i.jsx)(O.motion.line,{initial:!1,animate:{x1:t,y1:r,x2:n,y2:s},transition:o.DEFAULT_SPRING_TRANSITION,style:u,...l}):(0,i.jsx)("line",{x1:t,y1:r,x2:n,y2:s,style:u,...l})},ce=({animateTransitions:e,x:t,y:r,width:n,height:s,rx:c,ry:l,effects:u,...h})=>{const p=o.toGeomEffectsStyle(u);return e?(0,i.jsx)(O.motion.rect,{initial:!1,animate:{attrX:t,attrY:r,width:n,height:s,...c!==void 0&&l!==void 0?{rx:c,ry:l}:{}},transition:o.DEFAULT_SPRING_TRANSITION,style:p,...h}):(0,i.jsx)("rect",{x:t,y:r,width:n,height:s,rx:c,ry:l,style:p,...h})},ue=({animateTransitions:e,d:t,source:r,effects:n,...s})=>{const c=o.toGeomEffectsStyle(n);return e?(0,i.jsx)(Ye,{d:t,source:r,style:c,...s}):(0,i.jsx)("path",{d:t,style:c,...s})},Ke=e=>{const{Circle:t}=o.useGeomShapes();return t===void 0?ae(e):(0,i.jsx)(o.GeomShapesProvider,{children:(0,i.jsx)(t,{...e})})},Fe=e=>{const{Line:t}=o.useGeomShapes();return t===void 0?le(e):(0,i.jsx)(o.GeomShapesProvider,{children:(0,i.jsx)(t,{...e})})},Ue=({cornerRadius:e,...t})=>{const{Rect:r}=o.useGeomShapes(),n=o.useGeomPanelPixelSize(),s=o.useGeomPixelsPerUnit(),c={...t,...We(e,t,n,s)};return r===void 0?ce(c):(0,i.jsx)(o.GeomShapesProvider,{children:(0,i.jsx)(r,{...c})})},ze=e=>{const{Path:t}=o.useGeomShapes();return t===void 0?ue(e):(0,i.jsx)(o.GeomShapesProvider,{children:(0,i.jsx)(t,{...e})})},Ye=({d:e,source:t,...r})=>{const n=o.useSvgPathMorph(e,o.DEFAULT_SPRING_TRANSITION,t);return(0,i.jsx)(O.motion.path,{d:n,...r})},We=(e,t,r,n)=>{if(e===void 0)return{};const s=Ve(t,r,n);if(s===null)return e==="full"?{}:Z((0,m.resolveGeomCornerRadiusPx)({cornerRadius:e}),n);const c=Math.min((0,m.resolveGeomCornerRadiusPx)({cornerRadius:e,box:s}),Math.min(s.width,s.height)/2);return Z(c,n)},Ve=(e,t,r)=>{const n=J(e.width,t?.width,r.x),s=J(e.height,t?.height,r.y);return n===null||s===null?null:{width:n,height:s}},J=(e,t,r)=>{if(typeof e=="number")return Number.isFinite(e)?Math.abs(e)*r:null;if(t===void 0)return null;const n=k(e,t);return n===null?null:Math.abs(n)},Z=(e,t)=>t.x<=0||t.y<=0?{rx:0,ry:0}:{rx:e/t.x,ry:e/t.y},Xe=({children:e,...t})=>{const r=o.useGeomPanelPixelSize();return(0,i.jsx)("svg",{viewBox:"0 0 1 1",preserveAspectRatio:"none",width:"100%",height:"100%",pointerEvents:"none",...t,children:(0,i.jsx)(o.GeomPanelSizeProvider,{size:r,space:"unit",children:e})})},Qe=({box:e,children:t})=>{const r=o.useGeomPanelSize(),n=r===null?null:r.width*(e.x1-e.x0),s=r===null?null:r.height*(e.y1-e.y0),c=(0,d.useMemo)(()=>n===null||s===null?null:{width:n,height:s},[n,s]);return(0,i.jsx)("svg",{x:(0,m.toPercent)(e.x0),y:(0,m.toPercent)(e.y0),width:(0,m.toPercent)(e.x1-e.x0),height:(0,m.toPercent)(e.y1-e.y0),overflow:"hidden",pointerEvents:"none",children:(0,i.jsx)(o.GeomPanelSizeProvider,{size:c,children:t})})},Je="drqe3u0",Ze="drqe3u1",et="drqe3u2",tt="drqe3u3",w="drqe3u4",rt="drqe3u5",nt="drqe3u6",st="drqe3u7",B="drqe3u8",ot="drqe3u9",it="drqe3ua";var at="drqe3uc",lt="drqe3ud",ct="drqe3ue",ut="drqe3uf";var dt="drqe3uh",ht="drqe3ui",ee={enabled:"drqe3uk drqe3uj",disabled:"drqe3ul drqe3uj"},te={ran:"drqe3un drqe3um",dim:"drqe3uo drqe3um"},de={ran:"drqe3uq drqe3up",cached:"drqe3ur drqe3up",untouched:"drqe3us drqe3up"},mt=({width:e=440,style:t,className:r}={})=>{const{compileBus:n}=o.useGraphContext(),[s]=(0,d.useState)(()=>Re()),[c,l]=(0,d.useState)(!1),[u,h]=(0,d.useState)(m.isCompilerCachingEnabled);(0,d.useEffect)(()=>{const{recordCompile:g}=s.getState(),S=n.getLastTrigger(),E=n.getLastCompile();return S&&E&&g(S,E),n.subscribe(g)},[s,n]);const p=(0,F.useStore)(s,g=>g.lastCompile),R=(0,F.useStore)(s,g=>g.history),P=n.getCacheStats(),x=p===null&&R.length===0,f=()=>{h(g=>{const S=!g;return(0,m.setCompilerCachingEnabled)(S),S})};return(0,i.jsxs)("div",{className:(0,U.default)(it,r),style:{width:e,...t},children:[(0,i.jsxs)("div",{className:Je,children:[(0,i.jsxs)("div",{children:[(0,i.jsx)("div",{className:Ze,children:"compile cache"}),(0,i.jsx)("div",{className:ct,children:x?"production: stats disabled":p?`last: ${p.label} · ${W(p.durationMs)}`:"awaiting first compile…"})]}),(0,i.jsx)("button",{type:"button",onClick:()=>l(g=>!g),className:ut,children:c?"▾":"▴"})]}),!c&&(0,i.jsxs)("div",{className:"drqe3ub",children:[(0,i.jsxs)("button",{type:"button",onClick:f,className:u?ee.enabled:ee.disabled,"aria-pressed":u,children:["cache ",u?"enabled":"disabled"]}),(0,i.jsx)("span",{className:"drqe3ug",children:"next compile reflects this toggle"})]}),!c&&!x&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(gt,{delta:p?.stages,durations:p?.stageDurationsMs,cumulative:P}),(0,i.jsx)(pt,{entries:R})]})]})},gt=({delta:e,durations:t,cumulative:r})=>(0,i.jsxs)("table",{className:et,children:[(0,i.jsx)("thead",{children:(0,i.jsxs)("tr",{className:dt,children:[(0,i.jsx)("th",{className:tt,children:"stage"}),(0,i.jsx)("th",{className:w,children:"time"}),(0,i.jsx)("th",{className:w,children:"Δ miss"}),(0,i.jsx)("th",{className:w,children:"Δ hit"}),(0,i.jsx)("th",{className:w,children:"total miss"}),(0,i.jsx)("th",{className:w,children:"total hit"})]})}),(0,i.jsx)("tbody",{children:m.COMPILER_STAGE_KEYS.map(n=>{const s=e?.[n],c=vt(s);return(0,i.jsxs)("tr",{className:at,children:[(0,i.jsxs)("td",{className:rt,children:[(0,i.jsx)("span",{className:de[c],"aria-hidden":!0})," ",n]}),(0,i.jsx)("td",{className:B,children:t===void 0||c==="untouched"?"—":W(t[n])}),(0,i.jsx)("td",{className:c==="ran"?te.ran:te.dim,children:s?.misses??0}),(0,i.jsx)("td",{className:B,children:s?.hits??0}),(0,i.jsx)("td",{className:B,children:r[n].misses}),(0,i.jsx)("td",{className:B,children:r[n].hits})]},n)})})]}),pt=({entries:e})=>e.length===0?null:(0,i.jsxs)("div",{className:lt,children:[(0,i.jsx)("div",{className:ht,children:"recent compiles"}),e.map(t=>{const r=ft(t.stages,c=>c.misses>0),n=m.COMPILER_STAGE_KEYS.length,s=r===0?"cached":"ran";return(0,i.jsxs)("div",{className:nt,children:[(0,i.jsx)("span",{className:de[s],"aria-hidden":!0}),(0,i.jsx)("span",{className:st,title:t.label,children:t.label}),(0,i.jsxs)("span",{className:ot,children:[r,"/",n," ran · ",W(t.durationMs)]})]},t.id)})]}),vt=e=>!e||e.hits===0&&e.misses===0?"untouched":e.misses>0?"ran":"cached",ft=(e,t)=>{let r=0;for(const n of m.COMPILER_STAGE_KEYS)t(e[n])&&(r+=1);return r},W=e=>e<.1?"<0.1ms":e>=10?`${e.toFixed(0)}ms`:`${e.toFixed(2)}ms`,St=()=>{const{history:e}=o.useGraphContext(),{stack:t,undo:r,redo:n}=e,s=(0,d.useCallback)(u=>t.subscribe(u),[t]),c=(0,d.useCallback)(()=>t.getSnapshot(),[t]),l=(0,d.useSyncExternalStore)(s,c,c);return(0,d.useMemo)(()=>({...l,undo:r,redo:n}),[l,r,n])},yt=new Set(["button","checkbox","color","file","hidden","image","radio","range","reset","submit"]),bt=(e,t={})=>{const{target:r,enabled:n=!0}=t;(0,d.useEffect)(()=>{const s=Gt(r);if(!n||!s)return;const c=l=>{if(!xt(l)||l.defaultPrevented||Et(l.target))return;const u=o.resolveHistoryStep(l);if(!u)return;const h=e.current;h&&(u==="undo"?h.undo():h.redo())&&l.preventDefault()};return s.addEventListener("keydown",c),()=>s.removeEventListener("keydown",c)},[e,r,n])},Gt=e=>e===void 0?window:e!==null&&"current"in e?e.current:e,xt=e=>"key"in e,Et=e=>e instanceof HTMLInputElement?!yt.has(e.type):e instanceof HTMLElement?e.isContentEditable||e.tagName==="TEXTAREA":!1,Tt=()=>{const{targetBoundaryStore:e}=o.useGraphContext();return(0,F.useStore)(e,t=>t.boundary)};exports.BrandMark=o.BrandMark;exports.CanvasTextMeasurer=o.CanvasTextMeasurer;exports.DefaultFooter=o.DefaultFooter;exports.DefaultGeomCircle=ae;exports.DefaultGeomLine=le;exports.DefaultGeomPath=ue;exports.DefaultGeomRect=ce;exports.DefaultGrid=o.DefaultGrid;exports.DefaultHeader=o.DefaultHeader;exports.DefaultSwatch=o.DefaultSwatch;exports.DefaultTooltip=o.DefaultTooltip;exports.DevToolsPanel=mt;exports.GRAPH_MODES=o.GRAPH_MODES;exports.GeomCircle=Ke;exports.GeomLine=Fe;exports.GeomOverpaint=o.GeomOverpaint;exports.GeomPath=ze;exports.GeomRect=Ue;exports.GraphErrorBoundary=re;exports.GraphErrorPanel=z;exports.GraphProvider=ie;exports.GraphRenderer=o.GraphRenderer;exports.HoverProvider=o.HoverProvider;exports.IntroFade=o.IntroFade;exports.IntroWipeClip=o.IntroWipeClip;exports.TextMeasurerProvider=o.TextMeasurerProvider;exports.ThemeProvider=o.ThemeProvider;exports.UnitBoxSvg=Qe;exports.UnitSpaceSvg=Xe;exports.buildDotsEditOutlineShapes=o.buildDotsEditOutlineShapes;exports.createGraphyKit=Be;exports.darkTheme=o.darkTheme;exports.defineGeomRenderer=o.defineGeomRenderer;exports.lightTheme=o.lightTheme;exports.lightenCss=o.lightenCss;exports.projectPointCartesian=o.projectPointCartesian;exports.pruneSelection=oe;exports.readPositionPixels=k;exports.readRectPixels=Oe;exports.resolveBrandMarkVisual=o.resolveBrandMarkVisual;exports.resolvePathStroke=o.resolvePathStroke;exports.scalePointToPanel=o.scalePointToPanel;exports.stampAxisEditTarget=o.stampAxisEditTarget;exports.stampGridEditTarget=o.stampGridEditTarget;exports.stampLegendEditTarget=o.stampLegendEditTarget;exports.useElementScreenRect=o.useElementScreenRect;exports.useGeomHitTest=o.useGeomHitTest;exports.useGeomHover=o.useGeomHover;exports.useGeomPanelSize=o.useGeomPanelSize;exports.useGeomReaderTree=o.useGeomReaderTree;exports.useGeomStyleReader=o.useGeomStyleReader;exports.useGraphCommands=o.useGraphCommands;exports.useGraphHandle=o.useGraphHandle;exports.useGraphHistory=St;exports.useGraphHistoryShortcuts=bt;exports.useGraphLocale=o.useGraphLocale;exports.useGraphSelection=o.useGraphSelection;exports.useGuidesTakePress=o.useGuidesTakePress;exports.useHandleScene=o.useHandleScene;exports.useHoverState=o.useHoverState;exports.usePaintDefs=o.usePaintDefs;exports.useResolvedStyle=o.useResolvedStyle;exports.useSceneSelector=o.useSceneSelector;exports.useStyleReaderTree=o.useStyleReaderTree;exports.useStyleResolver=o.useStyleResolver;exports.useTargetBoundary=Tt;exports.useTextMeasurer=o.useTextMeasurer;exports.vars=o.vars;
package/dist/index.d.ts CHANGED
@@ -240,7 +240,7 @@ declare const createTargetBoundaryStore: () => StoreApi<TargetBoundaryStoreState
240
240
  export declare const darkTheme: string;
241
241
 
242
242
  /** Default paint for the footer region — caption, source line, and optional footer-anchored badge. */
243
- export declare const DefaultFooter: ({ ref, footerRect, mode, caption, isCaptionVisible, source, isSourceVisible, captionStyle, sourceStyle, brandMark, }: FooterSlotProps) => JSX.Element | null;
243
+ export declare const DefaultFooter: ({ ref, footerRect, mode, caption, showCaption, source, showSource, captionStyle, sourceStyle, brandMark, }: FooterSlotProps) => JSX.Element | null;
244
244
 
245
245
  /**
246
246
  * A circle that follows a data change the way a built-in geom's marks do: its center and radius
@@ -251,23 +251,23 @@ export declare const DefaultFooter: ({ ref, footerRect, mode, caption, isCaption
251
251
  * at its position rather than traveling to it from an unset attribute at the panel's origin. An
252
252
  * entrance is the layer's to play, through {@link IntroFade} or {@link IntroWipeClip}.
253
253
  */
254
- export declare const DefaultGeomCircle: ({ shouldAnimateTransitions, cx, cy, r, effects, ...paint }: GeomCircleProps) => JSX.Element;
254
+ export declare const DefaultGeomCircle: ({ animateTransitions, cx, cy, r, effects, ...paint }: GeomCircleProps) => JSX.Element;
255
255
 
256
256
  /** A straight line whose endpoints spring to their new positions — {@link GeomCircle} for a segment. */
257
- export declare const DefaultGeomLine: ({ shouldAnimateTransitions, x1, y1, x2, y2, effects, ...paint }: GeomLineProps) => JSX.Element;
257
+ export declare const DefaultGeomLine: ({ animateTransitions, x1, y1, x2, y2, effects, ...paint }: GeomLineProps) => JSX.Element;
258
258
 
259
259
  /**
260
260
  * A path whose shape morphs to its new one — {@link GeomCircle} for a free shape, such as a polygon between two
261
261
  * bars. A path is drawn in pixels, so it takes the layer it is drawn from as `source`: a resize redraws it where
262
262
  * the percentage marks already are, rather than morphing behind them.
263
263
  */
264
- export declare const DefaultGeomPath: ({ shouldAnimateTransitions, d, source, effects, ...paint }: GeomPathProps) => JSX.Element;
264
+ export declare const DefaultGeomPath: ({ animateTransitions, d, source, effects, ...paint }: GeomPathProps) => JSX.Element;
265
265
 
266
266
  /**
267
267
  * A rect whose origin, size and corners spring to their new values — {@link GeomCircle} for a box. Motion reads `x`
268
268
  * and `y` on an SVG element as a transform, so the origin springs through `attrX` and `attrY`, the attributes.
269
269
  */
270
- export declare const DefaultGeomRect: ({ shouldAnimateTransitions, x, y, width, height, rx, ry, effects, ...paint }: GeomRectShapeProps) => JSX.Element;
270
+ export declare const DefaultGeomRect: ({ animateTransitions, x, y, width, height, rx, ry, effects, ...paint }: GeomRectShapeProps) => JSX.Element;
271
271
 
272
272
  /**
273
273
  * Default paint for the grid region — per-tick grid lines, drawn inside the panel frame rect. Where a press
@@ -279,7 +279,7 @@ export declare const DefaultGeomRect: ({ shouldAnimateTransitions, x, y, width,
279
279
  export declare const DefaultGrid: ({ axes, panelBorderSizes, panelFrameRect, panelRect }: GridSlotProps) => JSX.Element;
280
280
 
281
281
  /** Default paint for the header region — title, subtitle, and optional header-anchored badge. */
282
- export declare const DefaultHeader: ({ ref, headerRect, mode, title, isTitleVisible, subtitle, isSubtitleVisible, headingStyle, subtitleStyle, brandMark, }: HeaderSlotProps) => JSX.Element | null;
282
+ export declare const DefaultHeader: ({ ref, headerRect, mode, title, showTitle, subtitle, showSubtitle, headingStyle, subtitleStyle, brandMark, }: HeaderSlotProps) => JSX.Element | null;
283
283
 
284
284
  /** The built-in drawing of each {@link SwatchShape}. */
285
285
  export declare const DefaultSwatch: ({ shape, color, paint, lineType, width, height, strokeWidth, alpha, cornerRadius, symbol, mainAxis, }: Omit<SwatchSlotProps, "surface" | "label">) => JSX.Element;
@@ -344,7 +344,7 @@ export declare interface EditorSurfaceSlotProps {
344
344
  /** The axes as the chart paints them, whose ticks a stamped tick index addresses. */
345
345
  formattedAxes: readonly FormattedAxis[];
346
346
  /** Whether the chart animates between states, so what the editor draws over its geoms can follow. */
347
- shouldAnimateTransitions: boolean;
347
+ animateTransitions: boolean;
348
348
  }
349
349
 
350
350
  /** Round marks of one size, which the outline grows from their rim. */
@@ -381,7 +381,7 @@ declare interface EditOutlineShapesInput<G extends GeomName | string = string, C
381
381
  /** Cascade readers for this layer, for the sizes a shape matches: a line's width, a point's size. */
382
382
  styleReaders: StyleReadersOf<G>;
383
383
  /** Whether the chart animates transitions, for a shape to copy where the geom's paint springs. */
384
- shouldAnimateTransitions: boolean;
384
+ animateTransitions: boolean;
385
385
  }
386
386
 
387
387
  /** A stroke, which the outline grows from either side of its thickness. */
@@ -404,9 +404,9 @@ export declare interface FooterSlotProps {
404
404
  footerRect: Rect;
405
405
  mode?: GraphMode;
406
406
  caption: TextContent | null;
407
- isCaptionVisible: boolean;
407
+ showCaption: boolean;
408
408
  source: SourceContent | null;
409
- isSourceVisible: boolean;
409
+ showSource: boolean;
410
410
  captionStyle: TextStyle;
411
411
  sourceStyle: SourceStyle;
412
412
  /**
@@ -439,7 +439,7 @@ export declare interface GeomCircleProps {
439
439
  /** Shadow, blend mode and filters from `readGeomEffects`. The resting shadow is `'none'` when the layer casts it. */
440
440
  effects?: GeomEffects;
441
441
  /** Whether a change of center or radius springs to the new one. Snaps when false. */
442
- shouldAnimateTransitions: boolean;
442
+ animateTransitions: boolean;
443
443
  /** A geom's own test hook, since the primitive owns the painted element. */
444
444
  'data-testid'?: string;
445
445
  }
@@ -485,7 +485,7 @@ export declare interface GeomLineProps {
485
485
  /** Shadow, blend mode and filters from `readGeomEffects`. The resting shadow is `'none'` when the layer casts it. */
486
486
  effects?: GeomEffects;
487
487
  /** Whether a change of either endpoint springs to the new one. Snaps when false. */
488
- shouldAnimateTransitions: boolean;
488
+ animateTransitions: boolean;
489
489
  'data-testid'?: string;
490
490
  }
491
491
 
@@ -552,7 +552,7 @@ export declare interface GeomPathProps {
552
552
  /** Shadow, blend mode and filters from `readGeomEffects`. The resting shadow is `'none'` when the layer casts it. */
553
553
  effects?: GeomEffects;
554
554
  /** Whether a change of shape morphs to the new one. Snaps when false. */
555
- shouldAnimateTransitions: boolean;
555
+ animateTransitions: boolean;
556
556
  'data-testid'?: string;
557
557
  }
558
558
 
@@ -574,7 +574,7 @@ export declare interface GeomRectProps {
574
574
  /** Shadow, blend mode and filters from `readGeomEffects`. The resting shadow is `'none'` when the layer casts it. */
575
575
  effects?: GeomEffects;
576
576
  /** Whether a change of origin or size springs to the new one. Snaps when false. */
577
- shouldAnimateTransitions: boolean;
577
+ animateTransitions: boolean;
578
578
  'data-testid'?: string;
579
579
  }
580
580
 
@@ -690,7 +690,7 @@ export declare type GeomRenderFn<G extends GeomName | string = string, C extends
690
690
  declare interface GeomRenderInput<G extends GeomName | string = string, C extends CoordKind = CoordKind> extends GeomRenderInputBase {
691
691
  layer: SceneLayerOf<G>;
692
692
  coordSystem: CoordSystemFor<C>;
693
- shouldAnimateTransitions: boolean;
693
+ animateTransitions: boolean;
694
694
  formattingLocale: Locale;
695
695
  intro?: LayerIntroPlan | null;
696
696
  /**
@@ -1056,9 +1056,9 @@ export declare interface HeaderSlotProps {
1056
1056
  headerRect: Rect;
1057
1057
  mode?: GraphMode;
1058
1058
  title: TextContent | null;
1059
- isTitleVisible: boolean;
1059
+ showTitle: boolean;
1060
1060
  subtitle: TextContent | null;
1061
- isSubtitleVisible: boolean;
1061
+ showSubtitle: boolean;
1062
1062
  headingStyle: TextStyle;
1063
1063
  subtitleStyle: TextStyle;
1064
1064
  /**
@@ -1079,7 +1079,7 @@ export declare interface HeadlineSlotProps {
1079
1079
  * Whether this figure sits in the donut hole. Strip polar totals reuse the grand-total class, so
1080
1080
  * paint cannot infer the hole from CSS — only the placement input knows.
1081
1081
  */
1082
- isInDonutHole?: boolean;
1082
+ inDonutHole?: boolean;
1083
1083
  }
1084
1084
 
1085
1085
  /**
@@ -1148,12 +1148,12 @@ declare interface HoverSlice {
1148
1148
  */
1149
1149
  pointerRegions: readonly PointerRegion[];
1150
1150
  /** A gesture owns the pointer: the tracker runs no query, so nothing recomputes behind it. */
1151
- isPointerSuspended: boolean;
1151
+ suspendsHover: boolean;
1152
1152
  /**
1153
1153
  * An editing surface makes the one query a frame and writes the hover itself: the tracker keeps the
1154
1154
  * viewport and runs no query, so a chart with no such surface mounted keeps its own.
1155
1155
  */
1156
- isQueryOwnedByEditor: boolean;
1156
+ editorOwnsQuery: boolean;
1157
1157
  }
1158
1158
 
1159
1159
  declare interface HoverStoreActions {
@@ -1164,8 +1164,8 @@ declare interface HoverStoreActions {
1164
1164
  * without clobbering each other; an empty list retracts the publisher entirely.
1165
1165
  */
1166
1166
  publishPointerRegions: (publisher: string, regions: readonly PointerRegion[]) => void;
1167
- setPointerSuspended: (next: boolean) => void;
1168
- setQueryOwnedByEditor: (next: boolean) => void;
1167
+ setSuspendsHover: (next: boolean) => void;
1168
+ setEditorOwnsQuery: (next: boolean) => void;
1169
1169
  }
1170
1170
 
1171
1171
  /** State of the hover store: the current {@link HoverState} plus its setter. */
@@ -1278,7 +1278,7 @@ declare interface MorphingEditOutlineShape {
1278
1278
  /** Identifies the shape across renders, such as a line's group, so a morph starts from where it was. */
1279
1279
  key?: string;
1280
1280
  /** Whether a change of shape morphs to the new one, as the geom's paint does. Snaps when omitted. */
1281
- shouldAnimateTransitions?: boolean;
1281
+ animateTransitions?: boolean;
1282
1282
  }
1283
1283
 
1284
1284
  declare interface ObservationRectInput<G extends GeomName | string = string, C extends CoordKind = CoordKind> {
@@ -1384,7 +1384,7 @@ export declare interface ResizeObserverState {
1384
1384
  width: number;
1385
1385
  height: number;
1386
1386
  /** True until the first ResizeObserver measurement lands. */
1387
- isDefault: boolean;
1387
+ unmeasured: boolean;
1388
1388
  }
1389
1389
 
1390
1390
  export declare const resolveBrandMarkVisual: (enabled: boolean, frameSize: {
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { An as te, At as or, Bt as ar, Cn as ir, Dn as cr, Dt as lr, En as dr, Ft as Z, H as ur, Ht as Ne, Kt as mr, M as hr, Mt as gr, N as pr, Nn as J, Nt as vr, On as fr, Qt as yr, R as Sr, Rt as Ge, Sn as br, Tn as Er, Tt as Tr, Ut as Rr, V as Nr, Vt as Y, Xt as Gr, Yt as Cr, Zt as Dr, _n as z, _t as wr, a as Pr, an as qr, at as Ir, cn as _r, ct as kr, dn as fe, fn as Ce, gn as De, h as Lr, hn as Mr, i as xr, j as $r, jn as we, jt as Hr, kn as Pe, ln as ye, mn as W, mt as Ar, n as Br, nn as Or, ot as Kr, pn as qe, qt as Ie, r as Fr, s as jr, t as _e, un as A, vn as V, vt as Ur, w as Yr, wn as zr, xn as Wr, yn as Vr, z as Xr, zt as ke } from "./history-chords-BIeYhK4y.js";
1
+ import { An as te, At as or, Bt as ar, Cn as ir, Dn as cr, Dt as lr, En as dr, Ft as Z, H as ur, Ht as Ne, Kt as mr, M as hr, Mt as gr, N as pr, Nn as J, Nt as vr, On as fr, Qt as yr, R as Sr, Rt as Ge, Sn as br, Tn as Er, Tt as Tr, Ut as Rr, V as Nr, Vt as Y, Xt as Gr, Yt as Cr, Zt as Dr, _n as z, _t as wr, a as Pr, an as qr, at as Ir, cn as _r, ct as kr, dn as fe, fn as Ce, gn as De, h as Lr, hn as Mr, i as xr, j as $r, jn as we, jt as Hr, kn as Pe, ln as ye, mn as W, mt as Ar, n as Br, nn as Or, ot as Kr, pn as qe, qt as Ie, r as Fr, s as jr, t as _e, un as A, vn as V, vt as Ur, w as Yr, wn as zr, xn as Wr, yn as Vr, z as Xr, zt as ke } from "./history-chords-Kybi2Tvr.js";
2
2
  import { COMPILER_STAGE_KEYS as re, Geom as Le, GraphCompilationSession as Me, areEditTargetsEqual as xe, buildDiagnostic as oe, createAnchorResolver as $e, createCompiler as He, createDataLabelPlacementResolver as Ae, createSpecBuilder as Be, createStyleResolver as Se, findAnnotation as Oe, findLayerById as ae, isCompilerCachingEnabled as Ke, resolveDefinition as Fe, resolveGeomCornerRadiusPx as ie, setCompilerCachingEnabled as je, toPercent as j } from "@graphysdk/viz-engine";
3
3
  import { Component as Ue, useCallback as v, useEffect as H, useId as Ye, useImperativeHandle as ze, useMemo as _, useRef as ce, useState as b, useSyncExternalStore as We } from "react";
4
4
  import { Fragment as Ve, jsx as c, jsxs as f } from "react/jsx-runtime";
@@ -392,7 +392,7 @@ var Nt = (e) => ne((t) => ({
392
392
  if (!o) return;
393
393
  o.committedSpec && G.current?.(o.committedSpec);
394
394
  const h = N(o.result);
395
- k(q(h)), h && w(h), P(E(o.result)), h || u.emit({ kind: o.specChanged ? "spec" : "data" });
395
+ k(q(h)), h && w(h), P(E(o.result)), h || u.emit({ kind: o.hasSpecChange ? "spec" : "data" });
396
396
  }, [
397
397
  e,
398
398
  t,
@@ -568,7 +568,7 @@ var $ = (e, t) => {
568
568
  width: l,
569
569
  height: d
570
570
  };
571
- }, wt = ({ shouldAnimateTransitions: e, cx: t, cy: r, r: n, effects: s, ...i }) => {
571
+ }, wt = ({ animateTransitions: e, cx: t, cy: r, r: n, effects: s, ...i }) => {
572
572
  const a = V(s);
573
573
  return e ? /* @__PURE__ */ c(X.circle, {
574
574
  initial: !1,
@@ -587,7 +587,7 @@ var $ = (e, t) => {
587
587
  style: a,
588
588
  ...i
589
589
  });
590
- }, Pt = ({ shouldAnimateTransitions: e, x1: t, y1: r, x2: n, y2: s, effects: i, ...a }) => {
590
+ }, Pt = ({ animateTransitions: e, x1: t, y1: r, x2: n, y2: s, effects: i, ...a }) => {
591
591
  const l = V(i);
592
592
  return e ? /* @__PURE__ */ c(X.line, {
593
593
  initial: !1,
@@ -608,7 +608,7 @@ var $ = (e, t) => {
608
608
  style: l,
609
609
  ...a
610
610
  });
611
- }, qt = ({ shouldAnimateTransitions: e, x: t, y: r, width: n, height: s, rx: i, ry: a, effects: l, ...d }) => {
611
+ }, qt = ({ animateTransitions: e, x: t, y: r, width: n, height: s, rx: i, ry: a, effects: l, ...d }) => {
612
612
  const m = V(l);
613
613
  return e ? /* @__PURE__ */ c(X.rect, {
614
614
  initial: !1,
@@ -635,7 +635,7 @@ var $ = (e, t) => {
635
635
  style: m,
636
636
  ...d
637
637
  });
638
- }, It = ({ shouldAnimateTransitions: e, d: t, source: r, effects: n, ...s }) => {
638
+ }, It = ({ animateTransitions: e, d: t, source: r, effects: n, ...s }) => {
639
639
  const i = V(n);
640
640
  return e ? /* @__PURE__ */ c(_t, {
641
641
  d: t,
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "visualization",
12
12
  "renderer"
13
13
  ],
14
- "version": "1.9.0-beta.1792505847409",
14
+ "version": "1.9.0-beta.1792510459918",
15
15
  "type": "module",
16
16
  "sideEffects": [
17
17
  "**/*.css.ts",
@@ -50,7 +50,7 @@
50
50
  "react-colorful": "^5.6.1",
51
51
  "react-intl": "^8.1.3",
52
52
  "zustand": "^5.0.12",
53
- "@graphysdk/viz-engine": "1.9.0-beta.1792505847409"
53
+ "@graphysdk/viz-engine": "1.9.0-beta.1792510459918"
54
54
  },
55
55
  "peerDependencies": {
56
56
  "@tiptap/core": "^3.0.0",
@@ -150,10 +150,10 @@
150
150
  "vite-plugin-dts": "^4.5.4",
151
151
  "vite-plugin-lib-inject-css": "^2.2.2",
152
152
  "vitest": "^4.1.11",
153
- "@graphytools/eslint-config": "0.0.1",
154
153
  "@graphytools/eslint-plugin-graphy": "1.0.0",
155
154
  "@graphytools/typescript-config": "0.0.1",
156
- "@graphytools/vitest-config": "1.0.0"
155
+ "@graphytools/vitest-config": "1.0.0",
156
+ "@graphytools/eslint-config": "0.0.1"
157
157
  },
158
158
  "publishConfig": {
159
159
  "access": "public"