@graphysdk/react-renderer 1.9.0-beta.1788780809119 → 1.9.0-beta.1788781002318

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-lLtDj1lQ.cjs"),z=require("./dev.utils-C5W6wbHd.cjs");let p=require("@graphysdk/viz-engine"),l=require("react"),i=require("react/jsx-runtime"),U=require("zustand"),K=require("zustand/vanilla"),$=require("clsx");$=c.__toESM($,1);function L(e){for(const t of e)(t.severity==="error"?console.error:console.warn)(`[graphy] ${t.code}: ${t.message}`,t)}var oe="_1a5iqpb0",ie="_1a5iqpb1";var ae="_1a5iqpb3",ce="_1a5iqpb4",le="_1a5iqpb5";var B=({errors:e})=>{const[t,...r]=e;return(0,i.jsxs)("div",{role:"alert",className:oe,children:[(0,i.jsx)("strong",{className:ie,children:"This chart could not be rendered."}),t&&(0,i.jsx)(Y,{diagnostic:t}),r.length>0&&(0,i.jsx)("ul",{className:"_1a5iqpb2",children:r.map((s,o)=>(0,i.jsx)("li",{children:(0,i.jsx)(Y,{diagnostic:s})},`${s.code}-${o}`))})]})},Y=({diagnostic:e})=>(0,i.jsxs)("div",{className:ae,children:[(0,i.jsx)("span",{className:ce,children:e.code}),(0,i.jsx)("p",{className:le,children:e.message}),e.suggestion&&(0,i.jsx)("p",{className:"_1a5iqpb6",children:e.suggestion})]});function de(e=[],t=[]){return e.length===t.length&&e.every((r,s)=>Object.is(r,t[s]))}var X=class extends l.Component{constructor(...e){super(...e),this.state={caughtDiagnostic:null}}static getDerivedStateFromError(e){return{caughtDiagnostic:(0,p.buildDiagnostic)(e)}}componentDidCatch(e,t){const r=(0,p.buildDiagnostic)(e);L([r]),this.props.onError?.([r]),console.error("Chart render component stack:",t.componentStack)}componentDidUpdate(e){this.state.caughtDiagnostic&&!de(e.resetKeys,this.props.resetKeys)&&this.setState({caughtDiagnostic:null})}render(){const{caughtDiagnostic:e}=this.state;if(e)return(0,i.jsx)(B,{errors:[e]});const{forcedErrors:t,children:r}=this.props;return t&&t.length>0?(0,i.jsx)(B,{errors:t}):r}},Q=e=>typeof e=="object"&&"geom"in e&&"render"in e,ue=e=>{const t=(0,p.resolveDefinition)(e);return t instanceof p.Geom?t:null},J=(e,t)=>{const r=e.filter(s=>me(s,t));return r.length===e.length?e:r},me=(e,t)=>e.kind!=="annotation"?!0:(0,p.findAnnotation)(t.annotations,e.id)!==null,F=[],he=()=>(0,K.createStore)(e=>({selection:F,setSelection:t=>e(r=>ge(r.selection,t)?r:{selection:t}),clearSelection:()=>e(t=>t.selection.length===0?t:{selection:F})})),ge=(e,t)=>e===t?!0:e.length!==t.length?!1:e.every((r,s)=>{const o=t[s];return o!==void 0&&(0,p.areEditTargetsEqual)(r,o)}),pe=5,fe=e=>{if(!z.IS_DEV)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,K.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(Q),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 m=ue(u);m===null||r.has(m.type)||o.has(m.type)||(o.add(m.type),s.push({kind:"user-input",severity:"error",code:"MISSING_GEOM_RENDERER",message:`Custom geom '${m.type}' is registered but has no renderer.`,context:{requested:m.type,kind:"geom-renderer"},suggestion:`Add a render half for it: \`defineGeomRenderer(${m.type}Geom, { coord, render })\`, then include it in \`plugins\`.`}))}const d=new Map;for(const u of t){if("definition"in u)continue;const m=`${u.geom}|${u.coord}`,v=d.get(m);v?v.count+=1:d.set(m,{geom:u.geom,coord:u.coord,count:1})}const a=[];for(const{geom:u,coord:m,count:v}of d.values())v<2||a.push({kind:"user-input",severity:"warning",code:"DUPLICATE_REGISTERED_TYPE",message:`Multiple render-only overrides register ('${u}', '${m}') (${v} entries); the last in the array wins.`,context:{requested:`${u}@${m}`,kind:"geom-renderer"},suggestion:`Keep a single render-only override for ('${u}', '${m}').`});return{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||c.isOverlayHosted(u)||(o.add(a.geom),d.push({kind:"user-input",severity:"warning",code:"MISSING_RENDER_HIT_TEST",message:`Geom '${a.geom}' declares spatialKind 'render-hit-test' but its renderer provides no hit-test; the layer has no hover.`,context:{requested:a.geom,kind:"geom-renderer"},suggestion:`Add a \`hitTest\` factory (precomputed geometry) or an overlay render (\`{ fn, options: { overlay: true } }\`, live simulation) to the renderer for ('${a.geom}', '${r.type}').`}))}return d}function 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||!c.isOverlayHosted(u)||(o.add(a.geom),d.push({kind:"user-input",severity:"warning",code:"CONFLICTING_RENDER_HIT_TEST",message:`Geom '${a.geom}' declares both a \`hitTest\` factory and an overlay render; these are alternatives, so only the overlay is used.`,context:{requested:a.geom,kind:"geom-renderer"},suggestion:"Keep one: a `hitTest` factory for precomputed geometry, OR an overlay render (`{ fn, options: { overlay: true } }`) for a live simulation."}))}return d}function 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 a of s){if(a.interactive===!1||a.spatialKind==="render-hit-test"||o.has(a.geom))continue;const u=t(a.geom,r.type);u===null||!c.isOverlayHosted(u)||(o.add(a.geom),d.push({kind:"user-input",severity:"warning",code:"OVERLAY_REQUIRES_RENDER_HIT_TEST",message:`Geom '${a.geom}' declares an overlay render but its layer's spatialKind is '${a.spatialKind}', not 'render-hit-test'; the overlay's push-path hover resolves to nothing.`,context:{requested:a.geom,kind:"geom-renderer"},suggestion:"Have the geom's manifest yield spatialKind 'render-hit-test' so the compiled layer carries the `byKey` index the overlay's `pushHover` resolves against."}))}return d}var ke=e=>(0,K.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:m,onWarnings:v})=>{const x=c.useLatestRef(u),j=c.useLatestRef(m),q=c.useLatestRef(v),[{session:f,compileBus:h}]=(0,l.useState)(()=>{const n=(0,p.createCompiler)({plugins:o});return{session:new p.GraphCompilationSession(n),compileBus:fe(n)}}),[g]=(0,l.useState)(()=>Ee(o??[])),S=(0,l.useRef)(null),[k]=(0,l.useState)(je),T=(0,l.useRef)(null),b=(0,l.useCallback)(n=>g.errors.length===0?n:[...g.errors,...n??[]],[g]),_=(0,l.useCallback)(n=>{if(!n.ok)return n.errors;if(T.current)T.current.getState().setCompiled(n.compiled);else{const y=ke(n.compiled);y.subscribe(k.notify),T.current=y,k.notify()}return null},[k]),[D,w]=(0,l.useState)(()=>{const n=f.compile({input:e,data:t,customPalettes:r,colorScheme:s});return S.current=n,b(_(n))}),G=(0,l.useCallback)(n=>n.ok?[...n.warnings,...Ce(n.compiled,d),...xe(n.compiled,d),...Te(n.compiled),...Re(n.compiled,d),...Ge(n.compiled,d),...qe(n.compiled,a)]:n.warnings,[d,a]),E=(0,l.useCallback)(n=>{n.length!==0&&(L(n),j.current?.(n))},[j]),R=(0,l.useCallback)(n=>{n.length!==0&&(L(n),q.current?.(n))},[q]);(0,l.useEffect)(()=>{const n=S.current;n&&(E([...g.errors,...n.ok?[]:n.errors]),R([...g.warnings,...G(n)]),n.ok&&h.emit({kind:"init"}))},[h,E,R,g,G]),(0,l.useEffect)(()=>{const n=f.update({input:e,data:t,customPalettes:r,colorScheme:s});if(!n)return;n.sealedInput&&x.current?.(n.sealedInput);const y=_(n.result);w(b(y)),y&&E(y),R(G(n.result)),y||h.emit({kind:n.inputChanged?"input":"data"})},[e,t,r,s,f,h,_,E,R,b,G,x]);const N=(0,l.useCallback)(n=>{w(y=>y===null?y:b(null)),R(G(n))},[b,R,G]),I=(0,l.useCallback)(n=>{n.compiled&&T.current?.getState().setCompiled(n.compiled),n.result&&N(n.result),n.command&&h.emit({kind:"command",command:n.command}),n.input&&x.current?.(n.input),n.errors&&E([...n.errors])},[N,h,x,E]),C=(0,l.useCallback)(n=>{for(const y of n)I(y);return n.some(y=>!!y.compiled)},[I]),M=(0,l.useCallback)((n,y)=>{C(f.applyCommand(n,y))},[f,C]),re=(0,l.useCallback)(()=>{C(f.seal())},[f,C]),O=(0,l.useCallback)(()=>C(f.undo()),[f,C]),A=(0,l.useCallback)(()=>C(f.redo()),[f,C]),se=(0,l.useMemo)(()=>({stack:f.history,undo:O,redo:A}),[f,O,A]),ne=(0,l.useCallback)(()=>T.current?.getState().compiled??null,[]);return{store:T.current,dispatch:M,seal:re,history:se,subscribe:k.subscribe,getCompiled:ne,compileBus:h,compileErrors:D}},je=()=>{const e=new Set;return{subscribe:t=>(e.add(t),()=>{e.delete(t)}),notify:()=>e.forEach(t=>t())}},_e={},Z=({data:e,input:t,plugins:r=[],formattingLocale:s,handleRef:o,onChange:d,onError:a,onWarnings:u,customPalettes:m,colorScheme:v="light",themeOverrides:x=_e,children:j})=>{const[q]=(0,l.useState)(()=>c.createGeomRendererResolver(r.filter(Q))),f=(0,l.useId)(),[h]=(0,l.useState)(()=>(0,p.createAnchorResolver)(r)),[g]=(0,l.useState)(()=>he()),{store:S,dispatch:k,seal:T,history:b,subscribe:_,getCompiled:D,compileBus:w,compileErrors:G}=Ne({input:t,data:e,customPalettes:m,colorScheme:v,plugins:r,resolveRenderer:q,anchorResolver:h,onChange:d,onError:a,onWarnings:u});(0,l.useEffect)(()=>{if(S)return S.subscribe((N,I)=>{if(N.compiled.spec===I.compiled.spec)return;const{selection:C,setSelection:M}=g.getState();C.length!==0&&M(J(C,N.compiled.spec))})},[S,g]);const E=(0,l.useMemo)(()=>({dispatch:k,seal:T}),[k,T]);(0,l.useImperativeHandle)(o,()=>({commands:E,undo:b.undo,redo:b.redo,subscribe:_,getCompiled:D,getSelection:()=>g.getState().selection,setSelection:N=>g.getState().setSelection(N),subscribeSelection:g.subscribe}),[E,b,_,D,g]);const R=(0,l.useMemo)(()=>S?{chartId:f,store:S,selectionStore:g,commands:E,history:b,formattingLocale:s,compileBus:w,colorScheme:v,themeOverrides:x,anchorResolver:h}:null,[f,S,g,E,b,s,w,v,x,h]);return(0,i.jsx)(X,{forcedErrors:G,onError:a,resetKeys:[t,e],children:R?(0,i.jsx)(c.GraphContext.Provider,{value:R,children:(0,i.jsx)(c.GeomRendererResolverProvider,{value:q,children:j})}):null})};function we(e){const t=(0,p.createGraphyBuilder)(e);return{...t,GraphProvider:s=>(0,i.jsx)(Z,{...s,plugins:t.plugins})}}var De=({children:e,...t})=>(0,i.jsx)("svg",{viewBox:"0 0 1 1",preserveAspectRatio:"none",width:"100%",height:"100%",pointerEvents:"none",...t,children:e}),Ie=({box:e,children:t})=>(0,i.jsx)("svg",{x:(0,p.toPercent)(e.x0),y:(0,p.toPercent)(e.y0),width:(0,p.toPercent)(e.x1-e.x0),height:(0,p.toPercent)(e.y1-e.y0),overflow:"hidden",pointerEvents:"none",children:t}),He="drqe3u0",Me="drqe3u1",Pe="drqe3u2",$e="drqe3u3",H="drqe3u4",Le="drqe3u5",Be="drqe3u6",Ke="drqe3u7",P="drqe3u8",Oe="drqe3u9",Ae="drqe3ua";var Ue="drqe3uc",Ye="drqe3ud",Fe="drqe3ue",Ve="drqe3uf";var We="drqe3uh",ze="drqe3ui",V={enabled:"drqe3uk drqe3uj",disabled:"drqe3ul drqe3uj"},W={ran:"drqe3un drqe3um",dim:"drqe3uo drqe3um"},ee={ran:"drqe3uq drqe3up",cached:"drqe3ur drqe3up",untouched:"drqe3us drqe3up"},Xe=({width:e=380,style:t,className:r}={})=>{const{compileBus:s}=c.useGraphContext(),[o]=(0,l.useState)(()=>ve()),[d,a]=(0,l.useState)(!1),[u,m]=(0,l.useState)(p.isCompilerCachingEnabled);(0,l.useEffect)(()=>{const{recordCompile:h}=o.getState(),g=s.getLastTrigger(),S=s.getLastCompile();return g&&S&&h(g,S),s.subscribe(h)},[o,s]);const v=(0,U.useStore)(o,h=>h.lastCompile),x=(0,U.useStore)(o,h=>h.history),j=s.getCacheStats(),q=v===null&&x.length===0,f=()=>{m(h=>{const g=!h;return(0,p.setCompilerCachingEnabled)(g),g})};return(0,i.jsxs)("div",{className:(0,$.default)(Ae,r),style:{width:e,...t},children:[(0,i.jsxs)("div",{className:He,children:[(0,i.jsxs)("div",{children:[(0,i.jsx)("div",{className:Me,children:"compile cache"}),(0,i.jsx)("div",{className:Fe,children:q?"production: stats disabled":v?`last: ${v.label} · ${te(v.durationMs)}`:"awaiting first compile…"})]}),(0,i.jsx)("button",{type:"button",onClick:()=>a(h=>!h),className:Ve,children:d?"▾":"▴"})]}),!d&&(0,i.jsxs)("div",{className:"drqe3ub",children:[(0,i.jsxs)("button",{type:"button",onClick:f,className:u?V.enabled:V.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)(Qe,{delta:v?.stages,cumulative:j}),(0,i.jsx)(Je,{entries:x})]})]})},Qe=({delta:e,cumulative:t})=>(0,i.jsxs)("table",{className:Pe,children:[(0,i.jsx)("thead",{children:(0,i.jsxs)("tr",{className:We,children:[(0,i.jsx)("th",{className:$e,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:p.COMPILER_STAGE_KEYS.map(r=>{const s=e?.[r],o=Ze(s);return(0,i.jsxs)("tr",{className:Ue,children:[(0,i.jsxs)("td",{className:Le,children:[(0,i.jsx)("span",{className:ee[o],"aria-hidden":!0})," ",r]}),(0,i.jsx)("td",{className:o==="ran"?W.ran:W.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)})})]}),Je=({entries:e})=>e.length===0?null:(0,i.jsxs)("div",{className:Ye,children:[(0,i.jsx)("div",{className:ze,children:"recent compiles"}),e.map(t=>{const r=et(t.stages,d=>d.misses>0),s=p.COMPILER_STAGE_KEYS.length,o=r===0?"cached":"ran";return(0,i.jsxs)("div",{className:Be,children:[(0,i.jsx)("span",{className:ee[o],"aria-hidden":!0}),(0,i.jsx)("span",{className:Ke,title:t.label,children:t.label}),(0,i.jsxs)("span",{className:Oe,children:[r,"/",s," ran · ",te(t.durationMs)]})]},t.id)})]}),Ze=e=>!e||e.hits===0&&e.misses===0?"untouched":e.misses>0?"ran":"cached",et=(e,t)=>{let r=0;for(const s of p.COMPILER_STAGE_KEYS)t(e[s])&&(r+=1);return r},te=e=>e>=10?`${e.toFixed(0)}ms`:`${e.toFixed(2)}ms`,tt=()=>{const{history:e}=c.useGraphContext(),{stack:t,undo:r,redo:s}=e,o=(0,l.useCallback)(u=>t.subscribe(u),[t]),d=(0,l.useCallback)(()=>t.getSnapshot(),[t]),a=(0,l.useSyncExternalStore)(o,d,d);return(0,l.useMemo)(()=>({...a,undo:r,redo:s}),[a,r,s])},rt=new Set(["button","checkbox","color","file","hidden","image","radio","range","reset","submit"]),st=(e,t={})=>{const{target:r,enabled:s=!0}=t;(0,l.useEffect)(()=>{const o=nt(r);if(!s||!o)return;const d=a=>{if(!ot(a)||a.defaultPrevented||it(a.target))return;const u=c.resolveHistoryStep(a);if(!u)return;const m=e.current;m&&(u==="undo"?m.undo():m.redo())&&a.preventDefault()};return o.addEventListener("keydown",d),()=>o.removeEventListener("keydown",d)},[e,r,s])},nt=e=>e===void 0?window:e!==null&&"current"in e?e.current:e,ot=e=>"key"in e,it=e=>e instanceof HTMLInputElement?!rt.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=Xe;exports.GraphErrorBoundary=X;exports.GraphErrorPanel=B;exports.GraphProvider=Z;exports.GraphRenderer=c.GraphRenderer;exports.HoverProvider=c.HoverProvider;exports.TextMeasurerProvider=c.TextMeasurerProvider;exports.ThemeProvider=c.ThemeProvider;exports.UnitBoxSvg=Ie;exports.UnitSpaceSvg=De;exports.createGraphyKit=we;exports.darkTheme=c.darkTheme;exports.defineGeomRenderer=c.defineGeomRenderer;exports.lightTheme=c.lightTheme;exports.lightenCss=c.lightenCss;exports.pruneSelection=J;exports.resolveBrandMarkVisual=c.resolveBrandMarkVisual;exports.useCompiledSelector=c.useCompiledSelector;exports.useElementScreenRect=c.useElementScreenRect;exports.useGeomHitTest=c.useGeomHitTest;exports.useGeomHover=c.useGeomHover;exports.useGraphCommands=c.useGraphCommands;exports.useGraphHandle=c.useGraphHandle;exports.useGraphHistory=tt;exports.useGraphHistoryShortcuts=st;exports.useGraphSelection=c.useGraphSelection;exports.useHandleCompiled=c.useHandleCompiled;exports.useHoverState=c.useHoverState;exports.useStyleReaders=c.useStyleReaders;exports.useTextMeasurer=c.useTextMeasurer;exports.vars=z.vars;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('./index.css');const c=require("./history-chords-B-YJjTsb.cjs"),z=require("./dev.utils-LKbf3pnu.cjs");let p=require("@graphysdk/viz-engine"),l=require("react"),i=require("react/jsx-runtime"),U=require("zustand"),K=require("zustand/vanilla"),$=require("clsx");$=c.__toESM($,1);function L(e){for(const t of e)(t.severity==="error"?console.error:console.warn)(`[graphy] ${t.code}: ${t.message}`,t)}var oe="_1a5iqpb0",ie="_1a5iqpb1";var ae="_1a5iqpb3",ce="_1a5iqpb4",le="_1a5iqpb5";var B=({errors:e})=>{const[t,...r]=e;return(0,i.jsxs)("div",{role:"alert",className:oe,children:[(0,i.jsx)("strong",{className:ie,children:"This chart could not be rendered."}),t&&(0,i.jsx)(Y,{diagnostic:t}),r.length>0&&(0,i.jsx)("ul",{className:"_1a5iqpb2",children:r.map((s,o)=>(0,i.jsx)("li",{children:(0,i.jsx)(Y,{diagnostic:s})},`${s.code}-${o}`))})]})},Y=({diagnostic:e})=>(0,i.jsxs)("div",{className:ae,children:[(0,i.jsx)("span",{className:ce,children:e.code}),(0,i.jsx)("p",{className:le,children:e.message}),e.suggestion&&(0,i.jsx)("p",{className:"_1a5iqpb6",children:e.suggestion})]});function de(e=[],t=[]){return e.length===t.length&&e.every((r,s)=>Object.is(r,t[s]))}var X=class extends l.Component{constructor(...e){super(...e),this.state={caughtDiagnostic:null}}static getDerivedStateFromError(e){return{caughtDiagnostic:(0,p.buildDiagnostic)(e)}}componentDidCatch(e,t){const r=(0,p.buildDiagnostic)(e);L([r]),this.props.onError?.([r]),console.error("Chart render component stack:",t.componentStack)}componentDidUpdate(e){this.state.caughtDiagnostic&&!de(e.resetKeys,this.props.resetKeys)&&this.setState({caughtDiagnostic:null})}render(){const{caughtDiagnostic:e}=this.state;if(e)return(0,i.jsx)(B,{errors:[e]});const{forcedErrors:t,children:r}=this.props;return t&&t.length>0?(0,i.jsx)(B,{errors:t}):r}},Q=e=>typeof e=="object"&&"geom"in e&&"render"in e,ue=e=>{const t=(0,p.resolveDefinition)(e);return t instanceof p.Geom?t:null},J=(e,t)=>{const r=e.filter(s=>me(s,t));return r.length===e.length?e:r},me=(e,t)=>e.kind!=="annotation"?!0:(0,p.findAnnotation)(t.annotations,e.id)!==null,F=[],he=()=>(0,K.createStore)(e=>({selection:F,setSelection:t=>e(r=>ge(r.selection,t)?r:{selection:t}),clearSelection:()=>e(t=>t.selection.length===0?t:{selection:F})})),ge=(e,t)=>e===t?!0:e.length!==t.length?!1:e.every((r,s)=>{const o=t[s];return o!==void 0&&(0,p.areEditTargetsEqual)(r,o)}),pe=5,fe=e=>{if(!z.IS_DEV)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,K.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(Q),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 m=ue(u);m===null||r.has(m.type)||o.has(m.type)||(o.add(m.type),s.push({kind:"user-input",severity:"error",code:"MISSING_GEOM_RENDERER",message:`Custom geom '${m.type}' is registered but has no renderer.`,context:{requested:m.type,kind:"geom-renderer"},suggestion:`Add a render half for it: \`defineGeomRenderer(${m.type}Geom, { coord, render })\`, then include it in \`plugins\`.`}))}const d=new Map;for(const u of t){if("definition"in u)continue;const m=`${u.geom}|${u.coord}`,v=d.get(m);v?v.count+=1:d.set(m,{geom:u.geom,coord:u.coord,count:1})}const a=[];for(const{geom:u,coord:m,count:v}of d.values())v<2||a.push({kind:"user-input",severity:"warning",code:"DUPLICATE_REGISTERED_TYPE",message:`Multiple render-only overrides register ('${u}', '${m}') (${v} entries); the last in the array wins.`,context:{requested:`${u}@${m}`,kind:"geom-renderer"},suggestion:`Keep a single render-only override for ('${u}', '${m}').`});return{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||c.isOverlayHosted(u)||(o.add(a.geom),d.push({kind:"user-input",severity:"warning",code:"MISSING_RENDER_HIT_TEST",message:`Geom '${a.geom}' declares spatialKind 'render-hit-test' but its renderer provides no hit-test; the layer has no hover.`,context:{requested:a.geom,kind:"geom-renderer"},suggestion:`Add a \`hitTest\` factory (precomputed geometry) or an overlay render (\`{ fn, options: { overlay: true } }\`, live simulation) to the renderer for ('${a.geom}', '${r.type}').`}))}return d}function 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||!c.isOverlayHosted(u)||(o.add(a.geom),d.push({kind:"user-input",severity:"warning",code:"CONFLICTING_RENDER_HIT_TEST",message:`Geom '${a.geom}' declares both a \`hitTest\` factory and an overlay render; these are alternatives, so only the overlay is used.`,context:{requested:a.geom,kind:"geom-renderer"},suggestion:"Keep one: a `hitTest` factory for precomputed geometry, OR an overlay render (`{ fn, options: { overlay: true } }`) for a live simulation."}))}return d}function 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 a of s){if(a.interactive===!1||a.spatialKind==="render-hit-test"||o.has(a.geom))continue;const u=t(a.geom,r.type);u===null||!c.isOverlayHosted(u)||(o.add(a.geom),d.push({kind:"user-input",severity:"warning",code:"OVERLAY_REQUIRES_RENDER_HIT_TEST",message:`Geom '${a.geom}' declares an overlay render but its layer's spatialKind is '${a.spatialKind}', not 'render-hit-test'; the overlay's push-path hover resolves to nothing.`,context:{requested:a.geom,kind:"geom-renderer"},suggestion:"Have the geom's manifest yield spatialKind 'render-hit-test' so the compiled layer carries the `byKey` index the overlay's `pushHover` resolves against."}))}return d}var ke=e=>(0,K.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:m,onWarnings:v})=>{const x=c.useLatestRef(u),j=c.useLatestRef(m),q=c.useLatestRef(v),[{session:f,compileBus:h}]=(0,l.useState)(()=>{const n=(0,p.createCompiler)({plugins:o});return{session:new p.GraphCompilationSession(n),compileBus:fe(n)}}),[g]=(0,l.useState)(()=>Ee(o??[])),S=(0,l.useRef)(null),[k]=(0,l.useState)(je),T=(0,l.useRef)(null),b=(0,l.useCallback)(n=>g.errors.length===0?n:[...g.errors,...n??[]],[g]),_=(0,l.useCallback)(n=>{if(!n.ok)return n.errors;if(T.current)T.current.getState().setCompiled(n.compiled);else{const y=ke(n.compiled);y.subscribe(k.notify),T.current=y,k.notify()}return null},[k]),[D,w]=(0,l.useState)(()=>{const n=f.compile({input:e,data:t,customPalettes:r,colorScheme:s});return S.current=n,b(_(n))}),G=(0,l.useCallback)(n=>n.ok?[...n.warnings,...Ce(n.compiled,d),...xe(n.compiled,d),...Te(n.compiled),...Re(n.compiled,d),...Ge(n.compiled,d),...qe(n.compiled,a)]:n.warnings,[d,a]),E=(0,l.useCallback)(n=>{n.length!==0&&(L(n),j.current?.(n))},[j]),R=(0,l.useCallback)(n=>{n.length!==0&&(L(n),q.current?.(n))},[q]);(0,l.useEffect)(()=>{const n=S.current;n&&(E([...g.errors,...n.ok?[]:n.errors]),R([...g.warnings,...G(n)]),n.ok&&h.emit({kind:"init"}))},[h,E,R,g,G]),(0,l.useEffect)(()=>{const n=f.update({input:e,data:t,customPalettes:r,colorScheme:s});if(!n)return;n.sealedInput&&x.current?.(n.sealedInput);const y=_(n.result);w(b(y)),y&&E(y),R(G(n.result)),y||h.emit({kind:n.inputChanged?"input":"data"})},[e,t,r,s,f,h,_,E,R,b,G,x]);const N=(0,l.useCallback)(n=>{w(y=>y===null?y:b(null)),R(G(n))},[b,R,G]),I=(0,l.useCallback)(n=>{n.compiled&&T.current?.getState().setCompiled(n.compiled),n.result&&N(n.result),n.command&&h.emit({kind:"command",command:n.command}),n.input&&x.current?.(n.input),n.errors&&E([...n.errors])},[N,h,x,E]),C=(0,l.useCallback)(n=>{for(const y of n)I(y);return n.some(y=>!!y.compiled)},[I]),M=(0,l.useCallback)((n,y)=>{C(f.applyCommand(n,y))},[f,C]),re=(0,l.useCallback)(()=>{C(f.seal())},[f,C]),O=(0,l.useCallback)(()=>C(f.undo()),[f,C]),A=(0,l.useCallback)(()=>C(f.redo()),[f,C]),se=(0,l.useMemo)(()=>({stack:f.history,undo:O,redo:A}),[f,O,A]),ne=(0,l.useCallback)(()=>T.current?.getState().compiled??null,[]);return{store:T.current,dispatch:M,seal:re,history:se,subscribe:k.subscribe,getCompiled:ne,compileBus:h,compileErrors:D}},je=()=>{const e=new Set;return{subscribe:t=>(e.add(t),()=>{e.delete(t)}),notify:()=>e.forEach(t=>t())}},_e={},Z=({data:e,input:t,plugins:r=[],formattingLocale:s,handleRef:o,onChange:d,onError:a,onWarnings:u,customPalettes:m,colorScheme:v="light",themeOverrides:x=_e,children:j})=>{const[q]=(0,l.useState)(()=>c.createGeomRendererResolver(r.filter(Q))),f=(0,l.useId)(),[h]=(0,l.useState)(()=>(0,p.createAnchorResolver)(r)),[g]=(0,l.useState)(()=>he()),{store:S,dispatch:k,seal:T,history:b,subscribe:_,getCompiled:D,compileBus:w,compileErrors:G}=Ne({input:t,data:e,customPalettes:m,colorScheme:v,plugins:r,resolveRenderer:q,anchorResolver:h,onChange:d,onError:a,onWarnings:u});(0,l.useEffect)(()=>{if(S)return S.subscribe((N,I)=>{if(N.compiled.spec===I.compiled.spec)return;const{selection:C,setSelection:M}=g.getState();C.length!==0&&M(J(C,N.compiled.spec))})},[S,g]);const E=(0,l.useMemo)(()=>({dispatch:k,seal:T}),[k,T]);(0,l.useImperativeHandle)(o,()=>({commands:E,undo:b.undo,redo:b.redo,subscribe:_,getCompiled:D,getSelection:()=>g.getState().selection,setSelection:N=>g.getState().setSelection(N),subscribeSelection:g.subscribe}),[E,b,_,D,g]);const R=(0,l.useMemo)(()=>S?{chartId:f,store:S,selectionStore:g,commands:E,history:b,formattingLocale:s,compileBus:w,colorScheme:v,themeOverrides:x,anchorResolver:h}:null,[f,S,g,E,b,s,w,v,x,h]);return(0,i.jsx)(X,{forcedErrors:G,onError:a,resetKeys:[t,e],children:R?(0,i.jsx)(c.GraphContext.Provider,{value:R,children:(0,i.jsx)(c.GeomRendererResolverProvider,{value:q,children:j})}):null})};function we(e){const t=(0,p.createGraphyBuilder)(e);return{...t,GraphProvider:s=>(0,i.jsx)(Z,{...s,plugins:t.plugins})}}var De=({children:e,...t})=>(0,i.jsx)("svg",{viewBox:"0 0 1 1",preserveAspectRatio:"none",width:"100%",height:"100%",pointerEvents:"none",...t,children:e}),Ie=({box:e,children:t})=>(0,i.jsx)("svg",{x:(0,p.toPercent)(e.x0),y:(0,p.toPercent)(e.y0),width:(0,p.toPercent)(e.x1-e.x0),height:(0,p.toPercent)(e.y1-e.y0),overflow:"hidden",pointerEvents:"none",children:t}),He="drqe3u0",Me="drqe3u1",Pe="drqe3u2",$e="drqe3u3",H="drqe3u4",Le="drqe3u5",Be="drqe3u6",Ke="drqe3u7",P="drqe3u8",Oe="drqe3u9",Ae="drqe3ua";var Ue="drqe3uc",Ye="drqe3ud",Fe="drqe3ue",Ve="drqe3uf";var We="drqe3uh",ze="drqe3ui",V={enabled:"drqe3uk drqe3uj",disabled:"drqe3ul drqe3uj"},W={ran:"drqe3un drqe3um",dim:"drqe3uo drqe3um"},ee={ran:"drqe3uq drqe3up",cached:"drqe3ur drqe3up",untouched:"drqe3us drqe3up"},Xe=({width:e=380,style:t,className:r}={})=>{const{compileBus:s}=c.useGraphContext(),[o]=(0,l.useState)(()=>ve()),[d,a]=(0,l.useState)(!1),[u,m]=(0,l.useState)(p.isCompilerCachingEnabled);(0,l.useEffect)(()=>{const{recordCompile:h}=o.getState(),g=s.getLastTrigger(),S=s.getLastCompile();return g&&S&&h(g,S),s.subscribe(h)},[o,s]);const v=(0,U.useStore)(o,h=>h.lastCompile),x=(0,U.useStore)(o,h=>h.history),j=s.getCacheStats(),q=v===null&&x.length===0,f=()=>{m(h=>{const g=!h;return(0,p.setCompilerCachingEnabled)(g),g})};return(0,i.jsxs)("div",{className:(0,$.default)(Ae,r),style:{width:e,...t},children:[(0,i.jsxs)("div",{className:He,children:[(0,i.jsxs)("div",{children:[(0,i.jsx)("div",{className:Me,children:"compile cache"}),(0,i.jsx)("div",{className:Fe,children:q?"production: stats disabled":v?`last: ${v.label} · ${te(v.durationMs)}`:"awaiting first compile…"})]}),(0,i.jsx)("button",{type:"button",onClick:()=>a(h=>!h),className:Ve,children:d?"▾":"▴"})]}),!d&&(0,i.jsxs)("div",{className:"drqe3ub",children:[(0,i.jsxs)("button",{type:"button",onClick:f,className:u?V.enabled:V.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)(Qe,{delta:v?.stages,cumulative:j}),(0,i.jsx)(Je,{entries:x})]})]})},Qe=({delta:e,cumulative:t})=>(0,i.jsxs)("table",{className:Pe,children:[(0,i.jsx)("thead",{children:(0,i.jsxs)("tr",{className:We,children:[(0,i.jsx)("th",{className:$e,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:p.COMPILER_STAGE_KEYS.map(r=>{const s=e?.[r],o=Ze(s);return(0,i.jsxs)("tr",{className:Ue,children:[(0,i.jsxs)("td",{className:Le,children:[(0,i.jsx)("span",{className:ee[o],"aria-hidden":!0})," ",r]}),(0,i.jsx)("td",{className:o==="ran"?W.ran:W.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)})})]}),Je=({entries:e})=>e.length===0?null:(0,i.jsxs)("div",{className:Ye,children:[(0,i.jsx)("div",{className:ze,children:"recent compiles"}),e.map(t=>{const r=et(t.stages,d=>d.misses>0),s=p.COMPILER_STAGE_KEYS.length,o=r===0?"cached":"ran";return(0,i.jsxs)("div",{className:Be,children:[(0,i.jsx)("span",{className:ee[o],"aria-hidden":!0}),(0,i.jsx)("span",{className:Ke,title:t.label,children:t.label}),(0,i.jsxs)("span",{className:Oe,children:[r,"/",s," ran · ",te(t.durationMs)]})]},t.id)})]}),Ze=e=>!e||e.hits===0&&e.misses===0?"untouched":e.misses>0?"ran":"cached",et=(e,t)=>{let r=0;for(const s of p.COMPILER_STAGE_KEYS)t(e[s])&&(r+=1);return r},te=e=>e>=10?`${e.toFixed(0)}ms`:`${e.toFixed(2)}ms`,tt=()=>{const{history:e}=c.useGraphContext(),{stack:t,undo:r,redo:s}=e,o=(0,l.useCallback)(u=>t.subscribe(u),[t]),d=(0,l.useCallback)(()=>t.getSnapshot(),[t]),a=(0,l.useSyncExternalStore)(o,d,d);return(0,l.useMemo)(()=>({...a,undo:r,redo:s}),[a,r,s])},rt=new Set(["button","checkbox","color","file","hidden","image","radio","range","reset","submit"]),st=(e,t={})=>{const{target:r,enabled:s=!0}=t;(0,l.useEffect)(()=>{const o=nt(r);if(!s||!o)return;const d=a=>{if(!ot(a)||a.defaultPrevented||it(a.target))return;const u=c.resolveHistoryStep(a);if(!u)return;const m=e.current;m&&(u==="undo"?m.undo():m.redo())&&a.preventDefault()};return o.addEventListener("keydown",d),()=>o.removeEventListener("keydown",d)},[e,r,s])},nt=e=>e===void 0?window:e!==null&&"current"in e?e.current:e,ot=e=>"key"in e,it=e=>e instanceof HTMLInputElement?!rt.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=Xe;exports.GraphErrorBoundary=X;exports.GraphErrorPanel=B;exports.GraphProvider=Z;exports.GraphRenderer=c.GraphRenderer;exports.HoverProvider=c.HoverProvider;exports.TextMeasurerProvider=c.TextMeasurerProvider;exports.ThemeProvider=c.ThemeProvider;exports.UnitBoxSvg=Ie;exports.UnitSpaceSvg=De;exports.createGraphyKit=we;exports.darkTheme=c.darkTheme;exports.defineGeomRenderer=c.defineGeomRenderer;exports.lightTheme=c.lightTheme;exports.lightenCss=c.lightenCss;exports.pruneSelection=J;exports.resolveBrandMarkVisual=c.resolveBrandMarkVisual;exports.useCompiledSelector=c.useCompiledSelector;exports.useElementScreenRect=c.useElementScreenRect;exports.useGeomHitTest=c.useGeomHitTest;exports.useGeomHover=c.useGeomHover;exports.useGraphCommands=c.useGraphCommands;exports.useGraphHandle=c.useGraphHandle;exports.useGraphHistory=tt;exports.useGraphHistoryShortcuts=st;exports.useGraphSelection=c.useGraphSelection;exports.useHandleCompiled=c.useHandleCompiled;exports.useHoverState=c.useHoverState;exports.useStyleReaders=c.useStyleReaders;exports.useTextMeasurer=c.useTextMeasurer;exports.vars=z.vars;
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
- import { Ct as It, Ft as re, M as Dt, Mt as $t, Nt as xt, O as Ht, Pt as de, St as le, Tt as Mt, X as Pt, Y as Lt, _ as Bt, _t as ue, a as Kt, bt as me, ct as Ot, gt as K, i as At, it as jt, j as Yt, jt as Ft, k as Ut, lt as Wt, mt as Vt, n as Xt, pt as Qt, r as zt, rt as Jt, s as Zt, t as ge, tt as er, vt as tr, wt as rr, xt as nr, yt as j } from "./history-chords-DEguzjPn.js";
2
- import { f as or, t as he } from "./dev.utils-HBVa4Fj9.js";
1
+ import { Ct as It, Ft as re, M as Dt, Mt as $t, Nt as xt, O as Ht, Pt as de, St as le, Tt as Mt, X as Pt, Y as Lt, _ as Bt, _t as ue, a as Kt, bt as me, ct as Ot, gt as K, i as At, it as jt, j as Yt, jt as Ft, k as Ut, lt as Wt, mt as Vt, n as Xt, pt as Qt, r as zt, rt as Jt, s as Zt, t as ge, tt as er, vt as tr, wt as rr, xt as nr, yt as j } from "./history-chords-CbCsZGB2.js";
2
+ import { f as or, t as he } from "./dev.utils-E7Ho6zQ7.js";
3
3
  import { COMPILER_STAGE_KEYS as Y, Geom as pe, GraphCompilationSession as fe, areEditTargetsEqual as ve, buildDiagnostic as V, createAnchorResolver as ye, createCompiler as Se, createGraphyBuilder as be, findAnnotation as Ee, isCompilerCachingEnabled as Te, resolveDefinition as Ce, setCompilerCachingEnabled as Ne, toPercent as M } from "@graphysdk/viz-engine";
