@pibbl/core 0.0.2 → 0.0.3-alpha.85.1

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.
Files changed (233) hide show
  1. package/THIRD_PARTY_NOTICES.txt +81 -0
  2. package/dist/features/textures/index.d.ts +12 -2
  3. package/dist/features/textures/index.js +33 -1
  4. package/dist/features/textures/index.js.map +2 -2
  5. package/dist/features/textures/lib/chemical-field.d.ts +56 -0
  6. package/dist/features/textures/lib/chemical-field.js +154 -0
  7. package/dist/features/textures/lib/chemical-field.js.map +7 -0
  8. package/dist/features/textures/lib/chemical-recipes.d.ts +119 -0
  9. package/dist/features/textures/lib/chemical-recipes.js +275 -0
  10. package/dist/features/textures/lib/chemical-recipes.js.map +7 -0
  11. package/dist/features/textures/lib/definitions.d.ts +3 -18
  12. package/dist/features/textures/lib/definitions.js +15 -20
  13. package/dist/features/textures/lib/definitions.js.map +2 -2
  14. package/dist/features/textures/lib/geometric-patterns.d.ts +149 -0
  15. package/dist/features/textures/lib/geometric-patterns.js +305 -0
  16. package/dist/features/textures/lib/geometric-patterns.js.map +7 -0
  17. package/dist/features/textures/lib/gray-scott.d.ts +55 -0
  18. package/dist/features/textures/lib/gray-scott.js +39 -0
  19. package/dist/features/textures/lib/gray-scott.js.map +7 -0
  20. package/dist/features/textures/lib/patterns.d.ts +123 -0
  21. package/dist/features/textures/lib/patterns.js +344 -0
  22. package/dist/features/textures/lib/patterns.js.map +7 -0
  23. package/dist/features/textures/lib/reaction-diffusion.d.ts +3 -2
  24. package/dist/features/textures/lib/reaction-diffusion.js +9 -20
  25. package/dist/features/textures/lib/reaction-diffusion.js.map +2 -2
  26. package/dist/features/textures/lib/simulation.d.ts +10 -4
  27. package/dist/features/textures/lib/simulation.js +23 -13
  28. package/dist/features/textures/lib/simulation.js.map +2 -2
  29. package/dist/features/viz/index.d.ts +55 -6
  30. package/dist/features/viz/index.js +107 -2
  31. package/dist/features/viz/index.js.map +2 -2
  32. package/dist/features/viz/inspection/bar.d.ts +79 -0
  33. package/dist/features/viz/inspection/bar.js +49 -0
  34. package/dist/features/viz/inspection/bar.js.map +7 -0
  35. package/dist/features/viz/inspection/candle.d.ts +156 -0
  36. package/dist/features/viz/inspection/candle.js +120 -0
  37. package/dist/features/viz/inspection/candle.js.map +7 -0
  38. package/dist/features/viz/inspection/capture-types.d.ts +65 -0
  39. package/dist/features/viz/inspection/capture.d.ts +16 -0
  40. package/dist/features/viz/inspection/capture.js +49 -0
  41. package/dist/features/viz/inspection/capture.js.map +7 -0
  42. package/dist/features/viz/inspection/handler.d.ts +36 -0
  43. package/dist/features/viz/inspection/handler.js +91 -0
  44. package/dist/features/viz/inspection/handler.js.map +7 -0
  45. package/dist/features/viz/inspection/ohlc-bar.d.ts +132 -0
  46. package/dist/features/viz/inspection/ohlc-bar.js +118 -0
  47. package/dist/features/viz/inspection/ohlc-bar.js.map +7 -0
  48. package/dist/features/viz/inspection/owned-ref.d.ts +16 -0
  49. package/dist/features/viz/inspection/owned-ref.js +99 -0
  50. package/dist/features/viz/inspection/owned-ref.js.map +7 -0
  51. package/dist/features/viz/inspection/painted-point.d.ts +22 -0
  52. package/dist/features/viz/inspection/painted-point.js +29 -0
  53. package/dist/features/viz/inspection/painted-point.js.map +7 -0
  54. package/dist/features/viz/inspection/queries.d.ts +100 -0
  55. package/dist/features/viz/inspection/queries.js +192 -0
  56. package/dist/features/viz/inspection/queries.js.map +7 -0
  57. package/dist/features/viz/inspection/query-types.d.ts +177 -0
  58. package/dist/features/viz/inspection/volume.d.ts +104 -0
  59. package/dist/features/viz/inspection/volume.js +95 -0
  60. package/dist/features/viz/inspection/volume.js.map +7 -0
  61. package/dist/features/viz/inspection.d.ts +19 -0
  62. package/dist/features/viz/inspection.js +54 -0
  63. package/dist/features/viz/inspection.js.map +7 -0
  64. package/dist/features/viz/inspection.mjs +1 -0
  65. package/dist/features/viz/lib/area-series.d.ts +62 -0
  66. package/dist/features/viz/lib/area-series.js +120 -0
  67. package/dist/features/viz/lib/area-series.js.map +7 -0
  68. package/dist/features/viz/lib/axis.js +1 -1
  69. package/dist/features/viz/lib/axis.js.map +2 -2
  70. package/dist/features/viz/lib/bar-series.d.ts +3 -1
  71. package/dist/features/viz/lib/bar-series.js +16 -1
  72. package/dist/features/viz/lib/bar-series.js.map +2 -2
  73. package/dist/features/viz/lib/baseline-series.d.ts +55 -0
  74. package/dist/features/viz/lib/baseline-series.js +136 -0
  75. package/dist/features/viz/lib/baseline-series.js.map +7 -0
  76. package/dist/features/viz/lib/candlestick-series.d.ts +62 -0
  77. package/dist/features/viz/lib/candlestick-series.js +150 -0
  78. package/dist/features/viz/lib/candlestick-series.js.map +7 -0
  79. package/dist/features/viz/lib/censored-point-series.d.ts +71 -0
  80. package/dist/features/viz/lib/censored-point-series.js +129 -0
  81. package/dist/features/viz/lib/censored-point-series.js.map +7 -0
  82. package/dist/features/viz/lib/color-context.d.ts +4 -0
  83. package/dist/features/viz/lib/color-context.js +41 -0
  84. package/dist/features/viz/lib/color-context.js.map +7 -0
  85. package/dist/features/viz/lib/color-math.d.ts +4 -0
  86. package/dist/features/viz/lib/color-math.js +31 -0
  87. package/dist/features/viz/lib/color-math.js.map +7 -0
  88. package/dist/features/viz/lib/color-types.d.ts +53 -0
  89. package/dist/features/viz/lib/curve-definition.d.ts +49 -0
  90. package/dist/features/viz/lib/curve-definition.js +148 -0
  91. package/dist/features/viz/lib/curve-definition.js.map +7 -0
  92. package/dist/features/viz/lib/diverging-color-scale.d.ts +11 -0
  93. package/dist/features/viz/lib/diverging-color-scale.js +51 -0
  94. package/dist/features/viz/lib/diverging-color-scale.js.map +7 -0
  95. package/dist/features/viz/lib/domain-navigation.d.ts +40 -0
  96. package/dist/features/viz/lib/domain-navigation.js +77 -0
  97. package/dist/features/viz/lib/domain-navigation.js.map +7 -0
  98. package/dist/features/viz/lib/editable-chart-elements.d.ts +178 -0
  99. package/dist/features/viz/lib/editable-chart-elements.js +733 -0
  100. package/dist/features/viz/lib/editable-chart-elements.js.map +7 -0
  101. package/dist/features/viz/lib/financial-aggregation.d.ts +127 -0
  102. package/dist/features/viz/lib/financial-aggregation.js +116 -0
  103. package/dist/features/viz/lib/financial-aggregation.js.map +7 -0
  104. package/dist/features/viz/lib/financial-autoscale.d.ts +64 -0
  105. package/dist/features/viz/lib/financial-autoscale.js +61 -0
  106. package/dist/features/viz/lib/financial-autoscale.js.map +7 -0
  107. package/dist/features/viz/lib/financial-comparison.d.ts +62 -0
  108. package/dist/features/viz/lib/financial-comparison.js +98 -0
  109. package/dist/features/viz/lib/financial-comparison.js.map +7 -0
  110. package/dist/features/viz/lib/financial-geometry.d.ts +77 -0
  111. package/dist/features/viz/lib/financial-geometry.js +67 -0
  112. package/dist/features/viz/lib/financial-geometry.js.map +7 -0
  113. package/dist/features/viz/lib/financial-indicators.d.ts +114 -0
  114. package/dist/features/viz/lib/financial-indicators.js +135 -0
  115. package/dist/features/viz/lib/financial-indicators.js.map +7 -0
  116. package/dist/features/viz/lib/financial-oscillators.d.ts +171 -0
  117. package/dist/features/viz/lib/financial-oscillators.js +265 -0
  118. package/dist/features/viz/lib/financial-oscillators.js.map +7 -0
  119. package/dist/features/viz/lib/hover-data.d.ts +1 -1
  120. package/dist/features/viz/lib/hover-data.js +5 -2
  121. package/dist/features/viz/lib/hover-data.js.map +2 -2
  122. package/dist/features/viz/lib/interval-band-series.d.ts +49 -0
  123. package/dist/features/viz/lib/interval-band-series.js +136 -0
  124. package/dist/features/viz/lib/interval-band-series.js.map +7 -0
  125. package/dist/features/viz/lib/interval-diamond-series.d.ts +43 -0
  126. package/dist/features/viz/lib/interval-diamond-series.js +124 -0
  127. package/dist/features/viz/lib/interval-diamond-series.js.map +7 -0
  128. package/dist/features/viz/lib/interval-series.d.ts +79 -0
  129. package/dist/features/viz/lib/interval-series.js +158 -0
  130. package/dist/features/viz/lib/interval-series.js.map +7 -0
  131. package/dist/features/viz/lib/line-series.d.ts +1 -1
  132. package/dist/features/viz/lib/line-series.js +47 -28
  133. package/dist/features/viz/lib/line-series.js.map +2 -2
  134. package/dist/features/viz/lib/linear-scale.js +1 -1
  135. package/dist/features/viz/lib/linear-scale.js.map +2 -2
  136. package/dist/features/viz/lib/monotone-curve.d.ts +11 -0
  137. package/dist/features/viz/lib/monotone-curve.js +63 -0
  138. package/dist/features/viz/lib/monotone-curve.js.map +7 -0
  139. package/dist/features/viz/lib/numeric-range-interpolation.d.ts +15 -0
  140. package/dist/features/viz/lib/numeric-range-interpolation.js +36 -0
  141. package/dist/features/viz/lib/numeric-range-interpolation.js.map +7 -0
  142. package/dist/features/viz/lib/ohlc-bar-series.d.ts +55 -0
  143. package/dist/features/viz/lib/ohlc-bar-series.js +168 -0
  144. package/dist/features/viz/lib/ohlc-bar-series.js.map +7 -0
  145. package/dist/features/viz/lib/paired-series.d.ts +44 -0
  146. package/dist/features/viz/lib/paired-series.js +93 -0
  147. package/dist/features/viz/lib/paired-series.js.map +7 -0
  148. package/dist/features/viz/lib/plot-series.js +11 -6
  149. package/dist/features/viz/lib/plot-series.js.map +2 -2
  150. package/dist/features/viz/lib/plot-types.d.ts +4 -3
  151. package/dist/features/viz/lib/point-series.d.ts +1 -1
  152. package/dist/features/viz/lib/point-series.js +36 -9
  153. package/dist/features/viz/lib/point-series.js.map +2 -2
  154. package/dist/features/viz/lib/point-types.d.ts +5 -2
  155. package/dist/features/viz/lib/scale-context.d.ts +1 -1
  156. package/dist/features/viz/lib/scale-ticks.js +21 -6
  157. package/dist/features/viz/lib/scale-ticks.js.map +2 -2
  158. package/dist/features/viz/lib/sequential-color-scale.d.ts +11 -0
  159. package/dist/features/viz/lib/sequential-color-scale.js +49 -0
  160. package/dist/features/viz/lib/sequential-color-scale.js.map +7 -0
  161. package/dist/features/viz/lib/series-position.d.ts +12 -0
  162. package/dist/features/viz/lib/series-position.js +44 -0
  163. package/dist/features/viz/lib/series-position.js.map +7 -0
  164. package/dist/features/viz/lib/step-curves.d.ts +19 -0
  165. package/dist/features/viz/lib/step-curves.js +53 -0
  166. package/dist/features/viz/lib/step-curves.js.map +7 -0
  167. package/dist/features/viz/lib/threshold-color-scale.d.ts +43 -0
  168. package/dist/features/viz/lib/threshold-color-scale.js +59 -0
  169. package/dist/features/viz/lib/threshold-color-scale.js.map +7 -0
  170. package/dist/features/viz/lib/trading-time-mapping.d.ts +32 -0
  171. package/dist/features/viz/lib/trading-time-mapping.js +89 -0
  172. package/dist/features/viz/lib/trading-time-mapping.js.map +7 -0
  173. package/dist/features/viz/lib/trading-time-scale.d.ts +83 -0
  174. package/dist/features/viz/lib/trading-time-scale.js +96 -0
  175. package/dist/features/viz/lib/trading-time-scale.js.map +7 -0
  176. package/dist/features/viz/lib/trajectory-series.d.ts +71 -0
  177. package/dist/features/viz/lib/trajectory-series.js +111 -0
  178. package/dist/features/viz/lib/trajectory-series.js.map +7 -0
  179. package/dist/features/viz/lib/types.d.ts +20 -4
  180. package/dist/features/viz/lib/use-continuous-scale.js +6 -1
  181. package/dist/features/viz/lib/use-continuous-scale.js.map +2 -2
  182. package/dist/features/viz/lib/volume-series.d.ts +59 -0
  183. package/dist/features/viz/lib/volume-series.js +117 -0
  184. package/dist/features/viz/lib/volume-series.js.map +7 -0
  185. package/dist/features/viz/lib/weighted-point-series.d.ts +71 -0
  186. package/dist/features/viz/lib/weighted-point-series.js +169 -0
  187. package/dist/features/viz/lib/weighted-point-series.js.map +7 -0
  188. package/dist/filters/emboss-gpu.d.ts +4 -0
  189. package/dist/filters/emboss-gpu.js +39 -0
  190. package/dist/filters/emboss-gpu.js.map +7 -0
  191. package/dist/filters/emboss.d.ts +32 -0
  192. package/dist/filters/emboss.js +106 -0
  193. package/dist/filters/emboss.js.map +7 -0
  194. package/dist/filters/reflection-gpu.d.ts +3 -1
  195. package/dist/filters/reflection-gpu.js +5 -2
  196. package/dist/filters/reflection-gpu.js.map +2 -2
  197. package/dist/filters/render-emboss-boundary.d.ts +13 -0
  198. package/dist/filters/render-emboss-boundary.js +131 -0
  199. package/dist/filters/render-emboss-boundary.js.map +7 -0
  200. package/dist/filters.d.ts +2 -0
  201. package/dist/filters.js +2 -0
  202. package/dist/filters.js.map +2 -2
  203. package/dist/index.d.ts +2 -0
  204. package/dist/index.js +3 -0
  205. package/dist/index.js.map +2 -2
  206. package/dist/internal.d.ts +2 -0
  207. package/dist/internal.js +4 -0
  208. package/dist/internal.js.map +2 -2
  209. package/dist/lib/events/event-facade.d.ts +13 -0
  210. package/dist/lib/events/event-facade.js +23 -0
  211. package/dist/lib/events/event-facade.js.map +2 -2
  212. package/dist/lib/events/propagation.js +19 -14
  213. package/dist/lib/events/propagation.js.map +2 -2
  214. package/dist/lib/execute-render.js +13 -0
  215. package/dist/lib/execute-render.js.map +2 -2
  216. package/dist/lib/recording/recording.d.ts +43 -0
  217. package/dist/lib/recording/recording.js +555 -0
  218. package/dist/lib/recording/recording.js.map +7 -0
  219. package/dist/lib/recording/types.d.ts +118 -0
  220. package/dist/lib/recording/wasm-bytes.d.ts +1 -0
  221. package/dist/lib/recording/wasm-bytes.js +5 -0
  222. package/dist/lib/recording/wasm-bytes.js.map +7 -0
  223. package/dist/lib/recording/worker-source.d.ts +1 -0
  224. package/dist/lib/recording/worker-source.js +5 -0
  225. package/dist/lib/recording/worker-source.js.map +7 -0
  226. package/dist/lib/render-transaction.d.ts +5 -2
  227. package/dist/lib/render-transaction.js +23 -1
  228. package/dist/lib/render-transaction.js.map +2 -2
  229. package/dist/lib/series-inspection-frame.d.ts +18 -0
  230. package/dist/lib/series-inspection-frame.js +70 -0
  231. package/dist/lib/series-inspection-frame.js.map +7 -0
  232. package/dist/lib/types.d.ts +6 -0
  233. package/package.json +10 -2
