@graphysdk/react-renderer 1.9.0-beta.1789737596195 → 1.9.0-beta.1789747103525
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.mjs +1528 -1528
- package/dist/{history-chords-BT1cYObW.js → history-chords-B81HfyGl.js} +2169 -2216
- package/dist/history-chords-Ymt9mGjN.cjs +2 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.mjs +115 -114
- package/package.json +2 -2
- package/dist/history-chords-B54t6bZE.cjs +0 -2
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('./index.css');const c=require("./history-chords-B54t6bZE.cjs"),se=require("./theme.contract.css-DKDKSByt.cjs");let m=require("@graphysdk/viz-engine"),d=require("react"),a=require("react/jsx-runtime"),U=require("zustand"),B=require("zustand/vanilla"),$=require("clsx");$=c.__toESM($,1);var ne="_1a5iqpb0",oe="_1a5iqpb1";var ae="_1a5iqpb3",ie="_1a5iqpb4",ce="_1a5iqpb5";var L=({errors:e})=>{const[t,...s]=e;return(0,a.jsxs)("div",{role:"alert",className:ne,children:[(0,a.jsx)("strong",{className:oe,children:"This chart could not be rendered."}),t&&(0,a.jsx)(Y,{diagnostic:t}),s.length>0&&(0,a.jsx)("ul",{className:"_1a5iqpb2",children:s.map((r,o)=>(0,a.jsx)("li",{children:(0,a.jsx)(Y,{diagnostic:r})},`${r.code}-${o}`))})]})},Y=({diagnostic:e})=>(0,a.jsxs)("div",{className:ae,children:[(0,a.jsx)("span",{className:ie,children:e.code}),(0,a.jsx)("p",{className:ce,children:e.message}),e.suggestion&&(0,a.jsx)("p",{className:"_1a5iqpb6",children:e.suggestion})]});function le(e=[],t=[]){return e.length===t.length&&e.every((s,r)=>Object.is(s,t[r]))}var z=class extends d.Component{constructor(...e){super(...e),this.state={caughtDiagnostic:null}}static getDerivedStateFromError(e){return{caughtDiagnostic:(0,m.buildDiagnostic)(e)}}componentDidCatch(e,t){const s=(0,m.buildDiagnostic)(e);c.logDiagnostics([s]),this.props.onError?.([s]),console.error("Chart render component stack:",t.componentStack)}componentDidUpdate(e){this.state.caughtDiagnostic&&!le(e.resetKeys,this.props.resetKeys)&&this.setState({caughtDiagnostic:null})}render(){const{caughtDiagnostic:e}=this.state;if(e)return(0,a.jsx)(L,{errors:[e]});const{forcedErrors:t,children:s}=this.props;return t&&t.length>0?(0,a.jsx)(L,{errors:t}):s}},X=e=>typeof e=="object"&&"geom"in e&&"render"in e,de=e=>{const t=(0,m.resolveDefinition)(e);return t instanceof m.Geom?t:null},Q=(e,t)=>{const s=e.filter(r=>ue(r,t));return s.length===e.length?e:s},ue=(e,t)=>e.kind==="annotation"?(0,m.findAnnotation)(t.annotations,e.id)!==null:e.kind==="observations"||e.kind==="layer"&&e.layerId!==void 0?(0,m.findLayerById)(t.layers,e.layerId)!==void 0:!0,F=[],he=()=>(0,B.createStore)(e=>({selection:F,setSelection:t=>e(s=>ge(s.selection,t)?s:{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((s,r)=>{const o=t[r];return o!==void 0&&(0,m.areEditTargetsEqual)(s,o)}),me=process.env.NODE_ENV!=="production",pe=5,ve=e=>{if(!me)return{emit:()=>{},subscribe:()=>ye,getLastTrigger:()=>null,getLastCompile:()=>null,getCacheStats:()=>e.getCacheStats()};const t=new Set;let s=null;return{emit:r=>{const o=e.getLastCompile();if(o){s=r;for(const l of t)l(r,o)}},subscribe:r=>(t.add(r),()=>{t.delete(r)}),getLastTrigger:()=>s,getLastCompile:()=>e.getLastCompile(),getCacheStats:()=>e.getCacheStats()}},fe=()=>(0,B.createStore)(e=>({lastCompile:null,history:[],nextId:1,lastSnapshot:null,recordCompile:(t,s)=>e(r=>{if(r.lastSnapshot===s)return r;const o={id:r.nextId,label:Se(t),stages:s.stages,stageDurationsMs:s.stageDurationsMs,durationMs:s.durationMs};return{lastCompile:o,history:be(r.history,o,pe),nextId:r.nextId+1,lastSnapshot:s}})})),ye=()=>{},Se=e=>{switch(e.kind){case"init":return"init";case"spec":return"spec change";case"data":return"data change";case"command":return e.command.metadata.description}},be=(e,t,s)=>{const r=e.length>=s?e.length-(s-1):0;return[...e.slice(r),t]};function Ee(e){const t=e.filter(X),s=new Set([...Object.keys(c.BUILT_IN_GEOM_RENDERERS),...t.map(u=>u.geom)]),r=[],o=new Set;for(const u of e){const g=de(u);g===null||s.has(g.type)||o.has(g.type)||(o.add(g.type),r.push({kind:"user-input",severity:"error",code:"MISSING_GEOM_RENDERER",message:`Custom geom '${g.type}' is registered but has no renderer.`,context:{requested:g.type,kind:"geom-renderer"},suggestion:`Add a render half for it: \`defineGeomRenderer(${g.type}Geom, { coord, render })\`, then include it in \`plugins\`.`}))}const l=new Map;for(const u of t){if("definition"in u)continue;const g=`${u.geom}|${u.coord}`,p=l.get(g);p?p.count+=1:l.set(g,{geom:u.geom,coord:u.coord,count:1})}const i=[];for(const{geom:u,coord:g,count:p}of l.values())p<2||i.push({kind:"user-input",severity:"warning",code:"DUPLICATE_REGISTERED_TYPE",message:`Multiple render-only overrides register ('${u}', '${g}') (${p} entries); the last in the array wins.`,context:{requested:`${u}@${g}`,kind:"geom-renderer"},suggestion:`Keep a single render-only override for ('${u}', '${g}').`});return{errors:r,warnings:i}}function xe(e,t){const{coordSystem:s,layers:r}=e,o=new Set,l=[];for(const i of r)t(i.geom,s.type)!==null||o.has(i.geom)||(o.add(i.geom),l.push({kind:"user-input",severity:"warning",code:"MISSING_GEOM_RENDERER",message:`No renderer for geom '${i.geom}' under ${s.type} coords; the layer is not painted.`,context:{requested:i.geom,kind:"geom-renderer"},suggestion:`Register a renderer for ('${i.geom}', '${s.type}') via \`defineGeomRenderer\`.`}));return l}function Te(e,t){const{coordSystem:s,layers:r}=e,o=new Set,l=[];for(const i of r){if(i.interactive===!1||i.spatialKind!=="render-hit-test"||o.has(i.geom))continue;const u=t(i.geom,s.type);u===null||u.hitTest||c.isOverlayHosted(u)||(o.add(i.geom),l.push({kind:"user-input",severity:"warning",code:"MISSING_RENDER_HIT_TEST",message:`Geom '${i.geom}' declares spatialKind 'render-hit-test' but its renderer provides no hit-test; the layer has no hover.`,context:{requested:i.geom,kind:"geom-renderer"},suggestion:`Add a \`hitTest\` factory (precomputed geometry) or an overlay render (\`{ fn, options: { overlay: true } }\`, live simulation) to the renderer for ('${i.geom}', '${s.type}').`}))}return l}function Ce(e){const t=new Set,s=[];for(const r of e.layers){const o=r.identityKey;r.interactive!==!1&&(r.spatialKind!=="render-hit-test"||typeof o!="object"||t.has(r.geom)||r.data.hasVariable(o.variable)||(t.add(r.geom),s.push({kind:"user-input",severity:"warning",code:"RENDER_HIT_TEST_IDENTITY",message:`Geom '${r.geom}' keys its identity on '${o.variable}', a column its compile output does not emit; its hover lookup is empty.`,context:{requested:r.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 s}function Re(e,t){const{coordSystem:s,layers:r}=e,o=new Set,l=[];for(const i of r){if(i.interactive===!1||i.spatialKind!=="render-hit-test"||o.has(i.geom))continue;const u=t(i.geom,s.type);u===null||!u.hitTest||!c.isOverlayHosted(u)||(o.add(i.geom),l.push({kind:"user-input",severity:"warning",code:"CONFLICTING_RENDER_HIT_TEST",message:`Geom '${i.geom}' declares both a \`hitTest\` factory and an overlay render; these are alternatives, so only the overlay is used.`,context:{requested:i.geom,kind:"geom-renderer"},suggestion:"Keep one: a `hitTest` factory for precomputed geometry, OR an overlay render (`{ fn, options: { overlay: true } }`) for a live simulation."}))}return l}function Ge(e,t){const s=new Set,r=[];for(const o of e.layers)o.interactive!==!1&&(o.spatialKind!=="render-hit-test"||s.has(o.geom)||t.hasCapability(o.geom)||(s.add(o.geom),r.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 r}function qe(e,t){const{coordSystem:s,layers:r}=e,o=new Set,l=[];for(const i of r){if(i.interactive===!1||i.spatialKind==="render-hit-test"||o.has(i.geom))continue;const u=t(i.geom,s.type);u===null||!c.isOverlayHosted(u)||(o.add(i.geom),l.push({kind:"user-input",severity:"warning",code:"OVERLAY_REQUIRES_RENDER_HIT_TEST",message:`Geom '${i.geom}' declares an overlay render but its layer's spatialKind is '${i.spatialKind}', not 'render-hit-test'; the overlay's push-path hover resolves to nothing.`,context:{requested:i.geom,kind:"geom-renderer"},suggestion:"Have the geom's manifest yield spatialKind 'render-hit-test' so the scene layer carries the `byKey` index the overlay's `pushHover` resolves against."}))}return l}var ke=e=>(0,B.createStore)(t=>({scene:e,setScene:s=>t(r=>r.scene===s?r:{scene:s})})),Ne=({spec:e,data:t,customPalettes:s,colorScheme:r,plugins:o,resolveRenderer:l,anchorResolver:i,onSpecChange:u,onError:g,onWarnings:p})=>{const T=c.useLatestRef(u),k=c.useLatestRef(g),G=c.useLatestRef(p),[{session:v,compileBus:h}]=(0,d.useState)(()=>{const n=(0,m.createCompiler)({plugins:o});return{session:new m.GraphCompilationSession(n),compileBus:ve(n)}}),[y]=(0,d.useState)(()=>Ee(o??[])),S=(0,d.useRef)(null),[N]=(0,d.useState)(je),C=(0,d.useRef)(null),b=(0,d.useCallback)(n=>y.errors.length===0?n:[...y.errors,...n??[]],[y]),_=(0,d.useCallback)(n=>{if(!n.ok)return n.errors;if(C.current)C.current.getState().setScene(n.scene);else{const f=ke(n.scene);f.subscribe(N.notify),C.current=f,N.notify()}return null},[N]),[w,D]=(0,d.useState)(()=>{const n=v.compile({spec:e,data:t,customPalettes:s,colorScheme:r});return S.current=n,b(_(n))}),q=(0,d.useCallback)(n=>n.ok?[...n.warnings,...xe(n.scene,l),...Te(n.scene,l),...Ce(n.scene),...Re(n.scene,l),...qe(n.scene,l),...Ge(n.scene,i)]:n.warnings,[l,i]),E=(0,d.useCallback)(n=>{n.length!==0&&(c.logDiagnostics(n),k.current?.(n))},[k]),R=(0,d.useCallback)(n=>{n.length!==0&&(c.logDiagnostics(n),G.current?.(n))},[G]);(0,d.useEffect)(()=>{const n=S.current;n&&(E([...y.errors,...n.ok?[]:n.errors]),R([...y.warnings,...q(n)]),n.ok&&h.emit({kind:"init"}))},[h,E,R,y,q]),(0,d.useEffect)(()=>{const n=v.update({spec:e,data:t,customPalettes:s,colorScheme:r});if(!n)return;n.committedSpec&&T.current?.(n.committedSpec);const f=_(n.result);D(b(f)),f&&E(f),R(q(n.result)),f||h.emit({kind:n.specChanged?"spec":"data"})},[e,t,s,r,v,h,_,E,R,b,q,T]);const j=(0,d.useCallback)(n=>{D(f=>f===null?f:b(null)),R(q(n))},[b,R,q]),H=(0,d.useCallback)(n=>{n.scene&&C.current?.getState().setScene(n.scene),n.result&&j(n.result),n.command&&h.emit({kind:"command",command:n.command}),n.spec&&T.current?.(n.spec),n.errors&&E([...n.errors])},[j,h,T,E]),x=(0,d.useCallback)(n=>{for(const f of n)H(f);return n.some(f=>!!f.scene)},[H]),P=(0,d.useCallback)((n,f)=>{x(v.applyCommand(n,f))},[v,x]),ee=(0,d.useCallback)(()=>{x(v.commit())},[v,x]),A=(0,d.useCallback)(()=>x(v.undo()),[v,x]),K=(0,d.useCallback)(()=>x(v.redo()),[v,x]),te=(0,d.useMemo)(()=>({stack:v.history,undo:A,redo:K}),[v,A,K]),re=(0,d.useCallback)(()=>C.current?.getState().scene??null,[]);return{store:C.current,dispatch:P,commit:ee,history:te,subscribe:N.subscribe,getScene:re,compileBus:h,compileErrors:w}},je=()=>{const e=new Set;return{subscribe:t=>(e.add(t),()=>{e.delete(t)}),notify:()=>e.forEach(t=>t())}},J=({data:e,spec:t,plugins:s=[],formattingLocale:r,handleRef:o,onSpecChange:l,onError:i,onWarnings:u,customPalettes:g,colorScheme:p="light",children:T})=>{const[k]=(0,d.useState)(()=>c.createGeomRendererResolver(s.filter(X))),G=(0,d.useId)(),[v]=(0,d.useState)(()=>(0,m.createAnchorResolver)(s)),[h]=(0,d.useState)(()=>he()),y=(0,d.useMemo)(()=>(0,m.createStyleResolver)({colorScheme:p}),[p]),{store:S,dispatch:N,commit:C,history:b,subscribe:_,getScene:w,compileBus:D,compileErrors:q}=Ne({spec:t,data:e,customPalettes:g,colorScheme:p,plugins:s,resolveRenderer:k,anchorResolver:v,onSpecChange:l,onError:i,onWarnings:u});(0,d.useEffect)(()=>{if(S)return S.subscribe((j,H)=>{if(j.scene.spec===H.scene.spec)return;const{selection:x,setSelection:P}=h.getState();x.length!==0&&P(Q(x,j.scene.spec))})},[S,h]);const E=(0,d.useMemo)(()=>({dispatch:N,commit:C}),[N,C]);(0,d.useImperativeHandle)(o,()=>({commands:E,undo:b.undo,redo:b.redo,subscribe:_,getScene:w,getSelection:()=>h.getState().selection,setSelection:j=>h.getState().setSelection(j),subscribeSelection:h.subscribe}),[E,b,_,w,h]);const R=(0,d.useMemo)(()=>S?{chartId:G,store:S,selectionStore:h,commands:E,history:b,formattingLocale:r,compileBus:D,colorScheme:p,styleResolver:y,anchorResolver:v}:null,[G,S,h,E,b,r,D,p,y,v]);return(0,a.jsx)(z,{forcedErrors:q,onError:i,resetKeys:[t,e],children:R?(0,a.jsx)(c.GraphContext.Provider,{value:R,children:(0,a.jsx)(c.GeomRendererResolverProvider,{value:k,children:T})}):null})};function _e(e){const t=(0,m.createSpecBuilder)(e);return{...t,GraphProvider:r=>(0,a.jsx)(J,{...r,plugins:t.plugins})}}var De=({children:e,...t})=>(0,a.jsx)("svg",{viewBox:"0 0 1 1",preserveAspectRatio:"none",width:"100%",height:"100%",pointerEvents:"none",...t,children:e}),Ie=({box:e,children:t})=>(0,a.jsx)("svg",{x:(0,m.toPercent)(e.x0),y:(0,m.toPercent)(e.y0),width:(0,m.toPercent)(e.x1-e.x0),height:(0,m.toPercent)(e.y1-e.y0),overflow:"hidden",pointerEvents:"none",children:t}),we="drqe3u0",He="drqe3u1",Me="drqe3u2",Pe="drqe3u3",I="drqe3u4",$e="drqe3u5",Le="drqe3u6",Be="drqe3u7",M="drqe3u8",Oe="drqe3u9",Ae="drqe3ua";var Ke="drqe3uc",Ue="drqe3ud",Ye="drqe3ue",Fe="drqe3uf";var Ve="drqe3uh",We="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"},ze=({width:e=440,style:t,className:s}={})=>{const{compileBus:r}=c.useGraphContext(),[o]=(0,d.useState)(()=>fe()),[l,i]=(0,d.useState)(!1),[u,g]=(0,d.useState)(m.isCompilerCachingEnabled);(0,d.useEffect)(()=>{const{recordCompile:h}=o.getState(),y=r.getLastTrigger(),S=r.getLastCompile();return y&&S&&h(y,S),r.subscribe(h)},[o,r]);const p=(0,U.useStore)(o,h=>h.lastCompile),T=(0,U.useStore)(o,h=>h.history),k=r.getCacheStats(),G=p===null&&T.length===0,v=()=>{g(h=>{const y=!h;return(0,m.setCompilerCachingEnabled)(y),y})};return(0,a.jsxs)("div",{className:(0,$.default)(Ae,s),style:{width:e,...t},children:[(0,a.jsxs)("div",{className:we,children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:He,children:"compile cache"}),(0,a.jsx)("div",{className:Ye,children:G?"production: stats disabled":p?`last: ${p.label} · ${O(p.durationMs)}`:"awaiting first compile…"})]}),(0,a.jsx)("button",{type:"button",onClick:()=>i(h=>!h),className:Fe,children:l?"▾":"▴"})]}),!l&&(0,a.jsxs)("div",{className:"drqe3ub",children:[(0,a.jsxs)("button",{type:"button",onClick:v,className:u?V.enabled:V.disabled,"aria-pressed":u,children:["cache ",u?"enabled":"disabled"]}),(0,a.jsx)("span",{className:"drqe3ug",children:"next compile reflects this toggle"})]}),!l&&!G&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(Xe,{delta:p?.stages,durations:p?.stageDurationsMs,cumulative:k}),(0,a.jsx)(Qe,{entries:T})]})]})},Xe=({delta:e,durations:t,cumulative:s})=>(0,a.jsxs)("table",{className:Me,children:[(0,a.jsx)("thead",{children:(0,a.jsxs)("tr",{className:Ve,children:[(0,a.jsx)("th",{className:Pe,children:"stage"}),(0,a.jsx)("th",{className:I,children:"time"}),(0,a.jsx)("th",{className:I,children:"Δ miss"}),(0,a.jsx)("th",{className:I,children:"Δ hit"}),(0,a.jsx)("th",{className:I,children:"total miss"}),(0,a.jsx)("th",{className:I,children:"total hit"})]})}),(0,a.jsx)("tbody",{children:m.COMPILER_STAGE_KEYS.map(r=>{const o=e?.[r],l=Je(o);return(0,a.jsxs)("tr",{className:Ke,children:[(0,a.jsxs)("td",{className:$e,children:[(0,a.jsx)("span",{className:Z[l],"aria-hidden":!0})," ",r]}),(0,a.jsx)("td",{className:M,children:t===void 0||l==="untouched"?"—":O(t[r])}),(0,a.jsx)("td",{className:l==="ran"?W.ran:W.dim,children:o?.misses??0}),(0,a.jsx)("td",{className:M,children:o?.hits??0}),(0,a.jsx)("td",{className:M,children:s[r].misses}),(0,a.jsx)("td",{className:M,children:s[r].hits})]},r)})})]}),Qe=({entries:e})=>e.length===0?null:(0,a.jsxs)("div",{className:Ue,children:[(0,a.jsx)("div",{className:We,children:"recent compiles"}),e.map(t=>{const s=Ze(t.stages,l=>l.misses>0),r=m.COMPILER_STAGE_KEYS.length,o=s===0?"cached":"ran";return(0,a.jsxs)("div",{className:Le,children:[(0,a.jsx)("span",{className:Z[o],"aria-hidden":!0}),(0,a.jsx)("span",{className:Be,title:t.label,children:t.label}),(0,a.jsxs)("span",{className:Oe,children:[s,"/",r," ran · ",O(t.durationMs)]})]},t.id)})]}),Je=e=>!e||e.hits===0&&e.misses===0?"untouched":e.misses>0?"ran":"cached",Ze=(e,t)=>{let s=0;for(const r of m.COMPILER_STAGE_KEYS)t(e[r])&&(s+=1);return s},O=e=>e<.1?"<0.1ms":e>=10?`${e.toFixed(0)}ms`:`${e.toFixed(2)}ms`,et=()=>{const{history:e}=c.useGraphContext(),{stack:t,undo:s,redo:r}=e,o=(0,d.useCallback)(u=>t.subscribe(u),[t]),l=(0,d.useCallback)(()=>t.getSnapshot(),[t]),i=(0,d.useSyncExternalStore)(o,l,l);return(0,d.useMemo)(()=>({...i,undo:s,redo:r}),[i,s,r])},tt=new Set(["button","checkbox","color","file","hidden","image","radio","range","reset","submit"]),rt=(e,t={})=>{const{target:s,enabled:r=!0}=t;(0,d.useEffect)(()=>{const o=st(s);if(!r||!o)return;const l=i=>{if(!nt(i)||i.defaultPrevented||ot(i.target))return;const u=c.resolveHistoryStep(i);if(!u)return;const g=e.current;g&&(u==="undo"?g.undo():g.redo())&&i.preventDefault()};return o.addEventListener("keydown",l),()=>o.removeEventListener("keydown",l)},[e,s,r])},st=e=>e===void 0?window:e!==null&&"current"in e?e.current:e,nt=e=>"key"in e,ot=e=>e instanceof HTMLInputElement?!tt.has(e.type):e instanceof HTMLElement?e.isContentEditable||e.tagName==="TEXTAREA":!1;exports.BrandMark=c.BrandMark;exports.CanvasTextMeasurer=c.CanvasTextMeasurer;exports.DefaultFooter=c.DefaultFooter;exports.DefaultGrid=c.DefaultGrid;exports.DefaultHeader=c.DefaultHeader;exports.DefaultSwatch=c.DefaultSwatch;exports.DefaultTooltip=c.DefaultTooltip;exports.DevToolsPanel=ze;exports.GRAPH_MODES=c.GRAPH_MODES;exports.GraphErrorBoundary=z;exports.GraphErrorPanel=L;exports.GraphProvider=J;exports.GraphRenderer=c.GraphRenderer;exports.HoverProvider=c.HoverProvider;exports.TextMeasurerProvider=c.TextMeasurerProvider;exports.ThemeProvider=c.ThemeProvider;exports.UnitBoxSvg=Ie;exports.UnitSpaceSvg=De;exports.createGraphyKit=_e;exports.darkTheme=c.darkTheme;exports.defineGeomRenderer=c.defineGeomRenderer;exports.lightTheme=c.lightTheme;exports.lightenCss=c.lightenCss;exports.pruneSelection=Q;exports.resolveBrandMarkVisual=c.resolveBrandMarkVisual;exports.stampAxisEditTarget=c.stampAxisEditTarget;exports.stampGridEditTarget=c.stampGridEditTarget;exports.stampLegendEditTarget=c.stampLegendEditTarget;exports.useElementScreenRect=c.useElementScreenRect;exports.useGeomHitTest=c.useGeomHitTest;exports.useGeomHover=c.useGeomHover;exports.useGraphCommands=c.useGraphCommands;exports.useGraphHandle=c.useGraphHandle;exports.useGraphHistory=et;exports.useGraphHistoryShortcuts=rt;exports.useGraphSelection=c.useGraphSelection;exports.useGuidesTakePress=c.useGuidesTakePress;exports.useHandleScene=c.useHandleScene;exports.useHoverState=c.useHoverState;exports.useSceneSelector=c.useSceneSelector;exports.useStyleReaderTree=c.useStyleReaderTree;exports.useStyleReaders=c.useStyleReaders;exports.useStyleResolver=c.useStyleResolver;exports.useTextMeasurer=c.useTextMeasurer;exports.vars=se.vars;
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('./index.css');const c=require("./history-chords-Ymt9mGjN.cjs"),se=require("./theme.contract.css-DKDKSByt.cjs");let m=require("@graphysdk/viz-engine"),d=require("react"),a=require("react/jsx-runtime"),U=require("zustand"),B=require("zustand/vanilla"),$=require("clsx");$=c.__toESM($,1);var ne="_1a5iqpb0",oe="_1a5iqpb1";var ae="_1a5iqpb3",ie="_1a5iqpb4",ce="_1a5iqpb5";var L=({errors:e})=>{const[t,...s]=e;return(0,a.jsxs)("div",{role:"alert",className:ne,children:[(0,a.jsx)("strong",{className:oe,children:"This chart could not be rendered."}),t&&(0,a.jsx)(Y,{diagnostic:t}),s.length>0&&(0,a.jsx)("ul",{className:"_1a5iqpb2",children:s.map((r,o)=>(0,a.jsx)("li",{children:(0,a.jsx)(Y,{diagnostic:r})},`${r.code}-${o}`))})]})},Y=({diagnostic:e})=>(0,a.jsxs)("div",{className:ae,children:[(0,a.jsx)("span",{className:ie,children:e.code}),(0,a.jsx)("p",{className:ce,children:e.message}),e.suggestion&&(0,a.jsx)("p",{className:"_1a5iqpb6",children:e.suggestion})]});function le(e=[],t=[]){return e.length===t.length&&e.every((s,r)=>Object.is(s,t[r]))}var z=class extends d.Component{constructor(...e){super(...e),this.state={caughtDiagnostic:null}}static getDerivedStateFromError(e){return{caughtDiagnostic:(0,m.buildDiagnostic)(e)}}componentDidCatch(e,t){const s=(0,m.buildDiagnostic)(e);c.logDiagnostics([s]),this.props.onError?.([s]),console.error("Chart render component stack:",t.componentStack)}componentDidUpdate(e){this.state.caughtDiagnostic&&!le(e.resetKeys,this.props.resetKeys)&&this.setState({caughtDiagnostic:null})}render(){const{caughtDiagnostic:e}=this.state;if(e)return(0,a.jsx)(L,{errors:[e]});const{forcedErrors:t,children:s}=this.props;return t&&t.length>0?(0,a.jsx)(L,{errors:t}):s}},X=e=>typeof e=="object"&&"geom"in e&&"render"in e,de=e=>{const t=(0,m.resolveDefinition)(e);return t instanceof m.Geom?t:null},Q=(e,t)=>{const s=e.filter(r=>ue(r,t));return s.length===e.length?e:s},ue=(e,t)=>e.kind==="annotation"?(0,m.findAnnotation)(t.annotations,e.id)!==null:e.kind==="observations"||e.kind==="layer"&&e.layerId!==void 0?(0,m.findLayerById)(t.layers,e.layerId)!==void 0:!0,F=[],he=()=>(0,B.createStore)(e=>({selection:F,setSelection:t=>e(s=>ge(s.selection,t)?s:{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((s,r)=>{const o=t[r];return o!==void 0&&(0,m.areEditTargetsEqual)(s,o)}),me=process.env.NODE_ENV!=="production",pe=5,ve=e=>{if(!me)return{emit:()=>{},subscribe:()=>ye,getLastTrigger:()=>null,getLastCompile:()=>null,getCacheStats:()=>e.getCacheStats()};const t=new Set;let s=null;return{emit:r=>{const o=e.getLastCompile();if(o){s=r;for(const l of t)l(r,o)}},subscribe:r=>(t.add(r),()=>{t.delete(r)}),getLastTrigger:()=>s,getLastCompile:()=>e.getLastCompile(),getCacheStats:()=>e.getCacheStats()}},fe=()=>(0,B.createStore)(e=>({lastCompile:null,history:[],nextId:1,lastSnapshot:null,recordCompile:(t,s)=>e(r=>{if(r.lastSnapshot===s)return r;const o={id:r.nextId,label:Se(t),stages:s.stages,stageDurationsMs:s.stageDurationsMs,durationMs:s.durationMs};return{lastCompile:o,history:be(r.history,o,pe),nextId:r.nextId+1,lastSnapshot:s}})})),ye=()=>{},Se=e=>{switch(e.kind){case"init":return"init";case"spec":return"spec change";case"data":return"data change";case"command":return e.command.metadata.description}},be=(e,t,s)=>{const r=e.length>=s?e.length-(s-1):0;return[...e.slice(r),t]};function Ee(e){const t=e.filter(X),s=new Set([...Object.keys(c.BUILT_IN_GEOM_RENDERERS),...t.map(u=>u.geom)]),r=[],o=new Set;for(const u of e){const g=de(u);g===null||s.has(g.type)||o.has(g.type)||(o.add(g.type),r.push({kind:"user-input",severity:"error",code:"MISSING_GEOM_RENDERER",message:`Custom geom '${g.type}' is registered but has no renderer.`,context:{requested:g.type,kind:"geom-renderer"},suggestion:`Add a render half for it: \`defineGeomRenderer(${g.type}Geom, { coord, render })\`, then include it in \`plugins\`.`}))}const l=new Map;for(const u of t){if("definition"in u)continue;const g=`${u.geom}|${u.coord}`,p=l.get(g);p?p.count+=1:l.set(g,{geom:u.geom,coord:u.coord,count:1})}const i=[];for(const{geom:u,coord:g,count:p}of l.values())p<2||i.push({kind:"user-input",severity:"warning",code:"DUPLICATE_REGISTERED_TYPE",message:`Multiple render-only overrides register ('${u}', '${g}') (${p} entries); the last in the array wins.`,context:{requested:`${u}@${g}`,kind:"geom-renderer"},suggestion:`Keep a single render-only override for ('${u}', '${g}').`});return{errors:r,warnings:i}}function xe(e,t){const{coordSystem:s,layers:r}=e,o=new Set,l=[];for(const i of r)t(i.geom,s.type)!==null||o.has(i.geom)||(o.add(i.geom),l.push({kind:"user-input",severity:"warning",code:"MISSING_GEOM_RENDERER",message:`No renderer for geom '${i.geom}' under ${s.type} coords; the layer is not painted.`,context:{requested:i.geom,kind:"geom-renderer"},suggestion:`Register a renderer for ('${i.geom}', '${s.type}') via \`defineGeomRenderer\`.`}));return l}function Te(e,t){const{coordSystem:s,layers:r}=e,o=new Set,l=[];for(const i of r){if(i.interactive===!1||i.spatialKind!=="render-hit-test"||o.has(i.geom))continue;const u=t(i.geom,s.type);u===null||u.hitTest||c.isOverlayHosted(u)||(o.add(i.geom),l.push({kind:"user-input",severity:"warning",code:"MISSING_RENDER_HIT_TEST",message:`Geom '${i.geom}' declares spatialKind 'render-hit-test' but its renderer provides no hit-test; the layer has no hover.`,context:{requested:i.geom,kind:"geom-renderer"},suggestion:`Add a \`hitTest\` factory (precomputed geometry) or an overlay render (\`{ fn, options: { overlay: true } }\`, live simulation) to the renderer for ('${i.geom}', '${s.type}').`}))}return l}function Re(e){const t=new Set,s=[];for(const r of e.layers){const o=r.identityKey;r.interactive!==!1&&(r.spatialKind!=="render-hit-test"||typeof o!="object"||t.has(r.geom)||r.data.hasVariable(o.variable)||(t.add(r.geom),s.push({kind:"user-input",severity:"warning",code:"RENDER_HIT_TEST_IDENTITY",message:`Geom '${r.geom}' keys its identity on '${o.variable}', a column its compile output does not emit; its hover lookup is empty.`,context:{requested:r.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 s}function Ce(e,t){const{coordSystem:s,layers:r}=e,o=new Set,l=[];for(const i of r){if(i.interactive===!1||i.spatialKind!=="render-hit-test"||o.has(i.geom))continue;const u=t(i.geom,s.type);u===null||!u.hitTest||!c.isOverlayHosted(u)||(o.add(i.geom),l.push({kind:"user-input",severity:"warning",code:"CONFLICTING_RENDER_HIT_TEST",message:`Geom '${i.geom}' declares both a \`hitTest\` factory and an overlay render; these are alternatives, so only the overlay is used.`,context:{requested:i.geom,kind:"geom-renderer"},suggestion:"Keep one: a `hitTest` factory for precomputed geometry, OR an overlay render (`{ fn, options: { overlay: true } }`) for a live simulation."}))}return l}function Ge(e,t){const s=new Set,r=[];for(const o of e.layers)o.interactive!==!1&&(o.spatialKind!=="render-hit-test"||s.has(o.geom)||t.hasCapability(o.geom)||(s.add(o.geom),r.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 r}function qe(e,t){const{coordSystem:s,layers:r}=e,o=new Set,l=[];for(const i of r){if(i.interactive===!1||i.spatialKind==="render-hit-test"||o.has(i.geom))continue;const u=t(i.geom,s.type);u===null||!c.isOverlayHosted(u)||(o.add(i.geom),l.push({kind:"user-input",severity:"warning",code:"OVERLAY_REQUIRES_RENDER_HIT_TEST",message:`Geom '${i.geom}' declares an overlay render but its layer's spatialKind is '${i.spatialKind}', not 'render-hit-test'; the overlay's push-path hover resolves to nothing.`,context:{requested:i.geom,kind:"geom-renderer"},suggestion:"Have the geom's manifest yield spatialKind 'render-hit-test' so the scene layer carries the `byKey` index the overlay's `pushHover` resolves against."}))}return l}var ke=e=>(0,B.createStore)(t=>({scene:e,setScene:s=>t(r=>r.scene===s?r:{scene:s})})),Ne=({spec:e,data:t,customPalettes:s,colorScheme:r,plugins:o,resolveRenderer:l,anchorResolver:i,onSpecChange:u,onError:g,onWarnings:p})=>{const T=c.useLatestRef(u),k=c.useLatestRef(g),G=c.useLatestRef(p),[{session:v,compileBus:h}]=(0,d.useState)(()=>{const n=(0,m.createCompiler)({plugins:o});return{session:new m.GraphCompilationSession(n),compileBus:ve(n)}}),[y]=(0,d.useState)(()=>Ee(o??[])),S=(0,d.useRef)(null),[N]=(0,d.useState)(je),R=(0,d.useRef)(null),b=(0,d.useCallback)(n=>y.errors.length===0?n:[...y.errors,...n??[]],[y]),_=(0,d.useCallback)(n=>{if(!n.ok)return n.errors;if(R.current)R.current.getState().setScene(n.scene);else{const f=ke(n.scene);f.subscribe(N.notify),R.current=f,N.notify()}return null},[N]),[w,D]=(0,d.useState)(()=>{const n=v.compile({spec:e,data:t,customPalettes:s,colorScheme:r});return S.current=n,b(_(n))}),q=(0,d.useCallback)(n=>n.ok?[...n.warnings,...xe(n.scene,l),...Te(n.scene,l),...Re(n.scene),...Ce(n.scene,l),...qe(n.scene,l),...Ge(n.scene,i)]:n.warnings,[l,i]),E=(0,d.useCallback)(n=>{n.length!==0&&(c.logDiagnostics(n),k.current?.(n))},[k]),C=(0,d.useCallback)(n=>{n.length!==0&&(c.logDiagnostics(n),G.current?.(n))},[G]);(0,d.useEffect)(()=>{const n=S.current;n&&(E([...y.errors,...n.ok?[]:n.errors]),C([...y.warnings,...q(n)]),n.ok&&h.emit({kind:"init"}))},[h,E,C,y,q]),(0,d.useEffect)(()=>{const n=v.update({spec:e,data:t,customPalettes:s,colorScheme:r});if(!n)return;n.committedSpec&&T.current?.(n.committedSpec);const f=_(n.result);D(b(f)),f&&E(f),C(q(n.result)),f||h.emit({kind:n.specChanged?"spec":"data"})},[e,t,s,r,v,h,_,E,C,b,q,T]);const j=(0,d.useCallback)(n=>{D(f=>f===null?f:b(null)),C(q(n))},[b,C,q]),H=(0,d.useCallback)(n=>{n.scene&&R.current?.getState().setScene(n.scene),n.result&&j(n.result),n.command&&h.emit({kind:"command",command:n.command}),n.spec&&T.current?.(n.spec),n.errors&&E([...n.errors])},[j,h,T,E]),x=(0,d.useCallback)(n=>{for(const f of n)H(f);return n.some(f=>!!f.scene)},[H]),P=(0,d.useCallback)((n,f)=>{x(v.applyCommand(n,f))},[v,x]),ee=(0,d.useCallback)(()=>{x(v.commit())},[v,x]),A=(0,d.useCallback)(()=>x(v.undo()),[v,x]),K=(0,d.useCallback)(()=>x(v.redo()),[v,x]),te=(0,d.useMemo)(()=>({stack:v.history,undo:A,redo:K}),[v,A,K]),re=(0,d.useCallback)(()=>R.current?.getState().scene??null,[]);return{store:R.current,dispatch:P,commit:ee,history:te,subscribe:N.subscribe,getScene:re,compileBus:h,compileErrors:w}},je=()=>{const e=new Set;return{subscribe:t=>(e.add(t),()=>{e.delete(t)}),notify:()=>e.forEach(t=>t())}},J=({data:e,spec:t,plugins:s=[],formattingLocale:r,handleRef:o,onSpecChange:l,onError:i,onWarnings:u,customPalettes:g,colorScheme:p="light",children:T})=>{const[k]=(0,d.useState)(()=>c.createGeomRendererResolver(s.filter(X))),G=(0,d.useId)(),[v]=(0,d.useState)(()=>(0,m.createAnchorResolver)(s)),[h]=(0,d.useState)(()=>he()),y=(0,d.useMemo)(()=>(0,m.createStyleResolver)({colorScheme:p}),[p]),{store:S,dispatch:N,commit:R,history:b,subscribe:_,getScene:w,compileBus:D,compileErrors:q}=Ne({spec:t,data:e,customPalettes:g,colorScheme:p,plugins:s,resolveRenderer:k,anchorResolver:v,onSpecChange:l,onError:i,onWarnings:u});(0,d.useEffect)(()=>{if(S)return S.subscribe((j,H)=>{if(j.scene.spec===H.scene.spec)return;const{selection:x,setSelection:P}=h.getState();x.length!==0&&P(Q(x,j.scene.spec))})},[S,h]);const E=(0,d.useMemo)(()=>({dispatch:N,commit:R}),[N,R]);(0,d.useImperativeHandle)(o,()=>({commands:E,undo:b.undo,redo:b.redo,subscribe:_,getScene:w,getSelection:()=>h.getState().selection,setSelection:j=>h.getState().setSelection(j),subscribeSelection:h.subscribe}),[E,b,_,w,h]);const C=(0,d.useMemo)(()=>S?{chartId:G,store:S,selectionStore:h,commands:E,history:b,formattingLocale:r,compileBus:D,colorScheme:p,styleResolver:y,anchorResolver:v}:null,[G,S,h,E,b,r,D,p,y,v]);return(0,a.jsx)(z,{forcedErrors:q,onError:i,resetKeys:[t,e],children:C?(0,a.jsx)(c.GraphContext.Provider,{value:C,children:(0,a.jsx)(c.GeomRendererResolverProvider,{value:k,children:T})}):null})};function _e(e){const t=(0,m.createSpecBuilder)(e);return{...t,GraphProvider:r=>(0,a.jsx)(J,{...r,plugins:t.plugins})}}var De=({children:e,...t})=>(0,a.jsx)("svg",{viewBox:"0 0 1 1",preserveAspectRatio:"none",width:"100%",height:"100%",pointerEvents:"none",...t,children:e}),Ie=({box:e,children:t})=>(0,a.jsx)("svg",{x:(0,m.toPercent)(e.x0),y:(0,m.toPercent)(e.y0),width:(0,m.toPercent)(e.x1-e.x0),height:(0,m.toPercent)(e.y1-e.y0),overflow:"hidden",pointerEvents:"none",children:t}),we="drqe3u0",He="drqe3u1",Me="drqe3u2",Pe="drqe3u3",I="drqe3u4",$e="drqe3u5",Le="drqe3u6",Be="drqe3u7",M="drqe3u8",Oe="drqe3u9",Ae="drqe3ua";var Ke="drqe3uc",Ue="drqe3ud",Ye="drqe3ue",Fe="drqe3uf";var Ve="drqe3uh",We="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"},ze=({width:e=440,style:t,className:s}={})=>{const{compileBus:r}=c.useGraphContext(),[o]=(0,d.useState)(()=>fe()),[l,i]=(0,d.useState)(!1),[u,g]=(0,d.useState)(m.isCompilerCachingEnabled);(0,d.useEffect)(()=>{const{recordCompile:h}=o.getState(),y=r.getLastTrigger(),S=r.getLastCompile();return y&&S&&h(y,S),r.subscribe(h)},[o,r]);const p=(0,U.useStore)(o,h=>h.lastCompile),T=(0,U.useStore)(o,h=>h.history),k=r.getCacheStats(),G=p===null&&T.length===0,v=()=>{g(h=>{const y=!h;return(0,m.setCompilerCachingEnabled)(y),y})};return(0,a.jsxs)("div",{className:(0,$.default)(Ae,s),style:{width:e,...t},children:[(0,a.jsxs)("div",{className:we,children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:He,children:"compile cache"}),(0,a.jsx)("div",{className:Ye,children:G?"production: stats disabled":p?`last: ${p.label} · ${O(p.durationMs)}`:"awaiting first compile…"})]}),(0,a.jsx)("button",{type:"button",onClick:()=>i(h=>!h),className:Fe,children:l?"▾":"▴"})]}),!l&&(0,a.jsxs)("div",{className:"drqe3ub",children:[(0,a.jsxs)("button",{type:"button",onClick:v,className:u?V.enabled:V.disabled,"aria-pressed":u,children:["cache ",u?"enabled":"disabled"]}),(0,a.jsx)("span",{className:"drqe3ug",children:"next compile reflects this toggle"})]}),!l&&!G&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(Xe,{delta:p?.stages,durations:p?.stageDurationsMs,cumulative:k}),(0,a.jsx)(Qe,{entries:T})]})]})},Xe=({delta:e,durations:t,cumulative:s})=>(0,a.jsxs)("table",{className:Me,children:[(0,a.jsx)("thead",{children:(0,a.jsxs)("tr",{className:Ve,children:[(0,a.jsx)("th",{className:Pe,children:"stage"}),(0,a.jsx)("th",{className:I,children:"time"}),(0,a.jsx)("th",{className:I,children:"Δ miss"}),(0,a.jsx)("th",{className:I,children:"Δ hit"}),(0,a.jsx)("th",{className:I,children:"total miss"}),(0,a.jsx)("th",{className:I,children:"total hit"})]})}),(0,a.jsx)("tbody",{children:m.COMPILER_STAGE_KEYS.map(r=>{const o=e?.[r],l=Je(o);return(0,a.jsxs)("tr",{className:Ke,children:[(0,a.jsxs)("td",{className:$e,children:[(0,a.jsx)("span",{className:Z[l],"aria-hidden":!0})," ",r]}),(0,a.jsx)("td",{className:M,children:t===void 0||l==="untouched"?"—":O(t[r])}),(0,a.jsx)("td",{className:l==="ran"?W.ran:W.dim,children:o?.misses??0}),(0,a.jsx)("td",{className:M,children:o?.hits??0}),(0,a.jsx)("td",{className:M,children:s[r].misses}),(0,a.jsx)("td",{className:M,children:s[r].hits})]},r)})})]}),Qe=({entries:e})=>e.length===0?null:(0,a.jsxs)("div",{className:Ue,children:[(0,a.jsx)("div",{className:We,children:"recent compiles"}),e.map(t=>{const s=Ze(t.stages,l=>l.misses>0),r=m.COMPILER_STAGE_KEYS.length,o=s===0?"cached":"ran";return(0,a.jsxs)("div",{className:Le,children:[(0,a.jsx)("span",{className:Z[o],"aria-hidden":!0}),(0,a.jsx)("span",{className:Be,title:t.label,children:t.label}),(0,a.jsxs)("span",{className:Oe,children:[s,"/",r," ran · ",O(t.durationMs)]})]},t.id)})]}),Je=e=>!e||e.hits===0&&e.misses===0?"untouched":e.misses>0?"ran":"cached",Ze=(e,t)=>{let s=0;for(const r of m.COMPILER_STAGE_KEYS)t(e[r])&&(s+=1);return s},O=e=>e<.1?"<0.1ms":e>=10?`${e.toFixed(0)}ms`:`${e.toFixed(2)}ms`,et=()=>{const{history:e}=c.useGraphContext(),{stack:t,undo:s,redo:r}=e,o=(0,d.useCallback)(u=>t.subscribe(u),[t]),l=(0,d.useCallback)(()=>t.getSnapshot(),[t]),i=(0,d.useSyncExternalStore)(o,l,l);return(0,d.useMemo)(()=>({...i,undo:s,redo:r}),[i,s,r])},tt=new Set(["button","checkbox","color","file","hidden","image","radio","range","reset","submit"]),rt=(e,t={})=>{const{target:s,enabled:r=!0}=t;(0,d.useEffect)(()=>{const o=st(s);if(!r||!o)return;const l=i=>{if(!nt(i)||i.defaultPrevented||ot(i.target))return;const u=c.resolveHistoryStep(i);if(!u)return;const g=e.current;g&&(u==="undo"?g.undo():g.redo())&&i.preventDefault()};return o.addEventListener("keydown",l),()=>o.removeEventListener("keydown",l)},[e,s,r])},st=e=>e===void 0?window:e!==null&&"current"in e?e.current:e,nt=e=>"key"in e,ot=e=>e instanceof HTMLInputElement?!tt.has(e.type):e instanceof HTMLElement?e.isContentEditable||e.tagName==="TEXTAREA":!1;exports.BrandMark=c.BrandMark;exports.CanvasTextMeasurer=c.CanvasTextMeasurer;exports.DefaultFooter=c.DefaultFooter;exports.DefaultGrid=c.DefaultGrid;exports.DefaultHeader=c.DefaultHeader;exports.DefaultSwatch=c.DefaultSwatch;exports.DefaultTooltip=c.DefaultTooltip;exports.DevToolsPanel=ze;exports.GRAPH_MODES=c.GRAPH_MODES;exports.GraphErrorBoundary=z;exports.GraphErrorPanel=L;exports.GraphProvider=J;exports.GraphRenderer=c.GraphRenderer;exports.HoverProvider=c.HoverProvider;exports.TextMeasurerProvider=c.TextMeasurerProvider;exports.ThemeProvider=c.ThemeProvider;exports.UnitBoxSvg=Ie;exports.UnitSpaceSvg=De;exports.createGraphyKit=_e;exports.darkTheme=c.darkTheme;exports.defineGeomRenderer=c.defineGeomRenderer;exports.lightTheme=c.lightTheme;exports.lightenCss=c.lightenCss;exports.pruneSelection=Q;exports.resolveBrandMarkVisual=c.resolveBrandMarkVisual;exports.stampAxisEditTarget=c.stampAxisEditTarget;exports.stampGridEditTarget=c.stampGridEditTarget;exports.stampLegendEditTarget=c.stampLegendEditTarget;exports.useElementScreenRect=c.useElementScreenRect;exports.useGeomHitTest=c.useGeomHitTest;exports.useGeomHover=c.useGeomHover;exports.useGraphCommands=c.useGraphCommands;exports.useGraphHandle=c.useGraphHandle;exports.useGraphHistory=et;exports.useGraphHistoryShortcuts=rt;exports.useGraphSelection=c.useGraphSelection;exports.useGuidesTakePress=c.useGuidesTakePress;exports.useHandleScene=c.useHandleScene;exports.useHoverState=c.useHoverState;exports.useResolvedStyle=c.useResolvedStyle;exports.useSceneSelector=c.useSceneSelector;exports.useStyleReaderTree=c.useStyleReaderTree;exports.useStyleReaders=c.useStyleReaders;exports.useStyleResolver=c.useStyleResolver;exports.useTextMeasurer=c.useTextMeasurer;exports.vars=se.vars;
|
package/dist/index.d.ts
CHANGED
|
@@ -1436,6 +1436,9 @@ export declare const useHandleScene: (handle: GraphHandle) => Scene | null;
|
|
|
1436
1436
|
*/
|
|
1437
1437
|
export declare function useHoverState<T>(selector: (state: HoverStoreState) => T): T;
|
|
1438
1438
|
|
|
1439
|
+
/** Memoizes a module-level style read. Pass the read function, then the arguments it needs. */
|
|
1440
|
+
export declare const useResolvedStyle: <TArgs extends readonly unknown[], TResult>(read: (...args: TArgs) => TResult, ...args: TArgs) => TResult;
|
|
1441
|
+
|
|
1439
1442
|
/**
|
|
1440
1443
|
* Subscribes to a derived slice of the scene. The subscription only fires when the
|
|
1441
1444
|
* selector's result changes by reference, so combined with the compiler's per-stage memoization
|
package/dist/index.mjs
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { At as
|
|
2
|
-
import { n as
|
|
3
|
-
import { COMPILER_STAGE_KEYS as j, Geom as pe, GraphCompilationSession as fe, areEditTargetsEqual as ve, buildDiagnostic as
|
|
4
|
-
import { Component as
|
|
5
|
-
import { Fragment as
|
|
6
|
-
import { useStore as
|
|
1
|
+
import { At as A, B as _t, Bt as $t, Ct as Ht, D as xt, Dt as Mt, F as Pt, H as Lt, Ht as Bt, Jt as Ot, Lt as At, Mt as Kt, N as Ut, Nt as U, Ot as jt, P as Ft, Pt as le, Rt as ue, St as Yt, U as Vt, Ut as Wt, Vt as Xt, _ as zt, a as Jt, an as me, bt as Qt, ft as Zt, ht as er, i as tr, in as rr, jt as ge, mt as nr, n as sr, nn as or, on as se, ot as ir, r as ar, rn as cr, s as dr, sn as K, st as lr, t as he, tn as ur, z as mr } from "./history-chords-B81HfyGl.js";
|
|
2
|
+
import { n as hr } from "./theme.contract.css-AyXDNf0F.js";
|
|
3
|
+
import { COMPILER_STAGE_KEYS as j, Geom as pe, GraphCompilationSession as fe, areEditTargetsEqual as ve, buildDiagnostic as X, createAnchorResolver as ye, createCompiler as Se, createSpecBuilder as be, createStyleResolver as Ee, findAnnotation as Te, findLayerById as z, isCompilerCachingEnabled as Ne, resolveDefinition as Re, setCompilerCachingEnabled as Ce, toPercent as L } from "@graphysdk/viz-engine";
|
|
4
|
+
import { Component as qe, useCallback as f, useEffect as x, useId as Ge, useImperativeHandle as ke, useMemo as H, useRef as J, useState as T, useSyncExternalStore as De } from "react";
|
|
5
|
+
import { Fragment as Ie, jsx as c, jsxs as v } from "react/jsx-runtime";
|
|
6
|
+
import { useStore as Q } from "zustand";
|
|
7
7
|
import { createStore as F } from "zustand/vanilla";
|
|
8
8
|
import we from "clsx";
|
|
9
9
|
import './index.css';var _e = "_1a5iqpb0", $e = "_1a5iqpb1";
|
|
10
|
-
var
|
|
10
|
+
var He = "_1a5iqpb3", xe = "_1a5iqpb4", Me = "_1a5iqpb5";
|
|
11
11
|
var Z = ({ errors: e }) => {
|
|
12
12
|
const [t, ...n] = e;
|
|
13
13
|
return /* @__PURE__ */ v("div", {
|
|
@@ -26,10 +26,10 @@ var Z = ({ errors: e }) => {
|
|
|
26
26
|
]
|
|
27
27
|
});
|
|
28
28
|
}, ee = ({ diagnostic: e }) => /* @__PURE__ */ v("div", {
|
|
29
|
-
className:
|
|
29
|
+
className: He,
|
|
30
30
|
children: [
|
|
31
31
|
/* @__PURE__ */ c("span", {
|
|
32
|
-
className:
|
|
32
|
+
className: xe,
|
|
33
33
|
children: e.code
|
|
34
34
|
}),
|
|
35
35
|
/* @__PURE__ */ c("p", {
|
|
@@ -45,15 +45,15 @@ var Z = ({ errors: e }) => {
|
|
|
45
45
|
function Pe(e = [], t = []) {
|
|
46
46
|
return e.length === t.length && e.every((n, r) => Object.is(n, t[r]));
|
|
47
47
|
}
|
|
48
|
-
var Le = class extends
|
|
48
|
+
var Le = class extends qe {
|
|
49
49
|
constructor(...e) {
|
|
50
50
|
super(...e), this.state = { caughtDiagnostic: null };
|
|
51
51
|
}
|
|
52
52
|
static getDerivedStateFromError(e) {
|
|
53
|
-
return { caughtDiagnostic:
|
|
53
|
+
return { caughtDiagnostic: X(e) };
|
|
54
54
|
}
|
|
55
55
|
componentDidCatch(e, t) {
|
|
56
|
-
const n =
|
|
56
|
+
const n = X(e);
|
|
57
57
|
K([n]), this.props.onError?.([n]), console.error("Chart render component stack:", t.componentStack);
|
|
58
58
|
}
|
|
59
59
|
componentDidUpdate(e) {
|
|
@@ -68,10 +68,10 @@ var Le = class extends Ce {
|
|
|
68
68
|
}, oe = (e) => typeof e == "object" && "geom" in e && "render" in e, Be = (e) => {
|
|
69
69
|
const t = Re(e);
|
|
70
70
|
return t instanceof pe ? t : null;
|
|
71
|
-
},
|
|
72
|
-
const n = e.filter((r) =>
|
|
71
|
+
}, Oe = (e, t) => {
|
|
72
|
+
const n = e.filter((r) => Ae(r, t));
|
|
73
73
|
return n.length === e.length ? e : n;
|
|
74
|
-
},
|
|
74
|
+
}, Ae = (e, t) => e.kind === "annotation" ? Te(t.annotations, e.id) !== null : e.kind === "observations" ? z(t.layers, e.layerId) !== void 0 : e.kind === "layer" && e.layerId !== void 0 ? z(t.layers, e.layerId) !== void 0 : !0, te = [], Ke = () => F((e) => ({
|
|
75
75
|
selection: te,
|
|
76
76
|
setSelection: (t) => e((n) => Ue(n.selection, t) ? n : { selection: t }),
|
|
77
77
|
clearSelection: () => e((t) => t.selection.length === 0 ? t : { selection: te })
|
|
@@ -113,20 +113,20 @@ var Le = class extends Ce {
|
|
|
113
113
|
if (r.lastSnapshot === n) return r;
|
|
114
114
|
const o = {
|
|
115
115
|
id: r.nextId,
|
|
116
|
-
label:
|
|
116
|
+
label: Xe(t),
|
|
117
117
|
stages: n.stages,
|
|
118
118
|
stageDurationsMs: n.stageDurationsMs,
|
|
119
119
|
durationMs: n.durationMs
|
|
120
120
|
};
|
|
121
121
|
return {
|
|
122
122
|
lastCompile: o,
|
|
123
|
-
history:
|
|
123
|
+
history: ze(r.history, o, Fe),
|
|
124
124
|
nextId: r.nextId + 1,
|
|
125
125
|
lastSnapshot: n
|
|
126
126
|
};
|
|
127
127
|
})
|
|
128
128
|
})), We = () => {
|
|
129
|
-
},
|
|
129
|
+
}, Xe = (e) => {
|
|
130
130
|
switch (e.kind) {
|
|
131
131
|
case "init":
|
|
132
132
|
return "init";
|
|
@@ -137,12 +137,12 @@ var Le = class extends Ce {
|
|
|
137
137
|
case "command":
|
|
138
138
|
return e.command.metadata.description;
|
|
139
139
|
}
|
|
140
|
-
},
|
|
140
|
+
}, ze = (e, t, n) => {
|
|
141
141
|
const r = e.length >= n ? e.length - (n - 1) : 0;
|
|
142
142
|
return [...e.slice(r), t];
|
|
143
143
|
};
|
|
144
|
-
function
|
|
145
|
-
const t = e.filter(oe), n = /* @__PURE__ */ new Set([...Object.keys(
|
|
144
|
+
function Je(e) {
|
|
145
|
+
const t = e.filter(oe), n = /* @__PURE__ */ new Set([...Object.keys(le), ...t.map((d) => d.geom)]), r = [], o = /* @__PURE__ */ new Set();
|
|
146
146
|
for (const d of e) {
|
|
147
147
|
const u = Be(d);
|
|
148
148
|
u === null || n.has(u.type) || o.has(u.type) || (o.add(u.type), r.push({
|
|
@@ -185,7 +185,7 @@ function Qe(e) {
|
|
|
185
185
|
warnings: i
|
|
186
186
|
};
|
|
187
187
|
}
|
|
188
|
-
function
|
|
188
|
+
function Qe(e, t) {
|
|
189
189
|
const { coordSystem: n, layers: r } = e, o = /* @__PURE__ */ new Set(), a = [];
|
|
190
190
|
for (const i of r)
|
|
191
191
|
t(i.geom, n.type) !== null || o.has(i.geom) || (o.add(i.geom), a.push({
|
|
@@ -296,21 +296,21 @@ var st = (e) => F((t) => ({
|
|
|
296
296
|
scene: e,
|
|
297
297
|
setScene: (n) => t((r) => r.scene === n ? r : { scene: n })
|
|
298
298
|
})), ot = ({ spec: e, data: t, customPalettes: n, colorScheme: r, plugins: o, resolveRenderer: a, anchorResolver: i, onSpecChange: d, onError: u, onWarnings: m }) => {
|
|
299
|
-
const N =
|
|
299
|
+
const N = A(d), k = A(u), q = A(m), [{ session: g, compileBus: l }] = T(() => {
|
|
300
300
|
const s = Se({ plugins: o });
|
|
301
301
|
return {
|
|
302
302
|
session: new fe(s),
|
|
303
303
|
compileBus: Ye(s)
|
|
304
304
|
};
|
|
305
|
-
}), [p] = T(() =>
|
|
305
|
+
}), [p] = T(() => Je(o ?? [])), y = J(null), [D] = T(it), R = J(null), S = f((s) => p.errors.length === 0 ? s : [...p.errors, ...s ?? []], [p]), w = f((s) => {
|
|
306
306
|
if (!s.ok) return s.errors;
|
|
307
307
|
if (R.current) R.current.getState().setScene(s.scene);
|
|
308
308
|
else {
|
|
309
309
|
const h = st(s.scene);
|
|
310
|
-
h.subscribe(
|
|
310
|
+
h.subscribe(D.notify), R.current = h, D.notify();
|
|
311
311
|
}
|
|
312
312
|
return null;
|
|
313
|
-
}, [
|
|
313
|
+
}, [D]), [M, _] = T(() => {
|
|
314
314
|
const s = g.compile({
|
|
315
315
|
spec: e,
|
|
316
316
|
data: t,
|
|
@@ -320,7 +320,7 @@ var st = (e) => F((t) => ({
|
|
|
320
320
|
return y.current = s, S(w(s));
|
|
321
321
|
}), G = f((s) => s.ok ? [
|
|
322
322
|
...s.warnings,
|
|
323
|
-
...
|
|
323
|
+
...Qe(s.scene, a),
|
|
324
324
|
...Ze(s.scene, a),
|
|
325
325
|
...et(s.scene),
|
|
326
326
|
...tt(s.scene, a),
|
|
@@ -328,19 +328,19 @@ var st = (e) => F((t) => ({
|
|
|
328
328
|
...rt(s.scene, i)
|
|
329
329
|
] : s.warnings, [a, i]), b = f((s) => {
|
|
330
330
|
s.length !== 0 && (K(s), k.current?.(s));
|
|
331
|
-
}, [k]),
|
|
332
|
-
s.length !== 0 && (K(s),
|
|
333
|
-
}, [
|
|
334
|
-
|
|
331
|
+
}, [k]), C = f((s) => {
|
|
332
|
+
s.length !== 0 && (K(s), q.current?.(s));
|
|
333
|
+
}, [q]);
|
|
334
|
+
x(() => {
|
|
335
335
|
const s = y.current;
|
|
336
|
-
s && (b([...p.errors, ...s.ok ? [] : s.errors]),
|
|
336
|
+
s && (b([...p.errors, ...s.ok ? [] : s.errors]), C([...p.warnings, ...G(s)]), s.ok && l.emit({ kind: "init" }));
|
|
337
337
|
}, [
|
|
338
338
|
l,
|
|
339
339
|
b,
|
|
340
|
-
|
|
340
|
+
C,
|
|
341
341
|
p,
|
|
342
342
|
G
|
|
343
|
-
]),
|
|
343
|
+
]), x(() => {
|
|
344
344
|
const s = g.update({
|
|
345
345
|
spec: e,
|
|
346
346
|
data: t,
|
|
@@ -350,7 +350,7 @@ var st = (e) => F((t) => ({
|
|
|
350
350
|
if (!s) return;
|
|
351
351
|
s.committedSpec && N.current?.(s.committedSpec);
|
|
352
352
|
const h = w(s.result);
|
|
353
|
-
_(S(h)), h && b(h),
|
|
353
|
+
_(S(h)), h && b(h), C(G(s.result)), h || l.emit({ kind: s.specChanged ? "spec" : "data" });
|
|
354
354
|
}, [
|
|
355
355
|
e,
|
|
356
356
|
t,
|
|
@@ -360,35 +360,35 @@ var st = (e) => F((t) => ({
|
|
|
360
360
|
l,
|
|
361
361
|
w,
|
|
362
362
|
b,
|
|
363
|
-
|
|
363
|
+
C,
|
|
364
364
|
S,
|
|
365
365
|
G,
|
|
366
366
|
N
|
|
367
367
|
]);
|
|
368
|
-
const
|
|
369
|
-
_((h) => h === null ? h : S(null)),
|
|
368
|
+
const I = f((s) => {
|
|
369
|
+
_((h) => h === null ? h : S(null)), C(G(s));
|
|
370
370
|
}, [
|
|
371
371
|
S,
|
|
372
|
-
|
|
372
|
+
C,
|
|
373
373
|
G
|
|
374
374
|
]), P = f((s) => {
|
|
375
|
-
s.scene && R.current?.getState().setScene(s.scene), s.result &&
|
|
375
|
+
s.scene && R.current?.getState().setScene(s.scene), s.result && I(s.result), s.command && l.emit({
|
|
376
376
|
kind: "command",
|
|
377
377
|
command: s.command
|
|
378
378
|
}), s.spec && N.current?.(s.spec), s.errors && b([...s.errors]);
|
|
379
379
|
}, [
|
|
380
|
-
|
|
380
|
+
I,
|
|
381
381
|
l,
|
|
382
382
|
N,
|
|
383
383
|
b
|
|
384
384
|
]), E = f((s) => {
|
|
385
385
|
for (const h of s) P(h);
|
|
386
386
|
return s.some((h) => !!h.scene);
|
|
387
|
-
}, [P]),
|
|
387
|
+
}, [P]), O = f((s, h) => {
|
|
388
388
|
E(g.applyCommand(s, h));
|
|
389
389
|
}, [g, E]), ae = f(() => {
|
|
390
390
|
E(g.commit());
|
|
391
|
-
}, [g, E]), V = f(() => E(g.undo()), [g, E]), W = f(() => E(g.redo()), [g, E]), ce =
|
|
391
|
+
}, [g, E]), V = f(() => E(g.undo()), [g, E]), W = f(() => E(g.redo()), [g, E]), ce = H(() => ({
|
|
392
392
|
stack: g.history,
|
|
393
393
|
undo: V,
|
|
394
394
|
redo: W
|
|
@@ -399,10 +399,10 @@ var st = (e) => F((t) => ({
|
|
|
399
399
|
]), de = f(() => R.current?.getState().scene ?? null, []);
|
|
400
400
|
return {
|
|
401
401
|
store: R.current,
|
|
402
|
-
dispatch:
|
|
402
|
+
dispatch: O,
|
|
403
403
|
commit: ae,
|
|
404
404
|
history: ce,
|
|
405
|
-
subscribe:
|
|
405
|
+
subscribe: D.subscribe,
|
|
406
406
|
getScene: de,
|
|
407
407
|
compileBus: l,
|
|
408
408
|
compileErrors: M
|
|
@@ -416,7 +416,7 @@ var st = (e) => F((t) => ({
|
|
|
416
416
|
notify: () => e.forEach((t) => t())
|
|
417
417
|
};
|
|
418
418
|
}, at = ({ data: e, spec: t, plugins: n = [], formattingLocale: r, handleRef: o, onSpecChange: a, onError: i, onWarnings: d, customPalettes: u, colorScheme: m = "light", children: N }) => {
|
|
419
|
-
const [k] = T(() =>
|
|
419
|
+
const [k] = T(() => ge(n.filter(oe))), q = Ge(), [g] = T(() => ye(n)), [l] = T(() => Ke()), p = H(() => Ee({ colorScheme: m }), [m]), { store: y, dispatch: D, commit: R, history: S, subscribe: w, getScene: M, compileBus: _, compileErrors: G } = ot({
|
|
420
420
|
spec: t,
|
|
421
421
|
data: e,
|
|
422
422
|
customPalettes: u,
|
|
@@ -428,18 +428,18 @@ var st = (e) => F((t) => ({
|
|
|
428
428
|
onError: i,
|
|
429
429
|
onWarnings: d
|
|
430
430
|
});
|
|
431
|
-
|
|
431
|
+
x(() => {
|
|
432
432
|
if (y)
|
|
433
|
-
return y.subscribe((
|
|
434
|
-
if (
|
|
435
|
-
const { selection: E, setSelection:
|
|
436
|
-
E.length !== 0 &&
|
|
433
|
+
return y.subscribe((I, P) => {
|
|
434
|
+
if (I.scene.spec === P.scene.spec) return;
|
|
435
|
+
const { selection: E, setSelection: O } = l.getState();
|
|
436
|
+
E.length !== 0 && O(Oe(E, I.scene.spec));
|
|
437
437
|
});
|
|
438
438
|
}, [y, l]);
|
|
439
|
-
const b =
|
|
440
|
-
dispatch:
|
|
439
|
+
const b = H(() => ({
|
|
440
|
+
dispatch: D,
|
|
441
441
|
commit: R
|
|
442
|
-
}), [
|
|
442
|
+
}), [D, R]);
|
|
443
443
|
ke(o, () => ({
|
|
444
444
|
commands: b,
|
|
445
445
|
undo: S.undo,
|
|
@@ -447,7 +447,7 @@ var st = (e) => F((t) => ({
|
|
|
447
447
|
subscribe: w,
|
|
448
448
|
getScene: M,
|
|
449
449
|
getSelection: () => l.getState().selection,
|
|
450
|
-
setSelection: (
|
|
450
|
+
setSelection: (I) => l.getState().setSelection(I),
|
|
451
451
|
subscribeSelection: l.subscribe
|
|
452
452
|
}), [
|
|
453
453
|
b,
|
|
@@ -456,8 +456,8 @@ var st = (e) => F((t) => ({
|
|
|
456
456
|
M,
|
|
457
457
|
l
|
|
458
458
|
]);
|
|
459
|
-
const
|
|
460
|
-
chartId:
|
|
459
|
+
const C = H(() => y ? {
|
|
460
|
+
chartId: q,
|
|
461
461
|
store: y,
|
|
462
462
|
selectionStore: l,
|
|
463
463
|
commands: b,
|
|
@@ -468,7 +468,7 @@ var st = (e) => F((t) => ({
|
|
|
468
468
|
styleResolver: p,
|
|
469
469
|
anchorResolver: g
|
|
470
470
|
} : null, [
|
|
471
|
-
|
|
471
|
+
q,
|
|
472
472
|
y,
|
|
473
473
|
l,
|
|
474
474
|
b,
|
|
@@ -483,8 +483,8 @@ var st = (e) => F((t) => ({
|
|
|
483
483
|
forcedErrors: G,
|
|
484
484
|
onError: i,
|
|
485
485
|
resetKeys: [t, e],
|
|
486
|
-
children:
|
|
487
|
-
value:
|
|
486
|
+
children: C ? /* @__PURE__ */ c(me.Provider, {
|
|
487
|
+
value: C,
|
|
488
488
|
children: /* @__PURE__ */ c(ue, {
|
|
489
489
|
value: k,
|
|
490
490
|
children: N
|
|
@@ -492,7 +492,7 @@ var st = (e) => F((t) => ({
|
|
|
492
492
|
}) : null
|
|
493
493
|
});
|
|
494
494
|
};
|
|
495
|
-
function
|
|
495
|
+
function Er(e) {
|
|
496
496
|
const t = be(e);
|
|
497
497
|
return {
|
|
498
498
|
...t,
|
|
@@ -502,7 +502,7 @@ function br(e) {
|
|
|
502
502
|
})
|
|
503
503
|
};
|
|
504
504
|
}
|
|
505
|
-
var
|
|
505
|
+
var Tr = ({ children: e, ...t }) => /* @__PURE__ */ c("svg", {
|
|
506
506
|
viewBox: "0 0 1 1",
|
|
507
507
|
preserveAspectRatio: "none",
|
|
508
508
|
width: "100%",
|
|
@@ -510,7 +510,7 @@ var Er = ({ children: e, ...t }) => /* @__PURE__ */ c("svg", {
|
|
|
510
510
|
pointerEvents: "none",
|
|
511
511
|
...t,
|
|
512
512
|
children: e
|
|
513
|
-
}),
|
|
513
|
+
}), Nr = ({ box: e, children: t }) => /* @__PURE__ */ c("svg", {
|
|
514
514
|
x: L(e.x0),
|
|
515
515
|
y: L(e.y0),
|
|
516
516
|
width: L(e.x1 - e.x0),
|
|
@@ -530,16 +530,16 @@ var Et = "drqe3uh", Tt = "drqe3ui", re = {
|
|
|
530
530
|
ran: "drqe3uq drqe3up",
|
|
531
531
|
cached: "drqe3ur drqe3up",
|
|
532
532
|
untouched: "drqe3us drqe3up"
|
|
533
|
-
},
|
|
533
|
+
}, Rr = ({ width: e = 440, style: t, className: n } = {}) => {
|
|
534
534
|
const { compileBus: r } = se(), [o] = T(() => Ve()), [a, i] = T(!1), [d, u] = T(Ne);
|
|
535
|
-
|
|
535
|
+
x(() => {
|
|
536
536
|
const { recordCompile: l } = o.getState(), p = r.getLastTrigger(), y = r.getLastCompile();
|
|
537
537
|
return p && y && l(p, y), r.subscribe(l);
|
|
538
538
|
}, [o, r]);
|
|
539
|
-
const m =
|
|
539
|
+
const m = Q(o, (l) => l.lastCompile), N = Q(o, (l) => l.history), k = r.getCacheStats(), q = m === null && N.length === 0, g = () => {
|
|
540
540
|
u((l) => {
|
|
541
541
|
const p = !l;
|
|
542
|
-
return
|
|
542
|
+
return Ce(p), p;
|
|
543
543
|
});
|
|
544
544
|
};
|
|
545
545
|
return /* @__PURE__ */ v("div", {
|
|
@@ -556,7 +556,7 @@ var Et = "drqe3uh", Tt = "drqe3ui", re = {
|
|
|
556
556
|
children: "compile cache"
|
|
557
557
|
}), /* @__PURE__ */ c("div", {
|
|
558
558
|
className: St,
|
|
559
|
-
children:
|
|
559
|
+
children: q ? "production: stats disabled" : m ? `last: ${m.label} · ${Y(m.durationMs)}` : "awaiting first compile…"
|
|
560
560
|
})] }), /* @__PURE__ */ c("button", {
|
|
561
561
|
type: "button",
|
|
562
562
|
onClick: () => i((l) => !l),
|
|
@@ -577,7 +577,7 @@ var Et = "drqe3uh", Tt = "drqe3ui", re = {
|
|
|
577
577
|
children: "next compile reflects this toggle"
|
|
578
578
|
})]
|
|
579
579
|
}),
|
|
580
|
-
!a && !
|
|
580
|
+
!a && !q && /* @__PURE__ */ v(Ie, { children: [/* @__PURE__ */ c(Nt, {
|
|
581
581
|
delta: m?.stages,
|
|
582
582
|
durations: m?.stageDurationsMs,
|
|
583
583
|
cumulative: k
|
|
@@ -615,7 +615,7 @@ var Et = "drqe3uh", Tt = "drqe3ui", re = {
|
|
|
615
615
|
})
|
|
616
616
|
]
|
|
617
617
|
}) }), /* @__PURE__ */ c("tbody", { children: j.map((r) => {
|
|
618
|
-
const o = e?.[r], a =
|
|
618
|
+
const o = e?.[r], a = Ct(o);
|
|
619
619
|
return /* @__PURE__ */ v("tr", {
|
|
620
620
|
className: vt,
|
|
621
621
|
children: [
|
|
@@ -659,7 +659,7 @@ var Et = "drqe3uh", Tt = "drqe3ui", re = {
|
|
|
659
659
|
className: Tt,
|
|
660
660
|
children: "recent compiles"
|
|
661
661
|
}), e.map((t) => {
|
|
662
|
-
const n =
|
|
662
|
+
const n = qt(t.stages, (a) => a.misses > 0), r = j.length;
|
|
663
663
|
return /* @__PURE__ */ v("div", {
|
|
664
664
|
className: gt,
|
|
665
665
|
children: [
|
|
@@ -685,13 +685,13 @@ var Et = "drqe3uh", Tt = "drqe3ui", re = {
|
|
|
685
685
|
]
|
|
686
686
|
}, t.id);
|
|
687
687
|
})]
|
|
688
|
-
}),
|
|
688
|
+
}), Ct = (e) => !e || e.hits === 0 && e.misses === 0 ? "untouched" : e.misses > 0 ? "ran" : "cached", qt = (e, t) => {
|
|
689
689
|
let n = 0;
|
|
690
690
|
for (const r of j) t(e[r]) && (n += 1);
|
|
691
691
|
return n;
|
|
692
|
-
}, Y = (e) => e < 0.1 ? "<0.1ms" : e >= 10 ? `${e.toFixed(0)}ms` : `${e.toFixed(2)}ms`,
|
|
693
|
-
const { history: e } = se(), { stack: t, undo: n, redo: r } = e, o = f((d) => t.subscribe(d), [t]), a = f(() => t.getSnapshot(), [t]), i =
|
|
694
|
-
return
|
|
692
|
+
}, Y = (e) => e < 0.1 ? "<0.1ms" : e >= 10 ? `${e.toFixed(0)}ms` : `${e.toFixed(2)}ms`, Cr = () => {
|
|
693
|
+
const { history: e } = se(), { stack: t, undo: n, redo: r } = e, o = f((d) => t.subscribe(d), [t]), a = f(() => t.getSnapshot(), [t]), i = De(o, a, a);
|
|
694
|
+
return H(() => ({
|
|
695
695
|
...i,
|
|
696
696
|
undo: n,
|
|
697
697
|
redo: r
|
|
@@ -713,11 +713,11 @@ var Et = "drqe3uh", Tt = "drqe3ui", re = {
|
|
|
713
713
|
"submit"
|
|
714
714
|
]), qr = (e, t = {}) => {
|
|
715
715
|
const { target: n, enabled: r = !0 } = t;
|
|
716
|
-
|
|
716
|
+
x(() => {
|
|
717
717
|
const o = kt(n);
|
|
718
718
|
if (!r || !o) return;
|
|
719
719
|
const a = (i) => {
|
|
720
|
-
if (!
|
|
720
|
+
if (!Dt(i) || i.defaultPrevented || It(i.target)) return;
|
|
721
721
|
const d = he(i);
|
|
722
722
|
if (!d) return;
|
|
723
723
|
const u = e.current;
|
|
@@ -729,51 +729,52 @@ var Et = "drqe3uh", Tt = "drqe3ui", re = {
|
|
|
729
729
|
n,
|
|
730
730
|
r
|
|
731
731
|
]);
|
|
732
|
-
}, kt = (e) => e === void 0 ? window : e !== null && "current" in e ? e.current : e,
|
|
732
|
+
}, kt = (e) => e === void 0 ? window : e !== null && "current" in e ? e.current : e, Dt = (e) => "key" in e, It = (e) => e instanceof HTMLInputElement ? !Gt.has(e.type) : e instanceof HTMLElement ? e.isContentEditable || e.tagName === "TEXTAREA" : !1;
|
|
733
733
|
export {
|
|
734
734
|
Lt as BrandMark,
|
|
735
|
-
|
|
735
|
+
Bt as CanvasTextMeasurer,
|
|
736
736
|
_t as DefaultFooter,
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
737
|
+
dr as DefaultGrid,
|
|
738
|
+
mr as DefaultHeader,
|
|
739
|
+
At as DefaultSwatch,
|
|
740
|
+
ir as DefaultTooltip,
|
|
741
|
+
Rr as DevToolsPanel,
|
|
742
|
+
Qt as GRAPH_MODES,
|
|
743
743
|
Le as GraphErrorBoundary,
|
|
744
744
|
Z as GraphErrorPanel,
|
|
745
745
|
at as GraphProvider,
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
746
|
+
Jt as GraphRenderer,
|
|
747
|
+
jt as HoverProvider,
|
|
748
|
+
$t as TextMeasurerProvider,
|
|
749
|
+
Zt as ThemeProvider,
|
|
750
|
+
Nr as UnitBoxSvg,
|
|
751
|
+
Tr as UnitSpaceSvg,
|
|
752
|
+
Er as createGraphyKit,
|
|
753
|
+
nr as darkTheme,
|
|
754
|
+
Kt as defineGeomRenderer,
|
|
755
|
+
er as lightTheme,
|
|
756
|
+
Ot as lightenCss,
|
|
757
|
+
Oe as pruneSelection,
|
|
758
|
+
Vt as resolveBrandMarkVisual,
|
|
759
|
+
Ut as stampAxisEditTarget,
|
|
760
|
+
Ft as stampGridEditTarget,
|
|
761
761
|
Pt as stampLegendEditTarget,
|
|
762
|
-
|
|
762
|
+
Ht as useElementScreenRect,
|
|
763
763
|
Mt as useGeomHitTest,
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
764
|
+
Yt as useGeomHover,
|
|
765
|
+
sr as useGraphCommands,
|
|
766
|
+
tr as useGraphHandle,
|
|
767
|
+
Cr as useGraphHistory,
|
|
768
768
|
qr as useGraphHistoryShortcuts,
|
|
769
|
-
|
|
769
|
+
zt as useGraphSelection,
|
|
770
770
|
xt as useGuidesTakePress,
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
771
|
+
ar as useHandleScene,
|
|
772
|
+
lr as useHoverState,
|
|
773
|
+
Wt as useResolvedStyle,
|
|
774
|
+
rr as useSceneSelector,
|
|
775
|
+
ur as useStyleReaderTree,
|
|
776
|
+
or as useStyleReaders,
|
|
777
|
+
cr as useStyleResolver,
|
|
778
|
+
Xt as useTextMeasurer,
|
|
779
|
+
hr as vars
|
|
779
780
|
};
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"visualization",
|
|
12
12
|
"renderer"
|
|
13
13
|
],
|
|
14
|
-
"version": "1.9.0-beta.
|
|
14
|
+
"version": "1.9.0-beta.1789747103525",
|
|
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.
|
|
58
|
+
"@graphysdk/viz-engine": "1.9.0-beta.1789747103525"
|
|
59
59
|
},
|
|
60
60
|
"peerDependencies": {
|
|
61
61
|
"@tiptap/core": "^3.0.0",
|