@krizaka/charts 0.0.0-stage → 0.2.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/LICENSE +202 -0
- package/README.md +59 -2
- package/dist/bar.d.ts +17 -0
- package/dist/bar.js +17 -0
- package/dist/bar.js.map +1 -0
- package/dist/candlestick-IG626XL4.js +13 -0
- package/dist/candlestick-IG626XL4.js.map +1 -0
- package/dist/candlestick.d.ts +42 -0
- package/dist/candlestick.js +13 -0
- package/dist/candlestick.js.map +1 -0
- package/dist/canvas-4MSYDVFO.js +14 -0
- package/dist/canvas-4MSYDVFO.js.map +1 -0
- package/dist/cartesian-BRhNQ3ib.d.ts +34 -0
- package/dist/chart.d.ts +58 -0
- package/dist/chart.js +11 -0
- package/dist/chart.js.map +1 -0
- package/dist/chunk-3CJHBJXA.js +186 -0
- package/dist/chunk-3CJHBJXA.js.map +1 -0
- package/dist/chunk-4LBXEAGC.js +133 -0
- package/dist/chunk-4LBXEAGC.js.map +1 -0
- package/dist/chunk-6FINSUOS.js +49 -0
- package/dist/chunk-6FINSUOS.js.map +1 -0
- package/dist/chunk-AA5EWWYV.js +38 -0
- package/dist/chunk-AA5EWWYV.js.map +1 -0
- package/dist/chunk-ANUCSRUN.js +43 -0
- package/dist/chunk-ANUCSRUN.js.map +1 -0
- package/dist/chunk-ARARFMNE.js +88 -0
- package/dist/chunk-ARARFMNE.js.map +1 -0
- package/dist/chunk-BISL7DYW.js +66 -0
- package/dist/chunk-BISL7DYW.js.map +1 -0
- package/dist/chunk-BV4DBGN7.js +178 -0
- package/dist/chunk-BV4DBGN7.js.map +1 -0
- package/dist/chunk-C4MFZLJM.js +19 -0
- package/dist/chunk-C4MFZLJM.js.map +1 -0
- package/dist/chunk-CSSZLFLO.js +116 -0
- package/dist/chunk-CSSZLFLO.js.map +1 -0
- package/dist/chunk-CVWSMUUB.js +378 -0
- package/dist/chunk-CVWSMUUB.js.map +1 -0
- package/dist/chunk-E5DKBSWX.js +2 -0
- package/dist/chunk-E5DKBSWX.js.map +1 -0
- package/dist/chunk-EEP7PS2L.js +54 -0
- package/dist/chunk-EEP7PS2L.js.map +1 -0
- package/dist/chunk-EQLC2QVN.js +73 -0
- package/dist/chunk-EQLC2QVN.js.map +1 -0
- package/dist/chunk-FINOPIDN.js +2 -0
- package/dist/chunk-FINOPIDN.js.map +1 -0
- package/dist/chunk-G2KF2WL4.js +2 -0
- package/dist/chunk-G2KF2WL4.js.map +1 -0
- package/dist/chunk-I3D7KUGN.js +205 -0
- package/dist/chunk-I3D7KUGN.js.map +1 -0
- package/dist/chunk-IKQV3NSL.js +76 -0
- package/dist/chunk-IKQV3NSL.js.map +1 -0
- package/dist/chunk-JTKR7ZWP.js +468 -0
- package/dist/chunk-JTKR7ZWP.js.map +1 -0
- package/dist/chunk-KNDHO67X.js +78 -0
- package/dist/chunk-KNDHO67X.js.map +1 -0
- package/dist/chunk-L2EKYWVI.js +94 -0
- package/dist/chunk-L2EKYWVI.js.map +1 -0
- package/dist/chunk-MXLITIGU.js +92 -0
- package/dist/chunk-MXLITIGU.js.map +1 -0
- package/dist/chunk-NCIQMRV3.js +155 -0
- package/dist/chunk-NCIQMRV3.js.map +1 -0
- package/dist/chunk-OB5EFDDH.js +118 -0
- package/dist/chunk-OB5EFDDH.js.map +1 -0
- package/dist/chunk-OIRHLJBC.js +83 -0
- package/dist/chunk-OIRHLJBC.js.map +1 -0
- package/dist/chunk-PBQV3B6O.js +145 -0
- package/dist/chunk-PBQV3B6O.js.map +1 -0
- package/dist/chunk-POQIHFAZ.js +2 -0
- package/dist/chunk-POQIHFAZ.js.map +1 -0
- package/dist/chunk-PWMMXRMC.js +234 -0
- package/dist/chunk-PWMMXRMC.js.map +1 -0
- package/dist/chunk-SLEJDQ3A.js +81 -0
- package/dist/chunk-SLEJDQ3A.js.map +1 -0
- package/dist/chunk-TPJDOB7R.js +15 -0
- package/dist/chunk-TPJDOB7R.js.map +1 -0
- package/dist/chunk-VKZZY2QD.js +103 -0
- package/dist/chunk-VKZZY2QD.js.map +1 -0
- package/dist/chunk-W5FX4TU3.js +102 -0
- package/dist/chunk-W5FX4TU3.js.map +1 -0
- package/dist/chunk-W5ILLSPK.js +107 -0
- package/dist/chunk-W5ILLSPK.js.map +1 -0
- package/dist/chunk-WBHFVBSK.js +25 -0
- package/dist/chunk-WBHFVBSK.js.map +1 -0
- package/dist/chunk-WNUFGMS7.js +113 -0
- package/dist/chunk-WNUFGMS7.js.map +1 -0
- package/dist/chunk-WVTIKOII.js +15 -0
- package/dist/chunk-WVTIKOII.js.map +1 -0
- package/dist/chunk-XDDALY4C.js +166 -0
- package/dist/chunk-XDDALY4C.js.map +1 -0
- package/dist/chunk-XLLYNNC6.js +89 -0
- package/dist/chunk-XLLYNNC6.js.map +1 -0
- package/dist/context-BgYUymEO.d.ts +163 -0
- package/dist/credits.d.ts +42 -0
- package/dist/credits.js +21 -0
- package/dist/credits.js.map +1 -0
- package/dist/earnings.d.ts +29 -0
- package/dist/earnings.js +22 -0
- package/dist/earnings.js.map +1 -0
- package/dist/frame-I7_xYGy5.d.ts +45 -0
- package/dist/full-S2MBPEEP.js +11 -0
- package/dist/full-S2MBPEEP.js.map +1 -0
- package/dist/funnel-QU5ZPC52.js +13 -0
- package/dist/funnel-QU5ZPC52.js.map +1 -0
- package/dist/funnel.d.ts +26 -0
- package/dist/funnel.js +13 -0
- package/dist/funnel.js.map +1 -0
- package/dist/gauge.d.ts +38 -0
- package/dist/gauge.js +13 -0
- package/dist/gauge.js.map +1 -0
- package/dist/geo.d.ts +37 -0
- package/dist/geo.js +13 -0
- package/dist/geo.js.map +1 -0
- package/dist/globe.d.ts +36 -0
- package/dist/globe.js +12 -0
- package/dist/globe.js.map +1 -0
- package/dist/goal.d.ts +26 -0
- package/dist/goal.js +17 -0
- package/dist/goal.js.map +1 -0
- package/dist/heatmap-JWQOKUGM.js +13 -0
- package/dist/heatmap-JWQOKUGM.js.map +1 -0
- package/dist/heatmap.d.ts +47 -0
- package/dist/heatmap.js +15 -0
- package/dist/heatmap.js.map +1 -0
- package/dist/host-_F8RgiIz.d.ts +15 -0
- package/dist/index.d.ts +29 -0
- package/dist/index.js +148 -0
- package/dist/index.js.map +1 -0
- package/dist/labels-DE_743fQ.d.ts +72 -0
- package/dist/latency.d.ts +33 -0
- package/dist/latency.js +24 -0
- package/dist/latency.js.map +1 -0
- package/dist/line.d.ts +25 -0
- package/dist/line.js +19 -0
- package/dist/line.js.map +1 -0
- package/dist/native.d.ts +494 -0
- package/dist/native.js +1244 -0
- package/dist/native.js.map +1 -0
- package/dist/pie.d.ts +37 -0
- package/dist/pie.js +16 -0
- package/dist/pie.js.map +1 -0
- package/dist/provider.d.ts +73 -0
- package/dist/provider.js +24 -0
- package/dist/provider.js.map +1 -0
- package/dist/radar-75GRJ2IK.js +13 -0
- package/dist/radar-75GRJ2IK.js.map +1 -0
- package/dist/radar.d.ts +22 -0
- package/dist/radar.js +13 -0
- package/dist/radar.js.map +1 -0
- package/dist/sankey-XQTX2EG6.js +13 -0
- package/dist/sankey-XQTX2EG6.js.map +1 -0
- package/dist/sankey.d.ts +28 -0
- package/dist/sankey.js +13 -0
- package/dist/sankey.js.map +1 -0
- package/dist/scatter-XSNG4OKD.js +13 -0
- package/dist/scatter-XSNG4OKD.js.map +1 -0
- package/dist/scatter.d.ts +41 -0
- package/dist/scatter.js +15 -0
- package/dist/scatter.js.map +1 -0
- package/dist/sparkline.d.ts +26 -0
- package/dist/sparkline.js +16 -0
- package/dist/sparkline.js.map +1 -0
- package/dist/svg-BJUHYX3B.js +14 -0
- package/dist/svg-BJUHYX3B.js.map +1 -0
- package/dist/throughput.d.ts +37 -0
- package/dist/throughput.js +24 -0
- package/dist/throughput.js.map +1 -0
- package/dist/ticker.d.ts +38 -0
- package/dist/ticker.js +22 -0
- package/dist/ticker.js.map +1 -0
- package/dist/treemap-OMGGGB5U.js +13 -0
- package/dist/treemap-OMGGGB5U.js.map +1 -0
- package/dist/treemap.d.ts +24 -0
- package/dist/treemap.js +14 -0
- package/dist/treemap.js.map +1 -0
- package/dist/world-110m-DVFWXS42.js +18 -0
- package/dist/world-110m-DVFWXS42.js.map +1 -0
- package/package.json +614 -3
- package/registry/area-chart.json +785 -0
- package/registry/bar-chart.json +784 -0
- package/registry/calendar-heatmap.json +460 -0
- package/registry/candlestick.json +553 -0
- package/registry/chart.json +441 -0
- package/registry/charts-provider.json +191 -0
- package/registry/credit-usage.json +473 -0
- package/registry/earnings-chart.json +703 -0
- package/registry/examples/area-chart/credits-usage.d.ts +4 -0
- package/registry/examples/area-chart/credits-usage.js +38 -0
- package/registry/examples/area-chart/credits-usage.tsx +32 -0
- package/registry/examples/area-chart/native/credits-usage.d.ts +4 -0
- package/registry/examples/area-chart/native/credits-usage.dark.png +0 -0
- package/registry/examples/area-chart/native/credits-usage.js +33 -0
- package/registry/examples/area-chart/native/credits-usage.light.png +0 -0
- package/registry/examples/area-chart/native/credits-usage.tsx +27 -0
- package/registry/examples/area-chart/storage.d.ts +4 -0
- package/registry/examples/area-chart/storage.js +27 -0
- package/registry/examples/area-chart/storage.tsx +21 -0
- package/registry/examples/bar-chart/jobs-by-status.d.ts +4 -0
- package/registry/examples/bar-chart/jobs-by-status.js +37 -0
- package/registry/examples/bar-chart/jobs-by-status.tsx +31 -0
- package/registry/examples/bar-chart/native/jobs-by-status.d.ts +4 -0
- package/registry/examples/bar-chart/native/jobs-by-status.dark.png +0 -0
- package/registry/examples/bar-chart/native/jobs-by-status.js +32 -0
- package/registry/examples/bar-chart/native/jobs-by-status.light.png +0 -0
- package/registry/examples/bar-chart/native/jobs-by-status.tsx +26 -0
- package/registry/examples/bar-chart/plans-by-quarter.d.ts +4 -0
- package/registry/examples/bar-chart/plans-by-quarter.js +31 -0
- package/registry/examples/bar-chart/plans-by-quarter.tsx +26 -0
- package/registry/examples/bar-chart/top-supporters.d.ts +4 -0
- package/registry/examples/bar-chart/top-supporters.js +32 -0
- package/registry/examples/bar-chart/top-supporters.tsx +27 -0
- package/registry/examples/calendar-heatmap/publishing.d.ts +4 -0
- package/registry/examples/calendar-heatmap/publishing.js +28 -0
- package/registry/examples/calendar-heatmap/publishing.tsx +23 -0
- package/registry/examples/candlestick/auction-bids.d.ts +4 -0
- package/registry/examples/candlestick/auction-bids.js +37 -0
- package/registry/examples/candlestick/auction-bids.tsx +32 -0
- package/registry/examples/chart/polar-uploads.d.ts +4 -0
- package/registry/examples/chart/polar-uploads.js +34 -0
- package/registry/examples/chart/polar-uploads.tsx +30 -0
- package/registry/examples/charts-provider/french-orazaka.d.ts +4 -0
- package/registry/examples/charts-provider/french-orazaka.js +26 -0
- package/registry/examples/charts-provider/french-orazaka.tsx +22 -0
- package/registry/examples/charts-provider/native/french-orazaka.d.ts +4 -0
- package/registry/examples/charts-provider/native/french-orazaka.dark.png +0 -0
- package/registry/examples/charts-provider/native/french-orazaka.js +17 -0
- package/registry/examples/charts-provider/native/french-orazaka.light.png +0 -0
- package/registry/examples/charts-provider/native/french-orazaka.tsx +17 -0
- package/registry/examples/credit-usage/monthly-credits.d.ts +4 -0
- package/registry/examples/credit-usage/monthly-credits.js +24 -0
- package/registry/examples/credit-usage/monthly-credits.tsx +19 -0
- package/registry/examples/credit-usage/native/monthly-credits.d.ts +4 -0
- package/registry/examples/credit-usage/native/monthly-credits.dark.png +0 -0
- package/registry/examples/credit-usage/native/monthly-credits.js +23 -0
- package/registry/examples/credit-usage/native/monthly-credits.light.png +0 -0
- package/registry/examples/credit-usage/native/monthly-credits.tsx +18 -0
- package/registry/examples/credit-usage/storage-plan.d.ts +4 -0
- package/registry/examples/credit-usage/storage-plan.js +21 -0
- package/registry/examples/credit-usage/storage-plan.tsx +15 -0
- package/registry/examples/earnings-chart/creator-month.d.ts +4 -0
- package/registry/examples/earnings-chart/creator-month.js +29 -0
- package/registry/examples/earnings-chart/creator-month.tsx +24 -0
- package/registry/examples/earnings-chart/gross-and-net.d.ts +4 -0
- package/registry/examples/earnings-chart/gross-and-net.js +29 -0
- package/registry/examples/earnings-chart/gross-and-net.tsx +24 -0
- package/registry/examples/earnings-chart/native/creator-month.d.ts +4 -0
- package/registry/examples/earnings-chart/native/creator-month.dark.png +0 -0
- package/registry/examples/earnings-chart/native/creator-month.js +29 -0
- package/registry/examples/earnings-chart/native/creator-month.light.png +0 -0
- package/registry/examples/earnings-chart/native/creator-month.tsx +24 -0
- package/registry/examples/funnel/signup.d.ts +4 -0
- package/registry/examples/funnel/signup.js +30 -0
- package/registry/examples/funnel/signup.tsx +24 -0
- package/registry/examples/gauge/challenge-goal.d.ts +4 -0
- package/registry/examples/gauge/challenge-goal.js +24 -0
- package/registry/examples/gauge/challenge-goal.tsx +18 -0
- package/registry/examples/gauge/credits-quota.d.ts +4 -0
- package/registry/examples/gauge/credits-quota.js +26 -0
- package/registry/examples/gauge/credits-quota.tsx +19 -0
- package/registry/examples/gauge/native/credits-quota.d.ts +4 -0
- package/registry/examples/gauge/native/credits-quota.dark.png +0 -0
- package/registry/examples/gauge/native/credits-quota.js +25 -0
- package/registry/examples/gauge/native/credits-quota.light.png +0 -0
- package/registry/examples/gauge/native/credits-quota.tsx +18 -0
- package/registry/examples/geo-map/viewers.d.ts +4 -0
- package/registry/examples/geo-map/viewers.js +43 -0
- package/registry/examples/geo-map/viewers.tsx +29 -0
- package/registry/examples/globe/deployment-regions.d.ts +4 -0
- package/registry/examples/globe/deployment-regions.js +36 -0
- package/registry/examples/globe/deployment-regions.tsx +30 -0
- package/registry/examples/goal-progress/challenge-pot.d.ts +4 -0
- package/registry/examples/goal-progress/challenge-pot.js +22 -0
- package/registry/examples/goal-progress/challenge-pot.tsx +16 -0
- package/registry/examples/goal-progress/goal-reached.d.ts +4 -0
- package/registry/examples/goal-progress/goal-reached.js +11 -0
- package/registry/examples/goal-progress/goal-reached.tsx +6 -0
- package/registry/examples/goal-progress/native/challenge-pot.d.ts +4 -0
- package/registry/examples/goal-progress/native/challenge-pot.dark.png +0 -0
- package/registry/examples/goal-progress/native/challenge-pot.js +11 -0
- package/registry/examples/goal-progress/native/challenge-pot.light.png +0 -0
- package/registry/examples/goal-progress/native/challenge-pot.tsx +6 -0
- package/registry/examples/heatmap/upload-activity.d.ts +4 -0
- package/registry/examples/heatmap/upload-activity.js +30 -0
- package/registry/examples/heatmap/upload-activity.tsx +25 -0
- package/registry/examples/job-throughput/live-hours.d.ts +4 -0
- package/registry/examples/job-throughput/live-hours.js +33 -0
- package/registry/examples/job-throughput/live-hours.tsx +28 -0
- package/registry/examples/job-throughput/native/week-of-jobs.d.ts +4 -0
- package/registry/examples/job-throughput/native/week-of-jobs.dark.png +0 -0
- package/registry/examples/job-throughput/native/week-of-jobs.js +20 -0
- package/registry/examples/job-throughput/native/week-of-jobs.light.png +0 -0
- package/registry/examples/job-throughput/native/week-of-jobs.tsx +16 -0
- package/registry/examples/job-throughput/week-of-jobs.d.ts +4 -0
- package/registry/examples/job-throughput/week-of-jobs.js +20 -0
- package/registry/examples/job-throughput/week-of-jobs.tsx +16 -0
- package/registry/examples/latency-chart/by-capability.d.ts +4 -0
- package/registry/examples/latency-chart/by-capability.js +26 -0
- package/registry/examples/latency-chart/by-capability.tsx +21 -0
- package/registry/examples/latency-chart/native/by-capability.d.ts +4 -0
- package/registry/examples/latency-chart/native/by-capability.dark.png +0 -0
- package/registry/examples/latency-chart/native/by-capability.js +17 -0
- package/registry/examples/latency-chart/native/by-capability.light.png +0 -0
- package/registry/examples/latency-chart/native/by-capability.tsx +13 -0
- package/registry/examples/latency-chart/time-to-result.d.ts +4 -0
- package/registry/examples/latency-chart/time-to-result.js +27 -0
- package/registry/examples/latency-chart/time-to-result.tsx +22 -0
- package/registry/examples/line-chart/creator-earnings.d.ts +4 -0
- package/registry/examples/line-chart/creator-earnings.js +35 -0
- package/registry/examples/line-chart/creator-earnings.tsx +30 -0
- package/registry/examples/line-chart/forecast.d.ts +4 -0
- package/registry/examples/line-chart/forecast.js +36 -0
- package/registry/examples/line-chart/forecast.tsx +30 -0
- package/registry/examples/line-chart/live-jobs.d.ts +4 -0
- package/registry/examples/line-chart/live-jobs.js +21 -0
- package/registry/examples/line-chart/live-jobs.tsx +23 -0
- package/registry/examples/line-chart/native/creator-earnings.d.ts +4 -0
- package/registry/examples/line-chart/native/creator-earnings.dark.png +0 -0
- package/registry/examples/line-chart/native/creator-earnings.js +32 -0
- package/registry/examples/line-chart/native/creator-earnings.light.png +0 -0
- package/registry/examples/line-chart/native/creator-earnings.tsx +26 -0
- package/registry/examples/line-chart/states.d.ts +4 -0
- package/registry/examples/line-chart/states.js +16 -0
- package/registry/examples/line-chart/states.tsx +13 -0
- package/registry/examples/pie-chart/credit-spend.d.ts +4 -0
- package/registry/examples/pie-chart/credit-spend.js +30 -0
- package/registry/examples/pie-chart/credit-spend.tsx +24 -0
- package/registry/examples/pie-chart/native/credit-spend.d.ts +4 -0
- package/registry/examples/pie-chart/native/credit-spend.dark.png +0 -0
- package/registry/examples/pie-chart/native/credit-spend.js +17 -0
- package/registry/examples/pie-chart/native/credit-spend.light.png +0 -0
- package/registry/examples/pie-chart/native/credit-spend.tsx +12 -0
- package/registry/examples/pie-chart/storage-by-kind.d.ts +4 -0
- package/registry/examples/pie-chart/storage-by-kind.js +31 -0
- package/registry/examples/pie-chart/storage-by-kind.tsx +26 -0
- package/registry/examples/price-ticker/auction-room.d.ts +4 -0
- package/registry/examples/price-ticker/auction-room.js +21 -0
- package/registry/examples/price-ticker/auction-room.tsx +17 -0
- package/registry/examples/price-ticker/native/auction-room.d.ts +4 -0
- package/registry/examples/price-ticker/native/auction-room.dark.png +0 -0
- package/registry/examples/price-ticker/native/auction-room.js +19 -0
- package/registry/examples/price-ticker/native/auction-room.light.png +0 -0
- package/registry/examples/price-ticker/native/auction-room.tsx +15 -0
- package/registry/examples/price-ticker/no-bid-yet.d.ts +4 -0
- package/registry/examples/price-ticker/no-bid-yet.js +11 -0
- package/registry/examples/price-ticker/no-bid-yet.tsx +6 -0
- package/registry/examples/radar-chart/model-comparison.d.ts +4 -0
- package/registry/examples/radar-chart/model-comparison.js +33 -0
- package/registry/examples/radar-chart/model-comparison.tsx +28 -0
- package/registry/examples/sankey/credit-flow.d.ts +4 -0
- package/registry/examples/sankey/credit-flow.js +37 -0
- package/registry/examples/sankey/credit-flow.tsx +32 -0
- package/registry/examples/scatter-chart/watch-time.d.ts +4 -0
- package/registry/examples/scatter-chart/watch-time.js +36 -0
- package/registry/examples/scatter-chart/watch-time.tsx +31 -0
- package/registry/examples/sparkline/bars.d.ts +4 -0
- package/registry/examples/sparkline/bars.js +12 -0
- package/registry/examples/sparkline/bars.tsx +7 -0
- package/registry/examples/sparkline/native/stat-trend.d.ts +4 -0
- package/registry/examples/sparkline/native/stat-trend.dark.png +0 -0
- package/registry/examples/sparkline/native/stat-trend.js +12 -0
- package/registry/examples/sparkline/native/stat-trend.light.png +0 -0
- package/registry/examples/sparkline/native/stat-trend.tsx +7 -0
- package/registry/examples/sparkline/stat-trend.d.ts +4 -0
- package/registry/examples/sparkline/stat-trend.js +18 -0
- package/registry/examples/sparkline/stat-trend.tsx +15 -0
- package/registry/examples/sparkline/table-rows.d.ts +4 -0
- package/registry/examples/sparkline/table-rows.js +23 -0
- package/registry/examples/sparkline/table-rows.tsx +26 -0
- package/registry/examples/treemap/storage.d.ts +4 -0
- package/registry/examples/treemap/storage.js +17 -0
- package/registry/examples/treemap/storage.tsx +13 -0
- package/registry/funnel.json +487 -0
- package/registry/gauge.json +600 -0
- package/registry/geo-map.json +484 -0
- package/registry/globe.json +469 -0
- package/registry/goal-progress.json +520 -0
- package/registry/heatmap.json +531 -0
- package/registry/index.json +582 -0
- package/registry/job-throughput.json +654 -0
- package/registry/latency-chart.json +671 -0
- package/registry/line-chart.json +793 -0
- package/registry/pie-chart.json +1288 -0
- package/registry/price-ticker.json +684 -0
- package/registry/radar-chart.json +459 -0
- package/registry/sankey.json +503 -0
- package/registry/scatter-chart.json +559 -0
- package/registry/sparkline.json +563 -0
- package/registry/treemap.json +432 -0
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
useWorld
|
|
4
|
+
} from "./chunk-6FINSUOS.js";
|
|
5
|
+
import {
|
|
6
|
+
valueFormatter
|
|
7
|
+
} from "./chunk-XLLYNNC6.js";
|
|
8
|
+
import {
|
|
9
|
+
ChartFrame,
|
|
10
|
+
Tooltip,
|
|
11
|
+
colorOf,
|
|
12
|
+
useInView,
|
|
13
|
+
useMounted,
|
|
14
|
+
useReducedMotion,
|
|
15
|
+
useSettings
|
|
16
|
+
} from "./chunk-JTKR7ZWP.js";
|
|
17
|
+
import {
|
|
18
|
+
fill
|
|
19
|
+
} from "./chunk-3CJHBJXA.js";
|
|
20
|
+
|
|
21
|
+
// src/globe/globe.tsx
|
|
22
|
+
import { geoDistance, geoGraticule10, geoInterpolate, geoOrthographic, geoPath } from "d3-geo";
|
|
23
|
+
import { useEffect, useId, useMemo, useRef, useState } from "react";
|
|
24
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
25
|
+
var SPEED = 6;
|
|
26
|
+
function Globe3D(props) {
|
|
27
|
+
const { points, arcs = [], regions = [], format, center, autoRotate = true, pointLabel, valueLabel } = props;
|
|
28
|
+
const { locale, labels } = useSettings(props);
|
|
29
|
+
const mounted = useMounted();
|
|
30
|
+
const { world, failed } = useWorld(mounted);
|
|
31
|
+
const reduced = useReducedMotion();
|
|
32
|
+
const plotRef = useRef(null);
|
|
33
|
+
const onScreen = useInView(plotRef, { margin: "0px" });
|
|
34
|
+
const fmt = useMemo(() => valueFormatter(format, locale, labels.noValue), [format, locale, labels.noValue]);
|
|
35
|
+
const uid = useId().replace(/:/g, "");
|
|
36
|
+
const start = center ?? (points[0] ? [points[0].lon, points[0].lat] : [0, 20]);
|
|
37
|
+
const [rotation, setRotation] = useState([-start[0], -Math.max(-60, Math.min(60, start[1]))]);
|
|
38
|
+
const [active, setActive] = useState(null);
|
|
39
|
+
const [dragging, setDragging] = useState(false);
|
|
40
|
+
const drag = useRef(null);
|
|
41
|
+
const highlighted = useMemo(() => new Set(regions.map((r) => r.toUpperCase())), [regions]);
|
|
42
|
+
const turning = autoRotate && !reduced && onScreen && !dragging && active === null && mounted && Boolean(world);
|
|
43
|
+
useEffect(() => {
|
|
44
|
+
if (!turning) return void 0;
|
|
45
|
+
let frame = 0;
|
|
46
|
+
let last = performance.now();
|
|
47
|
+
const tick = (now) => {
|
|
48
|
+
if (now - last >= 33 && document.visibilityState === "visible") {
|
|
49
|
+
const dt = (now - last) / 1e3;
|
|
50
|
+
last = now;
|
|
51
|
+
setRotation(([lon, lat]) => [lon + SPEED * dt, lat]);
|
|
52
|
+
} else if (document.visibilityState !== "visible") last = now;
|
|
53
|
+
frame = requestAnimationFrame(tick);
|
|
54
|
+
};
|
|
55
|
+
frame = requestAnimationFrame(tick);
|
|
56
|
+
return () => cancelAnimationFrame(frame);
|
|
57
|
+
}, [turning]);
|
|
58
|
+
const pointAt = (ref) => {
|
|
59
|
+
if (typeof ref !== "string") return [ref[0], ref[1]];
|
|
60
|
+
const p = points.find((q) => q.label === ref);
|
|
61
|
+
return p ? [p.lon, p.lat] : null;
|
|
62
|
+
};
|
|
63
|
+
const summary = points.length ? `${fill(labels.summaryIntro, { kind: labels.kinds.globe, count: points.length })} ${points.map((p) => p.value == null ? p.label : `${p.label} ${fmt(p.value)}`).join(", ")}.` : labels.empty;
|
|
64
|
+
const table = { columns: [pointLabel ?? labels.category, valueLabel ?? labels.value, "lon", "lat"], rows: points.map((p) => [p.label, p.value == null ? labels.noValue : fmt(p.value), p.lon.toFixed(2), p.lat.toFixed(2)]) };
|
|
65
|
+
const focus = (i) => {
|
|
66
|
+
setActive(i);
|
|
67
|
+
if (i !== null) {
|
|
68
|
+
const p = points[i];
|
|
69
|
+
setRotation([-p.lon, -Math.max(-60, Math.min(60, p.lat))]);
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
const onKeyDown = (event) => {
|
|
73
|
+
const n = points.length;
|
|
74
|
+
if (!n) return;
|
|
75
|
+
const moves = {
|
|
76
|
+
ArrowRight: () => ((active ?? -1) + 1) % n,
|
|
77
|
+
ArrowDown: () => ((active ?? -1) + 1) % n,
|
|
78
|
+
ArrowLeft: () => ((active ?? 0) - 1 + n) % n,
|
|
79
|
+
ArrowUp: () => ((active ?? 0) - 1 + n) % n,
|
|
80
|
+
Home: () => 0,
|
|
81
|
+
End: () => n - 1,
|
|
82
|
+
Escape: () => null
|
|
83
|
+
};
|
|
84
|
+
const move = moves[event.key];
|
|
85
|
+
if (!move) return;
|
|
86
|
+
event.preventDefault();
|
|
87
|
+
focus(move());
|
|
88
|
+
};
|
|
89
|
+
const onPointerDown = (event) => {
|
|
90
|
+
drag.current = { x: event.clientX, y: event.clientY, r: rotation };
|
|
91
|
+
setDragging(true);
|
|
92
|
+
event.currentTarget.setPointerCapture?.(event.pointerId);
|
|
93
|
+
};
|
|
94
|
+
const onPointerMove = (event) => {
|
|
95
|
+
if (!drag.current) return;
|
|
96
|
+
const { x, y, r } = drag.current;
|
|
97
|
+
setRotation([r[0] + (event.clientX - x) * 0.4, Math.max(-75, Math.min(75, r[1] - (event.clientY - y) * 0.4))]);
|
|
98
|
+
};
|
|
99
|
+
const onPointerUp = () => {
|
|
100
|
+
drag.current = null;
|
|
101
|
+
setDragging(false);
|
|
102
|
+
};
|
|
103
|
+
return /* @__PURE__ */ jsx(
|
|
104
|
+
ChartFrame,
|
|
105
|
+
{
|
|
106
|
+
kind: "globe",
|
|
107
|
+
frame: { ...props, error: props.error ?? (failed || void 0), loading: props.loading || mounted && !world && !failed },
|
|
108
|
+
pending: !world && !failed,
|
|
109
|
+
defaultHeight: 360,
|
|
110
|
+
table,
|
|
111
|
+
summary,
|
|
112
|
+
isEmpty: points.length === 0,
|
|
113
|
+
announcement: active === null ? "" : `${points[active].label}${points[active].value != null ? `: ${fmt(points[active].value)}` : ""}`,
|
|
114
|
+
handlers: { onKeyDown, onBlur: () => setActive(null) },
|
|
115
|
+
plotRef,
|
|
116
|
+
children: (width, height) => {
|
|
117
|
+
if (!world) return null;
|
|
118
|
+
const radius = Math.max(20, Math.min(width, height) / 2 - 12);
|
|
119
|
+
const cx = width / 2;
|
|
120
|
+
const cy = height / 2;
|
|
121
|
+
const projection = geoOrthographic().scale(radius).translate([cx, cy]).rotate([rotation[0], rotation[1]]).clipAngle(90).precision(0.5);
|
|
122
|
+
const path = geoPath(projection);
|
|
123
|
+
const facing = [-rotation[0], -rotation[1]];
|
|
124
|
+
const visible = (lon, lat) => geoDistance([lon, lat], facing) < Math.PI / 2 - 0.02;
|
|
125
|
+
const current = active !== null ? points[active] : null;
|
|
126
|
+
const tipAt = current && visible(current.lon, current.lat) ? projection([current.lon, current.lat]) : null;
|
|
127
|
+
const placed = [];
|
|
128
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
129
|
+
/* @__PURE__ */ jsxs(
|
|
130
|
+
"svg",
|
|
131
|
+
{
|
|
132
|
+
className: "kzc-svg kzc-enter-pop",
|
|
133
|
+
width,
|
|
134
|
+
height,
|
|
135
|
+
viewBox: `0 0 ${width} ${height}`,
|
|
136
|
+
"aria-hidden": true,
|
|
137
|
+
style: { cursor: dragging ? "grabbing" : "grab", touchAction: "none" },
|
|
138
|
+
onPointerDown,
|
|
139
|
+
onPointerMove,
|
|
140
|
+
onPointerUp,
|
|
141
|
+
onPointerCancel: onPointerUp,
|
|
142
|
+
children: [
|
|
143
|
+
/* @__PURE__ */ jsxs("defs", { children: [
|
|
144
|
+
/* @__PURE__ */ jsxs("radialGradient", { id: `${uid}-light`, cx: "35%", cy: "30%", r: "75%", children: [
|
|
145
|
+
/* @__PURE__ */ jsx("stop", { offset: "0%", style: { stopColor: "color-mix(in oklab, var(--kz-accent) 14%, var(--kz-surface-2))" } }),
|
|
146
|
+
/* @__PURE__ */ jsx("stop", { offset: "100%", style: { stopColor: "var(--kz-surface-1)" } })
|
|
147
|
+
] }),
|
|
148
|
+
/* @__PURE__ */ jsxs("radialGradient", { id: `${uid}-halo`, cx: "50%", cy: "50%", r: "50%", children: [
|
|
149
|
+
/* @__PURE__ */ jsx("stop", { offset: "86%", style: { stopColor: "var(--kz-accent)", stopOpacity: 0.22 } }),
|
|
150
|
+
/* @__PURE__ */ jsx("stop", { offset: "100%", style: { stopColor: "var(--kz-accent)", stopOpacity: 0 } })
|
|
151
|
+
] })
|
|
152
|
+
] }),
|
|
153
|
+
/* @__PURE__ */ jsx("circle", { cx, cy, r: radius * 1.12, style: { fill: `url(#${uid}-halo)` } }),
|
|
154
|
+
/* @__PURE__ */ jsx("circle", { cx, cy, r: radius, style: { fill: `url(#${uid}-light)`, stroke: "var(--kz-border-default)" } }),
|
|
155
|
+
/* @__PURE__ */ jsx("path", { d: path(geoGraticule10()) ?? "", style: { fill: "none", stroke: "var(--kz-border-subtle)", strokeWidth: 0.75 } }),
|
|
156
|
+
world.features.map((f, i) => /* @__PURE__ */ jsx(
|
|
157
|
+
"path",
|
|
158
|
+
{
|
|
159
|
+
d: path(f) ?? "",
|
|
160
|
+
style: {
|
|
161
|
+
fill: f.id && highlighted.has(f.id) ? "color-mix(in oklab, var(--kz-accent) 45%, var(--kz-surface-3))" : "var(--kz-surface-3)",
|
|
162
|
+
stroke: "var(--kz-surface-1)",
|
|
163
|
+
strokeWidth: 0.5
|
|
164
|
+
}
|
|
165
|
+
},
|
|
166
|
+
`${f.id ?? "x"}-${i}`
|
|
167
|
+
)),
|
|
168
|
+
arcs.map((arc, i) => {
|
|
169
|
+
const a = pointAt(arc.from);
|
|
170
|
+
const b = pointAt(arc.to);
|
|
171
|
+
if (!a || !b) return null;
|
|
172
|
+
const interpolate = geoInterpolate(a, b);
|
|
173
|
+
const line = { type: "LineString", coordinates: Array.from({ length: 33 }, (_, k) => interpolate(k / 32)) };
|
|
174
|
+
return /* @__PURE__ */ jsx("path", { d: path(line) ?? "", style: { fill: "none", stroke: "var(--kz-accent-text)", strokeWidth: 1.5, strokeDasharray: "4 3", opacity: 0.85 } }, i);
|
|
175
|
+
}),
|
|
176
|
+
points.map((p, i) => {
|
|
177
|
+
if (!visible(p.lon, p.lat)) return null;
|
|
178
|
+
const at0 = projection([p.lon, p.lat]);
|
|
179
|
+
const box = at0 && { x: at0[0] + 10, y: at0[1] - 8, w: p.label.length * 6.6, h: 16 };
|
|
180
|
+
const free = box && (active === i || !placed.some((b) => box.x < b.x + b.w && b.x < box.x + box.w && box.y < b.y + b.h && b.y < box.y + box.h));
|
|
181
|
+
if (free) placed.push(box);
|
|
182
|
+
const at = projection([p.lon, p.lat]);
|
|
183
|
+
if (!at) return null;
|
|
184
|
+
const color = colorOf(p.tone ?? "accent", 1);
|
|
185
|
+
const on = active === i;
|
|
186
|
+
return /* @__PURE__ */ jsxs("g", { children: [
|
|
187
|
+
/* @__PURE__ */ jsx("circle", { cx: at[0], cy: at[1], r: on ? 11 : 8, style: { fill: color, opacity: 0.22 } }),
|
|
188
|
+
/* @__PURE__ */ jsx("circle", { cx: at[0], cy: at[1], r: on ? 5.5 : 4.5, className: "kzc-dot", style: { fill: color } }),
|
|
189
|
+
free && (on || points.length <= 8) && width >= 320 && /* @__PURE__ */ jsx("text", { x: at[0] + 10, y: at[1], dominantBaseline: "central", className: "kzc-threshold-label", children: p.label })
|
|
190
|
+
] }, `${p.label}-${i}`);
|
|
191
|
+
})
|
|
192
|
+
]
|
|
193
|
+
}
|
|
194
|
+
),
|
|
195
|
+
current && tipAt && /* @__PURE__ */ jsx(Tooltip, { x: tipAt[0], y: tipAt[1], width, title: current.label, rows: current.value == null ? [] : [{ label: valueLabel ?? labels.value, value: fmt(current.value) }] })
|
|
196
|
+
] });
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
);
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
export {
|
|
203
|
+
Globe3D
|
|
204
|
+
};
|
|
205
|
+
//# sourceMappingURL=chunk-I3D7KUGN.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/globe/globe.tsx"],"sourcesContent":["\"use client\";\n// A 3D globe without WebGL: the orthographic projection of d3-geo, lit like a sphere (a radial light, an atmosphere\n// in the brand accent), the far side clipped, great-circle arcs between places. Plain SVG — server-safe, sharp at\n// any size, readable by the export, a fraction of echarts-gl's 300 kB (see the package README). It turns slowly\n// while on screen and the page is visible, never under reduced motion; it is dragged with the pointer, and the\n// keyboard walks the places, turning the globe to each one.\nimport { geoDistance, geoGraticule10, geoInterpolate, geoOrthographic, geoPath } from \"d3-geo\";\nimport { type KeyboardEvent, type PointerEvent, useEffect, useId, useMemo, useRef, useState } from \"react\";\n\nimport { valueFormatter } from \"../core/format\";\nimport { fill } from \"../core/labels\";\nimport type { Tone, ValueFormat } from \"../core/types\";\nimport type { GeoPoint } from \"../geo/geo-map\";\nimport { useWorld } from \"../geo/world\";\nimport { ChartFrame, type ChartFrameProps, useSettings } from \"../web/frame\";\nimport { useInView, useMounted, useReducedMotion } from \"../web/hooks\";\nimport { colorOf, Tooltip } from \"../web/parts\";\n\nexport interface GlobePoint extends GeoPoint {\n /** Its tone: a healthy region in `\"success\"`, a degraded one in `\"warning\"`. Default `\"accent\"`. */\n readonly tone?: Tone;\n}\n\nexport interface GlobeArc {\n /** The labels of two points (or their coordinates, `[lon, lat]`). */\n readonly from: string | readonly [number, number];\n readonly to: string | readonly [number, number];\n}\n\nexport interface Globe3DProps extends ChartFrameProps {\n /** The places: deployment regions, data centres, audiences. */\n points: readonly GlobePoint[];\n /** Great-circle arcs between places: replication, traffic. */\n arcs?: readonly GlobeArc[];\n /** Countries to tint in the accent (ISO alpha-2): where the service is available. */\n regions?: readonly string[];\n /** How the points' values are written. */\n format?: ValueFormat;\n /** The longitude and latitude facing the reader at first. Default: the first point. */\n center?: readonly [number, number];\n /** Turn slowly while on screen (never under reduced motion). Default true. */\n autoRotate?: boolean;\n /** The header of the places and of their values in the table. */\n pointLabel?: string;\n/** The header of the points' values (“Availability”). */\n valueLabel?: string;\n}\n\nconst SPEED = 6; // degrees per second: one turn a minute.\n\n/** The world as a lit sphere: deployment regions, the arcs between them, a slow turn. */\nexport function Globe3D(props: Globe3DProps) {\n const { points, arcs = [], regions = [], format, center, autoRotate = true, pointLabel, valueLabel } = props;\n const { locale, labels } = useSettings(props);\n const mounted = useMounted();\n const { world, failed } = useWorld(mounted);\n const reduced = useReducedMotion();\n const plotRef = useRef<HTMLDivElement | null>(null);\n const onScreen = useInView(plotRef, { margin: \"0px\" });\n const fmt = useMemo(() => valueFormatter(format, locale, labels.noValue), [format, locale, labels.noValue]);\n const uid = useId().replace(/:/g, \"\");\n const start = center ?? (points[0] ? [points[0].lon, points[0].lat] : [0, 20]);\n const [rotation, setRotation] = useState<[number, number]>([-start[0], -Math.max(-60, Math.min(60, start[1]))]);\n const [active, setActive] = useState<number | null>(null);\n const [dragging, setDragging] = useState(false);\n const drag = useRef<{ x: number; y: number; r: [number, number] } | null>(null);\n const highlighted = useMemo(() => new Set(regions.map((r) => r.toUpperCase())), [regions]);\n\n // The slow turn: only on screen, page visible, no reduced motion, not while dragged or a place is focused.\n const turning = autoRotate && !reduced && onScreen && !dragging && active === null && mounted && Boolean(world);\n useEffect(() => {\n if (!turning) return undefined;\n let frame = 0;\n let last = performance.now();\n const tick = (now: number) => {\n // ~30 frames a second is plenty for a turn of 6°/s, and half the work.\n if (now - last >= 33 && document.visibilityState === \"visible\") {\n const dt = (now - last) / 1000;\n last = now;\n setRotation(([lon, lat]) => [lon + SPEED * dt, lat]);\n } else if (document.visibilityState !== \"visible\") last = now;\n frame = requestAnimationFrame(tick);\n };\n frame = requestAnimationFrame(tick);\n return () => cancelAnimationFrame(frame);\n }, [turning]);\n\n const pointAt = (ref: GlobeArc[\"from\"]): [number, number] | null => {\n if (typeof ref !== \"string\") return [ref[0], ref[1]];\n const p = points.find((q) => q.label === ref);\n return p ? [p.lon, p.lat] : null;\n };\n\n const summary = points.length\n ? `${fill(labels.summaryIntro, { kind: labels.kinds.globe, count: points.length })} ${points.map((p) => (p.value == null ? p.label : `${p.label} ${fmt(p.value)}`)).join(\", \")}.`\n : labels.empty;\n const table = { columns: [pointLabel ?? labels.category, valueLabel ?? labels.value, \"lon\", \"lat\"], rows: points.map((p) => [p.label, p.value == null ? labels.noValue : fmt(p.value), p.lon.toFixed(2), p.lat.toFixed(2)]) };\n\n const focus = (i: number | null) => {\n setActive(i);\n if (i !== null) {\n const p = points[i]!;\n setRotation([-p.lon, -Math.max(-60, Math.min(60, p.lat))]);\n }\n };\n const onKeyDown = (event: KeyboardEvent<HTMLDivElement>) => {\n const n = points.length;\n if (!n) return;\n const moves: Record<string, () => number | null> = {\n ArrowRight: () => ((active ?? -1) + 1) % n,\n ArrowDown: () => ((active ?? -1) + 1) % n,\n ArrowLeft: () => ((active ?? 0) - 1 + n) % n,\n ArrowUp: () => ((active ?? 0) - 1 + n) % n,\n Home: () => 0,\n End: () => n - 1,\n Escape: () => null,\n };\n const move = moves[event.key];\n if (!move) return;\n event.preventDefault();\n focus(move());\n };\n\n const onPointerDown = (event: PointerEvent<SVGSVGElement>) => {\n drag.current = { x: event.clientX, y: event.clientY, r: rotation };\n setDragging(true);\n event.currentTarget.setPointerCapture?.(event.pointerId);\n };\n const onPointerMove = (event: PointerEvent<SVGSVGElement>) => {\n if (!drag.current) return;\n const { x, y, r } = drag.current;\n setRotation([r[0] + (event.clientX - x) * 0.4, Math.max(-75, Math.min(75, r[1] - (event.clientY - y) * 0.4))]);\n };\n const onPointerUp = () => {\n drag.current = null;\n setDragging(false);\n };\n\n return (\n <ChartFrame\n kind=\"globe\"\n frame={{ ...props, error: props.error ?? (failed || undefined), loading: props.loading || (mounted && !world && !failed) }}\n pending={!world && !failed}\n defaultHeight={360}\n table={table}\n summary={summary}\n isEmpty={points.length === 0}\n announcement={active === null ? \"\" : `${points[active]!.label}${points[active]!.value != null ? `: ${fmt(points[active]!.value)}` : \"\"}`}\n handlers={{ onKeyDown, onBlur: () => setActive(null) }}\n plotRef={plotRef}\n >\n {(width, height) => {\n if (!world) return null;\n const radius = Math.max(20, Math.min(width, height) / 2 - 12);\n const cx = width / 2;\n const cy = height / 2;\n const projection = geoOrthographic().scale(radius).translate([cx, cy]).rotate([rotation[0], rotation[1]]).clipAngle(90).precision(0.5);\n const path = geoPath(projection);\n const facing: [number, number] = [-rotation[0], -rotation[1]];\n const visible = (lon: number, lat: number) => geoDistance([lon, lat], facing) < Math.PI / 2 - 0.02;\n const current = active !== null ? points[active] : null;\n const tipAt = current && visible(current.lon, current.lat) ? projection([current.lon, current.lat]) : null;\n const placed: { x: number; y: number; w: number; h: number }[] = [];\n return (\n <>\n <svg\n className=\"kzc-svg kzc-enter-pop\"\n width={width}\n height={height}\n viewBox={`0 0 ${width} ${height}`}\n aria-hidden\n style={{ cursor: dragging ? \"grabbing\" : \"grab\", touchAction: \"none\" }}\n onPointerDown={onPointerDown}\n onPointerMove={onPointerMove}\n onPointerUp={onPointerUp}\n onPointerCancel={onPointerUp}\n >\n <defs>\n <radialGradient id={`${uid}-light`} cx=\"35%\" cy=\"30%\" r=\"75%\">\n <stop offset=\"0%\" style={{ stopColor: \"color-mix(in oklab, var(--kz-accent) 14%, var(--kz-surface-2))\" }} />\n <stop offset=\"100%\" style={{ stopColor: \"var(--kz-surface-1)\" }} />\n </radialGradient>\n <radialGradient id={`${uid}-halo`} cx=\"50%\" cy=\"50%\" r=\"50%\">\n <stop offset=\"86%\" style={{ stopColor: \"var(--kz-accent)\", stopOpacity: 0.22 }} />\n <stop offset=\"100%\" style={{ stopColor: \"var(--kz-accent)\", stopOpacity: 0 }} />\n </radialGradient>\n </defs>\n <circle cx={cx} cy={cy} r={radius * 1.12} style={{ fill: `url(#${uid}-halo)` }} />\n <circle cx={cx} cy={cy} r={radius} style={{ fill: `url(#${uid}-light)`, stroke: \"var(--kz-border-default)\" }} />\n <path d={path(geoGraticule10()) ?? \"\"} style={{ fill: \"none\", stroke: \"var(--kz-border-subtle)\", strokeWidth: 0.75 }} />\n {world.features.map((f, i) => (\n <path\n key={`${f.id ?? \"x\"}-${i}`}\n d={path(f) ?? \"\"}\n style={{\n fill: f.id && highlighted.has(f.id) ? \"color-mix(in oklab, var(--kz-accent) 45%, var(--kz-surface-3))\" : \"var(--kz-surface-3)\",\n stroke: \"var(--kz-surface-1)\",\n strokeWidth: 0.5,\n }}\n />\n ))}\n {arcs.map((arc, i) => {\n const a = pointAt(arc.from);\n const b = pointAt(arc.to);\n if (!a || !b) return null;\n const interpolate = geoInterpolate(a, b);\n const line = { type: \"LineString\" as const, coordinates: Array.from({ length: 33 }, (_, k) => interpolate(k / 32)) };\n return <path key={i} d={path(line) ?? \"\"} style={{ fill: \"none\", stroke: \"var(--kz-accent-text)\", strokeWidth: 1.5, strokeDasharray: \"4 3\", opacity: 0.85 }} />;\n })}\n {points.map((p, i) => {\n if (!visible(p.lon, p.lat)) return null;\n const at0 = projection([p.lon, p.lat]);\n // A label is written only where it does not cover another (the active place's always).\n const box = at0 && { x: at0[0] + 10, y: at0[1] - 8, w: p.label.length * 6.6, h: 16 };\n const free = box && (active === i || !placed.some((b) => box.x < b.x + b.w && b.x < box.x + box.w && box.y < b.y + b.h && b.y < box.y + box.h));\n if (free) placed.push(box);\n const at = projection([p.lon, p.lat]);\n if (!at) return null;\n const color = colorOf(p.tone ?? \"accent\", 1);\n const on = active === i;\n return (\n <g key={`${p.label}-${i}`}>\n <circle cx={at[0]} cy={at[1]} r={on ? 11 : 8} style={{ fill: color, opacity: 0.22 }} />\n <circle cx={at[0]} cy={at[1]} r={on ? 5.5 : 4.5} className=\"kzc-dot\" style={{ fill: color }} />\n {free && (on || points.length <= 8) && width >= 320 && (\n <text x={at[0] + 10} y={at[1]} dominantBaseline=\"central\" className=\"kzc-threshold-label\">\n {p.label}\n </text>\n )}\n </g>\n );\n })}\n </svg>\n {current && tipAt && <Tooltip x={tipAt[0]} y={tipAt[1]} width={width} title={current.label} rows={current.value == null ? [] : [{ label: valueLabel ?? labels.value, value: fmt(current.value) }]} />}\n </>\n );\n }}\n </ChartFrame>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAMA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
|
+
BarChart
|
|
4
|
+
} from "./chunk-WVTIKOII.js";
|
|
5
|
+
import {
|
|
6
|
+
Kpi
|
|
7
|
+
} from "./chunk-WBHFVBSK.js";
|
|
8
|
+
import {
|
|
9
|
+
LATENCY_LABELS,
|
|
10
|
+
fillIn,
|
|
11
|
+
formatDuration,
|
|
12
|
+
numberOf
|
|
13
|
+
} from "./chunk-WNUFGMS7.js";
|
|
14
|
+
import {
|
|
15
|
+
useSettings
|
|
16
|
+
} from "./chunk-JTKR7ZWP.js";
|
|
17
|
+
|
|
18
|
+
// src/latency/latency-chart.tsx
|
|
19
|
+
import { useMemo } from "react";
|
|
20
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
21
|
+
function LatencyChart({
|
|
22
|
+
x = "name",
|
|
23
|
+
p50 = "p50",
|
|
24
|
+
p95 = "p95",
|
|
25
|
+
objective,
|
|
26
|
+
vertical,
|
|
27
|
+
hideSummary,
|
|
28
|
+
labels: given,
|
|
29
|
+
description,
|
|
30
|
+
data,
|
|
31
|
+
...props
|
|
32
|
+
}) {
|
|
33
|
+
const words = { ...LATENCY_LABELS, ...given };
|
|
34
|
+
const { locale } = useSettings(props);
|
|
35
|
+
const series = useMemo(
|
|
36
|
+
() => [{ key: p50, label: words.p50, color: "neutral" }, ...p95 ? [{ key: p95, label: words.p95, color: 1 }] : []],
|
|
37
|
+
[p50, p95, words.p50, words.p95]
|
|
38
|
+
);
|
|
39
|
+
const tail = p95 ?? p50;
|
|
40
|
+
const measured = data.map((row, i) => ({ row, i, value: numberOf(row, tail, i) })).filter((m) => m.value != null);
|
|
41
|
+
const slowest = measured.reduce((a, m) => !a || (m.value ?? 0) > (a.value ?? 0) ? m : a, null);
|
|
42
|
+
const over = objective ? measured.filter((m) => (m.value ?? 0) > objective.value).length : 0;
|
|
43
|
+
const nameOf = (row, i) => String(typeof x === "function" ? x(row, i) : row[x]);
|
|
44
|
+
const summary = hideSummary || !slowest ? null : /* @__PURE__ */ jsx(
|
|
45
|
+
Kpi,
|
|
46
|
+
{
|
|
47
|
+
value: formatDuration(slowest.value ?? 0, locale),
|
|
48
|
+
label: fillIn(words.slowest, { name: nameOf(slowest.row, slowest.i) }),
|
|
49
|
+
delta: objective ? over > 0 ? fillIn(words.over, { count: over }) : words.within : null,
|
|
50
|
+
direction: objective ? over > 0 ? "up" : "flat" : null,
|
|
51
|
+
tone: over > 0 ? "danger" : "success"
|
|
52
|
+
}
|
|
53
|
+
);
|
|
54
|
+
return /* @__PURE__ */ jsx(
|
|
55
|
+
BarChart,
|
|
56
|
+
{
|
|
57
|
+
...props,
|
|
58
|
+
data,
|
|
59
|
+
x,
|
|
60
|
+
series,
|
|
61
|
+
format: (value, l) => formatDuration(value, l),
|
|
62
|
+
horizontal: !vertical,
|
|
63
|
+
thresholds: objective ? [{ ...objective, tone: "danger" }] : void 0,
|
|
64
|
+
description: description || summary ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
65
|
+
description,
|
|
66
|
+
description && summary ? /* @__PURE__ */ jsx("br", {}) : null,
|
|
67
|
+
summary
|
|
68
|
+
] }) : void 0
|
|
69
|
+
}
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export {
|
|
74
|
+
LatencyChart
|
|
75
|
+
};
|
|
76
|
+
//# sourceMappingURL=chunk-IKQV3NSL.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/latency/latency-chart.tsx"],"sourcesContent":["\"use client\";\n// Latency per capability, model or kind of job (the console's supervision, Orazaka's \"time to result\"): the median\n// and the 95th percentile side by side in horizontal bars, durations written in the unit that fits (ms, s, min), the\n// service objective as a line, the slowest p95 and how many go past the objective written above.\nimport { useMemo } from \"react\";\n\nimport { BarChart } from \"../bar/bar-chart\";\nimport type { CartesianProps } from \"../cartesian/cartesian\";\nimport type { Accessor, Datum, SeriesSpec } from \"../core/types\";\nimport { Kpi } from \"../needs/kpi\";\nimport { LATENCY_LABELS, type LatencyLabels } from \"../needs/labels\";\nimport { fillIn, formatDuration, numberOf } from \"../needs/model\";\nimport { useSettings } from \"../web/frame\";\n\nexport interface LatencyChartProps<T extends Datum>\n extends Omit<CartesianProps<T>, \"y\" | \"yLabel\" | \"series\" | \"format\" | \"x\" | \"xFormat\" | \"thresholds\" | \"labels\"> {\n /** The field (or function) naming what is measured (a capability, a model). Default `\"name\"`. */\n x?: Accessor<T, unknown>;\n /** The median, in milliseconds. Default `\"p50\"`. */\n p50?: Accessor<T, number | null | undefined>;\n /** The 95th percentile, in milliseconds. Default `\"p95\"`; `null` to draw the median alone. */\n p95?: Accessor<T, number | null | undefined> | null;\n /** The service objective, in milliseconds: a line, and the count of what goes past it (by p95). */\n objective?: { readonly value: number; readonly label: string };\n /** Vertical bars instead of horizontal ones (few, short names). */\n vertical?: boolean;\n /** Hide the slowest p95 and the count over the objective. */\n hideSummary?: boolean;\n /** The words, passed translated; English by default. */\n labels?: Partial<LatencyLabels>;\n}\n\n/** Median and p95 latency per item, durations in the unit that fits, against a service objective. */\nexport function LatencyChart<T extends Datum>({\n x = \"name\" as Accessor<T, unknown>,\n p50 = \"p50\" as Accessor<T, number | null | undefined>,\n p95 = \"p95\" as Accessor<T, number | null | undefined>,\n objective,\n vertical,\n hideSummary,\n labels: given,\n description,\n data,\n ...props\n}: LatencyChartProps<T>) {\n const words = { ...LATENCY_LABELS, ...given };\n const { locale } = useSettings(props as CartesianProps<T>);\n const series = useMemo<SeriesSpec<T>[]>(\n () => [{ key: p50, label: words.p50, color: \"neutral\" }, ...(p95 ? [{ key: p95, label: words.p95, color: 1 as const }] : [])],\n [p50, p95, words.p50, words.p95],\n );\n const tail = p95 ?? p50;\n const measured = data.map((row, i) => ({ row, i, value: numberOf(row, tail, i) })).filter((m) => m.value != null);\n const slowest = measured.reduce<(typeof measured)[number] | null>((a, m) => (!a || (m.value ?? 0) > (a.value ?? 0) ? m : a), null);\n const over = objective ? measured.filter((m) => (m.value ?? 0) > objective.value).length : 0;\n const nameOf = (row: T, i: number) => String(typeof x === \"function\" ? x(row, i) : (row as Record<string, unknown>)[x]);\n const summary =\n hideSummary || !slowest ? null : (\n <Kpi\n value={formatDuration(slowest.value ?? 0, locale)}\n label={fillIn(words.slowest, { name: nameOf(slowest.row, slowest.i) })}\n delta={objective ? (over > 0 ? fillIn(words.over, { count: over }) : words.within) : null}\n direction={objective ? (over > 0 ? \"up\" : \"flat\") : null}\n tone={over > 0 ? \"danger\" : \"success\"}\n />\n );\n return (\n <BarChart\n {...props}\n data={data}\n x={x}\n series={series}\n format={(value, l) => formatDuration(value, l)}\n horizontal={!vertical}\n thresholds={objective ? [{ ...objective, tone: \"danger\" }] : undefined}\n description={\n description || summary ? (\n <>\n {description}\n {description && summary ? <br /> : null}\n {summary}\n </>\n ) : undefined\n }\n />\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAIA,SAAS,eAAe;AAsDlB,SAmBI,UAnBJ,KAmBI,YAnBJ;AAzBC,SAAS,aAA8B;AAAA,EAC5C,IAAI;AAAA,EACJ,MAAM;AAAA,EACN,MAAM;AAAA,EACN;AAAA,EACA;AAAA,EACA;AAAA,EACA,QAAQ;AAAA,EACR;AAAA,EACA;AAAA,EACA,GAAG;AACL,GAAyB;AACvB,QAAM,QAAQ,EAAE,GAAG,gBAAgB,GAAG,MAAM;AAC5C,QAAM,EAAE,OAAO,IAAI,YAAY,KAA0B;AACzD,QAAM,SAAS;AAAA,IACb,MAAM,CAAC,EAAE,KAAK,KAAK,OAAO,MAAM,KAAK,OAAO,UAAU,GAAG,GAAI,MAAM,CAAC,EAAE,KAAK,KAAK,OAAO,MAAM,KAAK,OAAO,EAAW,CAAC,IAAI,CAAC,CAAE;AAAA,IAC5H,CAAC,KAAK,KAAK,MAAM,KAAK,MAAM,GAAG;AAAA,EACjC;AACA,QAAM,OAAO,OAAO;AACpB,QAAM,WAAW,KAAK,IAAI,CAAC,KAAK,OAAO,EAAE,KAAK,GAAG,OAAO,SAAS,KAAK,MAAM,CAAC,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