@@ -0,0 +1,19 @@
1
+ /** Optional committed-render inspection. Rendering entries do not import these algorithms. */
2
+ export { useNumericInspection, usePointInspection, } from "./inspection/capture.js";
3
+ export { withInspection } from "./inspection/handler.js";
4
+ export { paintedPointAt } from "./inspection/painted-point.js";
5
+ export { useBarInspection, paintedBarAt } from "./inspection/bar.js";
6
+ export type { BarInspectionRef, BarRenderedSeries, PaintedBarHit, } from "./inspection/bar.js";
7
+ export type { PaintedPointHit } from "./inspection/painted-point.js";
8
+ export type { InspectionContext, InspectionRef } from "./inspection/handler.js";
9
+ export type { NumericInspectionRef, PointInspectionRef, PointRenderedSeries, } from "./inspection/capture-types.js";
10
+ export { nearestRecordedX, nearestRecordedPoint, sampleRecordedX, firstSourceObservation, lastSourceObservation, anchorInsideClips, } from "./inspection/queries.js";
11
+ export type { NumericRenderedSeries, NumericRenderedObservation, RecordedNumericHit, NearestRecordedXHit, NearestRecordedPointHit, RecordedXSample, NumericRenderedFilter, NumericDuplicateResolver, NumericDomainInterpolation, RenderedSeriesPoint, } from "./inspection/query-types.js";
12
+ export type { NumericRenderedSeries as RenderedSeries, InspectionCandidate, NumericRenderedAnchors, } from "./inspection/query-types.js";
13
+ export type { NearestRecordedXOptions, NearestRecordedPointOptions, SampleRecordedXOptions, } from "./inspection/queries.js";
14
+ export { useVolumeInspection, nearestRecordedVolumeX, paintedVolumeAt, } from "./inspection/volume.js";
15
+ export type { VolumeObservation, VolumeInspectionCandidate, NearestVolumeHit, PaintedVolumeHit, VolumeInspectionRef, VolumeRenderedSeries, } from "./inspection/volume.js";
16
+ export { useCandleInspection, nearestRecordedCandleX, paintedCandleAt, } from "./inspection/candle.js";
17
+ export type { CandleObservation, CandleInspectionCandidate, NearestCandleHit, PaintedCandleHit, CandleInspectionRef, CandleRenderedSeries, } from "./inspection/candle.js";
18
+ export { useOhlcBarInspection, nearestRecordedOhlcBarX, paintedOhlcBarAt, } from "./inspection/ohlc-bar.js";
19
+ export type { OhlcBarObservation, OhlcBarInspectionCandidate, NearestOhlcBarHit, PaintedOhlcBarHit, OhlcBarInspectionRef, OhlcBarRenderedSeries, } from "./inspection/ohlc-bar.js";
@@ -0,0 +1,54 @@
1
+ import {
2
+ useNumericInspection,
3
+ usePointInspection
4
+ } from "./inspection/capture.js";
5
+ import { withInspection } from "./inspection/handler.js";
6
+ import { paintedPointAt } from "./inspection/painted-point.js";
7
+ import { useBarInspection, paintedBarAt } from "./inspection/bar.js";
8
+ import {
9
+ nearestRecordedX,
10
+ nearestRecordedPoint,
11
+ sampleRecordedX,
12
+ firstSourceObservation,
13
+ lastSourceObservation,
14
+ anchorInsideClips
15
+ } from "./inspection/queries.js";
16
+ import {
17
+ useVolumeInspection,
18
+ nearestRecordedVolumeX,
19
+ paintedVolumeAt
20
+ } from "./inspection/volume.js";
21
+ import {
22
+ useCandleInspection,
23
+ nearestRecordedCandleX,
24
+ paintedCandleAt
25
+ } from "./inspection/candle.js";
26
+ import {
27
+ useOhlcBarInspection,
28
+ nearestRecordedOhlcBarX,
29
+ paintedOhlcBarAt
30
+ } from "./inspection/ohlc-bar.js";
31
+ export {
32
+ anchorInsideClips,
33
+ firstSourceObservation,
34
+ lastSourceObservation,
35
+ nearestRecordedCandleX,
36
+ nearestRecordedOhlcBarX,
37
+ nearestRecordedPoint,
38
+ nearestRecordedVolumeX,
39
+ nearestRecordedX,
40
+ paintedBarAt,
41
+ paintedCandleAt,
42
+ paintedOhlcBarAt,
43
+ paintedPointAt,
44
+ paintedVolumeAt,
45
+ sampleRecordedX,
46
+ useBarInspection,
47
+ useCandleInspection,
48
+ useNumericInspection,
49
+ useOhlcBarInspection,
50
+ usePointInspection,
51
+ useVolumeInspection,
52
+ withInspection
53
+ };
54
+ //# sourceMappingURL=inspection.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/features/viz/inspection.ts"],
4
+ "sourcesContent": ["/** Optional committed-render inspection. Rendering entries do not import these algorithms. */\nexport {\n useNumericInspection,\n usePointInspection,\n} from \"./inspection/capture.js\";\nexport { withInspection } from \"./inspection/handler.js\";\nexport { paintedPointAt } from \"./inspection/painted-point.js\";\nexport { useBarInspection, paintedBarAt } from \"./inspection/bar.js\";\nexport type {\n BarInspectionRef,\n BarRenderedSeries,\n PaintedBarHit,\n} from \"./inspection/bar.js\";\nexport type { PaintedPointHit } from \"./inspection/painted-point.js\";\nexport type { InspectionContext, InspectionRef } from \"./inspection/handler.js\";\nexport type {\n NumericInspectionRef,\n PointInspectionRef,\n PointRenderedSeries,\n} from \"./inspection/capture-types.js\";\nexport {\n nearestRecordedX,\n nearestRecordedPoint,\n sampleRecordedX,\n firstSourceObservation,\n lastSourceObservation,\n anchorInsideClips,\n} from \"./inspection/queries.js\";\nexport type {\n NumericRenderedSeries,\n NumericRenderedObservation,\n RecordedNumericHit,\n NearestRecordedXHit,\n NearestRecordedPointHit,\n RecordedXSample,\n NumericRenderedFilter,\n NumericDuplicateResolver,\n NumericDomainInterpolation,\n RenderedSeriesPoint,\n} from \"./inspection/query-types.js\";\n\nexport type {\n NumericRenderedSeries as RenderedSeries,\n InspectionCandidate,\n NumericRenderedAnchors,\n} from \"./inspection/query-types.js\";\nexport type {\n NearestRecordedXOptions,\n NearestRecordedPointOptions,\n SampleRecordedXOptions,\n} from \"./inspection/queries.js\";\nexport {\n useVolumeInspection,\n nearestRecordedVolumeX,\n paintedVolumeAt,\n} from \"./inspection/volume.js\";\nexport type {\n VolumeObservation,\n VolumeInspectionCandidate,\n NearestVolumeHit,\n PaintedVolumeHit,\n VolumeInspectionRef,\n VolumeRenderedSeries,\n} from \"./inspection/volume.js\";\nexport {\n useCandleInspection,\n nearestRecordedCandleX,\n paintedCandleAt,\n} from \"./inspection/candle.js\";\nexport type {\n CandleObservation,\n CandleInspectionCandidate,\n NearestCandleHit,\n PaintedCandleHit,\n CandleInspectionRef,\n CandleRenderedSeries,\n} from \"./inspection/candle.js\";\nexport {\n useOhlcBarInspection,\n nearestRecordedOhlcBarX,\n paintedOhlcBarAt,\n} from \"./inspection/ohlc-bar.js\";\nexport type {\n OhlcBarObservation,\n OhlcBarInspectionCandidate,\n NearestOhlcBarHit,\n PaintedOhlcBarHit,\n OhlcBarInspectionRef,\n OhlcBarRenderedSeries,\n} from \"./inspection/ohlc-bar.js\";\n"],
5
+ "mappings": "AACA;AAAA,EACE;AAAA,EACA;AAAA,OACK;AACP,SAAS,sBAAsB;AAC/B,SAAS,sBAAsB;AAC/B,SAAS,kBAAkB,oBAAoB;AAa/C;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAwBP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AASP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AASP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;",
6
+ "names": []
7
+ }
@@ -0,0 +1 @@
1
+ export * from './inspection.js';
@@ -0,0 +1,62 @@
1
+ import type { Path } from "@pibbl/core";
2
+ import type { FillStyle, PibblEventHandlers, PibblEventParticipationOptions, SignalValue } from "@pibbl/core";
3
+ import type { SignalStyle } from "@pibbl/core/internal";
4
+ import type { LineAccessor, LineSeriesProps } from "./types.js";
5
+ /**
6
+ * Presentation properties for an {@link AreaSeries}.
7
+ *
8
+ * @see {@link FillStyle}
9
+ * @see {@link AreaSeriesProps}
10
+ */
11
+ export interface AreaSeriesStyle {
12
+ /** Paint used for the area interior. */
13
+ readonly fill?: FillStyle;
14
+ /** Opacity of the painted area, from zero through one. */
15
+ readonly opacity?: number;
16
+ /** Cursor shown while the area target owns pointer presentation. */
17
+ readonly cursor?: string;
18
+ }
19
+ /**
20
+ * Authored inputs for {@link AreaSeries}.
21
+ *
22
+ * The data, coordinate accessors, scales, and defined predicate use the same
23
+ * contract as {@link LineSeriesProps}. Each contiguous run of at least two
24
+ * valid observations is closed to `baseline` in data space.
25
+ *
26
+ * @see {@link LineSeriesProps}
27
+ * @see {@link AreaSeriesStyle}
28
+ */
29
+ export interface AreaSeriesProps<D> extends PibblEventHandlers, PibblEventParticipationOptions {
30
+ /** Application data supplied directly or through a signal. */
31
+ readonly data: LineSeriesProps<D>["data"];
32
+ /** Property key or callback extracting the horizontal coordinate. */
33
+ readonly x: LineAccessor<D>;
34
+ /** Property key or callback extracting the vertical coordinate. */
35
+ readonly y: LineAccessor<D>;
36
+ /** Continuous scale used to map horizontal data coordinates. */
37
+ readonly xScale: LineSeriesProps<D>["xScale"];
38
+ /** Continuous scale used to map vertical data coordinates and baseline. */
39
+ readonly yScale: LineSeriesProps<D>["yScale"];
40
+ /** Selects records that participate in an observed run. */
41
+ readonly defined?: LineSeriesProps<D>["defined"];
42
+ /** Curve used to connect successive observed samples. */
43
+ readonly curve?: LineSeriesProps<D>["curve"];
44
+ /** Finite data-space value to which each observed run closes. */
45
+ readonly baseline: SignalValue<number>;
46
+ /** Shared area presentation. Individual datum styling is not supported. */
47
+ readonly style?: SignalValue<SignalStyle<AreaSeriesStyle>>;
48
+ }
49
+ /**
50
+ * Draws each contiguous observed run as a filled polygon closed to an explicit baseline.
51
+ *
52
+ * Missing, non-finite, and excluded coordinates split runs. A lone observation has no area.
53
+ * The component owns one ordinary {@link Path} target, so event participation follows the
54
+ * standard Path defaults; callers may wrap it in `Clip` when clipping is needed.
55
+ *
56
+ * @param props - Data, coordinate accessors, continuous scales, baseline, and presentation.
57
+ * @returns A Pibbl path node containing all drawable area runs.
58
+ * @throws When `data` is not an array, the baseline is not finite, or presentation is invalid.
59
+ *
60
+ * @see {@link AreaSeriesProps}
61
+ */
62
+ export declare function AreaSeries<D>({ data: dataInput, x: xInput, y: yInput, xScale: xId, yScale: yId, baseline: baselineInput, defined, curve, style: styleInput, ...eventProps }: AreaSeriesProps<D>): import("../../../jsx-runtime.js").JSX.Element;
@@ -0,0 +1,120 @@
1
+ import { jsx } from "@pibbl/core/jsx-runtime";
2
+ import { useNumericPosition } from "./series-position.js";
3
+ import { Path, resolveSignalValue } from "@pibbl/core";
4
+ import {
5
+ useInternalValueMemoSlot,
6
+ validateTexturePaint
7
+ } from "@pibbl/core/internal";
8
+ import {
9
+ appendCurveForward,
10
+ curveGeometry,
11
+ resolveSeriesCurve
12
+ } from "./curve-definition.js";
13
+ import { opacity } from "./paint.js";
14
+ import { useContinuousScale } from "./use-continuous-scale.js";
15
+ function accessor(input) {
16
+ return typeof input === "function" ? input : (datum) => datum[input];
17
+ }
18
+ function fill(value) {
19
+ if (typeof value === "string" || value instanceof CanvasGradient || value instanceof CanvasPattern)
20
+ return value;
21
+ try {
22
+ validateTexturePaint(value);
23
+ return value;
24
+ } catch {
25
+ throw new TypeError("AreaSeries: invalid fill.");
26
+ }
27
+ }
28
+ function AreaSeries({
29
+ data: dataInput,
30
+ x: xInput,
31
+ y: yInput,
32
+ xScale: xId,
33
+ yScale: yId,
34
+ baseline: baselineInput,
35
+ defined,
36
+ curve,
37
+ style: styleInput,
38
+ ...eventProps
39
+ }) {
40
+ const xScale = useNumericPosition(xId);
41
+ const yScale = useContinuousScale(yId).get();
42
+ const curveDefinition = resolveSeriesCurve(curve);
43
+ const x = useInternalValueMemoSlot(
44
+ "vizAreaXAccessor",
45
+ () => accessor(xInput),
46
+ [xInput]
47
+ );
48
+ const y = useInternalValueMemoSlot(
49
+ "vizAreaYAccessor",
50
+ () => accessor(yInput),
51
+ [yInput]
52
+ );
53
+ const data = resolveSignalValue(dataInput);
54
+ if (!Array.isArray(data))
55
+ throw new TypeError(
56
+ "AreaSeries data must be an array or a signal containing an array."
57
+ );
58
+ const baseline = resolveSignalValue(baselineInput);
59
+ if (typeof baseline !== "number" || !Number.isFinite(baseline))
60
+ throw new RangeError("AreaSeries baseline must be finite.");
61
+ const baselineY = yScale.map(baseline);
62
+ if (!Number.isFinite(baselineY))
63
+ throw new RangeError(
64
+ "AreaSeries baseline must map to a finite coordinate."
65
+ );
66
+ const style = resolveSignalValue(styleInput) ?? {};
67
+ if (style === null || typeof style !== "object" || Array.isArray(style))
68
+ throw new TypeError("AreaSeries: style must be an object.");
69
+ const areaFill = fill(resolveSignalValue(style.fill) ?? "#2563eb");
70
+ const alpha = opacity(resolveSignalValue(style.opacity) ?? 0.2, "AreaSeries");
71
+ const cursor = resolveSignalValue(style.cursor);
72
+ if (cursor !== void 0 && typeof cursor !== "string")
73
+ throw new TypeError("AreaSeries: cursor must be a string.");
74
+ const path = new Path2D();
75
+ let run = [];
76
+ const closeRun = () => {
77
+ if (run.length >= 2) {
78
+ const first = run[0];
79
+ const last = run[run.length - 1];
80
+ const geometry = curveGeometry(curveDefinition, run);
81
+ path.moveTo(geometry.start[0], geometry.start[1]);
82
+ appendCurveForward(path, geometry);
83
+ path.lineTo(last[0], baselineY);
84
+ path.lineTo(first[0], baselineY);
85
+ path.closePath();
86
+ }
87
+ run = [];
88
+ };
89
+ for (let i = 0; i < data.length; i++) {
90
+ const datum = data[i];
91
+ if (defined && !defined(datum, i, data)) {
92
+ closeRun();
93
+ continue;
94
+ }
95
+ const xv = x(datum, i, data);
96
+ const yv = y(datum, i, data);
97
+ if (typeof xv !== "number" || typeof yv !== "number" || !Number.isFinite(xv) || !Number.isFinite(yv)) {
98
+ closeRun();
99
+ continue;
100
+ }
101
+ const point = [xScale.map(xv), yScale.map(yv)];
102
+ if (!Number.isFinite(point[0]) || !Number.isFinite(point[1])) {
103
+ closeRun();
104
+ continue;
105
+ }
106
+ run.push(point);
107
+ }
108
+ closeRun();
109
+ return /* @__PURE__ */ jsx(
110
+ Path,
111
+ {
112
+ ...eventProps,
113
+ style: { d: path, fill: areaFill, opacity: alpha, cursor }
114
+ }
115
+ );
116
+ }
117
+ export {
118
+ AreaSeries
119
+ };
120
+ //# sourceMappingURL=area-series.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../src/features/viz/lib/area-series.tsx"],
4
+ "sourcesContent": ["import { useNumericPosition } from \"./series-position.js\";\nimport { Path, resolveSignalValue } from \"@pibbl/core\";\nimport type {\n FillStyle,\n PibblEventHandlers,\n PibblEventParticipationOptions,\n SignalValue,\n} from \"@pibbl/core\";\nimport {\n useInternalValueMemoSlot,\n validateTexturePaint,\n} from \"@pibbl/core/internal\";\nimport type { SignalStyle } from \"@pibbl/core/internal\";\nimport type { LineAccessor, LineCoordinate, LineSeriesProps } from \"./types.js\";\nimport {\n appendCurveForward,\n curveGeometry,\n resolveSeriesCurve,\n} from \"./curve-definition.js\";\nimport { opacity } from \"./paint.js\";\nimport { useContinuousScale } from \"./use-continuous-scale.js\";\n\n/**\n * Presentation properties for an {@link AreaSeries}.\n *\n * @see {@link FillStyle}\n * @see {@link AreaSeriesProps}\n */\nexport interface AreaSeriesStyle {\n /** Paint used for the area interior. */\n readonly fill?: FillStyle;\n /** Opacity of the painted area, from zero through one. */\n readonly opacity?: number;\n /** Cursor shown while the area target owns pointer presentation. */\n readonly cursor?: string;\n}\n\n/**\n * Authored inputs for {@link AreaSeries}.\n *\n * The data, coordinate accessors, scales, and defined predicate use the same\n * contract as {@link LineSeriesProps}. Each contiguous run of at least two\n * valid observations is closed to `baseline` in data space.\n *\n * @see {@link LineSeriesProps}\n * @see {@link AreaSeriesStyle}\n */\nexport interface AreaSeriesProps<D>\n extends PibblEventHandlers, PibblEventParticipationOptions {\n /** Application data supplied directly or through a signal. */\n readonly data: LineSeriesProps<D>[\"data\"];\n /** Property key or callback extracting the horizontal coordinate. */\n readonly x: LineAccessor<D>;\n /** Property key or callback extracting the vertical coordinate. */\n readonly y: LineAccessor<D>;\n /** Continuous scale used to map horizontal data coordinates. */\n readonly xScale: LineSeriesProps<D>[\"xScale\"];\n /** Continuous scale used to map vertical data coordinates and baseline. */\n readonly yScale: LineSeriesProps<D>[\"yScale\"];\n /** Selects records that participate in an observed run. */\n readonly defined?: LineSeriesProps<D>[\"defined\"];\n /** Curve used to connect successive observed samples. */\n readonly curve?: LineSeriesProps<D>[\"curve\"];\n /** Finite data-space value to which each observed run closes. */\n readonly baseline: SignalValue<number>;\n /** Shared area presentation. Individual datum styling is not supported. */\n readonly style?: SignalValue<SignalStyle<AreaSeriesStyle>>;\n}\n\nfunction accessor<D>(\n input: LineAccessor<D>,\n): (datum: D, index: number, data: readonly D[]) => LineCoordinate {\n return typeof input === \"function\"\n ? input\n : (datum) => datum[input] as LineCoordinate;\n}\n\nfunction fill(value: unknown): FillStyle {\n if (\n typeof value === \"string\" ||\n value instanceof CanvasGradient ||\n value instanceof CanvasPattern\n )\n return value;\n try {\n validateTexturePaint(value as never);\n return value as FillStyle;\n } catch {\n throw new TypeError(\"AreaSeries: invalid fill.\");\n }\n}\n\n/**\n * Draws each contiguous observed run as a filled polygon closed to an explicit baseline.\n *\n * Missing, non-finite, and excluded coordinates split runs. A lone observation has no area.\n * The component owns one ordinary {@link Path} target, so event participation follows the\n * standard Path defaults; callers may wrap it in `Clip` when clipping is needed.\n *\n * @param props - Data, coordinate accessors, continuous scales, baseline, and presentation.\n * @returns A Pibbl path node containing all drawable area runs.\n * @throws When `data` is not an array, the baseline is not finite, or presentation is invalid.\n *\n * @see {@link AreaSeriesProps}\n */\nexport function AreaSeries<D>({\n data: dataInput,\n x: xInput,\n y: yInput,\n xScale: xId,\n yScale: yId,\n baseline: baselineInput,\n defined,\n curve,\n style: styleInput,\n ...eventProps\n}: AreaSeriesProps<D>) {\n const xScale = useNumericPosition(xId);\n const yScale = useContinuousScale(yId).get();\n const curveDefinition = resolveSeriesCurve(curve);\n const x = useInternalValueMemoSlot(\n \"vizAreaXAccessor\",\n () => accessor(xInput),\n [xInput],\n );\n const y = useInternalValueMemoSlot(\n \"vizAreaYAccessor\",\n () => accessor(yInput),\n [yInput],\n );\n const data = resolveSignalValue(dataInput);\n if (!Array.isArray(data))\n throw new TypeError(\n \"AreaSeries data must be an array or a signal containing an array.\",\n );\n const baseline = resolveSignalValue(baselineInput);\n if (typeof baseline !== \"number\" || !Number.isFinite(baseline))\n throw new RangeError(\"AreaSeries baseline must be finite.\");\n const baselineY = yScale.map(baseline);\n if (!Number.isFinite(baselineY))\n throw new RangeError(\n \"AreaSeries baseline must map to a finite coordinate.\",\n );\n const style = resolveSignalValue(styleInput) ?? {};\n if (style === null || typeof style !== \"object\" || Array.isArray(style))\n throw new TypeError(\"AreaSeries: style must be an object.\");\n const areaFill = fill(resolveSignalValue(style.fill) ?? \"#2563eb\");\n const alpha = opacity(resolveSignalValue(style.opacity) ?? 0.2, \"AreaSeries\");\n const cursor = resolveSignalValue(style.cursor);\n if (cursor !== undefined && typeof cursor !== \"string\")\n throw new TypeError(\"AreaSeries: cursor must be a string.\");\n\n const path = new Path2D();\n let run: (readonly [number, number])[] = [];\n const closeRun = () => {\n if (run.length >= 2) {\n const first = run[0];\n const last = run[run.length - 1];\n const geometry = curveGeometry(curveDefinition, run);\n path.moveTo(geometry.start[0], geometry.start[1]);\n appendCurveForward(path, geometry);\n path.lineTo(last[0], baselineY);\n path.lineTo(first[0], baselineY);\n path.closePath();\n }\n run = [];\n };\n for (let i = 0; i < data.length; i++) {\n const datum = data[i];\n if (defined && !defined(datum, i, data)) {\n closeRun();\n continue;\n }\n const xv = x(datum, i, data);\n const yv = y(datum, i, data);\n if (\n typeof xv !== \"number\" ||\n typeof yv !== \"number\" ||\n !Number.isFinite(xv) ||\n !Number.isFinite(yv)\n ) {\n closeRun();\n continue;\n }\n const point = [xScale.map(xv), yScale.map(yv)] as const;\n if (!Number.isFinite(point[0]) || !Number.isFinite(point[1])) {\n closeRun();\n continue;\n }\n run.push(point);\n }\n closeRun();\n return (\n <Path\n {...eventProps}\n style={{ d: path, fill: areaFill, opacity: alpha, cursor }}\n />\n );\n}\n"],
5
+ "mappings": "AAiMI;AAjMJ,SAAS,0BAA0B;AACnC,SAAS,MAAM,0BAA0B;AAOzC;AAAA,EACE;AAAA,EACA;AAAA,OACK;AAGP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,eAAe;AACxB,SAAS,0BAA0B;AAiDnC,SAAS,SACP,OACiE;AACjE,SAAO,OAAO,UAAU,aACpB,QACA,CAAC,UAAU,MAAM,KAAK;AAC5B;AAEA,SAAS,KAAK,OAA2B;AACvC,MACE,OAAO,UAAU,YACjB,iBAAiB,kBACjB,iBAAiB;AAEjB,WAAO;AACT,MAAI;AACF,yBAAqB,KAAc;AACnC,WAAO;AAAA,EACT,QAAQ;AACN,UAAM,IAAI,UAAU,2B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
7
+ }
@@ -38,7 +38,7 @@ function Axis(props) {
38
38
  const occupied = [];
39
39
  const visible = /* @__PURE__ */ new Set();
40
40
  const texts = selected.map((value, index) => {
41
- const label = props.tickFormat ? props.tickFormat(value, index) : scale.type === "utc" ? scale.formatTick(value) : typeof value === "number" ? String(Number(value.toPrecision(6))) : value;
41
+ const label = props.tickFormat ? props.tickFormat(value, index) : scale.type === "utc" || scale.type === "trading-time" ? scale.formatTick(value) : typeof value === "number" ? String(Number(value.toPrecision(6))) : value;
42
42
  if (typeof label !== "string") throw new TypeError("Axis tickFormat must return a string.");
43
43
  return label;
44
44
  });
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/features/viz/lib/axis.tsx"],
4
- "sourcesContent": ["import { Path, Text, resolveSignalValue, useCanvasContext } from \"@pibbl/core\";\nimport type { AxisProps } from \"./types.js\";\nimport { lookupScale } from \"./scale-context.js\";\nimport { width, opacity } from \"./paint.js\";\n\nimport { fitAxisLabel } from \"./axis-labels.js\";\n\nimport { ticks, position } from \"./scale-ticks.js\";\n\n/**\n * Draws ticks and labels using a named scale and the configured orientation and style.\n *\n * @param props - Scale, orientation, tick, label, and styling options. See {@link AxisProps}.\n * @returns Pibbl nodes drawing the axis.\n *\n * @see {@link AxisProps}\n */\nexport function Axis(props: AxisProps) {\n if (\n props.position !== \"bottom\" &&\n props.position !== \"left\" &&\n props.position !== \"top\" &&\n props.position !== \"right\"\n )\n throw new TypeError(\"Axis position must be bottom, left, top, or right.\");\n const source = lookupScale(props.scale, \"Axis\");\n if (!source) throw new TypeError(\"Axis requires a scale ID.\");\n const scale = source.get();\n const style = resolveSignalValue(props.style) ?? {};\n const stroke = resolveSignalValue(style.stroke) ?? \"#64748b\";\n const strokeWidth = width(resolveSignalValue(style.strokeWidth) ?? 1, \"Axis\");\n const fill = resolveSignalValue(style.fill) ?? \"#64748b\";\n const font = resolveSignalValue(style.font) ?? \"12px sans-serif\";\n const alpha = opacity(resolveSignalValue(style.opacity) ?? 1, \"Axis\");\n const horizontal = props.position === \"bottom\" || props.position === \"top\";\n const outward = props.position === \"bottom\" || props.position === \"right\" ? 1 : -1;\n const baseline = horizontal\n ? props.position === \"bottom\" ? scale.frame.height : 0\n : props.position === \"right\" ? scale.frame.width : 0;\n const selected = ticks(scale, props);\n const context = useCanvasContext();\n const overlap = resolveSignalValue(props.labelOverlap ?? \"allow\");\n const gap = resolveSignalValue(props.labelGap ?? 8);\n if (overlap !== \"allow\" && overlap !== \"skip\") throw new TypeError(\"Axis labelOverlap must be allow or skip.\");\n if (!Number.isFinite(gap) || gap < 0) throw new RangeError(\"Axis labelGap must be finite and nonnegative.\");\n const overflow = resolveSignalValue(props.labelOverflow ?? \"allow\");\n const maxWidth = props.labelMaxWidth === undefined ? undefined : resolveSignalValue(props.labelMaxWidth);\n const maxLines = resolveSignalValue(props.labelMaxLines ?? 2);\n const lineHeightInput = props.labelLineHeight === undefined ? undefined : resolveSignalValue(props.labelLineHeight);\n if (![\"allow\", \"wrap\", \"truncate\"].includes(overflow)) throw new TypeError(\"Axis labelOverflow must be allow, wrap, or truncate.\");\n if ((overflow !== \"allow\" && maxWidth === undefined) || (maxWidth !== undefined && (!Number.isFinite(maxWidth) || maxWidth <= 0))) throw new RangeError(\"Axis labelMaxWidth must be positive and finite for wrap/truncate.\");\n if (!Number.isInteger(maxLines) || maxLines < 1 || maxLines > 20) throw new RangeError(\"Axis labelMaxLines must be an integer from 1 to 20.\");\n if (lineHeightInput !== undefined && (!Number.isFinite(lineHeightInput) || lineHeightInput <= 0)) throw new RangeError(\"Axis labelLineHeight must be positive and finite.\");\n let lineHeight = 0;\n const lines: (readonly string[])[] = [];\n const occupied: { start: number; end: number }[] = [];\n const visible = new Set<number>();\n const texts = selected.map((value, index) => {\n const label = props.tickFormat ? props.tickFormat(value, index)\n : scale.type === \"utc\" ? scale.formatTick(value as number)\n : typeof value === \"number\" ? String(Number(value.toPrecision(6))) : value;\n if (typeof label !== \"string\") throw new TypeError(\"Axis tickFormat must return a string.\");\n return label;\n });\n // Endpoints have priority; sort by physical position for reversed ranges too.\n const order = selected.map((value, index) => ({ index, p: position(scale, value) })).sort((a, b) => a.p - b.p);\n const priority = order.length > 1 ? [order[0], order[order.length - 1], ...order.slice(1, -1)] : order;\n context.save();\n try {\n context.font = font;\n const fontMetrics = context.measureText(\"Mg\");\n lineHeight = lineHeightInput ?? Math.ceil(fontMetrics.actualBoundingBoxAscent + fontMetrics.actualBoundingBoxDescent + 4);\n for (const text of texts) lines.push(fitAxisLabel(context, text, maxWidth ?? Infinity, overflow, maxLines));\n for (const { index, p } of priority) {\n const metrics = lines[index].map(text => context.measureText(text));\n const size = horizontal ? Math.max(...metrics.map(m => m.width)) : (lines[index].length - 1) * lineHeight + Math.max(...metrics.map(m => m.actualBoundingBoxAscent + m.actualBoundingBoxDescent));\n const interval = { start: p - size / 2, end: p + size / 2 };\n if (overlap === \"allow\" || occupied.every(other => interval.end + gap <= other.start || interval.start >= other.end + gap)) {\n visible.add(index); occupied.push(interval);\n }\n }\n } finally { context.restore(); }\n const path = new Path2D();\n if (horizontal) {\n path.moveTo(scale.range[0], baseline);\n path.lineTo(scale.range[1], baseline);\n } else {\n path.moveTo(baseline, scale.range[0]);\n path.lineTo(baseline, scale.range[1]);\n }\n const labels = selected.map((value, index) => {\n const p = position(scale, value);\n if (horizontal) {\n path.moveTo(p, baseline);\n path.lineTo(p, baseline + outward * 6);\n } else {\n path.moveTo(baseline, p);\n path.lineTo(baseline + outward * 6, p);\n }\n if (!visible.has(index)) return null;\n return lines[index].map((label, lineIndex) => (\n <Text\n key={`${index}:${lineIndex}`}\n pointerEvents=\"none\"\n style={{\n left: horizontal ? p : baseline + outward * 10,\n top: horizontal ? baseline + outward * 10 + (outward > 0 ? lineIndex : lineIndex - lines[index].length + 1) * lineHeight : p + (lineIndex - (lines[index].length - 1) / 2) * lineHeight,\n fill,\n font,\n opacity: alpha,\n textAlign: horizontal ? \"center\" : outward < 0 ? \"right\" : \"left\",\n textBaseline: horizontal ? outward > 0 ? \"top\" : \"bottom\" : \"middle\",\n }}\n >\n {label}\n </Text>\n ));\n });\n return [\n <Path\n key=\"axis\"\n pointerEvents=\"none\"\n style={{ d: path, stroke, strokeWidth, opacity: alpha }}\n />,\n labels,\n ];\n}\n"],
5
- "mappings": "AAqGM;AArGN,SAAS,MAAM,MAAM,oBAAoB,wBAAwB;AAEjE,SAAS,mBAAmB;AAC5B,SAAS,OAAO,eAAe;AAE/B,SAAS,oBAAoB;AAE7B,SAAS,OAAO,gBAAgB;AAUzB,SAAS,KAAK,OAAkB;AACrC,MACE,MAAM,aAAa,YACnB,MAAM,aAAa,UACnB,MAAM,aAAa,SACnB,MAAM,aAAa;AAEnB,UAAM,IAAI,UAAU,oDAAoD;AAC1E,QAAM,SAAS,YAAY,MAAM,OAAO,MAAM;AAC9C,MAAI,CAAC,OAAQ,OAAM,IAAI,UAAU,2BAA2B;AAC5D,QAAM,QAAQ,OAAO,IAAI;AACzB,QAAM,QAAQ,mBAAmB,MAAM,KAAK,KAAK,CAAC;AAClD,QAAM,SAAS,mBAAmB,MAAM,MAAM,KAAK;AACnD,QAAM,cAAc,MAAM,mBAAmB,MAAM,WAAW,KAAK,GAAG,MAAM;AAC5E,QAAM,OAAO,mBAAmB,MAAM,IAAI,KAAK;AAC/C,QAAM,OAAO,mBAAmB,MAAM,IAAI,KAAK;AAC/C,QAAM,QAAQ,QAAQ,mBAAmB,MAAM,OAAO,KAAK,GAAG,MAAM;AACpE,QAAM,aAAa,MAAM,aAAa,YAAY,MAAM,aAAa;AACrE,QAAM,UAAU,MAAM,aAAa,YAAY,MAAM,aAAa,UAAU,IAAI;AAChF,QAAM,WAAW,aACb,MAAM,aAAa,WAAW,MAAM,MAAM,SAAS,IACnD,MAAM,aAAa,UAAU,MAAM,MAAM,QAAQ;AACrD,QAAM,WAAW,MAAM,OAAO,KAAK;AACnC,QAAM,UAAU,iBAAiB;AACjC,QAAM,UAAU,mBAAmB,MAA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AAAA,EACF;AACF;",
4
+ "sourcesContent": ["import { Path, Text, resolveSignalValue, useCanvasContext } from \"@pibbl/core\";\nimport type { AxisProps } from \"./types.js\";\nimport { lookupScale } from \"./scale-context.js\";\nimport { width, opacity } from \"./paint.js\";\n\nimport { fitAxisLabel } from \"./axis-labels.js\";\n\nimport { ticks, position } from \"./scale-ticks.js\";\n\n/**\n * Draws ticks and labels using a named scale and the configured orientation and style.\n *\n * @param props - Scale, orientation, tick, label, and styling options. See {@link AxisProps}.\n * @returns Pibbl nodes drawing the axis.\n *\n * @see {@link AxisProps}\n */\nexport function Axis(props: AxisProps) {\n if (\n props.position !== \"bottom\" &&\n props.position !== \"left\" &&\n props.position !== \"top\" &&\n props.position !== \"right\"\n )\n throw new TypeError(\"Axis position must be bottom, left, top, or right.\");\n const source = lookupScale(props.scale, \"Axis\");\n if (!source) throw new TypeError(\"Axis requires a scale ID.\");\n const scale = source.get();\n const style = resolveSignalValue(props.style) ?? {};\n const stroke = resolveSignalValue(style.stroke) ?? \"#64748b\";\n const strokeWidth = width(resolveSignalValue(style.strokeWidth) ?? 1, \"Axis\");\n const fill = resolveSignalValue(style.fill) ?? \"#64748b\";\n const font = resolveSignalValue(style.font) ?? \"12px sans-serif\";\n const alpha = opacity(resolveSignalValue(style.opacity) ?? 1, \"Axis\");\n const horizontal = props.position === \"bottom\" || props.position === \"top\";\n const outward = props.position === \"bottom\" || props.position === \"right\" ? 1 : -1;\n const baseline = horizontal\n ? props.position === \"bottom\" ? scale.frame.height : 0\n : props.position === \"right\" ? scale.frame.width : 0;\n const selected = ticks(scale, props);\n const context = useCanvasContext();\n const overlap = resolveSignalValue(props.labelOverlap ?? \"allow\");\n const gap = resolveSignalValue(props.labelGap ?? 8);\n if (overlap !== \"allow\" && overlap !== \"skip\") throw new TypeError(\"Axis labelOverlap must be allow or skip.\");\n if (!Number.isFinite(gap) || gap < 0) throw new RangeError(\"Axis labelGap must be finite and nonnegative.\");\n const overflow = resolveSignalValue(props.labelOverflow ?? \"allow\");\n const maxWidth = props.labelMaxWidth === undefined ? undefined : resolveSignalValue(props.labelMaxWidth);\n const maxLines = resolveSignalValue(props.labelMaxLines ?? 2);\n const lineHeightInput = props.labelLineHeight === undefined ? undefined : resolveSignalValue(props.labelLineHeight);\n if (![\"allow\", \"wrap\", \"truncate\"].includes(overflow)) throw new TypeError(\"Axis labelOverflow must be allow, wrap, or truncate.\");\n if ((overflow !== \"allow\" && maxWidth === undefined) || (maxWidth !== undefined && (!Number.isFinite(maxWidth) || maxWidth <= 0))) throw new RangeError(\"Axis labelMaxWidth must be positive and finite for wrap/truncate.\");\n if (!Number.isInteger(maxLines) || maxLines < 1 || maxLines > 20) throw new RangeError(\"Axis labelMaxLines must be an integer from 1 to 20.\");\n if (lineHeightInput !== undefined && (!Number.isFinite(lineHeightInput) || lineHeightInput <= 0)) throw new RangeError(\"Axis labelLineHeight must be positive and finite.\");\n let lineHeight = 0;\n const lines: (readonly string[])[] = [];\n const occupied: { start: number; end: number }[] = [];\n const visible = new Set<number>();\n const texts = selected.map((value, index) => {\n const label = props.tickFormat ? props.tickFormat(value, index)\n : (scale.type === \"utc\" || scale.type === \"trading-time\") ? scale.formatTick(value as number)\n : typeof value === \"number\" ? String(Number(value.toPrecision(6))) : value;\n if (typeof label !== \"string\") throw new TypeError(\"Axis tickFormat must return a string.\");\n return label;\n });\n // Endpoints have priority; sort by physical position for reversed ranges too.\n const order = selected.map((value, index) => ({ index, p: position(scale, value) })).sort((a, b) => a.p - b.p);\n const priority = order.length > 1 ? [order[0], order[order.length - 1], ...order.slice(1, -1)] : order;\n context.save();\n try {\n context.font = font;\n const fontMetrics = context.measureText(\"Mg\");\n lineHeight = lineHeightInput ?? Math.ceil(fontMetrics.actualBoundingBoxAscent + fontMetrics.actualBoundingBoxDescent + 4);\n for (const text of texts) lines.push(fitAxisLabel(context, text, maxWidth ?? Infinity, overflow, maxLines));\n for (const { index, p } of priority) {\n const metrics = lines[index].map(text => context.measureText(text));\n const size = horizontal ? Math.max(...metrics.map(m => m.width)) : (lines[index].length - 1) * lineHeight + Math.max(...metrics.map(m => m.actualBoundingBoxAscent + m.actualBoundingBoxDescent));\n const interval = { start: p - size / 2, end: p + size / 2 };\n if (overlap === \"allow\" || occupied.every(other => interval.end + gap <= other.start || interval.start >= other.end + gap)) {\n visible.add(index); occupied.push(interval);\n }\n }\n } finally { context.restore(); }\n const path = new Path2D();\n if (horizontal) {\n path.moveTo(scale.range[0], baseline);\n path.lineTo(scale.range[1], baseline);\n } else {\n path.moveTo(baseline, scale.range[0]);\n path.lineTo(baseline, scale.range[1]);\n }\n const labels = selected.map((value, index) => {\n const p = position(scale, value);\n if (horizontal) {\n path.moveTo(p, baseline);\n path.lineTo(p, baseline + outward * 6);\n } else {\n path.moveTo(baseline, p);\n path.lineTo(baseline + outward * 6, p);\n }\n if (!visible.has(index)) return null;\n return lines[index].map((label, lineIndex) => (\n <Text\n key={`${index}:${lineIndex}`}\n pointerEvents=\"none\"\n style={{\n left: horizontal ? p : baseline + outward * 10,\n top: horizontal ? baseline + outward * 10 + (outward > 0 ? lineIndex : lineIndex - lines[index].length + 1) * lineHeight : p + (lineIndex - (lines[index].length - 1) / 2) * lineHeight,\n fill,\n font,\n opacity: alpha,\n textAlign: horizontal ? \"center\" : outward < 0 ? \"right\" : \"left\",\n textBaseline: horizontal ? outward > 0 ? \"top\" : \"bottom\" : \"middle\",\n }}\n >\n {label}\n </Text>\n ));\n });\n return [\n <Path\n key=\"axis\"\n pointerEvents=\"none\"\n style={{ d: path, stroke, strokeWidth, opacity: alpha }}\n />,\n labels,\n ];\n}\n"],
5
+ "mappings": "AAqGM;AArGN,SAAS,MAAM,MAAM,oBAAoB,wBAAwB;AAEjE,SAAS,mBAAmB;AAC5B,SAAS,OAAO,eAAe;AAE/B,SAAS,oBAAoB;AAE7B,SAAS,OAAO,gBAAgB;AAUzB,SAAS,KAAK,OAAkB;AACrC,MACE,MAAM,aAAa,YACnB,MAAM,aAAa,UACnB,MAAM,aA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,OAAO,UAAU,CAAC;AACvB,WAAK,OAAO,WAAW,UAAU,GAAG,CAAC;AAAA,IACvC;AACA,QAAI,CAAC,QAAQ,IAAI,KAAK,EAAG,QAAO;AAChC,WAAO,MAAM,KAAK,EAAE,IAAI,CAAC,OAAO,cAC9B;AAAA,MAAC;AAAA;AAAA,QAEC,eAAc;AAAA,QACd,OAAO;AAAA,UACL,MAAM,aAAa,IAAI,WAAW,UAAU;AAAA,UAC5C,KAAK,aAAa,WAAW,UAAU,MAAM,UAAU,IAAI,YAAY,YAAY,MAAM,KAAK,EAAE,SAAS,KAAK,aAAa,KAAK,aAAa,MAAM,KAAK,EAAE,SAAS,KAAK,KAAK;AAAA,UAC7K;AAAA,UACA;AAAA,UACA,SAAS;AAAA,UACT,WAAW,aAAa,WAAW,UAAU,IAAI,UAAU;AAAA,UAC3D,cAAc,aAAa,UAAU,IAAI,QAAQ,WAAW;AAAA,QAC9D;AAAA,QAEC;AAAA;AAAA,MAZI,GAAG,KAAK,IAAI,SAAS;AAAA,IAa5B,CACD;AAAA,EACH,CAAC;AACD,SAAO;AAAA,IACL;AAAA,MAAC;AAAA;AAAA,QAEC,eAAc;AAAA,QACd,OAAO,EAAE,GAAG,MAAM,QAAQ,aAAa,SAAS,MAAM;AAAA;AAAA,MAFlD;AAAA,IAGN;AAAA,IACA;AAAA,EACF;AACF;",
6
6
  "names": []
7
7
  }
