@graphysdk/react-renderer 1.9.0-beta.1789110714410 → 1.9.0-beta.1789110926690

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 l=require("./history-chords-H1dA50dL.cjs"),se=require("./theme.contract.css-CEjZ4rbL.cjs");let g=require("@graphysdk/viz-engine"),c=require("react"),i=require("react/jsx-runtime"),A=require("zustand"),B=require("zustand/vanilla"),$=require("clsx");$=l.__toESM($,1);var ne="_1a5iqpb0",oe="_1a5iqpb1";var ie="_1a5iqpb3",ae="_1a5iqpb4",le="_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:le,children:e.message}),e.suggestion&&(0,i.jsx)("p",{className:"_1a5iqpb6",children:e.suggestion})]});function ce(e=[],t=[]){return e.length===t.length&&e.every((r,s)=>Object.is(r,t[s]))}var W=class extends c.Component{constructor(...e){super(...e),this.state={caughtDiagnostic:null}}static getDerivedStateFromError(e){return{caughtDiagnostic:(0,g.buildDiagnostic)(e)}}componentDidCatch(e,t){const r=(0,g.buildDiagnostic)(e);l.logDiagnostics([r]),this.props.onError?.([r]),console.error("Chart render component stack:",t.componentStack)}componentDidUpdate(e){this.state.caughtDiagnostic&&!ce(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,g.resolveDefinition)(e);return t instanceof g.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,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,Y=[],me=()=>(0,B.createStore)(e=>({selection:Y,setSelection:t=>e(r=>he(r.selection,t)?r:{selection:t}),clearSelection:()=>e(t=>t.selection.length===0?t:{selection:Y})})),he=(e,t)=>e===t?!0:e.length!==t.length?!1:e.every((r,s)=>{const o=t[s];return o!==void 0&&(0,g.areEditTargetsEqual)(r,o)}),ge=process.env.NODE_ENV!=="production",pe=5,fe=e=>{if(!ge)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(l.BUILT_IN_GEOM_RENDERERS),...t.map(u=>u.geom)]),s=[],o=new Set;for(const u of e){const h=de(u);h===null||r.has(h.type)||o.has(h.type)||(o.add(h.type),s.push({kind:"user-input",severity:"error",code:"MISSING_GEOM_RENDERER",message:`Custom geom '${h.type}' is registered but has no renderer.`,context:{requested:h.type,kind:"geom-renderer"},suggestion:`Add a render half for it: \`defineGeomRenderer(${h.type}Geom, { coord, render })\`, then include it in \`plugins\`.`}))}const d=new Map;for(const u of t){if("definition"in u)continue;const h=`${u.geom}|${u.coord}`,p=d.get(h);p?p.count+=1:d.set(h,{geom:u.geom,coord:u.coord,count:1})}const a=[];for(const{geom:u,coord:h,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}', '${h}') (${p} entries); the last in the array wins.`,context:{requested:`${u}@${h}`,kind:"geom-renderer"},suggestion:`Keep a single render-only override for ('${u}', '${h}').`});return{errors:s,warnings:a}}function Ce(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 xe(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||l.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 Te(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||!l.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 qe(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 ke(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||!l.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 compiled layer carries the `byKey` index the overlay's `pushHover` resolves against."}))}return d}var Ge=e=>(0,B.createStore)(t=>({compiled:e,setCompiled:r=>t(s=>s.compiled===r?s:{compiled:r})})),Ne=({input:e,data:t,customPalettes:r,colorScheme:s,plugins:o,resolveRenderer:d,anchorResolver:a,onChange:u,onError:h,onWarnings:p})=>{const x=l.useLatestRef(u),G=l.useLatestRef(h),q=l.useLatestRef(p),[{session:f,compileBus:m}]=(0,c.useState)(()=>{const n=(0,g.createCompiler)({plugins:o});return{session:new g.GraphCompilationSession(n),compileBus:fe(n)}}),[y]=(0,c.useState)(()=>Ee(o??[])),S=(0,c.useRef)(null),[N]=(0,c.useState)(je),T=(0,c.useRef)(null),b=(0,c.useCallback)(n=>y.errors.length===0?n:[...y.errors,...n??[]],[y]),_=(0,c.useCallback)(n=>{if(!n.ok)return n.errors;if(T.current)T.current.getState().setCompiled(n.compiled);else{const v=Ge(n.compiled);v.subscribe(N.notify),T.current=v,N.notify()}return null},[N]),[D,I]=(0,c.useState)(()=>{const n=f.compile({input:e,data:t,customPalettes:r,colorScheme:s});return S.current=n,b(_(n))}),k=(0,c.useCallback)(n=>n.ok?[...n.warnings,...Ce(n.compiled,d),...xe(n.compiled,d),...Te(n.compiled),...Re(n.compiled,d),...ke(n.compiled,d),...qe(n.compiled,a)]:n.warnings,[d,a]),E=(0,c.useCallback)(n=>{n.length!==0&&(l.logDiagnostics(n),G.current?.(n))},[G]),R=(0,c.useCallback)(n=>{n.length!==0&&(l.logDiagnostics(n),q.current?.(n))},[q]);(0,c.useEffect)(()=>{const n=S.current;n&&(E([...y.errors,...n.ok?[]:n.errors]),R([...y.warnings,...k(n)]),n.ok&&m.emit({kind:"init"}))},[m,E,R,y,k]),(0,c.useEffect)(()=>{const n=f.update({input:e,data:t,customPalettes:r,colorScheme:s});if(!n)return;n.sealedInput&&x.current?.(n.sealedInput);const v=_(n.result);I(b(v)),v&&E(v),R(k(n.result)),v||m.emit({kind:n.inputChanged?"input":"data"})},[e,t,r,s,f,m,_,E,R,b,k,x]);const j=(0,c.useCallback)(n=>{I(v=>v===null?v:b(null)),R(k(n))},[b,R,k]),w=(0,c.useCallback)(n=>{n.compiled&&T.current?.getState().setCompiled(n.compiled),n.result&&j(n.result),n.command&&m.emit({kind:"command",command:n.command}),n.input&&x.current?.(n.input),n.errors&&E([...n.errors])},[j,m,x,E]),C=(0,c.useCallback)(n=>{for(const v of n)w(v);return n.some(v=>!!v.compiled)},[w]),M=(0,c.useCallback)((n,v)=>{C(f.applyCommand(n,v))},[f,C]),ee=(0,c.useCallback)(()=>{C(f.seal())},[f,C]),O=(0,c.useCallback)(()=>C(f.undo()),[f,C]),K=(0,c.useCallback)(()=>C(f.redo()),[f,C]),te=(0,c.useMemo)(()=>({stack:f.history,undo:O,redo:K}),[f,O,K]),re=(0,c.useCallback)(()=>T.current?.getState().compiled??null,[]);return{store:T.current,dispatch:M,seal:ee,history:te,subscribe:N.subscribe,getCompiled:re,compileBus:m,compileErrors:D}},je=()=>{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:a,onWarnings:u,customPalettes:h,colorScheme:p="light",children:x})=>{const[G]=(0,c.useState)(()=>l.createGeomRendererResolver(r.filter(z))),q=(0,c.useId)(),[f]=(0,c.useState)(()=>(0,g.createAnchorResolver)(r)),[m]=(0,c.useState)(()=>me()),y=(0,c.useMemo)(()=>(0,g.createStyleResolver)({colorScheme:p}),[p]),{store:S,dispatch:N,seal:T,history:b,subscribe:_,getCompiled:D,compileBus:I,compileErrors:k}=Ne({input:t,data:e,customPalettes:h,colorScheme:p,plugins:r,resolveRenderer:G,anchorResolver:f,onChange:d,onError:a,onWarnings:u});(0,c.useEffect)(()=>{if(S)return S.subscribe((j,w)=>{if(j.compiled.spec===w.compiled.spec)return;const{selection:C,setSelection:M}=m.getState();C.length!==0&&M(X(C,j.compiled.spec))})},[S,m]);const E=(0,c.useMemo)(()=>({dispatch:N,seal:T}),[N,T]);(0,c.useImperativeHandle)(o,()=>({commands:E,undo:b.undo,redo:b.redo,subscribe:_,getCompiled:D,getSelection:()=>m.getState().selection,setSelection:j=>m.getState().setSelection(j),subscribeSelection:m.subscribe}),[E,b,_,D,m]);const R=(0,c.useMemo)(()=>S?{chartId:q,store:S,selectionStore:m,commands:E,history:b,formattingLocale:s,compileBus:I,colorScheme:p,styleResolver:y,anchorResolver:f}:null,[q,S,m,E,b,s,I,p,y,f]);return(0,i.jsx)(W,{forcedErrors:k,onError:a,resetKeys:[t,e],children:R?(0,i.jsx)(l.GraphContext.Provider,{value:R,children:(0,i.jsx)(l.GeomRendererResolverProvider,{value:G,children:x})}):null})};function _e(e){const t=(0,g.createGraphyBuilder)(e);return{...t,GraphProvider:s=>(0,i.jsx)(Q,{...s,plugins:t.plugins})}}var Ie=({children:e,...t})=>(0,i.jsx)("svg",{viewBox:"0 0 1 1",preserveAspectRatio:"none",width:"100%",height:"100%",pointerEvents:"none",...t,children:e}),De=({box:e,children:t})=>(0,i.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}),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}=l.useGraphContext(),[o]=(0,c.useState)(()=>ve()),[d,a]=(0,c.useState)(!1),[u,h]=(0,c.useState)(g.isCompilerCachingEnabled);(0,c.useEffect)(()=>{const{recordCompile:m}=o.getState(),y=s.getLastTrigger(),S=s.getLastCompile();return y&&S&&m(y,S),s.subscribe(m)},[o,s]);const p=(0,A.useStore)(o,m=>m.lastCompile),x=(0,A.useStore)(o,m=>m.history),G=s.getCacheStats(),q=p===null&&x.length===0,f=()=>{h(m=>{const y=!m;return(0,g.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:q?"production: stats disabled":p?`last: ${p.label} · ${Z(p.durationMs)}`:"awaiting first compile…"})]}),(0,i.jsx)("button",{type:"button",onClick:()=>a(m=>!m),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&&!q&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(Xe,{delta:p?.stages,cumulative:G}),(0,i.jsx)(Qe,{entries:x})]})]})},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:g.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=g.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 g.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}=l.useGraphContext(),{stack:t,undo:r,redo:s}=e,o=(0,c.useCallback)(u=>t.subscribe(u),[t]),d=(0,c.useCallback)(()=>t.getSnapshot(),[t]),a=(0,c.useSyncExternalStore)(o,d,d);return(0,c.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,c.useEffect)(()=>{const o=st(r);if(!s||!o)return;const d=a=>{if(!nt(a)||a.defaultPrevented||ot(a.target))return;const u=l.resolveHistoryStep(a);if(!u)return;const h=e.current;h&&(u==="undo"?h.undo():h.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=l.BrandMark;exports.CanvasTextMeasurer=l.CanvasTextMeasurer;exports.DefaultFooter=l.DefaultFooter;exports.DefaultGrid=l.DefaultGrid;exports.DefaultHeader=l.DefaultHeader;exports.DefaultSwatch=l.DefaultSwatch;exports.DefaultTooltip=l.DefaultTooltip;exports.DevToolsPanel=ze;exports.GraphErrorBoundary=W;exports.GraphErrorPanel=L;exports.GraphProvider=Q;exports.GraphRenderer=l.GraphRenderer;exports.HoverProvider=l.HoverProvider;exports.TextMeasurerProvider=l.TextMeasurerProvider;exports.ThemeProvider=l.ThemeProvider;exports.UnitBoxSvg=De;exports.UnitSpaceSvg=Ie;exports.createGraphyKit=_e;exports.darkTheme=l.darkTheme;exports.defineGeomRenderer=l.defineGeomRenderer;exports.lightTheme=l.lightTheme;exports.lightenCss=l.lightenCss;exports.pruneSelection=X;exports.resolveBrandMarkVisual=l.resolveBrandMarkVisual;exports.useCompiledSelector=l.useCompiledSelector;exports.useElementScreenRect=l.useElementScreenRect;exports.useGeomHitTest=l.useGeomHitTest;exports.useGeomHover=l.useGeomHover;exports.useGraphCommands=l.useGraphCommands;exports.useGraphHandle=l.useGraphHandle;exports.useGraphHistory=et;exports.useGraphHistoryShortcuts=rt;exports.useGraphSelection=l.useGraphSelection;exports.useHandleCompiled=l.useHandleCompiled;exports.useHoverState=l.useHoverState;exports.useStyleReaders=l.useStyleReaders;exports.useStyleResolver=l.useStyleResolver;exports.useTextMeasurer=l.useTextMeasurer;exports.vars=se.vars;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('./index.css');const l=require("./history-chords-SWP7j5EG.cjs"),se=require("./theme.contract.css-BHtVczcV.cjs");let g=require("@graphysdk/viz-engine"),c=require("react"),i=require("react/jsx-runtime"),A=require("zustand"),B=require("zustand/vanilla"),$=require("clsx");$=l.__toESM($,1);var ne="_1a5iqpb0",oe="_1a5iqpb1";var ie="_1a5iqpb3",ae="_1a5iqpb4",le="_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:le,children:e.message}),e.suggestion&&(0,i.jsx)("p",{className:"_1a5iqpb6",children:e.suggestion})]});function ce(e=[],t=[]){return e.length===t.length&&e.every((r,s)=>Object.is(r,t[s]))}var W=class extends c.Component{constructor(...e){super(...e),this.state={caughtDiagnostic:null}}static getDerivedStateFromError(e){return{caughtDiagnostic:(0,g.buildDiagnostic)(e)}}componentDidCatch(e,t){const r=(0,g.buildDiagnostic)(e);l.logDiagnostics([r]),this.props.onError?.([r]),console.error("Chart render component stack:",t.componentStack)}componentDidUpdate(e){this.state.caughtDiagnostic&&!ce(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,g.resolveDefinition)(e);return t instanceof g.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,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,Y=[],me=()=>(0,B.createStore)(e=>({selection:Y,setSelection:t=>e(r=>he(r.selection,t)?r:{selection:t}),clearSelection:()=>e(t=>t.selection.length===0?t:{selection:Y})})),he=(e,t)=>e===t?!0:e.length!==t.length?!1:e.every((r,s)=>{const o=t[s];return o!==void 0&&(0,g.areEditTargetsEqual)(r,o)}),ge=process.env.NODE_ENV!=="production",pe=5,fe=e=>{if(!ge)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(l.BUILT_IN_GEOM_RENDERERS),...t.map(u=>u.geom)]),s=[],o=new Set;for(const u of e){const h=de(u);h===null||r.has(h.type)||o.has(h.type)||(o.add(h.type),s.push({kind:"user-input",severity:"error",code:"MISSING_GEOM_RENDERER",message:`Custom geom '${h.type}' is registered but has no renderer.`,context:{requested:h.type,kind:"geom-renderer"},suggestion:`Add a render half for it: \`defineGeomRenderer(${h.type}Geom, { coord, render })\`, then include it in \`plugins\`.`}))}const d=new Map;for(const u of t){if("definition"in u)continue;const h=`${u.geom}|${u.coord}`,p=d.get(h);p?p.count+=1:d.set(h,{geom:u.geom,coord:u.coord,count:1})}const a=[];for(const{geom:u,coord:h,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}', '${h}') (${p} entries); the last in the array wins.`,context:{requested:`${u}@${h}`,kind:"geom-renderer"},suggestion:`Keep a single render-only override for ('${u}', '${h}').`});return{errors:s,warnings:a}}function Ce(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 xe(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||l.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 Te(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||!l.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 qe(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 ke(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||!l.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 compiled layer carries the `byKey` index the overlay's `pushHover` resolves against."}))}return d}var Ge=e=>(0,B.createStore)(t=>({compiled:e,setCompiled:r=>t(s=>s.compiled===r?s:{compiled:r})})),Ne=({input:e,data:t,customPalettes:r,colorScheme:s,plugins:o,resolveRenderer:d,anchorResolver:a,onChange:u,onError:h,onWarnings:p})=>{const x=l.useLatestRef(u),G=l.useLatestRef(h),q=l.useLatestRef(p),[{session:f,compileBus:m}]=(0,c.useState)(()=>{const n=(0,g.createCompiler)({plugins:o});return{session:new g.GraphCompilationSession(n),compileBus:fe(n)}}),[y]=(0,c.useState)(()=>Ee(o??[])),S=(0,c.useRef)(null),[N]=(0,c.useState)(je),T=(0,c.useRef)(null),b=(0,c.useCallback)(n=>y.errors.length===0?n:[...y.errors,...n??[]],[y]),_=(0,c.useCallback)(n=>{if(!n.ok)return n.errors;if(T.current)T.current.getState().setCompiled(n.compiled);else{const v=Ge(n.compiled);v.subscribe(N.notify),T.current=v,N.notify()}return null},[N]),[D,I]=(0,c.useState)(()=>{const n=f.compile({input:e,data:t,customPalettes:r,colorScheme:s});return S.current=n,b(_(n))}),k=(0,c.useCallback)(n=>n.ok?[...n.warnings,...Ce(n.compiled,d),...xe(n.compiled,d),...Te(n.compiled),...Re(n.compiled,d),...ke(n.compiled,d),...qe(n.compiled,a)]:n.warnings,[d,a]),E=(0,c.useCallback)(n=>{n.length!==0&&(l.logDiagnostics(n),G.current?.(n))},[G]),R=(0,c.useCallback)(n=>{n.length!==0&&(l.logDiagnostics(n),q.current?.(n))},[q]);(0,c.useEffect)(()=>{const n=S.current;n&&(E([...y.errors,...n.ok?[]:n.errors]),R([...y.warnings,...k(n)]),n.ok&&m.emit({kind:"init"}))},[m,E,R,y,k]),(0,c.useEffect)(()=>{const n=f.update({input:e,data:t,customPalettes:r,colorScheme:s});if(!n)return;n.sealedInput&&x.current?.(n.sealedInput);const v=_(n.result);I(b(v)),v&&E(v),R(k(n.result)),v||m.emit({kind:n.inputChanged?"input":"data"})},[e,t,r,s,f,m,_,E,R,b,k,x]);const j=(0,c.useCallback)(n=>{I(v=>v===null?v:b(null)),R(k(n))},[b,R,k]),w=(0,c.useCallback)(n=>{n.compiled&&T.current?.getState().setCompiled(n.compiled),n.result&&j(n.result),n.command&&m.emit({kind:"command",command:n.command}),n.input&&x.current?.(n.input),n.errors&&E([...n.errors])},[j,m,x,E]),C=(0,c.useCallback)(n=>{for(const v of n)w(v);return n.some(v=>!!v.compiled)},[w]),M=(0,c.useCallback)((n,v)=>{C(f.applyCommand(n,v))},[f,C]),ee=(0,c.useCallback)(()=>{C(f.seal())},[f,C]),O=(0,c.useCallback)(()=>C(f.undo()),[f,C]),K=(0,c.useCallback)(()=>C(f.redo()),[f,C]),te=(0,c.useMemo)(()=>({stack:f.history,undo:O,redo:K}),[f,O,K]),re=(0,c.useCallback)(()=>T.current?.getState().compiled??null,[]);return{store:T.current,dispatch:M,seal:ee,history:te,subscribe:N.subscribe,getCompiled:re,compileBus:m,compileErrors:D}},je=()=>{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:a,onWarnings:u,customPalettes:h,colorScheme:p="light",children:x})=>{const[G]=(0,c.useState)(()=>l.createGeomRendererResolver(r.filter(z))),q=(0,c.useId)(),[f]=(0,c.useState)(()=>(0,g.createAnchorResolver)(r)),[m]=(0,c.useState)(()=>me()),y=(0,c.useMemo)(()=>(0,g.createStyleResolver)({colorScheme:p}),[p]),{store:S,dispatch:N,seal:T,history:b,subscribe:_,getCompiled:D,compileBus:I,compileErrors:k}=Ne({input:t,data:e,customPalettes:h,colorScheme:p,plugins:r,resolveRenderer:G,anchorResolver:f,onChange:d,onError:a,onWarnings:u});(0,c.useEffect)(()=>{if(S)return S.subscribe((j,w)=>{if(j.compiled.spec===w.compiled.spec)return;const{selection:C,setSelection:M}=m.getState();C.length!==0&&M(X(C,j.compiled.spec))})},[S,m]);const E=(0,c.useMemo)(()=>({dispatch:N,seal:T}),[N,T]);(0,c.useImperativeHandle)(o,()=>({commands:E,undo:b.undo,redo:b.redo,subscribe:_,getCompiled:D,getSelection:()=>m.getState().selection,setSelection:j=>m.getState().setSelection(j),subscribeSelection:m.subscribe}),[E,b,_,D,m]);const R=(0,c.useMemo)(()=>S?{chartId:q,store:S,selectionStore:m,commands:E,history:b,formattingLocale:s,compileBus:I,colorScheme:p,styleResolver:y,anchorResolver:f}:null,[q,S,m,E,b,s,I,p,y,f]);return(0,i.jsx)(W,{forcedErrors:k,onError:a,resetKeys:[t,e],children:R?(0,i.jsx)(l.GraphContext.Provider,{value:R,children:(0,i.jsx)(l.GeomRendererResolverProvider,{value:G,children:x})}):null})};function _e(e){const t=(0,g.createGraphyBuilder)(e);return{...t,GraphProvider:s=>(0,i.jsx)(Q,{...s,plugins:t.plugins})}}var Ie=({children:e,...t})=>(0,i.jsx)("svg",{viewBox:"0 0 1 1",preserveAspectRatio:"none",width:"100%",height:"100%",pointerEvents:"none",...t,children:e}),De=({box:e,children:t})=>(0,i.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}),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}=l.useGraphContext(),[o]=(0,c.useState)(()=>ve()),[d,a]=(0,c.useState)(!1),[u,h]=(0,c.useState)(g.isCompilerCachingEnabled);(0,c.useEffect)(()=>{const{recordCompile:m}=o.getState(),y=s.getLastTrigger(),S=s.getLastCompile();return y&&S&&m(y,S),s.subscribe(m)},[o,s]);const p=(0,A.useStore)(o,m=>m.lastCompile),x=(0,A.useStore)(o,m=>m.history),G=s.getCacheStats(),q=p===null&&x.length===0,f=()=>{h(m=>{const y=!m;return(0,g.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:q?"production: stats disabled":p?`last: ${p.label} · ${Z(p.durationMs)}`:"awaiting first compile…"})]}),(0,i.jsx)("button",{type:"button",onClick:()=>a(m=>!m),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&&!q&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(Xe,{delta:p?.stages,cumulative:G}),(0,i.jsx)(Qe,{entries:x})]})]})},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:g.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=g.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 g.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}=l.useGraphContext(),{stack:t,undo:r,redo:s}=e,o=(0,c.useCallback)(u=>t.subscribe(u),[t]),d=(0,c.useCallback)(()=>t.getSnapshot(),[t]),a=(0,c.useSyncExternalStore)(o,d,d);return(0,c.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,c.useEffect)(()=>{const o=st(r);if(!s||!o)return;const d=a=>{if(!nt(a)||a.defaultPrevented||ot(a.target))return;const u=l.resolveHistoryStep(a);if(!u)return;const h=e.current;h&&(u==="undo"?h.undo():h.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=l.BrandMark;exports.CanvasTextMeasurer=l.CanvasTextMeasurer;exports.DefaultFooter=l.DefaultFooter;exports.DefaultGrid=l.DefaultGrid;exports.DefaultHeader=l.DefaultHeader;exports.DefaultSwatch=l.DefaultSwatch;exports.DefaultTooltip=l.DefaultTooltip;exports.DevToolsPanel=ze;exports.GraphErrorBoundary=W;exports.GraphErrorPanel=L;exports.GraphProvider=Q;exports.GraphRenderer=l.GraphRenderer;exports.HoverProvider=l.HoverProvider;exports.TextMeasurerProvider=l.TextMeasurerProvider;exports.ThemeProvider=l.ThemeProvider;exports.UnitBoxSvg=De;exports.UnitSpaceSvg=Ie;exports.createGraphyKit=_e;exports.darkTheme=l.darkTheme;exports.defineGeomRenderer=l.defineGeomRenderer;exports.lightTheme=l.lightTheme;exports.lightenCss=l.lightenCss;exports.pruneSelection=X;exports.resolveBrandMarkVisual=l.resolveBrandMarkVisual;exports.useCompiledSelector=l.useCompiledSelector;exports.useElementScreenRect=l.useElementScreenRect;exports.useGeomHitTest=l.useGeomHitTest;exports.useGeomHover=l.useGeomHover;exports.useGraphCommands=l.useGraphCommands;exports.useGraphHandle=l.useGraphHandle;exports.useGraphHistory=et;exports.useGraphHistoryShortcuts=rt;exports.useGraphSelection=l.useGraphSelection;exports.useHandleCompiled=l.useHandleCompiled;exports.useHoverState=l.useHoverState;exports.useStyleReaders=l.useStyleReaders;exports.useStyleResolver=l.useStyleResolver;exports.useTextMeasurer=l.useTextMeasurer;exports.vars=se.vars;
package/dist/index.d.ts CHANGED
@@ -1,6 +1,4 @@
1
1
  import { AnchorPlacement } from '@graphysdk/viz-engine';
2
- import { AreaStyleReaders } from '@graphysdk/viz-engine';
3
- import { BarStyleReaders } from '@graphysdk/viz-engine';
4
2
  import { BrandMarkVariant } from '@graphysdk/viz-engine';
5
3
  import { CartesianCoordSystem } from '@graphysdk/viz-engine';
6
4
  import { ColorScheme } from '@graphysdk/viz-engine';
@@ -36,14 +34,12 @@ import { IntroStaggerOrder } from '@graphysdk/viz-engine';
36
34
  import { JSX } from 'react/jsx-runtime';
37
35
  import { LayerIntroPlan } from '@graphysdk/viz-engine';
38
36
  import { LayoutEdge } from '@graphysdk/viz-engine';
39
- import { LineStyleReaders } from '@graphysdk/viz-engine';
40
37
  import { LineStyleType } from '@graphysdk/viz-engine';
41
38
  import { Locale } from '@graphysdk/viz-engine';
42
39
  import { MeasuredText } from '@graphysdk/viz-engine';
43
40
  import { Observation } from '@graphysdk/viz-engine';
44
41
  import { Plugin as Plugin_2 } from '@graphysdk/viz-engine';
45
42
  import { PointerRegion } from '@graphysdk/viz-engine';
46
- import { PointStyleReaders } from '@graphysdk/viz-engine';
47
43
  import { PolarCoordSystem } from '@graphysdk/viz-engine';
48
44
  import { ReactElement } from 'react';
49
45
  import { ReactNode } from 'react';
@@ -52,11 +48,11 @@ import { Ref } from 'react';
52
48
  import { RefObject } from 'react';
53
49
  import { RenderHitTester } from '@graphysdk/viz-engine';
54
50
  import { ResolvedHeadlineSize } from '@graphysdk/viz-engine';
55
- import { RuleStyleReaders } from '@graphysdk/viz-engine';
56
51
  import { SourceContent } from '@graphysdk/viz-engine';
57
52
  import { Spec } from '@graphysdk/viz-engine';
58
53
  import { SpecInput } from '@graphysdk/viz-engine';
59
54
  import { StoreApi } from 'zustand';
55
+ import { StyleReadersForLayer } from '@graphysdk/viz-engine';
60
56
  import { StyleResolver } from '@graphysdk/viz-engine';
61
57
  import { SVGProps } from 'react';
62
58
  import { TextContent } from '@graphysdk/viz-engine';
@@ -1269,22 +1265,12 @@ export declare function useHoverState<T>(selector: (state: HoverStoreState) => T
1269
1265
 
1270
1266
  /**
1271
1267
  * Style readers for a layer, resolving paint through the stylesheet cascade. Takes either a base layer
1272
- * or a highlight's filtered sub-layer. A known geom kind gets back its own readers (for example
1273
- * {@link BarStyleReaders}), whose builtin-backed properties resolve NonNullable.
1268
+ * or a highlight's filtered sub-layer. A known geom kind gets back its own readers, whose
1269
+ * builtin-backed properties resolve NonNullable.
1274
1270
  *
1275
1271
  * Plugin paint can also read the same cascade from `input.styleReaders` on the geom render contract.
1276
1272
  */
1277
- export declare function useStyleReaders(layer: CompiledLayerFor<'bar'>): BarStyleReaders;
1278
-
1279
- export declare function useStyleReaders(layer: CompiledLayerFor<'line'>): LineStyleReaders;
1280
-
1281
- export declare function useStyleReaders(layer: CompiledLayerFor<'area'>): AreaStyleReaders;
1282
-
1283
- export declare function useStyleReaders(layer: CompiledLayerFor<'point'>): PointStyleReaders;
1284
-
1285
- export declare function useStyleReaders(layer: CompiledLayerFor<'rule'>): RuleStyleReaders;
1286
-
1287
- export declare function useStyleReaders(layer: CompiledLayer): GeomStyleReaders;
1273
+ export declare const useStyleReaders: <L extends CompiledLayer>(layer: L) => StyleReadersForLayer<L>;
1288
1274
 
1289
1275
  /** The chart's stylesheet resolver. One instance per provider, rebuilt when the colour scheme flips. */
1290
1276
  export declare const useStyleResolver: () => StyleResolver;
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
- import { Ct as Dt, Ft as $t, It as le, Lt as ne, M as xt, Nt as Ht, O as Mt, Pt as Lt, Rt as A, St as ue, Tt as Pt, X as Bt, Y as Kt, _ as Ot, _t as me, a as At, bt as he, ct as jt, gt as K, i as Ft, it as Ut, j as Yt, jt as Wt, k as Vt, lt as Xt, mt as Qt, n as zt, pt as Jt, r as Zt, rt as er, s as tr, t as ge, tt as rr, vt as nr, wt as sr, xt as or, yt as j } from "./history-chords-CP39rvrA.js";
2
- import { n as ar } from "./theme.contract.css-pudzI2o1.js";
1
+ import { Ct as Dt, Ft as $t, It as le, Lt as ne, M as xt, Nt as Ht, O as Mt, Pt as Lt, Rt as A, St as ue, Tt as Pt, X as Bt, Y as Kt, _ as Ot, _t as me, a as At, bt as he, ct as jt, gt as K, i as Ft, it as Ut, j as Yt, jt as Wt, k as Vt, lt as Xt, mt as Qt, n as zt, pt as Jt, r as Zt, rt as er, s as tr, t as ge, tt as rr, vt as nr, wt as sr, xt as or, yt as j } from "./history-chords-BLPhwLjz.js";
2
+ import { n as ar } from "./theme.contract.css-Rb-GELRv.js";
3
3
  import { COMPILER_STAGE_KEYS as F, Geom as pe, GraphCompilationSession as fe, areEditTargetsEqual as ve, buildDiagnostic as V, createAnchorResolver as ye, createCompiler as be, createGraphyBuilder as Se, createStyleResolver as Ee, findAnnotation as Ce, findLayerById as X, isCompilerCachingEnabled as Te, resolveDefinition as Ne, setCompilerCachingEnabled as Re, toPercent as L } from "@graphysdk/viz-engine";
4
4
  import { Component as qe, useCallback as f, useEffect as x, useId as Ie, useImperativeHandle as ke, useMemo as $, useRef as Q, useState as C, useSyncExternalStore as Ge } from "react";
5
5
  import { Fragment as we, jsx as d, jsxs as v } from "react/jsx-runtime";
@@ -0,0 +1 @@
1
+ var r=["canvasDefault","canvasBlue","canvasCyan","canvasGreen","canvasYellow","canvasOrange","canvasRed","canvasPink","canvasPurple","canvasGray","canvasInverse"],a={white:"var(--graphy-white)",black:"var(--graphy-black)",transparent:"var(--graphy-transparent)",grey100:"var(--graphy-grey-100)",grey95:"var(--graphy-grey-95)",grey90:"var(--graphy-grey-90)",grey85:"var(--graphy-grey-85)",grey80:"var(--graphy-grey-80)",grey75:"var(--graphy-grey-75)",grey70:"var(--graphy-grey-70)",grey60:"var(--graphy-grey-60)",grey50:"var(--graphy-grey-50)",grey0:"var(--graphy-grey-0)",greyGradient80:"var(--graphy-grey-gradient-80)",green60:"var(--graphy-green-60)",green50:"var(--graphy-green-50)",red60:"var(--graphy-red-60)",red50:"var(--graphy-red-50)",amber70:"var(--graphy-amber-70)",amber50:"var(--graphy-amber-50)",amber40:"var(--graphy-amber-40)",amber30:"var(--graphy-amber-30)",blue80:"var(--graphy-blue-80)",blue60:"var(--graphy-blue-60)",purple50:"var(--graphy-purple-50)",purple30:"var(--graphy-purple-30)",brand:"var(--graphy-brand)",success:"var(--graphy-success)",warning:"var(--graphy-warning)",alert:"var(--graphy-alert)",textPrimary:"var(--graphy-text-primary)",textSecondary:"var(--graphy-text-secondary)",textDisabled:"var(--graphy-text-disabled)",iconPrimary:"var(--graphy-icon-primary)",iconSecondary:"var(--graphy-icon-secondary)",iconStickerBackground:"var(--graphy-icon-sticker-background)",border100:"var(--graphy-border-100)",border50:"var(--graphy-border-50)",border10:"var(--graphy-border-10)",sunkenBackground:"var(--graphy-sunken-background)",defaultBackground:"var(--graphy-default-background)",raisedBackground:"var(--graphy-raised-background)",overlayBackground:"var(--graphy-overlay-background)",overlayBorderGradient:"var(--graphy-overlay-border-gradient)",graphBackground:"var(--graphy-graph-background)",legendFocusOutlineColor:"var(--graphy-legend-focus-outline-color)",annotationFrameBorderColor:"var(--graphy-annotation-frame-border-color)",editMenuTriggerIconColor:"var(--graphy-edit-menu-trigger-icon-color)",tooltipRowGap:"var(--graphy-tooltip-row-gap)",editorControlHeight:"var(--graphy-editor-control-height)",legendSwatchGap:"var(--graphy-legend-swatch-gap)",headlineRowGap:"var(--graphy-headline-row-gap)",canvasDefault:"var(--graphy-canvas-default)",canvasBlue:"var(--graphy-canvas-blue)",canvasCyan:"var(--graphy-canvas-cyan)",canvasGreen:"var(--graphy-canvas-green)",canvasYellow:"var(--graphy-canvas-yellow)",canvasOrange:"var(--graphy-canvas-orange)",canvasRed:"var(--graphy-canvas-red)",canvasPink:"var(--graphy-canvas-pink)",canvasPurple:"var(--graphy-canvas-purple)",canvasGray:"var(--graphy-canvas-gray)",canvasInverse:"var(--graphy-canvas-inverse)",elevationXs:"var(--graphy-elevation-xs)",elevationSm:"var(--graphy-elevation-sm)",elevationMd:"var(--graphy-elevation-md)",elevationLg:"var(--graphy-elevation-lg)",radiiXs:"var(--graphy-radii-xs)",radiiSm:"var(--graphy-radii-sm)",radiiMd:"var(--graphy-radii-md)",radiiLg:"var(--graphy-radii-lg)",spaceXxs:"var(--graphy-space-xxs)",spaceXs:"var(--graphy-space-xs)",spaceSm:"var(--graphy-space-sm)",spaceMd:"var(--graphy-space-md)",spaceLg:"var(--graphy-space-lg)",spaceXl:"var(--graphy-space-xl)",zIndexToolbar:"var(--graphy-z-index-toolbar)",zIndexToolbarTooltip:"var(--graphy-z-index-toolbar-tooltip)",zIndexToolbarPopover:"var(--graphy-z-index-toolbar-popover)",zIndexEditorPopover:"var(--graphy-z-index-editor-popover)",toolbarBackgroundColor:"var(--graphy-toolbar-background-color)",toolbarButtonBackgroundColor:"var(--graphy-toolbar-button-background-color)",toolbarButtonBackgroundColorHovered:"var(--graphy-toolbar-button-background-color-hovered)",toolbarButtonBackgroundColorSelected:"var(--graphy-toolbar-button-background-color-selected)",toolbarSeparatorColor:"var(--graphy-toolbar-separator-color)",fontFamily:"var(--graphy-font-family)",fontFamilyHeading:"var(--graphy-font-family-heading)",fontWeightRegular:"var(--graphy-font-weight-regular)",fontWeightMedium:"var(--graphy-font-weight-medium)",fontWeightSemibold:"var(--graphy-font-weight-semibold)",fontWeightBold:"var(--graphy-font-weight-bold)",fontWeightExtraBold:"var(--graphy-font-weight-extra-bold)",textScale:"var(--graphy-text-scale)",fontSizeXxs:"var(--graphy-font-size-xxs)",fontSizeXs:"var(--graphy-font-size-xs)",fontSizeSm:"var(--graphy-font-size-sm)",fontSizeMd:"var(--graphy-font-size-md)",fontSizeLg:"var(--graphy-font-size-lg)",fontSizeXl:"var(--graphy-font-size-xl)",fontLineHeightXxs:"var(--graphy-font-line-height-xxs)",fontLineHeightXs:"var(--graphy-font-line-height-xs)",fontLineHeightSm:"var(--graphy-font-line-height-sm)",fontLineHeightMd:"var(--graphy-font-line-height-md)",fontLineHeightLg:"var(--graphy-font-line-height-lg)",fontLineHeightXl:"var(--graphy-font-line-height-xl)",fontSizeEditorBody:"var(--graphy-font-size-editor-body)",fontSizeHeadingSm:"var(--graphy-font-size-heading-sm)",fontSizeHeadingMd:"var(--graphy-font-size-heading-md)",fontSizeHeadingLg:"var(--graphy-font-size-heading-lg)",fontLineHeightEditorBody:"var(--graphy-font-line-height-editor-body)",fontLineHeightHeadingSm:"var(--graphy-font-line-height-heading-sm)",fontLineHeightHeadingMd:"var(--graphy-font-line-height-heading-md)",fontLineHeightHeadingLg:"var(--graphy-font-line-height-heading-lg)",fontButton:"var(--graphy-font-button)",fontInput:"var(--graphy-font-input)",fontInputLabel:"var(--graphy-font-input-label)",fontSelectLabel:"var(--graphy-font-select-label)",fontSelectDescription:"var(--graphy-font-select-description)",fontColorSelectLabel:"var(--graphy-font-color-select-label)",fontMenuTitle:"var(--graphy-font-menu-title)",fontMenuGroupTitle:"var(--graphy-font-menu-group-title)",fontMenuItemLabel:"var(--graphy-font-menu-item-label)",fontMenuItemLabelSecondary:"var(--graphy-font-menu-item-label-secondary)",fontUITooltip:"var(--graphy-font-uitooltip)",fontUITooltipSecondary:"var(--graphy-font-uitooltip-secondary)",fontErrorBoundaryTitle:"var(--graphy-font-error-boundary-title)",fontErrorBoundaryMessage:"var(--graphy-font-error-boundary-message)",fontTableCell:"var(--graphy-font-table-cell)",fontTableHeaderCell:"var(--graphy-font-table-header-cell)",fontSourceLabel:"var(--graphy-font-source-label)",fontSourceLink:"var(--graphy-font-source-link)",fontTextEditorH1:"var(--graphy-font-text-editor-h1)",fontTextEditorH2:"var(--graphy-font-text-editor-h2)",fontTextEditorH3:"var(--graphy-font-text-editor-h3)",fontTextEditorH6:"var(--graphy-font-text-editor-h6)",fontTextEditorBody:"var(--graphy-font-text-editor-body)",fontTextEditorLink:"var(--graphy-font-text-editor-link)",fontHighlightModeTitle:"var(--graphy-font-highlight-mode-title)",fontHighlightModeSubtitle:"var(--graphy-font-highlight-mode-subtitle)",fontEditorControlLabel:"var(--graphy-font-editor-control-label)",fontEditorControlValue:"var(--graphy-font-editor-control-value)",fontEditorSectionTitle:"var(--graphy-font-editor-section-title)",fontEditorCaption:"var(--graphy-font-editor-caption)"};Object.defineProperty(exports,"CANVAS_COLOR_KEYS",{enumerable:!0,get:function(){return r}});Object.defineProperty(exports,"vars",{enumerable:!0,get:function(){return a}});
@@ -1,4 +1,4 @@
1
- import './theme.contract.css';var a = [
1
+ var a = [
2
2
  "canvasDefault",
3
3
  "canvasBlue",
4
4
  "canvasCyan",
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "visualization",
12
12
  "renderer"
13
13
  ],
14
- "version": "1.9.0-beta.1789110714410",
14
+ "version": "1.9.0-beta.1789110926690",
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.1789110714410"
58
+ "@graphysdk/viz-engine": "1.9.0-beta.1789110926690"
59
59
  },
60
60
  "peerDependencies": {
61
61
  "@tiptap/core": "^3.0.0",