@graphysdk/react-renderer 1.9.0-beta.1789573335651 → 1.9.0-beta.1789582064893

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 c=require("./history-chords-CSMD3xY9.cjs"),se=require("./theme.contract.css-Dd-73-Je.cjs");let m=require("@graphysdk/viz-engine"),l=require("react"),a=require("react/jsx-runtime"),A=require("zustand"),B=require("zustand/vanilla"),$=require("clsx");$=c.__toESM($,1);var ne="_1a5iqpb0",oe="_1a5iqpb1";var ae="_1a5iqpb3",ie="_1a5iqpb4",ce="_1a5iqpb5";var L=({errors:e})=>{const[t,...r]=e;return(0,a.jsxs)("div",{role:"alert",className:ne,children:[(0,a.jsx)("strong",{className:oe,children:"This chart could not be rendered."}),t&&(0,a.jsx)(U,{diagnostic:t}),r.length>0&&(0,a.jsx)("ul",{className:"_1a5iqpb2",children:r.map((s,o)=>(0,a.jsx)("li",{children:(0,a.jsx)(U,{diagnostic:s})},`${s.code}-${o}`))})]})},U=({diagnostic:e})=>(0,a.jsxs)("div",{className:ae,children:[(0,a.jsx)("span",{className:ie,children:e.code}),(0,a.jsx)("p",{className:ce,children:e.message}),e.suggestion&&(0,a.jsx)("p",{className:"_1a5iqpb6",children:e.suggestion})]});function le(e=[],t=[]){return e.length===t.length&&e.every((r,s)=>Object.is(r,t[s]))}var W=class extends l.Component{constructor(...e){super(...e),this.state={caughtDiagnostic:null}}static getDerivedStateFromError(e){return{caughtDiagnostic:(0,m.buildDiagnostic)(e)}}componentDidCatch(e,t){const r=(0,m.buildDiagnostic)(e);c.logDiagnostics([r]),this.props.onError?.([r]),console.error("Chart render component stack:",t.componentStack)}componentDidUpdate(e){this.state.caughtDiagnostic&&!le(e.resetKeys,this.props.resetKeys)&&this.setState({caughtDiagnostic:null})}render(){const{caughtDiagnostic:e}=this.state;if(e)return(0,a.jsx)(L,{errors:[e]});const{forcedErrors:t,children:r}=this.props;return t&&t.length>0?(0,a.jsx)(L,{errors:t}):r}},z=e=>typeof e=="object"&&"geom"in e&&"render"in e,de=e=>{const t=(0,m.resolveDefinition)(e);return t instanceof m.Geom?t:null},X=(e,t)=>{const r=e.filter(s=>ue(s,t));return r.length===e.length?e:r},ue=(e,t)=>e.kind==="annotation"?(0,m.findAnnotation)(t.annotations,e.id)!==null:e.kind==="observations"||e.kind==="layer"&&e.layerId!==void 0?(0,m.findLayerById)(t.layers,e.layerId)!==void 0:!0,Y=[],he=()=>(0,B.createStore)(e=>({selection:Y,setSelection:t=>e(r=>ge(r.selection,t)?r:{selection:t}),clearSelection:()=>e(t=>t.selection.length===0?t:{selection:Y})})),ge=(e,t)=>e===t?!0:e.length!==t.length?!1:e.every((r,s)=>{const o=t[s];return o!==void 0&&(0,m.areEditTargetsEqual)(r,o)}),me=process.env.NODE_ENV!=="production",pe=5,fe=e=>{if(!me)return{emit:()=>{},subscribe:()=>ye,getLastTrigger:()=>null,getLastCompile:()=>null,getCacheStats:()=>e.getCacheStats()};const t=new Set;let r=null;return{emit:s=>{const o=e.getLastCompile();if(o){r=s;for(const d of t)d(s,o)}},subscribe:s=>(t.add(s),()=>{t.delete(s)}),getLastTrigger:()=>r,getLastCompile:()=>e.getLastCompile(),getCacheStats:()=>e.getCacheStats()}},ve=()=>(0,B.createStore)(e=>({lastCompile:null,history:[],nextId:1,lastSnapshot:null,recordCompile:(t,r)=>e(s=>{if(s.lastSnapshot===r)return s;const o={id:s.nextId,label:Se(t),stages:r.stages,durationMs:r.durationMs};return{lastCompile:o,history:be(s.history,o,pe),nextId:s.nextId+1,lastSnapshot:r}})})),ye=()=>{},Se=e=>{switch(e.kind){case"init":return"init";case"input":return"input change";case"data":return"data change";case"command":return e.command.metadata.description}},be=(e,t,r)=>{const s=e.length>=r?e.length-(r-1):0;return[...e.slice(s),t]};function Ee(e){const t=e.filter(z),r=new Set([...Object.keys(c.BUILT_IN_GEOM_RENDERERS),...t.map(u=>u.geom)]),s=[],o=new Set;for(const u of e){const g=de(u);g===null||r.has(g.type)||o.has(g.type)||(o.add(g.type),s.push({kind:"user-input",severity:"error",code:"MISSING_GEOM_RENDERER",message:`Custom geom '${g.type}' is registered but has no renderer.`,context:{requested:g.type,kind:"geom-renderer"},suggestion:`Add a render half for it: \`defineGeomRenderer(${g.type}Geom, { coord, render })\`, then include it in \`plugins\`.`}))}const d=new Map;for(const u of t){if("definition"in u)continue;const g=`${u.geom}|${u.coord}`,p=d.get(g);p?p.count+=1:d.set(g,{geom:u.geom,coord:u.coord,count:1})}const i=[];for(const{geom:u,coord:g,count:p}of d.values())p<2||i.push({kind:"user-input",severity:"warning",code:"DUPLICATE_REGISTERED_TYPE",message:`Multiple render-only overrides register ('${u}', '${g}') (${p} entries); the last in the array wins.`,context:{requested:`${u}@${g}`,kind:"geom-renderer"},suggestion:`Keep a single render-only override for ('${u}', '${g}').`});return{errors:s,warnings:i}}function xe(e,t){const{coordSystem:r,layers:s}=e,o=new Set,d=[];for(const i of s)t(i.geom,r.type)!==null||o.has(i.geom)||(o.add(i.geom),d.push({kind:"user-input",severity:"warning",code:"MISSING_GEOM_RENDERER",message:`No renderer for geom '${i.geom}' under ${r.type} coords; the layer is not painted.`,context:{requested:i.geom,kind:"geom-renderer"},suggestion:`Register a renderer for ('${i.geom}', '${r.type}') via \`defineGeomRenderer\`.`}));return d}function Te(e,t){const{coordSystem:r,layers:s}=e,o=new Set,d=[];for(const i of s){if(i.interactive===!1||i.spatialKind!=="render-hit-test"||o.has(i.geom))continue;const u=t(i.geom,r.type);u===null||u.hitTest||c.isOverlayHosted(u)||(o.add(i.geom),d.push({kind:"user-input",severity:"warning",code:"MISSING_RENDER_HIT_TEST",message:`Geom '${i.geom}' declares spatialKind 'render-hit-test' but its renderer provides no hit-test; the layer has no hover.`,context:{requested:i.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 ('${i.geom}', '${r.type}').`}))}return d}function Ce(e){const t=new Set,r=[];for(const s of e.layers){const o=s.identityKey;s.interactive!==!1&&(s.spatialKind!=="render-hit-test"||typeof o!="object"||t.has(s.geom)||s.data.hasVariable(o.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 '${o.variable}', a column its compile output does not emit; its hover lookup is empty.`,context:{requested:s.geom,kind:"geom-renderer"},suggestion:`Emit the '${o.variable}' column from the geom's \`compile()\`, or point \`identityKey\` at a column it does emit.`})))}return r}function Re(e,t){const{coordSystem:r,layers:s}=e,o=new Set,d=[];for(const i of s){if(i.interactive===!1||i.spatialKind!=="render-hit-test"||o.has(i.geom))continue;const u=t(i.geom,r.type);u===null||!u.hitTest||!c.isOverlayHosted(u)||(o.add(i.geom),d.push({kind:"user-input",severity:"warning",code:"CONFLICTING_RENDER_HIT_TEST",message:`Geom '${i.geom}' declares both a \`hitTest\` factory and an overlay render; these are alternatives, so only the overlay is used.`,context:{requested:i.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 d}function Ge(e,t){const r=new Set,s=[];for(const o of e.layers)o.interactive!==!1&&(o.spatialKind!=="render-hit-test"||r.has(o.geom)||t.hasCapability(o.geom)||(r.add(o.geom),s.push({kind:"user-input",severity:"warning",code:"MISSING_ANCHOR_CAPABILITY",message:`Geom '${o.geom}' declares no \`resolveAnchorPosition\`; its observations cannot be annotated, so the editor overlay paints no creation trigger on them.`,context:{requested:o.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 qe(e,t){const{coordSystem:r,layers:s}=e,o=new Set,d=[];for(const i of s){if(i.interactive===!1||i.spatialKind==="render-hit-test"||o.has(i.geom))continue;const u=t(i.geom,r.type);u===null||!c.isOverlayHosted(u)||(o.add(i.geom),d.push({kind:"user-input",severity:"warning",code:"OVERLAY_REQUIRES_RENDER_HIT_TEST",message:`Geom '${i.geom}' declares an overlay render but its layer's spatialKind is '${i.spatialKind}', not 'render-hit-test'; the overlay's push-path hover resolves to nothing.`,context:{requested:i.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 d}var ke=e=>(0,B.createStore)(t=>({scene:e,setScene:r=>t(s=>s.scene===r?s:{scene:r})})),Ne=({input:e,data:t,customPalettes:r,colorScheme:s,plugins:o,resolveRenderer:d,anchorResolver:i,onChange:u,onError:g,onWarnings:p})=>{const T=c.useLatestRef(u),k=c.useLatestRef(g),G=c.useLatestRef(p),[{session:f,compileBus:h}]=(0,l.useState)(()=>{const n=(0,m.createCompiler)({plugins:o});return{session:new m.GraphCompilationSession(n),compileBus:fe(n)}}),[y]=(0,l.useState)(()=>Ee(o??[])),S=(0,l.useRef)(null),[N]=(0,l.useState)(_e),C=(0,l.useRef)(null),b=(0,l.useCallback)(n=>y.errors.length===0?n:[...y.errors,...n??[]],[y]),j=(0,l.useCallback)(n=>{if(!n.ok)return n.errors;if(C.current)C.current.getState().setScene(n.scene);else{const v=ke(n.scene);v.subscribe(N.notify),C.current=v,N.notify()}return null},[N]),[I,D]=(0,l.useState)(()=>{const n=f.compile({input:e,data:t,customPalettes:r,colorScheme:s});return S.current=n,b(j(n))}),q=(0,l.useCallback)(n=>n.ok?[...n.warnings,...xe(n.scene,d),...Te(n.scene,d),...Ce(n.scene),...Re(n.scene,d),...qe(n.scene,d),...Ge(n.scene,i)]:n.warnings,[d,i]),E=(0,l.useCallback)(n=>{n.length!==0&&(c.logDiagnostics(n),k.current?.(n))},[k]),R=(0,l.useCallback)(n=>{n.length!==0&&(c.logDiagnostics(n),G.current?.(n))},[G]);(0,l.useEffect)(()=>{const n=S.current;n&&(E([...y.errors,...n.ok?[]:n.errors]),R([...y.warnings,...q(n)]),n.ok&&h.emit({kind:"init"}))},[h,E,R,y,q]),(0,l.useEffect)(()=>{const n=f.update({input:e,data:t,customPalettes:r,colorScheme:s});if(!n)return;n.sealedInput&&T.current?.(n.sealedInput);const v=j(n.result);D(b(v)),v&&E(v),R(q(n.result)),v||h.emit({kind:n.inputChanged?"input":"data"})},[e,t,r,s,f,h,j,E,R,b,q,T]);const _=(0,l.useCallback)(n=>{D(v=>v===null?v:b(null)),R(q(n))},[b,R,q]),w=(0,l.useCallback)(n=>{n.scene&&C.current?.getState().setScene(n.scene),n.result&&_(n.result),n.command&&h.emit({kind:"command",command:n.command}),n.input&&T.current?.(n.input),n.errors&&E([...n.errors])},[_,h,T,E]),x=(0,l.useCallback)(n=>{for(const v of n)w(v);return n.some(v=>!!v.scene)},[w]),M=(0,l.useCallback)((n,v)=>{x(f.applyCommand(n,v))},[f,x]),ee=(0,l.useCallback)(()=>{x(f.seal())},[f,x]),O=(0,l.useCallback)(()=>x(f.undo()),[f,x]),K=(0,l.useCallback)(()=>x(f.redo()),[f,x]),te=(0,l.useMemo)(()=>({stack:f.history,undo:O,redo:K}),[f,O,K]),re=(0,l.useCallback)(()=>C.current?.getState().scene??null,[]);return{store:C.current,dispatch:M,seal:ee,history:te,subscribe:N.subscribe,getScene:re,compileBus:h,compileErrors:I}},_e=()=>{const e=new Set;return{subscribe:t=>(e.add(t),()=>{e.delete(t)}),notify:()=>e.forEach(t=>t())}},Q=({data:e,input:t,plugins:r=[],formattingLocale:s,handleRef:o,onChange:d,onError:i,onWarnings:u,customPalettes:g,colorScheme:p="light",children:T})=>{const[k]=(0,l.useState)(()=>c.createGeomRendererResolver(r.filter(z))),G=(0,l.useId)(),[f]=(0,l.useState)(()=>(0,m.createAnchorResolver)(r)),[h]=(0,l.useState)(()=>he()),y=(0,l.useMemo)(()=>(0,m.createStyleResolver)({colorScheme:p}),[p]),{store:S,dispatch:N,seal:C,history:b,subscribe:j,getScene:I,compileBus:D,compileErrors:q}=Ne({input:t,data:e,customPalettes:g,colorScheme:p,plugins:r,resolveRenderer:k,anchorResolver:f,onChange:d,onError:i,onWarnings:u});(0,l.useEffect)(()=>{if(S)return S.subscribe((_,w)=>{if(_.scene.spec===w.scene.spec)return;const{selection:x,setSelection:M}=h.getState();x.length!==0&&M(X(x,_.scene.spec))})},[S,h]);const E=(0,l.useMemo)(()=>({dispatch:N,seal:C}),[N,C]);(0,l.useImperativeHandle)(o,()=>({commands:E,undo:b.undo,redo:b.redo,subscribe:j,getScene:I,getSelection:()=>h.getState().selection,setSelection:_=>h.getState().setSelection(_),subscribeSelection:h.subscribe}),[E,b,j,I,h]);const R=(0,l.useMemo)(()=>S?{chartId:G,store:S,selectionStore:h,commands:E,history:b,formattingLocale:s,compileBus:D,colorScheme:p,styleResolver:y,anchorResolver:f}:null,[G,S,h,E,b,s,D,p,y,f]);return(0,a.jsx)(W,{forcedErrors:q,onError:i,resetKeys:[t,e],children:R?(0,a.jsx)(c.GraphContext.Provider,{value:R,children:(0,a.jsx)(c.GeomRendererResolverProvider,{value:k,children:T})}):null})};function je(e){const t=(0,m.createGraphyBuilder)(e);return{...t,GraphProvider:s=>(0,a.jsx)(Q,{...s,plugins:t.plugins})}}var De=({children:e,...t})=>(0,a.jsx)("svg",{viewBox:"0 0 1 1",preserveAspectRatio:"none",width:"100%",height:"100%",pointerEvents:"none",...t,children:e}),Ie=({box:e,children:t})=>(0,a.jsx)("svg",{x:(0,m.toPercent)(e.x0),y:(0,m.toPercent)(e.y0),width:(0,m.toPercent)(e.x1-e.x0),height:(0,m.toPercent)(e.y1-e.y0),overflow:"hidden",pointerEvents:"none",children:t}),we="drqe3u0",He="drqe3u1",Me="drqe3u2",Pe="drqe3u3",H="drqe3u4",$e="drqe3u5",Le="drqe3u6",Be="drqe3u7",P="drqe3u8",Oe="drqe3u9",Ke="drqe3ua";var Ae="drqe3uc",Ue="drqe3ud",Ye="drqe3ue",Fe="drqe3uf";var Ve="drqe3uh",We="drqe3ui",F={enabled:"drqe3uk drqe3uj",disabled:"drqe3ul drqe3uj"},V={ran:"drqe3un drqe3um",dim:"drqe3uo drqe3um"},J={ran:"drqe3uq drqe3up",cached:"drqe3ur drqe3up",untouched:"drqe3us drqe3up"},ze=({width:e=380,style:t,className:r}={})=>{const{compileBus:s}=c.useGraphContext(),[o]=(0,l.useState)(()=>ve()),[d,i]=(0,l.useState)(!1),[u,g]=(0,l.useState)(m.isCompilerCachingEnabled);(0,l.useEffect)(()=>{const{recordCompile:h}=o.getState(),y=s.getLastTrigger(),S=s.getLastCompile();return y&&S&&h(y,S),s.subscribe(h)},[o,s]);const p=(0,A.useStore)(o,h=>h.lastCompile),T=(0,A.useStore)(o,h=>h.history),k=s.getCacheStats(),G=p===null&&T.length===0,f=()=>{g(h=>{const y=!h;return(0,m.setCompilerCachingEnabled)(y),y})};return(0,a.jsxs)("div",{className:(0,$.default)(Ke,r),style:{width:e,...t},children:[(0,a.jsxs)("div",{className:we,children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:He,children:"compile cache"}),(0,a.jsx)("div",{className:Ye,children:G?"production: stats disabled":p?`last: ${p.label} · ${Z(p.durationMs)}`:"awaiting first compile…"})]}),(0,a.jsx)("button",{type:"button",onClick:()=>i(h=>!h),className:Fe,children:d?"▾":"▴"})]}),!d&&(0,a.jsxs)("div",{className:"drqe3ub",children:[(0,a.jsxs)("button",{type:"button",onClick:f,className:u?F.enabled:F.disabled,"aria-pressed":u,children:["cache ",u?"enabled":"disabled"]}),(0,a.jsx)("span",{className:"drqe3ug",children:"next compile reflects this toggle"})]}),!d&&!G&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(Xe,{delta:p?.stages,cumulative:k}),(0,a.jsx)(Qe,{entries:T})]})]})},Xe=({delta:e,cumulative:t})=>(0,a.jsxs)("table",{className:Me,children:[(0,a.jsx)("thead",{children:(0,a.jsxs)("tr",{className:Ve,children:[(0,a.jsx)("th",{className:Pe,children:"stage"}),(0,a.jsx)("th",{className:H,children:"Δ miss"}),(0,a.jsx)("th",{className:H,children:"Δ hit"}),(0,a.jsx)("th",{className:H,children:"total miss"}),(0,a.jsx)("th",{className:H,children:"total hit"})]})}),(0,a.jsx)("tbody",{children:m.COMPILER_STAGE_KEYS.map(r=>{const s=e?.[r],o=Je(s);return(0,a.jsxs)("tr",{className:Ae,children:[(0,a.jsxs)("td",{className:$e,children:[(0,a.jsx)("span",{className:J[o],"aria-hidden":!0})," ",r]}),(0,a.jsx)("td",{className:o==="ran"?V.ran:V.dim,children:s?.misses??0}),(0,a.jsx)("td",{className:P,children:s?.hits??0}),(0,a.jsx)("td",{className:P,children:t[r].misses}),(0,a.jsx)("td",{className:P,children:t[r].hits})]},r)})})]}),Qe=({entries:e})=>e.length===0?null:(0,a.jsxs)("div",{className:Ue,children:[(0,a.jsx)("div",{className:We,children:"recent compiles"}),e.map(t=>{const r=Ze(t.stages,d=>d.misses>0),s=m.COMPILER_STAGE_KEYS.length,o=r===0?"cached":"ran";return(0,a.jsxs)("div",{className:Le,children:[(0,a.jsx)("span",{className:J[o],"aria-hidden":!0}),(0,a.jsx)("span",{className:Be,title:t.label,children:t.label}),(0,a.jsxs)("span",{className:Oe,children:[r,"/",s," ran · ",Z(t.durationMs)]})]},t.id)})]}),Je=e=>!e||e.hits===0&&e.misses===0?"untouched":e.misses>0?"ran":"cached",Ze=(e,t)=>{let r=0;for(const s of m.COMPILER_STAGE_KEYS)t(e[s])&&(r+=1);return r},Z=e=>e>=10?`${e.toFixed(0)}ms`:`${e.toFixed(2)}ms`,et=()=>{const{history:e}=c.useGraphContext(),{stack:t,undo:r,redo:s}=e,o=(0,l.useCallback)(u=>t.subscribe(u),[t]),d=(0,l.useCallback)(()=>t.getSnapshot(),[t]),i=(0,l.useSyncExternalStore)(o,d,d);return(0,l.useMemo)(()=>({...i,undo:r,redo:s}),[i,r,s])},tt=new Set(["button","checkbox","color","file","hidden","image","radio","range","reset","submit"]),rt=(e,t={})=>{const{target:r,enabled:s=!0}=t;(0,l.useEffect)(()=>{const o=st(r);if(!s||!o)return;const d=i=>{if(!nt(i)||i.defaultPrevented||ot(i.target))return;const u=c.resolveHistoryStep(i);if(!u)return;const g=e.current;g&&(u==="undo"?g.undo():g.redo())&&i.preventDefault()};return o.addEventListener("keydown",d),()=>o.removeEventListener("keydown",d)},[e,r,s])},st=e=>e===void 0?window:e!==null&&"current"in e?e.current:e,nt=e=>"key"in e,ot=e=>e instanceof HTMLInputElement?!tt.has(e.type):e instanceof HTMLElement?e.isContentEditable||e.tagName==="TEXTAREA":!1;exports.BrandMark=c.BrandMark;exports.CanvasTextMeasurer=c.CanvasTextMeasurer;exports.DefaultFooter=c.DefaultFooter;exports.DefaultGrid=c.DefaultGrid;exports.DefaultHeader=c.DefaultHeader;exports.DefaultSwatch=c.DefaultSwatch;exports.DefaultTooltip=c.DefaultTooltip;exports.DevToolsPanel=ze;exports.GRAPH_MODES=c.GRAPH_MODES;exports.GraphErrorBoundary=W;exports.GraphErrorPanel=L;exports.GraphProvider=Q;exports.GraphRenderer=c.GraphRenderer;exports.HoverProvider=c.HoverProvider;exports.TextMeasurerProvider=c.TextMeasurerProvider;exports.ThemeProvider=c.ThemeProvider;exports.UnitBoxSvg=Ie;exports.UnitSpaceSvg=De;exports.createGraphyKit=je;exports.darkTheme=c.darkTheme;exports.defineGeomRenderer=c.defineGeomRenderer;exports.lightTheme=c.lightTheme;exports.lightenCss=c.lightenCss;exports.pruneSelection=X;exports.resolveBrandMarkVisual=c.resolveBrandMarkVisual;exports.stampGridEditTarget=c.stampGridEditTarget;exports.useElementScreenRect=c.useElementScreenRect;exports.useGeomHitTest=c.useGeomHitTest;exports.useGeomHover=c.useGeomHover;exports.useGraphCommands=c.useGraphCommands;exports.useGraphHandle=c.useGraphHandle;exports.useGraphHistory=et;exports.useGraphHistoryShortcuts=rt;exports.useGraphSelection=c.useGraphSelection;exports.useGuidesTakePress=c.useGuidesTakePress;exports.useHandleScene=c.useHandleScene;exports.useHoverState=c.useHoverState;exports.useSceneSelector=c.useSceneSelector;exports.useStyleReaderTree=c.useStyleReaderTree;exports.useStyleReaders=c.useStyleReaders;exports.useStyleResolver=c.useStyleResolver;exports.useTextMeasurer=c.useTextMeasurer;exports.vars=se.vars;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('./index.css');const c=require("./history-chords-vcFCt26X.cjs"),se=require("./theme.contract.css-Dd-73-Je.cjs");let m=require("@graphysdk/viz-engine"),l=require("react"),i=require("react/jsx-runtime"),A=require("zustand"),B=require("zustand/vanilla"),$=require("clsx");$=c.__toESM($,1);var ne="_1a5iqpb0",oe="_1a5iqpb1";var ie="_1a5iqpb3",ae="_1a5iqpb4",ce="_1a5iqpb5";var L=({errors:e})=>{const[t,...r]=e;return(0,i.jsxs)("div",{role:"alert",className:ne,children:[(0,i.jsx)("strong",{className:oe,children:"This chart could not be rendered."}),t&&(0,i.jsx)(U,{diagnostic:t}),r.length>0&&(0,i.jsx)("ul",{className:"_1a5iqpb2",children:r.map((s,o)=>(0,i.jsx)("li",{children:(0,i.jsx)(U,{diagnostic:s})},`${s.code}-${o}`))})]})},U=({diagnostic:e})=>(0,i.jsxs)("div",{className:ie,children:[(0,i.jsx)("span",{className:ae,children:e.code}),(0,i.jsx)("p",{className:ce,children:e.message}),e.suggestion&&(0,i.jsx)("p",{className:"_1a5iqpb6",children:e.suggestion})]});function le(e=[],t=[]){return e.length===t.length&&e.every((r,s)=>Object.is(r,t[s]))}var W=class extends l.Component{constructor(...e){super(...e),this.state={caughtDiagnostic:null}}static getDerivedStateFromError(e){return{caughtDiagnostic:(0,m.buildDiagnostic)(e)}}componentDidCatch(e,t){const r=(0,m.buildDiagnostic)(e);c.logDiagnostics([r]),this.props.onError?.([r]),console.error("Chart render component stack:",t.componentStack)}componentDidUpdate(e){this.state.caughtDiagnostic&&!le(e.resetKeys,this.props.resetKeys)&&this.setState({caughtDiagnostic:null})}render(){const{caughtDiagnostic:e}=this.state;if(e)return(0,i.jsx)(L,{errors:[e]});const{forcedErrors:t,children:r}=this.props;return t&&t.length>0?(0,i.jsx)(L,{errors:t}):r}},z=e=>typeof e=="object"&&"geom"in e&&"render"in e,de=e=>{const t=(0,m.resolveDefinition)(e);return t instanceof m.Geom?t:null},X=(e,t)=>{const r=e.filter(s=>ue(s,t));return r.length===e.length?e:r},ue=(e,t)=>e.kind==="annotation"?(0,m.findAnnotation)(t.annotations,e.id)!==null:e.kind==="observations"||e.kind==="layer"&&e.layerId!==void 0?(0,m.findLayerById)(t.layers,e.layerId)!==void 0:!0,Y=[],he=()=>(0,B.createStore)(e=>({selection:Y,setSelection:t=>e(r=>ge(r.selection,t)?r:{selection:t}),clearSelection:()=>e(t=>t.selection.length===0?t:{selection:Y})})),ge=(e,t)=>e===t?!0:e.length!==t.length?!1:e.every((r,s)=>{const o=t[s];return o!==void 0&&(0,m.areEditTargetsEqual)(r,o)}),me=process.env.NODE_ENV!=="production",pe=5,fe=e=>{if(!me)return{emit:()=>{},subscribe:()=>ye,getLastTrigger:()=>null,getLastCompile:()=>null,getCacheStats:()=>e.getCacheStats()};const t=new Set;let r=null;return{emit:s=>{const o=e.getLastCompile();if(o){r=s;for(const d of t)d(s,o)}},subscribe:s=>(t.add(s),()=>{t.delete(s)}),getLastTrigger:()=>r,getLastCompile:()=>e.getLastCompile(),getCacheStats:()=>e.getCacheStats()}},ve=()=>(0,B.createStore)(e=>({lastCompile:null,history:[],nextId:1,lastSnapshot:null,recordCompile:(t,r)=>e(s=>{if(s.lastSnapshot===r)return s;const o={id:s.nextId,label:Se(t),stages:r.stages,durationMs:r.durationMs};return{lastCompile:o,history:be(s.history,o,pe),nextId:s.nextId+1,lastSnapshot:r}})})),ye=()=>{},Se=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}},be=(e,t,r)=>{const s=e.length>=r?e.length-(r-1):0;return[...e.slice(s),t]};function Ee(e){const t=e.filter(z),r=new Set([...Object.keys(c.BUILT_IN_GEOM_RENDERERS),...t.map(u=>u.geom)]),s=[],o=new Set;for(const u of e){const g=de(u);g===null||r.has(g.type)||o.has(g.type)||(o.add(g.type),s.push({kind:"user-input",severity:"error",code:"MISSING_GEOM_RENDERER",message:`Custom geom '${g.type}' is registered but has no renderer.`,context:{requested:g.type,kind:"geom-renderer"},suggestion:`Add a render half for it: \`defineGeomRenderer(${g.type}Geom, { coord, render })\`, then include it in \`plugins\`.`}))}const d=new Map;for(const u of t){if("definition"in u)continue;const g=`${u.geom}|${u.coord}`,p=d.get(g);p?p.count+=1:d.set(g,{geom:u.geom,coord:u.coord,count:1})}const a=[];for(const{geom:u,coord:g,count:p}of d.values())p<2||a.push({kind:"user-input",severity:"warning",code:"DUPLICATE_REGISTERED_TYPE",message:`Multiple render-only overrides register ('${u}', '${g}') (${p} entries); the last in the array wins.`,context:{requested:`${u}@${g}`,kind:"geom-renderer"},suggestion:`Keep a single render-only override for ('${u}', '${g}').`});return{errors:s,warnings:a}}function xe(e,t){const{coordSystem:r,layers:s}=e,o=new Set,d=[];for(const a of s)t(a.geom,r.type)!==null||o.has(a.geom)||(o.add(a.geom),d.push({kind:"user-input",severity:"warning",code:"MISSING_GEOM_RENDERER",message:`No renderer for geom '${a.geom}' under ${r.type} coords; the layer is not painted.`,context:{requested:a.geom,kind:"geom-renderer"},suggestion:`Register a renderer for ('${a.geom}', '${r.type}') via \`defineGeomRenderer\`.`}));return d}function Te(e,t){const{coordSystem:r,layers:s}=e,o=new Set,d=[];for(const a of s){if(a.interactive===!1||a.spatialKind!=="render-hit-test"||o.has(a.geom))continue;const u=t(a.geom,r.type);u===null||u.hitTest||c.isOverlayHosted(u)||(o.add(a.geom),d.push({kind:"user-input",severity:"warning",code:"MISSING_RENDER_HIT_TEST",message:`Geom '${a.geom}' declares spatialKind 'render-hit-test' but its renderer provides no hit-test; the layer has no hover.`,context:{requested:a.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 ('${a.geom}', '${r.type}').`}))}return d}function Ce(e){const t=new Set,r=[];for(const s of e.layers){const o=s.identityKey;s.interactive!==!1&&(s.spatialKind!=="render-hit-test"||typeof o!="object"||t.has(s.geom)||s.data.hasVariable(o.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 '${o.variable}', a column its compile output does not emit; its hover lookup is empty.`,context:{requested:s.geom,kind:"geom-renderer"},suggestion:`Emit the '${o.variable}' column from the geom's \`compile()\`, or point \`identityKey\` at a column it does emit.`})))}return r}function Re(e,t){const{coordSystem:r,layers:s}=e,o=new Set,d=[];for(const a of s){if(a.interactive===!1||a.spatialKind!=="render-hit-test"||o.has(a.geom))continue;const u=t(a.geom,r.type);u===null||!u.hitTest||!c.isOverlayHosted(u)||(o.add(a.geom),d.push({kind:"user-input",severity:"warning",code:"CONFLICTING_RENDER_HIT_TEST",message:`Geom '${a.geom}' declares both a \`hitTest\` factory and an overlay render; these are alternatives, so only the overlay is used.`,context:{requested:a.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 d}function Ge(e,t){const r=new Set,s=[];for(const o of e.layers)o.interactive!==!1&&(o.spatialKind!=="render-hit-test"||r.has(o.geom)||t.hasCapability(o.geom)||(r.add(o.geom),s.push({kind:"user-input",severity:"warning",code:"MISSING_ANCHOR_CAPABILITY",message:`Geom '${o.geom}' declares no \`resolveAnchorPosition\`; its observations cannot be annotated, so the editor overlay paints no creation trigger on them.`,context:{requested:o.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 qe(e,t){const{coordSystem:r,layers:s}=e,o=new Set,d=[];for(const a of s){if(a.interactive===!1||a.spatialKind==="render-hit-test"||o.has(a.geom))continue;const u=t(a.geom,r.type);u===null||!c.isOverlayHosted(u)||(o.add(a.geom),d.push({kind:"user-input",severity:"warning",code:"OVERLAY_REQUIRES_RENDER_HIT_TEST",message:`Geom '${a.geom}' declares an overlay render but its layer's spatialKind is '${a.spatialKind}', not 'render-hit-test'; the overlay's push-path hover resolves to nothing.`,context:{requested:a.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 d}var ke=e=>(0,B.createStore)(t=>({scene:e,setScene:r=>t(s=>s.scene===r?s:{scene:r})})),Ne=({spec:e,data:t,customPalettes:r,colorScheme:s,plugins:o,resolveRenderer:d,anchorResolver:a,onSpecChange:u,onError:g,onWarnings:p})=>{const T=c.useLatestRef(u),k=c.useLatestRef(g),G=c.useLatestRef(p),[{session:f,compileBus:h}]=(0,l.useState)(()=>{const n=(0,m.createCompiler)({plugins:o});return{session:new m.GraphCompilationSession(n),compileBus:fe(n)}}),[y]=(0,l.useState)(()=>Ee(o??[])),S=(0,l.useRef)(null),[N]=(0,l.useState)(_e),C=(0,l.useRef)(null),b=(0,l.useCallback)(n=>y.errors.length===0?n:[...y.errors,...n??[]],[y]),j=(0,l.useCallback)(n=>{if(!n.ok)return n.errors;if(C.current)C.current.getState().setScene(n.scene);else{const v=ke(n.scene);v.subscribe(N.notify),C.current=v,N.notify()}return null},[N]),[I,D]=(0,l.useState)(()=>{const n=f.compile({spec:e,data:t,customPalettes:r,colorScheme:s});return S.current=n,b(j(n))}),q=(0,l.useCallback)(n=>n.ok?[...n.warnings,...xe(n.scene,d),...Te(n.scene,d),...Ce(n.scene),...Re(n.scene,d),...qe(n.scene,d),...Ge(n.scene,a)]:n.warnings,[d,a]),E=(0,l.useCallback)(n=>{n.length!==0&&(c.logDiagnostics(n),k.current?.(n))},[k]),R=(0,l.useCallback)(n=>{n.length!==0&&(c.logDiagnostics(n),G.current?.(n))},[G]);(0,l.useEffect)(()=>{const n=S.current;n&&(E([...y.errors,...n.ok?[]:n.errors]),R([...y.warnings,...q(n)]),n.ok&&h.emit({kind:"init"}))},[h,E,R,y,q]),(0,l.useEffect)(()=>{const n=f.update({spec:e,data:t,customPalettes:r,colorScheme:s});if(!n)return;n.committedSpec&&T.current?.(n.committedSpec);const v=j(n.result);D(b(v)),v&&E(v),R(q(n.result)),v||h.emit({kind:n.specChanged?"spec":"data"})},[e,t,r,s,f,h,j,E,R,b,q,T]);const _=(0,l.useCallback)(n=>{D(v=>v===null?v:b(null)),R(q(n))},[b,R,q]),w=(0,l.useCallback)(n=>{n.scene&&C.current?.getState().setScene(n.scene),n.result&&_(n.result),n.command&&h.emit({kind:"command",command:n.command}),n.spec&&T.current?.(n.spec),n.errors&&E([...n.errors])},[_,h,T,E]),x=(0,l.useCallback)(n=>{for(const v of n)w(v);return n.some(v=>!!v.scene)},[w]),M=(0,l.useCallback)((n,v)=>{x(f.applyCommand(n,v))},[f,x]),ee=(0,l.useCallback)(()=>{x(f.commit())},[f,x]),O=(0,l.useCallback)(()=>x(f.undo()),[f,x]),K=(0,l.useCallback)(()=>x(f.redo()),[f,x]),te=(0,l.useMemo)(()=>({stack:f.history,undo:O,redo:K}),[f,O,K]),re=(0,l.useCallback)(()=>C.current?.getState().scene??null,[]);return{store:C.current,dispatch:M,commit:ee,history:te,subscribe:N.subscribe,getScene:re,compileBus:h,compileErrors:I}},_e=()=>{const e=new Set;return{subscribe:t=>(e.add(t),()=>{e.delete(t)}),notify:()=>e.forEach(t=>t())}},Q=({data:e,spec:t,plugins:r=[],formattingLocale:s,handleRef:o,onSpecChange:d,onError:a,onWarnings:u,customPalettes:g,colorScheme:p="light",children:T})=>{const[k]=(0,l.useState)(()=>c.createGeomRendererResolver(r.filter(z))),G=(0,l.useId)(),[f]=(0,l.useState)(()=>(0,m.createAnchorResolver)(r)),[h]=(0,l.useState)(()=>he()),y=(0,l.useMemo)(()=>(0,m.createStyleResolver)({colorScheme:p}),[p]),{store:S,dispatch:N,commit:C,history:b,subscribe:j,getScene:I,compileBus:D,compileErrors:q}=Ne({spec:t,data:e,customPalettes:g,colorScheme:p,plugins:r,resolveRenderer:k,anchorResolver:f,onSpecChange:d,onError:a,onWarnings:u});(0,l.useEffect)(()=>{if(S)return S.subscribe((_,w)=>{if(_.scene.spec===w.scene.spec)return;const{selection:x,setSelection:M}=h.getState();x.length!==0&&M(X(x,_.scene.spec))})},[S,h]);const E=(0,l.useMemo)(()=>({dispatch:N,commit:C}),[N,C]);(0,l.useImperativeHandle)(o,()=>({commands:E,undo:b.undo,redo:b.redo,subscribe:j,getScene:I,getSelection:()=>h.getState().selection,setSelection:_=>h.getState().setSelection(_),subscribeSelection:h.subscribe}),[E,b,j,I,h]);const R=(0,l.useMemo)(()=>S?{chartId:G,store:S,selectionStore:h,commands:E,history:b,formattingLocale:s,compileBus:D,colorScheme:p,styleResolver:y,anchorResolver:f}:null,[G,S,h,E,b,s,D,p,y,f]);return(0,i.jsx)(W,{forcedErrors:q,onError:a,resetKeys:[t,e],children:R?(0,i.jsx)(c.GraphContext.Provider,{value:R,children:(0,i.jsx)(c.GeomRendererResolverProvider,{value:k,children:T})}):null})};function je(e){const t=(0,m.createGraphyBuilder)(e);return{...t,GraphProvider:s=>(0,i.jsx)(Q,{...s,plugins:t.plugins})}}var De=({children:e,...t})=>(0,i.jsx)("svg",{viewBox:"0 0 1 1",preserveAspectRatio:"none",width:"100%",height:"100%",pointerEvents:"none",...t,children:e}),Ie=({box:e,children:t})=>(0,i.jsx)("svg",{x:(0,m.toPercent)(e.x0),y:(0,m.toPercent)(e.y0),width:(0,m.toPercent)(e.x1-e.x0),height:(0,m.toPercent)(e.y1-e.y0),overflow:"hidden",pointerEvents:"none",children:t}),we="drqe3u0",He="drqe3u1",Me="drqe3u2",Pe="drqe3u3",H="drqe3u4",$e="drqe3u5",Le="drqe3u6",Be="drqe3u7",P="drqe3u8",Oe="drqe3u9",Ke="drqe3ua";var Ae="drqe3uc",Ue="drqe3ud",Ye="drqe3ue",Fe="drqe3uf";var Ve="drqe3uh",We="drqe3ui",F={enabled:"drqe3uk drqe3uj",disabled:"drqe3ul drqe3uj"},V={ran:"drqe3un drqe3um",dim:"drqe3uo drqe3um"},J={ran:"drqe3uq drqe3up",cached:"drqe3ur drqe3up",untouched:"drqe3us drqe3up"},ze=({width:e=380,style:t,className:r}={})=>{const{compileBus:s}=c.useGraphContext(),[o]=(0,l.useState)(()=>ve()),[d,a]=(0,l.useState)(!1),[u,g]=(0,l.useState)(m.isCompilerCachingEnabled);(0,l.useEffect)(()=>{const{recordCompile:h}=o.getState(),y=s.getLastTrigger(),S=s.getLastCompile();return y&&S&&h(y,S),s.subscribe(h)},[o,s]);const p=(0,A.useStore)(o,h=>h.lastCompile),T=(0,A.useStore)(o,h=>h.history),k=s.getCacheStats(),G=p===null&&T.length===0,f=()=>{g(h=>{const y=!h;return(0,m.setCompilerCachingEnabled)(y),y})};return(0,i.jsxs)("div",{className:(0,$.default)(Ke,r),style:{width:e,...t},children:[(0,i.jsxs)("div",{className:we,children:[(0,i.jsxs)("div",{children:[(0,i.jsx)("div",{className:He,children:"compile cache"}),(0,i.jsx)("div",{className:Ye,children:G?"production: stats disabled":p?`last: ${p.label} · ${Z(p.durationMs)}`:"awaiting first compile…"})]}),(0,i.jsx)("button",{type:"button",onClick:()=>a(h=>!h),className:Fe,children:d?"▾":"▴"})]}),!d&&(0,i.jsxs)("div",{className:"drqe3ub",children:[(0,i.jsxs)("button",{type:"button",onClick:f,className:u?F.enabled:F.disabled,"aria-pressed":u,children:["cache ",u?"enabled":"disabled"]}),(0,i.jsx)("span",{className:"drqe3ug",children:"next compile reflects this toggle"})]}),!d&&!G&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(Xe,{delta:p?.stages,cumulative:k}),(0,i.jsx)(Qe,{entries:T})]})]})},Xe=({delta:e,cumulative:t})=>(0,i.jsxs)("table",{className:Me,children:[(0,i.jsx)("thead",{children:(0,i.jsxs)("tr",{className:Ve,children:[(0,i.jsx)("th",{className:Pe,children:"stage"}),(0,i.jsx)("th",{className:H,children:"Δ miss"}),(0,i.jsx)("th",{className:H,children:"Δ hit"}),(0,i.jsx)("th",{className:H,children:"total miss"}),(0,i.jsx)("th",{className:H,children:"total hit"})]})}),(0,i.jsx)("tbody",{children:m.COMPILER_STAGE_KEYS.map(r=>{const s=e?.[r],o=Je(s);return(0,i.jsxs)("tr",{className:Ae,children:[(0,i.jsxs)("td",{className:$e,children:[(0,i.jsx)("span",{className:J[o],"aria-hidden":!0})," ",r]}),(0,i.jsx)("td",{className:o==="ran"?V.ran:V.dim,children:s?.misses??0}),(0,i.jsx)("td",{className:P,children:s?.hits??0}),(0,i.jsx)("td",{className:P,children:t[r].misses}),(0,i.jsx)("td",{className:P,children:t[r].hits})]},r)})})]}),Qe=({entries:e})=>e.length===0?null:(0,i.jsxs)("div",{className:Ue,children:[(0,i.jsx)("div",{className:We,children:"recent compiles"}),e.map(t=>{const r=Ze(t.stages,d=>d.misses>0),s=m.COMPILER_STAGE_KEYS.length,o=r===0?"cached":"ran";return(0,i.jsxs)("div",{className:Le,children:[(0,i.jsx)("span",{className:J[o],"aria-hidden":!0}),(0,i.jsx)("span",{className:Be,title:t.label,children:t.label}),(0,i.jsxs)("span",{className:Oe,children:[r,"/",s," ran · ",Z(t.durationMs)]})]},t.id)})]}),Je=e=>!e||e.hits===0&&e.misses===0?"untouched":e.misses>0?"ran":"cached",Ze=(e,t)=>{let r=0;for(const s of m.COMPILER_STAGE_KEYS)t(e[s])&&(r+=1);return r},Z=e=>e>=10?`${e.toFixed(0)}ms`:`${e.toFixed(2)}ms`,et=()=>{const{history:e}=c.useGraphContext(),{stack:t,undo:r,redo:s}=e,o=(0,l.useCallback)(u=>t.subscribe(u),[t]),d=(0,l.useCallback)(()=>t.getSnapshot(),[t]),a=(0,l.useSyncExternalStore)(o,d,d);return(0,l.useMemo)(()=>({...a,undo:r,redo:s}),[a,r,s])},tt=new Set(["button","checkbox","color","file","hidden","image","radio","range","reset","submit"]),rt=(e,t={})=>{const{target:r,enabled:s=!0}=t;(0,l.useEffect)(()=>{const o=st(r);if(!s||!o)return;const d=a=>{if(!nt(a)||a.defaultPrevented||ot(a.target))return;const u=c.resolveHistoryStep(a);if(!u)return;const g=e.current;g&&(u==="undo"?g.undo():g.redo())&&a.preventDefault()};return o.addEventListener("keydown",d),()=>o.removeEventListener("keydown",d)},[e,r,s])},st=e=>e===void 0?window:e!==null&&"current"in e?e.current:e,nt=e=>"key"in e,ot=e=>e instanceof HTMLInputElement?!tt.has(e.type):e instanceof HTMLElement?e.isContentEditable||e.tagName==="TEXTAREA":!1;exports.BrandMark=c.BrandMark;exports.CanvasTextMeasurer=c.CanvasTextMeasurer;exports.DefaultFooter=c.DefaultFooter;exports.DefaultGrid=c.DefaultGrid;exports.DefaultHeader=c.DefaultHeader;exports.DefaultSwatch=c.DefaultSwatch;exports.DefaultTooltip=c.DefaultTooltip;exports.DevToolsPanel=ze;exports.GRAPH_MODES=c.GRAPH_MODES;exports.GraphErrorBoundary=W;exports.GraphErrorPanel=L;exports.GraphProvider=Q;exports.GraphRenderer=c.GraphRenderer;exports.HoverProvider=c.HoverProvider;exports.TextMeasurerProvider=c.TextMeasurerProvider;exports.ThemeProvider=c.ThemeProvider;exports.UnitBoxSvg=Ie;exports.UnitSpaceSvg=De;exports.createGraphyKit=je;exports.darkTheme=c.darkTheme;exports.defineGeomRenderer=c.defineGeomRenderer;exports.lightTheme=c.lightTheme;exports.lightenCss=c.lightenCss;exports.pruneSelection=X;exports.resolveBrandMarkVisual=c.resolveBrandMarkVisual;exports.stampGridEditTarget=c.stampGridEditTarget;exports.useElementScreenRect=c.useElementScreenRect;exports.useGeomHitTest=c.useGeomHitTest;exports.useGeomHover=c.useGeomHover;exports.useGraphCommands=c.useGraphCommands;exports.useGraphHandle=c.useGraphHandle;exports.useGraphHistory=et;exports.useGraphHistoryShortcuts=rt;exports.useGraphSelection=c.useGraphSelection;exports.useGuidesTakePress=c.useGuidesTakePress;exports.useHandleScene=c.useHandleScene;exports.useHoverState=c.useHoverState;exports.useSceneSelector=c.useSceneSelector;exports.useStyleReaderTree=c.useStyleReaderTree;exports.useStyleReaders=c.useStyleReaders;exports.useStyleResolver=c.useStyleResolver;exports.useTextMeasurer=c.useTextMeasurer;exports.vars=se.vars;
package/dist/index.d.ts CHANGED
@@ -9,7 +9,7 @@ import { ComponentType } from 'react';
9
9
  import { CoordSystem } from '@graphysdk/viz-engine';
10
10
  import { CreateGraphyBuilderOptions } from '@graphysdk/viz-engine';
11
11
  import { CSSProperties } from 'react';
12
- import { CustomPalettesInput } from '@graphysdk/viz-engine';
12
+ import { CustomPalettes } from '@graphysdk/viz-engine';
13
13
  import { Data } from '@graphysdk/viz-engine';
14
14
  import { DispatchOptions } from '@graphysdk/viz-engine';
15
15
  import { EdgeSizes } from '@graphysdk/viz-engine';
@@ -46,6 +46,7 @@ import { RefObject } from 'react';
46
46
  import { RenderHitTester } from '@graphysdk/viz-engine';
47
47
  import { ResolvedHeadlineSize } from '@graphysdk/viz-engine';
48
48
  import { ResolvedSourceStyle } from '@graphysdk/viz-engine';
49
+ import { ResolvedSpec } from '@graphysdk/viz-engine';
49
50
  import { ResolvedTextStyle } from '@graphysdk/viz-engine';
50
51
  import { ScaledPositionAestheticKey } from '@graphysdk/viz-engine';
51
52
  import { Scene } from '@graphysdk/viz-engine';
@@ -53,7 +54,6 @@ import { SceneLayer } from '@graphysdk/viz-engine';
53
54
  import { SceneLayerFor } from '@graphysdk/viz-engine';
54
55
  import { SourceContent } from '@graphysdk/viz-engine';
55
56
  import { Spec } from '@graphysdk/viz-engine';
56
- import { SpecInput } from '@graphysdk/viz-engine';
57
57
  import { StoreApi } from 'zustand';
58
58
  import { StyleReadersForLayer } from '@graphysdk/viz-engine';
59
59
  import { StyleReaderTree } from '@graphysdk/viz-engine';
@@ -472,12 +472,12 @@ export declare interface GraphCommands {
472
472
  /** Applies a command to the provider's live spec. */
473
473
  dispatch: (command: Command, options?: DispatchOptions) => void;
474
474
  /**
475
- * Closes a run of `{ transient: true }` dispatches and fires `onChange` once for it. Call it when
475
+ * Closes a run of `{ transient: true }` dispatches and fires `onSpecChange` once for it. Call it when
476
476
  * the gesture ends — pointer up, blur. Forgetting only delays the notification rather than
477
477
  * corrupting undo: the run covers one {@link EditTarget}, and the next committed dispatch, undo,
478
478
  * redo or external change closes it.
479
479
  */
480
- seal: () => void;
480
+ commit: () => void;
481
481
  }
482
482
 
483
483
  /**
@@ -588,16 +588,16 @@ export declare type GraphMode = (typeof GRAPH_MODES)[keyof typeof GRAPH_MODES];
588
588
  * render-throw from a renderer component — converge on a single {@link GraphErrorBoundary} that shows
589
589
  * the error in place, so a broken chart never blanks the page.
590
590
  */
591
- export declare const GraphProvider: ({ data, input, plugins, formattingLocale, handleRef, onChange, onError, onWarnings, customPalettes, colorScheme, children, }: GraphProviderProps) => JSX.Element;
591
+ export declare const GraphProvider: ({ data, spec, plugins, formattingLocale, handleRef, onSpecChange, onError, onWarnings, customPalettes, colorScheme, children, }: GraphProviderProps) => JSX.Element;
592
592
 
593
- /** Props for {@link GraphProvider}: the data and spec input to compile, plus color scheme, locale and plugin wiring. */
593
+ /** Props for {@link GraphProvider}: the data and spec to compile, plus color scheme, locale and plugin wiring. */
594
594
  export declare interface GraphProviderProps {
595
595
  data: Data;
596
- input: SpecInput;
596
+ spec: Spec;
597
597
  /**
598
598
  * Custom geoms, stats, and transforms (and their render halves) registered for this graph. Seeds
599
599
  * the compiler and builds the per-provider render resolver from one array. Construction-time config,
600
- * frozen at mount — change the registered set by remounting (React `key`); `data`/`input`/`colorScheme`
600
+ * frozen at mount — change the registered set by remounting (React `key`); `data`/`spec`/`colorScheme`
601
601
  * stay reactive.
602
602
  */
603
603
  plugins?: readonly Plugin_2[];
@@ -607,13 +607,13 @@ export declare interface GraphProviderProps {
607
607
  * hooks can't reach. `useGraphHistoryShortcuts` binds the undo/redo chords to one.
608
608
  */
609
609
  handleRef?: Ref<GraphHandle>;
610
- onChange?: (next: SpecInput) => void;
610
+ onSpecChange?: (next: Spec) => void;
611
611
  /** Fires with the compile failure(s) whenever a compile/recompile/dispatch produces errors. */
612
612
  onError?: (errors: VizDiagnostic[]) => void;
613
613
  /** Fires with any warnings a successful compile produced. */
614
614
  onWarnings?: (warnings: VizDiagnostic[]) => void;
615
615
  colorScheme?: ColorScheme;
616
- customPalettes?: CustomPalettesInput;
616
+ customPalettes?: CustomPalettes;
617
617
  children: ReactNode;
618
618
  }
619
619
 
@@ -667,7 +667,7 @@ export declare type GraphSizing = {
667
667
  };
668
668
 
669
669
  /**
670
- * Region overrides for `GraphRenderer`. A slot replaces how one region paints; the viz-engine `Spec`
670
+ * Region overrides for `GraphRenderer`. A slot replaces how one region paints; the viz-engine `ResolvedSpec`
671
671
  * still owns whether a region exists and what data it receives, and an override gets the same
672
672
  * render-ready props as its default.
673
673
  *
@@ -917,7 +917,7 @@ declare interface OverlayAnchorInput<G extends GeomName | string = string, C ext
917
917
  * cannot place, and a target whose annotation failed to resolve has to stay selected for the user to
918
918
  * be able to repair it.
919
919
  */
920
- export declare const pruneSelection: (selection: readonly EditTarget[], spec: Spec) => readonly EditTarget[];
920
+ export declare const pruneSelection: (selection: readonly EditTarget[], spec: ResolvedSpec) => readonly EditTarget[];
921
921
 
922
922
  export { RenderHitTester }
923
923
 
@@ -1206,14 +1206,14 @@ export declare function useGeomHover(layerId: string): GeomHoverPush;
1206
1206
  *
1207
1207
  * @example
1208
1208
  * ```tsx
1209
- * const { dispatch, seal } = useGraphCommands();
1209
+ * const { dispatch, commit } = useGraphCommands();
1210
1210
  *
1211
1211
  * const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {
1212
1212
  * const rule = style.graph({ borderRadius: event.target.valueAsNumber });
1213
1213
  * dispatch(new SetStyleRuleCommand({ list: 'defaults', rule, id: 'frame-radius' }), { transient: true });
1214
1214
  * };
1215
1215
  *
1216
- * const handlePointerUp = () => seal();
1216
+ * const handlePointerUp = () => commit();
1217
1217
  *
1218
1218
  * <input type="range" onChange={handleChange} onPointerUp={handlePointerUp}
1219
1219
  * />
@@ -1257,7 +1257,7 @@ export declare const useGraphHistory: () => GraphHistory;
1257
1257
  * useGraphHistoryShortcuts(handleRef);
1258
1258
  *
1259
1259
  * return (
1260
- * <GraphProvider input={input} data={data} handleRef={handleRef}>
1260
+ * <GraphProvider spec={input} data={data} handleRef={handleRef}>
1261
1261
  * <GraphRenderer mode="editable" />
1262
1262
  * </GraphProvider>
1263
1263
  * );
package/dist/index.mjs CHANGED
@@ -1,7 +1,7 @@
1
- import { $ as Dt, At as le, C as $t, Ct as ue, Et as he, F as Ht, Gt as me, Ht as xt, I as Mt, Kt as ne, M as Pt, Mt as Lt, N as Bt, Nt as Kt, St as K, Tt as U, Ut as Ot, Vt as At, Wt as Ut, a as jt, at as Ft, bt as Yt, c as Wt, ct as Vt, et as Xt, ft as zt, ht as Qt, i as Jt, jt as Zt, kt as er, mt as tr, n as rr, qt as A, r as nr, s as sr, st as or, t as ge, v as ir, wt as ar, yt as cr, zt as dr } from "./history-chords-FqjF3hMF.js";
1
+ import { $ as Dt, At as le, C as $t, Ct as ue, Et as me, F as Ht, Gt as he, Ht as xt, I as Mt, Kt as ne, M as Pt, Mt as Lt, N as Bt, Nt as Kt, St as K, Tt as U, Ut as Ot, Vt as At, Wt as Ut, a as jt, at as Ft, bt as Yt, c as Wt, ct as Vt, et as Xt, ft as zt, ht as Qt, i as Jt, jt as Zt, kt as er, mt as tr, n as rr, qt as A, r as nr, s as sr, st as or, t as ge, v as ir, wt as ar, yt as cr, zt as dr } from "./history-chords-S1G_f-FU.js";
2
2
  import { n as ur } from "./theme.contract.css-DaZ5UPN0.js";
3
3
  import { COMPILER_STAGE_KEYS as j, Geom as pe, GraphCompilationSession as fe, areEditTargetsEqual as ve, buildDiagnostic as V, createAnchorResolver as ye, createCompiler as Se, createGraphyBuilder as be, createStyleResolver as Ee, findAnnotation as Te, findLayerById as X, isCompilerCachingEnabled as Ne, resolveDefinition as Re, setCompilerCachingEnabled as Ce, toPercent as P } from "@graphysdk/viz-engine";
4
- import { Component as qe, useCallback as f, useEffect as H, useId as Ge, useImperativeHandle as Ie, useMemo as $, useRef as z, useState as T, useSyncExternalStore as ke } from "react";
4
+ import { Component as qe, useCallback as f, useEffect as H, useId as Ge, useImperativeHandle as ke, useMemo as $, useRef as z, useState as T, useSyncExternalStore as Ie } from "react";
5
5
  import { Fragment as we, jsx as d, jsxs as v } from "react/jsx-runtime";
6
6
  import { useStore as Q } from "zustand";
7
7
  import { createStore as F } from "zustand/vanilla";
@@ -129,8 +129,8 @@ var Le = class extends qe {
129
129
  switch (e.kind) {
130
130
  case "init":
131
131
  return "init";
132
- case "input":
133
- return "input change";
132
+ case "spec":
133
+ return "spec change";
134
134
  case "data":
135
135
  return "data change";
136
136
  case "command":
@@ -141,7 +141,7 @@ var Le = class extends qe {
141
141
  return [...e.slice(n), t];
142
142
  };
143
143
  function Qe(e) {
144
- const t = e.filter(se), r = /* @__PURE__ */ new Set([...Object.keys(he), ...t.map((c) => c.geom)]), n = [], o = /* @__PURE__ */ new Set();
144
+ const t = e.filter(se), r = /* @__PURE__ */ new Set([...Object.keys(me), ...t.map((c) => c.geom)]), n = [], o = /* @__PURE__ */ new Set();
145
145
  for (const c of e) {
146
146
  const u = Be(c);
147
147
  u === null || r.has(u.type) || o.has(u.type) || (o.add(u.type), n.push({
@@ -159,20 +159,20 @@ function Qe(e) {
159
159
  const a = /* @__PURE__ */ new Map();
160
160
  for (const c of t) {
161
161
  if ("definition" in c) continue;
162
- const u = `${c.geom}|${c.coord}`, h = a.get(u);
163
- h ? h.count += 1 : a.set(u, {
162
+ const u = `${c.geom}|${c.coord}`, m = a.get(u);
163
+ m ? m.count += 1 : a.set(u, {
164
164
  geom: c.geom,
165
165
  coord: c.coord,
166
166
  count: 1
167
167
  });
168
168
  }
169
169
  const i = [];
170
- for (const { geom: c, coord: u, count: h } of a.values())
171
- h < 2 || i.push({
170
+ for (const { geom: c, coord: u, count: m } of a.values())
171
+ m < 2 || i.push({
172
172
  kind: "user-input",
173
173
  severity: "warning",
174
174
  code: "DUPLICATE_REGISTERED_TYPE",
175
- message: `Multiple render-only overrides register ('${c}', '${u}') (${h} entries); the last in the array wins.`,
175
+ message: `Multiple render-only overrides register ('${c}', '${u}') (${m} entries); the last in the array wins.`,
176
176
  context: {
177
177
  requested: `${c}@${u}`,
178
178
  kind: "geom-renderer"
@@ -294,24 +294,24 @@ function nt(e, t) {
294
294
  var st = (e) => F((t) => ({
295
295
  scene: e,
296
296
  setScene: (r) => t((n) => n.scene === r ? n : { scene: r })
297
- })), ot = ({ input: e, data: t, customPalettes: r, colorScheme: n, plugins: o, resolveRenderer: a, anchorResolver: i, onChange: c, onError: u, onWarnings: h }) => {
298
- const N = K(c), I = K(u), q = K(h), [{ session: m, compileBus: l }] = T(() => {
297
+ })), ot = ({ spec: e, data: t, customPalettes: r, colorScheme: n, plugins: o, resolveRenderer: a, anchorResolver: i, onSpecChange: c, onError: u, onWarnings: m }) => {
298
+ const N = K(c), k = K(u), q = K(m), [{ session: h, compileBus: l }] = T(() => {
299
299
  const s = Se({ plugins: o });
300
300
  return {
301
301
  session: new fe(s),
302
302
  compileBus: Ye(s)
303
303
  };
304
- }), [p] = T(() => Qe(o ?? [])), y = z(null), [k] = T(it), R = z(null), S = f((s) => p.errors.length === 0 ? s : [...p.errors, ...s ?? []], [p]), _ = f((s) => {
304
+ }), [p] = T(() => Qe(o ?? [])), y = z(null), [I] = T(it), R = z(null), S = f((s) => p.errors.length === 0 ? s : [...p.errors, ...s ?? []], [p]), _ = f((s) => {
305
305
  if (!s.ok) return s.errors;
306
306
  if (R.current) R.current.getState().setScene(s.scene);
307
307
  else {
308
308
  const g = st(s.scene);
309
- g.subscribe(k.notify), R.current = g, k.notify();
309
+ g.subscribe(I.notify), R.current = g, I.notify();
310
310
  }
311
311
  return null;
312
- }, [k]), [x, D] = T(() => {
313
- const s = m.compile({
314
- input: e,
312
+ }, [I]), [x, D] = T(() => {
313
+ const s = h.compile({
314
+ spec: e,
315
315
  data: t,
316
316
  customPalettes: r,
317
317
  colorScheme: n
@@ -326,8 +326,8 @@ var st = (e) => F((t) => ({
326
326
  ...nt(s.scene, a),
327
327
  ...rt(s.scene, i)
328
328
  ] : s.warnings, [a, i]), b = f((s) => {
329
- s.length !== 0 && (A(s), I.current?.(s));
330
- }, [I]), C = f((s) => {
329
+ s.length !== 0 && (A(s), k.current?.(s));
330
+ }, [k]), C = f((s) => {
331
331
  s.length !== 0 && (A(s), q.current?.(s));
332
332
  }, [q]);
333
333
  H(() => {
@@ -340,22 +340,22 @@ var st = (e) => F((t) => ({
340
340
  p,
341
341
  G
342
342
  ]), H(() => {
343
- const s = m.update({
344
- input: e,
343
+ const s = h.update({
344
+ spec: e,
345
345
  data: t,
346
346
  customPalettes: r,
347
347
  colorScheme: n
348
348
  });
349
349
  if (!s) return;
350
- s.sealedInput && N.current?.(s.sealedInput);
350
+ s.committedSpec && N.current?.(s.committedSpec);
351
351
  const g = _(s.result);
352
- D(S(g)), g && b(g), C(G(s.result)), g || l.emit({ kind: s.inputChanged ? "input" : "data" });
352
+ D(S(g)), g && b(g), C(G(s.result)), g || l.emit({ kind: s.specChanged ? "spec" : "data" });
353
353
  }, [
354
354
  e,
355
355
  t,
356
356
  r,
357
357
  n,
358
- m,
358
+ h,
359
359
  l,
360
360
  _,
361
361
  b,
@@ -374,7 +374,7 @@ var st = (e) => F((t) => ({
374
374
  s.scene && R.current?.getState().setScene(s.scene), s.result && w(s.result), s.command && l.emit({
375
375
  kind: "command",
376
376
  command: s.command
377
- }), s.input && N.current?.(s.input), s.errors && b([...s.errors]);
377
+ }), s.spec && N.current?.(s.spec), s.errors && b([...s.errors]);
378
378
  }, [
379
379
  w,
380
380
  l,
@@ -384,24 +384,24 @@ var st = (e) => F((t) => ({
384
384
  for (const g of s) M(g);
385
385
  return s.some((g) => !!g.scene);
386
386
  }, [M]), B = f((s, g) => {
387
- E(m.applyCommand(s, g));
388
- }, [m, E]), ae = f(() => {
389
- E(m.seal());
390
- }, [m, E]), Y = f(() => E(m.undo()), [m, E]), W = f(() => E(m.redo()), [m, E]), ce = $(() => ({
391
- stack: m.history,
387
+ E(h.applyCommand(s, g));
388
+ }, [h, E]), ae = f(() => {
389
+ E(h.commit());
390
+ }, [h, E]), Y = f(() => E(h.undo()), [h, E]), W = f(() => E(h.redo()), [h, E]), ce = $(() => ({
391
+ stack: h.history,
392
392
  undo: Y,
393
393
  redo: W
394
394
  }), [
395
- m,
395
+ h,
396
396
  Y,
397
397
  W
398
398
  ]), de = f(() => R.current?.getState().scene ?? null, []);
399
399
  return {
400
400
  store: R.current,
401
401
  dispatch: B,
402
- seal: ae,
402
+ commit: ae,
403
403
  history: ce,
404
- subscribe: k.subscribe,
404
+ subscribe: I.subscribe,
405
405
  getScene: de,
406
406
  compileBus: l,
407
407
  compileErrors: x
@@ -414,16 +414,16 @@ var st = (e) => F((t) => ({
414
414
  }),
415
415
  notify: () => e.forEach((t) => t())
416
416
  };
417
- }, at = ({ data: e, input: t, plugins: r = [], formattingLocale: n, handleRef: o, onChange: a, onError: i, onWarnings: c, customPalettes: u, colorScheme: h = "light", children: N }) => {
418
- const [I] = T(() => ue(r.filter(se))), q = Ge(), [m] = T(() => ye(r)), [l] = T(() => Ae()), p = $(() => Ee({ colorScheme: h }), [h]), { store: y, dispatch: k, seal: R, history: S, subscribe: _, getScene: x, compileBus: D, compileErrors: G } = ot({
419
- input: t,
417
+ }, at = ({ data: e, spec: t, plugins: r = [], formattingLocale: n, handleRef: o, onSpecChange: a, onError: i, onWarnings: c, customPalettes: u, colorScheme: m = "light", children: N }) => {
418
+ const [k] = T(() => ue(r.filter(se))), q = Ge(), [h] = T(() => ye(r)), [l] = T(() => Ae()), p = $(() => Ee({ colorScheme: m }), [m]), { store: y, dispatch: I, commit: R, history: S, subscribe: _, getScene: x, compileBus: D, compileErrors: G } = ot({
419
+ spec: t,
420
420
  data: e,
421
421
  customPalettes: u,
422
- colorScheme: h,
422
+ colorScheme: m,
423
423
  plugins: r,
424
- resolveRenderer: I,
425
- anchorResolver: m,
426
- onChange: a,
424
+ resolveRenderer: k,
425
+ anchorResolver: h,
426
+ onSpecChange: a,
427
427
  onError: i,
428
428
  onWarnings: c
429
429
  });
@@ -436,10 +436,10 @@ var st = (e) => F((t) => ({
436
436
  });
437
437
  }, [y, l]);
438
438
  const b = $(() => ({
439
- dispatch: k,
440
- seal: R
441
- }), [k, R]);
442
- Ie(o, () => ({
439
+ dispatch: I,
440
+ commit: R
441
+ }), [I, R]);
442
+ ke(o, () => ({
443
443
  commands: b,
444
444
  undo: S.undo,
445
445
  redo: S.redo,
@@ -463,9 +463,9 @@ var st = (e) => F((t) => ({
463
463
  history: S,
464
464
  formattingLocale: n,
465
465
  compileBus: D,
466
- colorScheme: h,
466
+ colorScheme: m,
467
467
  styleResolver: p,
468
- anchorResolver: m
468
+ anchorResolver: h
469
469
  } : null, [
470
470
  q,
471
471
  y,
@@ -474,18 +474,18 @@ var st = (e) => F((t) => ({
474
474
  S,
475
475
  n,
476
476
  D,
477
- h,
477
+ m,
478
478
  p,
479
- m
479
+ h
480
480
  ]);
481
481
  return /* @__PURE__ */ d(Le, {
482
482
  forcedErrors: G,
483
483
  onError: i,
484
484
  resetKeys: [t, e],
485
- children: C ? /* @__PURE__ */ d(me.Provider, {
485
+ children: C ? /* @__PURE__ */ d(he.Provider, {
486
486
  value: C,
487
487
  children: /* @__PURE__ */ d(le, {
488
- value: I,
488
+ value: k,
489
489
  children: N
490
490
  })
491
491
  }) : null
@@ -517,7 +517,7 @@ var Sr = ({ children: e, ...t }) => /* @__PURE__ */ d("svg", {
517
517
  overflow: "hidden",
518
518
  pointerEvents: "none",
519
519
  children: t
520
- }), ct = "drqe3u0", dt = "drqe3u1", lt = "drqe3u2", ut = "drqe3u3", L = "drqe3u4", ht = "drqe3u5", mt = "drqe3u6", gt = "drqe3u7", O = "drqe3u8", pt = "drqe3u9", ft = "drqe3ua";
520
+ }), ct = "drqe3u0", dt = "drqe3u1", lt = "drqe3u2", ut = "drqe3u3", L = "drqe3u4", mt = "drqe3u5", ht = "drqe3u6", gt = "drqe3u7", O = "drqe3u8", pt = "drqe3u9", ft = "drqe3ua";
521
521
  var vt = "drqe3uc", yt = "drqe3ud", St = "drqe3ue", bt = "drqe3uf";
522
522
  var Et = "drqe3uh", Tt = "drqe3ui", te = {
523
523
  enabled: "drqe3uk drqe3uj",
@@ -535,7 +535,7 @@ var Et = "drqe3uh", Tt = "drqe3ui", te = {
535
535
  const { recordCompile: l } = o.getState(), p = n.getLastTrigger(), y = n.getLastCompile();
536
536
  return p && y && l(p, y), n.subscribe(l);
537
537
  }, [o, n]);
538
- const h = Q(o, (l) => l.lastCompile), N = Q(o, (l) => l.history), I = n.getCacheStats(), q = h === null && N.length === 0, m = () => {
538
+ const m = Q(o, (l) => l.lastCompile), N = Q(o, (l) => l.history), k = n.getCacheStats(), q = m === null && N.length === 0, h = () => {
539
539
  u((l) => {
540
540
  const p = !l;
541
541
  return Ce(p), p;
@@ -555,7 +555,7 @@ var Et = "drqe3uh", Tt = "drqe3ui", te = {
555
555
  children: "compile cache"
556
556
  }), /* @__PURE__ */ d("div", {
557
557
  className: St,
558
- children: q ? "production: stats disabled" : h ? `last: ${h.label} · ${ie(h.durationMs)}` : "awaiting first compile…"
558
+ children: q ? "production: stats disabled" : m ? `last: ${m.label} · ${ie(m.durationMs)}` : "awaiting first compile…"
559
559
  })] }), /* @__PURE__ */ d("button", {
560
560
  type: "button",
561
561
  onClick: () => i((l) => !l),
@@ -567,7 +567,7 @@ var Et = "drqe3uh", Tt = "drqe3ui", te = {
567
567
  className: "drqe3ub",
568
568
  children: [/* @__PURE__ */ v("button", {
569
569
  type: "button",
570
- onClick: m,
570
+ onClick: h,
571
571
  className: c ? te.enabled : te.disabled,
572
572
  "aria-pressed": c,
573
573
  children: ["cache ", c ? "enabled" : "disabled"]
@@ -577,8 +577,8 @@ var Et = "drqe3uh", Tt = "drqe3ui", te = {
577
577
  })]
578
578
  }),
579
579
  !a && !q && /* @__PURE__ */ v(we, { children: [/* @__PURE__ */ d(Nt, {
580
- delta: h?.stages,
581
- cumulative: I
580
+ delta: m?.stages,
581
+ cumulative: k
582
582
  }), /* @__PURE__ */ d(Rt, { entries: N })] })
583
583
  ]
584
584
  });
@@ -614,7 +614,7 @@ var Et = "drqe3uh", Tt = "drqe3ui", te = {
614
614
  className: vt,
615
615
  children: [
616
616
  /* @__PURE__ */ v("td", {
617
- className: ht,
617
+ className: mt,
618
618
  children: [
619
619
  /* @__PURE__ */ d("span", {
620
620
  className: oe[o],
@@ -651,7 +651,7 @@ var Et = "drqe3uh", Tt = "drqe3ui", te = {
651
651
  }), e.map((t) => {
652
652
  const r = qt(t.stages, (a) => a.misses > 0), n = j.length;
653
653
  return /* @__PURE__ */ v("div", {
654
- className: mt,
654
+ className: ht,
655
655
  children: [
656
656
  /* @__PURE__ */ d("span", {
657
657
  className: oe[r === 0 ? "cached" : "ran"],
@@ -680,7 +680,7 @@ var Et = "drqe3uh", Tt = "drqe3ui", te = {
680
680
  for (const n of j) t(e[n]) && (r += 1);
681
681
  return r;
682
682
  }, ie = (e) => e >= 10 ? `${e.toFixed(0)}ms` : `${e.toFixed(2)}ms`, Tr = () => {
683
- const { history: e } = ne(), { stack: t, undo: r, redo: n } = e, o = f((c) => t.subscribe(c), [t]), a = f(() => t.getSnapshot(), [t]), i = ke(o, a, a);
683
+ const { history: e } = ne(), { stack: t, undo: r, redo: n } = e, o = f((c) => t.subscribe(c), [t]), a = f(() => t.getSnapshot(), [t]), i = Ie(o, a, a);
684
684
  return $(() => ({
685
685
  ...i,
686
686
  undo: r,
@@ -704,10 +704,10 @@ var Et = "drqe3uh", Tt = "drqe3ui", te = {
704
704
  ]), Nr = (e, t = {}) => {
705
705
  const { target: r, enabled: n = !0 } = t;
706
706
  H(() => {
707
- const o = It(r);
707
+ const o = kt(r);
708
708
  if (!n || !o) return;
709
709
  const a = (i) => {
710
- if (!kt(i) || i.defaultPrevented || wt(i.target)) return;
710
+ if (!It(i) || i.defaultPrevented || wt(i.target)) return;
711
711
  const c = ge(i);
712
712
  if (!c) return;
713
713
  const u = e.current;
@@ -719,7 +719,7 @@ var Et = "drqe3uh", Tt = "drqe3ui", te = {
719
719
  r,
720
720
  n
721
721
  ]);
722
- }, It = (e) => e === void 0 ? window : e !== null && "current" in e ? e.current : e, kt = (e) => "key" in e, wt = (e) => e instanceof HTMLInputElement ? !Gt.has(e.type) : e instanceof HTMLElement ? e.isContentEditable || e.tagName === "TEXTAREA" : !1;
722
+ }, kt = (e) => e === void 0 ? window : e !== null && "current" in e ? e.current : e, It = (e) => "key" in e, wt = (e) => e instanceof HTMLInputElement ? !Gt.has(e.type) : e instanceof HTMLElement ? e.isContentEditable || e.tagName === "TEXTAREA" : !1;
723
723
  export {
724
724
  Ht as BrandMark,
725
725
  Kt as CanvasTextMeasurer,
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "visualization",
12
12
  "renderer"
13
13
  ],
14
- "version": "1.9.0-beta.1789573335651",
14
+ "version": "1.9.0-beta.1789582064893",
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.1789573335651"
58
+ "@graphysdk/viz-engine": "1.9.0-beta.1789582064893"
59
59
  },
60
60
  "peerDependencies": {
61
61
  "@tiptap/core": "^3.0.0",