@graphysdk/react-renderer 1.9.0-beta.1791282086791 → 1.9.0-beta.1791291594669

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-FESymrSZ.cjs"),oe=require("./theme.contract.css-DKDKSByt.cjs");let g=require("@graphysdk/viz-engine"),d=require("react"),a=require("react/jsx-runtime"),B=require("zustand"),A=require("motion/react"),F=require("zustand/vanilla"),O=require("clsx");O=o.__toESM(O,1);var ae="_1a5iqpb0",ie="_1a5iqpb1";var ce="_1a5iqpb3",le="_1a5iqpb4",de="_1a5iqpb5";var K=({errors:e})=>{const[t,...s]=e;return(0,a.jsxs)("div",{role:"alert",className:ae,children:[(0,a.jsx)("strong",{className:ie,children:"This chart could not be rendered."}),t&&(0,a.jsx)(W,{diagnostic:t}),s.length>0&&(0,a.jsx)("ul",{className:"_1a5iqpb2",children:s.map((r,n)=>(0,a.jsx)("li",{children:(0,a.jsx)(W,{diagnostic:r})},`${r.code}-${n}`))})]})},W=({diagnostic:e})=>(0,a.jsxs)("div",{className:ce,children:[(0,a.jsx)("span",{className:le,children:e.code}),(0,a.jsx)("p",{className:de,children:e.message}),e.suggestion&&(0,a.jsx)("p",{className:"_1a5iqpb6",children:e.suggestion})]});function ue(e=[],t=[]){return e.length===t.length&&e.every((s,r)=>Object.is(s,t[r]))}var Q=class extends d.Component{constructor(...e){super(...e),this.state={caughtDiagnostic:null}}static getDerivedStateFromError(e){return{caughtDiagnostic:(0,g.buildDiagnostic)(e)}}componentDidCatch(e,t){const s=(0,g.buildDiagnostic)(e);o.logDiagnostics([s]),this.props.onError?.([s]),console.error("Chart render component stack:",t.componentStack)}componentDidUpdate(e){this.state.caughtDiagnostic&&!ue(e.resetKeys,this.props.resetKeys)&&this.setState({caughtDiagnostic:null})}render(){const{caughtDiagnostic:e}=this.state;if(e)return(0,a.jsx)(K,{errors:[e]});const{forcedErrors:t,children:s}=this.props;return t&&t.length>0?(0,a.jsx)(K,{errors:t}):s}},J=e=>typeof e=="object"&&"geom"in e&&"render"in e,Z=e=>{const t=(0,g.resolveDefinition)(e);return t instanceof g.Geom?t:null},ee=(e,t)=>{const s=e.filter(r=>me(r,t));return s.length===e.length?e:s},me=(e,t)=>e.kind==="annotation"?(0,g.findAnnotation)(t.annotations,e.id)!==null:e.kind==="observations"||e.kind==="layer"&&e.layerId!==void 0?(0,g.findLayerById)(t.layers,e.layerId)!==void 0:!0,V=[],he=()=>(0,F.createStore)(e=>({selection:V,setSelection:t=>e(s=>ge(s.selection,t)?s:{selection:t}),clearSelection:()=>e(t=>t.selection.length===0?t:{selection:V})})),ge=(e,t)=>e===t?!0:e.length!==t.length?!1:e.every((s,r)=>{const n=t[r];return n!==void 0&&(0,g.areEditTargetsEqual)(s,n)}),pe=process.env.NODE_ENV!=="production",fe=5,ve=e=>{if(!pe)return{emit:()=>{},subscribe:()=>ye,getLastTrigger:()=>null,getLastCompile:()=>null,getCacheStats:()=>e.getCacheStats()};const t=new Set;let s=null;return{emit:r=>{const n=e.getLastCompile();if(n){s=r;for(const l of t)l(r,n)}},subscribe:r=>(t.add(r),()=>{t.delete(r)}),getLastTrigger:()=>s,getLastCompile:()=>e.getLastCompile(),getCacheStats:()=>e.getCacheStats()}},Se=()=>(0,F.createStore)(e=>({lastCompile:null,history:[],nextId:1,lastSnapshot:null,recordCompile:(t,s)=>e(r=>{if(r.lastSnapshot===s)return r;const n={id:r.nextId,label:be(t),stages:s.stages,stageDurationsMs:s.stageDurationsMs,durationMs:s.durationMs};return{lastCompile:n,history:Te(r.history,n,fe),nextId:r.nextId+1,lastSnapshot:s}})})),ye=()=>{},be=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}},Te=(e,t,s)=>{const r=e.length>=s?e.length-(s-1):0;return[...e.slice(r),t]};function Ee(e){const t=e.filter(J),s=new Set([...Object.keys(o.BUILT_IN_GEOM_RENDERERS),...t.map(u=>u.geom)]),r=[],n=new Set;for(const u of e){const m=Z(u);m===null||s.has(m.type)||n.has(m.type)||(n.add(m.type),r.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 u of t){if("definition"in u)continue;const m=`${u.geom}|${u.coord}`,f=l.get(m);f?f.count+=1:l.set(m,{geom:u.geom,coord:u.coord,count:1})}const c=[];for(const{geom:u,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 ('${u}', '${m}') (${f} 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 c.push(..._e(e)),{errors:r,warnings:c}}function xe(e,t){const{coordSystem:s,layers:r}=e,n=new Set,l=[];for(const c of r)t(c.geom,s.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 ${s.type} coords; the layer is not painted.`,context:{requested:c.geom,kind:"geom-renderer"},suggestion:`Register a renderer for ('${c.geom}', '${s.type}') via \`defineGeomRenderer\`.`}));return l}function Re(e,t){const{coordSystem:s,layers:r}=e,n=new Set,l=[];for(const c of r){if(c.interactive===!1||c.spatialKind!=="render-hit-test"||n.has(c.geom))continue;const u=t(c.geom,s.type);u===null||u.hitTest||o.isOverlayHosted(u)||(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}', '${s.type}').`}))}return l}function Ge(e){const t=new Set,s=[];for(const r of e.layers){const n=r.identityKey;r.interactive!==!1&&(r.spatialKind!=="render-hit-test"||typeof n!="object"||t.has(r.geom)||r.data.hasVariable(n.variable)||(t.add(r.geom),s.push({kind:"user-input",severity:"warning",code:"RENDER_HIT_TEST_IDENTITY",message:`Geom '${r.geom}' keys its identity on '${n.variable}', a column its compile output does not emit; its hover lookup is empty.`,context:{requested:r.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 s}function Ce(e,t){const{coordSystem:s,layers:r}=e,n=new Set,l=[];for(const c of r){if(c.interactive===!1||c.spatialKind!=="render-hit-test"||n.has(c.geom))continue;const u=t(c.geom,s.type);u===null||!u.hitTest||!o.isOverlayHosted(u)||(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 Ne(e,t){const s=new Set,r=[];for(const n of e.layers)n.interactive!==!1&&(n.spatialKind!=="render-hit-test"||s.has(n.geom)||t.hasCapability(n.geom)||(s.add(n.geom),r.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 r}function je(e,t){const{coordSystem:s,layers:r}=e,n=new Set,l=[];for(const c of r){if(c.interactive===!1||c.spatialKind==="render-hit-test"||n.has(c.geom))continue;const u=t(c.geom,s.type);u===null||!o.isOverlayHosted(u)||(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}function _e(e){const t=new Set,s=[];for(const r of e){const n=Z(r);n===null||t.has(n.type)||n.dataLabelCoordTypes.length===0||n.getDataLabelPlacements!==void 0||(t.add(n.type),s.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 s}var De=e=>(0,F.createStore)(t=>({scene:e,setScene:s=>t(r=>r.scene===s?r:{scene:s})})),qe=({spec:e,data:t,customPalettes:s,colorScheme:r,plugins:n,resolveRenderer:l,anchorResolver:c,onSpecChange:u,onError:m,onWarnings:f})=>{const T=o.useLatestRef(u),j=o.useLatestRef(m),R=o.useLatestRef(f),[{session:v,compileBus:h}]=(0,d.useState)(()=>{const i=(0,g.createCompiler)({plugins:n});return{session:new g.GraphCompilationSession(i),compileBus:ve(i)}}),[p]=(0,d.useState)(()=>Ee(n??[])),G=(0,d.useRef)(null),[_]=(0,d.useState)(ke),y=(0,d.useRef)(null),C=(0,d.useCallback)(i=>p.errors.length===0?i:[...p.errors,...i??[]],[p]),k=(0,d.useCallback)(i=>{if(!i.ok)return i.errors;if(y.current)y.current.getState().setScene(i.scene);else{const S=De(i.scene);S.subscribe(_.notify),y.current=S,_.notify()}return null},[_]),[D,I]=(0,d.useState)(()=>{const i=v.compile({spec:e,data:t,customPalettes:s,colorScheme:r});return G.current=i,C(k(i))}),E=(0,d.useCallback)(i=>i.ok?[...i.warnings,...xe(i.scene,l),...Re(i.scene,l),...Ge(i.scene),...Ce(i.scene,l),...je(i.scene,l),...Ne(i.scene,c)]:i.warnings,[l,c]),x=(0,d.useCallback)(i=>{i.length!==0&&(o.logDiagnostics(i),j.current?.(i))},[j]),N=(0,d.useCallback)(i=>{i.length!==0&&(o.logDiagnostics(i),R.current?.(i))},[R]);(0,d.useEffect)(()=>{const i=G.current;i&&(x([...p.errors,...i.ok?[]:i.errors]),N([...p.warnings,...E(i)]),i.ok&&h.emit({kind:"init"}))},[h,x,N,p,E]),(0,d.useEffect)(()=>{const i=v.update({spec:e,data:t,customPalettes:s,colorScheme:r});if(!i)return;i.committedSpec&&T.current?.(i.committedSpec);const S=k(i.result);I(C(S)),S&&x(S),N(E(i.result)),S||h.emit({kind:i.specChanged?"spec":"data"})},[e,t,s,r,v,h,k,x,N,C,E,T]);const q=(0,d.useCallback)(i=>{I(S=>S===null?S:C(null)),N(E(i))},[C,N,E]),P=(0,d.useCallback)(i=>{i.scene&&y.current?.getState().setScene(i.scene),i.result&&q(i.result),i.command&&h.emit({kind:"command",command:i.command}),i.spec&&T.current?.(i.spec),i.errors&&x([...i.errors])},[q,h,T,x]),b=(0,d.useCallback)(i=>{for(const S of i)P(S);return i.some(S=>!!S.scene)},[P]),$=(0,d.useCallback)((i,S)=>{b(v.applyCommand(i,S))},[v,b]),w=(0,d.useCallback)(()=>{b(v.commit())},[v,b]),M=(0,d.useCallback)(()=>b(v.undo()),[v,b]),Y=(0,d.useCallback)(()=>b(v.redo()),[v,b]),se=(0,d.useMemo)(()=>({stack:v.history,undo:M,redo:Y}),[v,M,Y]),ne=(0,d.useCallback)(()=>y.current?.getState().scene??null,[]);return{store:y.current,dispatch:$,commit:w,history:se,subscribe:_.subscribe,getScene:ne,compileBus:h,compileErrors:D}},ke=()=>{const e=new Set;return{subscribe:t=>(e.add(t),()=>{e.delete(t)}),notify:()=>e.forEach(t=>t())}},te=({data:e,spec:t,plugins:s=[],formattingLocale:r,handleRef:n,onSpecChange:l,onError:c,onWarnings:u,customPalettes:m,colorScheme:f="light",children:T})=>{const[j]=(0,d.useState)(()=>o.createGeomRendererResolver(s.filter(J))),R=(0,d.useId)(),[v]=(0,d.useState)(()=>(0,g.createAnchorResolver)(s)),[h]=(0,d.useState)(()=>(0,g.createDataLabelPlacementResolver)(s)),[p]=(0,d.useState)(()=>he()),[G]=(0,d.useState)(()=>o.createTargetBoundaryStore()),_=(0,d.useMemo)(()=>(0,g.createStyleResolver)({colorScheme:f}),[f]),{store:y,dispatch:C,commit:k,history:D,subscribe:I,getScene:E,compileBus:x,compileErrors:N}=qe({spec:t,data:e,customPalettes:m,colorScheme:f,plugins:s,resolveRenderer:j,anchorResolver:v,onSpecChange:l,onError:c,onWarnings:u});(0,d.useEffect)(()=>{if(y)return y.subscribe((b,$)=>{if(b.scene.spec===$.scene.spec)return;const{selection:w,setSelection:M}=p.getState();w.length!==0&&M(ee(w,b.scene.spec))})},[y,p]);const q=(0,d.useMemo)(()=>({dispatch:C,commit:k}),[C,k]);(0,d.useImperativeHandle)(n,()=>({commands:q,undo:D.undo,redo:D.redo,subscribe:I,getScene:E,getSelection:()=>p.getState().selection,setSelection:b=>p.getState().setSelection(b),subscribeSelection:p.subscribe,canPlaceDataLabels:h.hasCapability,canFormatDataLabelsAsPercentages:h.hasPercentageFormat}),[q,D,I,E,p,h]);const P=(0,d.useMemo)(()=>y?{chartId:R,store:y,selectionStore:p,targetBoundaryStore:G,commands:q,history:D,formattingLocale:r,compileBus:x,colorScheme:f,styleResolver:_,anchorResolver:v}:null,[R,y,p,G,q,D,r,x,f,_,v]);return(0,a.jsx)(Q,{forcedErrors:N,onError:c,resetKeys:[t,e],children:P?(0,a.jsx)(o.GraphContext.Provider,{value:P,children:(0,a.jsx)(o.GeomRendererResolverProvider,{value:j,children:(0,a.jsx)(o.DataLabelPlacementResolverProvider,{value:h,children:T})})}):null})};function Ie(e){const t=(0,g.createSpecBuilder)(e);return{...t,GraphProvider:r=>(0,a.jsx)(te,{...r,plugins:t.plugins})}}var Pe=({shouldAnimateTransitions:e,cx:t,cy:s,r,...n})=>e?(0,a.jsx)(A.motion.circle,{initial:!1,animate:{cx:t,cy:s,r},transition:o.DEFAULT_SPRING_TRANSITION,...n}):(0,a.jsx)("circle",{cx:t,cy:s,r,...n}),Le=({shouldAnimateTransitions:e,x1:t,y1:s,x2:r,y2:n,...l})=>e?(0,a.jsx)(A.motion.line,{initial:!1,animate:{x1:t,y1:s,x2:r,y2:n},transition:o.DEFAULT_SPRING_TRANSITION,...l}):(0,a.jsx)("line",{x1:t,y1:s,x2:r,y2:n,...l}),we=({shouldAnimateTransitions:e,x:t,y:s,width:r,height:n,...l})=>e?(0,a.jsx)(A.motion.rect,{initial:!1,animate:{attrX:t,attrY:s,width:r,height:n},transition:o.DEFAULT_SPRING_TRANSITION,...l}):(0,a.jsx)("rect",{x:t,y:s,width:r,height:n,...l}),Me=({shouldAnimateTransitions:e,d:t,source:s,...r})=>e?(0,a.jsx)(He,{d:t,source:s,...r}):(0,a.jsx)("path",{d:t,...r}),He=({d:e,source:t,...s})=>{const r=o.useSvgPathMorph(e,o.DEFAULT_SPRING_TRANSITION,t);return(0,a.jsx)(A.motion.path,{d:r,...s})},Ae=({children:e,...t})=>(0,a.jsx)("svg",{viewBox:"0 0 1 1",preserveAspectRatio:"none",width:"100%",height:"100%",pointerEvents:"none",...t,children:e}),$e=({box:e,children:t})=>(0,a.jsx)("svg",{x:(0,g.toPercent)(e.x0),y:(0,g.toPercent)(e.y0),width:(0,g.toPercent)(e.x1-e.x0),height:(0,g.toPercent)(e.y1-e.y0),overflow:"hidden",pointerEvents:"none",children:t}),Be="drqe3u0",Oe="drqe3u1",Ke="drqe3u2",Fe="drqe3u3",L="drqe3u4",Ue="drqe3u5",Ye="drqe3u6",We="drqe3u7",H="drqe3u8",Ve="drqe3u9",ze="drqe3ua";var Xe="drqe3uc",Qe="drqe3ud",Je="drqe3ue",Ze="drqe3uf";var et="drqe3uh",tt="drqe3ui",z={enabled:"drqe3uk drqe3uj",disabled:"drqe3ul drqe3uj"},X={ran:"drqe3un drqe3um",dim:"drqe3uo drqe3um"},re={ran:"drqe3uq drqe3up",cached:"drqe3ur drqe3up",untouched:"drqe3us drqe3up"},rt=({width:e=440,style:t,className:s}={})=>{const{compileBus:r}=o.useGraphContext(),[n]=(0,d.useState)(()=>Se()),[l,c]=(0,d.useState)(!1),[u,m]=(0,d.useState)(g.isCompilerCachingEnabled);(0,d.useEffect)(()=>{const{recordCompile:h}=n.getState(),p=r.getLastTrigger(),G=r.getLastCompile();return p&&G&&h(p,G),r.subscribe(h)},[n,r]);const f=(0,B.useStore)(n,h=>h.lastCompile),T=(0,B.useStore)(n,h=>h.history),j=r.getCacheStats(),R=f===null&&T.length===0,v=()=>{m(h=>{const p=!h;return(0,g.setCompilerCachingEnabled)(p),p})};return(0,a.jsxs)("div",{className:(0,O.default)(ze,s),style:{width:e,...t},children:[(0,a.jsxs)("div",{className:Be,children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:Oe,children:"compile cache"}),(0,a.jsx)("div",{className:Je,children:R?"production: stats disabled":f?`last: ${f.label} · ${U(f.durationMs)}`:"awaiting first compile…"})]}),(0,a.jsx)("button",{type:"button",onClick:()=>c(h=>!h),className:Ze,children:l?"▾":"▴"})]}),!l&&(0,a.jsxs)("div",{className:"drqe3ub",children:[(0,a.jsxs)("button",{type:"button",onClick:v,className:u?z.enabled:z.disabled,"aria-pressed":u,children:["cache ",u?"enabled":"disabled"]}),(0,a.jsx)("span",{className:"drqe3ug",children:"next compile reflects this toggle"})]}),!l&&!R&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(st,{delta:f?.stages,durations:f?.stageDurationsMs,cumulative:j}),(0,a.jsx)(nt,{entries:T})]})]})},st=({delta:e,durations:t,cumulative:s})=>(0,a.jsxs)("table",{className:Ke,children:[(0,a.jsx)("thead",{children:(0,a.jsxs)("tr",{className:et,children:[(0,a.jsx)("th",{className:Fe,children:"stage"}),(0,a.jsx)("th",{className:L,children:"time"}),(0,a.jsx)("th",{className:L,children:"Δ miss"}),(0,a.jsx)("th",{className:L,children:"Δ hit"}),(0,a.jsx)("th",{className:L,children:"total miss"}),(0,a.jsx)("th",{className:L,children:"total hit"})]})}),(0,a.jsx)("tbody",{children:g.COMPILER_STAGE_KEYS.map(r=>{const n=e?.[r],l=ot(n);return(0,a.jsxs)("tr",{className:Xe,children:[(0,a.jsxs)("td",{className:Ue,children:[(0,a.jsx)("span",{className:re[l],"aria-hidden":!0})," ",r]}),(0,a.jsx)("td",{className:H,children:t===void 0||l==="untouched"?"—":U(t[r])}),(0,a.jsx)("td",{className:l==="ran"?X.ran:X.dim,children:n?.misses??0}),(0,a.jsx)("td",{className:H,children:n?.hits??0}),(0,a.jsx)("td",{className:H,children:s[r].misses}),(0,a.jsx)("td",{className:H,children:s[r].hits})]},r)})})]}),nt=({entries:e})=>e.length===0?null:(0,a.jsxs)("div",{className:Qe,children:[(0,a.jsx)("div",{className:tt,children:"recent compiles"}),e.map(t=>{const s=at(t.stages,l=>l.misses>0),r=g.COMPILER_STAGE_KEYS.length,n=s===0?"cached":"ran";return(0,a.jsxs)("div",{className:Ye,children:[(0,a.jsx)("span",{className:re[n],"aria-hidden":!0}),(0,a.jsx)("span",{className:We,title:t.label,children:t.label}),(0,a.jsxs)("span",{className:Ve,children:[s,"/",r," ran · ",U(t.durationMs)]})]},t.id)})]}),ot=e=>!e||e.hits===0&&e.misses===0?"untouched":e.misses>0?"ran":"cached",at=(e,t)=>{let s=0;for(const r of g.COMPILER_STAGE_KEYS)t(e[r])&&(s+=1);return s},U=e=>e<.1?"<0.1ms":e>=10?`${e.toFixed(0)}ms`:`${e.toFixed(2)}ms`,it=()=>{const{history:e}=o.useGraphContext(),{stack:t,undo:s,redo:r}=e,n=(0,d.useCallback)(u=>t.subscribe(u),[t]),l=(0,d.useCallback)(()=>t.getSnapshot(),[t]),c=(0,d.useSyncExternalStore)(n,l,l);return(0,d.useMemo)(()=>({...c,undo:s,redo:r}),[c,s,r])},ct=new Set(["button","checkbox","color","file","hidden","image","radio","range","reset","submit"]),lt=(e,t={})=>{const{target:s,enabled:r=!0}=t;(0,d.useEffect)(()=>{const n=dt(s);if(!r||!n)return;const l=c=>{if(!ut(c)||c.defaultPrevented||mt(c.target))return;const u=o.resolveHistoryStep(c);if(!u)return;const m=e.current;m&&(u==="undo"?m.undo():m.redo())&&c.preventDefault()};return n.addEventListener("keydown",l),()=>n.removeEventListener("keydown",l)},[e,s,r])},dt=e=>e===void 0?window:e!==null&&"current"in e?e.current:e,ut=e=>"key"in e,mt=e=>e instanceof HTMLInputElement?!ct.has(e.type):e instanceof HTMLElement?e.isContentEditable||e.tagName==="TEXTAREA":!1,ht=()=>{const{targetBoundaryStore:e}=o.useGraphContext();return(0,B.useStore)(e,t=>t.boundary)};exports.BrandMark=o.BrandMark;exports.CanvasTextMeasurer=o.CanvasTextMeasurer;exports.DefaultFooter=o.DefaultFooter;exports.DefaultGrid=o.DefaultGrid;exports.DefaultHeader=o.DefaultHeader;exports.DefaultSwatch=o.DefaultSwatch;exports.DefaultTooltip=o.DefaultTooltip;exports.DevToolsPanel=rt;exports.GRAPH_MODES=o.GRAPH_MODES;exports.GeomCircle=Pe;exports.GeomLine=Le;exports.GeomPath=Me;exports.GeomRect=we;exports.GraphErrorBoundary=Q;exports.GraphErrorPanel=K;exports.GraphProvider=te;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=$e;exports.UnitSpaceSvg=Ae;exports.buildDotsEditOutlineShapes=o.buildDotsEditOutlineShapes;exports.createGraphyKit=Ie;exports.darkTheme=o.darkTheme;exports.defineGeomRenderer=o.defineGeomRenderer;exports.lightTheme=o.lightTheme;exports.lightenCss=o.lightenCss;exports.projectPointCartesian=o.projectPointCartesian;exports.pruneSelection=ee;exports.resolveBrandMarkVisual=o.resolveBrandMarkVisual;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.useGeomReaderTree=o.useGeomReaderTree;exports.useGeomStyleReader=o.useGeomStyleReader;exports.useGraphCommands=o.useGraphCommands;exports.useGraphHandle=o.useGraphHandle;exports.useGraphHistory=it;exports.useGraphHistoryShortcuts=lt;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=ht;exports.useTextMeasurer=o.useTextMeasurer;exports.vars=oe.vars;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('./index.css');const o=require("./history-chords-D2z9pPzz.cjs"),oe=require("./theme.contract.css-DKDKSByt.cjs");let g=require("@graphysdk/viz-engine"),d=require("react"),a=require("react/jsx-runtime"),B=require("zustand"),A=require("motion/react"),F=require("zustand/vanilla"),O=require("clsx");O=o.__toESM(O,1);var ae="_1a5iqpb0",ie="_1a5iqpb1";var ce="_1a5iqpb3",le="_1a5iqpb4",de="_1a5iqpb5";var K=({errors:e})=>{const[t,...s]=e;return(0,a.jsxs)("div",{role:"alert",className:ae,children:[(0,a.jsx)("strong",{className:ie,children:"This chart could not be rendered."}),t&&(0,a.jsx)(W,{diagnostic:t}),s.length>0&&(0,a.jsx)("ul",{className:"_1a5iqpb2",children:s.map((r,n)=>(0,a.jsx)("li",{children:(0,a.jsx)(W,{diagnostic:r})},`${r.code}-${n}`))})]})},W=({diagnostic:e})=>(0,a.jsxs)("div",{className:ce,children:[(0,a.jsx)("span",{className:le,children:e.code}),(0,a.jsx)("p",{className:de,children:e.message}),e.suggestion&&(0,a.jsx)("p",{className:"_1a5iqpb6",children:e.suggestion})]});function ue(e=[],t=[]){return e.length===t.length&&e.every((s,r)=>Object.is(s,t[r]))}var Q=class extends d.Component{constructor(...e){super(...e),this.state={caughtDiagnostic:null}}static getDerivedStateFromError(e){return{caughtDiagnostic:(0,g.buildDiagnostic)(e)}}componentDidCatch(e,t){const s=(0,g.buildDiagnostic)(e);o.logDiagnostics([s]),this.props.onError?.([s]),console.error("Chart render component stack:",t.componentStack)}componentDidUpdate(e){this.state.caughtDiagnostic&&!ue(e.resetKeys,this.props.resetKeys)&&this.setState({caughtDiagnostic:null})}render(){const{caughtDiagnostic:e}=this.state;if(e)return(0,a.jsx)(K,{errors:[e]});const{forcedErrors:t,children:s}=this.props;return t&&t.length>0?(0,a.jsx)(K,{errors:t}):s}},J=e=>typeof e=="object"&&"geom"in e&&"render"in e,Z=e=>{const t=(0,g.resolveDefinition)(e);return t instanceof g.Geom?t:null},ee=(e,t)=>{const s=e.filter(r=>me(r,t));return s.length===e.length?e:s},me=(e,t)=>e.kind==="annotation"?(0,g.findAnnotation)(t.annotations,e.id)!==null:e.kind==="observations"||e.kind==="layer"&&e.layerId!==void 0?(0,g.findLayerById)(t.layers,e.layerId)!==void 0:!0,V=[],he=()=>(0,F.createStore)(e=>({selection:V,setSelection:t=>e(s=>ge(s.selection,t)?s:{selection:t}),clearSelection:()=>e(t=>t.selection.length===0?t:{selection:V})})),ge=(e,t)=>e===t?!0:e.length!==t.length?!1:e.every((s,r)=>{const n=t[r];return n!==void 0&&(0,g.areEditTargetsEqual)(s,n)}),pe=process.env.NODE_ENV!=="production",fe=5,ve=e=>{if(!pe)return{emit:()=>{},subscribe:()=>ye,getLastTrigger:()=>null,getLastCompile:()=>null,getCacheStats:()=>e.getCacheStats()};const t=new Set;let s=null;return{emit:r=>{const n=e.getLastCompile();if(n){s=r;for(const l of t)l(r,n)}},subscribe:r=>(t.add(r),()=>{t.delete(r)}),getLastTrigger:()=>s,getLastCompile:()=>e.getLastCompile(),getCacheStats:()=>e.getCacheStats()}},Se=()=>(0,F.createStore)(e=>({lastCompile:null,history:[],nextId:1,lastSnapshot:null,recordCompile:(t,s)=>e(r=>{if(r.lastSnapshot===s)return r;const n={id:r.nextId,label:be(t),stages:s.stages,stageDurationsMs:s.stageDurationsMs,durationMs:s.durationMs};return{lastCompile:n,history:Te(r.history,n,fe),nextId:r.nextId+1,lastSnapshot:s}})})),ye=()=>{},be=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}},Te=(e,t,s)=>{const r=e.length>=s?e.length-(s-1):0;return[...e.slice(r),t]};function Ee(e){const t=e.filter(J),s=new Set([...Object.keys(o.BUILT_IN_GEOM_RENDERERS),...t.map(u=>u.geom)]),r=[],n=new Set;for(const u of e){const m=Z(u);m===null||s.has(m.type)||n.has(m.type)||(n.add(m.type),r.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 u of t){if("definition"in u)continue;const m=`${u.geom}|${u.coord}`,f=l.get(m);f?f.count+=1:l.set(m,{geom:u.geom,coord:u.coord,count:1})}const c=[];for(const{geom:u,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 ('${u}', '${m}') (${f} 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 c.push(..._e(e)),{errors:r,warnings:c}}function xe(e,t){const{coordSystem:s,layers:r}=e,n=new Set,l=[];for(const c of r)t(c.geom,s.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 ${s.type} coords; the layer is not painted.`,context:{requested:c.geom,kind:"geom-renderer"},suggestion:`Register a renderer for ('${c.geom}', '${s.type}') via \`defineGeomRenderer\`.`}));return l}function Re(e,t){const{coordSystem:s,layers:r}=e,n=new Set,l=[];for(const c of r){if(c.interactive===!1||c.spatialKind!=="render-hit-test"||n.has(c.geom))continue;const u=t(c.geom,s.type);u===null||u.hitTest||o.isOverlayHosted(u)||(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}', '${s.type}').`}))}return l}function Ge(e){const t=new Set,s=[];for(const r of e.layers){const n=r.identityKey;r.interactive!==!1&&(r.spatialKind!=="render-hit-test"||typeof n!="object"||t.has(r.geom)||r.data.hasVariable(n.variable)||(t.add(r.geom),s.push({kind:"user-input",severity:"warning",code:"RENDER_HIT_TEST_IDENTITY",message:`Geom '${r.geom}' keys its identity on '${n.variable}', a column its compile output does not emit; its hover lookup is empty.`,context:{requested:r.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 s}function Ce(e,t){const{coordSystem:s,layers:r}=e,n=new Set,l=[];for(const c of r){if(c.interactive===!1||c.spatialKind!=="render-hit-test"||n.has(c.geom))continue;const u=t(c.geom,s.type);u===null||!u.hitTest||!o.isOverlayHosted(u)||(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 Ne(e,t){const s=new Set,r=[];for(const n of e.layers)n.interactive!==!1&&(n.spatialKind!=="render-hit-test"||s.has(n.geom)||t.hasCapability(n.geom)||(s.add(n.geom),r.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 r}function je(e,t){const{coordSystem:s,layers:r}=e,n=new Set,l=[];for(const c of r){if(c.interactive===!1||c.spatialKind==="render-hit-test"||n.has(c.geom))continue;const u=t(c.geom,s.type);u===null||!o.isOverlayHosted(u)||(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}function _e(e){const t=new Set,s=[];for(const r of e){const n=Z(r);n===null||t.has(n.type)||n.dataLabelCoordTypes.length===0||n.getDataLabelPlacements!==void 0||(t.add(n.type),s.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 s}var De=e=>(0,F.createStore)(t=>({scene:e,setScene:s=>t(r=>r.scene===s?r:{scene:s})})),qe=({spec:e,data:t,customPalettes:s,colorScheme:r,plugins:n,resolveRenderer:l,anchorResolver:c,onSpecChange:u,onError:m,onWarnings:f})=>{const T=o.useLatestRef(u),j=o.useLatestRef(m),R=o.useLatestRef(f),[{session:v,compileBus:h}]=(0,d.useState)(()=>{const i=(0,g.createCompiler)({plugins:n});return{session:new g.GraphCompilationSession(i),compileBus:ve(i)}}),[p]=(0,d.useState)(()=>Ee(n??[])),G=(0,d.useRef)(null),[_]=(0,d.useState)(ke),y=(0,d.useRef)(null),C=(0,d.useCallback)(i=>p.errors.length===0?i:[...p.errors,...i??[]],[p]),k=(0,d.useCallback)(i=>{if(!i.ok)return i.errors;if(y.current)y.current.getState().setScene(i.scene);else{const S=De(i.scene);S.subscribe(_.notify),y.current=S,_.notify()}return null},[_]),[D,I]=(0,d.useState)(()=>{const i=v.compile({spec:e,data:t,customPalettes:s,colorScheme:r});return G.current=i,C(k(i))}),E=(0,d.useCallback)(i=>i.ok?[...i.warnings,...xe(i.scene,l),...Re(i.scene,l),...Ge(i.scene),...Ce(i.scene,l),...je(i.scene,l),...Ne(i.scene,c)]:i.warnings,[l,c]),x=(0,d.useCallback)(i=>{i.length!==0&&(o.logDiagnostics(i),j.current?.(i))},[j]),N=(0,d.useCallback)(i=>{i.length!==0&&(o.logDiagnostics(i),R.current?.(i))},[R]);(0,d.useEffect)(()=>{const i=G.current;i&&(x([...p.errors,...i.ok?[]:i.errors]),N([...p.warnings,...E(i)]),i.ok&&h.emit({kind:"init"}))},[h,x,N,p,E]),(0,d.useEffect)(()=>{const i=v.update({spec:e,data:t,customPalettes:s,colorScheme:r});if(!i)return;i.committedSpec&&T.current?.(i.committedSpec);const S=k(i.result);I(C(S)),S&&x(S),N(E(i.result)),S||h.emit({kind:i.specChanged?"spec":"data"})},[e,t,s,r,v,h,k,x,N,C,E,T]);const q=(0,d.useCallback)(i=>{I(S=>S===null?S:C(null)),N(E(i))},[C,N,E]),P=(0,d.useCallback)(i=>{i.scene&&y.current?.getState().setScene(i.scene),i.result&&q(i.result),i.command&&h.emit({kind:"command",command:i.command}),i.spec&&T.current?.(i.spec),i.errors&&x([...i.errors])},[q,h,T,x]),b=(0,d.useCallback)(i=>{for(const S of i)P(S);return i.some(S=>!!S.scene)},[P]),$=(0,d.useCallback)((i,S)=>{b(v.applyCommand(i,S))},[v,b]),w=(0,d.useCallback)(()=>{b(v.commit())},[v,b]),M=(0,d.useCallback)(()=>b(v.undo()),[v,b]),Y=(0,d.useCallback)(()=>b(v.redo()),[v,b]),se=(0,d.useMemo)(()=>({stack:v.history,undo:M,redo:Y}),[v,M,Y]),ne=(0,d.useCallback)(()=>y.current?.getState().scene??null,[]);return{store:y.current,dispatch:$,commit:w,history:se,subscribe:_.subscribe,getScene:ne,compileBus:h,compileErrors:D}},ke=()=>{const e=new Set;return{subscribe:t=>(e.add(t),()=>{e.delete(t)}),notify:()=>e.forEach(t=>t())}},te=({data:e,spec:t,plugins:s=[],formattingLocale:r,handleRef:n,onSpecChange:l,onError:c,onWarnings:u,customPalettes:m,colorScheme:f="light",children:T})=>{const[j]=(0,d.useState)(()=>o.createGeomRendererResolver(s.filter(J))),R=(0,d.useId)(),[v]=(0,d.useState)(()=>(0,g.createAnchorResolver)(s)),[h]=(0,d.useState)(()=>(0,g.createDataLabelPlacementResolver)(s)),[p]=(0,d.useState)(()=>he()),[G]=(0,d.useState)(()=>o.createTargetBoundaryStore()),_=(0,d.useMemo)(()=>(0,g.createStyleResolver)({colorScheme:f}),[f]),{store:y,dispatch:C,commit:k,history:D,subscribe:I,getScene:E,compileBus:x,compileErrors:N}=qe({spec:t,data:e,customPalettes:m,colorScheme:f,plugins:s,resolveRenderer:j,anchorResolver:v,onSpecChange:l,onError:c,onWarnings:u});(0,d.useEffect)(()=>{if(y)return y.subscribe((b,$)=>{if(b.scene.spec===$.scene.spec)return;const{selection:w,setSelection:M}=p.getState();w.length!==0&&M(ee(w,b.scene.spec))})},[y,p]);const q=(0,d.useMemo)(()=>({dispatch:C,commit:k}),[C,k]);(0,d.useImperativeHandle)(n,()=>({commands:q,undo:D.undo,redo:D.redo,subscribe:I,getScene:E,getSelection:()=>p.getState().selection,setSelection:b=>p.getState().setSelection(b),subscribeSelection:p.subscribe,canPlaceDataLabels:h.hasCapability,canFormatDataLabelsAsPercentages:h.hasPercentageFormat}),[q,D,I,E,p,h]);const P=(0,d.useMemo)(()=>y?{chartId:R,store:y,selectionStore:p,targetBoundaryStore:G,commands:q,history:D,formattingLocale:r,compileBus:x,colorScheme:f,styleResolver:_,anchorResolver:v}:null,[R,y,p,G,q,D,r,x,f,_,v]);return(0,a.jsx)(Q,{forcedErrors:N,onError:c,resetKeys:[t,e],children:P?(0,a.jsx)(o.GraphContext.Provider,{value:P,children:(0,a.jsx)(o.GeomRendererResolverProvider,{value:j,children:(0,a.jsx)(o.DataLabelPlacementResolverProvider,{value:h,children:T})})}):null})};function Ie(e){const t=(0,g.createSpecBuilder)(e);return{...t,GraphProvider:r=>(0,a.jsx)(te,{...r,plugins:t.plugins})}}var Pe=({shouldAnimateTransitions:e,cx:t,cy:s,r,...n})=>e?(0,a.jsx)(A.motion.circle,{initial:!1,animate:{cx:t,cy:s,r},transition:o.DEFAULT_SPRING_TRANSITION,...n}):(0,a.jsx)("circle",{cx:t,cy:s,r,...n}),Le=({shouldAnimateTransitions:e,x1:t,y1:s,x2:r,y2:n,...l})=>e?(0,a.jsx)(A.motion.line,{initial:!1,animate:{x1:t,y1:s,x2:r,y2:n},transition:o.DEFAULT_SPRING_TRANSITION,...l}):(0,a.jsx)("line",{x1:t,y1:s,x2:r,y2:n,...l}),we=({shouldAnimateTransitions:e,x:t,y:s,width:r,height:n,...l})=>e?(0,a.jsx)(A.motion.rect,{initial:!1,animate:{attrX:t,attrY:s,width:r,height:n},transition:o.DEFAULT_SPRING_TRANSITION,...l}):(0,a.jsx)("rect",{x:t,y:s,width:r,height:n,...l}),Me=({shouldAnimateTransitions:e,d:t,source:s,...r})=>e?(0,a.jsx)(He,{d:t,source:s,...r}):(0,a.jsx)("path",{d:t,...r}),He=({d:e,source:t,...s})=>{const r=o.useSvgPathMorph(e,o.DEFAULT_SPRING_TRANSITION,t);return(0,a.jsx)(A.motion.path,{d:r,...s})},Ae=({children:e,...t})=>(0,a.jsx)("svg",{viewBox:"0 0 1 1",preserveAspectRatio:"none",width:"100%",height:"100%",pointerEvents:"none",...t,children:e}),$e=({box:e,children:t})=>(0,a.jsx)("svg",{x:(0,g.toPercent)(e.x0),y:(0,g.toPercent)(e.y0),width:(0,g.toPercent)(e.x1-e.x0),height:(0,g.toPercent)(e.y1-e.y0),overflow:"hidden",pointerEvents:"none",children:t}),Be="drqe3u0",Oe="drqe3u1",Ke="drqe3u2",Fe="drqe3u3",L="drqe3u4",Ue="drqe3u5",Ye="drqe3u6",We="drqe3u7",H="drqe3u8",Ve="drqe3u9",ze="drqe3ua";var Xe="drqe3uc",Qe="drqe3ud",Je="drqe3ue",Ze="drqe3uf";var et="drqe3uh",tt="drqe3ui",z={enabled:"drqe3uk drqe3uj",disabled:"drqe3ul drqe3uj"},X={ran:"drqe3un drqe3um",dim:"drqe3uo drqe3um"},re={ran:"drqe3uq drqe3up",cached:"drqe3ur drqe3up",untouched:"drqe3us drqe3up"},rt=({width:e=440,style:t,className:s}={})=>{const{compileBus:r}=o.useGraphContext(),[n]=(0,d.useState)(()=>Se()),[l,c]=(0,d.useState)(!1),[u,m]=(0,d.useState)(g.isCompilerCachingEnabled);(0,d.useEffect)(()=>{const{recordCompile:h}=n.getState(),p=r.getLastTrigger(),G=r.getLastCompile();return p&&G&&h(p,G),r.subscribe(h)},[n,r]);const f=(0,B.useStore)(n,h=>h.lastCompile),T=(0,B.useStore)(n,h=>h.history),j=r.getCacheStats(),R=f===null&&T.length===0,v=()=>{m(h=>{const p=!h;return(0,g.setCompilerCachingEnabled)(p),p})};return(0,a.jsxs)("div",{className:(0,O.default)(ze,s),style:{width:e,...t},children:[(0,a.jsxs)("div",{className:Be,children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:Oe,children:"compile cache"}),(0,a.jsx)("div",{className:Je,children:R?"production: stats disabled":f?`last: ${f.label} · ${U(f.durationMs)}`:"awaiting first compile…"})]}),(0,a.jsx)("button",{type:"button",onClick:()=>c(h=>!h),className:Ze,children:l?"▾":"▴"})]}),!l&&(0,a.jsxs)("div",{className:"drqe3ub",children:[(0,a.jsxs)("button",{type:"button",onClick:v,className:u?z.enabled:z.disabled,"aria-pressed":u,children:["cache ",u?"enabled":"disabled"]}),(0,a.jsx)("span",{className:"drqe3ug",children:"next compile reflects this toggle"})]}),!l&&!R&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(st,{delta:f?.stages,durations:f?.stageDurationsMs,cumulative:j}),(0,a.jsx)(nt,{entries:T})]})]})},st=({delta:e,durations:t,cumulative:s})=>(0,a.jsxs)("table",{className:Ke,children:[(0,a.jsx)("thead",{children:(0,a.jsxs)("tr",{className:et,children:[(0,a.jsx)("th",{className:Fe,children:"stage"}),(0,a.jsx)("th",{className:L,children:"time"}),(0,a.jsx)("th",{className:L,children:"Δ miss"}),(0,a.jsx)("th",{className:L,children:"Δ hit"}),(0,a.jsx)("th",{className:L,children:"total miss"}),(0,a.jsx)("th",{className:L,children:"total hit"})]})}),(0,a.jsx)("tbody",{children:g.COMPILER_STAGE_KEYS.map(r=>{const n=e?.[r],l=ot(n);return(0,a.jsxs)("tr",{className:Xe,children:[(0,a.jsxs)("td",{className:Ue,children:[(0,a.jsx)("span",{className:re[l],"aria-hidden":!0})," ",r]}),(0,a.jsx)("td",{className:H,children:t===void 0||l==="untouched"?"—":U(t[r])}),(0,a.jsx)("td",{className:l==="ran"?X.ran:X.dim,children:n?.misses??0}),(0,a.jsx)("td",{className:H,children:n?.hits??0}),(0,a.jsx)("td",{className:H,children:s[r].misses}),(0,a.jsx)("td",{className:H,children:s[r].hits})]},r)})})]}),nt=({entries:e})=>e.length===0?null:(0,a.jsxs)("div",{className:Qe,children:[(0,a.jsx)("div",{className:tt,children:"recent compiles"}),e.map(t=>{const s=at(t.stages,l=>l.misses>0),r=g.COMPILER_STAGE_KEYS.length,n=s===0?"cached":"ran";return(0,a.jsxs)("div",{className:Ye,children:[(0,a.jsx)("span",{className:re[n],"aria-hidden":!0}),(0,a.jsx)("span",{className:We,title:t.label,children:t.label}),(0,a.jsxs)("span",{className:Ve,children:[s,"/",r," ran · ",U(t.durationMs)]})]},t.id)})]}),ot=e=>!e||e.hits===0&&e.misses===0?"untouched":e.misses>0?"ran":"cached",at=(e,t)=>{let s=0;for(const r of g.COMPILER_STAGE_KEYS)t(e[r])&&(s+=1);return s},U=e=>e<.1?"<0.1ms":e>=10?`${e.toFixed(0)}ms`:`${e.toFixed(2)}ms`,it=()=>{const{history:e}=o.useGraphContext(),{stack:t,undo:s,redo:r}=e,n=(0,d.useCallback)(u=>t.subscribe(u),[t]),l=(0,d.useCallback)(()=>t.getSnapshot(),[t]),c=(0,d.useSyncExternalStore)(n,l,l);return(0,d.useMemo)(()=>({...c,undo:s,redo:r}),[c,s,r])},ct=new Set(["button","checkbox","color","file","hidden","image","radio","range","reset","submit"]),lt=(e,t={})=>{const{target:s,enabled:r=!0}=t;(0,d.useEffect)(()=>{const n=dt(s);if(!r||!n)return;const l=c=>{if(!ut(c)||c.defaultPrevented||mt(c.target))return;const u=o.resolveHistoryStep(c);if(!u)return;const m=e.current;m&&(u==="undo"?m.undo():m.redo())&&c.preventDefault()};return n.addEventListener("keydown",l),()=>n.removeEventListener("keydown",l)},[e,s,r])},dt=e=>e===void 0?window:e!==null&&"current"in e?e.current:e,ut=e=>"key"in e,mt=e=>e instanceof HTMLInputElement?!ct.has(e.type):e instanceof HTMLElement?e.isContentEditable||e.tagName==="TEXTAREA":!1,ht=()=>{const{targetBoundaryStore:e}=o.useGraphContext();return(0,B.useStore)(e,t=>t.boundary)};exports.BrandMark=o.BrandMark;exports.CanvasTextMeasurer=o.CanvasTextMeasurer;exports.DefaultFooter=o.DefaultFooter;exports.DefaultGrid=o.DefaultGrid;exports.DefaultHeader=o.DefaultHeader;exports.DefaultSwatch=o.DefaultSwatch;exports.DefaultTooltip=o.DefaultTooltip;exports.DevToolsPanel=rt;exports.GRAPH_MODES=o.GRAPH_MODES;exports.GeomCircle=Pe;exports.GeomLine=Le;exports.GeomPath=Me;exports.GeomRect=we;exports.GraphErrorBoundary=Q;exports.GraphErrorPanel=K;exports.GraphProvider=te;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=$e;exports.UnitSpaceSvg=Ae;exports.buildDotsEditOutlineShapes=o.buildDotsEditOutlineShapes;exports.createGraphyKit=Ie;exports.darkTheme=o.darkTheme;exports.defineGeomRenderer=o.defineGeomRenderer;exports.lightTheme=o.lightTheme;exports.lightenCss=o.lightenCss;exports.projectPointCartesian=o.projectPointCartesian;exports.pruneSelection=ee;exports.resolveBrandMarkVisual=o.resolveBrandMarkVisual;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.useGeomReaderTree=o.useGeomReaderTree;exports.useGeomStyleReader=o.useGeomStyleReader;exports.useGraphCommands=o.useGraphCommands;exports.useGraphHandle=o.useGraphHandle;exports.useGraphHistory=it;exports.useGraphHistoryShortcuts=lt;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=ht;exports.useTextMeasurer=o.useTextMeasurer;exports.vars=oe.vars;
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
- import { A as At, B as Ot, Bt as ge, Et as Kt, Ft as he, Gt as Ft, Ht as jt, I as Ut, It as Yt, L as Wt, M as Vt, Mt as pe, Nt as Xt, Ot as U, Pt as V, Tt as zt, Ut as Qt, Wt as Jt, Xt as Zt, a as er, at as tr, bt as rr, cn as nr, dn as sr, en as ar, fn as or, ft as ir, gn as Y, h as cr, hn as fe, i as lr, in as dr, it as ur, j as mr, jt as ve, ln as gr, mn as X, n as hr, nn as ye, on as pr, pn as Se, pt as fr, r as vr, rn as K, rt as yr, s as Sr, sn as br, t as be, tn as Er, un as Tr, ut as Rr, vt as Nr, w as Cr, xt as Gr, z as qr, zt as Dr } from "./history-chords-D59Eq2cm.js";
1
+ import { A as At, B as Ot, Bt as Kt, Dt as Ft, Et as Ut, Ft as V, Gt as jt, I as Yt, It as ge, Kt as Wt, L as Vt, Lt as Xt, M as zt, Mt as he, Nt as pe, Pt as Qt, St as Zt, Ut as Jt, Vt as fe, Wt as er, Zt as tr, _n as Y, a as rr, an as nr, at as sr, cn as ar, dn as or, dt as ir, fn as cr, gn as ve, h as lr, hn as X, i as dr, in as K, j as ur, kt as j, ln as mr, mn as ye, mt as gr, n as hr, nn as pr, ot as fr, pn as vr, pt as yr, r as Sr, rn as Se, rt as br, s as Er, sn as Tr, t as be, tn as Rr, un as Nr, w as Cr, xt as Gr, yt as qr, z as Dr } from "./history-chords-Cfaf8reL.js";
2
2
  import { n as kr } from "./theme.contract.css-AyXDNf0F.js";
