@graphysdk/react-renderer 1.8.1-beta.1786446230102 → 1.8.1-beta.1786548285802
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/editable.cjs +1 -1
- package/dist/editable.d.ts +16 -4
- package/dist/editable.mjs +1 -1
- package/dist/history-chords-BgYclR70.cjs +1 -0
- package/dist/{history-chords-ClsfSt3J.js → history-chords-ac4BYzSp.js} +2332 -2320
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +17 -5
- package/dist/index.mjs +1 -1
- package/package.json +4 -2
- package/dist/history-chords-DyVxXLaG.cjs +0 -1
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('./index.css');const l=require("./history-chords-DyVxXLaG.cjs"),se=require("./font-values-CStAZ2d1.cjs");let y=require("@graphysdk/viz-engine"),c=require("react"),i=require("react/jsx-runtime"),Y=require("zustand"),K=require("zustand/vanilla"),P=require("clsx");P=l.__toESM(P,1);function L(e){for(const r of e)(r.severity==="error"?console.error:console.warn)(`[graphy] ${r.code}: ${r.message}`,r)}var ne="_1a5iqpb0",oe="_1a5iqpb1";var ie="_1a5iqpb3",ae="_1a5iqpb4",ce="_1a5iqpb5";var O=({errors:e})=>{const[r,...t]=e;return(0,i.jsxs)("div",{role:"alert",className:ne,children:[(0,i.jsx)("strong",{className:oe,children:"This chart could not be rendered."}),r&&(0,i.jsx)(U,{diagnostic:r}),t.length>0&&(0,i.jsx)("ul",{className:"_1a5iqpb2",children:t.map((s,n)=>(0,i.jsx)("li",{children:(0,i.jsx)(U,{diagnostic:s})},`${s.code}-${n}`))})]})},U=({diagnostic:e})=>(0,i.jsxs)("div",{className:ie,children:[(0,i.jsx)("span",{className:ae,children:e.code}),(0,i.jsx)("p",{className:ce,children:e.message}),e.suggestion&&(0,i.jsx)("p",{className:"_1a5iqpb6",children:e.suggestion})]});function le(e=[],r=[]){return e.length===r.length&&e.every((t,s)=>Object.is(t,r[s]))}var z=class extends c.Component{constructor(...e){super(...e),this.state={caughtDiagnostic:null}}static getDerivedStateFromError(e){return{caughtDiagnostic:(0,y.buildDiagnostic)(e)}}componentDidCatch(e,r){const t=(0,y.buildDiagnostic)(e);L([t]),this.props.onError?.([t]),console.error("Chart render component stack:",r.componentStack)}componentDidUpdate(e){this.state.caughtDiagnostic&&!le(e.resetKeys,this.props.resetKeys)&&this.setState({caughtDiagnostic:null})}render(){const{caughtDiagnostic:e}=this.state;if(e)return(0,i.jsx)(O,{errors:[e]});const{forcedErrors:r,children:t}=this.props;return r&&r.length>0?(0,i.jsx)(O,{errors:r}):t}},X=e=>typeof e=="object"&&"geom"in e&&"render"in e,de=e=>{const r=(0,y.resolveDefinition)(e);return r instanceof y.Geom?r:null},Q=(e,r)=>{const t=e.filter(s=>ue(s,r));return t.length===e.length?e:t},ue=(e,r)=>e.kind!=="annotation"?!0:(0,y.findAnnotation)(r.annotations,e.id)!==null,F=[],me=()=>(0,K.createStore)(e=>({selection:F,setSelection:r=>e(t=>he(t.selection,r)?t:{selection:r}),clearSelection:()=>e(r=>r.selection.length===0?r:{selection:F})})),he=(e,r)=>e===r?!0:e.length!==r.length?!1:e.every((t,s)=>{const n=r[s];return n!==void 0&&(0,y.areEditTargetsEqual)(t,n)}),ge=5,pe=e=>{if(process.env.NODE_ENV==="production")return{emit:()=>{},subscribe:()=>ve,getLastTrigger:()=>null,getLastCompile:()=>null,getCacheStats:()=>e.getCacheStats()};const r=new Set;let t=null;return{emit:s=>{const n=e.getLastCompile();if(n){t=s;for(const u of r)u(s,n)}},subscribe:s=>(r.add(s),()=>{r.delete(s)}),getLastTrigger:()=>t,getLastCompile:()=>e.getLastCompile(),getCacheStats:()=>e.getCacheStats()}},fe=()=>(0,K.createStore)(e=>({lastCompile:null,history:[],nextId:1,lastSnapshot:null,recordCompile:(r,t)=>e(s=>{if(s.lastSnapshot===t)return s;const n={id:s.nextId,label:ye(r),stages:t.stages,durationMs:t.durationMs};return{lastCompile:n,history:Se(s.history,n,ge),nextId:s.nextId+1,lastSnapshot:t}})})),ve=()=>{},ye=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}},Se=(e,r,t)=>{const s=e.length>=t?e.length-(t-1):0;return[...e.slice(s),r]};function be(e){const r=e.filter(X),t=new Set([...Object.keys(l.BUILT_IN_GEOM_RENDERERS),...r.map(d=>d.geom)]),s=[],n=new Set;for(const d of e){const m=de(d);m===null||t.has(m.type)||n.has(m.type)||(n.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 u=new Map;for(const d of r){if("definition"in d)continue;const m=`${d.geom}|${d.coord}`,g=u.get(m);g?g.count+=1:u.set(m,{geom:d.geom,coord:d.coord,count:1})}const a=[];for(const{geom:d,coord:m,count:g}of u.values())g<2||a.push({kind:"user-input",severity:"warning",code:"DUPLICATE_REGISTERED_TYPE",message:`Multiple render-only overrides register ('${d}', '${m}') (${g} entries); the last in the array wins.`,context:{requested:`${d}@${m}`,kind:"geom-renderer"},suggestion:`Keep a single render-only override for ('${d}', '${m}').`});return{errors:s,warnings:a}}function Ee(e,r){const{coordSystem:t,layers:s}=e,n=new Set,u=[];for(const a of s)r(a.geom,t.type)!==null||n.has(a.geom)||(n.add(a.geom),u.push({kind:"user-input",severity:"warning",code:"MISSING_GEOM_RENDERER",message:`No renderer for geom '${a.geom}' under ${t.type} coords; the layer is not painted.`,context:{requested:a.geom,kind:"geom-renderer"},suggestion:`Register a renderer for ('${a.geom}', '${t.type}') via \`defineGeomRenderer\`.`}));return u}function Ce(e,r){const{coordSystem:t,layers:s}=e,n=new Set,u=[];for(const a of s){if(a.interactive===!1||a.spatialKind!=="render-hit-test"||n.has(a.geom))continue;const d=r(a.geom,t.type);d===null||d.hitTest||l.isOverlayHosted(d)||(n.add(a.geom),u.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}', '${t.type}').`}))}return u}function xe(e){const r=new Set,t=[];for(const s of e.layers){const n=s.identityKey;s.interactive!==!1&&(s.spatialKind!=="render-hit-test"||typeof n!="object"||r.has(s.geom)||s.data.hasVariable(n.variable)||(r.add(s.geom),t.push({kind:"user-input",severity:"warning",code:"RENDER_HIT_TEST_IDENTITY",message:`Geom '${s.geom}' keys its identity on '${n.variable}', a column its compile output does not emit; its hover lookup is empty.`,context:{requested:s.geom,kind:"geom-renderer"},suggestion:`Emit the '${n.variable}' column from the geom's \`compile()\`, or point \`identityKey\` at a column it does emit.`})))}return t}function Te(e,r){const{coordSystem:t,layers:s}=e,n=new Set,u=[];for(const a of s){if(a.interactive===!1||a.spatialKind!=="render-hit-test"||n.has(a.geom))continue;const d=r(a.geom,t.type);d===null||!d.hitTest||!l.isOverlayHosted(d)||(n.add(a.geom),u.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 u}function Re(e,r){const t=new Set,s=[];for(const n of e.layers)n.interactive!==!1&&(n.spatialKind!=="render-hit-test"||t.has(n.geom)||r.hasCapability(n.geom)||(t.add(n.geom),s.push({kind:"user-input",severity:"warning",code:"MISSING_ANCHOR_CAPABILITY",message:`Geom '${n.geom}' declares no \`resolveAnchorPosition\`; its observations cannot be annotated, so the editor overlay paints no creation trigger on them.`,context:{requested:n.geom,kind:"geom-renderer"},suggestion:"Implement `resolveAnchorPosition(observation, context)` on the geom, returning the normalised panel position an annotation on that observation belongs at."})));return s}function qe(e,r){const{coordSystem:t,layers:s}=e,n=new Set,u=[];for(const a of s){if(a.interactive===!1||a.spatialKind==="render-hit-test"||n.has(a.geom))continue;const d=r(a.geom,t.type);d===null||!l.isOverlayHosted(d)||(n.add(a.geom),u.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 u}var Ge=e=>(0,K.createStore)(r=>({compiled:e,setCompiled:t=>r(s=>s.compiled===t?s:{compiled:t})})),Ne=({input:e,data:r,customPalettes:t,plugins:s,resolveRenderer:n,anchorResolver:u,onChange:a,onError:d,onWarnings:m})=>{const g=l.useLatestRef(a),q=l.useLatestRef(d),j=l.useLatestRef(m),[{session:p,compileBus:b}]=(0,c.useState)(()=>{const o=(0,y.createCompiler)({plugins:s});return{session:new y.GraphCompilationSession(o),compileBus:pe(o)}}),[h]=(0,c.useState)(()=>be(s??[])),f=(0,c.useRef)(null),[S]=(0,c.useState)(ke),x=(0,c.useRef)(null),G=(0,c.useCallback)(o=>h.errors.length===0?o:[...h.errors,...o??[]],[h]),T=(0,c.useCallback)(o=>{if(!o.ok)return o.errors;if(x.current)x.current.getState().setCompiled(o.compiled);else{const v=Ge(o.compiled);v.subscribe(S.notify),x.current=v,S.notify()}return null},[S]),[I,_]=(0,c.useState)(()=>{const o=p.compile({input:e,data:r,customPalettes:t});return f.current=o,G(T(o))}),R=(0,c.useCallback)(o=>o.ok?[...o.warnings,...Ee(o.compiled,n),...Ce(o.compiled,n),...xe(o.compiled),...Te(o.compiled,n),...qe(o.compiled,n),...Re(o.compiled,u)]:o.warnings,[n,u]),N=(0,c.useCallback)(o=>{o.length!==0&&(L(o),q.current?.(o))},[q]),E=(0,c.useCallback)(o=>{o.length!==0&&(L(o),j.current?.(o))},[j]);(0,c.useEffect)(()=>{const o=f.current;o&&(N([...h.errors,...o.ok?[]:o.errors]),E([...h.warnings,...R(o)]),o.ok&&b.emit({kind:"init"}))},[b,N,E,h,R]),(0,c.useEffect)(()=>{const o=p.update({input:e,data:r,customPalettes:t});if(!o)return;o.sealedInput&&g.current?.(o.sealedInput);const v=T(o.result);_(G(v)),v&&N(v),E(R(o.result)),v||b.emit({kind:o.inputChanged?"input":"data"})},[e,r,t,p,b,T,N,E,G,R,g]);const D=(0,c.useCallback)(o=>{_(v=>v===null?v:G(null)),E(R(o))},[G,E,R]),k=(0,c.useCallback)(o=>{o.compiled&&x.current?.getState().setCompiled(o.compiled),o.result&&D(o.result),o.command&&b.emit({kind:"command",command:o.command}),o.input&&g.current?.(o.input),o.errors&&N([...o.errors])},[D,b,g,N]),C=(0,c.useCallback)(o=>{for(const v of o)k(v);return o.some(v=>!!v.compiled)},[k]),w=(0,c.useCallback)((o,v)=>{C(p.applyCommand(o,v))},[p,C]),M=(0,c.useCallback)(()=>{C(p.seal())},[p,C]),B=(0,c.useCallback)(()=>C(p.undo()),[p,C]),A=(0,c.useCallback)(()=>C(p.redo()),[p,C]),re=(0,c.useMemo)(()=>({stack:p.history,undo:B,redo:A}),[p,B,A]),te=(0,c.useCallback)(()=>x.current?.getState().compiled??null,[]);return{store:x.current,dispatch:w,seal:M,history:re,subscribe:S.subscribe,getCompiled:te,compileBus:b,compileErrors:I}},ke=()=>{const e=new Set;return{subscribe:r=>(e.add(r),()=>{e.delete(r)}),notify:()=>e.forEach(r=>r())}},je={},J=({data:e,input:r,plugins:t=[],formattingLocale:s,handleRef:n,onChange:u,onError:a,onWarnings:d,customPalettes:m,colorScheme:g="light",themeOverrides:q=je,children:j})=>{const[p]=(0,c.useState)(()=>l.createGeomRendererResolver(t.filter(X))),b=(0,c.useId)(),[h]=(0,c.useState)(()=>(0,y.createAnchorResolver)(t)),[f]=(0,c.useState)(()=>me()),{store:S,dispatch:x,seal:G,history:T,subscribe:I,getCompiled:_,compileBus:R,compileErrors:N}=Ne({input:r,data:e,customPalettes:m,plugins:t,resolveRenderer:p,anchorResolver:h,onChange:u,onError:a,onWarnings:d});(0,c.useEffect)(()=>{if(S)return S.subscribe((k,C)=>{if(k.compiled.spec===C.compiled.spec)return;const{selection:w,setSelection:M}=f.getState();w.length!==0&&M(Q(w,k.compiled.spec))})},[S,f]);const E=(0,c.useMemo)(()=>({dispatch:x,seal:G}),[x,G]);(0,c.useImperativeHandle)(n,()=>({commands:E,undo:T.undo,redo:T.redo,subscribe:I,getCompiled:_,getSelection:()=>f.getState().selection,setSelection:k=>f.getState().setSelection(k),subscribeSelection:f.subscribe}),[E,T,I,_,f]);const D=(0,c.useMemo)(()=>S?{chartId:b,store:S,selectionStore:f,commands:E,history:T,formattingLocale:s,compileBus:R,colorScheme:g,themeOverrides:q,anchorResolver:h}:null,[b,S,f,E,T,s,R,g,q,h]);return(0,i.jsx)(z,{forcedErrors:N,onError:a,resetKeys:[r,e],children:D?(0,i.jsx)(l.GraphContext.Provider,{value:D,children:(0,i.jsx)(l.GeomRendererResolverProvider,{value:p,children:j})}):null})};function _e(e){const r=(0,y.createGraphyBuilder)(e);return{...r,GraphProvider:s=>(0,i.jsx)(J,{...s,plugins:r.plugins})}}var De=({children:e,...r})=>(0,i.jsx)("svg",{viewBox:"0 0 1 1",preserveAspectRatio:"none",width:"100%",height:"100%",pointerEvents:"none",...r,children:e}),Ie="drqe3u0",we="drqe3u1",He="drqe3u2",Me="drqe3u3",H="drqe3u4",$e="drqe3u5",Pe="drqe3u6",Le="drqe3u7",$="drqe3u8",Oe="drqe3u9",Ke="drqe3ua";var Be="drqe3uc",Ae="drqe3ud",Ye="drqe3ue",Ue="drqe3uf";var Fe="drqe3uh",Ve="drqe3ui",V={enabled:"drqe3uk drqe3uj",disabled:"drqe3ul drqe3uj"},W={ran:"drqe3un drqe3um",dim:"drqe3uo drqe3um"},Z={ran:"drqe3uq drqe3up",cached:"drqe3ur drqe3up",untouched:"drqe3us drqe3up"},We=({width:e=380,style:r,className:t}={})=>{const{compileBus:s}=l.useGraphContext(),[n]=(0,c.useState)(()=>fe()),[u,a]=(0,c.useState)(!1),[d,m]=(0,c.useState)(y.isCompilerCachingEnabled);(0,c.useEffect)(()=>{const{recordCompile:h}=n.getState(),f=s.getLastTrigger(),S=s.getLastCompile();return f&&S&&h(f,S),s.subscribe(h)},[n,s]);const g=(0,Y.useStore)(n,h=>h.lastCompile),q=(0,Y.useStore)(n,h=>h.history),j=s.getCacheStats(),p=g===null&&q.length===0,b=()=>{m(h=>{const f=!h;return(0,y.setCompilerCachingEnabled)(f),f})};return(0,i.jsxs)("div",{className:(0,P.default)(Ke,t),style:{width:e,...r},children:[(0,i.jsxs)("div",{className:Ie,children:[(0,i.jsxs)("div",{children:[(0,i.jsx)("div",{className:we,children:"compile cache"}),(0,i.jsx)("div",{className:Ye,children:p?"production: stats disabled":g?`last: ${g.label} · ${ee(g.durationMs)}`:"awaiting first compile…"})]}),(0,i.jsx)("button",{type:"button",onClick:()=>a(h=>!h),className:Ue,children:u?"▾":"▴"})]}),!u&&(0,i.jsxs)("div",{className:"drqe3ub",children:[(0,i.jsxs)("button",{type:"button",onClick:b,className:d?V.enabled:V.disabled,"aria-pressed":d,children:["cache ",d?"enabled":"disabled"]}),(0,i.jsx)("span",{className:"drqe3ug",children:"next compile reflects this toggle"})]}),!u&&!p&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(ze,{delta:g?.stages,cumulative:j}),(0,i.jsx)(Xe,{entries:q})]})]})},ze=({delta:e,cumulative:r})=>(0,i.jsxs)("table",{className:He,children:[(0,i.jsx)("thead",{children:(0,i.jsxs)("tr",{className:Fe,children:[(0,i.jsx)("th",{className:Me,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:y.COMPILER_STAGE_KEYS.map(t=>{const s=e?.[t],n=Qe(s);return(0,i.jsxs)("tr",{className:Be,children:[(0,i.jsxs)("td",{className:$e,children:[(0,i.jsx)("span",{className:Z[n],"aria-hidden":!0})," ",t]}),(0,i.jsx)("td",{className:n==="ran"?W.ran:W.dim,children:s?.misses??0}),(0,i.jsx)("td",{className:$,children:s?.hits??0}),(0,i.jsx)("td",{className:$,children:r[t].misses}),(0,i.jsx)("td",{className:$,children:r[t].hits})]},t)})})]}),Xe=({entries:e})=>e.length===0?null:(0,i.jsxs)("div",{className:Ae,children:[(0,i.jsx)("div",{className:Ve,children:"recent compiles"}),e.map(r=>{const t=Je(r.stages,u=>u.misses>0),s=y.COMPILER_STAGE_KEYS.length,n=t===0?"cached":"ran";return(0,i.jsxs)("div",{className:Pe,children:[(0,i.jsx)("span",{className:Z[n],"aria-hidden":!0}),(0,i.jsx)("span",{className:Le,title:r.label,children:r.label}),(0,i.jsxs)("span",{className:Oe,children:[t,"/",s," ran · ",ee(r.durationMs)]})]},r.id)})]}),Qe=e=>!e||e.hits===0&&e.misses===0?"untouched":e.misses>0?"ran":"cached",Je=(e,r)=>{let t=0;for(const s of y.COMPILER_STAGE_KEYS)r(e[s])&&(t+=1);return t},ee=e=>e>=10?`${e.toFixed(0)}ms`:`${e.toFixed(2)}ms`,Ze=()=>{const{history:e}=l.useGraphContext(),{stack:r,undo:t,redo:s}=e,n=(0,c.useCallback)(d=>r.subscribe(d),[r]),u=(0,c.useCallback)(()=>r.getSnapshot(),[r]),a=(0,c.useSyncExternalStore)(n,u,u);return(0,c.useMemo)(()=>({...a,undo:t,redo:s}),[a,t,s])},er=new Set(["button","checkbox","color","file","hidden","image","radio","range","reset","submit"]),rr=(e,r={})=>{const{target:t,enabled:s=!0}=r;(0,c.useEffect)(()=>{const n=tr(t);if(!s||!n)return;const u=a=>{if(!sr(a)||a.defaultPrevented||nr(a.target))return;const d=l.resolveHistoryStep(a);if(!d)return;const m=e.current;m&&(d==="undo"?m.undo():m.redo())&&a.preventDefault()};return n.addEventListener("keydown",u),()=>n.removeEventListener("keydown",u)},[e,t,s])},tr=e=>e===void 0?window:e!==null&&"current"in e?e.current:e,sr=e=>"key"in e,nr=e=>e instanceof HTMLInputElement?!er.has(e.type):e instanceof HTMLElement?e.isContentEditable||e.tagName==="TEXTAREA":!1;exports.BrandMark=l.BrandMark;exports.CanvasTextMeasurer=l.CanvasTextMeasurer;exports.DefaultFooter=l.DefaultFooter;exports.DefaultGrid=l.DefaultGrid;exports.DefaultHeader=l.DefaultHeader;exports.DefaultSwatch=l.DefaultSwatch;exports.DefaultTooltip=l.DefaultTooltip;exports.DevToolsPanel=We;exports.GraphErrorBoundary=z;exports.GraphErrorPanel=O;exports.GraphProvider=J;exports.GraphRenderer=l.GraphRenderer;exports.HoverProvider=l.HoverProvider;exports.TextMeasurerProvider=l.TextMeasurerProvider;exports.ThemeProvider=l.ThemeProvider;exports.UnitSpaceSvg=De;exports.createGraphyKit=_e;exports.darkTheme=l.darkTheme;exports.defineGeomRenderer=l.defineGeomRenderer;exports.lightTheme=l.lightTheme;exports.lightenCss=l.lightenCss;exports.pruneSelection=Q;exports.resolveBrandMarkVisual=l.resolveBrandMarkVisual;exports.useCompiledSelector=l.useCompiledSelector;exports.useElementScreenRect=l.useElementScreenRect;exports.useGeomHitTest=l.useGeomHitTest;exports.useGeomHover=l.useGeomHover;exports.useGraphCommands=l.useGraphCommands;exports.useGraphHandle=l.useGraphHandle;exports.useGraphHistory=Ze;exports.useGraphHistoryShortcuts=rr;exports.useGraphSelection=l.useGraphSelection;exports.useHandleCompiled=l.useHandleCompiled;exports.useHoverState=l.useHoverState;exports.useTextMeasurer=l.useTextMeasurer;exports.vars=se.vars;
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('./index.css');const l=require("./history-chords-BgYclR70.cjs"),se=require("./font-values-CStAZ2d1.cjs");let y=require("@graphysdk/viz-engine"),c=require("react"),i=require("react/jsx-runtime"),Y=require("zustand"),K=require("zustand/vanilla"),P=require("clsx");P=l.__toESM(P,1);function L(e){for(const r of e)(r.severity==="error"?console.error:console.warn)(`[graphy] ${r.code}: ${r.message}`,r)}var ne="_1a5iqpb0",oe="_1a5iqpb1";var ie="_1a5iqpb3",ae="_1a5iqpb4",ce="_1a5iqpb5";var O=({errors:e})=>{const[r,...t]=e;return(0,i.jsxs)("div",{role:"alert",className:ne,children:[(0,i.jsx)("strong",{className:oe,children:"This chart could not be rendered."}),r&&(0,i.jsx)(U,{diagnostic:r}),t.length>0&&(0,i.jsx)("ul",{className:"_1a5iqpb2",children:t.map((s,n)=>(0,i.jsx)("li",{children:(0,i.jsx)(U,{diagnostic:s})},`${s.code}-${n}`))})]})},U=({diagnostic:e})=>(0,i.jsxs)("div",{className:ie,children:[(0,i.jsx)("span",{className:ae,children:e.code}),(0,i.jsx)("p",{className:ce,children:e.message}),e.suggestion&&(0,i.jsx)("p",{className:"_1a5iqpb6",children:e.suggestion})]});function le(e=[],r=[]){return e.length===r.length&&e.every((t,s)=>Object.is(t,r[s]))}var z=class extends c.Component{constructor(...e){super(...e),this.state={caughtDiagnostic:null}}static getDerivedStateFromError(e){return{caughtDiagnostic:(0,y.buildDiagnostic)(e)}}componentDidCatch(e,r){const t=(0,y.buildDiagnostic)(e);L([t]),this.props.onError?.([t]),console.error("Chart render component stack:",r.componentStack)}componentDidUpdate(e){this.state.caughtDiagnostic&&!le(e.resetKeys,this.props.resetKeys)&&this.setState({caughtDiagnostic:null})}render(){const{caughtDiagnostic:e}=this.state;if(e)return(0,i.jsx)(O,{errors:[e]});const{forcedErrors:r,children:t}=this.props;return r&&r.length>0?(0,i.jsx)(O,{errors:r}):t}},X=e=>typeof e=="object"&&"geom"in e&&"render"in e,de=e=>{const r=(0,y.resolveDefinition)(e);return r instanceof y.Geom?r:null},Q=(e,r)=>{const t=e.filter(s=>ue(s,r));return t.length===e.length?e:t},ue=(e,r)=>e.kind!=="annotation"?!0:(0,y.findAnnotation)(r.annotations,e.id)!==null,F=[],me=()=>(0,K.createStore)(e=>({selection:F,setSelection:r=>e(t=>he(t.selection,r)?t:{selection:r}),clearSelection:()=>e(r=>r.selection.length===0?r:{selection:F})})),he=(e,r)=>e===r?!0:e.length!==r.length?!1:e.every((t,s)=>{const n=r[s];return n!==void 0&&(0,y.areEditTargetsEqual)(t,n)}),ge=5,pe=e=>{if(process.env.NODE_ENV==="production")return{emit:()=>{},subscribe:()=>ve,getLastTrigger:()=>null,getLastCompile:()=>null,getCacheStats:()=>e.getCacheStats()};const r=new Set;let t=null;return{emit:s=>{const n=e.getLastCompile();if(n){t=s;for(const u of r)u(s,n)}},subscribe:s=>(r.add(s),()=>{r.delete(s)}),getLastTrigger:()=>t,getLastCompile:()=>e.getLastCompile(),getCacheStats:()=>e.getCacheStats()}},fe=()=>(0,K.createStore)(e=>({lastCompile:null,history:[],nextId:1,lastSnapshot:null,recordCompile:(r,t)=>e(s=>{if(s.lastSnapshot===t)return s;const n={id:s.nextId,label:ye(r),stages:t.stages,durationMs:t.durationMs};return{lastCompile:n,history:Se(s.history,n,ge),nextId:s.nextId+1,lastSnapshot:t}})})),ve=()=>{},ye=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}},Se=(e,r,t)=>{const s=e.length>=t?e.length-(t-1):0;return[...e.slice(s),r]};function be(e){const r=e.filter(X),t=new Set([...Object.keys(l.BUILT_IN_GEOM_RENDERERS),...r.map(d=>d.geom)]),s=[],n=new Set;for(const d of e){const m=de(d);m===null||t.has(m.type)||n.has(m.type)||(n.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 u=new Map;for(const d of r){if("definition"in d)continue;const m=`${d.geom}|${d.coord}`,g=u.get(m);g?g.count+=1:u.set(m,{geom:d.geom,coord:d.coord,count:1})}const a=[];for(const{geom:d,coord:m,count:g}of u.values())g<2||a.push({kind:"user-input",severity:"warning",code:"DUPLICATE_REGISTERED_TYPE",message:`Multiple render-only overrides register ('${d}', '${m}') (${g} entries); the last in the array wins.`,context:{requested:`${d}@${m}`,kind:"geom-renderer"},suggestion:`Keep a single render-only override for ('${d}', '${m}').`});return{errors:s,warnings:a}}function Ee(e,r){const{coordSystem:t,layers:s}=e,n=new Set,u=[];for(const a of s)r(a.geom,t.type)!==null||n.has(a.geom)||(n.add(a.geom),u.push({kind:"user-input",severity:"warning",code:"MISSING_GEOM_RENDERER",message:`No renderer for geom '${a.geom}' under ${t.type} coords; the layer is not painted.`,context:{requested:a.geom,kind:"geom-renderer"},suggestion:`Register a renderer for ('${a.geom}', '${t.type}') via \`defineGeomRenderer\`.`}));return u}function Ce(e,r){const{coordSystem:t,layers:s}=e,n=new Set,u=[];for(const a of s){if(a.interactive===!1||a.spatialKind!=="render-hit-test"||n.has(a.geom))continue;const d=r(a.geom,t.type);d===null||d.hitTest||l.isOverlayHosted(d)||(n.add(a.geom),u.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}', '${t.type}').`}))}return u}function xe(e){const r=new Set,t=[];for(const s of e.layers){const n=s.identityKey;s.interactive!==!1&&(s.spatialKind!=="render-hit-test"||typeof n!="object"||r.has(s.geom)||s.data.hasVariable(n.variable)||(r.add(s.geom),t.push({kind:"user-input",severity:"warning",code:"RENDER_HIT_TEST_IDENTITY",message:`Geom '${s.geom}' keys its identity on '${n.variable}', a column its compile output does not emit; its hover lookup is empty.`,context:{requested:s.geom,kind:"geom-renderer"},suggestion:`Emit the '${n.variable}' column from the geom's \`compile()\`, or point \`identityKey\` at a column it does emit.`})))}return t}function Te(e,r){const{coordSystem:t,layers:s}=e,n=new Set,u=[];for(const a of s){if(a.interactive===!1||a.spatialKind!=="render-hit-test"||n.has(a.geom))continue;const d=r(a.geom,t.type);d===null||!d.hitTest||!l.isOverlayHosted(d)||(n.add(a.geom),u.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 u}function Re(e,r){const t=new Set,s=[];for(const n of e.layers)n.interactive!==!1&&(n.spatialKind!=="render-hit-test"||t.has(n.geom)||r.hasCapability(n.geom)||(t.add(n.geom),s.push({kind:"user-input",severity:"warning",code:"MISSING_ANCHOR_CAPABILITY",message:`Geom '${n.geom}' declares no \`resolveAnchorPosition\`; its observations cannot be annotated, so the editor overlay paints no creation trigger on them.`,context:{requested:n.geom,kind:"geom-renderer"},suggestion:"Implement `resolveAnchorPosition(observation, context)` on the geom, returning the normalised panel position an annotation on that observation belongs at."})));return s}function qe(e,r){const{coordSystem:t,layers:s}=e,n=new Set,u=[];for(const a of s){if(a.interactive===!1||a.spatialKind==="render-hit-test"||n.has(a.geom))continue;const d=r(a.geom,t.type);d===null||!l.isOverlayHosted(d)||(n.add(a.geom),u.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 u}var Ge=e=>(0,K.createStore)(r=>({compiled:e,setCompiled:t=>r(s=>s.compiled===t?s:{compiled:t})})),Ne=({input:e,data:r,customPalettes:t,plugins:s,resolveRenderer:n,anchorResolver:u,onChange:a,onError:d,onWarnings:m})=>{const g=l.useLatestRef(a),q=l.useLatestRef(d),j=l.useLatestRef(m),[{session:p,compileBus:b}]=(0,c.useState)(()=>{const o=(0,y.createCompiler)({plugins:s});return{session:new y.GraphCompilationSession(o),compileBus:pe(o)}}),[h]=(0,c.useState)(()=>be(s??[])),f=(0,c.useRef)(null),[S]=(0,c.useState)(ke),x=(0,c.useRef)(null),G=(0,c.useCallback)(o=>h.errors.length===0?o:[...h.errors,...o??[]],[h]),T=(0,c.useCallback)(o=>{if(!o.ok)return o.errors;if(x.current)x.current.getState().setCompiled(o.compiled);else{const v=Ge(o.compiled);v.subscribe(S.notify),x.current=v,S.notify()}return null},[S]),[I,_]=(0,c.useState)(()=>{const o=p.compile({input:e,data:r,customPalettes:t});return f.current=o,G(T(o))}),R=(0,c.useCallback)(o=>o.ok?[...o.warnings,...Ee(o.compiled,n),...Ce(o.compiled,n),...xe(o.compiled),...Te(o.compiled,n),...qe(o.compiled,n),...Re(o.compiled,u)]:o.warnings,[n,u]),N=(0,c.useCallback)(o=>{o.length!==0&&(L(o),q.current?.(o))},[q]),E=(0,c.useCallback)(o=>{o.length!==0&&(L(o),j.current?.(o))},[j]);(0,c.useEffect)(()=>{const o=f.current;o&&(N([...h.errors,...o.ok?[]:o.errors]),E([...h.warnings,...R(o)]),o.ok&&b.emit({kind:"init"}))},[b,N,E,h,R]),(0,c.useEffect)(()=>{const o=p.update({input:e,data:r,customPalettes:t});if(!o)return;o.sealedInput&&g.current?.(o.sealedInput);const v=T(o.result);_(G(v)),v&&N(v),E(R(o.result)),v||b.emit({kind:o.inputChanged?"input":"data"})},[e,r,t,p,b,T,N,E,G,R,g]);const D=(0,c.useCallback)(o=>{_(v=>v===null?v:G(null)),E(R(o))},[G,E,R]),k=(0,c.useCallback)(o=>{o.compiled&&x.current?.getState().setCompiled(o.compiled),o.result&&D(o.result),o.command&&b.emit({kind:"command",command:o.command}),o.input&&g.current?.(o.input),o.errors&&N([...o.errors])},[D,b,g,N]),C=(0,c.useCallback)(o=>{for(const v of o)k(v);return o.some(v=>!!v.compiled)},[k]),w=(0,c.useCallback)((o,v)=>{C(p.applyCommand(o,v))},[p,C]),M=(0,c.useCallback)(()=>{C(p.seal())},[p,C]),B=(0,c.useCallback)(()=>C(p.undo()),[p,C]),A=(0,c.useCallback)(()=>C(p.redo()),[p,C]),re=(0,c.useMemo)(()=>({stack:p.history,undo:B,redo:A}),[p,B,A]),te=(0,c.useCallback)(()=>x.current?.getState().compiled??null,[]);return{store:x.current,dispatch:w,seal:M,history:re,subscribe:S.subscribe,getCompiled:te,compileBus:b,compileErrors:I}},ke=()=>{const e=new Set;return{subscribe:r=>(e.add(r),()=>{e.delete(r)}),notify:()=>e.forEach(r=>r())}},je={},J=({data:e,input:r,plugins:t=[],formattingLocale:s,handleRef:n,onChange:u,onError:a,onWarnings:d,customPalettes:m,colorScheme:g="light",themeOverrides:q=je,children:j})=>{const[p]=(0,c.useState)(()=>l.createGeomRendererResolver(t.filter(X))),b=(0,c.useId)(),[h]=(0,c.useState)(()=>(0,y.createAnchorResolver)(t)),[f]=(0,c.useState)(()=>me()),{store:S,dispatch:x,seal:G,history:T,subscribe:I,getCompiled:_,compileBus:R,compileErrors:N}=Ne({input:r,data:e,customPalettes:m,plugins:t,resolveRenderer:p,anchorResolver:h,onChange:u,onError:a,onWarnings:d});(0,c.useEffect)(()=>{if(S)return S.subscribe((k,C)=>{if(k.compiled.spec===C.compiled.spec)return;const{selection:w,setSelection:M}=f.getState();w.length!==0&&M(Q(w,k.compiled.spec))})},[S,f]);const E=(0,c.useMemo)(()=>({dispatch:x,seal:G}),[x,G]);(0,c.useImperativeHandle)(n,()=>({commands:E,undo:T.undo,redo:T.redo,subscribe:I,getCompiled:_,getSelection:()=>f.getState().selection,setSelection:k=>f.getState().setSelection(k),subscribeSelection:f.subscribe}),[E,T,I,_,f]);const D=(0,c.useMemo)(()=>S?{chartId:b,store:S,selectionStore:f,commands:E,history:T,formattingLocale:s,compileBus:R,colorScheme:g,themeOverrides:q,anchorResolver:h}:null,[b,S,f,E,T,s,R,g,q,h]);return(0,i.jsx)(z,{forcedErrors:N,onError:a,resetKeys:[r,e],children:D?(0,i.jsx)(l.GraphContext.Provider,{value:D,children:(0,i.jsx)(l.GeomRendererResolverProvider,{value:p,children:j})}):null})};function _e(e){const r=(0,y.createGraphyBuilder)(e);return{...r,GraphProvider:s=>(0,i.jsx)(J,{...s,plugins:r.plugins})}}var De=({children:e,...r})=>(0,i.jsx)("svg",{viewBox:"0 0 1 1",preserveAspectRatio:"none",width:"100%",height:"100%",pointerEvents:"none",...r,children:e}),Ie="drqe3u0",we="drqe3u1",He="drqe3u2",Me="drqe3u3",H="drqe3u4",$e="drqe3u5",Pe="drqe3u6",Le="drqe3u7",$="drqe3u8",Oe="drqe3u9",Ke="drqe3ua";var Be="drqe3uc",Ae="drqe3ud",Ye="drqe3ue",Ue="drqe3uf";var Fe="drqe3uh",Ve="drqe3ui",V={enabled:"drqe3uk drqe3uj",disabled:"drqe3ul drqe3uj"},W={ran:"drqe3un drqe3um",dim:"drqe3uo drqe3um"},Z={ran:"drqe3uq drqe3up",cached:"drqe3ur drqe3up",untouched:"drqe3us drqe3up"},We=({width:e=380,style:r,className:t}={})=>{const{compileBus:s}=l.useGraphContext(),[n]=(0,c.useState)(()=>fe()),[u,a]=(0,c.useState)(!1),[d,m]=(0,c.useState)(y.isCompilerCachingEnabled);(0,c.useEffect)(()=>{const{recordCompile:h}=n.getState(),f=s.getLastTrigger(),S=s.getLastCompile();return f&&S&&h(f,S),s.subscribe(h)},[n,s]);const g=(0,Y.useStore)(n,h=>h.lastCompile),q=(0,Y.useStore)(n,h=>h.history),j=s.getCacheStats(),p=g===null&&q.length===0,b=()=>{m(h=>{const f=!h;return(0,y.setCompilerCachingEnabled)(f),f})};return(0,i.jsxs)("div",{className:(0,P.default)(Ke,t),style:{width:e,...r},children:[(0,i.jsxs)("div",{className:Ie,children:[(0,i.jsxs)("div",{children:[(0,i.jsx)("div",{className:we,children:"compile cache"}),(0,i.jsx)("div",{className:Ye,children:p?"production: stats disabled":g?`last: ${g.label} · ${ee(g.durationMs)}`:"awaiting first compile…"})]}),(0,i.jsx)("button",{type:"button",onClick:()=>a(h=>!h),className:Ue,children:u?"▾":"▴"})]}),!u&&(0,i.jsxs)("div",{className:"drqe3ub",children:[(0,i.jsxs)("button",{type:"button",onClick:b,className:d?V.enabled:V.disabled,"aria-pressed":d,children:["cache ",d?"enabled":"disabled"]}),(0,i.jsx)("span",{className:"drqe3ug",children:"next compile reflects this toggle"})]}),!u&&!p&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(ze,{delta:g?.stages,cumulative:j}),(0,i.jsx)(Xe,{entries:q})]})]})},ze=({delta:e,cumulative:r})=>(0,i.jsxs)("table",{className:He,children:[(0,i.jsx)("thead",{children:(0,i.jsxs)("tr",{className:Fe,children:[(0,i.jsx)("th",{className:Me,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:y.COMPILER_STAGE_KEYS.map(t=>{const s=e?.[t],n=Qe(s);return(0,i.jsxs)("tr",{className:Be,children:[(0,i.jsxs)("td",{className:$e,children:[(0,i.jsx)("span",{className:Z[n],"aria-hidden":!0})," ",t]}),(0,i.jsx)("td",{className:n==="ran"?W.ran:W.dim,children:s?.misses??0}),(0,i.jsx)("td",{className:$,children:s?.hits??0}),(0,i.jsx)("td",{className:$,children:r[t].misses}),(0,i.jsx)("td",{className:$,children:r[t].hits})]},t)})})]}),Xe=({entries:e})=>e.length===0?null:(0,i.jsxs)("div",{className:Ae,children:[(0,i.jsx)("div",{className:Ve,children:"recent compiles"}),e.map(r=>{const t=Je(r.stages,u=>u.misses>0),s=y.COMPILER_STAGE_KEYS.length,n=t===0?"cached":"ran";return(0,i.jsxs)("div",{className:Pe,children:[(0,i.jsx)("span",{className:Z[n],"aria-hidden":!0}),(0,i.jsx)("span",{className:Le,title:r.label,children:r.label}),(0,i.jsxs)("span",{className:Oe,children:[t,"/",s," ran · ",ee(r.durationMs)]})]},r.id)})]}),Qe=e=>!e||e.hits===0&&e.misses===0?"untouched":e.misses>0?"ran":"cached",Je=(e,r)=>{let t=0;for(const s of y.COMPILER_STAGE_KEYS)r(e[s])&&(t+=1);return t},ee=e=>e>=10?`${e.toFixed(0)}ms`:`${e.toFixed(2)}ms`,Ze=()=>{const{history:e}=l.useGraphContext(),{stack:r,undo:t,redo:s}=e,n=(0,c.useCallback)(d=>r.subscribe(d),[r]),u=(0,c.useCallback)(()=>r.getSnapshot(),[r]),a=(0,c.useSyncExternalStore)(n,u,u);return(0,c.useMemo)(()=>({...a,undo:t,redo:s}),[a,t,s])},er=new Set(["button","checkbox","color","file","hidden","image","radio","range","reset","submit"]),rr=(e,r={})=>{const{target:t,enabled:s=!0}=r;(0,c.useEffect)(()=>{const n=tr(t);if(!s||!n)return;const u=a=>{if(!sr(a)||a.defaultPrevented||nr(a.target))return;const d=l.resolveHistoryStep(a);if(!d)return;const m=e.current;m&&(d==="undo"?m.undo():m.redo())&&a.preventDefault()};return n.addEventListener("keydown",u),()=>n.removeEventListener("keydown",u)},[e,t,s])},tr=e=>e===void 0?window:e!==null&&"current"in e?e.current:e,sr=e=>"key"in e,nr=e=>e instanceof HTMLInputElement?!er.has(e.type):e instanceof HTMLElement?e.isContentEditable||e.tagName==="TEXTAREA":!1;exports.BrandMark=l.BrandMark;exports.CanvasTextMeasurer=l.CanvasTextMeasurer;exports.DefaultFooter=l.DefaultFooter;exports.DefaultGrid=l.DefaultGrid;exports.DefaultHeader=l.DefaultHeader;exports.DefaultSwatch=l.DefaultSwatch;exports.DefaultTooltip=l.DefaultTooltip;exports.DevToolsPanel=We;exports.GraphErrorBoundary=z;exports.GraphErrorPanel=O;exports.GraphProvider=J;exports.GraphRenderer=l.GraphRenderer;exports.HoverProvider=l.HoverProvider;exports.TextMeasurerProvider=l.TextMeasurerProvider;exports.ThemeProvider=l.ThemeProvider;exports.UnitSpaceSvg=De;exports.createGraphyKit=_e;exports.darkTheme=l.darkTheme;exports.defineGeomRenderer=l.defineGeomRenderer;exports.lightTheme=l.lightTheme;exports.lightenCss=l.lightenCss;exports.pruneSelection=Q;exports.resolveBrandMarkVisual=l.resolveBrandMarkVisual;exports.useCompiledSelector=l.useCompiledSelector;exports.useElementScreenRect=l.useElementScreenRect;exports.useGeomHitTest=l.useGeomHitTest;exports.useGeomHover=l.useGeomHover;exports.useGraphCommands=l.useGraphCommands;exports.useGraphHandle=l.useGraphHandle;exports.useGraphHistory=Ze;exports.useGraphHistoryShortcuts=rr;exports.useGraphSelection=l.useGraphSelection;exports.useHandleCompiled=l.useHandleCompiled;exports.useHoverState=l.useHoverState;exports.useTextMeasurer=l.useTextMeasurer;exports.vars=se.vars;
|
package/dist/index.d.ts
CHANGED
|
@@ -416,7 +416,7 @@ export declare type GeomRenderFn<G extends GeomName | string = string, C extends
|
|
|
416
416
|
declare interface GeomRenderInput<G extends GeomName | string = string, C extends CoordKind = CoordKind> {
|
|
417
417
|
layer: CompiledLayerOf<G>;
|
|
418
418
|
coordSystem: CoordSystemFor<C>;
|
|
419
|
-
|
|
419
|
+
shouldAnimateTransitions: boolean;
|
|
420
420
|
formattingLocale: Locale;
|
|
421
421
|
intro?: LayerIntroPlan | null;
|
|
422
422
|
}
|
|
@@ -434,12 +434,21 @@ export declare interface GeomRenderOptions {
|
|
|
434
434
|
overlay: true;
|
|
435
435
|
}
|
|
436
436
|
|
|
437
|
+
/**
|
|
438
|
+
* Animation settings for a graph. `false` disables every animation. A viewer who prefers reduced
|
|
439
|
+
* motion gets no animation whatever this asks for.
|
|
440
|
+
*/
|
|
441
|
+
export declare type GraphAnimation = boolean | GraphAnimationProps;
|
|
442
|
+
|
|
443
|
+
/** Per-kind animation settings. Each kind is independent: turning one off leaves the other running. */
|
|
437
444
|
export declare interface GraphAnimationProps {
|
|
438
445
|
/**
|
|
439
|
-
* Settings for the intro animation played
|
|
440
|
-
* an object overrides individual intro settings. Defaults on.
|
|
446
|
+
* Settings for the intro animation played when the chart first mounts or the chart type changes.
|
|
447
|
+
* `false` disables it, an object overrides individual intro settings. Defaults on.
|
|
441
448
|
*/
|
|
442
449
|
intro?: boolean | Partial<IntroAnimationOptions>;
|
|
450
|
+
/** Whether geoms animate to their new position when the underlying data changes. Defaults on. */
|
|
451
|
+
transitions?: boolean;
|
|
443
452
|
}
|
|
444
453
|
|
|
445
454
|
/** Write access to the graph's spec: applying {@link Command}s and closing the runs they form. */
|
|
@@ -611,8 +620,11 @@ export declare interface GraphRendererProps {
|
|
|
611
620
|
sizing?: GraphSizing;
|
|
612
621
|
/** Callback invoked when the graph's container is resized. Fires in every sizing mode. */
|
|
613
622
|
onResize?: ResizeObserverOnResize;
|
|
614
|
-
|
|
615
|
-
|
|
623
|
+
/**
|
|
624
|
+
* Animation settings. A boolean disables/enables animations globally, an object tunes the intro
|
|
625
|
+
* and data transitions separately. A reduced-motion preference disables everything regardless.
|
|
626
|
+
*/
|
|
627
|
+
animation?: GraphAnimation;
|
|
616
628
|
showTooltips?: boolean;
|
|
617
629
|
mode?: GraphMode;
|
|
618
630
|
/** Per-region component overrides. Unspecified regions render their default. */
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as wt, A as _t, C as kt, E as It, F as Dt, G as ae, H as ce, J as $t, K as Ht, O as xt, P as Mt, R as Pt, S as Lt, T as Kt, U as Ot, V as K, W as A, X as Bt, Y as At, _ as Yt, a as jt, g as Ft, i as Ut, j as Wt, n as Vt, nt as de, o as Xt, q as le, r as zt, rt as te, t as ue, tt as Jt, w as Qt, z as Zt } from "./history-chords-
|
|
1
|
+
import { $ as wt, A as _t, C as kt, E as It, F as Dt, G as ae, H as ce, J as $t, K as Ht, O as xt, P as Mt, R as Pt, S as Lt, T as Kt, U as Ot, V as K, W as A, X as Bt, Y as At, _ as Yt, a as jt, g as Ft, i as Ut, j as Wt, n as Vt, nt as de, o as Xt, q as le, r as zt, rt as te, t as ue, tt as Jt, w as Qt, z as Zt } from "./history-chords-ac4BYzSp.js";
|
|
2
2
|
import { g as tr } from "./font-values-CPxYeqns.js";
|
|
3
3
|
import { COMPILER_STAGE_KEYS as Y, Geom as me, GraphCompilationSession as ge, areEditTargetsEqual as he, buildDiagnostic as W, createAnchorResolver as pe, createCompiler as fe, createGraphyBuilder as ve, findAnnotation as ye, isCompilerCachingEnabled as be, resolveDefinition as Se, setCompilerCachingEnabled as Ee } from "@graphysdk/viz-engine";
|
|
4
4
|
import { Component as Te, useCallback as f, useEffect as $, useId as Ce, useImperativeHandle as Ne, useMemo as P, useRef as V, useState as T, useSyncExternalStore as Re } from "react";
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"visualization",
|
|
12
12
|
"renderer"
|
|
13
13
|
],
|
|
14
|
-
"version": "1.8.1-beta.
|
|
14
|
+
"version": "1.8.1-beta.1786548285802",
|
|
15
15
|
"type": "module",
|
|
16
16
|
"sideEffects": [
|
|
17
17
|
"**/*.css.ts",
|
|
@@ -44,11 +44,12 @@
|
|
|
44
44
|
"clsx": "^2.1.1",
|
|
45
45
|
"color2k": "^2.0.3",
|
|
46
46
|
"d3-interpolate-path": "^2.3.0",
|
|
47
|
+
"lodash-es": "^4.18.1",
|
|
47
48
|
"motion": "^12.23.12",
|
|
48
49
|
"react-colorful": "^5.6.1",
|
|
49
50
|
"react-intl": "^8.1.3",
|
|
50
51
|
"zustand": "^5.0.12",
|
|
51
|
-
"@graphysdk/viz-engine": "1.8.1-beta.
|
|
52
|
+
"@graphysdk/viz-engine": "1.8.1-beta.1786548285802"
|
|
52
53
|
},
|
|
53
54
|
"peerDependencies": {
|
|
54
55
|
"@tiptap/core": "^3.0.0",
|
|
@@ -89,6 +90,7 @@
|
|
|
89
90
|
"@tiptap/pm": "^3.0.0",
|
|
90
91
|
"@tiptap/react": "^3.0.0",
|
|
91
92
|
"@types/d3-interpolate-path": "^2.0.3",
|
|
93
|
+
"@types/lodash-es": "^4.17.12",
|
|
92
94
|
"@types/react": "^19.2.14",
|
|
93
95
|
"@types/react-dom": "^19.2.3",
|
|
94
96
|
"@vanilla-extract/vite-plugin": "^5.0.0",
|