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

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--hYQ5dh8.cjs"),se=require("./theme.contract.css-s8e7gRJD.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 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 Ge(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),q=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))}),G=(0,l.useCallback)(n=>n.ok?[...n.warnings,...xe(n.scene,d),...Te(n.scene,d),...Ce(n.scene),...Re(n.scene,d),...Ge(n.scene,d),...qe(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),q.current?.(n))},[q]);(0,l.useEffect)(()=>{const n=S.current;n&&(E([...y.errors,...n.ok?[]:n.errors]),R([...y.warnings,...G(n)]),n.ok&&h.emit({kind:"init"}))},[h,E,R,y,G]),(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(G(n.result)),v||h.emit({kind:n.inputChanged?"input":"data"})},[e,t,r,s,f,h,j,E,R,b,G,T]);const _=(0,l.useCallback)(n=>{D(v=>v===null?v:b(null)),R(G(n))},[b,R,G]),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))),q=(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:G}=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:q,store:S,selectionStore:h,commands:E,history:b,formattingLocale:s,compileBus:D,colorScheme:p,styleResolver:y,anchorResolver:f}:null,[q,S,h,E,b,s,D,p,y,f]);return(0,a.jsx)(W,{forcedErrors:G,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(),q=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:q?"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&&!q&&(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.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.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-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;
package/dist/index.d.ts CHANGED
@@ -47,6 +47,7 @@ import { RenderHitTester } from '@graphysdk/viz-engine';
47
47
  import { ResolvedHeadlineSize } from '@graphysdk/viz-engine';
48
48
  import { ResolvedSourceStyle } from '@graphysdk/viz-engine';
49
49
  import { ResolvedTextStyle } from '@graphysdk/viz-engine';
50
+ import { ScaledPositionAestheticKey } from '@graphysdk/viz-engine';
50
51
  import { Scene } from '@graphysdk/viz-engine';
51
52
  import { SceneLayer } from '@graphysdk/viz-engine';
52
53
  import { SceneLayerFor } from '@graphysdk/viz-engine';
@@ -183,7 +184,12 @@ export declare const darkTheme: string;
183
184
  /** Default paint for the footer region — caption, source line, and optional footer-anchored badge. */
184
185
  export declare const DefaultFooter: ({ ref, footerRect, mode, caption, isCaptionVisible, source, isSourceVisible, captionStyle, sourceStyle, brandMark, }: FooterSlotProps) => JSX.Element | null;
185
186
 
186
- /** Default paint for the grid region — per-tick gridlines, drawn inside the panel frame rect. */
187
+ /**
188
+ * Default paint for the grid region — per-tick grid lines, drawn inside the panel frame rect. Where a press
189
+ * can take a guide, each drawn line is a stamped group holding the stroke and a transparent hit stroke
190
+ * `GRID_LINE_HIT_WIDTH_PX` wide on the same coordinates. The hit stroke is solid, so a dashed line answers
191
+ * along its whole length, gaps included. Of two crossing lines the one painted later answers.
192
+ */
187
193
  export declare const DefaultGrid: ({ axes, panelBorderSizes, panelFrameRect, panelRect }: GridSlotProps) => JSX.Element;
188
194
 
189
195
  /** Default paint for the header region — title, subtitle, and optional header-anchored badge. */
@@ -236,6 +242,12 @@ export declare interface DevToolsPanelProps {
236
242
  className?: string;
237
243
  }
238
244
 
245
+ /** Addresses the axis a stamped node belongs to. */
246
+ declare const EDIT_TARGET_AXIS_ATTRIBUTE = "data-edit-axis";
247
+
248
+ /** Names the family painted by a node, which the shared pointer resolver reads. */
249
+ declare const EDIT_TARGET_KIND_ATTRIBUTE = "data-edit-kind";
250
+
239
251
  /** Props the renderer passes to the editor layer filling the `EditorSurface` slot. */
240
252
  export declare interface EditorSurfaceSlotProps {
241
253
  /** The frame's content box — the element the layer measures, listens on and aligns its chrome to. */
@@ -694,9 +706,21 @@ export declare interface GraphyKit<P extends readonly Plugin_2[] = readonly Plug
694
706
  GraphProvider: (props: Omit<GraphProviderProps, 'plugins'>) => ReactElement;
695
707
  }
696
708
 
709
+ /** The axis identity spread onto the group holding one grid line's stroke and its hit stroke. */
710
+ export declare type GridEditTargetAttributes = {
711
+ /** The grid family read by the editor. */
712
+ [EDIT_TARGET_KIND_ATTRIBUTE]: 'grid';
713
+ /** The scale the line belongs to, kept as its own key so a secondary axis is told apart from the primary. */
714
+ [EDIT_TARGET_AXIS_ATTRIBUTE]: ScaledPositionAestheticKey;
715
+ };
716
+
697
717
  /**
698
718
  * Props for the Grid slot, overridable via `slots.Grid` on `GraphRenderer`. `panelRect` is in
699
719
  * SVG-local coordinates.
720
+ *
721
+ * A grid filling this slot spreads `stampGridEditTarget` on the group holding each line it draws, with a
722
+ * hit area of its own inside that group, where `useGuidesTakePress` is true; a line it hides or moves
723
+ * takes its hit area with it, and a line it does not stamp takes no press.
700
724
  */
701
725
  export declare interface GridSlotProps {
702
726
  axes: FormattedAxis[];
@@ -987,6 +1011,9 @@ export declare interface SlotOverride<Props, Measure> {
987
1011
  measure: Measure;
988
1012
  }
989
1013
 
1014
+ /** Identifies one drawn grid line of a scale, on the group holding its stroke and its hit stroke. */
1015
+ export declare const stampGridEditTarget: (scaleAestheticKey: ScaledPositionAestheticKey) => GridEditTargetAttributes;
1016
+
990
1017
  /**
991
1018
  * The vocabulary of legend/tooltip/headline marks the {@link Swatch} can paint. A geom picks the one
992
1019
  * that best evokes its on-canvas mark via `swatchShape` on its render contract (see
@@ -1257,6 +1284,12 @@ export declare const useGraphHistoryShortcuts: (handleRef: RefObject<GraphHandle
1257
1284
  */
1258
1285
  export declare const useGraphSelection: () => readonly EditTarget[];
1259
1286
 
1287
+ /**
1288
+ * Whether a press in the chart's mode takes a guide. A guide renderer, the default or a slot, reads it to
1289
+ * give its stamped nodes a hit area and the pointer only where a press on them selects the guide.
1290
+ */
1291
+ export declare const useGuidesTakePress: () => boolean;
1292
+
1260
1293
  /**
1261
1294
  * The graph's scene, re-read whenever the graph changes, or `null` before its first
1262
1295
  * successful compile.
package/dist/index.mjs CHANGED
@@ -1,9 +1,9 @@
1
- import { $ as Dt, At as $t, Bt as Ht, Ct as xt, F as Mt, Gt as ne, Ht as Pt, Kt as A, M as Lt, Mt as Bt, Ot as Kt, P as Ot, Q as At, Rt as jt, St as le, Tt as ue, Ut, Vt as Ft, Wt as he, _ as Yt, a as Wt, dt as Vt, i as Qt, it as Xt, j as zt, jt as Jt, kt as me, mt as Zt, n as er, ot as tr, pt as rr, r as nr, s as sr, st as or, t as ge, vt as ir, wt as j, xt as K, yt as ar } from "./history-chords-3nxfCajN.js";
2
- import { n as dr } from "./theme.contract.css-BVYwXVfn.js";
3
- import { COMPILER_STAGE_KEYS as U, 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 Q, isCompilerCachingEnabled as Re, resolveDefinition as Ne, 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 X, useState as T, useSyncExternalStore as ke } from "react";
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";
2
+ import { n as ur } from "./theme.contract.css-DaZ5UPN0.js";
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";
5
5
  import { Fragment as we, jsx as d, jsxs as v } from "react/jsx-runtime";
6
- import { useStore as z } from "zustand";
6
+ import { useStore as Q } from "zustand";
7
7
  import { createStore as F } from "zustand/vanilla";
8
8
  import _e from "clsx";
9
9
  import './index.css';var De = "_1a5iqpb0", $e = "_1a5iqpb1";
@@ -66,20 +66,20 @@ var Le = class extends qe {
66
66
  return t && t.length > 0 ? /* @__PURE__ */ d(J, { errors: t }) : r;
67
67
  }
68
68
  }, se = (e) => typeof e == "object" && "geom" in e && "render" in e, Be = (e) => {
69
- const t = Ne(e);
69
+ const t = Re(e);
70
70
  return t instanceof pe ? t : null;
71
71
  }, Ke = (e, t) => {
72
72
  const r = e.filter((n) => Oe(n, t));
73
73
  return r.length === e.length ? e : r;
74
- }, Oe = (e, t) => e.kind === "annotation" ? Te(t.annotations, e.id) !== null : e.kind === "observations" ? Q(t.layers, e.layerId) !== void 0 : e.kind === "layer" && e.layerId !== void 0 ? Q(t.layers, e.layerId) !== void 0 : !0, ee = [], Ae = () => F((e) => ({
74
+ }, Oe = (e, t) => e.kind === "annotation" ? Te(t.annotations, e.id) !== null : e.kind === "observations" ? X(t.layers, e.layerId) !== void 0 : e.kind === "layer" && e.layerId !== void 0 ? X(t.layers, e.layerId) !== void 0 : !0, ee = [], Ae = () => F((e) => ({
75
75
  selection: ee,
76
- setSelection: (t) => e((r) => je(r.selection, t) ? r : { selection: t }),
76
+ setSelection: (t) => e((r) => Ue(r.selection, t) ? r : { selection: t }),
77
77
  clearSelection: () => e((t) => t.selection.length === 0 ? t : { selection: ee })
78
- })), je = (e, t) => e === t ? !0 : e.length !== t.length ? !1 : e.every((r, n) => {
78
+ })), Ue = (e, t) => e === t ? !0 : e.length !== t.length ? !1 : e.every((r, n) => {
79
79
  const o = t[n];
80
80
  return o !== void 0 && ve(r, o);
81
- }), Ue = process.env.NODE_ENV !== "production", Fe = 5, Ye = (e) => {
82
- if (!Ue) return {
81
+ }), je = process.env.NODE_ENV !== "production", Fe = 5, Ye = (e) => {
82
+ if (!je) return {
83
83
  emit: () => {
84
84
  },
85
85
  subscribe: () => Ve,
@@ -113,19 +113,19 @@ var Le = class extends qe {
113
113
  if (n.lastSnapshot === r) return n;
114
114
  const o = {
115
115
  id: n.nextId,
116
- label: Qe(t),
116
+ label: Xe(t),
117
117
  stages: r.stages,
118
118
  durationMs: r.durationMs
119
119
  };
120
120
  return {
121
121
  lastCompile: o,
122
- history: Xe(n.history, o, Fe),
122
+ history: ze(n.history, o, Fe),
123
123
  nextId: n.nextId + 1,
124
124
  lastSnapshot: r
125
125
  };
126
126
  })
127
127
  })), Ve = () => {
128
- }, Qe = (e) => {
128
+ }, Xe = (e) => {
129
129
  switch (e.kind) {
130
130
  case "init":
131
131
  return "init";
@@ -136,12 +136,12 @@ var Le = class extends qe {
136
136
  case "command":
137
137
  return e.command.metadata.description;
138
138
  }
139
- }, Xe = (e, t, r) => {
139
+ }, ze = (e, t, r) => {
140
140
  const n = e.length >= r ? e.length - (r - 1) : 0;
141
141
  return [...e.slice(n), t];
142
142
  };
143
- function ze(e) {
144
- const t = e.filter(se), r = /* @__PURE__ */ new Set([...Object.keys(ue), ...t.map((c) => c.geom)]), n = [], o = /* @__PURE__ */ new Set();
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();
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({
@@ -205,7 +205,7 @@ function Ze(e, t) {
205
205
  for (const i of n) {
206
206
  if (i.interactive === !1 || i.spatialKind !== "render-hit-test" || o.has(i.geom)) continue;
207
207
  const c = t(i.geom, r.type);
208
- c === null || c.hitTest || j(c) || (o.add(i.geom), a.push({
208
+ c === null || c.hitTest || U(c) || (o.add(i.geom), a.push({
209
209
  kind: "user-input",
210
210
  severity: "warning",
211
211
  code: "MISSING_RENDER_HIT_TEST",
@@ -242,7 +242,7 @@ function tt(e, t) {
242
242
  for (const i of n) {
243
243
  if (i.interactive === !1 || i.spatialKind !== "render-hit-test" || o.has(i.geom)) continue;
244
244
  const c = t(i.geom, r.type);
245
- c === null || !c.hitTest || !j(c) || (o.add(i.geom), a.push({
245
+ c === null || !c.hitTest || !U(c) || (o.add(i.geom), a.push({
246
246
  kind: "user-input",
247
247
  severity: "warning",
248
248
  code: "CONFLICTING_RENDER_HIT_TEST",
@@ -277,7 +277,7 @@ function nt(e, t) {
277
277
  for (const i of n) {
278
278
  if (i.interactive === !1 || i.spatialKind === "render-hit-test" || o.has(i.geom)) continue;
279
279
  const c = t(i.geom, r.type);
280
- c === null || !j(c) || (o.add(i.geom), a.push({
280
+ c === null || !U(c) || (o.add(i.geom), a.push({
281
281
  kind: "user-input",
282
282
  severity: "warning",
283
283
  code: "OVERLAY_REQUIRES_RENDER_HIT_TEST",
@@ -295,18 +295,18 @@ var st = (e) => F((t) => ({
295
295
  scene: e,
296
296
  setScene: (r) => t((n) => n.scene === r ? n : { scene: r })
297
297
  })), ot = ({ input: e, data: t, customPalettes: r, colorScheme: n, plugins: o, resolveRenderer: a, anchorResolver: i, onChange: c, onError: u, onWarnings: h }) => {
298
- const R = K(c), I = K(u), q = K(h), [{ session: m, compileBus: l }] = T(() => {
298
+ const N = K(c), I = K(u), q = K(h), [{ session: m, 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(() => ze(o ?? [])), y = X(null), [k] = T(it), N = X(null), S = f((s) => p.errors.length === 0 ? s : [...p.errors, ...s ?? []], [p]), _ = f((s) => {
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) => {
305
305
  if (!s.ok) return s.errors;
306
- if (N.current) N.current.getState().setScene(s.scene);
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), N.current = g, k.notify();
309
+ g.subscribe(k.notify), R.current = g, k.notify();
310
310
  }
311
311
  return null;
312
312
  }, [k]), [x, D] = T(() => {
@@ -347,7 +347,7 @@ var st = (e) => F((t) => ({
347
347
  colorScheme: n
348
348
  });
349
349
  if (!s) return;
350
- s.sealedInput && R.current?.(s.sealedInput);
350
+ s.sealedInput && N.current?.(s.sealedInput);
351
351
  const g = _(s.result);
352
352
  D(S(g)), g && b(g), C(G(s.result)), g || l.emit({ kind: s.inputChanged ? "input" : "data" });
353
353
  }, [
@@ -362,7 +362,7 @@ var st = (e) => F((t) => ({
362
362
  C,
363
363
  S,
364
364
  G,
365
- R
365
+ N
366
366
  ]);
367
367
  const w = f((s) => {
368
368
  D((g) => g === null ? g : S(null)), C(G(s));
@@ -371,14 +371,14 @@ var st = (e) => F((t) => ({
371
371
  C,
372
372
  G
373
373
  ]), M = f((s) => {
374
- s.scene && N.current?.getState().setScene(s.scene), s.result && w(s.result), s.command && l.emit({
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 && R.current?.(s.input), s.errors && b([...s.errors]);
377
+ }), s.input && N.current?.(s.input), s.errors && b([...s.errors]);
378
378
  }, [
379
379
  w,
380
380
  l,
381
- R,
381
+ N,
382
382
  b
383
383
  ]), E = f((s) => {
384
384
  for (const g of s) M(g);
@@ -395,9 +395,9 @@ var st = (e) => F((t) => ({
395
395
  m,
396
396
  Y,
397
397
  W
398
- ]), de = f(() => N.current?.getState().scene ?? null, []);
398
+ ]), de = f(() => R.current?.getState().scene ?? null, []);
399
399
  return {
400
- store: N.current,
400
+ store: R.current,
401
401
  dispatch: B,
402
402
  seal: ae,
403
403
  history: ce,
@@ -414,8 +414,8 @@ 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: R }) => {
418
- const [I] = T(() => le(r.filter(se))), q = Ge(), [m] = T(() => ye(r)), [l] = T(() => Ae()), p = $(() => Ee({ colorScheme: h }), [h]), { store: y, dispatch: k, seal: N, history: S, subscribe: _, getScene: x, compileBus: D, compileErrors: G } = ot({
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
419
  input: t,
420
420
  data: e,
421
421
  customPalettes: u,
@@ -437,8 +437,8 @@ var st = (e) => F((t) => ({
437
437
  }, [y, l]);
438
438
  const b = $(() => ({
439
439
  dispatch: k,
440
- seal: N
441
- }), [k, N]);
440
+ seal: R
441
+ }), [k, R]);
442
442
  Ie(o, () => ({
443
443
  commands: b,
444
444
  undo: S.undo,
@@ -482,16 +482,16 @@ var st = (e) => F((t) => ({
482
482
  forcedErrors: G,
483
483
  onError: i,
484
484
  resetKeys: [t, e],
485
- children: C ? /* @__PURE__ */ d(he.Provider, {
485
+ children: C ? /* @__PURE__ */ d(me.Provider, {
486
486
  value: C,
487
- children: /* @__PURE__ */ d(me, {
487
+ children: /* @__PURE__ */ d(le, {
488
488
  value: I,
489
- children: R
489
+ children: N
490
490
  })
491
491
  }) : null
492
492
  });
493
493
  };
494
- function fr(e) {
494
+ function yr(e) {
495
495
  const t = be(e);
496
496
  return {
497
497
  ...t,
@@ -501,7 +501,7 @@ function fr(e) {
501
501
  })
502
502
  };
503
503
  }
504
- var vr = ({ children: e, ...t }) => /* @__PURE__ */ d("svg", {
504
+ var Sr = ({ children: e, ...t }) => /* @__PURE__ */ d("svg", {
505
505
  viewBox: "0 0 1 1",
506
506
  preserveAspectRatio: "none",
507
507
  width: "100%",
@@ -509,7 +509,7 @@ var vr = ({ children: e, ...t }) => /* @__PURE__ */ d("svg", {
509
509
  pointerEvents: "none",
510
510
  ...t,
511
511
  children: e
512
- }), yr = ({ box: e, children: t }) => /* @__PURE__ */ d("svg", {
512
+ }), br = ({ box: e, children: t }) => /* @__PURE__ */ d("svg", {
513
513
  x: P(e.x0),
514
514
  y: P(e.y0),
515
515
  width: P(e.x1 - e.x0),
@@ -529,13 +529,13 @@ var Et = "drqe3uh", Tt = "drqe3ui", te = {
529
529
  ran: "drqe3uq drqe3up",
530
530
  cached: "drqe3ur drqe3up",
531
531
  untouched: "drqe3us drqe3up"
532
- }, Sr = ({ width: e = 380, style: t, className: r } = {}) => {
533
- const { compileBus: n } = ne(), [o] = T(() => We()), [a, i] = T(!1), [c, u] = T(Re);
532
+ }, Er = ({ width: e = 380, style: t, className: r } = {}) => {
533
+ const { compileBus: n } = ne(), [o] = T(() => We()), [a, i] = T(!1), [c, u] = T(Ne);
534
534
  H(() => {
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 = z(o, (l) => l.lastCompile), R = z(o, (l) => l.history), I = n.getCacheStats(), q = h === null && R.length === 0, m = () => {
538
+ const h = Q(o, (l) => l.lastCompile), N = Q(o, (l) => l.history), I = n.getCacheStats(), q = h === null && N.length === 0, m = () => {
539
539
  u((l) => {
540
540
  const p = !l;
541
541
  return Ce(p), p;
@@ -576,13 +576,13 @@ var Et = "drqe3uh", Tt = "drqe3ui", te = {
576
576
  children: "next compile reflects this toggle"
577
577
  })]
578
578
  }),
579
- !a && !q && /* @__PURE__ */ v(we, { children: [/* @__PURE__ */ d(Rt, {
579
+ !a && !q && /* @__PURE__ */ v(we, { children: [/* @__PURE__ */ d(Nt, {
580
580
  delta: h?.stages,
581
581
  cumulative: I
582
- }), /* @__PURE__ */ d(Nt, { entries: R })] })
582
+ }), /* @__PURE__ */ d(Rt, { entries: N })] })
583
583
  ]
584
584
  });
585
- }, Rt = ({ delta: e, cumulative: t }) => /* @__PURE__ */ v("table", {
585
+ }, Nt = ({ delta: e, cumulative: t }) => /* @__PURE__ */ v("table", {
586
586
  className: lt,
587
587
  children: [/* @__PURE__ */ d("thead", { children: /* @__PURE__ */ v("tr", {
588
588
  className: Et,
@@ -608,7 +608,7 @@ var Et = "drqe3uh", Tt = "drqe3ui", te = {
608
608
  children: "total hit"
609
609
  })
610
610
  ]
611
- }) }), /* @__PURE__ */ d("tbody", { children: U.map((r) => {
611
+ }) }), /* @__PURE__ */ d("tbody", { children: j.map((r) => {
612
612
  const n = e?.[r], o = Ct(n);
613
613
  return /* @__PURE__ */ v("tr", {
614
614
  className: vt,
@@ -643,13 +643,13 @@ var Et = "drqe3uh", Tt = "drqe3ui", te = {
643
643
  ]
644
644
  }, r);
645
645
  }) })]
646
- }), Nt = ({ entries: e }) => e.length === 0 ? null : /* @__PURE__ */ v("div", {
646
+ }), Rt = ({ entries: e }) => e.length === 0 ? null : /* @__PURE__ */ v("div", {
647
647
  className: yt,
648
648
  children: [/* @__PURE__ */ d("div", {
649
649
  className: Tt,
650
650
  children: "recent compiles"
651
651
  }), e.map((t) => {
652
- const r = qt(t.stages, (a) => a.misses > 0), n = U.length;
652
+ const r = qt(t.stages, (a) => a.misses > 0), n = j.length;
653
653
  return /* @__PURE__ */ v("div", {
654
654
  className: mt,
655
655
  children: [
@@ -677,9 +677,9 @@ var Et = "drqe3uh", Tt = "drqe3ui", te = {
677
677
  })]
678
678
  }), Ct = (e) => !e || e.hits === 0 && e.misses === 0 ? "untouched" : e.misses > 0 ? "ran" : "cached", qt = (e, t) => {
679
679
  let r = 0;
680
- for (const n of U) t(e[n]) && (r += 1);
680
+ for (const n of j) t(e[n]) && (r += 1);
681
681
  return r;
682
- }, ie = (e) => e >= 10 ? `${e.toFixed(0)}ms` : `${e.toFixed(2)}ms`, br = () => {
682
+ }, ie = (e) => e >= 10 ? `${e.toFixed(0)}ms` : `${e.toFixed(2)}ms`, Tr = () => {
683
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);
684
684
  return $(() => ({
685
685
  ...i,
@@ -701,7 +701,7 @@ var Et = "drqe3uh", Tt = "drqe3ui", te = {
701
701
  "range",
702
702
  "reset",
703
703
  "submit"
704
- ]), Er = (e, t = {}) => {
704
+ ]), Nr = (e, t = {}) => {
705
705
  const { target: r, enabled: n = !0 } = t;
706
706
  H(() => {
707
707
  const o = It(r);
@@ -721,45 +721,47 @@ var Et = "drqe3uh", Tt = "drqe3ui", te = {
721
721
  ]);
722
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;
723
723
  export {
724
- Ot as BrandMark,
725
- Bt as CanvasTextMeasurer,
726
- Lt as DefaultFooter,
724
+ Ht as BrandMark,
725
+ Kt as CanvasTextMeasurer,
726
+ Bt as DefaultFooter,
727
727
  sr as DefaultGrid,
728
- zt as DefaultHeader,
729
- Kt as DefaultSwatch,
730
- At as DefaultTooltip,
731
- Sr as DevToolsPanel,
732
- Vt as GRAPH_MODES,
728
+ Pt as DefaultHeader,
729
+ er as DefaultSwatch,
730
+ Dt as DefaultTooltip,
731
+ Er as DevToolsPanel,
732
+ zt as GRAPH_MODES,
733
733
  Le as GraphErrorBoundary,
734
734
  J as GraphErrorPanel,
735
735
  at as GraphProvider,
736
- Wt as GraphRenderer,
737
- ar as HoverProvider,
738
- $t as TextMeasurerProvider,
739
- Xt as ThemeProvider,
740
- yr as UnitBoxSvg,
741
- vr as UnitSpaceSvg,
742
- fr as createGraphyKit,
743
- tr as darkTheme,
744
- xt as defineGeomRenderer,
745
- or as lightTheme,
746
- jt as lightenCss,
736
+ jt as GraphRenderer,
737
+ Yt as HoverProvider,
738
+ Zt as TextMeasurerProvider,
739
+ Ft as ThemeProvider,
740
+ br as UnitBoxSvg,
741
+ Sr as UnitSpaceSvg,
742
+ yr as createGraphyKit,
743
+ or as darkTheme,
744
+ ar as defineGeomRenderer,
745
+ Vt as lightTheme,
746
+ dr as lightenCss,
747
747
  Ke as pruneSelection,
748
748
  Mt as resolveBrandMarkVisual,
749
- Zt as useElementScreenRect,
750
- ir as useGeomHitTest,
751
- rr as useGeomHover,
752
- er as useGraphCommands,
753
- Qt as useGraphHandle,
754
- br as useGraphHistory,
755
- Er as useGraphHistoryShortcuts,
756
- Yt as useGraphSelection,
749
+ $t as stampGridEditTarget,
750
+ Qt as useElementScreenRect,
751
+ cr as useGeomHitTest,
752
+ tr as useGeomHover,
753
+ rr as useGraphCommands,
754
+ Jt as useGraphHandle,
755
+ Tr as useGraphHistory,
756
+ Nr as useGraphHistoryShortcuts,
757
+ ir as useGraphSelection,
758
+ Wt as useGuidesTakePress,
757
759
  nr as useHandleScene,
758
- Dt as useHoverState,
760
+ Xt as useHoverState,
759
761
  Ut as useSceneSelector,
760
- Ht as useStyleReaderTree,
761
- Ft as useStyleReaders,
762
- Pt as useStyleResolver,
763
- Jt as useTextMeasurer,
764
- dr as vars
762
+ At as useStyleReaderTree,
763
+ xt as useStyleReaders,
764
+ Ot as useStyleResolver,
765
+ Lt as useTextMeasurer,
766
+ ur as vars
765
767
  };
@@ -0,0 +1 @@
1
+
@@ -1,4 +1,4 @@
1
- var a = [
1
+ import './theme.contract.css';var a = [
2
2
  "canvasDefault",
3
3
  "canvasBlue",
4
4
  "canvasCyan",
@@ -0,0 +1 @@
1
+ require('./theme.contract.css');var a=["canvasDefault","canvasBlue","canvasCyan","canvasGreen","canvasYellow","canvasOrange","canvasRed","canvasPink","canvasPurple","canvasGray","canvasInverse"],r={white:"var(--graphy-white)",black:"var(--graphy-black)",transparent:"var(--graphy-transparent)",gray100:"var(--graphy-gray-100)",gray95:"var(--graphy-gray-95)",gray90:"var(--graphy-gray-90)",gray85:"var(--graphy-gray-85)",gray80:"var(--graphy-gray-80)",gray75:"var(--graphy-gray-75)",gray70:"var(--graphy-gray-70)",gray60:"var(--graphy-gray-60)",gray50:"var(--graphy-gray-50)",gray0:"var(--graphy-gray-0)",grayGradient80:"var(--graphy-gray-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 a}});Object.defineProperty(exports,"vars",{enumerable:!0,get:function(){return r}});
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "visualization",
12
12
  "renderer"
13
13
  ],
14
- "version": "1.9.0-beta.1789572763405",
14
+ "version": "1.9.0-beta.1789573335651",
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.1789572763405"
58
+ "@graphysdk/viz-engine": "1.9.0-beta.1789573335651"
59
59
  },
60
60
  "peerDependencies": {
61
61
  "@tiptap/core": "^3.0.0",