3
- import { COMPILER_STAGE_KEYS as z, Geom as Ee, GraphCompilationSession as Te, areEditTargetsEqual as Re, buildDiagnostic as ee, createAnchorResolver as Ne, createCompiler as Ce, createDataLabelPlacementResolver as Ge, createSpecBuilder as qe, createStyleResolver as De, findAnnotation as Ie, findLayerById as te, isCompilerCachingEnabled as ke, resolveDefinition as we, setCompilerCachingEnabled as _e, toPercent as A } from "@graphysdk/viz-engine";
3
+ import { COMPILER_STAGE_KEYS as z, Geom as Ee, GraphCompilationSession as Te, areEditTargetsEqual as Re, buildDiagnostic as ee, createAnchorResolver as Ne, createCompiler as Ce, createDataLabelPlacementResolver as Ge, createSpecBuilder as qe, createStyleResolver as De, findAnnotation as Ie, findLayerById as te, isCompilerCachingEnabled as ke, resolveDefinition as _e, setCompilerCachingEnabled as we, toPercent as A } from "@graphysdk/viz-engine";
4
4
  import { Component as Pe, useCallback as f, useEffect as H, useId as Le, useImperativeHandle as $e, useMemo as M, useRef as re, useState as b, useSyncExternalStore as Me } from "react";
