@graphysdk/react-renderer 1.9.0-beta.1792138483515 → 1.9.0-beta.1792147641623

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 a=require("./history-chords-lMmZCe5X.cjs");let h=require("@graphysdk/viz-engine"),u=require("react"),o=require("react/jsx-runtime"),F=require("zustand"),B=require("motion/react"),W=require("zustand/vanilla"),Y=require("clsx");Y=a.__toESM(Y,1);var ge="_1a5iqpb0",pe="_1a5iqpb1";var ve="_1a5iqpb3",fe="_1a5iqpb4",Se="_1a5iqpb5";var V=({errors:e})=>{const[t,...r]=e;return(0,o.jsxs)("div",{role:"alert",className:ge,children:[(0,o.jsx)("strong",{className:pe,children:"This chart could not be rendered."}),t&&(0,o.jsx)(X,{diagnostic:t}),r.length>0&&(0,o.jsx)("ul",{className:"_1a5iqpb2",children:r.map((s,n)=>(0,o.jsx)("li",{children:(0,o.jsx)(X,{diagnostic:s})},`${s.code}-${n}`))})]})},X=({diagnostic:e})=>(0,o.jsxs)("div",{className:ve,children:[(0,o.jsx)("span",{className:fe,children:e.code}),(0,o.jsx)("p",{className:Se,children:e.message}),e.suggestion&&(0,o.jsx)("p",{className:"_1a5iqpb6",children:e.suggestion})]});function ye(e=[],t=[]){return e.length===t.length&&e.every((r,s)=>Object.is(r,t[s]))}var te=class extends u.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);a.logDiagnostics([r]),this.props.onError?.([r]),console.error("Chart render component stack:",t.componentStack)}componentDidUpdate(e){this.state.caughtDiagnostic&&!ye(e.resetKeys,this.props.resetKeys)&&this.setState({caughtDiagnostic:null})}render(){const{caughtDiagnostic:e}=this.state;if(e)return(0,o.jsx)(V,{errors:[e]});const{forcedErrors:t,children:r}=this.props;return t&&t.length>0?(0,o.jsx)(V,{errors:t}):r}},re={},se=(0,u.createContext)(re),w=({shapes:e=re,children:t})=>(0,o.jsx)(se.Provider,{value:e,children:t}),K=()=>(0,u.useContext)(se),ne=e=>typeof e=="object"&&"geom"in e&&"render"in e,oe=e=>{const t=(0,h.resolveDefinition)(e);return t instanceof h.Geom?t:null},ae=(e,t)=>{const r=e.filter(s=>be(s,t));return r.length===e.length?e:r},be=(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,Q=[],Ee=()=>(0,W.createStore)(e=>({selection:Q,setSelection:t=>e(r=>Te(r.selection,t)?r:{selection:t}),clearSelection:()=>e(t=>t.selection.length===0?t:{selection:Q})})),Te=(e,t)=>e===t?!0:e.length!==t.length?!1:e.every((r,s)=>{const n=t[s];return n!==void 0&&(0,h.areEditTargetsEqual)(r,n)}),xe=process.env.NODE_ENV!=="production",Ge=5,Re=e=>{if(!xe)return{emit:()=>{},subscribe:()=>je,getLastTrigger:()=>null,getLastCompile:()=>null,getCacheStats:()=>e.getCacheStats()};const t=new Set;let r=null;return{emit:s=>{const n=e.getLastCompile();if(n){r=s;for(const l of t)l(s,n)}},subscribe:s=>(t.add(s),()=>{t.delete(s)}),getLastTrigger:()=>r,getLastCompile:()=>e.getLastCompile(),getCacheStats:()=>e.getCacheStats()}},Ce=()=>(0,W.createStore)(e=>({lastCompile:null,history:[],nextId:1,lastSnapshot:null,recordCompile:(t,r)=>e(s=>{if(s.lastSnapshot===r)return s;const n={id:s.nextId,label:Ne(t),stages:r.stages,stageDurationsMs:r.stageDurationsMs,durationMs:r.durationMs};return{lastCompile:n,history:De(s.history,n,Ge),nextId:s.nextId+1,lastSnapshot:r}})})),je=()=>{},Ne=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}},De=(e,t,r)=>{const s=e.length>=r?e.length-(r-1):0;return[...e.slice(s),t]};function Pe(e,t){let r;return e.layers.flatMap((s,n)=>a.isOverlayHosted(t(s.geom,e.coordSystem.type))?Me(s)?(r??=(0,h.createStyleResolver)().readers(e),He(s,r.geom(s))?[{kind:"user-input",severity:"warning",code:"INVALID_STYLE_RULE",message:`Style 'overlay' is not supported on portal-rendered geom '${s.geom}' (layer '${s.id}'); it is ignored.`,context:{param:"overlay",layerIndex:n,requested:s.geom},suggestion:"Remove the geom overlay or use a renderer that paints inside the panel SVG."}]:[]):[]:[])}function J(e){const t=e.filter(ne),r=new Set([...Object.keys(a.BUILT_IN_GEOM_RENDERERS),...t.map(d=>d.geom)]),s=[],n=new Set;for(const d of e){const m=oe(d);m===null||r.has(m.type)||n.has(m.type)||(n.add(m.type),s.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 l=new Map;for(const d of t){if("definition"in d)continue;const m=`${d.geom}|${d.coord}`,f=l.get(m);f?f.count+=1:l.set(m,{geom:d.geom,coord:d.coord,count:1})}const c=[];for(const{geom:d,coord:m,count:f}of l.values())f<2||c.push({kind:"user-input",severity:"warning",code:"DUPLICATE_REGISTERED_TYPE",message:`Multiple render-only overrides register ('${d}', '${m}') (${f} entries); the last in the array wins.`,context:{requested:`${d}@${m}`,kind:"geom-renderer"},suggestion:`Keep a single render-only override for ('${d}', '${m}').`});return c.push(...Ae(e)),{errors:s,warnings:c}}function _e(e,t){const{coordSystem:r,layers:s}=e,n=new Set,l=[];for(const c of s)t(c.geom,r.type)!==null||n.has(c.geom)||(n.add(c.geom),l.push({kind:"user-input",severity:"warning",code:"MISSING_GEOM_RENDERER",message:`No renderer for geom '${c.geom}' under ${r.type} coords; the layer is not painted.`,context:{requested:c.geom,kind:"geom-renderer"},suggestion:`Register a renderer for ('${c.geom}', '${r.type}') via \`defineGeomRenderer\`.`}));return l}function ke(e,t){const{coordSystem:r,layers:s}=e,n=new Set,l=[];for(const c of s){if(c.interactive===!1||c.spatialKind!=="render-hit-test"||n.has(c.geom))continue;const d=t(c.geom,r.type);d===null||d.hitTest||a.isOverlayHosted(d)||(n.add(c.geom),l.push({kind:"user-input",severity:"warning",code:"MISSING_RENDER_HIT_TEST",message:`Geom '${c.geom}' declares spatialKind 'render-hit-test' but its renderer provides no hit-test; the layer has no hover.`,context:{requested:c.geom,kind:"geom-renderer"},suggestion:`Add a \`hitTest\` factory (precomputed geometry) or an overlay render (\`{ fn, options: { overlay: true } }\`, live simulation) to the renderer for ('${c.geom}', '${r.type}').`}))}return l}function Ie(e){const t=new Set,r=[];for(const s of e.layers){const n=s.identityKey;s.interactive!==!1&&(s.spatialKind!=="render-hit-test"||typeof n!="object"||t.has(s.geom)||s.data.hasVariable(n.variable)||(t.add(s.geom),r.push({kind:"user-input",severity:"warning",code:"RENDER_HIT_TEST_IDENTITY",message:`Geom '${s.geom}' keys its identity on '${n.variable}', a column its compile output does not emit; its hover lookup is empty.`,context:{requested:s.geom,kind:"geom-renderer"},suggestion:`Emit the '${n.variable}' column from the geom's \`compile()\`, or point \`identityKey\` at a column it does emit.`})))}return r}function qe(e,t){const{coordSystem:r,layers:s}=e,n=new Set,l=[];for(const c of s){if(c.interactive===!1||c.spatialKind!=="render-hit-test"||n.has(c.geom))continue;const d=t(c.geom,r.type);d===null||!d.hitTest||!a.isOverlayHosted(d)||(n.add(c.geom),l.push({kind:"user-input",severity:"warning",code:"CONFLICTING_RENDER_HIT_TEST",message:`Geom '${c.geom}' declares both a \`hitTest\` factory and an overlay render; these are alternatives, so only the overlay is used.`,context:{requested:c.geom,kind:"geom-renderer"},suggestion:"Keep one: a `hitTest` factory for precomputed geometry, OR an overlay render (`{ fn, options: { overlay: true } }`) for a live simulation."}))}return l}function Le(e,t){const r=new Set,s=[];for(const n of e.layers)n.interactive!==!1&&(n.spatialKind!=="render-hit-test"||r.has(n.geom)||t.hasCapability(n.geom)||(r.add(n.geom),s.push({kind:"user-input",severity:"warning",code:"MISSING_ANCHOR_CAPABILITY",message:`Geom '${n.geom}' declares no \`resolveAnchorPosition\`; its observations cannot be annotated, so the editor overlay paints no creation trigger on them.`,context:{requested:n.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 s}function we(e,t){const{coordSystem:r,layers:s}=e,n=new Set,l=[];for(const c of s){if(c.interactive===!1||c.spatialKind==="render-hit-test"||n.has(c.geom))continue;const d=t(c.geom,r.type);d===null||!a.isOverlayHosted(d)||(n.add(c.geom),l.push({kind:"user-input",severity:"warning",code:"OVERLAY_REQUIRES_RENDER_HIT_TEST",message:`Geom '${c.geom}' declares an overlay render but its layer's spatialKind is '${c.spatialKind}', not 'render-hit-test'; the overlay's push-path hover resolves to nothing.`,context:{requested:c.geom,kind:"geom-renderer"},suggestion:"Have the geom's manifest yield spatialKind 'render-hit-test' so the scene layer carries the `byKey` index the overlay's `pushHover` resolves against."}))}return l}var Me=e=>[e.styles.defaults,e.styles.overrides].some(t=>t.some(r=>(r.declarations.overlay?.length??0)>0)),He=(e,t)=>{const[r]=e.data;if(r===void 0)return!1;if((t.get("overlay",r)?.length??0)>0)return!0;for(const s of e.data)if((t.get("overlay",s,"hovered")?.length??0)>0)return!0;return!1};function Ae(e){const t=new Set,r=[];for(const s of e){const n=oe(s);n===null||t.has(n.type)||n.dataLabelCoordTypes.length===0||n.getDataLabelPlacements!==void 0||(t.add(n.type),r.push({kind:"user-input",severity:"warning",code:"MISSING_DATA_LABEL_PLACEMENT",message:`Geom '${n.type}' declares \`dataLabelCoordTypes\` but implements no \`getDataLabelPlacements\`; its layers paint no data labels.`,context:{requested:n.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 Oe=e=>(0,W.createStore)(t=>({scene:e,setScene:r=>t(s=>s.scene===r?s:{scene:r})})),$e=({spec:e,data:t,colorScheme:r,plugins:s,theme:n,resolveRenderer:l,anchorResolver:c,onSpecChange:d,onError:m,onWarnings:f})=>{const R=a.useLatestRef(d),C=a.useLatestRef(m),T=a.useLatestRef(f),[{session:v,compileBus:g}]=(0,u.useState)(()=>{const i=(0,h.createCompiler)({plugins:s,theme:n});return{session:new h.GraphCompilationSession(i),compileBus:Re(i)}}),[S]=(0,u.useState)(()=>{const i=J(s??[]),p=J(n?.plugins??[]);return{errors:[...p.errors,...i.errors],warnings:[...p.warnings,...i.warnings]}}),x=(0,u.useRef)(null),[y]=(0,u.useState)(Be),j=(0,u.useRef)(null),P=(0,u.useCallback)(i=>S.errors.length===0?i:[...S.errors,...i??[]],[S]),G=(0,u.useCallback)(i=>{if(!i.ok)return i.errors;if(j.current)j.current.getState().setScene(i.scene);else{const p=Oe(i.scene);p.subscribe(y.notify),j.current=p,y.notify()}return null},[y]),[M,k]=(0,u.useState)(()=>{const i=v.compile({spec:e,data:t,colorScheme:r});return x.current=i,P(G(i))}),E=(0,u.useCallback)(i=>i.ok?[...i.warnings,..._e(i.scene,l),...ke(i.scene,l),...Ie(i.scene),...qe(i.scene,l),...we(i.scene,l),...Pe(i.scene,l),...Le(i.scene,c)]:i.warnings,[l,c]),N=(0,u.useCallback)(i=>{i.length!==0&&(a.logDiagnostics(i),C.current?.(i))},[C]),D=(0,u.useCallback)(i=>{i.length!==0&&(a.logDiagnostics(i),T.current?.(i))},[T]);(0,u.useEffect)(()=>{const i=x.current;i&&(N([...S.errors,...i.ok?[]:i.errors]),D([...S.warnings,...E(i)]),i.ok&&g.emit({kind:"init"}))},[g,N,D,S,E]),(0,u.useEffect)(()=>{const i=v.update({spec:e,data:t,colorScheme:r});if(!i)return;i.committedSpec&&R.current?.(i.committedSpec);const p=G(i.result);k(P(p)),p&&N(p),D(E(i.result)),p||g.emit({kind:i.specChanged?"spec":"data"})},[e,t,r,v,g,G,N,D,P,E,R]);const I=(0,u.useCallback)(i=>{k(p=>p===null?p:P(null)),D(E(i))},[P,D,E]),H=(0,u.useCallback)(i=>{i.scene&&j.current?.getState().setScene(i.scene),i.result&&I(i.result),i.command&&g.emit({kind:"command",command:i.command}),i.spec&&R.current?.(i.spec),i.errors&&N([...i.errors])},[I,g,R,N]),b=(0,u.useCallback)(i=>{for(const p of i)H(p);return i.some(p=>!!p.scene)},[H]),A=(0,u.useCallback)((i,p)=>{b(v.applyCommand(i,p))},[v,b]),_=(0,u.useCallback)(()=>{b(v.commit())},[v,b]),O=(0,u.useCallback)(()=>b(v.undo()),[v,b]),q=(0,u.useCallback)(()=>b(v.redo()),[v,b]),U=(0,u.useMemo)(()=>({stack:v.history,undo:O,redo:q}),[v,O,q]),he=(0,u.useCallback)(()=>j.current?.getState().scene??null,[]);return{store:j.current,dispatch:A,commit:_,history:U,subscribe:y.subscribe,getScene:he,compileBus:g,compileErrors:M}},Be=()=>{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:s,formattingLocale:n,handleRef:l,onSpecChange:c,onError:d,onWarnings:m,colorScheme:f="light",children:R})=>{const[C]=(0,u.useState)(()=>s),T=C?.colorScheme??f,[v]=(0,u.useState)(()=>a.createGeomRendererResolver([...C?.plugins??[],...r].filter(ne))),g=(0,u.useId)(),[S]=(0,u.useState)(()=>(0,h.createAnchorResolver)(r)),[x]=(0,u.useState)(()=>(0,h.createDataLabelPlacementResolver)(r)),[y]=(0,u.useState)(()=>Ee()),[j]=(0,u.useState)(()=>a.createTargetBoundaryStore()),P=(0,u.useMemo)(()=>(0,h.createStyleResolver)({colorScheme:T}),[T]),{store:G,dispatch:M,commit:k,history:E,subscribe:N,getScene:D,compileBus:I,compileErrors:H}=$e({spec:t,data:e,colorScheme:T,plugins:r,theme:C,resolveRenderer:v,anchorResolver:S,onSpecChange:c,onError:d,onWarnings:m});(0,u.useEffect)(()=>{if(G)return G.subscribe((_,O)=>{if(_.scene.spec===O.scene.spec)return;const{selection:q,setSelection:U}=y.getState();q.length!==0&&U(ae(q,_.scene.spec))})},[G,y]);const b=(0,u.useMemo)(()=>({dispatch:M,commit:k}),[M,k]);(0,u.useImperativeHandle)(l,()=>({commands:b,undo:E.undo,redo:E.redo,subscribe:N,getScene:D,getSelection:()=>y.getState().selection,setSelection:_=>y.getState().setSelection(_),subscribeSelection:y.subscribe,canPlaceDataLabels:x.hasCapability,canFormatDataLabelsAsPercentages:x.hasPercentageFormat}),[b,E,N,D,y,x]);const A=(0,u.useMemo)(()=>G?{chartId:g,store:G,selectionStore:y,targetBoundaryStore:j,commands:b,history:E,formattingLocale:n,compileBus:I,colorScheme:T,styleResolver:P,anchorResolver:S}:null,[g,G,y,j,b,E,n,I,T,P,S]);return(0,o.jsx)(te,{forcedErrors:H,onError:d,resetKeys:[t,e],children:A?(0,o.jsx)(a.GraphContext.Provider,{value:A,children:(0,o.jsx)(a.GeomRendererResolverProvider,{value:v,children:(0,o.jsx)(a.DataLabelPlacementResolverProvider,{value:x,children:(0,o.jsx)(w,{shapes:C?.shapes,children:R})})})}):null})};function Ke({theme:e,...t}={}){const r=(0,h.createSpecBuilder)(t);return{...r,GraphProvider:n=>(0,o.jsx)(ie,{...n,plugins:r.plugins,theme:e})}}var ce=({shouldAnimateTransitions:e,cx:t,cy:r,r:s,...n})=>e?(0,o.jsx)(B.motion.circle,{initial:!1,animate:{cx:t,cy:r,r:s},transition:a.DEFAULT_SPRING_TRANSITION,...n}):(0,o.jsx)("circle",{cx:t,cy:r,r:s,...n}),le=({shouldAnimateTransitions:e,x1:t,y1:r,x2:s,y2:n,...l})=>e?(0,o.jsx)(B.motion.line,{initial:!1,animate:{x1:t,y1:r,x2:s,y2:n},transition:a.DEFAULT_SPRING_TRANSITION,...l}):(0,o.jsx)("line",{x1:t,y1:r,x2:s,y2:n,...l}),ue=({shouldAnimateTransitions:e,x:t,y:r,width:s,height:n,...l})=>e?(0,o.jsx)(B.motion.rect,{initial:!1,animate:{attrX:t,attrY:r,width:s,height:n},transition:a.DEFAULT_SPRING_TRANSITION,...l}):(0,o.jsx)("rect",{x:t,y:r,width:s,height:n,...l}),de=({shouldAnimateTransitions:e,d:t,source:r,...s})=>e?(0,o.jsx)(We,{d:t,source:r,...s}):(0,o.jsx)("path",{d:t,...s}),Ue=e=>{const{Circle:t}=K();return t===void 0?ce(e):(0,o.jsx)(w,{children:(0,o.jsx)(t,{...e})})},Fe=e=>{const{Line:t}=K();return t===void 0?le(e):(0,o.jsx)(w,{children:(0,o.jsx)(t,{...e})})},Ye=e=>{const{Rect:t}=K();return t===void 0?ue(e):(0,o.jsx)(w,{children:(0,o.jsx)(t,{...e})})},Ve=e=>{const{Path:t}=K();return t===void 0?de(e):(0,o.jsx)(w,{children:(0,o.jsx)(t,{...e})})},We=({d:e,source:t,...r})=>{const s=a.useSvgPathMorph(e,a.DEFAULT_SPRING_TRANSITION,t);return(0,o.jsx)(B.motion.path,{d:s,...r})},ze=({children:e,...t})=>(0,o.jsx)("svg",{viewBox:"0 0 1 1",preserveAspectRatio:"none",width:"100%",height:"100%",pointerEvents:"none",...t,children:e}),Xe=({box:e,children:t})=>(0,o.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:t}),Qe="drqe3u0",Je="drqe3u1",Ze="drqe3u2",et="drqe3u3",L="drqe3u4",tt="drqe3u5",rt="drqe3u6",st="drqe3u7",$="drqe3u8",nt="drqe3u9",ot="drqe3ua";var at="drqe3uc",it="drqe3ud",ct="drqe3ue",lt="drqe3uf";var ut="drqe3uh",dt="drqe3ui",Z={enabled:"drqe3uk drqe3uj",disabled:"drqe3ul drqe3uj"},ee={ran:"drqe3un drqe3um",dim:"drqe3uo drqe3um"},me={ran:"drqe3uq drqe3up",cached:"drqe3ur drqe3up",untouched:"drqe3us drqe3up"},mt=({width:e=440,style:t,className:r}={})=>{const{compileBus:s}=a.useGraphContext(),[n]=(0,u.useState)(()=>Ce()),[l,c]=(0,u.useState)(!1),[d,m]=(0,u.useState)(h.isCompilerCachingEnabled);(0,u.useEffect)(()=>{const{recordCompile:g}=n.getState(),S=s.getLastTrigger(),x=s.getLastCompile();return S&&x&&g(S,x),s.subscribe(g)},[n,s]);const f=(0,F.useStore)(n,g=>g.lastCompile),R=(0,F.useStore)(n,g=>g.history),C=s.getCacheStats(),T=f===null&&R.length===0,v=()=>{m(g=>{const S=!g;return(0,h.setCompilerCachingEnabled)(S),S})};return(0,o.jsxs)("div",{className:(0,Y.default)(ot,r),style:{width:e,...t},children:[(0,o.jsxs)("div",{className:Qe,children:[(0,o.jsxs)("div",{children:[(0,o.jsx)("div",{className:Je,children:"compile cache"}),(0,o.jsx)("div",{className:ct,children:T?"production: stats disabled":f?`last: ${f.label} · ${z(f.durationMs)}`:"awaiting first compile…"})]}),(0,o.jsx)("button",{type:"button",onClick:()=>c(g=>!g),className:lt,children:l?"▾":"▴"})]}),!l&&(0,o.jsxs)("div",{className:"drqe3ub",children:[(0,o.jsxs)("button",{type:"button",onClick:v,className:d?Z.enabled:Z.disabled,"aria-pressed":d,children:["cache ",d?"enabled":"disabled"]}),(0,o.jsx)("span",{className:"drqe3ug",children:"next compile reflects this toggle"})]}),!l&&!T&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(ht,{delta:f?.stages,durations:f?.stageDurationsMs,cumulative:C}),(0,o.jsx)(gt,{entries:R})]})]})},ht=({delta:e,durations:t,cumulative:r})=>(0,o.jsxs)("table",{className:Ze,children:[(0,o.jsx)("thead",{children:(0,o.jsxs)("tr",{className:ut,children:[(0,o.jsx)("th",{className:et,children:"stage"}),(0,o.jsx)("th",{className:L,children:"time"}),(0,o.jsx)("th",{className:L,children:"Δ miss"}),(0,o.jsx)("th",{className:L,children:"Δ hit"}),(0,o.jsx)("th",{className:L,children:"total miss"}),(0,o.jsx)("th",{className:L,children:"total hit"})]})}),(0,o.jsx)("tbody",{children:h.COMPILER_STAGE_KEYS.map(s=>{const n=e?.[s],l=pt(n);return(0,o.jsxs)("tr",{className:at,children:[(0,o.jsxs)("td",{className:tt,children:[(0,o.jsx)("span",{className:me[l],"aria-hidden":!0})," ",s]}),(0,o.jsx)("td",{className:$,children:t===void 0||l==="untouched"?"—":z(t[s])}),(0,o.jsx)("td",{className:l==="ran"?ee.ran:ee.dim,children:n?.misses??0}),(0,o.jsx)("td",{className:$,children:n?.hits??0}),(0,o.jsx)("td",{className:$,children:r[s].misses}),(0,o.jsx)("td",{className:$,children:r[s].hits})]},s)})})]}),gt=({entries:e})=>e.length===0?null:(0,o.jsxs)("div",{className:it,children:[(0,o.jsx)("div",{className:dt,children:"recent compiles"}),e.map(t=>{const r=vt(t.stages,l=>l.misses>0),s=h.COMPILER_STAGE_KEYS.length,n=r===0?"cached":"ran";return(0,o.jsxs)("div",{className:rt,children:[(0,o.jsx)("span",{className:me[n],"aria-hidden":!0}),(0,o.jsx)("span",{className:st,title:t.label,children:t.label}),(0,o.jsxs)("span",{className:nt,children:[r,"/",s," ran · ",z(t.durationMs)]})]},t.id)})]}),pt=e=>!e||e.hits===0&&e.misses===0?"untouched":e.misses>0?"ran":"cached",vt=(e,t)=>{let r=0;for(const s of h.COMPILER_STAGE_KEYS)t(e[s])&&(r+=1);return r},z=e=>e<.1?"<0.1ms":e>=10?`${e.toFixed(0)}ms`:`${e.toFixed(2)}ms`,ft=()=>{const{history:e}=a.useGraphContext(),{stack:t,undo:r,redo:s}=e,n=(0,u.useCallback)(d=>t.subscribe(d),[t]),l=(0,u.useCallback)(()=>t.getSnapshot(),[t]),c=(0,u.useSyncExternalStore)(n,l,l);return(0,u.useMemo)(()=>({...c,undo:r,redo:s}),[c,r,s])},St=new Set(["button","checkbox","color","file","hidden","image","radio","range","reset","submit"]),yt=(e,t={})=>{const{target:r,enabled:s=!0}=t;(0,u.useEffect)(()=>{const n=bt(r);if(!s||!n)return;const l=c=>{if(!Et(c)||c.defaultPrevented||Tt(c.target))return;const d=a.resolveHistoryStep(c);if(!d)return;const m=e.current;m&&(d==="undo"?m.undo():m.redo())&&c.preventDefault()};return n.addEventListener("keydown",l),()=>n.removeEventListener("keydown",l)},[e,r,s])},bt=e=>e===void 0?window:e!==null&&"current"in e?e.current:e,Et=e=>"key"in e,Tt=e=>e instanceof HTMLInputElement?!St.has(e.type):e instanceof HTMLElement?e.isContentEditable||e.tagName==="TEXTAREA":!1,xt=()=>{const{targetBoundaryStore:e}=a.useGraphContext();return(0,F.useStore)(e,t=>t.boundary)};exports.BrandMark=a.BrandMark;exports.CanvasTextMeasurer=a.CanvasTextMeasurer;exports.DefaultFooter=a.DefaultFooter;exports.DefaultGeomCircle=ce;exports.DefaultGeomLine=le;exports.DefaultGeomPath=de;exports.DefaultGeomRect=ue;exports.DefaultGrid=a.DefaultGrid;exports.DefaultHeader=a.DefaultHeader;exports.DefaultSwatch=a.DefaultSwatch;exports.DefaultTooltip=a.DefaultTooltip;exports.DevToolsPanel=mt;exports.GRAPH_MODES=a.GRAPH_MODES;exports.GeomCircle=Ue;exports.GeomLine=Fe;exports.GeomPath=Ve;exports.GeomRect=Ye;exports.GraphErrorBoundary=te;exports.GraphErrorPanel=V;exports.GraphProvider=ie;exports.GraphRenderer=a.GraphRenderer;exports.HoverProvider=a.HoverProvider;exports.IntroFade=a.IntroFade;exports.IntroWipeClip=a.IntroWipeClip;exports.TextMeasurerProvider=a.TextMeasurerProvider;exports.ThemeProvider=a.ThemeProvider;exports.UnitBoxSvg=Xe;exports.UnitSpaceSvg=ze;exports.buildDotsEditOutlineShapes=a.buildDotsEditOutlineShapes;exports.createGraphyKit=Ke;exports.darkTheme=a.darkTheme;exports.defineGeomRenderer=a.defineGeomRenderer;exports.lightTheme=a.lightTheme;exports.lightenCss=a.lightenCss;exports.projectPointCartesian=a.projectPointCartesian;exports.pruneSelection=ae;exports.resolveBrandMarkVisual=a.resolveBrandMarkVisual;exports.resolvePathStroke=a.resolvePathStroke;exports.scalePointToPanel=a.scalePointToPanel;exports.stampAxisEditTarget=a.stampAxisEditTarget;exports.stampGridEditTarget=a.stampGridEditTarget;exports.stampLegendEditTarget=a.stampLegendEditTarget;exports.useElementScreenRect=a.useElementScreenRect;exports.useGeomHitTest=a.useGeomHitTest;exports.useGeomHover=a.useGeomHover;exports.useGeomReaderTree=a.useGeomReaderTree;exports.useGeomStyleReader=a.useGeomStyleReader;exports.useGraphCommands=a.useGraphCommands;exports.useGraphHandle=a.useGraphHandle;exports.useGraphHistory=ft;exports.useGraphHistoryShortcuts=yt;exports.useGraphLocale=a.useGraphLocale;exports.useGraphSelection=a.useGraphSelection;exports.useGuidesTakePress=a.useGuidesTakePress;exports.useHandleScene=a.useHandleScene;exports.useHoverState=a.useHoverState;exports.usePaintDefs=a.usePaintDefs;exports.useResolvedStyle=a.useResolvedStyle;exports.useSceneSelector=a.useSceneSelector;exports.useStyleReaderTree=a.useStyleReaderTree;exports.useStyleResolver=a.useStyleResolver;exports.useTargetBoundary=xt;exports.useTextMeasurer=a.useTextMeasurer;exports.vars=a.vars;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('./index.css');const a=require("./history-chords-DvTMVHi8.cjs");let h=require("@graphysdk/viz-engine"),u=require("react"),o=require("react/jsx-runtime"),F=require("zustand"),B=require("motion/react"),W=require("zustand/vanilla"),Y=require("clsx");Y=a.__toESM(Y,1);var ge="_1a5iqpb0",pe="_1a5iqpb1";var ve="_1a5iqpb3",fe="_1a5iqpb4",Se="_1a5iqpb5";var V=({errors:e})=>{const[t,...r]=e;return(0,o.jsxs)("div",{role:"alert",className:ge,children:[(0,o.jsx)("strong",{className:pe,children:"This chart could not be rendered."}),t&&(0,o.jsx)(X,{diagnostic:t}),r.length>0&&(0,o.jsx)("ul",{className:"_1a5iqpb2",children:r.map((s,n)=>(0,o.jsx)("li",{children:(0,o.jsx)(X,{diagnostic:s})},`${s.code}-${n}`))})]})},X=({diagnostic:e})=>(0,o.jsxs)("div",{className:ve,children:[(0,o.jsx)("span",{className:fe,children:e.code}),(0,o.jsx)("p",{className:Se,children:e.message}),e.suggestion&&(0,o.jsx)("p",{className:"_1a5iqpb6",children:e.suggestion})]});function ye(e=[],t=[]){return e.length===t.length&&e.every((r,s)=>Object.is(r,t[s]))}var te=class extends u.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);a.logDiagnostics([r]),this.props.onError?.([r]),console.error("Chart render component stack:",t.componentStack)}componentDidUpdate(e){this.state.caughtDiagnostic&&!ye(e.resetKeys,this.props.resetKeys)&&this.setState({caughtDiagnostic:null})}render(){const{caughtDiagnostic:e}=this.state;if(e)return(0,o.jsx)(V,{errors:[e]});const{forcedErrors:t,children:r}=this.props;return t&&t.length>0?(0,o.jsx)(V,{errors:t}):r}},re={},se=(0,u.createContext)(re),w=({shapes:e=re,children:t})=>(0,o.jsx)(se.Provider,{value:e,children:t}),K=()=>(0,u.useContext)(se),ne=e=>typeof e=="object"&&"geom"in e&&"render"in e,oe=e=>{const t=(0,h.resolveDefinition)(e);return t instanceof h.Geom?t:null},ae=(e,t)=>{const r=e.filter(s=>be(s,t));return r.length===e.length?e:r},be=(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,Q=[],Ee=()=>(0,W.createStore)(e=>({selection:Q,setSelection:t=>e(r=>Te(r.selection,t)?r:{selection:t}),clearSelection:()=>e(t=>t.selection.length===0?t:{selection:Q})})),Te=(e,t)=>e===t?!0:e.length!==t.length?!1:e.every((r,s)=>{const n=t[s];return n!==void 0&&(0,h.areEditTargetsEqual)(r,n)}),xe=process.env.NODE_ENV!=="production",Ge=5,Re=e=>{if(!xe)return{emit:()=>{},subscribe:()=>je,getLastTrigger:()=>null,getLastCompile:()=>null,getCacheStats:()=>e.getCacheStats()};const t=new Set;let r=null;return{emit:s=>{const n=e.getLastCompile();if(n){r=s;for(const l of t)l(s,n)}},subscribe:s=>(t.add(s),()=>{t.delete(s)}),getLastTrigger:()=>r,getLastCompile:()=>e.getLastCompile(),getCacheStats:()=>e.getCacheStats()}},Ce=()=>(0,W.createStore)(e=>({lastCompile:null,history:[],nextId:1,lastSnapshot:null,recordCompile:(t,r)=>e(s=>{if(s.lastSnapshot===r)return s;const n={id:s.nextId,label:Ne(t),stages:r.stages,stageDurationsMs:r.stageDurationsMs,durationMs:r.durationMs};return{lastCompile:n,history:De(s.history,n,Ge),nextId:s.nextId+1,lastSnapshot:r}})})),je=()=>{},Ne=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}},De=(e,t,r)=>{const s=e.length>=r?e.length-(r-1):0;return[...e.slice(s),t]};function Pe(e,t){let r;return e.layers.flatMap((s,n)=>a.isOverlayHosted(t(s.geom,e.coordSystem.type))?Me(s)?(r??=(0,h.createStyleResolver)().readers(e),He(s,r.geom(s))?[{kind:"user-input",severity:"warning",code:"INVALID_STYLE_RULE",message:`Style 'overlay' is not supported on portal-rendered geom '${s.geom}' (layer '${s.id}'); it is ignored.`,context:{param:"overlay",layerIndex:n,requested:s.geom},suggestion:"Remove the geom overlay or use a renderer that paints inside the panel SVG."}]:[]):[]:[])}function J(e){const t=e.filter(ne),r=new Set([...Object.keys(a.BUILT_IN_GEOM_RENDERERS),...t.map(d=>d.geom)]),s=[],n=new Set;for(const d of e){const m=oe(d);m===null||r.has(m.type)||n.has(m.type)||(n.add(m.type),s.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 l=new Map;for(const d of t){if("definition"in d)continue;const m=`${d.geom}|${d.coord}`,f=l.get(m);f?f.count+=1:l.set(m,{geom:d.geom,coord:d.coord,count:1})}const c=[];for(const{geom:d,coord:m,count:f}of l.values())f<2||c.push({kind:"user-input",severity:"warning",code:"DUPLICATE_REGISTERED_TYPE",message:`Multiple render-only overrides register ('${d}', '${m}') (${f} entries); the last in the array wins.`,context:{requested:`${d}@${m}`,kind:"geom-renderer"},suggestion:`Keep a single render-only override for ('${d}', '${m}').`});return c.push(...Ae(e)),{errors:s,warnings:c}}function _e(e,t){const{coordSystem:r,layers:s}=e,n=new Set,l=[];for(const c of s)t(c.geom,r.type)!==null||n.has(c.geom)||(n.add(c.geom),l.push({kind:"user-input",severity:"warning",code:"MISSING_GEOM_RENDERER",message:`No renderer for geom '${c.geom}' under ${r.type} coords; the layer is not painted.`,context:{requested:c.geom,kind:"geom-renderer"},suggestion:`Register a renderer for ('${c.geom}', '${r.type}') via \`defineGeomRenderer\`.`}));return l}function ke(e,t){const{coordSystem:r,layers:s}=e,n=new Set,l=[];for(const c of s){if(c.interactive===!1||c.spatialKind!=="render-hit-test"||n.has(c.geom))continue;const d=t(c.geom,r.type);d===null||d.hitTest||a.isOverlayHosted(d)||(n.add(c.geom),l.push({kind:"user-input",severity:"warning",code:"MISSING_RENDER_HIT_TEST",message:`Geom '${c.geom}' declares spatialKind 'render-hit-test' but its renderer provides no hit-test; the layer has no hover.`,context:{requested:c.geom,kind:"geom-renderer"},suggestion:`Add a \`hitTest\` factory (precomputed geometry) or an overlay render (\`{ fn, options: { overlay: true } }\`, live simulation) to the renderer for ('${c.geom}', '${r.type}').`}))}return l}function Ie(e){const t=new Set,r=[];for(const s of e.layers){const n=s.identityKey;s.interactive!==!1&&(s.spatialKind!=="render-hit-test"||typeof n!="object"||t.has(s.geom)||s.data.hasVariable(n.variable)||(t.add(s.geom),r.push({kind:"user-input",severity:"warning",code:"RENDER_HIT_TEST_IDENTITY",message:`Geom '${s.geom}' keys its identity on '${n.variable}', a column its compile output does not emit; its hover lookup is empty.`,context:{requested:s.geom,kind:"geom-renderer"},suggestion:`Emit the '${n.variable}' column from the geom's \`compile()\`, or point \`identityKey\` at a column it does emit.`})))}return r}function qe(e,t){const{coordSystem:r,layers:s}=e,n=new Set,l=[];for(const c of s){if(c.interactive===!1||c.spatialKind!=="render-hit-test"||n.has(c.geom))continue;const d=t(c.geom,r.type);d===null||!d.hitTest||!a.isOverlayHosted(d)||(n.add(c.geom),l.push({kind:"user-input",severity:"warning",code:"CONFLICTING_RENDER_HIT_TEST",message:`Geom '${c.geom}' declares both a \`hitTest\` factory and an overlay render; these are alternatives, so only the overlay is used.`,context:{requested:c.geom,kind:"geom-renderer"},suggestion:"Keep one: a `hitTest` factory for precomputed geometry, OR an overlay render (`{ fn, options: { overlay: true } }`) for a live simulation."}))}return l}function Le(e,t){const r=new Set,s=[];for(const n of e.layers)n.interactive!==!1&&(n.spatialKind!=="render-hit-test"||r.has(n.geom)||t.hasCapability(n.geom)||(r.add(n.geom),s.push({kind:"user-input",severity:"warning",code:"MISSING_ANCHOR_CAPABILITY",message:`Geom '${n.geom}' declares no \`resolveAnchorPosition\`; its observations cannot be annotated, so the editor overlay paints no creation trigger on them.`,context:{requested:n.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 s}function we(e,t){const{coordSystem:r,layers:s}=e,n=new Set,l=[];for(const c of s){if(c.interactive===!1||c.spatialKind==="render-hit-test"||n.has(c.geom))continue;const d=t(c.geom,r.type);d===null||!a.isOverlayHosted(d)||(n.add(c.geom),l.push({kind:"user-input",severity:"warning",code:"OVERLAY_REQUIRES_RENDER_HIT_TEST",message:`Geom '${c.geom}' declares an overlay render but its layer's spatialKind is '${c.spatialKind}', not 'render-hit-test'; the overlay's push-path hover resolves to nothing.`,context:{requested:c.geom,kind:"geom-renderer"},suggestion:"Have the geom's manifest yield spatialKind 'render-hit-test' so the scene layer carries the `byKey` index the overlay's `pushHover` resolves against."}))}return l}var Me=e=>[e.styles.defaults,e.styles.overrides].some(t=>t.some(r=>(r.declarations.overlay?.length??0)>0)),He=(e,t)=>{const[r]=e.data;if(r===void 0)return!1;if((t.get("overlay",r)?.length??0)>0)return!0;for(const s of e.data)if((t.get("overlay",s,"hovered")?.length??0)>0)return!0;return!1};function Ae(e){const t=new Set,r=[];for(const s of e){const n=oe(s);n===null||t.has(n.type)||n.dataLabelCoordTypes.length===0||n.getDataLabelPlacements!==void 0||(t.add(n.type),r.push({kind:"user-input",severity:"warning",code:"MISSING_DATA_LABEL_PLACEMENT",message:`Geom '${n.type}' declares \`dataLabelCoordTypes\` but implements no \`getDataLabelPlacements\`; its layers paint no data labels.`,context:{requested:n.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 Oe=e=>(0,W.createStore)(t=>({scene:e,setScene:r=>t(s=>s.scene===r?s:{scene:r})})),$e=({spec:e,data:t,colorScheme:r,plugins:s,theme:n,resolveRenderer:l,anchorResolver:c,onSpecChange:d,onError:m,onWarnings:f})=>{const R=a.useLatestRef(d),C=a.useLatestRef(m),T=a.useLatestRef(f),[{session:v,compileBus:g}]=(0,u.useState)(()=>{const i=(0,h.createCompiler)({plugins:s,theme:n});return{session:new h.GraphCompilationSession(i),compileBus:Re(i)}}),[S]=(0,u.useState)(()=>{const i=J(s??[]),p=J(n?.plugins??[]);return{errors:[...p.errors,...i.errors],warnings:[...p.warnings,...i.warnings]}}),x=(0,u.useRef)(null),[y]=(0,u.useState)(Be),j=(0,u.useRef)(null),P=(0,u.useCallback)(i=>S.errors.length===0?i:[...S.errors,...i??[]],[S]),G=(0,u.useCallback)(i=>{if(!i.ok)return i.errors;if(j.current)j.current.getState().setScene(i.scene);else{const p=Oe(i.scene);p.subscribe(y.notify),j.current=p,y.notify()}return null},[y]),[M,k]=(0,u.useState)(()=>{const i=v.compile({spec:e,data:t,colorScheme:r});return x.current=i,P(G(i))}),E=(0,u.useCallback)(i=>i.ok?[...i.warnings,..._e(i.scene,l),...ke(i.scene,l),...Ie(i.scene),...qe(i.scene,l),...we(i.scene,l),...Pe(i.scene,l),...Le(i.scene,c)]:i.warnings,[l,c]),N=(0,u.useCallback)(i=>{i.length!==0&&(a.logDiagnostics(i),C.current?.(i))},[C]),D=(0,u.useCallback)(i=>{i.length!==0&&(a.logDiagnostics(i),T.current?.(i))},[T]);(0,u.useEffect)(()=>{const i=x.current;i&&(N([...S.errors,...i.ok?[]:i.errors]),D([...S.warnings,...E(i)]),i.ok&&g.emit({kind:"init"}))},[g,N,D,S,E]),(0,u.useEffect)(()=>{const i=v.update({spec:e,data:t,colorScheme:r});if(!i)return;i.committedSpec&&R.current?.(i.committedSpec);const p=G(i.result);k(P(p)),p&&N(p),D(E(i.result)),p||g.emit({kind:i.specChanged?"spec":"data"})},[e,t,r,v,g,G,N,D,P,E,R]);const I=(0,u.useCallback)(i=>{k(p=>p===null?p:P(null)),D(E(i))},[P,D,E]),H=(0,u.useCallback)(i=>{i.scene&&j.current?.getState().setScene(i.scene),i.result&&I(i.result),i.command&&g.emit({kind:"command",command:i.command}),i.spec&&R.current?.(i.spec),i.errors&&N([...i.errors])},[I,g,R,N]),b=(0,u.useCallback)(i=>{for(const p of i)H(p);return i.some(p=>!!p.scene)},[H]),A=(0,u.useCallback)((i,p)=>{b(v.applyCommand(i,p))},[v,b]),_=(0,u.useCallback)(()=>{b(v.commit())},[v,b]),O=(0,u.useCallback)(()=>b(v.undo()),[v,b]),q=(0,u.useCallback)(()=>b(v.redo()),[v,b]),U=(0,u.useMemo)(()=>({stack:v.history,undo:O,redo:q}),[v,O,q]),he=(0,u.useCallback)(()=>j.current?.getState().scene??null,[]);return{store:j.current,dispatch:A,commit:_,history:U,subscribe:y.subscribe,getScene:he,compileBus:g,compileErrors:M}},Be=()=>{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:s,formattingLocale:n,handleRef:l,onSpecChange:c,onError:d,onWarnings:m,colorScheme:f="light",children:R})=>{const[C]=(0,u.useState)(()=>s),T=C?.colorScheme??f,[v]=(0,u.useState)(()=>a.createGeomRendererResolver([...C?.plugins??[],...r].filter(ne))),g=(0,u.useId)(),[S]=(0,u.useState)(()=>(0,h.createAnchorResolver)(r)),[x]=(0,u.useState)(()=>(0,h.createDataLabelPlacementResolver)(r)),[y]=(0,u.useState)(()=>Ee()),[j]=(0,u.useState)(()=>a.createTargetBoundaryStore()),P=(0,u.useMemo)(()=>(0,h.createStyleResolver)({colorScheme:T}),[T]),{store:G,dispatch:M,commit:k,history:E,subscribe:N,getScene:D,compileBus:I,compileErrors:H}=$e({spec:t,data:e,colorScheme:T,plugins:r,theme:C,resolveRenderer:v,anchorResolver:S,onSpecChange:c,onError:d,onWarnings:m});(0,u.useEffect)(()=>{if(G)return G.subscribe((_,O)=>{if(_.scene.spec===O.scene.spec)return;const{selection:q,setSelection:U}=y.getState();q.length!==0&&U(ae(q,_.scene.spec))})},[G,y]);const b=(0,u.useMemo)(()=>({dispatch:M,commit:k}),[M,k]);(0,u.useImperativeHandle)(l,()=>({commands:b,undo:E.undo,redo:E.redo,subscribe:N,getScene:D,getSelection:()=>y.getState().selection,setSelection:_=>y.getState().setSelection(_),subscribeSelection:y.subscribe,canPlaceDataLabels:x.hasCapability,canFormatDataLabelsAsPercentages:x.hasPercentageFormat}),[b,E,N,D,y,x]);const A=(0,u.useMemo)(()=>G?{chartId:g,store:G,selectionStore:y,targetBoundaryStore:j,commands:b,history:E,formattingLocale:n,compileBus:I,colorScheme:T,styleResolver:P,anchorResolver:S}:null,[g,G,y,j,b,E,n,I,T,P,S]);return(0,o.jsx)(te,{forcedErrors:H,onError:d,resetKeys:[t,e],children:A?(0,o.jsx)(a.GraphContext.Provider,{value:A,children:(0,o.jsx)(a.GeomRendererResolverProvider,{value:v,children:(0,o.jsx)(a.DataLabelPlacementResolverProvider,{value:x,children:(0,o.jsx)(w,{shapes:C?.shapes,children:R})})})}):null})};function Ke({theme:e,...t}={}){const r=(0,h.createSpecBuilder)(t);return{...r,GraphProvider:n=>(0,o.jsx)(ie,{...n,plugins:r.plugins,theme:e})}}var ce=({shouldAnimateTransitions:e,cx:t,cy:r,r:s,...n})=>e?(0,o.jsx)(B.motion.circle,{initial:!1,animate:{cx:t,cy:r,r:s},transition:a.DEFAULT_SPRING_TRANSITION,...n}):(0,o.jsx)("circle",{cx:t,cy:r,r:s,...n}),le=({shouldAnimateTransitions:e,x1:t,y1:r,x2:s,y2:n,...l})=>e?(0,o.jsx)(B.motion.line,{initial:!1,animate:{x1:t,y1:r,x2:s,y2:n},transition:a.DEFAULT_SPRING_TRANSITION,...l}):(0,o.jsx)("line",{x1:t,y1:r,x2:s,y2:n,...l}),ue=({shouldAnimateTransitions:e,x:t,y:r,width:s,height:n,...l})=>e?(0,o.jsx)(B.motion.rect,{initial:!1,animate:{attrX:t,attrY:r,width:s,height:n},transition:a.DEFAULT_SPRING_TRANSITION,...l}):(0,o.jsx)("rect",{x:t,y:r,width:s,height:n,...l}),de=({shouldAnimateTransitions:e,d:t,source:r,...s})=>e?(0,o.jsx)(We,{d:t,source:r,...s}):(0,o.jsx)("path",{d:t,...s}),Ue=e=>{const{Circle:t}=K();return t===void 0?ce(e):(0,o.jsx)(w,{children:(0,o.jsx)(t,{...e})})},Fe=e=>{const{Line:t}=K();return t===void 0?le(e):(0,o.jsx)(w,{children:(0,o.jsx)(t,{...e})})},Ye=e=>{const{Rect:t}=K();return t===void 0?ue(e):(0,o.jsx)(w,{children:(0,o.jsx)(t,{...e})})},Ve=e=>{const{Path:t}=K();return t===void 0?de(e):(0,o.jsx)(w,{children:(0,o.jsx)(t,{...e})})},We=({d:e,source:t,...r})=>{const s=a.useSvgPathMorph(e,a.DEFAULT_SPRING_TRANSITION,t);return(0,o.jsx)(B.motion.path,{d:s,...r})},ze=({children:e,...t})=>(0,o.jsx)("svg",{viewBox:"0 0 1 1",preserveAspectRatio:"none",width:"100%",height:"100%",pointerEvents:"none",...t,children:e}),Xe=({box:e,children:t})=>(0,o.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:t}),Qe="drqe3u0",Je="drqe3u1",Ze="drqe3u2",et="drqe3u3",L="drqe3u4",tt="drqe3u5",rt="drqe3u6",st="drqe3u7",$="drqe3u8",nt="drqe3u9",ot="drqe3ua";var at="drqe3uc",it="drqe3ud",ct="drqe3ue",lt="drqe3uf";var ut="drqe3uh",dt="drqe3ui",Z={enabled:"drqe3uk drqe3uj",disabled:"drqe3ul drqe3uj"},ee={ran:"drqe3un drqe3um",dim:"drqe3uo drqe3um"},me={ran:"drqe3uq drqe3up",cached:"drqe3ur drqe3up",untouched:"drqe3us drqe3up"},mt=({width:e=440,style:t,className:r}={})=>{const{compileBus:s}=a.useGraphContext(),[n]=(0,u.useState)(()=>Ce()),[l,c]=(0,u.useState)(!1),[d,m]=(0,u.useState)(h.isCompilerCachingEnabled);(0,u.useEffect)(()=>{const{recordCompile:g}=n.getState(),S=s.getLastTrigger(),x=s.getLastCompile();return S&&x&&g(S,x),s.subscribe(g)},[n,s]);const f=(0,F.useStore)(n,g=>g.lastCompile),R=(0,F.useStore)(n,g=>g.history),C=s.getCacheStats(),T=f===null&&R.length===0,v=()=>{m(g=>{const S=!g;return(0,h.setCompilerCachingEnabled)(S),S})};return(0,o.jsxs)("div",{className:(0,Y.default)(ot,r),style:{width:e,...t},children:[(0,o.jsxs)("div",{className:Qe,children:[(0,o.jsxs)("div",{children:[(0,o.jsx)("div",{className:Je,children:"compile cache"}),(0,o.jsx)("div",{className:ct,children:T?"production: stats disabled":f?`last: ${f.label} · ${z(f.durationMs)}`:"awaiting first compile…"})]}),(0,o.jsx)("button",{type:"button",onClick:()=>c(g=>!g),className:lt,children:l?"▾":"▴"})]}),!l&&(0,o.jsxs)("div",{className:"drqe3ub",children:[(0,o.jsxs)("button",{type:"button",onClick:v,className:d?Z.enabled:Z.disabled,"aria-pressed":d,children:["cache ",d?"enabled":"disabled"]}),(0,o.jsx)("span",{className:"drqe3ug",children:"next compile reflects this toggle"})]}),!l&&!T&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(ht,{delta:f?.stages,durations:f?.stageDurationsMs,cumulative:C}),(0,o.jsx)(gt,{entries:R})]})]})},ht=({delta:e,durations:t,cumulative:r})=>(0,o.jsxs)("table",{className:Ze,children:[(0,o.jsx)("thead",{children:(0,o.jsxs)("tr",{className:ut,children:[(0,o.jsx)("th",{className:et,children:"stage"}),(0,o.jsx)("th",{className:L,children:"time"}),(0,o.jsx)("th",{className:L,children:"Δ miss"}),(0,o.jsx)("th",{className:L,children:"Δ hit"}),(0,o.jsx)("th",{className:L,children:"total miss"}),(0,o.jsx)("th",{className:L,children:"total hit"})]})}),(0,o.jsx)("tbody",{children:h.COMPILER_STAGE_KEYS.map(s=>{const n=e?.[s],l=pt(n);return(0,o.jsxs)("tr",{className:at,children:[(0,o.jsxs)("td",{className:tt,children:[(0,o.jsx)("span",{className:me[l],"aria-hidden":!0})," ",s]}),(0,o.jsx)("td",{className:$,children:t===void 0||l==="untouched"?"—":z(t[s])}),(0,o.jsx)("td",{className:l==="ran"?ee.ran:ee.dim,children:n?.misses??0}),(0,o.jsx)("td",{className:$,children:n?.hits??0}),(0,o.jsx)("td",{className:$,children:r[s].misses}),(0,o.jsx)("td",{className:$,children:r[s].hits})]},s)})})]}),gt=({entries:e})=>e.length===0?null:(0,o.jsxs)("div",{className:it,children:[(0,o.jsx)("div",{className:dt,children:"recent compiles"}),e.map(t=>{const r=vt(t.stages,l=>l.misses>0),s=h.COMPILER_STAGE_KEYS.length,n=r===0?"cached":"ran";return(0,o.jsxs)("div",{className:rt,children:[(0,o.jsx)("span",{className:me[n],"aria-hidden":!0}),(0,o.jsx)("span",{className:st,title:t.label,children:t.label}),(0,o.jsxs)("span",{className:nt,children:[r,"/",s," ran · ",z(t.durationMs)]})]},t.id)})]}),pt=e=>!e||e.hits===0&&e.misses===0?"untouched":e.misses>0?"ran":"cached",vt=(e,t)=>{let r=0;for(const s of h.COMPILER_STAGE_KEYS)t(e[s])&&(r+=1);return r},z=e=>e<.1?"<0.1ms":e>=10?`${e.toFixed(0)}ms`:`${e.toFixed(2)}ms`,ft=()=>{const{history:e}=a.useGraphContext(),{stack:t,undo:r,redo:s}=e,n=(0,u.useCallback)(d=>t.subscribe(d),[t]),l=(0,u.useCallback)(()=>t.getSnapshot(),[t]),c=(0,u.useSyncExternalStore)(n,l,l);return(0,u.useMemo)(()=>({...c,undo:r,redo:s}),[c,r,s])},St=new Set(["button","checkbox","color","file","hidden","image","radio","range","reset","submit"]),yt=(e,t={})=>{const{target:r,enabled:s=!0}=t;(0,u.useEffect)(()=>{const n=bt(r);if(!s||!n)return;const l=c=>{if(!Et(c)||c.defaultPrevented||Tt(c.target))return;const d=a.resolveHistoryStep(c);if(!d)return;const m=e.current;m&&(d==="undo"?m.undo():m.redo())&&c.preventDefault()};return n.addEventListener("keydown",l),()=>n.removeEventListener("keydown",l)},[e,r,s])},bt=e=>e===void 0?window:e!==null&&"current"in e?e.current:e,Et=e=>"key"in e,Tt=e=>e instanceof HTMLInputElement?!St.has(e.type):e instanceof HTMLElement?e.isContentEditable||e.tagName==="TEXTAREA":!1,xt=()=>{const{targetBoundaryStore:e}=a.useGraphContext();return(0,F.useStore)(e,t=>t.boundary)};exports.BrandMark=a.BrandMark;exports.CanvasTextMeasurer=a.CanvasTextMeasurer;exports.DefaultFooter=a.DefaultFooter;exports.DefaultGeomCircle=ce;exports.DefaultGeomLine=le;exports.DefaultGeomPath=de;exports.DefaultGeomRect=ue;exports.DefaultGrid=a.DefaultGrid;exports.DefaultHeader=a.DefaultHeader;exports.DefaultSwatch=a.DefaultSwatch;exports.DefaultTooltip=a.DefaultTooltip;exports.DevToolsPanel=mt;exports.GRAPH_MODES=a.GRAPH_MODES;exports.GeomCircle=Ue;exports.GeomLine=Fe;exports.GeomPath=Ve;exports.GeomRect=Ye;exports.GraphErrorBoundary=te;exports.GraphErrorPanel=V;exports.GraphProvider=ie;exports.GraphRenderer=a.GraphRenderer;exports.HoverProvider=a.HoverProvider;exports.IntroFade=a.IntroFade;exports.IntroWipeClip=a.IntroWipeClip;exports.TextMeasurerProvider=a.TextMeasurerProvider;exports.ThemeProvider=a.ThemeProvider;exports.UnitBoxSvg=Xe;exports.UnitSpaceSvg=ze;exports.buildDotsEditOutlineShapes=a.buildDotsEditOutlineShapes;exports.createGraphyKit=Ke;exports.darkTheme=a.darkTheme;exports.defineGeomRenderer=a.defineGeomRenderer;exports.lightTheme=a.lightTheme;exports.lightenCss=a.lightenCss;exports.projectPointCartesian=a.projectPointCartesian;exports.pruneSelection=ae;exports.resolveBrandMarkVisual=a.resolveBrandMarkVisual;exports.resolvePathStroke=a.resolvePathStroke;exports.scalePointToPanel=a.scalePointToPanel;exports.stampAxisEditTarget=a.stampAxisEditTarget;exports.stampGridEditTarget=a.stampGridEditTarget;exports.stampLegendEditTarget=a.stampLegendEditTarget;exports.useElementScreenRect=a.useElementScreenRect;exports.useGeomHitTest=a.useGeomHitTest;exports.useGeomHover=a.useGeomHover;exports.useGeomReaderTree=a.useGeomReaderTree;exports.useGeomStyleReader=a.useGeomStyleReader;exports.useGraphCommands=a.useGraphCommands;exports.useGraphHandle=a.useGraphHandle;exports.useGraphHistory=ft;exports.useGraphHistoryShortcuts=yt;exports.useGraphLocale=a.useGraphLocale;exports.useGraphSelection=a.useGraphSelection;exports.useGuidesTakePress=a.useGuidesTakePress;exports.useHandleScene=a.useHandleScene;exports.useHoverState=a.useHoverState;exports.usePaintDefs=a.usePaintDefs;exports.useResolvedStyle=a.useResolvedStyle;exports.useSceneSelector=a.useSceneSelector;exports.useStyleReaderTree=a.useStyleReaderTree;exports.useStyleResolver=a.useStyleResolver;exports.useTargetBoundary=xt;exports.useTextMeasurer=a.useTextMeasurer;exports.vars=a.vars;
package/dist/index.mjs CHANGED
@@ -1,18 +1,18 @@
1
- import { A as Zt, B as er, Ct as tr, Ft as Se, Gt as rr, Ht as nr, It as sr, Jt as or, Kt as ar, L as ir, Lt as j, M as cr, Ot as lr, Pt as be, Qt as dr, R as ur, Rt as Ee, Sn as z, Ut as Te, V as mr, _n as hr, a as gr, an as pr, at as fr, bn as Re, cn as vr, dn as yr, fn as Sr, ft as br, gn as Er, h as Tr, hn as Rr, ht as Nr, i as Cr, in as Gr, it as Dr, j as qr, jt as Q, kt as Ir, mn as wr, mt as Pr, n as _r, on as Ne, pn as kr, qt as Lr, r as $r, s as Mr, sn as Y, st as xr, t as Ce, tn as Hr, un as Ar, vn as Ge, w as Br, wt as Or, xt as Kr, yn as Z, zt as Fr } from "./history-chords-DAaSkaRs.js";
1
+ import { $t as Zt, A as er, At as tr, B as rr, Bt as nr, Cn as J, Ct as sr, Ft as Se, It as be, Jt as or, Kt as ar, L as ir, Lt as cr, M as lr, Mt as z, R as dr, Rt as Y, Ut as ur, V as mr, Wt as Ee, Yt as hr, _n as gr, a as pr, an as fr, at as vr, bn as Z, cn as j, dn as yr, fn as Sr, ft as br, gn as Er, h as Tr, hn as Rr, ht as Nr, i as Cr, it as Gr, j as Dr, kt as qr, ln as Ir, mn as wr, mt as Pr, n as _r, nn as kr, on as Lr, pn as $r, qt as Mr, r as xr, s as Hr, sn as Te, st as Ar, t as Re, vn as Br, w as Or, wt as Kr, xn as Ne, xt as Fr, yn as Ce, zt as Ge } from "./history-chords-B6xbvtQI.js";
2
2
  import { COMPILER_STAGE_KEYS as ee, Geom as De, GraphCompilationSession as qe, areEditTargetsEqual as Ie, buildDiagnostic as ne, createAnchorResolver as we, createCompiler as Pe, createDataLabelPlacementResolver as _e, createSpecBuilder as ke, createStyleResolver as me, findAnnotation as Le, findLayerById as se, isCompilerCachingEnabled as $e, resolveDefinition as Me, setCompilerCachingEnabled as xe, toPercent as F } from "@graphysdk/viz-engine";
3
3
  import { Component as He, createContext as Ae, useCallback as f, useContext as Be, useEffect as x, useId as Oe, useImperativeHandle as Ke, useMemo as M, useRef as oe, useState as b, useSyncExternalStore as Fe } from "react";
4
4
  import { Fragment as Ue, jsx as a, jsxs as v } from "react/jsx-runtime";
5
- import { useStore as J } from "zustand";
5
+ import { useStore as Q } from "zustand";
6
6
  import { motion as V } from "motion/react";
7
7
  import { createStore as te } from "zustand/vanilla";
8
- import je from "clsx";
9
- import './index.css';var Ye = "_1a5iqpb0", Ve = "_1a5iqpb1";
10
- var We = "_1a5iqpb3", Xe = "_1a5iqpb4", Qe = "_1a5iqpb5";
8
+ import Ye from "clsx";
9
+ import './index.css';var je = "_1a5iqpb0", Ve = "_1a5iqpb1";
10
+ var We = "_1a5iqpb3", Xe = "_1a5iqpb4", ze = "_1a5iqpb5";
11
11
  var ae = ({ errors: e }) => {
12
12
  const [t, ...r] = e;
13
13
  return /* @__PURE__ */ v("div", {
14
14
  role: "alert",
15
- className: Ye,
15
+ className: je,
16
16
  children: [
17
17
  /* @__PURE__ */ a("strong", {
18
18
  className: Ve,
@@ -33,7 +33,7 @@ var ae = ({ errors: e }) => {
33
33
  children: e.code
34
34
  }),
35
35
  /* @__PURE__ */ a("p", {
36
- className: Qe,
36
+ className: ze,
37
37
  children: e.message
38
38
  }),
39
39
  e.suggestion && /* @__PURE__ */ a("p", {
@@ -42,10 +42,10 @@ var ae = ({ errors: e }) => {
42
42
  })
43
43
  ]
44
44
  });
45
- function ze(e = [], t = []) {
45
+ function Je(e = [], t = []) {
46
46
  return e.length === t.length && e.every((r, n) => Object.is(r, t[n]));
47
47
  }
48
- var Je = class extends He {
48
+ var Qe = class extends He {
49
49
  constructor(...e) {
50
50
  super(...e), this.state = { caughtDiagnostic: null };
51
51
  }
@@ -54,10 +54,10 @@ var Je = class extends He {
54
54
  }
55
55
  componentDidCatch(e, t) {
56
56
  const r = ne(e);
57
- z([r]), this.props.onError?.([r]), console.error("Chart render component stack:", t.componentStack);
57
+ J([r]), this.props.onError?.([r]), console.error("Chart render component stack:", t.componentStack);
58
58
  }
59
59
  componentDidUpdate(e) {
60
- this.state.caughtDiagnostic && !ze(e.resetKeys, this.props.resetKeys) && this.setState({ caughtDiagnostic: null });
60
+ this.state.caughtDiagnostic && !Je(e.resetKeys, this.props.resetKeys) && this.setState({ caughtDiagnostic: null });
61
61
  }
62
62
  render() {
63
63
  const { caughtDiagnostic: e } = this.state;
@@ -146,7 +146,7 @@ var Je = class extends He {
146
146
  };
147
147
  function dt(e, t) {
148
148
  let r;
149
- return e.layers.flatMap((n, s) => j(t(n.geom, e.coordSystem.type)) ? vt(n) ? (r ??= me().readers(e), yt(n, r.geom(n)) ? [{
149
+ return e.layers.flatMap((n, s) => Y(t(n.geom, e.coordSystem.type)) ? vt(n) ? (r ??= me().readers(e), yt(n, r.geom(n)) ? [{
150
150
  kind: "user-input",
151
151
  severity: "warning",
152
152
  code: "INVALID_STYLE_RULE",
@@ -160,7 +160,7 @@ function dt(e, t) {
160
160
  }] : []) : [] : []);
161
161
  }
162
162
  function le(e) {
163
- const t = e.filter(pe), r = /* @__PURE__ */ new Set([...Object.keys(Ee), ...t.map((l) => l.geom)]), n = [], s = /* @__PURE__ */ new Set();
163
+ const t = e.filter(pe), r = /* @__PURE__ */ new Set([...Object.keys(Ge), ...t.map((l) => l.geom)]), n = [], s = /* @__PURE__ */ new Set();
164
164
  for (const l of e) {
165
165
  const d = fe(l);
166
166
  d === null || r.has(d.type) || s.has(d.type) || (s.add(d.type), n.push({
@@ -224,7 +224,7 @@ function mt(e, t) {
224
224
  for (const i of n) {
225
225
  if (i.interactive === !1 || i.spatialKind !== "render-hit-test" || s.has(i.geom)) continue;
226
226
  const l = t(i.geom, r.type);
227
- l === null || l.hitTest || j(l) || (s.add(i.geom), c.push({
227
+ l === null || l.hitTest || Y(l) || (s.add(i.geom), c.push({
228
228
  kind: "user-input",
229
229
  severity: "warning",
230
230
  code: "MISSING_RENDER_HIT_TEST",
@@ -261,7 +261,7 @@ function gt(e, t) {
261
261
  for (const i of n) {
262
262
  if (i.interactive === !1 || i.spatialKind !== "render-hit-test" || s.has(i.geom)) continue;
263
263
  const l = t(i.geom, r.type);
264
- l === null || !l.hitTest || !j(l) || (s.add(i.geom), c.push({
264
+ l === null || !l.hitTest || !Y(l) || (s.add(i.geom), c.push({
265
265
  kind: "user-input",
266
266
  severity: "warning",
267
267
  code: "CONFLICTING_RENDER_HIT_TEST",
@@ -296,7 +296,7 @@ function ft(e, t) {
296
296
  for (const i of n) {
297
297
  if (i.interactive === !1 || i.spatialKind === "render-hit-test" || s.has(i.geom)) continue;
298
298
  const l = t(i.geom, r.type);
299
- l === null || !j(l) || (s.add(i.geom), c.push({
299
+ l === null || !Y(l) || (s.add(i.geom), c.push({
300
300
  kind: "user-input",
301
301
  severity: "warning",
302
302
  code: "OVERLAY_REQUIRES_RENDER_HIT_TEST",
@@ -339,7 +339,7 @@ var bt = (e) => te((t) => ({
339
339
  scene: e,
340
340
  setScene: (r) => t((n) => n.scene === r ? n : { scene: r })
341
341
  })), Et = ({ spec: e, data: t, colorScheme: r, plugins: n, theme: s, resolveRenderer: c, anchorResolver: i, onSpecChange: l, onError: d, onWarnings: g }) => {
342
- const C = Q(l), G = Q(d), T = Q(g), [{ session: h, compileBus: u }] = b(() => {
342
+ const C = z(l), G = z(d), T = z(g), [{ session: h, compileBus: u }] = b(() => {
343
343
  const o = Pe({
344
344
  plugins: n,
345
345
  theme: s
@@ -379,9 +379,9 @@ var bt = (e) => te((t) => ({
379
379
  ...dt(o.scene, c),
380
380
  ...pt(o.scene, i)
381
381
  ] : o.warnings, [c, i]), q = f((o) => {
382
- o.length !== 0 && (z(o), G.current?.(o));
382
+ o.length !== 0 && (J(o), G.current?.(o));
383
383
  }, [G]), I = f((o) => {
384
- o.length !== 0 && (z(o), T.current?.(o));
384
+ o.length !== 0 && (J(o), T.current?.(o));
385
385
  }, [T]);
386
386
  x(() => {
387
387
  const o = R.current;
@@ -466,7 +466,7 @@ var bt = (e) => te((t) => ({
466
466
  notify: () => e.forEach((t) => t())
467
467
  };
468
468
  }, Rt = ({ data: e, spec: t, plugins: r = [], theme: n, formattingLocale: s, handleRef: c, onSpecChange: i, onError: l, onWarnings: d, colorScheme: g = "light", children: C }) => {
469
- const [G] = b(() => n), T = G?.colorScheme ?? g, [h] = b(() => Se([...G?.plugins ?? [], ...r].filter(pe))), u = Oe(), [p] = b(() => we(r)), [R] = b(() => _e(r)), [y] = b(() => tt()), [D] = b(() => be()), w = M(() => me({ colorScheme: T }), [T]), { store: N, dispatch: A, commit: _, history: E, subscribe: q, getScene: I, compileBus: k, compileErrors: B } = Et({
469
+ const [G] = b(() => n), T = G?.colorScheme ?? g, [h] = b(() => be([...G?.plugins ?? [], ...r].filter(pe))), u = Oe(), [p] = b(() => we(r)), [R] = b(() => _e(r)), [y] = b(() => tt()), [D] = b(() => Se()), w = M(() => me({ colorScheme: T }), [T]), { store: N, dispatch: A, commit: _, history: E, subscribe: q, getScene: I, compileBus: k, compileErrors: B } = Et({
470
470
  spec: t,
471
471
  data: e,
472
472
  colorScheme: T,
@@ -534,15 +534,15 @@ var bt = (e) => te((t) => ({
534
534
  w,
535
535
  p
536
536
  ]);
537
- return /* @__PURE__ */ a(Je, {
537
+ return /* @__PURE__ */ a(Qe, {
538
538
  forcedErrors: B,
539
539
  onError: l,
540
540
  resetKeys: [t, e],
541
- children: O ? /* @__PURE__ */ a(Ge.Provider, {
541
+ children: O ? /* @__PURE__ */ a(Ce.Provider, {
542
542
  value: O,
543
- children: /* @__PURE__ */ a(Te, {
543
+ children: /* @__PURE__ */ a(Ee, {
544
544
  value: h,
545
- children: /* @__PURE__ */ a(Re, {
545
+ children: /* @__PURE__ */ a(Ne, {
546
546
  value: R,
547
547
  children: /* @__PURE__ */ a(H, {
548
548
  shapes: G?.shapes,
@@ -553,7 +553,7 @@ var bt = (e) => te((t) => ({
553
553
  }) : null
554
554
  });
555
555
  };
556
- function zr({ theme: e, ...t } = {}) {
556
+ function Jr({ theme: e, ...t } = {}) {
557
557
  const r = ke(t);
558
558
  return {
559
559
  ...r,
@@ -571,7 +571,7 @@ var Nt = ({ shouldAnimateTransitions: e, cx: t, cy: r, r: n, ...s }) => e ? /* @
571
571
  cy: r,
572
572
  r: n
573
573
  },
574
- transition: Y,
574
+ transition: j,
575
575
  ...s
576
576
  }) : /* @__PURE__ */ a("circle", {
577
577
  cx: t,
@@ -586,7 +586,7 @@ var Nt = ({ shouldAnimateTransitions: e, cx: t, cy: r, r: n, ...s }) => e ? /* @
586
586
  x2: n,
587
587
  y2: s
588
588
  },
589
- transition: Y,
589
+ transition: j,
590
590
  ...c
591
591
  }) : /* @__PURE__ */ a("line", {
592
592
  x1: t,
@@ -602,7 +602,7 @@ var Nt = ({ shouldAnimateTransitions: e, cx: t, cy: r, r: n, ...s }) => e ? /* @
602
602
  width: n,
603
603
  height: s
604
604
  },
605
- transition: Y,
605
+ transition: j,
606
606
  ...c
607
607
  }) : /* @__PURE__ */ a("rect", {
608
608
  x: t,
@@ -617,7 +617,7 @@ var Nt = ({ shouldAnimateTransitions: e, cx: t, cy: r, r: n, ...s }) => e ? /* @
617
617
  }) : /* @__PURE__ */ a("path", {
618
618
  d: t,
619
619
  ...n
620
- }), Jr = (e) => {
620
+ }), Qr = (e) => {
621
621
  const { Circle: t } = W();
622
622
  return t === void 0 ? Nt(e) : /* @__PURE__ */ a(H, { children: /* @__PURE__ */ a(t, { ...e }) });
623
623
  }, Zr = (e) => {
@@ -630,7 +630,7 @@ var Nt = ({ shouldAnimateTransitions: e, cx: t, cy: r, r: n, ...s }) => e ? /* @
630
630
  const { Path: t } = W();
631
631
  return t === void 0 ? Dt(e) : /* @__PURE__ */ a(H, { children: /* @__PURE__ */ a(t, { ...e }) });
632
632
  }, qt = ({ d: e, source: t, ...r }) => {
633
- const n = Ne(e, Y, t);
633
+ const n = Te(e, j, t);
634
634
  return /* @__PURE__ */ a(V.path, {
635
635
  d: n,
636
636
  ...r
@@ -669,14 +669,14 @@ var Kt = "drqe3uh", Ft = "drqe3ui", de = {
669
669
  const { recordCompile: u } = s.getState(), p = n.getLastTrigger(), R = n.getLastCompile();
670
670
  return p && R && u(p, R), n.subscribe(u);
671
671
  }, [s, n]);
672
- const g = J(s, (u) => u.lastCompile), C = J(s, (u) => u.history), G = n.getCacheStats(), T = g === null && C.length === 0, h = () => {
672
+ const g = Q(s, (u) => u.lastCompile), C = Q(s, (u) => u.history), G = n.getCacheStats(), T = g === null && C.length === 0, h = () => {
673
673
  d((u) => {
674
674
  const p = !u;
675
675
  return xe(p), p;
676
676
  });
677
677
  };
678
678
  return /* @__PURE__ */ v("div", {
679
- className: je(xt, r),
679
+ className: Ye(xt, r),
680
680
  style: {
681
681
  width: e,
682
682
  ...t
@@ -714,7 +714,7 @@ var Kt = "drqe3uh", Ft = "drqe3ui", de = {
714
714
  delta: g?.stages,
715
715
  durations: g?.stageDurationsMs,
716
716
  cumulative: G
717
- }), /* @__PURE__ */ a(jt, { entries: C })] })
717
+ }), /* @__PURE__ */ a(Yt, { entries: C })] })
718
718
  ]
719
719
  });
720
720
  }, Ut = ({ delta: e, durations: t, cumulative: r }) => /* @__PURE__ */ v("table", {
@@ -748,7 +748,7 @@ var Kt = "drqe3uh", Ft = "drqe3ui", de = {
748
748
  })
749
749
  ]
750
750
  }) }), /* @__PURE__ */ a("tbody", { children: ee.map((n) => {
751
- const s = e?.[n], c = Yt(s);
751
+ const s = e?.[n], c = jt(s);
752
752
  return /* @__PURE__ */ v("tr", {
753
753
  className: Ht,
754
754
  children: [
@@ -786,7 +786,7 @@ var Kt = "drqe3uh", Ft = "drqe3ui", de = {
786
786
  ]
787
787
  }, n);
788
788
  }) })]
789
- }), jt = ({ entries: e }) => e.length === 0 ? null : /* @__PURE__ */ v("div", {
789
+ }), Yt = ({ entries: e }) => e.length === 0 ? null : /* @__PURE__ */ v("div", {
790
790
  className: At,
791
791
  children: [/* @__PURE__ */ a("div", {
792
792
  className: Ft,
@@ -818,7 +818,7 @@ var Kt = "drqe3uh", Ft = "drqe3ui", de = {
818
818
  ]
819
819
  }, t.id);
820
820
  })]
821
- }), Yt = (e) => !e || e.hits === 0 && e.misses === 0 ? "untouched" : e.misses > 0 ? "ran" : "cached", Vt = (e, t) => {
821
+ }), jt = (e) => !e || e.hits === 0 && e.misses === 0 ? "untouched" : e.misses > 0 ? "ran" : "cached", Vt = (e, t) => {
822
822
  let r = 0;
823
823
  for (const n of ee) t(e[n]) && (r += 1);
824
824
  return r;
@@ -850,8 +850,8 @@ var Kt = "drqe3uh", Ft = "drqe3ui", de = {
850
850
  const s = Xt(r);
851
851
  if (!n || !s) return;
852
852
  const c = (i) => {
853
- if (!Qt(i) || i.defaultPrevented || zt(i.target)) return;
854
- const l = Ce(i);
853
+ if (!zt(i) || i.defaultPrevented || Jt(i.target)) return;
854
+ const l = Re(i);
855
855
  if (!l) return;
856
856
  const d = e.current;
857
857
  d && (l === "undo" ? d.undo() : d.redo()) && i.preventDefault();
@@ -862,73 +862,73 @@ var Kt = "drqe3uh", Ft = "drqe3ui", de = {
862
862
  r,
863
863
  n
864
864
  ]);
865
- }, Xt = (e) => e === void 0 ? window : e !== null && "current" in e ? e.current : e, Qt = (e) => "key" in e, zt = (e) => e instanceof HTMLInputElement ? !Wt.has(e.type) : e instanceof HTMLElement ? e.isContentEditable || e.tagName === "TEXTAREA" : !1, cn = () => {
865
+ }, Xt = (e) => e === void 0 ? window : e !== null && "current" in e ? e.current : e, zt = (e) => "key" in e, Jt = (e) => e instanceof HTMLInputElement ? !Wt.has(e.type) : e instanceof HTMLElement ? e.isContentEditable || e.tagName === "TEXTAREA" : !1, cn = () => {
866
866
  const { targetBoundaryStore: e } = Z();
867
- return J(e, (t) => t.boundary);
867
+ return Q(e, (t) => t.boundary);
868
868
  };
869
869
  export {
870
- er as BrandMark,
871
- Lr as CanvasTextMeasurer,
872
- ur as DefaultFooter,
870
+ rr as BrandMark,
871
+ or as CanvasTextMeasurer,
872
+ dr as DefaultFooter,
873
873
  Nt as DefaultGeomCircle,
874
874
  Ct as DefaultGeomLine,
875
875
  Dt as DefaultGeomPath,
876
876
  Gt as DefaultGeomRect,
877
- Mr as DefaultGrid,
877
+ Hr as DefaultGrid,
878
878
  ir as DefaultHeader,
879
- nr as DefaultSwatch,
880
- fr as DefaultTooltip,
879
+ ur as DefaultSwatch,
880
+ vr as DefaultTooltip,
881
881
  sn as DevToolsPanel,
882
- Kr as GRAPH_MODES,
883
- Jr as GeomCircle,
882
+ Fr as GRAPH_MODES,
883
+ Qr as GeomCircle,
884
884
  Zr as GeomLine,
885
885
  tn as GeomPath,
886
886
  en as GeomRect,
887
- Je as GraphErrorBoundary,
887
+ Qe as GraphErrorBoundary,
888
888
  ae as GraphErrorPanel,
889
889
  Rt as GraphProvider,
890
- gr as GraphRenderer,
891
- Ir as HoverProvider,
892
- Fr as IntroFade,
893
- pr as IntroWipeClip,
894
- rr as TextMeasurerProvider,
890
+ pr as GraphRenderer,
891
+ tr as HoverProvider,
892
+ nr as IntroFade,
893
+ Lr as IntroWipeClip,
894
+ ar as TextMeasurerProvider,
895
895
  br as ThemeProvider,
896
896
  nn as UnitBoxSvg,
897
897
  rn as UnitSpaceSvg,
898
- Ar as buildDotsEditOutlineShapes,
899
- zr as createGraphyKit,
898
+ yr as buildDotsEditOutlineShapes,
899
+ Jr as createGraphyKit,
900
900
  Pr as darkTheme,
901
- sr as defineGeomRenderer,
901
+ cr as defineGeomRenderer,
902
902
  Nr as lightTheme,
903
- dr as lightenCss,
904
- Sr as projectPointCartesian,
903
+ Zt as lightenCss,
904
+ $r as projectPointCartesian,
905
905
  Ze as pruneSelection,
906
906
  mr as resolveBrandMarkVisual,
907
- vr as resolvePathStroke,
908
- yr as scalePointToPanel,
909
- Zt as stampAxisEditTarget,
910
- qr as stampGridEditTarget,
911
- cr as stampLegendEditTarget,
912
- Or as useElementScreenRect,
913
- lr as useGeomHitTest,
914
- tr as useGeomHover,
915
- kr as useGeomReaderTree,
916
- wr as useGeomStyleReader,
907
+ Ir as resolvePathStroke,
908
+ Sr as scalePointToPanel,
909
+ er as stampAxisEditTarget,
910
+ Dr as stampGridEditTarget,
911
+ lr as stampLegendEditTarget,
912
+ Kr as useElementScreenRect,
913
+ qr as useGeomHitTest,
914
+ sr as useGeomHover,
915
+ wr as useGeomReaderTree,
916
+ Rr as useGeomStyleReader,
917
917
  _r as useGraphCommands,
918
918
  Cr as useGraphHandle,
919
919
  on as useGraphHistory,
920
920
  an as useGraphHistoryShortcuts,
921
- Dr as useGraphLocale,
921
+ Gr as useGraphLocale,
922
922
  Tr as useGraphSelection,
923
- Br as useGuidesTakePress,
924
- $r as useHandleScene,
925
- xr as useHoverState,
926
- Gr as usePaintDefs,
927
- or as useResolvedStyle,
928
- hr as useSceneSelector,
929
- Rr as useStyleReaderTree,
930
- Er as useStyleResolver,
923
+ Or as useGuidesTakePress,
924
+ xr as useHandleScene,
925
+ Ar as useHoverState,
926
+ fr as usePaintDefs,
927
+ hr as useResolvedStyle,
928
+ Br as useSceneSelector,
929
+ Er as useStyleReaderTree,
930
+ gr as useStyleResolver,
931
931
  cn as useTargetBoundary,
932
- ar as useTextMeasurer,
933
- Hr as vars
932
+ Mr as useTextMeasurer,
933
+ kr as vars
934
934
  };
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "visualization",
12
12
  "renderer"
13
13
  ],
14
- "version": "1.9.0-beta.1792138483515",
14
+ "version": "1.9.0-beta.1792147641623",
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.1792138483515"
53
+ "@graphysdk/viz-engine": "1.9.0-beta.1792147641623"
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",
154
+ "@graphytools/vitest-config": "1.0.0",
155
155
  "@graphytools/typescript-config": "0.0.1",
156
- "@graphytools/vitest-config": "1.0.0"
156
+ "@graphytools/eslint-config": "0.0.1"
157
157
  },
158
158
  "publishConfig": {
159
159
  "access": "public"