efficient-shell 8.16.2 → 8.17.0
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/README.md +20 -1
- package/dist/{Browser-AUE7SDAW.js → Browser-GZXTAL7Z.js} +11 -11
- package/dist/{Documents-GOOUHNMJ.js → Documents-GXYD4UD2.js} +3 -3
- package/dist/{Files-BSTDQMII.js → Files-OYZXQMRA.js} +11 -11
- package/dist/{Notepad-MQJGT2B6.js → Notepad-L4TKPWZ7.js} +10 -10
- package/dist/{Preview-YSN6S5M6.js → Preview-MPDXIVGC.js} +15 -15
- package/dist/{Spreadsheet-KRLDLSRZ.js → Spreadsheet-JBPWIBDY.js} +10 -10
- package/dist/apps/index.js +1 -1
- package/dist/bin/media-host-check.js +1 -1
- package/dist/bin/ui-check.js +1 -1
- package/dist/charts/BoxPlotChart.js +1 -1
- package/dist/charts/CandlestickChart.js +1 -1
- package/dist/charts/CartesianPlot.js +1 -1
- package/dist/charts/ChordChart.js +1 -1
- package/dist/charts/ColumnChart.js +1 -1
- package/dist/charts/HeatmapChart.js +1 -1
- package/dist/charts/HistogramChart.js +1 -1
- package/dist/charts/RadarChart.js +1 -1
- package/dist/charts/RangeChart.js +1 -1
- package/dist/charts/SankeyChart.js +1 -1
- package/dist/charts/ScatterChart.js +1 -1
- package/dist/charts/SunburstChart.js +1 -1
- package/dist/charts/TimeSeriesChart.js +1 -1
- package/dist/charts/TreemapChart.js +1 -1
- package/dist/charts/WaterfallChart.js +1 -1
- package/dist/{chunk-FEIVDR4M.js → chunk-7GU3LUMW.js} +6 -6
- package/dist/{chunk-3VCAQ72C.js → chunk-B4LK7WL6.js} +2 -2
- package/dist/{chunk-RPAKTBQT.js → chunk-BGVN7HOZ.js} +2 -2
- package/dist/{chunk-OFXGSEYD.js → chunk-EDYCBXWD.js} +4 -4
- package/dist/chunk-GLCKZI3N.js +1 -0
- package/dist/{chunk-G2A4K36M.js → chunk-JHXYW542.js} +3 -3
- package/dist/chunk-KIGGG3LT.js +1 -0
- package/dist/{chunk-UCMPHYBP.js → chunk-LPYFS4RV.js} +14 -14
- package/dist/{chunk-FPI7WBMU.js → chunk-PPSIMRJM.js} +4 -4
- package/dist/{chunk-3MZTDNAW.js → chunk-QQVLFDX6.js} +4 -4
- package/dist/{chunk-ACZDVHDY.js → chunk-S3RTAWEU.js} +1 -1
- package/dist/{chunk-VCEARTZR.js → chunk-UWHGJTAL.js} +5 -5
- package/dist/{chunk-JM2XJJRB.js → chunk-XMGXVMVS.js} +5 -5
- package/dist/chunk-YEY6YPTM.js +2 -0
- package/dist/{client-DLm3Fvbc.d.ts → client-DZeDEyG1.d.ts} +30 -9
- package/dist/index.d.ts +2 -1
- package/dist/index.js +66 -66
- package/dist/telemetry/index.d.ts +2 -1
- package/dist/telemetry/index.js +1 -1
- package/dist/templates/DashboardTemplate.js +1 -1
- package/dist/ui/index.js +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-ES4HIX3L.js +0 -2
- package/dist/chunk-GLX6W5W4.js +0 -1
- package/dist/chunk-THCH4PD5.js +0 -1
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import{
|
|
2
|
-
return E("div",{className:yt,ref:Vt,children:/* @__PURE__ */E(
|
|
3
|
-
return E("div",{className:yt,ref:Vt,children:/* @__PURE__ */E("p",{className:"flex items-center justify-center text-sm text-gray-500",style:{height:K},children:jt})});const Tt=J.map((t,e)=>Ft.reduce((t,a)=>t+(P(a.data[e])?a.data[e]:0),0)),Bt=(t,e)=>Tt[e]>0?t/Tt[e]:null,Ot=[];if(Q){let t=J.map(()=>0);for(const e of Ft)t=t.map((t,a)=>t+(P(e.data[a])?e.data[a]:0)),Ot.push("percent"===G?t.map((t,e)=>Bt(t,e)):[...t])}const Pt=!!H&&H.length>0,Yt=t=>"right"===t.axis,Jt=!Q&&!Pt&&void 0===q&&Ft.some(Yt)&&Ft.some(t=>!Yt(t)),Kt=Jt?Ft.filter(t=>!Yt(t)):Ft,Qt=Jt?Ft.filter(Yt).flatMap(t=>t.data.filter(P)):[],Gt=Q?(Ot.at(-1)??[]).filter(P):Kt.flatMap(t=>t.data.filter(P)),Ht=Jt?
|
|
1
|
+
import{ChartBrush as t}from"./chunk-TWWJLFTD.js";import{ChartDot as e}from"./chunk-CK2YOGUS.js";import{stepPath as a,curvePath as r,areaBetween as l,areaFrom as n}from"./chunk-VFC6QUEN.js";import{ChartDefs as i,MOTION as o,stagger as s,fillFor as c,dashFor as h,maskId as m}from"./chunk-465RRWBY.js";import{ChartSkeleton as d}from"./chunk-EVKBV6IV.js";import{useHighlight as u,highlightOpacity as f}from"./chunk-CNYAHYE6.js";import{ChartTooltip as p}from"./chunk-P5BOTIJU.js";import{tooltipBesideBand as g}from"./chunk-MG7A3R75.js";import{pairedAxes as k,niceAxis as y,niceMax as x,linearScale as v,axisGutter as b,bandScale as M,ladderScale as N}from"./chunk-2JWPNR2U.js";import{usePlotWidth as j}from"./chunk-MAFUXCPZ.js";import{resolveSeriesColor as V,CHART_INK as $,STATUS_VARS as w}from"./chunk-TZFACUMR.js";import{registerModalEscapeInterceptor as W}from"./chunk-TWVUQUUD.js";import{useShellStrings as A,useShellLocale as R}from"./chunk-OVNRVFWS.js";import{formatPercent as L,formatPlain as z}from"./chunk-C3QOHMR6.js";import{useRef as C,useState as S,useId as U,useEffect as D}from"react";import{jsx as E,jsxs as I}from"react/jsx-runtime";var F=12,T=16,B=26,O=52,P=t=>"number"==typeof t&&Number.isFinite(t);function Y({series:Y,labels:J,height:K=200,stacked:Q=!1,stackMode:G="value",levels:H,curve:Z="linear",tension:X=0,max:q,yTickCount:_=4,formatValue:tt,formatTooltipValue:et,tooltipLabels:at,yAxisLabel:rt,referenceLines:lt,labelEndpoints:nt=!1,dots:it,dotVariant:ot="border",pulse:st=!1,brush:ct=!1,range:ht,onRangeChange:mt,loading:dt=!1,animate:ut=!0,reveal:ft="left-to-right",fillVariant:pt="gradient",gridStyle:gt="solid",width:kt,className:yt,emptyLabel:xt}){const vt=A().charts,bt=R(),Mt=tt??(t=>z(t,bt)),Nt=et??Mt,jt=xt??vt.noData,Vt=C(null),$t=j(Vt),wt=kt??$t,[Wt,At]=S(null),[Rt,Lt]=S(null),{highlighted:zt}=u(),Ct=U();if(D(()=>{if(null!==Wt)return W(t=>"Escape"===t.key&&(At(null),!0))},[Wt]),dt)/* @__PURE__ */
|
|
2
|
+
return E("div",{className:yt,ref:Vt,children:/* @__PURE__ */E(d,{height:K,width:kt??$t})});const St=J,Ut=ht??Rt??[0,Math.max(0,St.length-1)],[Dt,Et]=Ut,It=t=>ct?t.slice(Dt,Et+1):t,Ft=Y.map((t,e)=>({...t,slot:e})).filter(t=>t.data.some(P)).map(t=>({...t,data:It(t.data)}));if(J=It(St),0===Ft.length||0===J.length)/* @__PURE__ */
|
|
3
|
+
return E("div",{className:yt,ref:Vt,children:/* @__PURE__ */E("p",{className:"flex items-center justify-center text-sm text-gray-500",style:{height:K},children:jt})});const Tt=J.map((t,e)=>Ft.reduce((t,a)=>t+(P(a.data[e])?a.data[e]:0),0)),Bt=(t,e)=>Tt[e]>0?t/Tt[e]:null,Ot=[];if(Q){let t=J.map(()=>0);for(const e of Ft)t=t.map((t,a)=>t+(P(e.data[a])?e.data[a]:0)),Ot.push("percent"===G?t.map((t,e)=>Bt(t,e)):[...t])}const Pt=!!H&&H.length>0,Yt=t=>"right"===t.axis,Jt=!Q&&!Pt&&void 0===q&&Ft.some(Yt)&&Ft.some(t=>!Yt(t)),Kt=Jt?Ft.filter(t=>!Yt(t)):Ft,Qt=Jt?Ft.filter(Yt).flatMap(t=>t.data.filter(P)):[],Gt=Q?(Ot.at(-1)??[]).filter(P):Kt.flatMap(t=>t.data.filter(P)),Ht=Jt?k([Math.min(0,...Gt),Math.max(0,...Gt)],[Math.min(0,...Qt),Math.max(0,...Qt)],{intervals:_+1,integerLeft:Gt.every(Number.isInteger),integerRight:Qt.every(Number.isInteger)}):null,Zt=Ht?Ht.left:Q&&"percent"===G||Pt||void 0!==q?null:y(Q?0:Math.min(0,...Gt),Math.max(0,...Gt),{intervals:_+1,integer:Gt.every(Number.isInteger)}),Xt=Zt?Zt.lo:0,qt=Q&&"percent"===G?1:Zt?Zt.hi:q??x(Math.max(...Gt,0)),_t=Q&&"percent"===G?t=>L(Math.round(100*t),0,bt):Mt,te=Pt?H:Zt?Zt.ticks:v([Xt,qt],{from:0,to:1}).ticks(_+1),ee=b(te.map(_t),O),ae=Ht?b(Ht.right.ticks.map(Mt),T):T,re={left:ee,right:Math.max(ee+1,wt-ae),top:F,bottom:K-B},le=M(J.length,{from:re.left,to:re.right}),ne=Pt?N(H,{from:re.bottom,to:re.top}):null,ie=v([Xt,qt],{from:re.bottom,to:re.top}),oe=ie(Math.max(Xt,0)),se=t=>ne?ne(t):ie(t),ce=Ht?v([Ht.right.lo,Ht.right.hi],{from:re.bottom,to:re.top}):null,he=t=>ce&&Yt(t)?ce:se,me=ne?ne.levels.map(t=>({value:t,y:ne(t)})):te.map(t=>({value:t,y:ie(t)})),de=t=>e=>{e.preventDefault(),At(e=>{const a=(e??0)+t;return Math.min(J.length-1,Math.max(0,a))})},ue=Math.max(1,Math.ceil(J.length/Math.max(1,Math.floor(wt/96))));/* @__PURE__ */
|
|
4
4
|
return I("div",{className:`relative ${yt??""}`,ref:Vt,children:[
|
|
5
5
|
/* @__PURE__ */I("svg",{width:"100%",height:K,viewBox:`0 0 ${wt} ${K}`,role:"img","aria-label":vt.overIntervals(Ft.map(t=>t.label),J.length),tabIndex:0,className:"rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-deep)]",onMouseLeave:()=>At(null),onBlur:()=>At(null),onKeyDown:t=>{"ArrowRight"===t.key&&de(1)(t),"ArrowLeft"===t.key&&de(-1)(t)},children:[
|
|
6
6
|
/* @__PURE__ */E("defs",{children:/* @__PURE__ */E("clipPath",{id:Ct,children:/* @__PURE__ */E("rect",{x:re.left,y:re.top,width:re.right-re.left,height:re.bottom-re.top})})}),
|
|
7
|
-
/* @__PURE__ */E(
|
|
8
|
-
/* @__PURE__ */E("line",{x1:re.left,y1:oe,x2:re.right,y2:oe,stroke
|
|
9
|
-
/* @__PURE__ */E("g",{clipPath:`url(#${Ct})`,mask:ut&&ft?`url(#${
|
|
10
|
-
return E("path",{d:e
|
|
11
|
-
return E("g",{opacity:d??void 0,className:"rosh-viz-mark",children:J.map((
|
|
12
|
-
return E("rect",{x:le.center(
|
|
7
|
+
/* @__PURE__ */E(i,{id:Ct,fills:Ft.map((t,e)=>({color:V(t.slot,t.color,t.tone),variant:t.fillVariant??pt})),fadeFrom:Q?.42:.3,reveal:!!ut&&ft}),me.map(t=>/* @__PURE__ */E("line",{x1:re.left,y1:t.y,x2:re.right,y2:t.y,stroke:$.grid,strokeWidth:1,shapeRendering:"crispEdges",strokeDasharray:"dashed"===gt?"3 3":void 0},`grid-${t.value}`)),
|
|
8
|
+
/* @__PURE__ */E("line",{x1:re.left,y1:oe,x2:re.right,y2:oe,stroke:$.axis,strokeWidth:1,shapeRendering:"crispEdges"}),me.map(t=>/* @__PURE__ */E("text",{x:re.left-8,y:t.y+4,textAnchor:"end","data-axis-tick":"true",fontSize:11,fill:$.label,style:{fontVariantNumeric:"tabular-nums"},children:_t(t.value)},`ytick-${t.value}`)),Ht&&me.map((t,e)=>/* @__PURE__ */E("text",{x:re.right+8,y:t.y+4,textAnchor:"start","data-axis-tick":"true",fontSize:11,fill:$.label,style:{fontVariantNumeric:"tabular-nums"},children:Mt(Ht.right.ticks[e])},`ytick-r-${t.value}`)),rt&&/* @__PURE__ */E("text",{x:12,y:(re.top+re.bottom)/2,transform:`rotate(-90 12 ${(re.top+re.bottom)/2})`,textAnchor:"middle",fontSize:11,fill:$.label,children:rt}),
|
|
9
|
+
/* @__PURE__ */E("g",{clipPath:`url(#${Ct})`,mask:ut&&ft?`url(#${m(Ct)})`:void 0,children:Ft.map((t,e)=>{const i=V(t.slot,t.color,t.tone),m=t.mode??(Q?"area":"line"),d=f(t.key,zt);if("step"===m){const e=J.map((e,a)=>({start:le(a),end:le.end(a),value:t.data[a]})).filter(t=>P(t.value)).map(e=>({start:e.start,end:e.end,y:he(t)(e.value)}));/* @__PURE__ */
|
|
10
|
+
return E("path",{d:a(e),fill:"none",stroke:i,strokeWidth:2.5,strokeLinecap:"butt",strokeLinejoin:"miter",opacity:d??void 0,className:"rosh-viz-mark"},t.key)}const u=J.map((a,r)=>{const l=Q?Ot[e]?.[r]:t.data[r];return P(l)?[le.center(r),he(t)(l)]:null}).filter(t=>null!==t);if(0===u.length)return null;if("column"===m){const a=Math.max(1,.62*le.bandwidth),r="solid"===t.fillVariant,l=he(t);/* @__PURE__ */
|
|
11
|
+
return E("g",{opacity:d??void 0,className:"rosh-viz-mark",children:J.map((n,c)=>{const h=Q?Ot[e]?.[c]:t.data[c];if(!P(h))return null;const m=l(h);/* @__PURE__ */
|
|
12
|
+
return E("rect",{x:le.center(c)-a/2,y:Math.min(m,oe),width:a,height:Math.abs(oe-m),rx:2,fill:i,fillOpacity:r?1:.35,className:ut?o.rise:void 0,style:ut?s(c,26):void 0},c)})},t.key)}const p=r(u,Z,X),g=Q&&e>0?J.map((t,a)=>[le.center(a),se(Ot[e-1]?.[a]??0)-2]):null,k=g?l(p,g):n(p,u,oe);/* @__PURE__ */
|
|
13
13
|
return I("g",{opacity:d??void 0,className:"rosh-viz-mark",children:[("area"===m||Q)&&
|
|
14
|
-
/* @__PURE__ */E("path",{d:k,fill:
|
|
15
|
-
/* @__PURE__ */E("path",{d:p,fill:"none",stroke:
|
|
14
|
+
/* @__PURE__ */E("path",{d:k,fill:c(Ct,e,t.fillVariant??pt,i),stroke:"none"}),
|
|
15
|
+
/* @__PURE__ */E("path",{d:p,fill:"none",stroke:i,strokeWidth:2,strokeLinejoin:"round",strokeLinecap:"round",strokeDasharray:h(t.stroke??(t.forecast?"animated-dashed":"solid")),className:ut&&("animated-dashed"===t.stroke||t.forecast&&!t.stroke)?o.march:void 0})]},t.key)})}),lt?.map((t,e)=>{const a=t.color??w[t.tone??"critical"],r=se(t.value);/* @__PURE__ */
|
|
16
16
|
return I("g",{children:[
|
|
17
|
-
/* @__PURE__ */E("line",{x1:re.left,y1:r,x2:re.right,y2:r,stroke:a,strokeWidth:1,strokeDasharray:"5 4"}),t.label&&/* @__PURE__ */E("text",{x:re.right-4,y:r-5,textAnchor:"end",fontSize:11,fontWeight:600,fill:a,children:t.label})]},`rule-${e}`)}),"none"!==(it??(nt?"last":"none"))&&Ft.map((
|
|
18
|
-
return I("g",{children:[i.map(r=>{const i=Q?Ot[a]?.[r]:
|
|
19
|
-
/* @__PURE__ */E("div",{className:"pointer-events-none absolute top-2 z-10",style:
|
|
17
|
+
/* @__PURE__ */E("line",{x1:re.left,y1:r,x2:re.right,y2:r,stroke:a,strokeWidth:1,strokeDasharray:"5 4"}),t.label&&/* @__PURE__ */E("text",{x:re.right-4,y:r-5,textAnchor:"end",fontSize:11,fontWeight:600,fill:a,children:t.label})]},`rule-${e}`)}),"none"!==(it??(nt?"last":"none"))&&Ft.map((t,a)=>{if("column"===t.mode)return null;const r=it??(nt?"last":"none"),l=V(t.slot,t.color,t.tone),n=[...t.data].map(P).lastIndexOf(!0),i="all"===r?J.map((t,e)=>e).filter(e=>P(Q?Ot[a]?.[e]:t.data[e])):n>=0?[n]:[];/* @__PURE__ */
|
|
18
|
+
return I("g",{children:[i.map(r=>{const i=Q?Ot[a]?.[r]:t.data[r];return P(i)?/* @__PURE__ */E(e,{cx:le.center(r),cy:he(t)(i),color:l,variant:ot,pulse:st&&r===n,title:`${J[r]}: ${t.label} ${Mt(i)}`},r):null}),nt&&n>=0&&P(Q?Ot[a]?.[n]:t.data[n])&&/* @__PURE__ */E("text",{x:le.center(n)-10,y:he(t)(Q?Ot[a]?.[n]:t.data[n])-9,textAnchor:"end",fontSize:12,fontWeight:600,fill:$.label,style:{fontVariantNumeric:"tabular-nums"},children:Mt(Q?Ot[a]?.[n]:t.data[n])})]},`dots-${t.key}`)}),J.map((t,e)=>e%ue===0?/* @__PURE__ */E("text",{x:le.center(e),y:K-8,textAnchor:"middle",fontSize:11,fill:$.label,style:{fontVariantNumeric:"tabular-nums"},children:t},`xtick-${e}`):null),null!==Wt&&/* @__PURE__ */E("line",{x1:le.center(Wt),y1:re.top,x2:le.center(Wt),y2:re.bottom,stroke:$.axis,strokeWidth:1}),J.map((t,e)=>/* @__PURE__ */E("rect",{x:le(e),y:re.top,width:Math.max(1,le.bandwidth),height:re.bottom-re.top,fill:"transparent",onMouseEnter:()=>At(e)},`hit-${e}`))]}),ct&&St.length>2&&/* @__PURE__ */E(t,{className:"mt-1",labels:St,width:wt,data:Y[0]?.data??[],range:Ut,onRangeChange:t=>{mt?mt(t):Lt(t)}}),null!==Wt&&
|
|
19
|
+
/* @__PURE__ */E("div",{className:"pointer-events-none absolute top-2 z-10",style:g(le.center(Wt),le.bandwidth,wt),children:/* @__PURE__ */E(p,{title:at?.[Wt]??J[Wt],rows:Ft.map((t,e)=>({key:t.key,label:t.label,color:V(t.slot,t.color,t.tone),value:P(t.data[Wt])?Q&&"percent"===G?`${L(100*(Bt(t.data[Wt],Wt)??0),1,bt)} · ${Nt(t.data[Wt])}`:Nt(t.data[Wt]):void 0})),footnote:Q&&"percent"===G?vt.inBucket(Nt(Tt[Wt])):void 0})})]})}export{Y as TimeSeriesChart};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import{tooltipBesideBand as t}from"./chunk-MG7A3R75.js";import{niceAxis as e,niceMax as i,linearScale as r,axisGutter as n,bandScale as l}from"./chunk-2JWPNR2U.js";import{usePlotWidth as o}from"./chunk-MAFUXCPZ.js";import{
|
|
1
|
+
import{tooltipBesideBand as t}from"./chunk-MG7A3R75.js";import{niceAxis as e,niceMax as i,linearScale as r,axisGutter as n,bandScale as l}from"./chunk-2JWPNR2U.js";import{usePlotWidth as o}from"./chunk-MAFUXCPZ.js";import{CHART_INK as a}from"./chunk-TZFACUMR.js";import{registerModalEscapeInterceptor as h}from"./chunk-TWVUQUUD.js";import{useShellStrings as s,useShellLocale as c}from"./chunk-OVNRVFWS.js";import{formatPlain as m}from"./chunk-C3QOHMR6.js";import{useRef as d,useState as u,useId as f,useEffect as x}from"react";import{jsx as g,jsxs as p}from"react/jsx-runtime";function y({labels:y,values:v,height:b=220,width:k,bandPadding:M=.24,min:N,max:w,yTickCount:A=4,formatValue:$,yAxisLabel:j,xTickAnchor:R="center",children:E,overlay:U,tooltip:V,onSelect:z,ariaLabel:C,className:D,emptyLabel:F}){const L=s().charts,P=c(),S=$??(t=>m(t,P)),W=F??L.noData,I=d(null),T=o(I),B=k??T,[O,Q]=u(null),Z=f();if(x(()=>{if(null!==O)return h(t=>"Escape"===t.key&&(Q(null),!0))},[O]),0===y.length||!v.some(Number.isFinite))/* @__PURE__ */
|
|
2
2
|
return g("div",{className:D,ref:I,children:/* @__PURE__ */g("p",{className:"flex items-center justify-center text-sm text-gray-500",style:{height:b},children:W})});const G=v.filter(Number.isFinite),H=G.every(Number.isInteger),J=void 0===N&&void 0===w?e(Math.min(0,...G),Math.max(0,...G),{intervals:A+1,integer:H}):null,K=void 0!==N&&void 0===w?e(N,Math.max(N,...G),{intervals:A+1,integer:H,zero:!1}):null,X=J?J.lo:N??Math.min(0,...G),q=J?J.hi:K?K.hi:w??i(Math.max(...G,0)),Y=J?J.ticks:K?[X,...K.ticks.filter(t=>t>X)]:r([X,q],{from:0,to:1}).ticks(A+1),_={top:12,right:16,bottom:26,left:n(Y.map(S),48)+(j?10:0)},tt=_.left,et=Math.max(tt+1,B-_.right),it=_.top,rt=b-_.bottom,nt=r([X,q],{from:rt,to:it}),lt=l(y.length,{from:tt,to:et},M),ot=(et-tt)/Math.max(1,y.length),at=ot>=48,ht=at?1:Math.max(1,Math.ceil(y.length/Math.max(1,Math.floor(B/84)))),st=Math.max(2,Math.floor((ot-6)/6.6)),ct=t=>at&&t.length>st?`${t.slice(0,st-1).trimEnd()}…`:t;/* @__PURE__ */
|
|
3
3
|
return p("div",{className:`relative ${D??""}`,ref:I,children:[
|
|
4
4
|
/* @__PURE__ */p("svg",{width:"100%",height:b,viewBox:`0 0 ${B} ${b}`,role:"img","aria-label":C,tabIndex:0,className:"rosh-focus-ring focus-visible:ring-2 focus-visible:ring-[color:var(--rosh-focus-ring-deep)]",onMouseLeave:()=>Q(null),onBlur:()=>Q(null),onKeyDown:t=>{if(z&&null!==O&&("Enter"===t.key||" "===t.key))return t.preventDefault(),void z(O);if("ArrowRight"!==t.key&&"ArrowLeft"!==t.key)return;t.preventDefault();const e="ArrowRight"===t.key?1:-1;Q(t=>Math.min(y.length-1,Math.max(0,(t??0)+e)))},children:[
|
|
5
|
-
/* @__PURE__ */g("defs",{children:/* @__PURE__ */g("clipPath",{id:Z,children:/* @__PURE__ */g("rect",{x:tt,y:it,width:et-tt,height:rt-it})})}),Y.map(t=>/* @__PURE__ */g("line",{x1:tt,y1:nt(t),x2:et,y2:nt(t),stroke:
|
|
6
|
-
/* @__PURE__ */g("line",{x1:tt,y1:nt(Math.max(X,0)),x2:et,y2:nt(Math.max(X,0)),stroke:
|
|
7
|
-
/* @__PURE__ */g("g",{clipPath:`url(#${Z})`,children:E({x:lt,y:nt,left:tt,right:et,top:it,bottom:rt,width:B,height:b,clipId:Z,active:O})}),U?.({x:lt,y:nt,left:tt,right:et,top:it,bottom:rt,width:B,height:b,clipId:Z,active:O}),y.map((t,e)=>e%ht===0?/* @__PURE__ */g("text",{x:"start"===R?lt(e):lt.center(e),y:b-8,textAnchor:"middle",fontSize:11,fill:
|
|
5
|
+
/* @__PURE__ */g("defs",{children:/* @__PURE__ */g("clipPath",{id:Z,children:/* @__PURE__ */g("rect",{x:tt,y:it,width:et-tt,height:rt-it})})}),Y.map(t=>/* @__PURE__ */g("line",{x1:tt,y1:nt(t),x2:et,y2:nt(t),stroke:a.grid,strokeWidth:1,shapeRendering:"crispEdges"},`g${t}`)),
|
|
6
|
+
/* @__PURE__ */g("line",{x1:tt,y1:nt(Math.max(X,0)),x2:et,y2:nt(Math.max(X,0)),stroke:a.axis,strokeWidth:1,shapeRendering:"crispEdges"}),Y.map(t=>/* @__PURE__ */g("text",{x:tt-8,y:nt(t)+4,textAnchor:"end",fontSize:11,fill:a.label,style:{fontVariantNumeric:"tabular-nums"},children:S(t)},`t${t}`)),j&&/* @__PURE__ */g("text",{x:14,y:(it+rt)/2,transform:`rotate(-90 14 ${(it+rt)/2})`,textAnchor:"middle",fontSize:11,fill:a.label,children:j}),
|
|
7
|
+
/* @__PURE__ */g("g",{clipPath:`url(#${Z})`,children:E({x:lt,y:nt,left:tt,right:et,top:it,bottom:rt,width:B,height:b,clipId:Z,active:O})}),U?.({x:lt,y:nt,left:tt,right:et,top:it,bottom:rt,width:B,height:b,clipId:Z,active:O}),y.map((t,e)=>e%ht===0?/* @__PURE__ */g("text",{x:"start"===R?lt(e):lt.center(e),y:b-8,textAnchor:"middle",fontSize:11,fill:a.label,style:{fontVariantNumeric:"tabular-nums"},children:ct(t)},`x${e}`):null),y.map((t,e)=>/* @__PURE__ */g("rect",{x:lt.center(e)-(et-tt)/y.length/2,y:it,width:(et-tt)/y.length,height:rt-it,fill:"transparent",onMouseEnter:()=>Q(e),onClick:z?()=>z(e):void 0,style:z?{cursor:"pointer"}:void 0},`h${e}`))]}),V&&null!==O&&
|
|
8
8
|
/* @__PURE__ */g("div",{className:"pointer-events-none absolute top-2 z-10",style:t(lt.center(O),lt.bandwidth,B),children:V(O)})]})}export{y as CartesianPlot};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{ChartTooltip as t}from"./chunk-P5BOTIJU.js";import{CartesianPlot as a}from"./chunk-
|
|
2
|
-
return i(a,{labels:c.map(t=>t.label),values:j,height:u,width:m,formatValue:y,yAxisLabel:f,className:p,emptyLabel:d,bandPadding:.36,ariaLabel:v.waterfall(c.length,y(
|
|
3
|
-
return i(t,{title:e?.label,rows:[{key:"step",color:o,label:e?.total?v.balance:e.value>=0?v.increase:v.decrease,value:e?.total?y(e.to):`${e.value>=0?"+":"−"}${y(Math.abs(e.value))}`},...e?.total?[]:[{key:"running",label:v.runningTotal,color:l.neutral,value:y(e.to)}]]})},children:({x:t,y:a,active:o})=>/* @__PURE__ */s("g",{children:[g&&
|
|
4
|
-
/* @__PURE__ */i("line",{x1:t.end(o),y1:a(l.to),x2:t(o+1),y2:a(l.to),stroke:e.grid,strokeWidth:1,shapeRendering:"crispEdges"},`c${o}`)),
|
|
1
|
+
import{ChartTooltip as t}from"./chunk-P5BOTIJU.js";import{CartesianPlot as a}from"./chunk-PPSIMRJM.js";import{CHART_INK as e,STATUS_VARS as l}from"./chunk-TZFACUMR.js";import{useShellStrings as o,useShellLocale as r}from"./chunk-OVNRVFWS.js";import{formatPlain as n}from"./chunk-C3QOHMR6.js";import{jsx as i,jsxs as s}from"react/jsx-runtime";function c({steps:c,height:u=240,width:m,formatValue:h,yAxisLabel:f,className:p,emptyLabel:d,radius:b=3,connectors:g=!0}){const v=o().charts,x=r(),y=h??(t=>n(t,x));let M=0;const k=c.map(t=>{if(t.total){const a={from:0,to:M,value:M,total:!0};return{...t,...a}}const a=M;return M+=t.value,{...t,from:a,to:M,value:t.value,total:!1}}),j=k.flatMap(t=>[t.from,t.to]);/* @__PURE__ */
|
|
2
|
+
return i(a,{labels:c.map(t=>t.label),values:j,height:u,width:m,formatValue:y,yAxisLabel:f,className:p,emptyLabel:d,bandPadding:.36,ariaLabel:v.waterfall(c.length,y(k[0]?.from??0),y(M)),tooltip:a=>{const e=k[a],o=e?.total?l.neutral:e.value>=0?l.good:l.critical;/* @__PURE__ */
|
|
3
|
+
return i(t,{title:e?.label,rows:[{key:"step",color:o,label:e?.total?v.balance:e.value>=0?v.increase:v.decrease,value:e?.total?y(e.to):`${e.value>=0?"+":"−"}${y(Math.abs(e.value))}`},...e?.total?[]:[{key:"running",label:v.runningTotal,color:l.neutral,value:y(e.to)}]]})},children:({x:t,y:a,active:o})=>/* @__PURE__ */s("g",{children:[g&&k.slice(0,-1).map((l,o)=>
|
|
4
|
+
/* @__PURE__ */i("line",{x1:t.end(o),y1:a(l.to),x2:t(o+1),y2:a(l.to),stroke:e.grid,strokeWidth:1,shapeRendering:"crispEdges"},`c${o}`)),k.map((e,r)=>{const n=e.total?l.neutral:e.value>=0?l.good:l.critical,s=Math.min(a(e.from),a(e.to)),c=Math.max(1,Math.abs(a(e.to)-a(e.from)));/* @__PURE__ */
|
|
5
5
|
return i("rect",{x:t(r),y:s,width:Math.max(1,t.bandwidth),height:c,rx:b,fill:n,fillOpacity:null===o||o===r?1:.45},r)})]})})}export{c as WaterfallChart};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{StatCard as e,Card as a}from"./chunk-RD5UPROC.js";import{Avatar as t}from"./chunk-UL4WB3VH.js";import{Sparkline as r}from"./chunk-CKCDGSTC.js";import{PieChart as s}from"./chunk-2DGTGJYJ.js";import{ColumnChart as l}from"./chunk-
|
|
1
|
+
import{StatCard as e,Card as a}from"./chunk-RD5UPROC.js";import{Avatar as t}from"./chunk-UL4WB3VH.js";import{Sparkline as r}from"./chunk-CKCDGSTC.js";import{PieChart as s}from"./chunk-2DGTGJYJ.js";import{ColumnChart as l}from"./chunk-UWHGJTAL.js";import{StatusBadgeProvider as i,StatusBadge as d}from"./chunk-5SULG7D5.js";import{TH_ONE_LINE as c}from"./chunk-7T3COEQK.js";import{Button_default as n}from"./chunk-UDD7GB4F.js";import{jsx as o,jsxs as m}from"react/jsx-runtime";var u={paid:"success",shipped:"active",processing:"queued",refunded:"neutral",overdue:"danger"},h=[12,18,14,22,19,27,24,31,28,35,30,38],p=["J","F","M","A","M","J","J","A","S","O","N","D"],g=[{key:"direct",label:"Direct",value:45},{key:"search",label:"Search",value:30},{key:"social",label:"Social",value:15},{key:"email",label:"Email",value:10}],x=[{id:"#3201",customer:"Alice Nguyen",total:"$1,204",status:"paid"},{id:"#3202",customer:"Marco Reyes",total:"$642",status:"shipped"},{id:"#3203",customer:"Priya Patel",total:"$2,980",status:"processing"},{id:"#3204",customer:"Tom Becker",total:"$318",status:"overdue"},{id:"#3205",customer:"Sara Lind",total:"$540",status:"refunded"}];function v(){/* @__PURE__ */
|
|
2
2
|
return o(i,{groups:u,children:/* @__PURE__ */o("div",{className:"h-full overflow-auto bg-gray-50 p-6",children:/* @__PURE__ */m("div",{className:"mx-auto max-w-6xl space-y-6",children:[
|
|
3
3
|
/* @__PURE__ */m("div",{className:"flex items-center justify-between gap-4",children:[
|
|
4
4
|
/* @__PURE__ */m("div",{children:[
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import{ChartDefs as t,MOTION as e,stagger as a,glowId as n}from"./chunk-465RRWBY.js";import{ChartSkeleton as i}from"./chunk-EVKBV6IV.js";import{useHighlight as r,autoHighlightIndex as l,highlightOpacity as o}from"./chunk-CNYAHYE6.js";import{ChartTooltip as m}from"./chunk-P5BOTIJU.js";import{CartesianPlot as s}from"./chunk-
|
|
1
|
+
import{ChartDefs as t,MOTION as e,stagger as a,glowId as n}from"./chunk-465RRWBY.js";import{ChartSkeleton as i}from"./chunk-EVKBV6IV.js";import{useHighlight as r,autoHighlightIndex as l,highlightOpacity as o}from"./chunk-CNYAHYE6.js";import{ChartTooltip as m}from"./chunk-P5BOTIJU.js";import{CartesianPlot as s}from"./chunk-PPSIMRJM.js";import{CHART_INK as u,STATUS_VARS as h,resolveSeriesColor as c}from"./chunk-TZFACUMR.js";import{useShellStrings as d,useShellLocale as f}from"./chunk-OVNRVFWS.js";import{formatPercent as b,formatPlain as p}from"./chunk-C3QOHMR6.js";import{useId as x}from"react";import{jsx as y,jsxs as M}from"react/jsx-runtime";function g({series:g,labels:v,stacked:k=!1,stackMode:N="value",height:$=220,width:w,max:F,formatValue:V,yAxisLabel:j,className:L,emptyLabel:A,radius:S=3,loading:C=!1,animate:R=!0,glow:O=!1,emphasise:z=!1,activeKey:B,highlight:E="none",valueLabels:T=!1,onSelect:I,min:P,formatTooltipValue:W,tooltipLabels:Y,barGap:H=4,seriesLabels:J=!1}){const K=x(),{highlighted:U}=r(),G=d().charts,Q=f(),Z=V??(t=>p(t,Q)),q=W??Z;if(C)/* @__PURE__ */return y(i,{height:$,width:w,variant:"bars",className:L});const D=(t,e)=>{const a=t.pointColors?.[e];if(a)return a;const n=t.pointTones?.[e];return n?h[n]:c(t.slot,t.color,t.tone)},X=g.map((t,e)=>({...t,slot:e})).filter(t=>t.data.some(t=>Number.isFinite(t))),_=(t,e)=>{const a=t.data[e];return"number"==typeof a&&Number.isFinite(a)?a:0},tt=v.map((t,e)=>X.reduce((t,a)=>t+_(a,e),0)),et=v.map((t,e)=>X.reduce((t,a)=>t+Math.max(0,_(a,e)),0)),at=v.map((t,e)=>X.reduce((t,a)=>t+Math.min(0,_(a,e)),0)),nt=k&&"percent"===N,it=(t,e)=>tt[e]>0?t/tt[e]:null,rt=nt?[1]:k?[...et,...at]:X.flatMap(t=>t.data.filter(Number.isFinite)),lt=(t,e)=>{const a=t.bandwidth/Math.max(1,X.length),n=X.length>1?Math.min(H,.25*a):0;return{offset:e*a+n/2,width:Math.max(1,a-n)}},ot=J&&!k?({x:t,y:e})=>{const a=Math.min(e.domain[1],Math.max(e.domain[0],0));return v.map((n,i)=>X.map((n,r)=>{const l=n.data[i];if(!Number.isFinite(l))return null;const o=Math.min(e.domain[1],Math.max(e.domain[0],l)),{offset:m,width:s}=lt(t,r),h=t(i)+m+s/2,c=Math.min(e(o),e(a)),d=Math.max(e(o),e(a));if(s<13)return null;const f=Math.floor((d-c-12)/6.6),b=f>=Math.min(4,n.label.length),p=b&&n.label.length>f?`${n.label.slice(0,f-1).trimEnd()}…`:n.label,x=b?d-6:c-4;/* @__PURE__ */
|
|
2
2
|
return y("text",{"data-series-label":"true",x:h,y:x,transform:`rotate(-90 ${h} ${x})`,textAnchor:"start",dominantBaseline:"central",fontSize:11,fill:b?u.surface:u.label,children:p},`n${n.key}-${i}`)}))}:null;/* @__PURE__ */
|
|
3
|
-
return y(s,{labels:v,values:rt,height:$,width:w,max:nt?1:F,min:nt?void 0:
|
|
3
|
+
return y(s,{labels:v,values:rt,height:$,width:w,max:nt?1:F,min:nt?void 0:P,formatValue:nt?t=>b(Math.round(100*t),0,Q):Z,yAxisLabel:j,className:L,emptyLabel:A,onSelect:I,ariaLabel:G.acrossCategories(X.map(t=>t.label),v.length),tooltip:t=>/* @__PURE__ */y(m,{title:Y?.[t]??v[t],rows:X.map(e=>({key:e.key,label:e.label,color:D(e,t),value:Number.isFinite(e.data[t])?nt?`${b(100*(it(e.data[t],t)??0),1,Q)} · ${q(e.data[t])}`:q(e.data[t]):void 0})),footnote:nt?G.inCategory(q(tt[t])):void 0}),overlay:T&&!nt||ot?({x:t,y:e})=>/* @__PURE__ */M("g",{pointerEvents:"none",children:[ot?.({x:t,y:e}),T&&!nt&&v.map((a,n)=>{if(k){if(!X.some(t=>Number.isFinite(t.data[n])))return null;const a=X.reduce((t,e)=>t+_(e,n),0),i=a>=0?et[n]:at[n];/* @__PURE__ */
|
|
4
4
|
return y("text",{"data-value-label":"true",x:t.center(n),y:a>=0?e(i)-4:e(i)+12,textAnchor:"middle",fontSize:11,fill:u.label,style:{fontVariantNumeric:"tabular-nums"},children:Z(a)},`v${n}`)}return X.map((a,i)=>{const r=a.data[n];if(!Number.isFinite(r))return null;const l=r,{offset:o,width:m}=lt(t,i);/* @__PURE__ */
|
|
5
|
-
return y("text",{"data-value-label":"true",x:t(n)+o+m/2,y:l>=0?e(l)-4:e(l)+12,textAnchor:"middle",fontSize:11,fill:u.label,style:{fontVariantNumeric:"tabular-nums"},children:Z(l)},`v${a.key}-${n}`)})})]}):void 0,children:({x:i,y:r,bottom:m,active:s})=>{const h=
|
|
5
|
+
return y("text",{"data-value-label":"true",x:t(n)+o+m/2,y:l>=0?e(l)-4:e(l)+12,textAnchor:"middle",fontSize:11,fill:u.label,style:{fontVariantNumeric:"tabular-nums"},children:Z(l)},`v${a.key}-${n}`)})})]}):void 0,children:({x:i,y:r,bottom:m,active:s})=>{const h=B?v.indexOf(B):-1,c=l(k?tt:X[0]?.data??[],E),d=s??(h>=0?h:c);/* @__PURE__ */
|
|
6
6
|
return M("g",{children:[
|
|
7
|
-
/* @__PURE__ */y(t,{id:
|
|
8
|
-
return y("rect",{x:M,y:v,width:g,height:w,rx:
|
|
7
|
+
/* @__PURE__ */y(t,{id:K,glow:O}),v.map((t,l)=>{let m=0,s=0;const h=r(Math.min(r.domain[1],Math.max(r.domain[0],0)));return X.map((t,c)=>{const f=t.data[l];if(!Number.isFinite(f))return null;const b=nt?it(f,l):f;if(null===b)return null;const p=D(t,l),x=lt(i,c),M=k?i(l):i(l)+x.offset,g=k?Math.max(1,i.bandwidth):x.width;let v,N,$=!0;if(k){const t=b>=0?m:s,e=t+b;b>=0?m=e:s=e,v=r(Math.max(t,e)),N=r(Math.min(t,e)),$=0===t}else v=Math.min(r(b),h),N=Math.max(r(b),h);const w=Math.max(0,N-v-(k&&!$?2:0)),F=null===d||d===l,V=F?p:z?u.muted:p,j=o(t.key,U);/* @__PURE__ */
|
|
8
|
+
return y("rect",{x:M,y:v,width:g,height:w,rx:S,fill:V,fillOpacity:j??(F?1:z?.32:.45),filter:O&&d===l?`url(#${n(K)})`:void 0,className:"rosh-viz-mark"+(R?` ${e.rise}`:""),style:R?a(l*(k?1:X.length)+c,26):void 0},`${t.key}-${l}`)})}),null!==s&&!z&&/* @__PURE__ */y("line",{x1:i.center(s),y1:r(r.domain[1]),x2:i.center(s),y2:m,stroke:u.axis,strokeWidth:1})]})}})}export{g as ColumnChart};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import{areaBetween as e,curvePath as i}from"./chunk-VFC6QUEN.js";import{ChartTooltip as l}from"./chunk-P5BOTIJU.js";import{CartesianPlot as t}from"./chunk-
|
|
2
|
-
return s(t,{labels:d,values:
|
|
1
|
+
import{areaBetween as e,curvePath as i}from"./chunk-VFC6QUEN.js";import{ChartTooltip as l}from"./chunk-P5BOTIJU.js";import{CartesianPlot as t}from"./chunk-PPSIMRJM.js";import{resolveSeriesColor as r,CHART_INK as a}from"./chunk-TZFACUMR.js";import{useShellStrings as o,useShellLocale as n}from"./chunk-OVNRVFWS.js";import{formatPlain as h}from"./chunk-C3QOHMR6.js";import{jsx as s,jsxs as m,Fragment as c}from"react/jsx-runtime";function u({rows:u,labels:d,variant:p="area",curve:f="linear",height:k=220,width:g,max:b,min:x,formatValue:w,yAxisLabel:y,color:j,tone:v,label:L,className:M,emptyLabel:O,radius:N=3}){const V=o().charts,F=n(),P=w??(e=>h(e,F)),R=L??V.range,W=u.flatMap(e=>[e.low,e.high]).filter(Number.isFinite),A=r(0,j,v);/* @__PURE__ */
|
|
2
|
+
return s(t,{labels:d,values:W,height:k,width:g,max:b,min:x,formatValue:P,yAxisLabel:y,className:M,emptyLabel:O,bandPadding:"bar"===p?.34:0,ariaLabel:V.rangeLabel(R,d.length),tooltip:e=>/* @__PURE__ */s(l,{title:d[e],rows:[{key:"high",label:V.high,color:A,value:null==u[e]?void 0:P(u[e].high)},{key:"low",label:V.low,color:A,value:null==u[e]?void 0:P(u[e].low)}]}),children:({x:l,y:t,active:r})=>"bar"===p?/* @__PURE__ */s("g",{children:u.map((e,i)=>/* @__PURE__ */s("rect",{x:l(i),y:t(e.high),width:Math.max(1,l.bandwidth),height:Math.max(1,t(e.low)-t(e.high)),rx:N,fill:A,fillOpacity:null===r||r===i?.85:.4},i))}):/* @__PURE__ */m("g",{children:[(()=>{const r=u.map((e,i)=>[l.center(i),t(e.high)]),a=u.map((e,i)=>[l.center(i),t(e.low)]);/* @__PURE__ */
|
|
3
3
|
return m(c,{children:[
|
|
4
|
-
/* @__PURE__ */s("path",{d:e(i(r,f),a),fill:
|
|
5
|
-
/* @__PURE__ */s("path",{d:i(r,f),fill:"none",stroke:
|
|
6
|
-
/* @__PURE__ */s("path",{d:i(a,f),fill:"none",stroke:
|
|
4
|
+
/* @__PURE__ */s("path",{d:e(i(r,f),a),fill:A,fillOpacity:.2,stroke:"none"}),
|
|
5
|
+
/* @__PURE__ */s("path",{d:i(r,f),fill:"none",stroke:A,strokeWidth:2,strokeLinejoin:"round"}),
|
|
6
|
+
/* @__PURE__ */s("path",{d:i(a,f),fill:"none",stroke:A,strokeWidth:2,strokeLinejoin:"round",strokeOpacity:.7})]})})(),null!==r&&/* @__PURE__ */s("line",{x1:l.center(r),y1:t(u[r].high),x2:l.center(r),y2:t(u[r].low),stroke:a.axis,strokeWidth:1})]})})}export{u as RangeChart};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{ChartTooltip as t}from"./chunk-P5BOTIJU.js";import{CartesianPlot as o}from"./chunk-PPSIMRJM.js";import{binValues as r}from"./chunk-2JWPNR2U.js";import{resolveSeriesColor as a}from"./chunk-TZFACUMR.js";import{useShellStrings as e,useShellLocale as i}from"./chunk-OVNRVFWS.js";import{formatPlain as m,formatFixed as n}from"./chunk-C3QOHMR6.js";import{jsx as l}from"react/jsx-runtime";function c({values:c,bins:s=10,precomputed:h,height:u=220,width:p,color:b,tone:f,formatBound:d,formatCount:x,yAxisLabel:g,label:k,className:y,emptyLabel:j}){const M=e().charts,v=i(),w=d??(t=>Number.isInteger(t)?m(t,v):n(t,1,v)),A=x??(t=>m(t,v)),L=g??M.countAxis,N=k??M.distribution,P=h??r(c??[],s),R=a(0,b,f),O=P.map(t=>w(t.from)),C=P.map(t=>t.count);/* @__PURE__ */
|
|
2
|
+
return l(o,{labels:O,values:C,height:u,width:p,bandPadding:0,xTickAnchor:"start",formatValue:A,yAxisLabel:L,className:y,emptyLabel:j,ariaLabel:M.histogram(N,P.length,(c??[]).length),tooltip:o=>/* @__PURE__ */l(t,{title:`${w(P[o].from)} – ${w(P[o].to)}`,rows:[{key:"count",label:M.observations,color:R,value:A(P[o].count)}]}),children:({x:t,y:o,bottom:r,active:a})=>/* @__PURE__ */l("g",{children:P.map((e,i)=>/* @__PURE__ */l("rect",{x:t(i)+.5,y:o(e.count),width:Math.max(1,t.bandwidth-1),height:Math.max(0,r-o(e.count)),fill:R,fillOpacity:null===a||a===i?.85:.42},i))})})}export{c as HistogramChart};
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { MetricType } from 'web-vitals';
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
* `startClientTelemetry` — web vitals and client errors from a portal page to
|
|
3
5
|
* the backend's intake (docs/adr/0057 section 4).
|
|
@@ -19,24 +21,27 @@
|
|
|
19
21
|
* Not `sendBeacon`: it cannot carry an `Authorization` header, and the intake
|
|
20
22
|
* is authenticated (ADR 0057 rejects a cookie-only telemetry session). A
|
|
21
23
|
* failed send is dropped, never retried.
|
|
24
|
+
*
|
|
25
|
+
* `anonymous: true` is the public storefront's mode (ADR 0057 section 4, s2):
|
|
26
|
+
* vitals only, to the storefront intake, with no token, no cookie and no
|
|
27
|
+
* error listener or boundary sink. Nothing is kept in the browser. A page
|
|
28
|
+
* load that is sampled out starts nothing at all.
|
|
22
29
|
*/
|
|
23
30
|
|
|
24
|
-
interface
|
|
31
|
+
interface ClientTelemetryOptions {
|
|
25
32
|
/** The web app's code at the intake: `admin-portal`, `customer-portal`,
|
|
26
|
-
* `supplier-portal`, `dealer-portal` or `
|
|
33
|
+
* `supplier-portal`, `dealer-portal`, `pos`, or `storefront` (anonymous). */
|
|
27
34
|
app: string;
|
|
28
35
|
/** This build's version, as the host's own package names it. */
|
|
29
36
|
release: string;
|
|
30
|
-
/** The bearer token for the intake, read at send time. Nothing is sent
|
|
31
|
-
* while it answers null (signed out). */
|
|
32
|
-
getAccessToken: () => string | null | undefined;
|
|
33
37
|
/** The current route TEMPLATE (`/sales-orders/:id`) or the active window's
|
|
34
38
|
* key — never `location.href`. A raw path is cleaned, but a template is
|
|
35
39
|
* what groups well. */
|
|
36
40
|
routeKey: () => string | null | undefined;
|
|
37
41
|
/** The host's switch. `false` starts nothing. Default `true`. */
|
|
38
42
|
enabled?: boolean;
|
|
39
|
-
/**
|
|
43
|
+
/** The intake. Default `/api/client-telemetry/web-batches/`, or
|
|
44
|
+
* `/api/storefront-analytics/web-vitals/` when `anonymous`. */
|
|
40
45
|
endpoint?: string;
|
|
41
46
|
/** Share of page loads whose vitals are collected, 0 to 1. Default 1.
|
|
42
47
|
* Errors are never sampled. */
|
|
@@ -47,7 +52,22 @@ interface ClientTelemetryConfig {
|
|
|
47
52
|
fetch?: typeof fetch;
|
|
48
53
|
/** For tests; defaults to `Math.random`. */
|
|
49
54
|
random?: () => number;
|
|
55
|
+
/** For tests; defaults to subscribing to every `web-vitals` metric. */
|
|
56
|
+
observeVitals?: (report: (metric: MetricType) => void) => void;
|
|
57
|
+
}
|
|
58
|
+
/** A signed-in portal page: vitals and errors, under the bearer token. */
|
|
59
|
+
interface SignedInClientTelemetryConfig extends ClientTelemetryOptions {
|
|
60
|
+
anonymous?: false;
|
|
61
|
+
/** The bearer token for the intake, read at send time. Nothing is sent
|
|
62
|
+
* while it answers null (signed out). */
|
|
63
|
+
getAccessToken: () => string | null | undefined;
|
|
64
|
+
}
|
|
65
|
+
/** A public page (the storefront): vitals only, no token and no cookie. */
|
|
66
|
+
interface AnonymousClientTelemetryConfig extends ClientTelemetryOptions {
|
|
67
|
+
anonymous: true;
|
|
68
|
+
getAccessToken?: never;
|
|
50
69
|
}
|
|
70
|
+
type ClientTelemetryConfig = SignedInClientTelemetryConfig | AnonymousClientTelemetryConfig;
|
|
51
71
|
interface ClientTelemetry {
|
|
52
72
|
/** Send what is queued now. */
|
|
53
73
|
flush(): void;
|
|
@@ -57,9 +77,10 @@ interface ClientTelemetry {
|
|
|
57
77
|
stop(): void;
|
|
58
78
|
}
|
|
59
79
|
/**
|
|
60
|
-
* Start collecting for this page. Call once, after sign-in is known
|
|
61
|
-
*
|
|
80
|
+
* Start collecting for this page. Call once, after sign-in is known (or, for
|
|
81
|
+
* `anonymous`, once the page may be measured); a second call replaces the
|
|
82
|
+
* first. Returns a handle to flush, report or stop.
|
|
62
83
|
*/
|
|
63
84
|
declare function startClientTelemetry(config: ClientTelemetryConfig): ClientTelemetry;
|
|
64
85
|
|
|
65
|
-
export { type ClientTelemetry as C, type ClientTelemetryConfig as a, startClientTelemetry as s };
|
|
86
|
+
export { type AnonymousClientTelemetryConfig as A, type ClientTelemetry as C, type SignedInClientTelemetryConfig as S, type ClientTelemetryConfig as a, startClientTelemetry as s };
|
package/dist/index.d.ts
CHANGED
|
@@ -200,8 +200,9 @@ import react__default, { ReactNode, Component, ErrorInfo, Dispatch, SetStateActi
|
|
|
200
200
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
201
201
|
import * as _tanstack_query_core from '@tanstack/query-core';
|
|
202
202
|
import { AxiosInstance } from 'axios';
|
|
203
|
-
export { C as ClientTelemetry, a as ClientTelemetryConfig, s as startClientTelemetry } from './client-
|
|
203
|
+
export { A as AnonymousClientTelemetryConfig, C as ClientTelemetry, a as ClientTelemetryConfig, S as SignedInClientTelemetryConfig, s as startClientTelemetry } from './client-DZeDEyG1.js';
|
|
204
204
|
import './moveGrip-sB7jfCia.js';
|
|
205
|
+
import 'web-vitals';
|
|
205
206
|
|
|
206
207
|
/**
|
|
207
208
|
* createWindowRegistry — composes a window registry from one or more partial
|