5
5
  import { Fragment as He, jsx as i, jsxs as v } from "react/jsx-runtime";
6
6
  import { useStore as W } from "zustand";
@@ -43,10 +43,10 @@ var ne = ({ errors: e }) => {
43
43
  })
44
44
  ]
45
45
  });
46
- function je(e = [], t = []) {
46
+ function Ue(e = [], t = []) {
47
47
  return e.length === t.length && e.every((n, r) => Object.is(n, t[r]));
48
48
  }
49
- var Ue = class extends Pe {
49
+ var je = class extends Pe {
50
50
  constructor(...e) {
51
51
  super(...e), this.state = { caughtDiagnostic: null };
52
52
  }
@@ -58,7 +58,7 @@ var Ue = class extends Pe {
58
58
  Y([n]), this.props.onError?.([n]), console.error("Chart render component stack:", t.componentStack);
59
59
  }
60
60
  componentDidUpdate(e) {
61
- this.state.caughtDiagnostic && !je(e.resetKeys, this.props.resetKeys) && this.setState({ caughtDiagnostic: null });
61
+ this.state.caughtDiagnostic && !Ue(e.resetKeys, this.props.resetKeys) && this.setState({ caughtDiagnostic: null });
62
62
  }
63
63
  render() {
64
64
  const { caughtDiagnostic: e } = this.state;
@@ -67,7 +67,7 @@ var Ue = class extends Pe {
67
67
  return t && t.length > 0 ? /* @__PURE__ */ i(ne, { errors: t }) : n;
68
68
  }
69
69
  }, ce = (e) => typeof e == "object" && "geom" in e && "render" in e, le = (e) => {
70
- const t = we(e);
70
+ const t = _e(e);
71
71
  return t instanceof Ee ? t : null;
72
72
  }, Ye = (e, t) => {
73
73
  const n = e.filter((r) => We(r, t));
@@ -79,7 +79,7 @@ var Ue = class extends Pe {
79
79
  })), Xe = (e, t) => e === t ? !0 : e.length !== t.length ? !1 : e.every((n, r) => {
80
80
  const s = t[r];
81
81
  return s !== void 0 && Re(n, s);
82
- }), ze = process.env.NODE_ENV !== "production", Qe = 5, Je = (e) => {
82
+ }), ze = process.env.NODE_ENV !== "production", Qe = 5, Ze = (e) => {
83
83
  if (!ze) return {
84
84
  emit: () => {
85
85
  },
@@ -105,7 +105,7 @@ var Ue = class extends Pe {
105
105
  getLastCompile: () => e.getLastCompile(),
106
106
  getCacheStats: () => e.getCacheStats()
107
107
  };
108
- }, Ze = () => Q((e) => ({
108
+ }, Je = () => Q((e) => ({
109
109
  lastCompile: null,
110
110
  history: [],
111
111
  nextId: 1,
@@ -143,7 +143,7 @@ var Ue = class extends Pe {
143
143
  return [...e.slice(r), t];
144
144
  };
145
145
  function nt(e) {
146
- const t = e.filter(ce), n = /* @__PURE__ */ new Set([...Object.keys(he), ...t.map((l) => l.geom)]), r = [], s = /* @__PURE__ */ new Set();
146
+ const t = e.filter(ce), n = /* @__PURE__ */ new Set([...Object.keys(ge), ...t.map((l) => l.geom)]), r = [], s = /* @__PURE__ */ new Set();
147
147
  for (const l of e) {
148
148
  const d = le(l);
149
149
  d === null || n.has(d.type) || s.has(d.type) || (s.add(d.type), r.push({
@@ -315,13 +315,13 @@ var ut = (e) => Q((t) => ({
315
315
  scene: e,
316
316
  setScene: (n) => t((r) => r.scene === n ? r : { scene: n })
317
317
  })), mt = ({ spec: e, data: t, customPalettes: n, colorScheme: r, plugins: s, resolveRenderer: c, anchorResolver: o, onSpecChange: l, onError: d, onWarnings: g }) => {
318
- const E = U(l), D = U(d), N = U(g), [{ session: h, compileBus: u }] = b(() => {
318
+ const E = j(l), D = j(d), N = j(g), [{ session: h, compileBus: u }] = b(() => {
319
319
  const a = Ce({ plugins: s });
320
320
  return {
321
321
  session: new Te(a),
322
- compileBus: Je(a)
322
+ compileBus: Ze(a)
323
323
  };
324
- }), [m] = b(() => nt(s ?? [])), C = re(null), [I] = b(gt), y = re(null), G = f((a) => m.errors.length === 0 ? a : [...m.errors, ...a ?? []], [m]), _ = f((a) => {
324
+ }), [m] = b(() => nt(s ?? [])), C = re(null), [I] = b(gt), y = re(null), G = f((a) => m.errors.length === 0 ? a : [...m.errors, ...a ?? []], [m]), w = f((a) => {
325
325
  if (!a.ok) return a.errors;
326
326
  if (y.current) y.current.getState().setScene(a.scene);
327
327
  else {
@@ -336,7 +336,7 @@ var ut = (e) => Q((t) => ({
336
336
  customPalettes: n,
337
337
  colorScheme: r
338
338
  });
339
- return C.current = a, G(_(a));
339
+ return C.current = a, G(w(a));
340
340
  }), T = f((a) => a.ok ? [
341
341
  ...a.warnings,
342
342
  ...st(a.scene, c),
@@ -368,7 +368,7 @@ var ut = (e) => Q((t) => ({
368
368
  });
369
369
  if (!a) return;
370
370
  a.committedSpec && E.current?.(a.committedSpec);
371
- const p = _(a.result);
371
+ const p = w(a.result);
372
372
  P(G(p)), p && R(p), q(T(a.result)), p || u.emit({ kind: a.specChanged ? "spec" : "data" });
373
373
  }, [
374
374
  e,
@@ -377,48 +377,48 @@ var ut = (e) => Q((t) => ({
377
377
  r,
378
378
  h,
379
379
  u,
380
- _,
380
+ w,
381
381
  R,
382
382
  q,
383
383
  G,
384
384
  T,
385
385
  E
386
386
  ]);
387
- const w = f((a) => {
387
+ const _ = f((a) => {
388
388
  P((p) => p === null ? p : G(null)), q(T(a));
389
389
  }, [
390
390
  G,
391
391
  q,
392
392
  T
393
393
  ]), L = f((a) => {
394
- a.scene && y.current?.getState().setScene(a.scene), a.result && w(a.result), a.command && u.emit({
394
+ a.scene && y.current?.getState().setScene(a.scene), a.result && _(a.result), a.command && u.emit({
395
395
  kind: "command",
396
396
  command: a.command
397
397
  }), a.spec && E.current?.(a.spec), a.errors && R([...a.errors]);
398
398
  }, [
399
- w,
399
+ _,
400
400
  u,
401
401
  E,
402
402
  R
403
403
  ]), S = f((a) => {
404
404
  for (const p of a) L(p);
405
405
  return a.some((p) => !!p.scene);
406
- }, [L]), j = f((a, p) => {
406
+ }, [L]), U = f((a, p) => {
407
407
  S(h.applyCommand(a, p));
408
408
  }, [h, S]), x = f(() => {
409
409
  S(h.commit());
410
- }, [h, S]), B = f(() => S(h.undo()), [h, S]), Z = f(() => S(h.redo()), [h, S]), ue = M(() => ({
410
+ }, [h, S]), B = f(() => S(h.undo()), [h, S]), J = f(() => S(h.redo()), [h, S]), ue = M(() => ({
411
411
  stack: h.history,
412
412
  undo: B,
413
- redo: Z
413
+ redo: J
414
414
  }), [
415
415
  h,
416
416
  B,
417
- Z
417
+ J
418
418
  ]), me = f(() => y.current?.getState().scene ?? null, []);
419
419
  return {
420
420
  store: y.current,
421
- dispatch: j,
421
+ dispatch: U,
422
422
  commit: x,
423
423
  history: ue,
424
424
  subscribe: I.subscribe,
@@ -435,7 +435,7 @@ var ut = (e) => Q((t) => ({
435
435
  notify: () => e.forEach((t) => t())
436
436
  };
437
437
  }, ht = ({ data: e, spec: t, plugins: n = [], formattingLocale: r, handleRef: s, onSpecChange: c, onError: o, onWarnings: l, customPalettes: d, colorScheme: g = "light", children: E }) => {
438
- const [D] = b(() => pe(n.filter(ce))), N = Le(), [h] = b(() => Ne(n)), [u] = b(() => Ge(n)), [m] = b(() => Ve()), [C] = b(() => ve()), I = M(() => De({ colorScheme: g }), [g]), { store: y, dispatch: G, commit: _, history: k, subscribe: P, getScene: T, compileBus: R, compileErrors: q } = mt({
438
+ const [D] = b(() => pe(n.filter(ce))), N = Le(), [h] = b(() => Ne(n)), [u] = b(() => Ge(n)), [m] = b(() => Ve()), [C] = b(() => he()), I = M(() => De({ colorScheme: g }), [g]), { store: y, dispatch: G, commit: w, history: k, subscribe: P, getScene: T, compileBus: R, compileErrors: q } = mt({
439
439
  spec: t,
440
440
  data: e,
441
441
  customPalettes: d,
@@ -449,18 +449,18 @@ var ut = (e) => Q((t) => ({
449
449
  });
450
450
  H(() => {
451
451
  if (y)
452
- return y.subscribe((S, j) => {
453
- if (S.scene.spec === j.scene.spec) return;
452
+ return y.subscribe((S, U) => {
453
+ if (S.scene.spec === U.scene.spec) return;
454
454
  const { selection: x, setSelection: B } = m.getState();
455
455
  x.length !== 0 && B(Ye(x, S.scene.spec));
456
456
  });
457
457
  }, [y, m]);
458
- const w = M(() => ({
458
+ const _ = M(() => ({
459
459
  dispatch: G,
460
- commit: _
461
- }), [G, _]);
460
+ commit: w
461
+ }), [G, w]);
462
462
  $e(s, () => ({
463
- commands: w,
463
+ commands: _,
464
464
  undo: k.undo,
465
465
  redo: k.redo,
466
466
  subscribe: P,
@@ -471,7 +471,7 @@ var ut = (e) => Q((t) => ({
471
471
  canPlaceDataLabels: u.hasCapability,
472
472
  canFormatDataLabelsAsPercentages: u.hasPercentageFormat
473
473
  }), [
474
- w,
474
+ _,
475
475
  k,
476
476
  P,
477
477
  T,
@@ -483,7 +483,7 @@ var ut = (e) => Q((t) => ({
483
483
  store: y,
484
484
  selectionStore: m,
485
485
  targetBoundaryStore: C,
486
- commands: w,
486
+ commands: _,
487
487
  history: k,
488
488
  formattingLocale: r,
489
489
  compileBus: R,
@@ -495,7 +495,7 @@ var ut = (e) => Q((t) => ({
495
495
  y,
496
496
  m,
497
497
  C,
498
- w,
498
+ _,
499
499
  k,
500
500
  r,
501
501
  R,
@@ -503,15 +503,15 @@ var ut = (e) => Q((t) => ({
503
503
  I,
504
504
  h
505
505
  ]);
506
- return /* @__PURE__ */ i(Ue, {
506
+ return /* @__PURE__ */ i(je, {
507
507
  forcedErrors: q,
508
508
  onError: o,
509
509
  resetKeys: [t, e],
510
- children: L ? /* @__PURE__ */ i(Se.Provider, {
510
+ children: L ? /* @__PURE__ */ i(ye.Provider, {
511
511
  value: L,
512
- children: /* @__PURE__ */ i(ge, {
512
+ children: /* @__PURE__ */ i(fe, {
513
513
  value: D,
514
- children: /* @__PURE__ */ i(fe, {
514
+ children: /* @__PURE__ */ i(ve, {
515
515
  value: u,
516
516
  children: E
517
517
  })
@@ -583,7 +583,7 @@ var Br = ({ shouldAnimateTransitions: e, cx: t, cy: n, r, ...s }) => e ? /* @__P
583
583
  d: t,
584
584
  ...r
585
585
  }), pt = ({ d: e, source: t, ...n }) => {
586
- const r = ye(e, K, t);
586
+ const r = Se(e, K, t);
587
587
  return /* @__PURE__ */ i(F.path, {
588
588
  d: r,
589
589
  ...n
@@ -596,7 +596,7 @@ var Br = ({ shouldAnimateTransitions: e, cx: t, cy: n, r, ...s }) => e ? /* @__P
596
596
  pointerEvents: "none",
597
597
  ...t,
598
598
  children: e
599
- }), jr = ({ box: e, children: t }) => /* @__PURE__ */ i("svg", {
599
+ }), Ur = ({ box: e, children: t }) => /* @__PURE__ */ i("svg", {
600
600
  x: A(e.x0),
601
601
  y: A(e.y0),
602
602
  width: A(e.x1 - e.x0),
@@ -616,8 +616,8 @@ var It = "drqe3uh", kt = "drqe3ui", oe = {
616
616
  ran: "drqe3uq drqe3up",
617
617
  cached: "drqe3ur drqe3up",
618
618
  untouched: "drqe3us drqe3up"
619
- }, Ur = ({ width: e = 440, style: t, className: n } = {}) => {
620
- const { compileBus: r } = X(), [s] = b(() => Ze()), [c, o] = b(!1), [l, d] = b(ke);
619
+ }, jr = ({ width: e = 440, style: t, className: n } = {}) => {
620
+ const { compileBus: r } = X(), [s] = b(() => Je()), [c, o] = b(!1), [l, d] = b(ke);
621
621
  H(() => {
622
622
  const { recordCompile: u } = s.getState(), m = r.getLastTrigger(), C = r.getLastCompile();
623
623
  return m && C && u(m, C), r.subscribe(u);
@@ -625,7 +625,7 @@ var It = "drqe3uh", kt = "drqe3ui", oe = {
625
625
  const g = W(s, (u) => u.lastCompile), E = W(s, (u) => u.history), D = r.getCacheStats(), N = g === null && E.length === 0, h = () => {
626
626
  d((u) => {
627
627
  const m = !u;
628
- return _e(m), m;
628
+ return we(m), m;
629
629
  });
630
630
  };
631
631
  return /* @__PURE__ */ v("div", {
@@ -642,7 +642,7 @@ var It = "drqe3uh", kt = "drqe3ui", oe = {
642
642
  children: "compile cache"
643
643
  }), /* @__PURE__ */ i("div", {
644
644
  className: qt,
645
- children: N ? "production: stats disabled" : g ? `last: ${g.label} · ${J(g.durationMs)}` : "awaiting first compile…"
645
+ children: N ? "production: stats disabled" : g ? `last: ${g.label} · ${Z(g.durationMs)}` : "awaiting first compile…"
646
646
  })] }), /* @__PURE__ */ i("button", {
647
647
  type: "button",
648
648
  onClick: () => o((u) => !u),
@@ -663,14 +663,14 @@ var It = "drqe3uh", kt = "drqe3ui", oe = {
663
663
  children: "next compile reflects this toggle"
664
664
  })]
665
665
  }),
666
- !c && !N && /* @__PURE__ */ v(He, { children: [/* @__PURE__ */ i(wt, {
666
+ !c && !N && /* @__PURE__ */ v(He, { children: [/* @__PURE__ */ i(_t, {
667
667
  delta: g?.stages,
668
668
  durations: g?.stageDurationsMs,
669
669
  cumulative: D
670
- }), /* @__PURE__ */ i(_t, { entries: E })] })
670
+ }), /* @__PURE__ */ i(wt, { entries: E })] })
671
671
  ]
672
672
  });
673
- }, wt = ({ delta: e, durations: t, cumulative: n }) => /* @__PURE__ */ v("table", {
673
+ }, _t = ({ delta: e, durations: t, cumulative: n }) => /* @__PURE__ */ v("table", {
674
674
  className: yt,
675
675
  children: [/* @__PURE__ */ i("thead", { children: /* @__PURE__ */ v("tr", {
676
676
  className: It,
@@ -718,7 +718,7 @@ var It = "drqe3uh", kt = "drqe3ui", oe = {
718
718
  }),
719
719
  /* @__PURE__ */ i("td", {
720
720
  className: O,
721
- children: t === void 0 || c === "untouched" ? "—" : J(t[r])
721
+ children: t === void 0 || c === "untouched" ? "—" : Z(t[r])
722
722
  }),
723
723
  /* @__PURE__ */ i("td", {
724
724
  className: c === "ran" ? ie.ran : ie.dim,
@@ -739,7 +739,7 @@ var It = "drqe3uh", kt = "drqe3ui", oe = {
739
739
  ]
740
740
  }, r);
741
741
  }) })]
742
- }), _t = ({ entries: e }) => e.length === 0 ? null : /* @__PURE__ */ v("div", {
742
+ }), wt = ({ entries: e }) => e.length === 0 ? null : /* @__PURE__ */ v("div", {
743
743
  className: Gt,
744
744
  children: [/* @__PURE__ */ i("div", {
745
745
  className: kt,
@@ -765,7 +765,7 @@ var It = "drqe3uh", kt = "drqe3ui", oe = {
765
765
  "/",
766
766
  r,
767
767
  " ran · ",
768
- J(t.durationMs)
768
+ Z(t.durationMs)
769
769
  ]
770
770
  })
771
771
  ]
@@ -775,7 +775,7 @@ var It = "drqe3uh", kt = "drqe3ui", oe = {
775
775
  let n = 0;
776
776
  for (const r of z) t(e[r]) && (n += 1);
777
777
  return n;
778
- }, J = (e) => e < 0.1 ? "<0.1ms" : e >= 10 ? `${e.toFixed(0)}ms` : `${e.toFixed(2)}ms`, Yr = () => {
778
+ }, Z = (e) => e < 0.1 ? "<0.1ms" : e >= 10 ? `${e.toFixed(0)}ms` : `${e.toFixed(2)}ms`, Yr = () => {
779
779
  const { history: e } = X(), { stack: t, undo: n, redo: r } = e, s = f((l) => t.subscribe(l), [t]), c = f(() => t.getSnapshot(), [t]), o = Me(s, c, c);
780
780
  return M(() => ({
781
781
  ...o,
@@ -820,63 +820,63 @@ var It = "drqe3uh", kt = "drqe3ui", oe = {
820
820
  return W(e, (t) => t.boundary);
821
821
  };
822
822
  export {
823
- qr as BrandMark,
824
- Jt as CanvasTextMeasurer,
825
- Wt as DefaultFooter,
826
- Sr as DefaultGrid,
827
- Ut as DefaultHeader,
828
- Dr as DefaultSwatch,
829
- ur as DefaultTooltip,
830
- Ur as DevToolsPanel,
831
- Nr as GRAPH_MODES,
823
+ Dr as BrandMark,
824
+ jt as CanvasTextMeasurer,
825
+ Vt as DefaultFooter,
826
+ Er as DefaultGrid,
827
+ Yt as DefaultHeader,
828
+ Kt as DefaultSwatch,
829
+ sr as DefaultTooltip,
830
+ jr as DevToolsPanel,
831
+ qr as GRAPH_MODES,
832
832
  Br as GeomCircle,
833
833
  Ar as GeomLine,
834
834
  Kr as GeomPath,
835
835
  Or as GeomRect,
836
- Ue as GraphErrorBoundary,
836
+ je as GraphErrorBoundary,
837
837
  ne as GraphErrorPanel,
838
838
  ht as GraphProvider,
839
- er as GraphRenderer,
840
- Kt as HoverProvider,
841
- Yt as IntroFade,
842
- Er as IntroWipeClip,
843
- jt as TextMeasurerProvider,
844
- Rr as ThemeProvider,
845
- jr as UnitBoxSvg,
839
+ rr as GraphRenderer,
840
+ Ft as HoverProvider,
841
+ Xt as IntroFade,
842
+ pr as IntroWipeClip,
843
+ Jt as TextMeasurerProvider,
844
+ ir as ThemeProvider,
845
+ Ur as UnitBoxSvg,
846
846
  Fr as UnitSpaceSvg,
847
- dr as buildDotsEditOutlineShapes,
847
+ nr as buildDotsEditOutlineShapes,
848
848
  xr as createGraphyKit,
849
- ir as darkTheme,
850
- Xt as defineGeomRenderer,
851
- fr as lightTheme,
852
- Zt as lightenCss,
853
- br as projectPointCartesian,
849
+ yr as darkTheme,
850
+ Qt as defineGeomRenderer,
851
+ gr as lightTheme,
852
+ tr as lightenCss,
853
+ ar as projectPointCartesian,
854
854
  Ye as pruneSelection,
855
855
  Ot as resolveBrandMarkVisual,
856
- pr as scalePointToPanel,
856
+ Tr as scalePointToPanel,
857
857
  At as stampAxisEditTarget,
858
- mr as stampGridEditTarget,
859
- Vt as stampLegendEditTarget,
860
- Gr as useElementScreenRect,
861
- zt as useGeomHitTest,
862
- rr as useGeomHover,
863
- nr as useGeomReaderTree,
864
- gr as useGeomStyleReader,
858
+ ur as stampGridEditTarget,
859
+ zt as stampLegendEditTarget,
860
+ Zt as useElementScreenRect,
861
+ Ut as useGeomHitTest,
862
+ Gr as useGeomHover,
863
+ mr as useGeomReaderTree,
864
+ Nr as useGeomStyleReader,
865
865
  hr as useGraphCommands,
866
- lr as useGraphHandle,
866
+ dr as useGraphHandle,
867
867
  Yr as useGraphHistory,
868
868
  Wr as useGraphHistoryShortcuts,
869
- yr as useGraphLocale,
870
- cr as useGraphSelection,
869
+ br as useGraphLocale,
870
+ lr as useGraphSelection,
871
871
  Cr as useGuidesTakePress,
872
- vr as useHandleScene,
873
- tr as useHoverState,
874
- ar as usePaintDefs,
875
- Ft as useResolvedStyle,
876
- or as useSceneSelector,
877
- Tr as useStyleReaderTree,
878
- sr as useStyleResolver,
872
+ Sr as useHandleScene,
873
+ fr as useHoverState,
874
+ Rr as usePaintDefs,
875
+ Wt as useResolvedStyle,
876
+ vr as useSceneSelector,
877
+ or as useStyleReaderTree,
878
+ cr as useStyleResolver,
879
879
  Vr as useTargetBoundary,
880
- Qt as useTextMeasurer,
880
+ er as useTextMeasurer,
881
881
  kr as vars
882
882
  };
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "visualization",
12
12
  "renderer"
13
13
  ],
14
- "version": "1.9.0-beta.1791282086791",
14
+ "version": "1.9.0-beta.1791291594669",
15
15
  "type": "module",
16
16
  "sideEffects": [
17
17
  "**/*.css.ts",
@@ -55,7 +55,7 @@
55
55
  "react-colorful": "^5.6.1",
56
56
  "react-intl": "^8.1.3",
57
57
  "zustand": "^5.0.12",
58
- "@graphysdk/viz-engine": "1.9.0-beta.1791282086791"
58
+ "@graphysdk/viz-engine": "1.9.0-beta.1791291594669"
59
59
  },
60
60
  "peerDependencies": {
61
61
  "@tiptap/core": "^3.0.0",
@@ -156,9 +156,9 @@
156
156
  "vite-plugin-lib-inject-css": "^2.2.2",
157
157
  "vitest": "^4.1.11",
158
158
  "@graphytools/eslint-config": "0.0.1",
159
- "@graphytools/eslint-plugin-graphy": "1.0.0",
159
+ "@graphytools/vitest-config": "1.0.0",
160
160
  "@graphytools/typescript-config": "0.0.1",
161
- "@graphytools/vitest-config": "1.0.0"
161
+ "@graphytools/eslint-plugin-graphy": "1.0.0"
162
162
  },
163
163
  "publishConfig": {
164
164
  "access": "public"