@graphysdk/react-renderer 1.9.0-beta.1794586691328 → 1.9.0-beta.1794840107396
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 +5 -6
- package/dist/editable.mjs +3455 -3446
- package/dist/{history-chords-D6QY_KYF.js → history-chords-BmkhK-8B.js} +2901 -2903
- package/dist/history-chords-DOEwIeNg.cjs +2 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +6 -5
- package/dist/index.mjs +472 -470
- package/package.json +4 -4
- package/dist/history-chords-DMIXDx00.cjs +0 -2
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('./index.css');const s=require("./history-chords-DMIXDx00.cjs");let m=require("@graphysdk/viz-engine"),u=require("react"),i=require("react/jsx-runtime"),W=require("zustand"),U=require("motion/react"),Q=require("zustand/vanilla"),Y=require("clsx");Y=s.__toESM(Y,1);var Se="_1a5iqpb0",ye="_1a5iqpb1";var Ge="_1a5iqpb3",be="_1a5iqpb4",Te="_1a5iqpb5";var X=({errors:e})=>{const[t,...r]=e;return(0,i.jsxs)("div",{role:"alert",className:Se,children:[(0,i.jsx)("strong",{className:ye,children:"This chart could not be rendered."}),t&&(0,i.jsx)(Z,{diagnostic:t}),r.length>0&&(0,i.jsx)("ul",{className:"_1a5iqpb2",children:r.map((n,o)=>(0,i.jsx)("li",{children:(0,i.jsx)(Z,{diagnostic:n})},`${n.code}-${o}`))})]})},Z=({diagnostic:e})=>(0,i.jsxs)("div",{className:Ge,children:[(0,i.jsx)("span",{className:be,children:e.code}),(0,i.jsx)("p",{className:Te,children:e.message}),e.suggestion&&(0,i.jsx)("p",{className:"_1a5iqpb6",children:e.suggestion})]});function xe(e=[],t=[]){return e.length===t.length&&e.every((r,n)=>Object.is(r,t[n]))}var ae=class extends u.Component{constructor(...e){super(...e),this.state={caughtDiagnostic:null}}static getDerivedStateFromError(e){return{caughtDiagnostic:(0,m.buildDiagnostic)(e)}}componentDidCatch(e,t){const r=(0,m.buildDiagnostic)(e);s.logDiagnostics([r]),this.props.onError?.([r]),console.error("Chart render component stack:",t.componentStack)}componentDidUpdate(e){this.state.caughtDiagnostic&&!xe(e.resetKeys,this.props.resetKeys)&&this.setState({caughtDiagnostic:null})}render(){const{caughtDiagnostic:e}=this.state;if(e)return(0,i.jsx)(X,{errors:[e]});const{forcedErrors:t,children:r}=this.props;return t&&t.length>0?(0,i.jsx)(X,{errors:t}):r}},ce=e=>typeof e=="object"&&"geom"in e&&"render"in e,le=e=>{const t=(0,m.resolveDefinition)(e);return t instanceof m.Geom?t:null},ue=(e,t)=>{const r=e.filter(n=>Ee(n,t));return r.length===e.length?e:r},Ee=(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,ee=[],Re=()=>(0,Q.createStore)(e=>({selection:ee,setSelection:t=>e(r=>Pe(r.selection,t)?r:{selection:t}),clearSelection:()=>e(t=>t.selection.length===0?t:{selection:ee})})),Pe=(e,t)=>e===t?!0:e.length!==t.length?!1:e.every((r,n)=>{const o=t[n];return o!==void 0&&(0,m.areEditTargetsEqual)(r,o)}),Ce=5,Ie=e=>{if(!s.IS_DEV)return{emit:()=>{},subscribe:()=>je,getLastTrigger:()=>null,getLastCompile:()=>null,getCacheStats:()=>e.getCacheStats()};const t=new Set;let r=null;return{emit:n=>{const o=e.getLastCompile();if(o){r=n;for(const c of t)c(n,o)}},subscribe:n=>(t.add(n),()=>{t.delete(n)}),getLastTrigger:()=>r,getLastCompile:()=>e.getLastCompile(),getCacheStats:()=>e.getCacheStats()}},Ne=()=>(0,Q.createStore)(e=>({lastCompile:null,history:[],nextId:1,lastSnapshot:null,recordCompile:(t,r)=>e(n=>{if(n.lastSnapshot===r)return n;const o={id:n.nextId,label:De(t),stages:r.stages,stageDurationsMs:r.stageDurationsMs,durationMs:r.durationMs};return{lastCompile:o,history:we(n.history,o,Ce),nextId:n.nextId+1,lastSnapshot:r}})})),je=()=>{},De=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}},we=(e,t,r)=>{const n=e.length>=r?e.length-(r-1):0;return[...e.slice(n),t]};function te(e){const t=e.filter(ce),r=new Set([...Object.keys(s.BUILT_IN_GEOM_RENDERERS),...t.map(d=>d.geom)]),n=[],o=new Set;for(const d of e){const h=le(d);h===null||r.has(h.type)||o.has(h.type)||(o.add(h.type),n.push({kind:"userInput",severity:"error",code:"MISSING_GEOM_RENDERER",message:`Custom geom '${h.type}' is registered but has no renderer.`,context:{requested:h.type,kind:"geom-renderer"},suggestion:`Add a render half for it: \`defineGeomRenderer(${h.type}Geom, { coord, render })\`, then include it in \`plugins\`.`}))}const c=new Map;for(const d of t){if("definition"in d)continue;const h=`${d.geom}|${d.coord}`,v=c.get(h);v?v.count+=1:c.set(h,{geom:d.geom,coord:d.coord,count:1})}const l=[];for(const{geom:d,coord:h,count:v}of c.values())v<2||l.push({kind:"userInput",severity:"warning",code:"DUPLICATE_REGISTERED_TYPE",message:`Multiple render-only overrides register ('${d}', '${h}') (${v} entries); the last in the array wins.`,context:{requested:`${d}@${h}`,kind:"geom-renderer"},suggestion:`Keep a single render-only override for ('${d}', '${h}').`});return l.push(...Oe(e)),{errors:n,warnings:l}}function Le(e,t){const{coordSystem:r,layers:n}=e,o=new Set,c=[];for(const l of n)t(l.geom,r.type)!==null||o.has(l.geom)||(o.add(l.geom),c.push({kind:"userInput",severity:"warning",code:"MISSING_GEOM_RENDERER",message:`No renderer for geom '${l.geom}' under ${r.type} coords; the layer is not painted.`,context:{requested:l.geom,kind:"geom-renderer"},suggestion:`Register a renderer for ('${l.geom}', '${r.type}') via \`defineGeomRenderer\`.`}));return c}function _e(e,t){const{coordSystem:r,layers:n}=e,o=new Set,c=[];for(const l of n){if(l.interactive===!1||l.spatialKind!=="renderHitTest"||o.has(l.geom))continue;const d=t(l.geom,r.type);d===null||d.hitTest||s.isLiveRender(d)||(o.add(l.geom),c.push({kind:"userInput",severity:"warning",code:"MISSING_RENDER_HIT_TEST",message:`Geom '${l.geom}' declares spatialKind 'renderHitTest' but its renderer provides no hit-test; the layer has no hover.`,context:{requested:l.geom,kind:"geom-renderer"},suggestion:`Add a \`hitTest\` factory (precomputed geometry) or a live render (\`{ fn, options: { live: true } }\`, live simulation) to the renderer for ('${l.geom}', '${r.type}').`}))}return c}function ke(e){const t=new Set,r=[];for(const n of e.layers){const o=n.identityKey;n.interactive!==!1&&(n.spatialKind!=="renderHitTest"||typeof o!="object"||t.has(n.geom)||n.data.hasVariable(o.variable)||(t.add(n.geom),r.push({kind:"userInput",severity:"warning",code:"RENDER_HIT_TEST_IDENTITY",message:`Geom '${n.geom}' keys its identity on '${o.variable}', a column its compile output does not emit; its hover lookup is empty.`,context:{requested:n.geom,kind:"geom-renderer"},suggestion:`Emit the '${o.variable}' column from the geom's \`compile()\`, or point \`identityKey\` at a column it does emit.`})))}return r}function qe(e,t){const{coordSystem:r,layers:n}=e,o=new Set,c=[];for(const l of n){if(l.interactive===!1||l.spatialKind!=="renderHitTest"||o.has(l.geom))continue;const d=t(l.geom,r.type);d===null||!d.hitTest||!s.isLiveRender(d)||(o.add(l.geom),c.push({kind:"userInput",severity:"warning",code:"CONFLICTING_RENDER_HIT_TEST",message:`Geom '${l.geom}' declares both a \`hitTest\` factory and a live render; these are alternatives, so only the live render is used.`,context:{requested:l.geom,kind:"geom-renderer"},suggestion:"Keep one: a `hitTest` factory for precomputed geometry, OR a live render (`{ fn, options: { live: true } }`) for a live simulation."}))}return c}function He(e,t){const r=new Set,n=[];for(const o of e.layers)o.interactive!==!1&&(o.spatialKind!=="renderHitTest"||r.has(o.geom)||t.hasCapability(o.geom)||(r.add(o.geom),n.push({kind:"userInput",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 n}function Me(e,t){const{coordSystem:r,layers:n}=e,o=new Set,c=[];for(const l of n){if(l.interactive===!1||l.spatialKind==="renderHitTest"||o.has(l.geom))continue;const d=t(l.geom,r.type);d===null||!s.isLiveRender(d)||(o.add(l.geom),c.push({kind:"userInput",severity:"warning",code:"LIVE_RENDER_REQUIRES_RENDER_HIT_TEST",message:`Geom '${l.geom}' declares a live render but its layer's spatialKind is '${l.spatialKind}', not 'renderHitTest'; its push-path hover resolves to nothing.`,context:{requested:l.geom,kind:"geom-renderer"},suggestion:"Have the geom's manifest yield spatialKind 'renderHitTest' so the scene layer carries the `byKey` index the live render's `pushHover` resolves against."}))}return c}function Ae(e,t){let r;return e.layers.flatMap((n,o)=>s.isLiveRender(t(n.geom,e.coordSystem.type))?$e(n)?(r??=(0,m.createStyleResolver)().readers(e),(r.geom(n).get("overpaint",void 0,"hovered")?.length??0)===0?[]:[{kind:"userInput",severity:"warning",code:"INVALID_STYLE_RULE",message:`Style 'overpaint' in state 'hovered' is not supported on live geom '${n.geom}' (layer '${n.id}'); it is ignored.`,context:{param:"overpaint",layerIndex:o,requested:n.geom},suggestion:"Remove the hovered overpaint, or paint the hover treatment in the geom's live render."}]):[]:[])}var $e=e=>[e.styles.defaults,e.styles.overrides].some(t=>t.some(r=>r.state==="hovered"&&(r.declarations.overpaint?.length??0)>0));function Oe(e){const t=new Set,r=[];for(const n of e){const o=le(n);o===null||t.has(o.type)||o.dataLabelCoordTypes.length===0||o.getDataLabelPlacements!==void 0||(t.add(o.type),r.push({kind:"userInput",severity:"warning",code:"MISSING_DATA_LABEL_PLACEMENT",message:`Geom '${o.type}' declares \`dataLabelCoordTypes\` but implements no \`getDataLabelPlacements\`; its layers paint no data labels.`,context:{requested:o.type,kind:"geom-renderer"},suggestion:"Implement `getDataLabelPlacements(context)` on the geom, or drop `dataLabelCoordTypes` so the compiler warns the author off the flag."}))}return r}var Be=e=>(0,Q.createStore)(t=>({scene:e,setScene:r=>t(n=>n.scene===r?n:{scene:r})})),Fe=({spec:e,data:t,colorScheme:r,plugins:n,theme:o,resolveRenderer:c,anchorResolver:l,onSpecChange:d,onError:h,onWarnings:v})=>{const G=s.useLatestRef(d),N=s.useLatestRef(h),x=s.useLatestRef(v),[{session:p,compileBus:f,findGeom:b}]=(0,u.useState)(()=>{const a=(0,m.createCompiler)({plugins:n,theme:o});return{session:new m.GraphCompilationSession(a),compileBus:Ie(a),findGeom:g=>a.findGeom(g)}}),[S]=(0,u.useState)(()=>{const a=te(n??[]),g=te(o?.plugins??[]);return{errors:[...g.errors,...a.errors],warnings:[...g.warnings,...a.warnings]}}),q=(0,u.useRef)(null),[j]=(0,u.useState)(Ke),T=(0,u.useRef)(null),y=(0,u.useCallback)(a=>S.errors.length===0?a:[...S.errors,...a??[]],[S]),L=(0,u.useCallback)(a=>{if(!a.ok)return a.errors;if(T.current)T.current.getState().setScene(a.scene);else{const g=Be(a.scene);g.subscribe(j.notify),T.current=g,j.notify()}return null},[j]),[$,R]=(0,u.useState)(()=>{const a=p.compile({spec:e,data:t,colorScheme:r});return q.current=a,y(L(a))}),P=(0,u.useCallback)(a=>a.ok?[...a.warnings,...Le(a.scene,c),..._e(a.scene,c),...ke(a.scene),...qe(a.scene,c),...Me(a.scene,c),...Ae(a.scene,c),...He(a.scene,l)]:a.warnings,[c,l]),C=(0,u.useCallback)(a=>{a.length!==0&&(s.logDiagnostics(a),N.current?.(a))},[N]),I=(0,u.useCallback)(a=>{a.length!==0&&(s.logDiagnostics(a),x.current?.(a))},[x]);(0,u.useEffect)(()=>{const a=q.current;a&&(C([...S.errors,...a.ok?[]:a.errors]),I([...S.warnings,...P(a)]),a.ok&&f.emit({kind:"init"}))},[f,C,I,S,P]),(0,u.useEffect)(()=>{const a=p.update({spec:e,data:t,colorScheme:r});if(!a)return;a.committedSpec&&G.current?.(a.committedSpec);const g=L(a.result);R(y(g)),g&&C(g),I(P(a.result)),g||f.emit({kind:a.hasSpecChange?"spec":"data"})},[e,t,r,p,f,L,C,I,y,P,G]);const H=(0,u.useCallback)(a=>{R(g=>g===null?g:y(null)),I(P(a))},[y,I,P]),D=(0,u.useCallback)(a=>{a.scene&&T.current?.getState().setScene(a.scene),a.result&&H(a.result),a.command&&f.emit({kind:"command",command:a.command}),a.spec&&G.current?.(a.spec),a.errors&&C([...a.errors])},[H,f,G,C]),E=(0,u.useCallback)(a=>{for(const g of a)D(g);return a.some(g=>!!g.scene)},[D]),O=(0,u.useCallback)((a,g)=>{E(p.applyCommand(a,g))},[p,E]),B=(0,u.useCallback)(()=>{E(p.commit())},[p,E]),F=(0,u.useCallback)(()=>E(p.undo()),[p,E]),M=(0,u.useCallback)(()=>E(p.redo()),[p,E]),_=(0,u.useCallback)(a=>{const g=p.preview(a).find(ve=>ve.scene)?.scene;return g?(T.current?.getState().setScene(g),!0):!1},[p]),K=(0,u.useCallback)(()=>{const a=p.scene;a&&T.current?.getState().setScene(a)},[p]),w=(0,u.useMemo)(()=>({stack:p.history,undo:F,redo:M}),[p,F,M]),V=(0,u.useCallback)(()=>T.current?.getState().scene??null,[]);return{store:T.current,dispatch:O,commit:B,paintPreview:_,clearPreview:K,history:w,subscribe:j.subscribe,getScene:V,compileBus:f,compileErrors:$,findGeom:b}},Ke=()=>{const e=new Set;return{subscribe:t=>(e.add(t),()=>{e.delete(t)}),notify:()=>e.forEach(t=>t())}},ze=["cartesian","polar"],de=({data:e,spec:t,plugins:r=[],theme:n,glyphs:o,formattingLocale:c,handleRef:l,onSpecChange:d,onError:h,onWarnings:v,colorScheme:G="light",children:N})=>{const x=We(c,v),[p]=(0,u.useState)(()=>n),[f]=(0,u.useState)(()=>s.mergeGlyphs(n?.glyphs,o)),b=p?.colorScheme??G,[S]=(0,u.useState)(()=>s.createGeomRendererResolver([...p?.plugins??[],...r].filter(ce)));Ve(S,f);const q=(0,u.useId)(),[j]=(0,u.useState)(()=>(0,m.createAnchorResolver)(r)),[T]=(0,u.useState)(()=>(0,m.createDataLabelPlacementResolver)(r)),[y]=(0,u.useState)(()=>Re()),[L]=(0,u.useState)(()=>s.createTargetBoundaryStore()),$=(0,u.useMemo)(()=>(0,m.createStyleResolver)({colorScheme:b}),[b]),{store:R,dispatch:P,commit:C,paintPreview:I,clearPreview:H,history:D,subscribe:E,getScene:O,compileBus:B,compileErrors:F,findGeom:M}=Fe({spec:t,data:e,colorScheme:b,plugins:r,theme:p,resolveRenderer:S,anchorResolver:j,onSpecChange:d,onError:h,onWarnings:v});(0,u.useEffect)(()=>{if(R)return R.subscribe((w,V)=>{if(w.scene.spec===V.scene.spec)return;const{selection:a,setSelection:g}=y.getState();a.length!==0&&g(ue(a,w.scene.spec))})},[R,y]);const _=(0,u.useMemo)(()=>({dispatch:P,commit:C,paintPreview:I,clearPreview:H}),[P,C,I,H]);(0,u.useImperativeHandle)(l,()=>({commands:_,undo:D.undo,redo:D.redo,subscribe:E,getScene:O,formattingLocale:x,getSelection:()=>y.getState().selection,setSelection:w=>y.getState().setSelection(w),subscribeSelection:y.subscribe,canPlaceDataLabels:T.hasCapability,canFormatDataLabelsAsPercentages:T.hasPercentageFormat,getGlyphs:()=>f,getPointSymbols:w=>S("point",w)?.symbols}),[_,D,E,O,x,y,T,f,S]);const K=(0,u.useMemo)(()=>R?{chartId:q,store:R,selectionStore:y,targetBoundaryStore:L,commands:_,history:D,formattingLocale:x,compileBus:B,colorScheme:b,styleResolver:$,anchorResolver:j,findGeom:M}:null,[q,R,y,L,_,D,x,B,b,$,j,M]);return(0,i.jsx)(ae,{forcedErrors:F,onError:h,resetKeys:[t,e],children:K?(0,i.jsx)(s.GraphContext.Provider,{value:K,children:(0,i.jsx)(s.GeomRendererResolverProvider,{value:S,children:(0,i.jsx)(s.DataLabelPlacementResolverProvider,{value:T,children:(0,i.jsx)(s.GeomShapesProvider,{shapes:p?.shapes,children:(0,i.jsx)(s.GlyphRegistryProvider,{glyphs:f,children:N})})})})}):null})},Ue=(e,t)=>(e??[]).filter(r=>!(0,m.isGeometricSymbol)(r)&&!t.has(r)),Ve=(e,t)=>{(0,u.useEffect)(()=>{if(!s.IS_DEV)return;const r=new Set(t.map(({name:n})=>n));for(const n of ze)for(const o of Ue(e("point",n)?.symbols,r))console.warn(`[graphy] The ${n} point renderer lists "${o}", but no glyph has that name. The shape menu offers it, and SymbolFigure draws the first listed symbol in its place.`)},[e,t])},We=(e,t)=>{const r=s.useLatestRef(t);return(0,u.useEffect)(()=>{if(e===void 0||(0,m.findIntlLocale)(e)!==void 0)return;const n=[{severity:"warning",kind:"userInput",code:"INVALID_FORMATTING_LOCALE",message:`formattingLocale '${e}' is not a tag Intl can format in, so the chart formats in ${m.DEFAULT_LOCALE}.`}];s.logDiagnostics(n),r.current?.(n)},[e,r]),e===void 0?void 0:(0,m.canonicalizeLocale)(e)};function Ye({theme:e,glyphs:t,...r}={}){const n=(0,m.createSpecBuilder)(r);return{...n,GraphProvider:c=>(0,i.jsx)(de,{...c,plugins:n.plugins,theme:e,glyphs:t})}}var k=(e,t)=>{if(typeof e=="number")return Number.isFinite(e)?e:null;if(!e.endsWith("%"))return null;const r=Number.parseFloat(e);return Number.isFinite(r)?r/100*t:null},Xe=({x:e,y:t,width:r,height:n},o)=>{const c=k(e,o.width),l=k(t,o.height),d=k(r,o.width),h=k(n,o.height);return c===null||l===null||d===null||h===null?null:{x:c,y:l,width:d,height:h}},me=({animateTransitions:e,cx:t,cy:r,r:n,effects:o,...c})=>{const l=s.toGeomEffectsStyle(o);return e?(0,i.jsx)(U.motion.circle,{initial:!1,animate:{cx:t,cy:r,r:n},transition:s.DEFAULT_SPRING_TRANSITION,style:l,...c}):(0,i.jsx)("circle",{cx:t,cy:r,r:n,style:l,...c})},he=({animateTransitions:e,x1:t,y1:r,x2:n,y2:o,effects:c,...l})=>{const d=s.toGeomEffectsStyle(c);return e?(0,i.jsx)(U.motion.line,{initial:!1,animate:{x1:t,y1:r,x2:n,y2:o},transition:s.DEFAULT_SPRING_TRANSITION,style:d,...l}):(0,i.jsx)("line",{x1:t,y1:r,x2:n,y2:o,style:d,...l})},ge=({animateTransitions:e,x:t,y:r,width:n,height:o,rx:c,ry:l,effects:d,...h})=>{const v=s.toGeomEffectsStyle(d);return e?(0,i.jsx)(U.motion.rect,{initial:!1,animate:{attrX:t,attrY:r,width:n,height:o,...c!==void 0&&l!==void 0?{rx:c,ry:l}:{}},transition:s.DEFAULT_SPRING_TRANSITION,style:v,...h}):(0,i.jsx)("rect",{x:t,y:r,width:n,height:o,rx:c,ry:l,style:v,...h})},pe=({animateTransitions:e,d:t,source:r,effects:n,...o})=>{const c=s.toGeomEffectsStyle(n);return e?(0,i.jsx)(tt,{d:t,source:r,style:c,...o}):(0,i.jsx)("path",{d:t,style:c,...o})},Qe=e=>{const{Circle:t}=s.useGeomShapes(),{animateTransitions:r}=s.useGraphAnimation(),{symbol:n,...o}=e,c={...o,animateTransitions:r};return n!==void 0&&n!=="circle"?(0,i.jsx)("g",{style:s.toGeomEffectsStyle(e.effects),"data-testid":e["data-testid"],children:(0,i.jsx)(s.PointSymbol,{symbol:n,cx:re(e.cx),cy:re(e.cy),size:e.r*2,fill:e.fill??"currentColor",fillOpacity:e.fillOpacity,opacity:e.opacity,stroke:e.stroke,strokeOpacity:e.strokeOpacity,strokeWidth:e.strokeWidth,motion:r?{transition:s.DEFAULT_SPRING_TRANSITION,intro:!1,fadesIn:!1}:null})}):t===void 0?me(c):(0,i.jsx)(s.GeomShapesProvider,{children:(0,i.jsx)(t,{...c})})},Je=e=>{const{Line:t}=s.useGeomShapes(),{animateTransitions:r}=s.useGraphAnimation(),n={...e,animateTransitions:r};return t===void 0?he(n):(0,i.jsx)(s.GeomShapesProvider,{children:(0,i.jsx)(t,{...n})})},Ze=({cornerRadius:e,...t})=>{const{Rect:r}=s.useGeomShapes(),n=s.useGeomViewport()?.size??null,o=s.useGeomPixelsPerUnit(),{animateTransitions:c}=s.useGraphAnimation(),l={...t,animateTransitions:c,...rt(e,t,n,o)};return r===void 0?ge(l):(0,i.jsx)(s.GeomShapesProvider,{children:(0,i.jsx)(r,{...l})})},et=e=>{const{Path:t}=s.useGeomShapes(),{animateTransitions:r}=s.useGraphAnimation(),n={...e,animateTransitions:r};return t===void 0?pe(n):(0,i.jsx)(s.GeomShapesProvider,{children:(0,i.jsx)(t,{...n})})},re=e=>typeof e=="number"?`${e}px`:e,tt=({d:e,source:t,...r})=>{const n=s.useSvgPathMorph(e,s.DEFAULT_SPRING_TRANSITION,t);return(0,i.jsx)(U.motion.path,{d:n,...r})},rt=(e,t,r,n)=>{if(e===void 0)return{};const o=(0,m.foldGeomCornerRadii)(e);if(o===void 0)return{};const c=nt(t,r,n);if(c===null)return o==="full"?{}:se((0,m.resolveGeomCornerRadiusPx)({cornerRadius:o}),n);const l=Math.min((0,m.resolveGeomCornerRadiusPx)({cornerRadius:o,box:c}),Math.min(c.width,c.height)/2);return se(l,n)},nt=(e,t,r)=>{const n=ne(e.width,t?.width,r.x),o=ne(e.height,t?.height,r.y);return n===null||o===null?null:{width:n,height:o}},ne=(e,t,r)=>{if(typeof e=="number")return Number.isFinite(e)?Math.abs(e)*r:null;if(t===void 0)return null;const n=k(e,t);return n===null?null:Math.abs(n)},se=(e,t)=>t.x<=0||t.y<=0?{rx:0,ry:0}:{rx:e/t.x,ry:e/t.y},st=({symbol:e,size:t,fill:r,fillOpacity:n,stroke:o,strokeOpacity:c,strokeWidth:l})=>{const d=s.useGlyphRegistry(),h=s.useGeomRendererResolver(),v=s.useSceneSelector(x=>x.coordSystem.type),G=ot(e,h("point",v)?.symbols??[],d),N={size:t,fill:r,fillOpacity:n,stroke:o,strokeOpacity:c,strokeWidth:l};return(0,m.isGeometricSymbol)(G)?(0,i.jsx)("path",{d:(0,m.buildPointSymbolPath)(G,t),fill:r,fillOpacity:n,stroke:o,strokeOpacity:c,strokeWidth:l,strokeLinejoin:"round"}):(0,i.jsx)(s.GlyphMark,{symbol:G,glyphs:d,...N})},ot=(e,t,r)=>(0,m.isImageSymbol)(e)||t.includes(e)||!(0,m.isGeometricSymbol)(e)&&r.has(e)?e:t[0]??"circle",it=({children:e,...t})=>{const r=s.useGeomViewport()?.size??null;return(0,i.jsx)("svg",{viewBox:"0 0 1 1",preserveAspectRatio:"none",width:"100%",height:"100%",pointerEvents:"none",...t,children:(0,i.jsx)(s.GeomViewportProvider,{size:r,space:"unit",children:e})})},at=({box:e,children:t})=>{const r=s.useGeomViewportSize(),n=r===null?null:r.width*(e.x1-e.x0),o=r===null?null:r.height*(e.y1-e.y0),c=(0,u.useMemo)(()=>n===null||o===null?null:{width:n,height:o},[n,o]);return(0,i.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:(0,i.jsx)(s.GeomViewportProvider,{size:c,children:t})})},ct="drqe3u0",lt="drqe3u1",ut="drqe3u2",dt="drqe3u3",A="drqe3u4",mt="drqe3u5",ht="drqe3u6",gt="drqe3u7",z="drqe3u8",pt="drqe3u9",ft="drqe3ua";var vt="drqe3uc",St="drqe3ud",yt="drqe3ue",Gt="drqe3uf";var bt="drqe3uh",Tt="drqe3ui",oe={enabled:"drqe3uk drqe3uj",disabled:"drqe3ul drqe3uj"},ie={ran:"drqe3un drqe3um",dim:"drqe3uo drqe3um"},fe={ran:"drqe3uq drqe3up",cached:"drqe3ur drqe3up",untouched:"drqe3us drqe3up"},xt=({width:e=440,style:t,className:r}={})=>{const{compileBus:n}=s.useGraphContext(),[o]=(0,u.useState)(()=>Ne()),[c,l]=(0,u.useState)(!1),[d,h]=(0,u.useState)(m.isCompilerCachingEnabled);(0,u.useEffect)(()=>{const{recordCompile:f}=o.getState(),b=n.getLastTrigger(),S=n.getLastCompile();return b&&S&&f(b,S),n.subscribe(f)},[o,n]);const v=(0,W.useStore)(o,f=>f.lastCompile),G=(0,W.useStore)(o,f=>f.history),N=n.getCacheStats(),x=v===null&&G.length===0,p=()=>{h(f=>{const b=!f;return(0,m.setCompilerCachingEnabled)(b),b})};return(0,i.jsxs)("div",{className:(0,Y.default)(ft,r),style:{width:e,...t},children:[(0,i.jsxs)("div",{className:ct,children:[(0,i.jsxs)("div",{children:[(0,i.jsx)("div",{className:lt,children:"compile cache"}),(0,i.jsx)("div",{className:yt,children:x?"production: stats disabled":v?`last: ${v.label} · ${J(v.durationMs)}`:"awaiting first compile…"})]}),(0,i.jsx)("button",{type:"button",onClick:()=>l(f=>!f),className:Gt,children:c?"▾":"▴"})]}),!c&&(0,i.jsxs)("div",{className:"drqe3ub",children:[(0,i.jsxs)("button",{type:"button",onClick:p,className:d?oe.enabled:oe.disabled,"aria-pressed":d,children:["cache ",d?"enabled":"disabled"]}),(0,i.jsx)("span",{className:"drqe3ug",children:"next compile reflects this toggle"})]}),!c&&!x&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(Et,{delta:v?.stages,durations:v?.stageDurationsMs,cumulative:N}),(0,i.jsx)(Rt,{entries:G})]})]})},Et=({delta:e,durations:t,cumulative:r})=>(0,i.jsxs)("table",{className:ut,children:[(0,i.jsx)("thead",{children:(0,i.jsxs)("tr",{className:bt,children:[(0,i.jsx)("th",{className:dt,children:"stage"}),(0,i.jsx)("th",{className:A,children:"time"}),(0,i.jsx)("th",{className:A,children:"Δ miss"}),(0,i.jsx)("th",{className:A,children:"Δ hit"}),(0,i.jsx)("th",{className:A,children:"total miss"}),(0,i.jsx)("th",{className:A,children:"total hit"})]})}),(0,i.jsx)("tbody",{children:m.COMPILER_STAGE_KEYS.map(n=>{const o=e?.[n],c=Pt(o);return(0,i.jsxs)("tr",{className:vt,children:[(0,i.jsxs)("td",{className:mt,children:[(0,i.jsx)("span",{className:fe[c],"aria-hidden":!0})," ",n]}),(0,i.jsx)("td",{className:z,children:t===void 0||c==="untouched"?"—":J(t[n])}),(0,i.jsx)("td",{className:c==="ran"?ie.ran:ie.dim,children:o?.misses??0}),(0,i.jsx)("td",{className:z,children:o?.hits??0}),(0,i.jsx)("td",{className:z,children:r[n].misses}),(0,i.jsx)("td",{className:z,children:r[n].hits})]},n)})})]}),Rt=({entries:e})=>e.length===0?null:(0,i.jsxs)("div",{className:St,children:[(0,i.jsx)("div",{className:Tt,children:"recent compiles"}),e.map(t=>{const r=Ct(t.stages,c=>c.misses>0),n=m.COMPILER_STAGE_KEYS.length,o=r===0?"cached":"ran";return(0,i.jsxs)("div",{className:ht,children:[(0,i.jsx)("span",{className:fe[o],"aria-hidden":!0}),(0,i.jsx)("span",{className:gt,title:t.label,children:t.label}),(0,i.jsxs)("span",{className:pt,children:[r,"/",n," ran · ",J(t.durationMs)]})]},t.id)})]}),Pt=e=>!e||e.hits===0&&e.misses===0?"untouched":e.misses>0?"ran":"cached",Ct=(e,t)=>{let r=0;for(const n of m.COMPILER_STAGE_KEYS)t(e[n])&&(r+=1);return r},J=e=>e<.1?"<0.1ms":e>=10?`${e.toFixed(0)}ms`:`${e.toFixed(2)}ms`,It=()=>{const{history:e}=s.useGraphContext(),{stack:t,undo:r,redo:n}=e,o=(0,u.useCallback)(d=>t.subscribe(d),[t]),c=(0,u.useCallback)(()=>t.getSnapshot(),[t]),l=(0,u.useSyncExternalStore)(o,c,c);return(0,u.useMemo)(()=>({...l,undo:r,redo:n}),[l,r,n])},Nt=new Set(["button","checkbox","color","file","hidden","image","radio","range","reset","submit"]),jt=(e,t={})=>{const{target:r,enabled:n=!0}=t;(0,u.useEffect)(()=>{const o=Dt(r);if(!n||!o)return;const c=l=>{if(!wt(l)||l.defaultPrevented||Lt(l.target))return;const d=s.resolveHistoryStep(l);if(!d)return;const h=e.current;h&&(d==="undo"?h.undo():h.redo())&&l.preventDefault()};return o.addEventListener("keydown",c),()=>o.removeEventListener("keydown",c)},[e,r,n])},Dt=e=>e===void 0?window:e!==null&&"current"in e?e.current:e,wt=e=>"key"in e,Lt=e=>e instanceof HTMLInputElement?!Nt.has(e.type):e instanceof HTMLElement?e.isContentEditable||e.tagName==="TEXTAREA":!1,_t=()=>{const{targetBoundaryStore:e}=s.useGraphContext();return(0,W.useStore)(e,t=>t.boundary)};exports.CanvasTextMeasurer=s.CanvasTextMeasurer;exports.DefaultFooter=s.DefaultFooter;exports.DefaultGeomCircle=me;exports.DefaultGeomLine=he;exports.DefaultGeomPath=pe;exports.DefaultGeomRect=ge;exports.DefaultGrid=s.DefaultGrid;exports.DefaultHeader=s.DefaultHeader;exports.DefaultSwatch=s.DefaultSwatch;exports.DefaultTooltip=s.DefaultTooltip;exports.DevToolsPanel=xt;exports.GRAPH_MODES=s.GRAPH_MODES;exports.GeomCircle=Qe;exports.GeomLine=Je;exports.GeomOverpaint=s.GeomOverpaint;exports.GeomPanelSizeProvider=s.GeomPanelSizeProvider;exports.GeomPath=et;exports.GeomRect=Ze;exports.GraphErrorBoundary=ae;exports.GraphErrorPanel=X;exports.GraphProvider=de;exports.GraphRenderer=s.GraphRenderer;exports.GraphyBadge=s.GraphyBadge;exports.HoverProvider=s.HoverProvider;exports.IntlProvider=s.ChartIntlProvider;exports.IntroFade=s.IntroFade;exports.IntroWipeClip=s.IntroWipeClip;exports.SymbolFigure=st;exports.TextMeasurerProvider=s.TextMeasurerProvider;exports.ThemeProvider=s.ThemeProvider;exports.UnitBoxSvg=at;exports.UnitSpaceSvg=it;exports.buildDotsEditOutlineShapes=s.buildDotsEditOutlineShapes;exports.createGraphyKit=Ye;exports.darkTheme=s.darkTheme;exports.defineGeomRenderer=s.defineGeomRenderer;exports.defineGlyph=s.defineGlyph;exports.getBuiltInEditOutlineShapes=s.getBuiltInEditOutlineShapes;exports.lightTheme=s.lightTheme;exports.lightenCss=s.lightenCss;exports.pruneSelection=ue;exports.readPositionPixels=k;exports.readRectPixels=Xe;exports.resolveGraphyBadgeVariant=s.resolveGraphyBadgeVariant;exports.resolvePathStroke=s.resolvePathStroke;exports.scalePointToPanel=s.scalePointToPanel;exports.stampAxisEditTarget=s.stampAxisEditTarget;exports.stampGridEditTarget=s.stampGridEditTarget;exports.stampLegendEditTarget=s.stampLegendEditTarget;exports.useElementScreenRect=s.useElementScreenRect;exports.useFormattingLocale=s.useFormattingLocale;exports.useGeomHitTest=s.useGeomHitTest;exports.useGeomHover=s.useGeomHover;exports.useGeomPanelSize=s.useGeomPanelSize;exports.useGeomReaderTree=s.useGeomReaderTree;exports.useGeomStyleReader=s.useGeomStyleReader;exports.useGeomViewportSize=s.useGeomViewportSize;exports.useGraphAnimation=s.useGraphAnimation;exports.useGraphCommands=s.useGraphCommands;exports.useGraphHandle=s.useGraphHandle;exports.useGraphHistory=It;exports.useGraphHistoryShortcuts=jt;exports.useGraphLocale=s.useGraphLocale;exports.useGraphSelection=s.useGraphSelection;exports.useGuidesTakePress=s.useGuidesTakePress;exports.useHandleScene=s.useHandleScene;exports.useHoverState=s.useHoverState;exports.usePaintDefs=s.usePaintDefs;exports.useResolvedStyle=s.useResolvedStyle;exports.useSceneSelector=s.useSceneSelector;exports.useStyleReaderTree=s.useStyleReaderTree;exports.useStyleResolver=s.useStyleResolver;exports.useTargetBoundary=_t;exports.useTextMeasurer=s.useTextMeasurer;exports.vars=s.vars;
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require('./index.css');const s=require("./history-chords-DOEwIeNg.cjs");let m=require("@graphysdk/viz-engine"),u=require("react"),i=require("react/jsx-runtime"),Y=require("zustand"),V=require("motion/react"),J=require("zustand/vanilla"),X=require("clsx");X=s.__toESM(X,1);var ye="_1a5iqpb0",Ge="_1a5iqpb1";var be="_1a5iqpb3",Te="_1a5iqpb4",xe="_1a5iqpb5";var Q=({errors:e})=>{const[t,...r]=e;return(0,i.jsxs)("div",{role:"alert",className:ye,children:[(0,i.jsx)("strong",{className:Ge,children:"This chart could not be rendered."}),t&&(0,i.jsx)(ee,{diagnostic:t}),r.length>0&&(0,i.jsx)("ul",{className:"_1a5iqpb2",children:r.map((n,o)=>(0,i.jsx)("li",{children:(0,i.jsx)(ee,{diagnostic:n})},`${n.code}-${o}`))})]})},ee=({diagnostic:e})=>(0,i.jsxs)("div",{className:be,children:[(0,i.jsx)("span",{className:Te,children:e.code}),(0,i.jsx)("p",{className:xe,children:e.message}),e.suggestion&&(0,i.jsx)("p",{className:"_1a5iqpb6",children:e.suggestion})]});function Ee(e=[],t=[]){return e.length===t.length&&e.every((r,n)=>Object.is(r,t[n]))}var ce=class extends u.Component{constructor(...e){super(...e),this.state={caughtDiagnostic:null}}static getDerivedStateFromError(e){return{caughtDiagnostic:(0,m.buildDiagnostic)(e)}}componentDidCatch(e,t){const r=(0,m.buildDiagnostic)(e);s.logDiagnostics([r]),this.props.onError?.([r]),console.error("Chart render component stack:",t.componentStack)}componentDidUpdate(e){this.state.caughtDiagnostic&&!Ee(e.resetKeys,this.props.resetKeys)&&this.setState({caughtDiagnostic:null})}render(){const{caughtDiagnostic:e}=this.state;if(e)return(0,i.jsx)(Q,{errors:[e]});const{forcedErrors:t,children:r}=this.props;return t&&t.length>0?(0,i.jsx)(Q,{errors:t}):r}},le=e=>typeof e=="object"&&"geom"in e&&"render"in e,ue=e=>{const t=(0,m.resolveDefinition)(e);return t instanceof m.Geom?t:null},de=(e,t)=>{const r=e.filter(n=>Re(n,t));return r.length===e.length?e:r},Re=(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,te=[],Pe=()=>(0,J.createStore)(e=>({selection:te,setSelection:t=>e(r=>Ce(r.selection,t)?r:{selection:t}),clearSelection:()=>e(t=>t.selection.length===0?t:{selection:te})})),Ce=(e,t)=>e===t?!0:e.length!==t.length?!1:e.every((r,n)=>{const o=t[n];return o!==void 0&&(0,m.areEditTargetsEqual)(r,o)}),Ie=5,Ne=e=>{if(!s.IS_DEV)return{emit:()=>{},subscribe:()=>De,getLastTrigger:()=>null,getLastCompile:()=>null,getCacheStats:()=>e.getCacheStats()};const t=new Set;let r=null;return{emit:n=>{const o=e.getLastCompile();if(o){r=n;for(const c of t)c(n,o)}},subscribe:n=>(t.add(n),()=>{t.delete(n)}),getLastTrigger:()=>r,getLastCompile:()=>e.getLastCompile(),getCacheStats:()=>e.getCacheStats()}},je=()=>(0,J.createStore)(e=>({lastCompile:null,history:[],nextId:1,lastSnapshot:null,recordCompile:(t,r)=>e(n=>{if(n.lastSnapshot===r)return n;const o={id:n.nextId,label:we(t),stages:r.stages,stageDurationsMs:r.stageDurationsMs,durationMs:r.durationMs};return{lastCompile:o,history:Le(n.history,o,Ie),nextId:n.nextId+1,lastSnapshot:r}})})),De=()=>{},we=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}},Le=(e,t,r)=>{const n=e.length>=r?e.length-(r-1):0;return[...e.slice(n),t]};function re(e){const t=e.filter(le),r=new Set([...Object.keys(s.BUILT_IN_GEOM_RENDERERS),...t.map(d=>d.geom)]),n=[],o=new Set;for(const d of e){const h=ue(d);h===null||r.has(h.type)||o.has(h.type)||(o.add(h.type),n.push({kind:"userInput",severity:"error",code:"MISSING_GEOM_RENDERER",message:`Custom geom '${h.type}' is registered but has no renderer.`,context:{requested:h.type,kind:"geom-renderer"},suggestion:`Add a render half for it: \`defineGeomRenderer(${h.type}Geom, { coord, render })\`, then include it in \`plugins\`.`}))}const c=new Map;for(const d of t){if("definition"in d)continue;const h=`${d.geom}|${d.coord}`,f=c.get(h);f?f.count+=1:c.set(h,{geom:d.geom,coord:d.coord,count:1})}const l=[];for(const{geom:d,coord:h,count:f}of c.values())f<2||l.push({kind:"userInput",severity:"warning",code:"DUPLICATE_REGISTERED_TYPE",message:`Multiple render-only overrides register ('${d}', '${h}') (${f} entries); the last in the array wins.`,context:{requested:`${d}@${h}`,kind:"geom-renderer"},suggestion:`Keep a single render-only override for ('${d}', '${h}').`});return l.push(...Be(e)),{errors:n,warnings:l}}function _e(e,t){const{coordSystem:r,layers:n}=e,o=new Set,c=[];for(const l of n)t(l.geom,r.type)!==null||o.has(l.geom)||(o.add(l.geom),c.push({kind:"userInput",severity:"warning",code:"MISSING_GEOM_RENDERER",message:`No renderer for geom '${l.geom}' under ${r.type} coords; the layer is not painted.`,context:{requested:l.geom,kind:"geom-renderer"},suggestion:`Register a renderer for ('${l.geom}', '${r.type}') via \`defineGeomRenderer\`.`}));return c}function ke(e,t){const{coordSystem:r,layers:n}=e,o=new Set,c=[];for(const l of n){if(l.interactive===!1||l.spatialKind!=="renderHitTest"||o.has(l.geom))continue;const d=t(l.geom,r.type);d===null||d.hitTest||s.isLiveRender(d)||(o.add(l.geom),c.push({kind:"userInput",severity:"warning",code:"MISSING_RENDER_HIT_TEST",message:`Geom '${l.geom}' declares spatialKind 'renderHitTest' but its renderer provides no hit-test; the layer has no hover.`,context:{requested:l.geom,kind:"geom-renderer"},suggestion:`Add a \`hitTest\` factory (precomputed geometry) or a live render (\`{ fn, options: { live: true } }\`, live simulation) to the renderer for ('${l.geom}', '${r.type}').`}))}return c}function qe(e){const t=new Set,r=[];for(const n of e.layers){const o=n.identityKey;n.interactive!==!1&&(n.spatialKind!=="renderHitTest"||typeof o!="object"||t.has(n.geom)||n.data.hasVariable(o.variable)||(t.add(n.geom),r.push({kind:"userInput",severity:"warning",code:"RENDER_HIT_TEST_IDENTITY",message:`Geom '${n.geom}' keys its identity on '${o.variable}', a column its compile output does not emit; its hover lookup is empty.`,context:{requested:n.geom,kind:"geom-renderer"},suggestion:`Emit the '${o.variable}' column from the geom's \`compile()\`, or point \`identityKey\` at a column it does emit.`})))}return r}function He(e,t){const{coordSystem:r,layers:n}=e,o=new Set,c=[];for(const l of n){if(l.interactive===!1||l.spatialKind!=="renderHitTest"||o.has(l.geom))continue;const d=t(l.geom,r.type);d===null||!d.hitTest||!s.isLiveRender(d)||(o.add(l.geom),c.push({kind:"userInput",severity:"warning",code:"CONFLICTING_RENDER_HIT_TEST",message:`Geom '${l.geom}' declares both a \`hitTest\` factory and a live render; these are alternatives, so only the live render is used.`,context:{requested:l.geom,kind:"geom-renderer"},suggestion:"Keep one: a `hitTest` factory for precomputed geometry, OR a live render (`{ fn, options: { live: true } }`) for a live simulation."}))}return c}function Me(e,t){const r=new Set,n=[];for(const o of e.layers)o.interactive!==!1&&(o.spatialKind!=="renderHitTest"||r.has(o.geom)||t.hasCapability(o.geom)||(r.add(o.geom),n.push({kind:"userInput",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 n}function Ae(e,t){const{coordSystem:r,layers:n}=e,o=new Set,c=[];for(const l of n){if(l.interactive===!1||l.spatialKind==="renderHitTest"||o.has(l.geom))continue;const d=t(l.geom,r.type);d===null||!s.isLiveRender(d)||(o.add(l.geom),c.push({kind:"userInput",severity:"warning",code:"LIVE_RENDER_REQUIRES_RENDER_HIT_TEST",message:`Geom '${l.geom}' declares a live render but its layer's spatialKind is '${l.spatialKind}', not 'renderHitTest'; its push-path hover resolves to nothing.`,context:{requested:l.geom,kind:"geom-renderer"},suggestion:"Have the geom's manifest yield spatialKind 'renderHitTest' so the scene layer carries the `byKey` index the live render's `pushHover` resolves against."}))}return c}function Oe(e,t){let r;return e.layers.flatMap((n,o)=>s.isLiveRender(t(n.geom,e.coordSystem.type))?$e(n)?(r??=(0,m.createStyleResolver)().readers(e),(r.geom(n).get("overpaint",void 0,"hovered")?.length??0)===0?[]:[{kind:"userInput",severity:"warning",code:"INVALID_STYLE_RULE",message:`Style 'overpaint' in state 'hovered' is not supported on live geom '${n.geom}' (layer '${n.id}'); it is ignored.`,context:{param:"overpaint",layerIndex:o,requested:n.geom},suggestion:"Remove the hovered overpaint, or paint the hover treatment in the geom's live render."}]):[]:[])}var $e=e=>[e.styles.defaults,e.styles.overrides].some(t=>t.some(r=>r.state==="hovered"&&(r.declarations.overpaint?.length??0)>0));function Be(e){const t=new Set,r=[];for(const n of e){const o=ue(n);o===null||t.has(o.type)||o.dataLabelCoordTypes.length===0||o.getDataLabelPlacements!==void 0||(t.add(o.type),r.push({kind:"userInput",severity:"warning",code:"MISSING_DATA_LABEL_PLACEMENT",message:`Geom '${o.type}' declares \`dataLabelCoordTypes\` but implements no \`getDataLabelPlacements\`; its layers paint no data labels.`,context:{requested:o.type,kind:"geom-renderer"},suggestion:"Implement `getDataLabelPlacements(context)` on the geom, or drop `dataLabelCoordTypes` so the compiler warns the author off the flag."}))}return r}var Fe=e=>(0,J.createStore)(t=>({scene:e,setScene:r=>t(n=>n.scene===r?n:{scene:r})})),Ke=({spec:e,data:t,colorScheme:r,plugins:n,theme:o,resolveRenderer:c,anchorResolver:l,onSpecChange:d,onError:h,onWarnings:f})=>{const y=s.useLatestRef(d),j=s.useLatestRef(h),P=s.useLatestRef(f),[{session:v,compileBus:p,findGeom:b}]=(0,u.useState)(()=>{const a=(0,m.createCompiler)({plugins:n,theme:o});return{session:new m.GraphCompilationSession(a),compileBus:Ne(a),findGeom:g=>a.findGeom(g)}}),[S]=(0,u.useState)(()=>{const a=re(n??[]),g=re(o?.plugins??[]);return{errors:[...g.errors,...a.errors],warnings:[...g.warnings,...a.warnings]}}),D=(0,u.useRef)(null),[E]=(0,u.useState)(ze),T=(0,u.useRef)(null),C=(0,u.useCallback)(a=>S.errors.length===0?a:[...S.errors,...a??[]],[S]),w=(0,u.useCallback)(a=>{if(!a.ok)return a.errors;if(T.current)T.current.getState().setScene(a.scene);else{const g=Fe(a.scene);g.subscribe(E.notify),T.current=g,E.notify()}return null},[E]),[R,q]=(0,u.useState)(()=>{const a=v.compile({spec:e,data:t,colorScheme:r});return D.current=a,C(w(a))}),I=(0,u.useCallback)(a=>a.ok?[...a.warnings,..._e(a.scene,c),...ke(a.scene,c),...qe(a.scene),...He(a.scene,c),...Ae(a.scene,c),...Oe(a.scene,c),...Me(a.scene,l)]:a.warnings,[c,l]),G=(0,u.useCallback)(a=>{a.length!==0&&(s.logDiagnostics(a),j.current?.(a))},[j]),N=(0,u.useCallback)(a=>{a.length!==0&&(s.logDiagnostics(a),P.current?.(a))},[P]);(0,u.useEffect)(()=>{const a=D.current;a&&(G([...S.errors,...a.ok?[]:a.errors]),N([...S.warnings,...I(a)]),a.ok&&p.emit({kind:"init"}))},[p,G,N,S,I]),(0,u.useEffect)(()=>{const a=v.update({spec:e,data:t,colorScheme:r});if(!a)return;a.committedSpec&&y.current?.(a.committedSpec);const g=w(a.result);q(C(g)),g&&G(g),N(I(a.result)),g||p.emit({kind:a.hasSpecChange?"spec":"data"})},[e,t,r,v,p,w,G,N,C,I,y]);const H=(0,u.useCallback)(a=>{q(g=>g===null?g:C(null)),N(I(a))},[C,N,I]),M=(0,u.useCallback)(a=>{a.scene&&T.current?.getState().setScene(a.scene),a.result&&H(a.result),a.command&&p.emit({kind:"command",command:a.command}),a.spec&&y.current?.(a.spec),a.errors&&G([...a.errors])},[H,p,y,G]),x=(0,u.useCallback)(a=>{for(const g of a)M(g);return a.some(g=>!!g.scene)},[M]),L=(0,u.useCallback)((a,g)=>{x(v.applyCommand(a,g))},[v,x]),B=(0,u.useCallback)(()=>{x(v.commit())},[v,x]),A=(0,u.useCallback)(()=>x(v.undo()),[v,x]),O=(0,u.useCallback)(()=>x(v.redo()),[v,x]),W=(0,u.useCallback)(a=>{const g=v.preview(a).find(z=>z.scene)?.scene;return g?(T.current?.getState().setScene(g),!0):!1},[v]),F=(0,u.useCallback)(()=>{const a=v.scene;a&&T.current?.getState().setScene(a)},[v]),_=(0,u.useMemo)(()=>({stack:v.history,undo:A,redo:O}),[v,A,O]),K=(0,u.useCallback)(()=>T.current?.getState().scene??null,[]);return{store:T.current,dispatch:L,commit:B,paintPreview:W,clearPreview:F,history:_,subscribe:E.subscribe,getScene:K,compileBus:p,compileErrors:R,findGeom:b}},ze=()=>{const e=new Set;return{subscribe:t=>(e.add(t),()=>{e.delete(t)}),notify:()=>e.forEach(t=>t())}},Ue=["cartesian","polar"],me=({data:e,spec:t,plugins:r=[],theme:n,glyphs:o,formattingLocale:c,handleRef:l,onSpecChange:d,onError:h,onWarnings:f,colorScheme:y="light",mode:j=s.GRAPH_MODES.readonly,children:P})=>{const v=s.resolveGraphMode(j),p=Ye(c,f),[b]=(0,u.useState)(()=>n),[S]=(0,u.useState)(()=>s.mergeGlyphs(n?.glyphs,o)),D=b?.colorScheme??y,[E]=(0,u.useState)(()=>s.createGeomRendererResolver([...b?.plugins??[],...r].filter(le)));We(E,S);const T=(0,u.useId)(),[C]=(0,u.useState)(()=>(0,m.createAnchorResolver)(r)),[w]=(0,u.useState)(()=>(0,m.createDataLabelPlacementResolver)(r)),[R]=(0,u.useState)(()=>Pe()),[q]=(0,u.useState)(()=>s.createTargetBoundaryStore()),I=(0,u.useMemo)(()=>(0,m.createStyleResolver)({colorScheme:D}),[D]),{store:G,dispatch:N,commit:H,paintPreview:M,clearPreview:x,history:L,subscribe:B,getScene:A,compileBus:O,compileErrors:W,findGeom:F}=Ke({spec:t,data:e,colorScheme:D,plugins:r,theme:b,resolveRenderer:E,anchorResolver:C,onSpecChange:d,onError:h,onWarnings:f});(0,u.useEffect)(()=>{if(G)return G.subscribe((a,g)=>{if(a.scene.spec===g.scene.spec)return;const{selection:z,setSelection:Se}=R.getState();z.length!==0&&Se(de(z,a.scene.spec))})},[G,R]);const _=(0,u.useMemo)(()=>({dispatch:N,commit:H,paintPreview:M,clearPreview:x}),[N,H,M,x]);(0,u.useImperativeHandle)(l,()=>({commands:_,undo:L.undo,redo:L.redo,subscribe:B,getScene:A,formattingLocale:p,getSelection:()=>R.getState().selection,setSelection:a=>R.getState().setSelection(a),subscribeSelection:R.subscribe,canPlaceDataLabels:w.hasCapability,canFormatDataLabelsAsPercentages:w.hasPercentageFormat,getGlyphs:()=>S,getPointSymbols:a=>E("point",a)?.symbols}),[_,L,B,A,p,R,w,S,E]);const K=(0,u.useMemo)(()=>G?{chartId:T,store:G,selectionStore:R,targetBoundaryStore:q,commands:_,history:L,formattingLocale:p,compileBus:O,colorScheme:D,mode:v,styleResolver:I,anchorResolver:C,findGeom:F}:null,[T,G,R,q,_,L,p,O,D,v,I,C,F]);return(0,i.jsx)(ce,{forcedErrors:W,onError:h,resetKeys:[t,e],children:K?(0,i.jsx)(s.GraphContext.Provider,{value:K,children:(0,i.jsx)(s.GeomRendererResolverProvider,{value:E,children:(0,i.jsx)(s.DataLabelPlacementResolverProvider,{value:w,children:(0,i.jsx)(s.GeomShapesProvider,{shapes:b?.shapes,children:(0,i.jsx)(s.GlyphRegistryProvider,{glyphs:S,children:P})})})})}):null})},Ve=(e,t)=>(e??[]).filter(r=>!(0,m.isGeometricSymbol)(r)&&!t.has(r)),We=(e,t)=>{(0,u.useEffect)(()=>{if(!s.IS_DEV)return;const r=new Set(t.map(({name:n})=>n));for(const n of Ue)for(const o of Ve(e("point",n)?.symbols,r))console.warn(`[graphy] The ${n} point renderer lists "${o}", but no glyph has that name. The shape menu offers it, and SymbolFigure draws the first listed symbol in its place.`)},[e,t])},Ye=(e,t)=>{const r=s.useLatestRef(t);return(0,u.useEffect)(()=>{if(e===void 0||(0,m.findIntlLocale)(e)!==void 0)return;const n=[{severity:"warning",kind:"userInput",code:"INVALID_FORMATTING_LOCALE",message:`formattingLocale '${e}' is not a tag Intl can format in, so the chart formats in ${m.DEFAULT_LOCALE}.`}];s.logDiagnostics(n),r.current?.(n)},[e,r]),e===void 0?void 0:(0,m.canonicalizeLocale)(e)};function Xe({theme:e,glyphs:t,...r}={}){const n=(0,m.createSpecBuilder)(r);return{...n,GraphProvider:c=>(0,i.jsx)(me,{...c,plugins:n.plugins,theme:e,glyphs:t})}}var k=(e,t)=>{if(typeof e=="number")return Number.isFinite(e)?e:null;if(!e.endsWith("%"))return null;const r=Number.parseFloat(e);return Number.isFinite(r)?r/100*t:null},Qe=({x:e,y:t,width:r,height:n},o)=>{const c=k(e,o.width),l=k(t,o.height),d=k(r,o.width),h=k(n,o.height);return c===null||l===null||d===null||h===null?null:{x:c,y:l,width:d,height:h}},he=({animateTransitions:e,cx:t,cy:r,r:n,effects:o,...c})=>{const l=s.toGeomEffectsStyle(o);return e?(0,i.jsx)(V.motion.circle,{initial:!1,animate:{cx:t,cy:r,r:n},transition:s.DEFAULT_SPRING_TRANSITION,style:l,...c}):(0,i.jsx)("circle",{cx:t,cy:r,r:n,style:l,...c})},ge=({animateTransitions:e,x1:t,y1:r,x2:n,y2:o,effects:c,...l})=>{const d=s.toGeomEffectsStyle(c);return e?(0,i.jsx)(V.motion.line,{initial:!1,animate:{x1:t,y1:r,x2:n,y2:o},transition:s.DEFAULT_SPRING_TRANSITION,style:d,...l}):(0,i.jsx)("line",{x1:t,y1:r,x2:n,y2:o,style:d,...l})},pe=({animateTransitions:e,x:t,y:r,width:n,height:o,rx:c,ry:l,effects:d,...h})=>{const f=s.toGeomEffectsStyle(d);return e?(0,i.jsx)(V.motion.rect,{initial:!1,animate:{attrX:t,attrY:r,width:n,height:o,...c!==void 0&&l!==void 0?{rx:c,ry:l}:{}},transition:s.DEFAULT_SPRING_TRANSITION,style:f,...h}):(0,i.jsx)("rect",{x:t,y:r,width:n,height:o,rx:c,ry:l,style:f,...h})},fe=({animateTransitions:e,d:t,source:r,effects:n,...o})=>{const c=s.toGeomEffectsStyle(n);return e?(0,i.jsx)(rt,{d:t,source:r,style:c,...o}):(0,i.jsx)("path",{d:t,style:c,...o})},Je=e=>{const{Circle:t}=s.useGeomShapes(),{animateTransitions:r}=s.useGraphAnimation(),{symbol:n,...o}=e,c={...o,animateTransitions:r};return n!==void 0&&n!=="circle"?(0,i.jsx)("g",{style:s.toGeomEffectsStyle(e.effects),"data-testid":e["data-testid"],children:(0,i.jsx)(s.PointSymbol,{symbol:n,cx:ne(e.cx),cy:ne(e.cy),size:e.r*2,fill:e.fill??"currentColor",fillOpacity:e.fillOpacity,opacity:e.opacity,stroke:e.stroke,strokeOpacity:e.strokeOpacity,strokeWidth:e.strokeWidth,motion:r?{transition:s.DEFAULT_SPRING_TRANSITION,intro:!1,fadesIn:!1}:null})}):t===void 0?he(c):(0,i.jsx)(s.GeomShapesProvider,{children:(0,i.jsx)(t,{...c})})},Ze=e=>{const{Line:t}=s.useGeomShapes(),{animateTransitions:r}=s.useGraphAnimation(),n={...e,animateTransitions:r};return t===void 0?ge(n):(0,i.jsx)(s.GeomShapesProvider,{children:(0,i.jsx)(t,{...n})})},et=({cornerRadius:e,...t})=>{const{Rect:r}=s.useGeomShapes(),n=s.useGeomViewport()?.size??null,o=s.useGeomPixelsPerUnit(),{animateTransitions:c}=s.useGraphAnimation(),l={...t,animateTransitions:c,...nt(e,t,n,o)};return r===void 0?pe(l):(0,i.jsx)(s.GeomShapesProvider,{children:(0,i.jsx)(r,{...l})})},tt=e=>{const{Path:t}=s.useGeomShapes(),{animateTransitions:r}=s.useGraphAnimation(),n={...e,animateTransitions:r};return t===void 0?fe(n):(0,i.jsx)(s.GeomShapesProvider,{children:(0,i.jsx)(t,{...n})})},ne=e=>typeof e=="number"?`${e}px`:e,rt=({d:e,source:t,...r})=>{const n=s.useSvgPathMorph(e,s.DEFAULT_SPRING_TRANSITION,t);return(0,i.jsx)(V.motion.path,{d:n,...r})},nt=(e,t,r,n)=>{if(e===void 0)return{};const o=(0,m.foldGeomCornerRadii)(e);if(o===void 0)return{};const c=st(t,r,n);if(c===null)return o==="full"?{}:oe((0,m.resolveGeomCornerRadiusPx)({cornerRadius:o}),n);const l=Math.min((0,m.resolveGeomCornerRadiusPx)({cornerRadius:o,box:c}),Math.min(c.width,c.height)/2);return oe(l,n)},st=(e,t,r)=>{const n=se(e.width,t?.width,r.x),o=se(e.height,t?.height,r.y);return n===null||o===null?null:{width:n,height:o}},se=(e,t,r)=>{if(typeof e=="number")return Number.isFinite(e)?Math.abs(e)*r:null;if(t===void 0)return null;const n=k(e,t);return n===null?null:Math.abs(n)},oe=(e,t)=>t.x<=0||t.y<=0?{rx:0,ry:0}:{rx:e/t.x,ry:e/t.y},ot=({symbol:e,size:t,fill:r,fillOpacity:n,stroke:o,strokeOpacity:c,strokeWidth:l})=>{const d=s.useGlyphRegistry(),h=s.useGeomRendererResolver(),f=s.useSceneSelector(P=>P.coordSystem.type),y=it(e,h("point",f)?.symbols??[],d),j={size:t,fill:r,fillOpacity:n,stroke:o,strokeOpacity:c,strokeWidth:l};return(0,m.isGeometricSymbol)(y)?(0,i.jsx)("path",{d:(0,m.buildPointSymbolPath)(y,t),fill:r,fillOpacity:n,stroke:o,strokeOpacity:c,strokeWidth:l,strokeLinejoin:"round"}):(0,i.jsx)(s.GlyphMark,{symbol:y,glyphs:d,...j})},it=(e,t,r)=>(0,m.isImageSymbol)(e)||t.includes(e)||!(0,m.isGeometricSymbol)(e)&&r.has(e)?e:t[0]??"circle",at=({children:e,...t})=>{const r=s.useGeomViewport()?.size??null;return(0,i.jsx)("svg",{viewBox:"0 0 1 1",preserveAspectRatio:"none",width:"100%",height:"100%",pointerEvents:"none",...t,children:(0,i.jsx)(s.GeomViewportProvider,{size:r,space:"unit",children:e})})},ct=({box:e,children:t})=>{const r=s.useGeomViewportSize(),n=r===null?null:r.width*(e.x1-e.x0),o=r===null?null:r.height*(e.y1-e.y0),c=(0,u.useMemo)(()=>n===null||o===null?null:{width:n,height:o},[n,o]);return(0,i.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:(0,i.jsx)(s.GeomViewportProvider,{size:c,children:t})})},lt="drqe3u0",ut="drqe3u1",dt="drqe3u2",mt="drqe3u3",$="drqe3u4",ht="drqe3u5",gt="drqe3u6",pt="drqe3u7",U="drqe3u8",ft="drqe3u9",vt="drqe3ua";var St="drqe3uc",yt="drqe3ud",Gt="drqe3ue",bt="drqe3uf";var Tt="drqe3uh",xt="drqe3ui",ie={enabled:"drqe3uk drqe3uj",disabled:"drqe3ul drqe3uj"},ae={ran:"drqe3un drqe3um",dim:"drqe3uo drqe3um"},ve={ran:"drqe3uq drqe3up",cached:"drqe3ur drqe3up",untouched:"drqe3us drqe3up"},Et=({width:e=440,style:t,className:r}={})=>{const{compileBus:n}=s.useGraphContext(),[o]=(0,u.useState)(()=>je()),[c,l]=(0,u.useState)(!1),[d,h]=(0,u.useState)(m.isCompilerCachingEnabled);(0,u.useEffect)(()=>{const{recordCompile:p}=o.getState(),b=n.getLastTrigger(),S=n.getLastCompile();return b&&S&&p(b,S),n.subscribe(p)},[o,n]);const f=(0,Y.useStore)(o,p=>p.lastCompile),y=(0,Y.useStore)(o,p=>p.history),j=n.getCacheStats(),P=f===null&&y.length===0,v=()=>{h(p=>{const b=!p;return(0,m.setCompilerCachingEnabled)(b),b})};return(0,i.jsxs)("div",{className:(0,X.default)(vt,r),style:{width:e,...t},children:[(0,i.jsxs)("div",{className:lt,children:[(0,i.jsxs)("div",{children:[(0,i.jsx)("div",{className:ut,children:"compile cache"}),(0,i.jsx)("div",{className:Gt,children:P?"production: stats disabled":f?`last: ${f.label} · ${Z(f.durationMs)}`:"awaiting first compile…"})]}),(0,i.jsx)("button",{type:"button",onClick:()=>l(p=>!p),className:bt,children:c?"▾":"▴"})]}),!c&&(0,i.jsxs)("div",{className:"drqe3ub",children:[(0,i.jsxs)("button",{type:"button",onClick:v,className:d?ie.enabled:ie.disabled,"aria-pressed":d,children:["cache ",d?"enabled":"disabled"]}),(0,i.jsx)("span",{className:"drqe3ug",children:"next compile reflects this toggle"})]}),!c&&!P&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(Rt,{delta:f?.stages,durations:f?.stageDurationsMs,cumulative:j}),(0,i.jsx)(Pt,{entries:y})]})]})},Rt=({delta:e,durations:t,cumulative:r})=>(0,i.jsxs)("table",{className:dt,children:[(0,i.jsx)("thead",{children:(0,i.jsxs)("tr",{className:Tt,children:[(0,i.jsx)("th",{className:mt,children:"stage"}),(0,i.jsx)("th",{className:$,children:"time"}),(0,i.jsx)("th",{className:$,children:"Δ miss"}),(0,i.jsx)("th",{className:$,children:"Δ hit"}),(0,i.jsx)("th",{className:$,children:"total miss"}),(0,i.jsx)("th",{className:$,children:"total hit"})]})}),(0,i.jsx)("tbody",{children:m.COMPILER_STAGE_KEYS.map(n=>{const o=e?.[n],c=Ct(o);return(0,i.jsxs)("tr",{className:St,children:[(0,i.jsxs)("td",{className:ht,children:[(0,i.jsx)("span",{className:ve[c],"aria-hidden":!0})," ",n]}),(0,i.jsx)("td",{className:U,children:t===void 0||c==="untouched"?"—":Z(t[n])}),(0,i.jsx)("td",{className:c==="ran"?ae.ran:ae.dim,children:o?.misses??0}),(0,i.jsx)("td",{className:U,children:o?.hits??0}),(0,i.jsx)("td",{className:U,children:r[n].misses}),(0,i.jsx)("td",{className:U,children:r[n].hits})]},n)})})]}),Pt=({entries:e})=>e.length===0?null:(0,i.jsxs)("div",{className:yt,children:[(0,i.jsx)("div",{className:xt,children:"recent compiles"}),e.map(t=>{const r=It(t.stages,c=>c.misses>0),n=m.COMPILER_STAGE_KEYS.length,o=r===0?"cached":"ran";return(0,i.jsxs)("div",{className:gt,children:[(0,i.jsx)("span",{className:ve[o],"aria-hidden":!0}),(0,i.jsx)("span",{className:pt,title:t.label,children:t.label}),(0,i.jsxs)("span",{className:ft,children:[r,"/",n," ran · ",Z(t.durationMs)]})]},t.id)})]}),Ct=e=>!e||e.hits===0&&e.misses===0?"untouched":e.misses>0?"ran":"cached",It=(e,t)=>{let r=0;for(const n of m.COMPILER_STAGE_KEYS)t(e[n])&&(r+=1);return r},Z=e=>e<.1?"<0.1ms":e>=10?`${e.toFixed(0)}ms`:`${e.toFixed(2)}ms`,Nt=()=>{const{history:e}=s.useGraphContext(),{stack:t,undo:r,redo:n}=e,o=(0,u.useCallback)(d=>t.subscribe(d),[t]),c=(0,u.useCallback)(()=>t.getSnapshot(),[t]),l=(0,u.useSyncExternalStore)(o,c,c);return(0,u.useMemo)(()=>({...l,undo:r,redo:n}),[l,r,n])},jt=new Set(["button","checkbox","color","file","hidden","image","radio","range","reset","submit"]),Dt=(e,t={})=>{const{target:r,enabled:n=!0}=t;(0,u.useEffect)(()=>{const o=wt(r);if(!n||!o)return;const c=l=>{if(!Lt(l)||l.defaultPrevented||_t(l.target))return;const d=s.resolveHistoryStep(l);if(!d)return;const h=e.current;h&&(d==="undo"?h.undo():h.redo())&&l.preventDefault()};return o.addEventListener("keydown",c),()=>o.removeEventListener("keydown",c)},[e,r,n])},wt=e=>e===void 0?window:e!==null&&"current"in e?e.current:e,Lt=e=>"key"in e,_t=e=>e instanceof HTMLInputElement?!jt.has(e.type):e instanceof HTMLElement?e.isContentEditable||e.tagName==="TEXTAREA":!1,kt=()=>{const{targetBoundaryStore:e}=s.useGraphContext();return(0,Y.useStore)(e,t=>t.boundary)};exports.CanvasTextMeasurer=s.CanvasTextMeasurer;exports.DefaultFooter=s.DefaultFooter;exports.DefaultGeomCircle=he;exports.DefaultGeomLine=ge;exports.DefaultGeomPath=fe;exports.DefaultGeomRect=pe;exports.DefaultGrid=s.DefaultGrid;exports.DefaultHeader=s.DefaultHeader;exports.DefaultSwatch=s.DefaultSwatch;exports.DefaultTooltip=s.DefaultTooltip;exports.DevToolsPanel=Et;exports.GRAPH_MODES=s.GRAPH_MODES;exports.GeomCircle=Je;exports.GeomLine=Ze;exports.GeomOverpaint=s.GeomOverpaint;exports.GeomPanelSizeProvider=s.GeomPanelSizeProvider;exports.GeomPath=tt;exports.GeomRect=et;exports.GraphErrorBoundary=ce;exports.GraphErrorPanel=Q;exports.GraphProvider=me;exports.GraphRenderer=s.GraphRenderer;exports.GraphyBadge=s.GraphyBadge;exports.HoverProvider=s.HoverProvider;exports.IntlProvider=s.ChartIntlProvider;exports.IntroFade=s.IntroFade;exports.IntroWipeClip=s.IntroWipeClip;exports.SymbolFigure=ot;exports.TextMeasurerProvider=s.TextMeasurerProvider;exports.ThemeProvider=s.ThemeProvider;exports.UnitBoxSvg=ct;exports.UnitSpaceSvg=at;exports.buildDotsEditOutlineShapes=s.buildDotsEditOutlineShapes;exports.createGraphyKit=Xe;exports.darkTheme=s.darkTheme;exports.defineGeomRenderer=s.defineGeomRenderer;exports.defineGlyph=s.defineGlyph;exports.getBuiltInEditOutlineShapes=s.getBuiltInEditOutlineShapes;exports.lightTheme=s.lightTheme;exports.lightenCss=s.lightenCss;exports.pruneSelection=de;exports.readPositionPixels=k;exports.readRectPixels=Qe;exports.resolveGraphyBadgeVariant=s.resolveGraphyBadgeVariant;exports.resolvePathStroke=s.resolvePathStroke;exports.scalePointToPanel=s.scalePointToPanel;exports.stampAxisEditTarget=s.stampAxisEditTarget;exports.stampGridEditTarget=s.stampGridEditTarget;exports.stampLegendEditTarget=s.stampLegendEditTarget;exports.useElementScreenRect=s.useElementScreenRect;exports.useFormattingLocale=s.useFormattingLocale;exports.useGeomHitTest=s.useGeomHitTest;exports.useGeomHover=s.useGeomHover;exports.useGeomPanelSize=s.useGeomPanelSize;exports.useGeomReaderTree=s.useGeomReaderTree;exports.useGeomStyleReader=s.useGeomStyleReader;exports.useGeomViewportSize=s.useGeomViewportSize;exports.useGraphAnimation=s.useGraphAnimation;exports.useGraphCommands=s.useGraphCommands;exports.useGraphHandle=s.useGraphHandle;exports.useGraphHistory=Nt;exports.useGraphHistoryShortcuts=Dt;exports.useGraphLocale=s.useGraphLocale;exports.useGraphSelection=s.useGraphSelection;exports.useGuidesTakePress=s.useGuidesTakePress;exports.useHandleScene=s.useHandleScene;exports.useHoverState=s.useHoverState;exports.usePaintDefs=s.usePaintDefs;exports.useResolvedStyle=s.useResolvedStyle;exports.useSceneSelector=s.useSceneSelector;exports.useStyleReaderTree=s.useStyleReaderTree;exports.useStyleResolver=s.useStyleResolver;exports.useTargetBoundary=kt;exports.useTextMeasurer=s.useTextMeasurer;exports.vars=s.vars;
|
package/dist/index.d.ts
CHANGED
|
@@ -1405,7 +1405,7 @@ export declare interface GraphHistoryShortcutsOptions {
|
|
|
1405
1405
|
enabled?: boolean;
|
|
1406
1406
|
}
|
|
1407
1407
|
|
|
1408
|
-
/** The mode a chart runs in, which `
|
|
1408
|
+
/** The mode a chart runs in, which `GraphProvider` takes as a prop and every row of `MODE_RULES` is keyed by. */
|
|
1409
1409
|
export declare type GraphMode = (typeof GRAPH_MODES)[keyof typeof GRAPH_MODES];
|
|
1410
1410
|
|
|
1411
1411
|
/** Every phrase a chart can say. The editing surface adds its own — see `editable/i18n/editor-i18n`. */
|
|
@@ -1417,7 +1417,7 @@ declare type GraphPhrases = typeof EN_GB;
|
|
|
1417
1417
|
* render-throw from a renderer component — converge on a single {@link GraphErrorBoundary} that shows
|
|
1418
1418
|
* the error in place, so a broken chart never blanks the page.
|
|
1419
1419
|
*/
|
|
1420
|
-
export declare const GraphProvider: ({ data, spec, plugins, theme, glyphs, formattingLocale: requestedFormattingLocale, handleRef, onSpecChange, onError, onWarnings, colorScheme: hostColorScheme, children, }: GraphProviderProps) => JSX.Element;
|
|
1420
|
+
export declare const GraphProvider: ({ data, spec, plugins, theme, glyphs, formattingLocale: requestedFormattingLocale, handleRef, onSpecChange, onError, onWarnings, colorScheme: hostColorScheme, mode: requestedMode, children, }: GraphProviderProps) => JSX.Element;
|
|
1421
1421
|
|
|
1422
1422
|
/** Props for {@link GraphProvider}: the data and spec to compile, plus color scheme, locale and plugin wiring. */
|
|
1423
1423
|
export declare interface GraphProviderProps {
|
|
@@ -1457,6 +1457,8 @@ export declare interface GraphProviderProps {
|
|
|
1457
1457
|
/** Fires with any warnings a successful compile produced, and with `INVALID_FORMATTING_LOCALE` on a tag `Intl` cannot read. */
|
|
1458
1458
|
onWarnings?: (warnings: VizDiagnostic[]) => void;
|
|
1459
1459
|
colorScheme?: ColorScheme;
|
|
1460
|
+
/** What the reader can do with the chart. Defaults to `readonly`. */
|
|
1461
|
+
mode?: GraphMode;
|
|
1460
1462
|
children: ReactNode;
|
|
1461
1463
|
}
|
|
1462
1464
|
|
|
@@ -1485,7 +1487,6 @@ export declare interface GraphRendererProps {
|
|
|
1485
1487
|
* and so does a chart denser than `maxAnimatedGeoms`.
|
|
1486
1488
|
*/
|
|
1487
1489
|
animation?: GraphAnimation;
|
|
1488
|
-
mode?: GraphMode;
|
|
1489
1490
|
/** Per-region component overrides. Unspecified regions render their default. */
|
|
1490
1491
|
slots?: GraphSlots;
|
|
1491
1492
|
}
|
|
@@ -2460,8 +2461,8 @@ export declare const useGraphHistory: () => GraphHistory;
|
|
|
2460
2461
|
* useGraphHistoryShortcuts(handleRef);
|
|
2461
2462
|
*
|
|
2462
2463
|
* return (
|
|
2463
|
-
* <GraphProvider spec={input} data={data} handleRef={handleRef}>
|
|
2464
|
-
* <GraphRenderer
|
|
2464
|
+
* <GraphProvider spec={input} data={data} handleRef={handleRef} mode="annotate">
|
|
2465
|
+
* <GraphRenderer />
|
|
2465
2466
|
* </GraphProvider>
|
|
2466
2467
|
* );
|
|
2467
2468
|
* };
|