@@ -63,6 +63,8 @@ interface BarSeriesBaseProps<D> extends PibblEventHandlers, PibblEventParticipat
63
63
  * Application data supplied to the component or reported by the event. See {@link SignalValue}.
64
64
  */
65
65
  readonly data: SignalValue<readonly D[]>;
66
+ /** Optional committed bar capture; rendering alone performs no inspection searches. */
67
+ readonly inspection?: import("../inspection/bar.js").BarInspectionRef<D>;
66
68
  /** Selects `"vertical"`, `"horizontal"` for orientation. See {@link BarSeriesBaseProps}. */
67
69
  readonly orientation?: "vertical" | "horizontal";
68
70
  /** Property or callback extracting a bar's discrete category. See {@link BarCategoryAccessor}. */
@@ -147,4 +149,4 @@ export type BarSeriesProps<D> = BarSeriesBaseProps<D> & ({
147
149
  *
148
150
  * @see {@link BarSeriesProps}
149
151
  */
150
- export declare function BarSeries<D>({ data: input, orientation, category: categoryInput, value: valueInput, valueStart, valueEnd, categoryScale, valueScale, baseline, group, groupScale, defined, style: styleInput, pointerEvents, ...events }: BarSeriesProps<D>): import("../../../jsx-runtime.js").JSX.Element;
152
+ export declare function BarSeries<D>({ data: input, orientation, category: categoryInput, value: valueInput, valueStart, valueEnd, categoryScale, valueScale, baseline, group, groupScale, defined, style: styleInput, pointerEvents, inspection, ...events }: BarSeriesProps<D>): import("../../../jsx-runtime.js").JSX.Element;
@@ -28,6 +28,7 @@ function BarSeries({
28
28
  defined,
29
29
  style: styleInput,
30
30
  pointerEvents,
31
+ inspection,
31
32
  ...events
32
33
  }) {
33
34
  const categories = useBarScale(categoryScale).get();
@@ -98,6 +99,7 @@ function BarSeries({
98
99
  }
99
100
  const shared = typeof specified === "function" ? void 0 : normalize(specified ?? {}, false);
100
101
  const nodes = [];
102
+ const captured = inspection ? [] : void 0;
101
103
  for (let i = 0; i < data.length; i++) {
102
104
  const datum = data[i];
103
105
  if (defined && !defined(datum, i, data)) continue;
@@ -124,6 +126,18 @@ function BarSeries({
124
126
  throw new RangeError("BarSeries value extent must be finite.");
125
127
  if (extent === 0) continue;
126
128
  const vertical = orientation === "vertical";
129
+ const markFill = fill(from, v);
130
+ captured?.push(Object.freeze({
131
+ datum,
132
+ sourceIndex: i,
133
+ category: c,
134
+ group: g ?? void 0,
135
+ valueStart: from,
136
+ valueEnd: v,
137
+ boundsLocal: Object.freeze({ x: vertical ? start + (slotWidth - bandwidth) / 2 : Math.min(base, end), y: vertical ? Math.min(base, end) : start + (slotWidth - bandwidth) / 2, width: vertical ? bandwidth : extent, height: vertical ? extent : bandwidth }),
138
+ fill: !!markFill,
139
+ strokeWidthLocal: stroke ? strokeWidth : 0
140
+ }));
127
141
  nodes.push(
128
142
  /* @__PURE__ */ jsx(
129
143
  Rectangle,
@@ -134,7 +148,7 @@ function BarSeries({
134
148
  top: vertical ? Math.min(base, end) : start + (slotWidth - bandwidth) / 2,
135
149
  width: vertical ? bandwidth : extent,
136
150
  height: vertical ? extent : bandwidth,
137
- fill: fill(from, v),
151
+ fill: markFill,
138
152
  stroke,
139
153
  strokeWidth,
140
154
  opacity: alpha,
@@ -145,6 +159,7 @@ function BarSeries({
145
159
  )
146
160
  );
147
161
  }
162
+ if (inspection) inspection.capture(captured);
148
163
  return /* @__PURE__ */ jsx(Group, { ...events, children: nodes });
149
164
  }
150
165
  export {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/features/viz/lib/bar-series.tsx"],
4
- "sourcesContent": ["import {\n Group,\n isSignal,\n Rectangle,\n resolveSignalValue,\n useCanvasContext,\n} from \"@pibbl/core\";\nimport type {\n PibblEventHandlers,\n PibblEventParticipationOptions,\n PibblNode,\n FillStyle,\n SignalValue,\n StrokeStyle,\n} from \"@pibbl/core\";\nimport { withHooksForbidden } from \"@pibbl/core/internal\";\nimport { lookupScale } from \"./scale-context.js\";\nimport type { SignalStyle } from \"@pibbl/core/internal\";\nimport type { BandCategory, LineAccessor, ScaleId } from \"./types.js\";\nimport { useContinuousScale } from \"./use-continuous-scale.js\";\nimport { useBarScale } from \"./use-bar-scale.js\";\nimport { pointAccessor, pointData, finiteCoordinate } from \"./point-data.js\";\nimport { opacity, width } from \"./paint.js\";\n/**\n * A data property or callback that extracts a category, with nullish values treated as missing.\n *\n * @param datum - Datum whose category is being read.\n * @param index - Zero-based index in the source data.\n * @param data - Complete source data array.\n * @returns The category, or null/undefined to indicate a missing category. See\n * {@link BandCategory} .\n *\n * @see {@link BandCategory}\n * @see {@link BarSeriesProps}\n */\nexport type BarCategoryAccessor<D> =\n | {\n [K in keyof D]-?: D[K] extends BandCategory | null | undefined\n ? K\n : never;\n }[keyof D]\n | ((\n datum: D,\n index: number,\n data: readonly D[],\n ) => BandCategory | null | undefined);\nimport { barFill, type BarThresholdFill } from \"./bar-fill.js\";\nexport type { BarThresholdFill } from \"./bar-fill.js\";\n/**\n * Supported geometry and presentation properties for BarSeries.\n *\n * @see {@link FillStyle}\n * @see {@link BarThresholdFill}\n * @see {@link StrokeStyle}\n * @see {@link BarStyleResolver}\n */\nexport interface BarSeriesStyle {\n /** Width allocated to one categorical band. See {@link BarSeriesStyle}. */\n readonly bandwidth?: number | \"auto\";\n /** Paint used for the interior. See {@link FillStyle}, {@link BarThresholdFill}. */\n readonly fill?: FillStyle | BarThresholdFill;\n /** Paint used for the outline. See {@link StrokeStyle}. */\n readonly stroke?: StrokeStyle;\n /** Width of the painted outline. See {@link BarSeriesStyle}. */\n readonly strokeWidth?: number;\n /** Opacity of the painted result. See {@link BarSeriesStyle}. */\n readonly opacity?: number;\n /** Cursor shown while this target owns pointer presentation. See {@link BarSeriesStyle}. */\n readonly cursor?: string;\n}\n/**\n * Computes bar styling from the datum, index, and source data.\n *\n * @param datum - Datum being styled.\n * @param index - Zero-based index in the source data.\n * @param data - Complete source data array.\n * @returns Style for this datum's bar. See {@link BarSeriesStyle}.\n *\n * @see {@link BarSeriesStyle}\n */\nexport type BarStyleResolver<D> = (\n datum: D,\n index: number,\n data: readonly D[],\n) => BarSeriesStyle;\n/**\n * Shared data, category/value scales, orientation, filtering, and styling for bar variants.\n *\n * @see {@link BarCategoryAccessor}\n * @see {@link BarSeriesStyle}\n * @see {@link BarSeriesProps}\n */\ninterface BarSeriesBaseProps<D> extends PibblEventHandlers, PibblEventParticipationOptions {\n /**\n * Application data supplied to the component or reported by the event. See {@link SignalValue}.\n */\n readonly data: SignalValue<readonly D[]>;\n /** Selects `\"vertical\"`, `\"horizontal\"` for orientation. See {@link BarSeriesBaseProps}. */\n readonly orientation?: \"vertical\" | \"horizontal\";\n /** Property or callback extracting a bar's discrete category. See {@link BarCategoryAccessor}. */\n readonly category: BarCategoryAccessor<D>;\n /** Band scale used to place categories. See {@link ScaleId}. */\n readonly categoryScale: ScaleId;\n /** Numeric scale used to map bar values. See {@link ScaleId}. */\n readonly valueScale: ScaleId;\n /**\n * Selects the records that participate in the bar series. See {@link BarSeriesProps}.\n * @param datum - Record to test.\n * @param index - Zero-based index in the source array.\n * @param data - Complete source data array.\n * @returns Whether this record should contribute a bar.\n */\n readonly defined?: (datum: D, index: number, data: readonly D[]) => boolean;\n /**\n * Declared presentation and layout properties. See {@link SignalValue}, {@link SignalStyle},\n * {@link BarSeriesStyle}, {@link BarStyleResolver}.\n */\n readonly style?: SignalValue<SignalStyle<BarSeriesStyle> | BarStyleResolver<D>>;\n}\n/**\n * Authored inputs for BarSeries, including the declared data and presentation options.\n *\n * @see {@link LineAccessor}\n * @see {@link SignalValue}\n * @see {@link BarCategoryAccessor}\n * @see {@link ScaleId}\n * @see {@link BarSeries}\n */\nexport type BarSeriesProps<D> = BarSeriesBaseProps<D> &\n (\n | {\n /** Value associated with this sample, input, or result. See {@link LineAccessor}. */\n readonly value: LineAccessor<D>;\n /** Numeric value from which each ordinary bar starts. See {@link SignalValue}. */\n readonly baseline?: SignalValue<number>;\n /**\n * Not accepted in this variant; use the alternative fields instead. See\n * {@link BarSeriesProps}.\n */\n readonly valueStart?: never;\n /**\n * Not accepted in this variant; use the alternative fields instead. See\n * {@link BarSeriesProps}.\n */\n readonly valueEnd?: never;\n }\n | {\n /**\n * Not accepted in this variant; use the alternative fields instead. See\n * {@link BarSeriesProps}.\n */\n readonly value?: never;\n /**\n * Not accepted in this variant; use the alternative fields instead. See\n * {@link BarSeriesProps}.\n */\n readonly baseline?: never;\n /** Accessor for the beginning of a range bar. See {@link LineAccessor}. */\n readonly valueStart: LineAccessor<D>;\n /** Accessor for the end of a range bar. See {@link LineAccessor}. */\n readonly valueEnd: LineAccessor<D>;\n }\n ) &\n (\n | {\n /** Accessor identifying the subgroup of each bar. See {@link BarCategoryAccessor}. */\n readonly group: BarCategoryAccessor<D>;\n /** Band scale used to place subgroups within a category. See {@link ScaleId}. */\n readonly groupScale: ScaleId;\n }\n | {\n /** Accessor identifying the subgroup of each bar. See {@link BarSeriesProps}. */\n readonly group?: never;\n /**\n * Not accepted in this variant; use the alternative fields instead. See\n * {@link BarSeriesProps}.\n */\n readonly groupScale?: never;\n }\n );\n/**\n * Value bars in source order; rectangles supply ordinary paint and event geometry.\n *\n * @param props - Data, category and value accessors, scales, grouping, and styling. See\n * {@link BarSeriesProps} .\n * @returns Pibbl nodes drawing the bars.\n *\n * @see {@link BarSeriesProps}\n */\nexport function BarSeries<D>({\n data: input,\n orientation = \"vertical\",\n category: categoryInput,\n value: valueInput,\n valueStart,\n valueEnd,\n categoryScale,\n valueScale,\n baseline,\n group,\n groupScale,\n defined,\n style: styleInput,\n pointerEvents,\n ...events\n}: BarSeriesProps<D>) {\n const categories = useBarScale(categoryScale).get();\n const values = useContinuousScale(valueScale).get();\n const groups = lookupScale(groupScale, \"BarSeries groupScale\")?.get();\n if ((group === undefined) !== (groupScale === undefined))\n throw new TypeError(\"BarSeries requires group and groupScale together.\");\n if (groups && groups.type !== \"band\")\n throw new TypeError(\"BarSeries groupScale requires a band scale.\");\n const groupValue =\n typeof group === \"function\"\n ? group\n : (datum: D) =>\n group === undefined\n ? undefined\n : (datum[group] as BandCategory | null | undefined);\n const slotWidth =\n groups?.type === \"band\" ? groups.bandwidth : categories.bandwidth;\n if (orientation !== \"vertical\" && orientation !== \"horizontal\")\n throw new TypeError(\"BarSeries orientation must be vertical or horizontal.\");\n const data = pointData(resolveSignalValue(input), \"BarSeries\");\n const category =\n typeof categoryInput === \"function\"\n ? categoryInput\n : (datum: D) =>\n datum[categoryInput] as BandCategory | null | undefined;\n const ranged = valueStart !== undefined || valueEnd !== undefined;\n if (\n ranged\n ? valueInput !== undefined ||\n baseline !== undefined ||\n valueStart === undefined ||\n valueEnd === undefined\n : valueInput === undefined\n )\n throw new TypeError(\n \"BarSeries requires either value with optional baseline, or both valueStart and valueEnd without value or baseline.\",\n );\n const value = pointAccessor((ranged ? valueEnd : valueInput)!);\n const startValue = ranged ? pointAccessor(valueStart!) : undefined;\n const baselineValue = resolveSignalValue(baseline ?? 0);\n const sharedBase = ranged ? undefined : values.map(baselineValue);\n const specified = resolveSignalValue(styleInput);\n const ctx = useCanvasContext();\n function normalize(input: unknown, callback: boolean) {\n if (!input || typeof input !== \"object\" || Array.isArray(input))\n throw new TypeError(\"BarSeries style must be an object.\");\n if (\n callback &&\n Object.getPrototypeOf(input) !== Object.prototype &&\n Object.getPrototypeOf(input) !== null\n )\n throw new TypeError(\n \"BarSeries datum style must be a plain synchronous object.\",\n );\n const style: Record<string, unknown> = {};\n for (const key of Object.keys(input)) {\n if (\n ![\n \"bandwidth\",\n \"fill\",\n \"stroke\",\n \"strokeWidth\",\n \"opacity\",\n \"cursor\",\n ].includes(key)\n )\n throw new TypeError(`BarSeries: unsupported style field ${key}.`);\n const value = (input as Record<string, unknown>)[key];\n if (callback && isSignal(value))\n throw new TypeError(\n \"BarSeries datum styles require plain values; read signals explicitly.\",\n );\n style[key] = callback ? value : resolveSignalValue(value);\n }\n const resolved = style as BarSeriesStyle;\n if (resolved.cursor !== undefined && typeof resolved.cursor !== \"string\")\n throw new TypeError(\"BarSeries cursor must be a string.\");\n return {\n bandwidth:\n resolved.bandwidth === undefined || resolved.bandwidth === \"auto\"\n ? slotWidth\n : width(resolved.bandwidth, \"BarSeries bandwidth\"),\n fill: barFill(ctx, resolved.fill ?? \"#2563eb\", (value) =>\n values.map(value),\n orientation,\n ),\n stroke: resolved.stroke,\n strokeWidth: width(resolved.strokeWidth ?? 1, \"BarSeries strokeWidth\"),\n alpha: opacity(resolved.opacity ?? 1, \"BarSeries\"),\n cursor: resolved.cursor,\n };\n }\n const shared =\n typeof specified === \"function\"\n ? undefined\n : normalize(specified ?? {}, false);\n const nodes: PibblNode[] = [];\n for (let i = 0; i < data.length; i++) {\n const datum = data[i];\n if (defined && !defined(datum, i, data)) continue;\n const c = category(datum, i, data),\n v = value(datum, i, data),\n from = startValue ? startValue(datum, i, data) : baselineValue;\n if (c == null || !finiteCoordinate(v) || !finiteCoordinate(from)) continue;\n const categoryStart = categories.map(c);\n const g = groups ? groupValue(datum, i, data) : undefined;\n const offset = groups ? (g == null ? undefined : groups.map(g)) : 0;\n if (categoryStart === undefined || offset === undefined || slotWidth === 0)\n continue;\n const start = categoryStart + offset;\n const { bandwidth, fill, stroke, strokeWidth, alpha, cursor } =\n shared ??\n normalize(\n withHooksForbidden(\"BarSeries style callback\", () =>\n (specified as BarStyleResolver<D>)(datum, i, data),\n ),\n true,\n );\n if (bandwidth === 0) continue;\n const base = sharedBase ?? values.map(from);\n const end = values.map(v);\n const extent = Math.abs(end - base);\n if (!Number.isFinite(extent))\n throw new RangeError(\"BarSeries value extent must be finite.\");\n if (extent === 0) continue;\n const vertical = orientation === \"vertical\";\n nodes.push(\n <Rectangle\n key={i}\n pointerEvents={pointerEvents}\n style={{\n left: vertical ? start + (slotWidth - bandwidth) / 2 : Math.min(base, end),\n top: vertical ? Math.min(base, end) : start + (slotWidth - bandwidth) / 2,\n width: vertical ? bandwidth : extent,\n height: vertical ? extent : bandwidth,\n fill: fill(from, v),\n stroke,\n strokeWidth,\n opacity: alpha,\n cursor,\n }}\n />,\n );\n }\n return <Group {...events}>{nodes}</Group>;\n}\n"],
5
- "mappings": "AA4UM;AA5UN;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AASP,SAAS,0BAA0B;AACnC,SAAS,mBAAmB;AAG5B,SAAS,0BAA0B;AACnC,SAAS,mBAAmB;AAC5B,SAAS,eAAe,WAAW,wBAAwB;AAC3D,SAAS,SAAS,aAAa;AAwB/B,SAAS,eAAsC;AA+IxC,SAAS,UAAa;AAAA,EAC3B,MAAM;AAAA,EACN,cAAc;AAAA,EACd,UAAU;AAAA,EACV,OAAO;AAAA,EACP;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,OAA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C,SAAO,GAAG,QAAS,iBAAM;AACnC;",
4
+ "sourcesContent": ["import {\n Group,\n isSignal,\n Rectangle,\n resolveSignalValue,\n useCanvasContext,\n} from \"@pibbl/core\";\nimport type {\n PibblEventHandlers,\n PibblEventParticipationOptions,\n PibblNode,\n FillStyle,\n SignalValue,\n StrokeStyle,\n} from \"@pibbl/core\";\nimport { withHooksForbidden } from \"@pibbl/core/internal\";\nimport { lookupScale } from \"./scale-context.js\";\nimport type { SignalStyle } from \"@pibbl/core/internal\";\nimport type { BandCategory, LineAccessor, ScaleId } from \"./types.js\";\nimport { useContinuousScale } from \"./use-continuous-scale.js\";\nimport { useBarScale } from \"./use-bar-scale.js\";\nimport { pointAccessor, pointData, finiteCoordinate } from \"./point-data.js\";\nimport { opacity, width } from \"./paint.js\";\n/**\n * A data property or callback that extracts a category, with nullish values treated as missing.\n *\n * @param datum - Datum whose category is being read.\n * @param index - Zero-based index in the source data.\n * @param data - Complete source data array.\n * @returns The category, or null/undefined to indicate a missing category. See\n * {@link BandCategory} .\n *\n * @see {@link BandCategory}\n * @see {@link BarSeriesProps}\n */\nexport type BarCategoryAccessor<D> =\n | {\n [K in keyof D]-?: D[K] extends BandCategory | null | undefined\n ? K\n : never;\n }[keyof D]\n | ((\n datum: D,\n index: number,\n data: readonly D[],\n ) => BandCategory | null | undefined);\nimport { barFill, type BarThresholdFill } from \"./bar-fill.js\";\nexport type { BarThresholdFill } from \"./bar-fill.js\";\n/**\n * Supported geometry and presentation properties for BarSeries.\n *\n * @see {@link FillStyle}\n * @see {@link BarThresholdFill}\n * @see {@link StrokeStyle}\n * @see {@link BarStyleResolver}\n */\nexport interface BarSeriesStyle {\n /** Width allocated to one categorical band. See {@link BarSeriesStyle}. */\n readonly bandwidth?: number | \"auto\";\n /** Paint used for the interior. See {@link FillStyle}, {@link BarThresholdFill}. */\n readonly fill?: FillStyle | BarThresholdFill;\n /** Paint used for the outline. See {@link StrokeStyle}. */\n readonly stroke?: StrokeStyle;\n /** Width of the painted outline. See {@link BarSeriesStyle}. */\n readonly strokeWidth?: number;\n /** Opacity of the painted result. See {@link BarSeriesStyle}. */\n readonly opacity?: number;\n /** Cursor shown while this target owns pointer presentation. See {@link BarSeriesStyle}. */\n readonly cursor?: string;\n}\n/**\n * Computes bar styling from the datum, index, and source data.\n *\n * @param datum - Datum being styled.\n * @param index - Zero-based index in the source data.\n * @param data - Complete source data array.\n * @returns Style for this datum's bar. See {@link BarSeriesStyle}.\n *\n * @see {@link BarSeriesStyle}\n */\nexport type BarStyleResolver<D> = (\n datum: D,\n index: number,\n data: readonly D[],\n) => BarSeriesStyle;\n/**\n * Shared data, category/value scales, orientation, filtering, and styling for bar variants.\n *\n * @see {@link BarCategoryAccessor}\n * @see {@link BarSeriesStyle}\n * @see {@link BarSeriesProps}\n */\ninterface BarSeriesBaseProps<D> extends PibblEventHandlers, PibblEventParticipationOptions {\n /**\n * Application data supplied to the component or reported by the event. See {@link SignalValue}.\n */\n readonly data: SignalValue<readonly D[]>;\n /** Optional committed bar capture; rendering alone performs no inspection searches. */\n readonly inspection?: import(\"../inspection/bar.js\").BarInspectionRef<D>;\n /** Selects `\"vertical\"`, `\"horizontal\"` for orientation. See {@link BarSeriesBaseProps}. */\n readonly orientation?: \"vertical\" | \"horizontal\";\n /** Property or callback extracting a bar's discrete category. See {@link BarCategoryAccessor}. */\n readonly category: BarCategoryAccessor<D>;\n /** Band scale used to place categories. See {@link ScaleId}. */\n readonly categoryScale: ScaleId;\n /** Numeric scale used to map bar values. See {@link ScaleId}. */\n readonly valueScale: ScaleId;\n /**\n * Selects the records that participate in the bar series. See {@link BarSeriesProps}.\n * @param datum - Record to test.\n * @param index - Zero-based index in the source array.\n * @param data - Complete source data array.\n * @returns Whether this record should contribute a bar.\n */\n readonly defined?: (datum: D, index: number, data: readonly D[]) => boolean;\n /**\n * Declared presentation and layout properties. See {@link SignalValue}, {@link SignalStyle},\n * {@link BarSeriesStyle}, {@link BarStyleResolver}.\n */\n readonly style?: SignalValue<SignalStyle<BarSeriesStyle> | BarStyleResolver<D>>;\n}\n/**\n * Authored inputs for BarSeries, including the declared data and presentation options.\n *\n * @see {@link LineAccessor}\n * @see {@link SignalValue}\n * @see {@link BarCategoryAccessor}\n * @see {@link ScaleId}\n * @see {@link BarSeries}\n */\nexport type BarSeriesProps<D> = BarSeriesBaseProps<D> &\n (\n | {\n /** Value associated with this sample, input, or result. See {@link LineAccessor}. */\n readonly value: LineAccessor<D>;\n /** Numeric value from which each ordinary bar starts. See {@link SignalValue}. */\n readonly baseline?: SignalValue<number>;\n /**\n * Not accepted in this variant; use the alternative fields instead. See\n * {@link BarSeriesProps}.\n */\n readonly valueStart?: never;\n /**\n * Not accepted in this variant; use the alternative fields instead. See\n * {@link BarSeriesProps}.\n */\n readonly valueEnd?: never;\n }\n | {\n /**\n * Not accepted in this variant; use the alternative fields instead. See\n * {@link BarSeriesProps}.\n */\n readonly value?: never;\n /**\n * Not accepted in this variant; use the alternative fields instead. See\n * {@link BarSeriesProps}.\n */\n readonly baseline?: never;\n /** Accessor for the beginning of a range bar. See {@link LineAccessor}. */\n readonly valueStart: LineAccessor<D>;\n /** Accessor for the end of a range bar. See {@link LineAccessor}. */\n readonly valueEnd: LineAccessor<D>;\n }\n ) &\n (\n | {\n /** Accessor identifying the subgroup of each bar. See {@link BarCategoryAccessor}. */\n readonly group: BarCategoryAccessor<D>;\n /** Band scale used to place subgroups within a category. See {@link ScaleId}. */\n readonly groupScale: ScaleId;\n }\n | {\n /** Accessor identifying the subgroup of each bar. See {@link BarSeriesProps}. */\n readonly group?: never;\n /**\n * Not accepted in this variant; use the alternative fields instead. See\n * {@link BarSeriesProps}.\n */\n readonly groupScale?: never;\n }\n );\n/**\n * Value bars in source order; rectangles supply ordinary paint and event geometry.\n *\n * @param props - Data, category and value accessors, scales, grouping, and styling. See\n * {@link BarSeriesProps} .\n * @returns Pibbl nodes drawing the bars.\n *\n * @see {@link BarSeriesProps}\n */\nexport function BarSeries<D>({\n data: input,\n orientation = \"vertical\",\n category: categoryInput,\n value: valueInput,\n valueStart,\n valueEnd,\n categoryScale,\n valueScale,\n baseline,\n group,\n groupScale,\n defined,\n style: styleInput,\n pointerEvents,\n inspection,\n ...events\n}: BarSeriesProps<D>) {\n const categories = useBarScale(categoryScale).get();\n const values = useContinuousScale(valueScale).get();\n const groups = lookupScale(groupScale, \"BarSeries groupScale\")?.get();\n if ((group === undefined) !== (groupScale === undefined))\n throw new TypeError(\"BarSeries requires group and groupScale together.\");\n if (groups && groups.type !== \"band\")\n throw new TypeError(\"BarSeries groupScale requires a band scale.\");\n const groupValue =\n typeof group === \"function\"\n ? group\n : (datum: D) =>\n group === undefined\n ? undefined\n : (datum[group] as BandCategory | null | undefined);\n const slotWidth =\n groups?.type === \"band\" ? groups.bandwidth : categories.bandwidth;\n if (orientation !== \"vertical\" && orientation !== \"horizontal\")\n throw new TypeError(\"BarSeries orientation must be vertical or horizontal.\");\n const data = pointData(resolveSignalValue(input), \"BarSeries\");\n const category =\n typeof categoryInput === \"function\"\n ? categoryInput\n : (datum: D) =>\n datum[categoryInput] as BandCategory | null | undefined;\n const ranged = valueStart !== undefined || valueEnd !== undefined;\n if (\n ranged\n ? valueInput !== undefined ||\n baseline !== undefined ||\n valueStart === undefined ||\n valueEnd === undefined\n : valueInput === undefined\n )\n throw new TypeError(\n \"BarSeries requires either value with optional baseline, or both valueStart and valueEnd without value or baseline.\",\n );\n const value = pointAccessor((ranged ? valueEnd : valueInput)!);\n const startValue = ranged ? pointAccessor(valueStart!) : undefined;\n const baselineValue = resolveSignalValue(baseline ?? 0);\n const sharedBase = ranged ? undefined : values.map(baselineValue);\n const specified = resolveSignalValue(styleInput);\n const ctx = useCanvasContext();\n function normalize(input: unknown, callback: boolean) {\n if (!input || typeof input !== \"object\" || Array.isArray(input))\n throw new TypeError(\"BarSeries style must be an object.\");\n if (\n callback &&\n Object.getPrototypeOf(input) !== Object.prototype &&\n Object.getPrototypeOf(input) !== null\n )\n throw new TypeError(\n \"BarSeries datum style must be a plain synchronous object.\",\n );\n const style: Record<string, unknown> = {};\n for (const key of Object.keys(input)) {\n if (\n ![\n \"bandwidth\",\n \"fill\",\n \"stroke\",\n \"strokeWidth\",\n \"opacity\",\n \"cursor\",\n ].includes(key)\n )\n throw new TypeError(`BarSeries: unsupported style field ${key}.`);\n const value = (input as Record<string, unknown>)[key];\n if (callback && isSignal(value))\n throw new TypeError(\n \"BarSeries datum styles require plain values; read signals explicitly.\",\n );\n style[key] = callback ? value : resolveSignalValue(value);\n }\n const resolved = style as BarSeriesStyle;\n if (resolved.cursor !== undefined && typeof resolved.cursor !== \"string\")\n throw new TypeError(\"BarSeries cursor must be a string.\");\n return {\n bandwidth:\n resolved.bandwidth === undefined || resolved.bandwidth === \"auto\"\n ? slotWidth\n : width(resolved.bandwidth, \"BarSeries bandwidth\"),\n fill: barFill(ctx, resolved.fill ?? \"#2563eb\", (value) =>\n values.map(value),\n orientation,\n ),\n stroke: resolved.stroke,\n strokeWidth: width(resolved.strokeWidth ?? 1, \"BarSeries strokeWidth\"),\n alpha: opacity(resolved.opacity ?? 1, \"BarSeries\"),\n cursor: resolved.cursor,\n };\n }\n const shared =\n typeof specified === \"function\"\n ? undefined\n : normalize(specified ?? {}, false);\n const nodes: PibblNode[] = [];\n const captured: import(\"../inspection/bar.js\").CapturedBarMark<D>[] | undefined = inspection ? [] : undefined;\n for (let i = 0; i < data.length; i++) {\n const datum = data[i];\n if (defined && !defined(datum, i, data)) continue;\n const c = category(datum, i, data),\n v = value(datum, i, data),\n from = startValue ? startValue(datum, i, data) : baselineValue;\n if (c == null || !finiteCoordinate(v) || !finiteCoordinate(from)) continue;\n const categoryStart = categories.map(c);\n const g = groups ? groupValue(datum, i, data) : undefined;\n const offset = groups ? (g == null ? undefined : groups.map(g)) : 0;\n if (categoryStart === undefined || offset === undefined || slotWidth === 0)\n continue;\n const start = categoryStart + offset;\n const { bandwidth, fill, stroke, strokeWidth, alpha, cursor } =\n shared ??\n normalize(\n withHooksForbidden(\"BarSeries style callback\", () =>\n (specified as BarStyleResolver<D>)(datum, i, data),\n ),\n true,\n );\n if (bandwidth === 0) continue;\n const base = sharedBase ?? values.map(from);\n const end = values.map(v);\n const extent = Math.abs(end - base);\n if (!Number.isFinite(extent))\n throw new RangeError(\"BarSeries value extent must be finite.\");\n if (extent === 0) continue;\n const vertical = orientation === \"vertical\";\n const markFill = fill(from,v);\n captured?.push(Object.freeze({datum,sourceIndex:i,category:c,group:g ?? undefined,valueStart:from,valueEnd:v,\n boundsLocal:Object.freeze({x:vertical?start+(slotWidth-bandwidth)/2:Math.min(base,end),y:vertical?Math.min(base,end):start+(slotWidth-bandwidth)/2,width:vertical?bandwidth:extent,height:vertical?extent:bandwidth}),\n fill:!!markFill,strokeWidthLocal:stroke?strokeWidth:0}));\n nodes.push(\n <Rectangle\n key={i}\n pointerEvents={pointerEvents}\n style={{\n left: vertical ? start + (slotWidth - bandwidth) / 2 : Math.min(base, end),\n top: vertical ? Math.min(base, end) : start + (slotWidth - bandwidth) / 2,\n width: vertical ? bandwidth : extent,\n height: vertical ? extent : bandwidth,\n fill: markFill,\n stroke,\n strokeWidth,\n opacity: alpha,\n cursor,\n }}\n />,\n );\n }\n if (inspection) inspection.capture(captured!);\n return <Group {...events}>{nodes}</Group>;\n}\n"],
5
+ "mappings": "AAoVM;AApVN;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AASP,SAAS,0BAA0B;AACnC,SAAS,mBAAmB;AAG5B,SAAS,0BAA0B;AACnC,SAAS,mBAAmB;AAC5B,SAAS,eAAe,WAAW,wBAAwB;AAC3D,SAAS,SAAS,aAAa;AAwB/B,SAAS,eAAsC;AAiJxC,SAAS,UAAa;AAAA,EAC3B,MAAM;AAAA,EACN,cAAc;AAAA,EACd,UAAU;AAAA,EACV,OAAO;AAAA,EACP;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AA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AO,UAAS,CAAC;AAAA,MACpN,MAAK,CAAC,CAAC;AAAA,MAAS,kBAAiB,SAAO,cAAY;AAAA,IAAC,CAAC,CAAC;AACzD,UAAM;AAAA,MACJ;AAAA,QAAC;AAAA;AAAA,UAEC;AAAA,UACA,OAAO;AAAA,YACL,MAAM,WAAW,SAAS,YAAY,aAAa,IAAI,KAAK,IAAI,MAAM,GAAG;AAAA,YACzE,KAAK,WAAW,KAAK,IAAI,MAAM,GAAG,IAAI,SAAS,YAAY,aAAa;AAAA,YACxE,OAAO,WAAW,YAAY;AAAA,YAC9B,QAAQ,WAAW,SAAS;AAAA,YAC5B,MAAM;AAAA,YACN;AAAA,YACA;AAAA,YACA,SAAS;AAAA,YACT;AAAA,UACF;AAAA;AAAA,QAZK;AAAA,MAaP;AAAA,IACF;AAAA,EACF;AACA,MAAI,WAAY,YAAW,QAAQ,QAAS;AAC5C,SAAO,oBAAC,SAAO,GAAG,QAAS,iBAAM;AACnC;",
6
6
  "names": ["input", "value"]
7
7
  }
@@ -0,0 +1,55 @@
1
+ import type { FillStyle, PibblEventHandlers, PibblEventParticipationOptions, SignalValue, StrokeStyle } from "@pibbl/core";
2
+ import type { SignalStyle } from "@pibbl/core/internal";
3
+ import type { LineAccessor, LineSeriesProps, ScaleId } from "./types.js";
4
+ /** Shared paint for one side of a baseline. See {@link BaselineSeries}. */
5
+ export interface BaselineSideStyle {
6
+ /** Area fill for this side of the baseline. */
7
+ readonly fill?: FillStyle;
8
+ /** Line stroke for this side of the baseline. */
9
+ readonly stroke?: StrokeStyle;
10
+ }
11
+ /** Shared presentation for a linear baseline series. See {@link BaselineSeries}. */
12
+ export interface BaselineSeriesStyle {
13
+ /** Paint for y values greater than or equal to baseline. */
14
+ readonly above?: BaselineSideStyle;
15
+ /** Paint for y values less than baseline. */
16
+ readonly below?: BaselineSideStyle;
17
+ /** Opacity for both area fills; defaults to 0.2. */
18
+ readonly fillOpacity?: number;
19
+ /** Width for both line strokes; defaults to 2. */
20
+ readonly strokeWidth?: number;
21
+ /** Cursor while a painted series path owns targeting. */
22
+ readonly cursor?: string;
23
+ }
24
+ /** A linear connected series split into independently painted regions at baseline crossings. See
25
+ * {@link BaselineSeries}.
26
+ */
27
+ export interface BaselineSeriesProps<D> extends PibblEventHandlers, PibblEventParticipationOptions {
28
+ /** Application records or a signal of records; source order is retained. */
29
+ readonly data: SignalValue<readonly D[]>;
30
+ /** Property key or callback extracting horizontal coordinates. */
31
+ readonly x: LineAccessor<D>;
32
+ /** Property key or callback extracting vertical coordinates. */
33
+ readonly y: LineAccessor<D>;
34
+ /** Numeric or trading-time horizontal scale identity. */
35
+ readonly xScale: ScaleId;
36
+ /** Linear vertical scale identity. */
37
+ readonly yScale: ScaleId;
38
+ /** Finite data-space division between the above and below presentations. */
39
+ readonly baseline: SignalValue<number>;
40
+ /** Excludes a record before its accessors run. */
41
+ readonly defined?: LineSeriesProps<D>["defined"];
42
+ /** Optional committed original-record capture on the standard numeric inspection foundation. */
43
+ readonly inspection?: import("../inspection/capture-types.js").NumericInspectionRef<D>;
44
+ /** Shared above/below paint and interaction presentation. */
45
+ readonly style?: SignalValue<SignalStyle<BaselineSeriesStyle>>;
46
+ }
47
+ /**
48
+ * Draws a linear connected series with independently painted regions above and below a baseline.
49
+ * Equal values belong to the above stroke; zero-area spans never receive a fill. Gaps split runs,
50
+ * and optional inspection captures only original records.
51
+ * @param props - Records, a numeric or trading-time x scale, linear price y scale, baseline, event props, and shared side paint.
52
+ * @returns Filled and stroked Pibbl paths in source paint order.
53
+ * @see {@link LineSeriesProps}
54
+ */
55
+ export declare function BaselineSeries<D>({ data: dataInput, x: xInput, y: yInput, xScale: xId, yScale: yId, baseline: baselineInput, defined, inspection, style: styleInput, ...eventProps }: BaselineSeriesProps<D>): import("../../../jsx-runtime.js").JSX.Element;