4
4
  import { Component as Re, useCallback as f, useEffect as $, useId as qe, useImperativeHandle as we, useMemo as L, useRef as X, useState as C, useSyncExternalStore as Ge } from "react";
5
5
  import { Fragment as _e, jsx as d, jsxs as v } from "react/jsx-runtime";
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "visualization",
12
12
  "renderer"
13
13
  ],
14
- "version": "1.9.0-beta.1788780809119",
14
+ "version": "1.9.0-beta.1788781002318",
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.1788780809119"
58
+ "@graphysdk/viz-engine": "1.9.0-beta.1788781002318"
59
59
  },
60
60
  "peerDependencies": {
61
61
  "@tiptap/core": "^3.0.0",
package/dist/dev.css DELETED
@@ -1 +0,0 @@
1
-
@@ -1,2 +0,0 @@
1
- require('./dev.css');let l=require("@graphysdk/viz-engine");var s=["canvasDefault","canvasBlue","canvasCyan","canvasGreen","canvasYellow","canvasOrange","canvasRed","canvasPink","canvasPurple","canvasGray","canvasInverse"],e={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)",gridLineColor:"var(--graphy-grid-line-color)",axisTickColor:"var(--graphy-axis-tick-color)",originLineColor:"var(--graphy-origin-line-color)",legendBackground:"var(--graphy-legend-background)",legendBorderColor:"var(--graphy-legend-border-color)",legendFocusOutlineColor:"var(--graphy-legend-focus-outline-color)",legendTextColor:"var(--graphy-legend-text-color)",annotationFrameBorderColor:"var(--graphy-annotation-frame-border-color)",editMenuTriggerIconColor:"var(--graphy-edit-menu-trigger-icon-color)",heatmapEmptyTileBackground:"var(--graphy-heatmap-empty-tile-background)",gridLineWidth:"var(--graphy-grid-line-width)",tooltipBorderRadius:"var(--graphy-tooltip-border-radius)",tooltipPaddingBlock:"var(--graphy-tooltip-padding-block)",tooltipPaddingInline:"var(--graphy-tooltip-padding-inline)",tooltipRowGap:"var(--graphy-tooltip-row-gap)",tooltipShadow:"var(--graphy-tooltip-shadow)",editorControlHeight:"var(--graphy-editor-control-height)",legendSwatchGap:"var(--graphy-legend-swatch-gap)",legendPillPaddingInline:"var(--graphy-legend-pill-padding-inline)",legendPillPaddingBlock:"var(--graphy-legend-pill-padding-block)",legendPillBorderWidth:"var(--graphy-legend-pill-border-width)",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)",tooltipBackground:"var(--graphy-tooltip-background)",tooltipBorderColor:"var(--graphy-tooltip-border-color)",tooltipValueTextColor:"var(--graphy-tooltip-value-text-color)",hoverGuideLineColor:"var(--graphy-hover-guide-line-color)",hoverGuideFillColor:"var(--graphy-hover-guide-fill-color)",fontFamilyDefault:"var(--graphy-font-family-default)",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)",fontLegendLabel:"var(--graphy-font-legend-label)",fontSeriesLabel:"var(--graphy-font-series-label)",fontPieLabel:"var(--graphy-font-pie-label)",fontPieChartTotal:"var(--graphy-font-pie-chart-total)",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)"},v=`var(--typography-chart-font-family, ${e.fontFamilyDefault})`,y=`"Stack Sans Text", 'Inter', -apple-system, BlinkMacSystemFont, 'Open Sans', 'Segoe UI', 'Roboto', 'Oxygen-Sans', 'Ubuntu',
2
- 'Cantarell', 'Helvetica Neue', 'NotoSansArabic', 'NotoSansJP', 'NotoSansSC', 'NotoSansKR', 'NotoSerifKR', sans-serif, 'Apple Color Emoji', 'NotoColorEmoji'`,c=y,d={regular:l.NAMED_WEIGHTS.regular,medium:l.NAMED_WEIGHTS.medium,semibold:l.NAMED_WEIGHTS.semiBold,bold:l.NAMED_WEIGHTS.bold,extraBold:l.NAMED_WEIGHTS.extraBold},a={xxs:1,xs:1.1,sm:1.2,md:1.4,lg:1.6,xl:2,editorBody:1.5,headingSm:1.8,headingMd:2.2,headingLg:2.8},o={xxs:1,xs:1,sm:1.3,md:1.43,lg:1,xl:1,editorBody:1.47,headingSm:1.25,headingMd:1.41,headingLg:1.29},f={fontLegendLabel:{weight:"fontWeightMedium",size:"fontSizeSm",lineHeight:"fontLineHeightSm"}},u=v,p=`var(--typography-chart-heading-font-family, ${e.fontFamilyHeading})`,S=i=>i in f,m=(i,r)=>{const g=f[i],h=t(r.weight?.toString()??e[g.weight],r.size===void 0?e[g.size]:`${r.size.value}${r.size.unit}`,r.lineHeight?.toString()??e[g.lineHeight],r.family??u);return r.style===void 0||r.style==="normal"?h:`${r.style} ${h}`},n=i=>`${i}em`,b={textScale:"1",fontFamilyDefault:y,fontFamilyHeading:c,fontWeightRegular:d.regular.toString(),fontWeightMedium:d.medium.toString(),fontWeightSemibold:d.semibold.toString(),fontWeightBold:d.bold.toString(),fontWeightExtraBold:d.extraBold.toString(),fontSizeXxs:n(a.xxs),fontSizeXs:n(a.xs),fontSizeSm:n(a.sm),fontSizeMd:n(a.md),fontSizeLg:n(a.lg),fontSizeXl:n(a.xl),fontLineHeightXxs:o.xxs.toString(),fontLineHeightXs:o.xs.toString(),fontLineHeightSm:o.sm.toString(),fontLineHeightMd:o.md.toString(),fontLineHeightLg:o.lg.toString(),fontLineHeightXl:o.xl.toString()},L={fontSizeEditorBody:n(a.editorBody),fontSizeHeadingSm:n(a.headingSm),fontSizeHeadingMd:n(a.headingMd),fontSizeHeadingLg:n(a.headingLg),fontLineHeightEditorBody:o.editorBody.toString(),fontLineHeightHeadingSm:o.headingSm.toString(),fontLineHeightHeadingMd:o.headingMd.toString(),fontLineHeightHeadingLg:o.headingLg.toString()},t=(i,r,g,h=u)=>`${i} ${r}/${g} ${h}`,H=({weight:i,size:r,lineHeight:g})=>t(e[i],e[r],e[g]),M={fontLegendLabel:H(f.fontLegendLabel),fontSeriesLabel:t(e.fontWeightSemibold,e.fontSizeSm,e.fontLineHeightSm),fontUITooltip:t(e.fontWeightMedium,e.fontSizeMd,e.fontLineHeightMd),fontUITooltipSecondary:t(e.fontWeightMedium,e.fontSizeSm,e.fontLineHeightSm),fontPieLabel:t(e.fontWeightMedium,e.fontSizeXs,e.fontLineHeightXs),fontPieChartTotal:t(e.fontWeightBold,e.fontSizeHeadingLg,e.fontLineHeightHeadingLg),fontButton:t(e.fontWeightMedium,e.fontSizeMd,e.fontLineHeightMd),fontInput:t(e.fontWeightMedium,e.fontSizeMd,e.fontLineHeightMd),fontInputLabel:t(e.fontWeightMedium,e.fontSizeXxs,e.fontLineHeightXxs),fontSelectLabel:t(e.fontWeightMedium,e.fontSizeMd,e.fontLineHeightMd),fontSelectDescription:t(e.fontWeightMedium,e.fontSizeSm,e.fontLineHeightSm),fontColorSelectLabel:t(e.fontWeightMedium,e.fontSizeSm,e.fontLineHeightSm),fontMenuTitle:t(e.fontWeightSemibold,e.fontSizeMd,e.fontLineHeightMd),fontMenuGroupTitle:t(e.fontWeightMedium,e.fontSizeSm,e.fontLineHeightSm),fontMenuItemLabel:t(e.fontWeightMedium,e.fontSizeMd,e.fontLineHeightMd),fontMenuItemLabelSecondary:t(e.fontWeightMedium,e.fontSizeSm,e.fontLineHeightSm),fontErrorBoundaryTitle:t(e.fontWeightSemibold,e.fontSizeHeadingSm,e.fontLineHeightHeadingSm),fontErrorBoundaryMessage:t(e.fontWeightMedium,e.fontSizeMd,e.fontLineHeightMd),fontTableCell:t(e.fontWeightMedium,e.fontSizeMd,e.fontLineHeightMd),fontTableHeaderCell:t(e.fontWeightSemibold,e.fontSizeSm,e.fontLineHeightSm),fontSourceLabel:t(e.fontWeightMedium,e.fontSizeSm,e.fontLineHeightSm),fontSourceLink:t(e.fontWeightRegular,e.fontSizeSm,e.fontLineHeightSm),fontTextEditorH1:t(e.fontWeightBold,e.fontSizeHeadingLg,e.fontLineHeightHeadingLg,p),fontTextEditorH2:t(e.fontWeightBold,e.fontSizeHeadingMd,e.fontLineHeightHeadingMd,p),fontTextEditorH3:t(e.fontWeightSemibold,e.fontSizeHeadingSm,e.fontLineHeightHeadingSm,p),fontTextEditorH6:t(e.fontWeightMedium,e.fontSizeSm,e.fontLineHeightSm),fontTextEditorBody:t(e.fontWeightMedium,e.fontSizeEditorBody,e.fontLineHeightEditorBody),fontTextEditorLink:t(e.fontWeightRegular,e.fontSizeMd,e.fontLineHeightMd),fontHighlightModeTitle:t(e.fontWeightBold,e.fontSizeMd,e.fontLineHeightMd),fontHighlightModeSubtitle:t(e.fontWeightMedium,e.fontSizeSm,e.fontLineHeightSm),fontEditorControlLabel:t(e.fontWeightMedium,e.fontSizeSm,e.fontLineHeightSm),fontEditorControlValue:t(e.fontWeightMedium,e.fontSizeSm,e.fontLineHeightSm),fontEditorSectionTitle:t(e.fontWeightSemibold,e.fontSizeSm,e.fontLineHeightSm),fontEditorCaption:t(e.fontWeightMedium,e.fontSizeXxs,e.fontLineHeightXxs)},x=process.env.NODE_ENV!=="production";Object.defineProperty(exports,"CANVAS_COLOR_KEYS",{enumerable:!0,get:function(){return s}});Object.defineProperty(exports,"CHART_FONT_FAMILY",{enumerable:!0,get:function(){return v}});Object.defineProperty(exports,"DEFAULT_FONT_FAMILY",{enumerable:!0,get:function(){return y}});Object.defineProperty(exports,"FONT_LINE_HEIGHT",{enumerable:!0,get:function(){return o}});Object.defineProperty(exports,"IS_DEV",{enumerable:!0,get:function(){return x}});Object.defineProperty(exports,"MEASURED_ELEMENT_FONT_DEFINITIONS",{enumerable:!0,get:function(){return f}});Object.defineProperty(exports,"baseTypographyTokens",{enumerable:!0,get:function(){return b}});Object.defineProperty(exports,"buildFontShorthand",{enumerable:!0,get:function(){return m}});Object.defineProperty(exports,"elementTypographyTokens",{enumerable:!0,get:function(){return M}});Object.defineProperty(exports,"isMeasuredFontTokenKey",{enumerable:!0,get:function(){return S}});Object.defineProperty(exports,"semanticTypographyTokens",{enumerable:!0,get:function(){return L}});Object.defineProperty(exports,"vars",{enumerable:!0,get:function(){return e}});