@pibbl/core 0.0.2 → 0.0.3-alpha.109.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.
- package/THIRD_PARTY_NOTICES.txt +81 -0
- package/dist/features/physics/2d-testing.d.ts +1 -1
- package/dist/features/physics/2d-testing.js +2 -2
- package/dist/features/physics/2d-testing.js.map +2 -2
- package/dist/features/physics/lib/2d/canvas/components.js +25 -21
- package/dist/features/physics/lib/2d/canvas/components.js.map +2 -2
- package/dist/features/physics/lib/2d/canvas/presentation.js +1 -2
- package/dist/features/physics/lib/2d/canvas/presentation.js.map +2 -2
- package/dist/features/physics/lib/2d/collision/casts.js +4 -2
- package/dist/features/physics/lib/2d/collision/casts.js.map +2 -2
- package/dist/features/physics/lib/2d/runtime/controller.js +1 -1
- package/dist/features/physics/lib/2d/runtime/controller.js.map +2 -2
- package/dist/features/physics/lib/2d/runtime/obstacles.js +9 -11
- package/dist/features/physics/lib/2d/runtime/obstacles.js.map +2 -2
- package/dist/features/physics/lib/2d/shapes.js +8 -9
- package/dist/features/physics/lib/2d/shapes.js.map +2 -2
- package/dist/features/physics/lib/2d/world/rapier.js +22 -26
- package/dist/features/physics/lib/2d/world/rapier.js.map +2 -2
- package/dist/features/sprites/loader.js +6 -3
- package/dist/features/sprites/loader.js.map +2 -2
- package/dist/features/textures/index.d.ts +12 -2
- package/dist/features/textures/index.js +33 -1
- package/dist/features/textures/index.js.map +2 -2
- package/dist/features/textures/lib/chemical-field.d.ts +56 -0
- package/dist/features/textures/lib/chemical-field.js +154 -0
- package/dist/features/textures/lib/chemical-field.js.map +7 -0
- package/dist/features/textures/lib/chemical-recipes.d.ts +119 -0
- package/dist/features/textures/lib/chemical-recipes.js +275 -0
- package/dist/features/textures/lib/chemical-recipes.js.map +7 -0
- package/dist/features/textures/lib/definitions.d.ts +3 -18
- package/dist/features/textures/lib/definitions.js +17 -24
- package/dist/features/textures/lib/definitions.js.map +2 -2
- package/dist/features/textures/lib/geometric-patterns.d.ts +149 -0
- package/dist/features/textures/lib/geometric-patterns.js +305 -0
- package/dist/features/textures/lib/geometric-patterns.js.map +7 -0
- package/dist/features/textures/lib/gray-scott.d.ts +55 -0
- package/dist/features/textures/lib/gray-scott.js +37 -0
- package/dist/features/textures/lib/gray-scott.js.map +7 -0
- package/dist/features/textures/lib/palette.js +1 -3
- package/dist/features/textures/lib/palette.js.map +2 -2
- package/dist/features/textures/lib/patterns.d.ts +123 -0
- package/dist/features/textures/lib/patterns.js +344 -0
- package/dist/features/textures/lib/patterns.js.map +7 -0
- package/dist/features/textures/lib/rain-drops.js +2 -1
- package/dist/features/textures/lib/rain-drops.js.map +2 -2
- package/dist/features/textures/lib/reaction-diffusion.d.ts +3 -2
- package/dist/features/textures/lib/reaction-diffusion.js +9 -20
- package/dist/features/textures/lib/reaction-diffusion.js.map +2 -2
- package/dist/features/textures/lib/simulation.d.ts +10 -4
- package/dist/features/textures/lib/simulation.js +23 -13
- package/dist/features/textures/lib/simulation.js.map +2 -2
- package/dist/features/textures/lib/wasm/electric.js +8 -1
- package/dist/features/textures/lib/wasm/electric.js.map +2 -2
- package/dist/features/textures/lib/water-surface.js +1 -3
- package/dist/features/textures/lib/water-surface.js.map +2 -2
- package/dist/features/viz/index.d.ts +68 -6
- package/dist/features/viz/index.js +164 -2
- package/dist/features/viz/index.js.map +2 -2
- package/dist/features/viz/inspection/bar.d.ts +79 -0
- package/dist/features/viz/inspection/bar.js +49 -0
- package/dist/features/viz/inspection/bar.js.map +7 -0
- package/dist/features/viz/inspection/candle.d.ts +156 -0
- package/dist/features/viz/inspection/candle.js +120 -0
- package/dist/features/viz/inspection/candle.js.map +7 -0
- package/dist/features/viz/inspection/capture-types.d.ts +65 -0
- package/dist/features/viz/inspection/capture.d.ts +16 -0
- package/dist/features/viz/inspection/capture.js +49 -0
- package/dist/features/viz/inspection/capture.js.map +7 -0
- package/dist/features/viz/inspection/handler.d.ts +36 -0
- package/dist/features/viz/inspection/handler.js +91 -0
- package/dist/features/viz/inspection/handler.js.map +7 -0
- package/dist/features/viz/inspection/ohlc-bar.d.ts +132 -0
- package/dist/features/viz/inspection/ohlc-bar.js +118 -0
- package/dist/features/viz/inspection/ohlc-bar.js.map +7 -0
- package/dist/features/viz/inspection/owned-ref.d.ts +16 -0
- package/dist/features/viz/inspection/owned-ref.js +99 -0
- package/dist/features/viz/inspection/owned-ref.js.map +7 -0
- package/dist/features/viz/inspection/painted-point.d.ts +22 -0
- package/dist/features/viz/inspection/painted-point.js +29 -0
- package/dist/features/viz/inspection/painted-point.js.map +7 -0
- package/dist/features/viz/inspection/queries.d.ts +100 -0
- package/dist/features/viz/inspection/queries.js +192 -0
- package/dist/features/viz/inspection/queries.js.map +7 -0
- package/dist/features/viz/inspection/query-types.d.ts +177 -0
- package/dist/features/viz/inspection/volume.d.ts +104 -0
- package/dist/features/viz/inspection/volume.js +95 -0
- package/dist/features/viz/inspection/volume.js.map +7 -0
- package/dist/features/viz/inspection.d.ts +19 -0
- package/dist/features/viz/inspection.js +54 -0
- package/dist/features/viz/inspection.js.map +7 -0
- package/dist/features/viz/inspection.mjs +1 -0
- package/dist/features/viz/lib/area-series.d.ts +62 -0
- package/dist/features/viz/lib/area-series.js +120 -0
- package/dist/features/viz/lib/area-series.js.map +7 -0
- package/dist/features/viz/lib/axis-title.js +2 -1
- package/dist/features/viz/lib/axis-title.js.map +2 -2
- package/dist/features/viz/lib/axis.js +1 -1
- package/dist/features/viz/lib/axis.js.map +2 -2
- package/dist/features/viz/lib/bar-series.d.ts +3 -1
- package/dist/features/viz/lib/bar-series.js +16 -1
- package/dist/features/viz/lib/bar-series.js.map +2 -2
- package/dist/features/viz/lib/baseline-series.d.ts +55 -0
- package/dist/features/viz/lib/baseline-series.js +136 -0
- package/dist/features/viz/lib/baseline-series.js.map +7 -0
- package/dist/features/viz/lib/candlestick-series.d.ts +62 -0
- package/dist/features/viz/lib/candlestick-series.js +150 -0
- package/dist/features/viz/lib/candlestick-series.js.map +7 -0
- package/dist/features/viz/lib/censored-point-series.d.ts +71 -0
- package/dist/features/viz/lib/censored-point-series.js +129 -0
- package/dist/features/viz/lib/censored-point-series.js.map +7 -0
- package/dist/features/viz/lib/color-context.d.ts +4 -0
- package/dist/features/viz/lib/color-context.js +41 -0
- package/dist/features/viz/lib/color-context.js.map +7 -0
- package/dist/features/viz/lib/color-math.d.ts +4 -0
- package/dist/features/viz/lib/color-math.js +31 -0
- package/dist/features/viz/lib/color-math.js.map +7 -0
- package/dist/features/viz/lib/color-types.d.ts +53 -0
- package/dist/features/viz/lib/curve-definition.d.ts +49 -0
- package/dist/features/viz/lib/curve-definition.js +142 -0
- package/dist/features/viz/lib/curve-definition.js.map +7 -0
- package/dist/features/viz/lib/diverging-color-scale.d.ts +11 -0
- package/dist/features/viz/lib/diverging-color-scale.js +51 -0
- package/dist/features/viz/lib/diverging-color-scale.js.map +7 -0
- package/dist/features/viz/lib/domain-navigation.d.ts +40 -0
- package/dist/features/viz/lib/domain-navigation.js +77 -0
- package/dist/features/viz/lib/domain-navigation.js.map +7 -0
- package/dist/features/viz/lib/editable-chart-elements.d.ts +178 -0
- package/dist/features/viz/lib/editable-chart-elements.js +733 -0
- package/dist/features/viz/lib/editable-chart-elements.js.map +7 -0
- package/dist/features/viz/lib/financial-aggregation.d.ts +127 -0
- package/dist/features/viz/lib/financial-aggregation.js +116 -0
- package/dist/features/viz/lib/financial-aggregation.js.map +7 -0
- package/dist/features/viz/lib/financial-autoscale.d.ts +64 -0
- package/dist/features/viz/lib/financial-autoscale.js +61 -0
- package/dist/features/viz/lib/financial-autoscale.js.map +7 -0
- package/dist/features/viz/lib/financial-comparison.d.ts +62 -0
- package/dist/features/viz/lib/financial-comparison.js +98 -0
- package/dist/features/viz/lib/financial-comparison.js.map +7 -0
- package/dist/features/viz/lib/financial-geometry.d.ts +77 -0
- package/dist/features/viz/lib/financial-geometry.js +67 -0
- package/dist/features/viz/lib/financial-geometry.js.map +7 -0
- package/dist/features/viz/lib/financial-indicators.d.ts +114 -0
- package/dist/features/viz/lib/financial-indicators.js +135 -0
- package/dist/features/viz/lib/financial-indicators.js.map +7 -0
- package/dist/features/viz/lib/financial-oscillators.d.ts +171 -0
- package/dist/features/viz/lib/financial-oscillators.js +265 -0
- package/dist/features/viz/lib/financial-oscillators.js.map +7 -0
- package/dist/features/viz/lib/graph/bipartite.d.ts +14 -0
- package/dist/features/viz/lib/graph/bipartite.js +250 -0
- package/dist/features/viz/lib/graph/bipartite.js.map +7 -0
- package/dist/features/viz/lib/graph/chord.d.ts +44 -0
- package/dist/features/viz/lib/graph/chord.js +348 -0
- package/dist/features/viz/lib/graph/chord.js.map +7 -0
- package/dist/features/viz/lib/graph/dependency.d.ts +26 -0
- package/dist/features/viz/lib/graph/dependency.js +140 -0
- package/dist/features/viz/lib/graph/dependency.js.map +7 -0
- package/dist/features/viz/lib/graph/force.d.ts +28 -0
- package/dist/features/viz/lib/graph/force.js +580 -0
- package/dist/features/viz/lib/graph/force.js.map +7 -0
- package/dist/features/viz/lib/graph/hierarchy.d.ts +21 -0
- package/dist/features/viz/lib/graph/hierarchy.js +112 -0
- package/dist/features/viz/lib/graph/hierarchy.js.map +7 -0
- package/dist/features/viz/lib/graph/icicle.d.ts +16 -0
- package/dist/features/viz/lib/graph/icicle.js +153 -0
- package/dist/features/viz/lib/graph/icicle.js.map +7 -0
- package/dist/features/viz/lib/graph/matrix.d.ts +30 -0
- package/dist/features/viz/lib/graph/matrix.js +243 -0
- package/dist/features/viz/lib/graph/matrix.js.map +7 -0
- package/dist/features/viz/lib/graph/neighborhood.d.ts +11 -0
- package/dist/features/viz/lib/graph/neighborhood.js +281 -0
- package/dist/features/viz/lib/graph/neighborhood.js.map +7 -0
- package/dist/features/viz/lib/graph/routes.d.ts +35 -0
- package/dist/features/viz/lib/graph/routes.js +101 -0
- package/dist/features/viz/lib/graph/routes.js.map +7 -0
- package/dist/features/viz/lib/graph/sankey.d.ts +44 -0
- package/dist/features/viz/lib/graph/sankey.js +341 -0
- package/dist/features/viz/lib/graph/sankey.js.map +7 -0
- package/dist/features/viz/lib/graph/shared.d.ts +59 -0
- package/dist/features/viz/lib/graph/shared.js +301 -0
- package/dist/features/viz/lib/graph/shared.js.map +7 -0
- package/dist/features/viz/lib/graph/tree.d.ts +11 -0
- package/dist/features/viz/lib/graph/tree.js +232 -0
- package/dist/features/viz/lib/graph/tree.js.map +7 -0
- package/dist/features/viz/lib/graph/treemap.d.ts +20 -0
- package/dist/features/viz/lib/graph/treemap.js +227 -0
- package/dist/features/viz/lib/graph/treemap.js.map +7 -0
- package/dist/features/viz/lib/graph/types.d.ts +1097 -0
- package/dist/features/viz/lib/hover-card.js +8 -9
- package/dist/features/viz/lib/hover-card.js.map +2 -2
- package/dist/features/viz/lib/hover-data.d.ts +1 -1
- package/dist/features/viz/lib/hover-data.js +5 -2
- package/dist/features/viz/lib/hover-data.js.map +2 -2
- package/dist/features/viz/lib/interval-band-series.d.ts +49 -0
- package/dist/features/viz/lib/interval-band-series.js +136 -0
- package/dist/features/viz/lib/interval-band-series.js.map +7 -0
- package/dist/features/viz/lib/interval-diamond-series.d.ts +43 -0
- package/dist/features/viz/lib/interval-diamond-series.js +122 -0
- package/dist/features/viz/lib/interval-diamond-series.js.map +7 -0
- package/dist/features/viz/lib/interval-series.d.ts +79 -0
- package/dist/features/viz/lib/interval-series.js +158 -0
- package/dist/features/viz/lib/interval-series.js.map +7 -0
- package/dist/features/viz/lib/layout-pie.js +9 -13
- package/dist/features/viz/lib/layout-pie.js.map +2 -2
- package/dist/features/viz/lib/line-series.d.ts +1 -1
- package/dist/features/viz/lib/line-series.js +47 -28
- package/dist/features/viz/lib/line-series.js.map +2 -2
- package/dist/features/viz/lib/linear-scale.js +1 -1
- package/dist/features/viz/lib/linear-scale.js.map +2 -2
- package/dist/features/viz/lib/monotone-curve.d.ts +11 -0
- package/dist/features/viz/lib/monotone-curve.js +63 -0
- package/dist/features/viz/lib/monotone-curve.js.map +7 -0
- package/dist/features/viz/lib/numeric-range-interpolation.d.ts +15 -0
- package/dist/features/viz/lib/numeric-range-interpolation.js +36 -0
- package/dist/features/viz/lib/numeric-range-interpolation.js.map +7 -0
- package/dist/features/viz/lib/ohlc-bar-series.d.ts +55 -0
- package/dist/features/viz/lib/ohlc-bar-series.js +168 -0
- package/dist/features/viz/lib/ohlc-bar-series.js.map +7 -0
- package/dist/features/viz/lib/paired-series.d.ts +44 -0
- package/dist/features/viz/lib/paired-series.js +93 -0
- package/dist/features/viz/lib/paired-series.js.map +7 -0
- package/dist/features/viz/lib/pie-layout.js +2 -1
- package/dist/features/viz/lib/pie-layout.js.map +2 -2
- package/dist/features/viz/lib/plot-series.js +11 -6
- package/dist/features/viz/lib/plot-series.js.map +2 -2
- package/dist/features/viz/lib/plot-types.d.ts +4 -3
- package/dist/features/viz/lib/point-series.d.ts +1 -1
- package/dist/features/viz/lib/point-series.js +36 -9
- package/dist/features/viz/lib/point-series.js.map +2 -2
- package/dist/features/viz/lib/point-types.d.ts +5 -2
- package/dist/features/viz/lib/reference-band.js +4 -1
- package/dist/features/viz/lib/reference-band.js.map +2 -2
- package/dist/features/viz/lib/scale-context.d.ts +1 -1
- package/dist/features/viz/lib/scale-ticks.js +21 -6
- package/dist/features/viz/lib/scale-ticks.js.map +2 -2
- package/dist/features/viz/lib/sequential-color-scale.d.ts +11 -0
- package/dist/features/viz/lib/sequential-color-scale.js +49 -0
- package/dist/features/viz/lib/sequential-color-scale.js.map +7 -0
- package/dist/features/viz/lib/series-position.d.ts +12 -0
- package/dist/features/viz/lib/series-position.js +44 -0
- package/dist/features/viz/lib/series-position.js.map +7 -0
- package/dist/features/viz/lib/step-curves.d.ts +19 -0
- package/dist/features/viz/lib/step-curves.js +53 -0
- package/dist/features/viz/lib/step-curves.js.map +7 -0
- package/dist/features/viz/lib/threshold-color-scale.d.ts +43 -0
- package/dist/features/viz/lib/threshold-color-scale.js +59 -0
- package/dist/features/viz/lib/threshold-color-scale.js.map +7 -0
- package/dist/features/viz/lib/trading-time-mapping.d.ts +32 -0
- package/dist/features/viz/lib/trading-time-mapping.js +89 -0
- package/dist/features/viz/lib/trading-time-mapping.js.map +7 -0
- package/dist/features/viz/lib/trading-time-scale.d.ts +83 -0
- package/dist/features/viz/lib/trading-time-scale.js +96 -0
- package/dist/features/viz/lib/trading-time-scale.js.map +7 -0
- package/dist/features/viz/lib/trajectory-series.d.ts +71 -0
- package/dist/features/viz/lib/trajectory-series.js +111 -0
- package/dist/features/viz/lib/trajectory-series.js.map +7 -0
- package/dist/features/viz/lib/types.d.ts +20 -4
- package/dist/features/viz/lib/use-continuous-scale.js +6 -1
- package/dist/features/viz/lib/use-continuous-scale.js.map +2 -2
- package/dist/features/viz/lib/utc-scale.js +11 -10
- package/dist/features/viz/lib/utc-scale.js.map +2 -2
- package/dist/features/viz/lib/volume-series.d.ts +59 -0
- package/dist/features/viz/lib/volume-series.js +117 -0
- package/dist/features/viz/lib/volume-series.js.map +7 -0
- package/dist/features/viz/lib/weighted-point-series.d.ts +71 -0
- package/dist/features/viz/lib/weighted-point-series.js +169 -0
- package/dist/features/viz/lib/weighted-point-series.js.map +7 -0
- package/dist/filters/backdrop-contrast-gpu.d.ts +5 -0
- package/dist/filters/backdrop-contrast-gpu.js +33 -0
- package/dist/filters/backdrop-contrast-gpu.js.map +7 -0
- package/dist/filters/backdrop-contrast.d.ts +21 -0
- package/dist/filters/backdrop-contrast.js +61 -0
- package/dist/filters/backdrop-contrast.js.map +7 -0
- package/dist/filters/displacement.js +1 -1
- package/dist/filters/displacement.js.map +2 -2
- package/dist/filters/emboss-gpu.d.ts +4 -0
- package/dist/filters/emboss-gpu.js +39 -0
- package/dist/filters/emboss-gpu.js.map +7 -0
- package/dist/filters/emboss.d.ts +32 -0
- package/dist/filters/emboss.js +104 -0
- package/dist/filters/emboss.js.map +7 -0
- package/dist/filters/filter-executor.d.ts +11 -4
- package/dist/filters/filter-executor.js +104 -49
- package/dist/filters/filter-executor.js.map +2 -2
- package/dist/filters/reflected-light.js +1 -1
- package/dist/filters/reflected-light.js.map +2 -2
- package/dist/filters/reflection-gpu.d.ts +3 -1
- package/dist/filters/reflection-gpu.js +5 -2
- package/dist/filters/reflection-gpu.js.map +2 -2
- package/dist/filters/render-backdrop-contrast-boundary.d.ts +31 -0
- package/dist/filters/render-backdrop-contrast-boundary.js +116 -0
- package/dist/filters/render-backdrop-contrast-boundary.js.map +7 -0
- package/dist/filters/render-emboss-boundary.d.ts +13 -0
- package/dist/filters/render-emboss-boundary.js +131 -0
- package/dist/filters/render-emboss-boundary.js.map +7 -0
- package/dist/filters.d.ts +9 -5
- package/dist/filters.js +4 -0
- package/dist/filters.js.map +2 -2
- package/dist/index.d.ts +9 -5
- package/dist/index.js +18 -2
- package/dist/index.js.map +2 -2
- package/dist/internal.d.ts +4 -0
- package/dist/internal.js +6 -0
- package/dist/internal.js.map +2 -2
- package/dist/layout-kernel.d.ts +12 -0
- package/dist/layout-kernel.js +11 -0
- package/dist/layout-kernel.js.map +7 -0
- package/dist/layout-kernel.mjs +1 -0
- package/dist/lib/backend/types.d.ts +13 -1
- package/dist/lib/backend/types.js.map +2 -2
- package/dist/lib/components/arc-geometry.js +2 -1
- package/dist/lib/components/arc-geometry.js.map +2 -2
- package/dist/lib/components/g.js +2 -0
- package/dist/lib/components/g.js.map +2 -2
- package/dist/lib/components/html-box.js +2 -1
- package/dist/lib/components/html-box.js.map +2 -2
- package/dist/lib/components/img.js +3 -3
- package/dist/lib/components/img.js.map +2 -2
- package/dist/lib/components/layer.js +98 -16
- package/dist/lib/components/layer.js.map +3 -3
- package/dist/lib/components/text.d.ts +16 -0
- package/dist/lib/components/text.js +131 -24
- package/dist/lib/components/text.js.map +2 -2
- package/dist/lib/define-primitive.d.ts +4 -2
- package/dist/lib/define-primitive.js +3 -1
- package/dist/lib/define-primitive.js.map +2 -2
- package/dist/lib/element/metadata.d.ts +9 -0
- package/dist/lib/element/metadata.js +19 -0
- package/dist/lib/element/metadata.js.map +2 -2
- package/dist/lib/element/resolve-primitive-inputs.d.ts +2 -0
- package/dist/lib/element/resolve-primitive-inputs.js +17 -4
- package/dist/lib/element/resolve-primitive-inputs.js.map +2 -2
- package/dist/lib/events/event-facade.d.ts +18 -0
- package/dist/lib/events/event-facade.js +28 -2
- package/dist/lib/events/event-facade.js.map +2 -2
- package/dist/lib/events/hit-test.js +2 -1
- package/dist/lib/events/hit-test.js.map +2 -2
- package/dist/lib/events/propagation.d.ts +2 -1
- package/dist/lib/events/propagation.js +22 -16
- package/dist/lib/events/propagation.js.map +2 -2
- package/dist/lib/events/registrations.d.ts +10 -0
- package/dist/lib/events/registrations.js +160 -5
- package/dist/lib/events/registrations.js.map +2 -2
- package/dist/lib/execute-render.js +25 -1
- package/dist/lib/execute-render.js.map +2 -2
- package/dist/lib/filter/filter-region.js +3 -10
- package/dist/lib/filter/filter-region.js.map +2 -2
- package/dist/lib/focus/focus-manager.d.ts +8 -1
- package/dist/lib/focus/focus-manager.js +87 -43
- package/dist/lib/focus/focus-manager.js.map +2 -2
- package/dist/lib/focus/geometry.d.ts +2 -0
- package/dist/lib/focus/geometry.js +6 -0
- package/dist/lib/focus/geometry.js.map +2 -2
- package/dist/lib/geometry/path-bend-guide.js +1 -1
- package/dist/lib/geometry/path-bend-guide.js.map +2 -2
- package/dist/lib/geometry/path-geometry.js +12 -11
- package/dist/lib/geometry/path-geometry.js.map +2 -2
- package/dist/lib/geometry/path-transforms.js +17 -21
- package/dist/lib/geometry/path-transforms.js.map +2 -2
- package/dist/lib/geometry/path-warp-bezier.js +3 -1
- package/dist/lib/geometry/path-warp-bezier.js.map +2 -2
- package/dist/lib/geometry/path-warp.js +1 -1
- package/dist/lib/geometry/path-warp.js.map +2 -2
- package/dist/lib/global-state.js +2 -0
- package/dist/lib/global-state.js.map +2 -2
- package/dist/lib/html/html-events.d.ts +32 -0
- package/dist/lib/html/html-events.js +179 -0
- package/dist/lib/html/html-events.js.map +7 -0
- package/dist/lib/html/html-service.d.ts +8 -2
- package/dist/lib/html/html-service.js +198 -65
- package/dist/lib/html/html-service.js.map +2 -2
- package/dist/lib/html/overlay-config.js +7 -6
- package/dist/lib/html/overlay-config.js.map +2 -2
- package/dist/lib/html/types.d.ts +29 -2
- package/dist/lib/layout/absolute.d.ts +11 -5
- package/dist/lib/layout/absolute.js +329 -55
- package/dist/lib/layout/absolute.js.map +3 -3
- package/dist/lib/layout/allocation-checkpoint-owner.d.ts +11 -0
- package/dist/lib/layout/allocation-checkpoint-owner.js +86 -0
- package/dist/lib/layout/allocation-checkpoint-owner.js.map +7 -0
- package/dist/lib/layout/allocation-checkpoint.d.ts +53 -0
- package/dist/lib/layout/allocation-checkpoint.js +463 -0
- package/dist/lib/layout/allocation-checkpoint.js.map +7 -0
- package/dist/lib/layout/allocation-dependencies.d.ts +30 -0
- package/dist/lib/layout/allocation-dependencies.js +90 -0
- package/dist/lib/layout/allocation-dependencies.js.map +7 -0
- package/dist/lib/layout/allocation-revision.d.ts +13 -0
- package/dist/lib/layout/allocation-revision.js +67 -0
- package/dist/lib/layout/allocation-revision.js.map +7 -0
- package/dist/lib/layout/box-insets.d.ts +17 -0
- package/dist/lib/layout/box-insets.js +138 -0
- package/dist/lib/layout/box-insets.js.map +7 -0
- package/dist/lib/layout/box-sizing.d.ts +16 -0
- package/dist/lib/layout/box-sizing.js +77 -0
- package/dist/lib/layout/box-sizing.js.map +7 -0
- package/dist/lib/layout/box.js +42 -12
- package/dist/lib/layout/box.js.map +2 -2
- package/dist/lib/layout/canvas-measurement.d.ts +13 -0
- package/dist/lib/layout/canvas-measurement.js +57 -0
- package/dist/lib/layout/canvas-measurement.js.map +7 -0
- package/dist/lib/layout/context.d.ts +35 -6
- package/dist/lib/layout/context.js +72 -3
- package/dist/lib/layout/context.js.map +2 -2
- package/dist/lib/layout/define-layout-component.d.ts +23 -0
- package/dist/lib/layout/define-layout-component.js +84 -0
- package/dist/lib/layout/define-layout-component.js.map +7 -0
- package/dist/lib/layout/flex-allocation-cache.d.ts +42 -0
- package/dist/lib/layout/flex-baseline-mode.d.ts +2 -0
- package/dist/lib/layout/flex-baseline-mode.js +7 -0
- package/dist/lib/layout/flex-baseline-mode.js.map +7 -0
- package/dist/lib/layout/flex.d.ts +50 -15
- package/dist/lib/layout/flex.js +2124 -195
- package/dist/lib/layout/flex.js.map +3 -3
- package/dist/lib/layout/flow.js +225 -49
- package/dist/lib/layout/flow.js.map +2 -2
- package/dist/lib/layout/geometry-publication.d.ts +53 -0
- package/dist/lib/layout/geometry-publication.js +244 -0
- package/dist/lib/layout/geometry-publication.js.map +7 -0
- package/dist/lib/layout/grid-kernel.d.ts +63 -0
- package/dist/lib/layout/grid-kernel.js +168 -0
- package/dist/lib/layout/grid-kernel.js.map +7 -0
- package/dist/lib/layout/grid.d.ts +63 -4
- package/dist/lib/layout/grid.js +767 -171
- package/dist/lib/layout/grid.js.map +3 -3
- package/dist/lib/layout/measure.d.ts +55 -3
- package/dist/lib/layout/measure.js +448 -15
- package/dist/lib/layout/measure.js.map +2 -2
- package/dist/lib/layout/overlay.js +81 -23
- package/dist/lib/layout/overlay.js.map +2 -2
- package/dist/lib/layout/participation.d.ts +27 -0
- package/dist/lib/layout/participation.js +188 -0
- package/dist/lib/layout/participation.js.map +7 -0
- package/dist/lib/layout/place-child.js +1 -1
- package/dist/lib/layout/place-child.js.map +2 -2
- package/dist/lib/layout/positioning-diagnostics.d.ts +1 -1
- package/dist/lib/layout/positioning-diagnostics.js +13 -2
- package/dist/lib/layout/positioning-diagnostics.js.map +2 -2
- package/dist/lib/layout/prepared-root.d.ts +121 -0
- package/dist/lib/layout/prepared-root.js +360 -0
- package/dist/lib/layout/prepared-root.js.map +7 -0
- package/dist/lib/layout/standalone-kernel.d.ts +60 -0
- package/dist/lib/layout/standalone-kernel.js +722 -0
- package/dist/lib/layout/standalone-kernel.js.map +7 -0
- package/dist/lib/layout/topology.d.ts +21 -0
- package/dist/lib/layout/topology.js +113 -0
- package/dist/lib/layout/topology.js.map +7 -0
- package/dist/lib/layout/types.d.ts +5 -0
- package/dist/lib/layout/wasm/artifact.d.ts +1 -0
- package/dist/lib/layout/wasm/artifact.js +5 -0
- package/dist/lib/layout/wasm/artifact.js.map +7 -0
- package/dist/lib/layout/wasm/bytes.d.ts +1 -0
- package/dist/lib/layout/wasm/bytes.js +5 -0
- package/dist/lib/layout/wasm/bytes.js.map +7 -0
- package/dist/lib/layout/wasm/embedded.d.ts +2 -0
- package/dist/lib/layout/wasm/embedded.js +12 -0
- package/dist/lib/layout/wasm/embedded.js.map +7 -0
- package/dist/lib/layout/wasm/layout.wasm +0 -0
- package/dist/lib/layout/wasm/module.d.ts +8 -0
- package/dist/lib/layout/wasm/module.js +70 -0
- package/dist/lib/layout/wasm/module.js.map +7 -0
- package/dist/lib/layout/wasm/region.d.ts +267 -0
- package/dist/lib/layout/wasm/region.js +1018 -0
- package/dist/lib/layout/wasm/region.js.map +7 -0
- package/dist/lib/manipulation/controller.js +4 -7
- package/dist/lib/manipulation/controller.js.map +2 -2
- package/dist/lib/manipulation/frame.js +1 -1
- package/dist/lib/manipulation/frame.js.map +2 -2
- package/dist/lib/manipulation/handles.js +32 -33
- package/dist/lib/manipulation/handles.js.map +2 -2
- package/dist/lib/manipulation/solve.js +12 -10
- package/dist/lib/manipulation/solve.js.map +2 -2
- package/dist/lib/mount-pibbl.js +1 -0
- package/dist/lib/mount-pibbl.js.map +2 -2
- package/dist/lib/mount-prepared-pibbl.d.ts +5 -0
- package/dist/lib/mount-prepared-pibbl.js +29 -0
- package/dist/lib/mount-prepared-pibbl.js.map +7 -0
- package/dist/lib/mount-request.d.ts +8 -0
- package/dist/lib/mount-request.js +41 -0
- package/dist/lib/mount-request.js.map +7 -0
- package/dist/lib/pibbl.d.ts +21 -13
- package/dist/lib/pibbl.js +18 -16
- package/dist/lib/pibbl.js.map +2 -2
- package/dist/lib/recording/recording.d.ts +43 -0
- package/dist/lib/recording/recording.js +555 -0
- package/dist/lib/recording/recording.js.map +7 -0
- package/dist/lib/recording/types.d.ts +118 -0
- package/dist/lib/recording/wasm-bytes.d.ts +1 -0
- package/dist/lib/recording/wasm-bytes.js +5 -0
- package/dist/lib/recording/wasm-bytes.js.map +7 -0
- package/dist/lib/recording/worker-source.d.ts +1 -0
- package/dist/lib/recording/worker-source.js +5 -0
- package/dist/lib/recording/worker-source.js.map +7 -0
- package/dist/lib/render-layer/controller.d.ts +9 -3
- package/dist/lib/render-layer/controller.js +259 -110
- package/dist/lib/render-layer/controller.js.map +2 -2
- package/dist/lib/render-transaction.d.ts +12 -2
- package/dist/lib/render-transaction.js +69 -1
- package/dist/lib/render-transaction.js.map +2 -2
- package/dist/lib/render.js +32 -8
- package/dist/lib/render.js.map +2 -2
- package/dist/lib/scheduler/realm-scheduler.d.ts +2 -0
- package/dist/lib/scheduler/realm-scheduler.js +55 -26
- package/dist/lib/scheduler/realm-scheduler.js.map +2 -2
- package/dist/lib/scheduler/renderer-participant.js +1 -0
- package/dist/lib/scheduler/renderer-participant.js.map +2 -2
- package/dist/lib/series-inspection-frame.d.ts +18 -0
- package/dist/lib/series-inspection-frame.js +70 -0
- package/dist/lib/series-inspection-frame.js.map +7 -0
- package/dist/lib/signals/edge.d.ts +7 -4
- package/dist/lib/signals/edge.js +25 -3
- package/dist/lib/signals/edge.js.map +2 -2
- package/dist/lib/signals/graph.d.ts +16 -2
- package/dist/lib/signals/graph.js +54 -12
- package/dist/lib/signals/graph.js.map +2 -2
- package/dist/lib/signals/input-provision.d.ts +15 -0
- package/dist/lib/signals/input-provision.js +53 -3
- package/dist/lib/signals/input-provision.js.map +2 -2
- package/dist/lib/signals/render-consumer.d.ts +3 -0
- package/dist/lib/signals/render-consumer.js +22 -14
- package/dist/lib/signals/render-consumer.js.map +2 -2
- package/dist/lib/style/positioning.d.ts +50 -2
- package/dist/lib/style/positioning.js +28 -4
- package/dist/lib/style/positioning.js.map +2 -2
- package/dist/lib/style/resolve-built-in.d.ts +4 -3
- package/dist/lib/style/resolve-built-in.js +17 -3
- package/dist/lib/style/resolve-built-in.js.map +2 -2
- package/dist/lib/style/resolve-dispatch.d.ts +3 -0
- package/dist/lib/style/resolve-dispatch.js +77 -4
- package/dist/lib/style/resolve-dispatch.js.map +2 -2
- package/dist/lib/style/resolve-length.d.ts +2 -0
- package/dist/lib/style/resolve-length.js +13 -9
- package/dist/lib/style/resolve-length.js.map +2 -2
- package/dist/lib/style/sizing-length.d.ts +51 -0
- package/dist/lib/style/sizing-length.js +77 -0
- package/dist/lib/style/sizing-length.js.map +7 -0
- package/dist/lib/style/types.d.ts +63 -25
- package/dist/lib/surface/root-surface.js +10 -6
- package/dist/lib/surface/root-surface.js.map +2 -2
- package/dist/lib/textures/texture.js +10 -8
- package/dist/lib/textures/texture.js.map +2 -2
- package/dist/lib/transitions/capture.js +4 -1
- package/dist/lib/transitions/capture.js.map +2 -2
- package/dist/lib/transitions/embers-physics.js +17 -10
- package/dist/lib/transitions/embers-physics.js.map +2 -2
- package/dist/lib/types.d.ts +110 -1
- package/dist/sync.d.ts +16 -0
- package/dist/sync.js +13 -0
- package/dist/sync.js.map +7 -0
- package/dist/sync.mjs +1 -0
- package/package.json +26 -3
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/features/viz/lib/pie-layout.tsx"],
|
|
4
|
-
"sourcesContent": ["import {\n Group,\n Path,\n Wedge,\n definePrimitive,\n Line,\n Rectangle,\n resolveSignalValue,\n useComputed,\n useCanvasContext,\n useLayoutBox,\n} from \"@pibbl/core\";\nimport { resolveTexturePaint, withHooksForbidden } from \"@pibbl/core/internal\";\nimport type {\n PieLayoutProps,\n PieLayoutSlice,\n PieSliceProps,\n PieLabelProps,\n PieLabelLayout,\n} from \"./pie-types.js\";\nimport { pieSlices } from \"./pie-slices.js\";\nimport { layoutPie } from \"./layout-pie.js\";\nfunction finite(value: number, name: string, nonnegative = false) {\n if (!Number.isFinite(value) || (nonnegative && value < 0))\n throw new RangeError(\n `PieLayout: ${name} must be finite${nonnegative ? \" and nonnegative\" : \"\"}.`,\n );\n return value;\n}\n/**\n * Computes pie geometry and label placement, then renders children for each resolved slice.\n *\n * @param props - Data, pie geometry, label policy, and child renderer. See {@link PieLayoutProps}.\n * @returns Pibbl content arranged as pie slices.\n *\n * @see {@link PieLayoutProps}\n */\nexport function PieLayout<D>(props: PieLayoutProps<D>) {\n const allocation = useLayoutBox();\n const context = useCanvasContext();\n const style = resolveSignalValue(props.style) ?? {};\n const bounds = resolveSignalValue(props.bounds) ?? {\n x: 0,\n y: 0,\n width: allocation.width,\n height: allocation.height,\n };\n const bx = finite(bounds.x, \"bounds.x\"),\n by = finite(bounds.y, \"bounds.y\");\n const bw = finite(bounds.width, \"bounds.width\", true),\n bh = finite(bounds.height, \"bounds.height\", true);\n finite(bx + bw, \"bounds right\");\n finite(by + bh, \"bounds bottom\");\n const cx = finite(resolveSignalValue(style.cx) ?? bx + bw / 2, \"cx\");\n const cy = finite(resolveSignalValue(style.cy) ?? by + bh / 2, \"cy\");\n const radius = finite(\n resolveSignalValue(style.radius) ?? Math.min(bw * 0.28, bh * 0.4),\n \"radius\",\n true,\n );\n const innerRadius = finite(\n resolveSignalValue(style.innerRadius) ?? 0,\n \"innerRadius\",\n true,\n );\n if (radius === 0 ? innerRadius !== 0 : innerRadius >= radius)\n throw new RangeError(\n \"PieLayout: innerRadius must be zero when radius is zero, or less than radius.\",\n );\n const gap = finite(resolveSignalValue(style.labelGap) ?? 8, \"labelGap\", true);\n finite(cx + radius + gap, \"right label edge\");\n finite(cx - radius - gap, \"left label edge\");\n finite(cy + radius, \"bottom\");\n finite(cy - radius, \"top\");\n const font = resolveSignalValue(style.labelFont) ?? \"14px sans-serif\";\n if (typeof font !== \"string\" || !font.trim())\n throw new TypeError(\"PieLayout: labelFont must be a Canvas font string.\");\n const placement = resolveSignalValue(props.placement) ?? \"outside\";\n if (![\"inside\", \"outside\", \"auto\"].includes(placement))\n throw new TypeError(\n \"PieLayout: placement must be inside, outside, or auto.\",\n );\n if (typeof props.children !== \"function\")\n throw new TypeError(\n \"PieLayout: children must be a function returning Pibbl elements.\",\n );\n const revision =\n props.revision === undefined ? undefined : resolveSignalValue(props.revision);\n if (\n revision !== undefined &&\n (!Number.isSafeInteger(revision) || revision < 0)\n )\n throw new RangeError(\n \"PieLayout: revision must be a finite nonnegative safe integer.\",\n );\n // An omitted revision deliberately replaces this token on every evaluation.\n // Stable callback identities alone are not evidence of stable results.\n const cacheKey = revision === undefined ? {} : revision;\n const slices = useComputed(\n () =>\n pieSlices(resolveSignalValue(props.data), {\n value: props.value,\n keyBy: props.keyBy,\n }),\n [cacheKey, props.data, props.value, props.keyBy],\n );\n const layout = useComputed(() => {\n context.save();\n try {\n // Canvas silently ignores malformed fonts. Two distinct sentinels detect\n // that without depending on the caller's inherited font or CSS spelling.\n context.font = \"10px serif\";\n context.font = font;\n const normalized = context.font;\n context.font = \"11px monospace\";\n context.font = font;\n if (context.font !== normalized)\n throw new TypeError(\"PieLayout: labelFont must be a valid Canvas font.\");\n context.textAlign = \"left\";\n context.textBaseline = \"alphabetic\";\n return layoutPie(\n slices.get(),\n cx,\n cy,\n radius,\n innerRadius,\n { x: bx, y: by, width: bw, height: bh },\n context.font,\n gap,\n placement,\n props.label,\n (text) => {\n const m = context.measureText(text);\n const width = Math.max(\n m.width,\n m.actualBoundingBoxLeft + m.actualBoundingBoxRight,\n );\n const ascent = Math.max(0, m.actualBoundingBoxAscent),\n descent = Math.max(0, m.actualBoundingBoxDescent);\n return {\n width: finite(width, \"label width\", true),\n height: finite(Math.max(1, ascent + descent), \"label height\", true),\n left: Math.max(0, m.actualBoundingBoxLeft),\n ascent,\n };\n },\n );\n } finally {\n context.restore();\n }\n }, [\n slices,\n cx,\n cy,\n radius,\n innerRadius,\n bx,\n by,\n bw,\n bh,\n font,\n gap,\n placement,\n props.label,\n context,\n ]);\n return layout\n .get()\n .map((slice) => (\n <Group key={slice.key}>\n {withHooksForbidden(\n \"PieLayout children cannot call hooks; return a component instead.\",\n () => props.children(slice),\n )}\n </Group>\n ));\n}\n/**\n * Draws a resolved pie slice using wedge geometry and the supplied paint style.\n *\n * @param props - Slice geometry, appearance, handlers, and children. See {@link PieSliceProps}.\n * @returns Pibbl nodes drawing one pie slice and its children.\n *\n * @see {@link PieSliceProps}\n */\nexport function PieSlice<D>({\n slice,\n style: input,\n children,\n ...events\n}: PieSliceProps<D>) {\n const style = resolveSignalValue(input) ?? {};\n if (slice.innerRadius === 0) {\n return (\n <Group>\n <Wedge\n {...events}\n style={{\n ...style,\n cx: slice.cx,\n cy: slice.cy,\n radius: slice.radius,\n startAngle: slice.startAngle,\n endAngle: slice.endAngle,\n }}\n />\n {children}\n </Group>\n );\n }\n const sweep = resolveClockwiseSweep(slice.startAngle, slice.endAngle);\n const path = new Path2D();\n path.arc(\n slice.cx,\n slice.cy,\n slice.radius,\n sweep.startAngle,\n sweep.endAngle,\n );\n if (slice.innerRadius > 0)\n path.arc(\n slice.cx,\n slice.cy,\n slice.innerRadius,\n sweep.endAngle,\n sweep.startAngle,\n true,\n );\n else path.lineTo(slice.cx, slice.cy);\n path.closePath();\n return (\n <Group>\n <Path\n {...events}\n keyboardNavigationBounds={\n events.keyboardNavigationBounds ??\n annularSliceBounds(slice, sweep)\n }\n style={{\n ...style,\n d: path,\n }}\n />\n {children}\n </Group>\n );\n}\n\n/** The outer and inner arcs both contribute to an annular path's focus box. */\nfunction annularSliceBounds(\n slice: PieLayoutSlice<unknown>,\n sweep: Readonly<ClockwiseSweep>,\n) {\n if (sweep.sweep === 0) return undefined;\n if (sweep.fullCircle)\n return {\n x: slice.cx - slice.radius,\n y: slice.cy - slice.radius,\n width: slice.radius * 2,\n height: slice.radius * 2,\n };\n const angles = [sweep.startAngle, sweep.endAngle];\n for (const cardinal of [0, Math.PI / 2, Math.PI, Math.PI * 1.5]) {\n const angle = cardinal < sweep.startAngle ? cardinal + fullTurn : cardinal;\n if (angle <= sweep.endAngle) angles.push(angle);\n }\n const xs: number[] = [];\n const ys: number[] = [];\n for (const angle of angles) {\n const cosine = Math.cos(angle);\n const sine = Math.sin(angle);\n xs.push(\n slice.cx + slice.radius * cosine,\n slice.cx + slice.innerRadius * cosine,\n );\n ys.push(\n slice.cy + slice.radius * sine,\n slice.cy + slice.innerRadius * sine,\n );\n }\n const left = Math.min(...xs);\n const right = Math.max(...xs);\n const top = Math.min(...ys);\n const bottom = Math.max(...ys);\n return { x: left, y: top, width: right - left, height: bottom - top };\n}\n\nconst fullTurn = Math.PI * 2;\n\ninterface ClockwiseSweep {\n readonly startAngle: number;\n readonly endAngle: number;\n readonly sweep: number;\n readonly fullCircle: boolean;\n}\n\n/** Matches Canvas's bounded clockwise arc rule without retaining unbounded turns. */\nfunction resolveClockwiseSweep(\n startAngle: number,\n endAngle: number,\n): ClockwiseSweep {\n if (!Number.isFinite(startAngle) || !Number.isFinite(endAngle))\n throw new RangeError(\"PieSlice: slice angles must be finite.\");\n const start = positiveModulo(startAngle, fullTurn);\n if (endAngle - startAngle >= fullTurn)\n return {\n startAngle: start,\n endAngle: start + fullTurn,\n sweep: fullTurn,\n fullCircle: true,\n };\n const sweep = positiveModulo(\n positiveModulo(endAngle, fullTurn) - start,\n fullTurn,\n );\n return {\n startAngle: start,\n endAngle: start + sweep,\n sweep,\n fullCircle: false,\n };\n}\n\nfunction positiveModulo(value: number, divisor: number) {\n const result = value % divisor;\n if (result === 0) return 0;\n return result < 0 ? result + divisor : result;\n}\n\nconst LabelText = definePrimitive<\n { label: Extract<PieLabelLayout, { status: \"placed\" }> },\n { readonly custom?: never; fill: import(\"@pibbl/core\").FillStyle }\n>(({ label }, style, context) => {\n context.font = label.font;\n context.textAlign = \"left\";\n context.textBaseline = \"alphabetic\";\n context.fillStyle = resolveTexturePaint(style.fill, context, { x: label.x, y: label.y, width: label.width, height: label.height });\n context.fillText(label.text, label.textX, label.textY);\n});\n\n/**\n * Draws a resolved slice label and optional leader line; decorative labels ignore pointer\n * targeting\n * by default.\n *\n * @param props - Slice geometry, label appearance, and interaction options. See\n * {@link PieLabelProps} .\n * @returns Pibbl content drawing the slice label, or null when the label was not placed.\n *\n * @see {@link PieLabelProps}\n */\nexport function PieLabel<D>({\n slice,\n style: input,\n pointerEvents = \"none\",\n ...events\n}: PieLabelProps<D>) {\n const style = resolveSignalValue(input) ?? {};\n const label = slice.label;\n if (!label || label.status !== \"placed\") return null;\n return (\n <Group {...events}>\n {label.leader && (\n <Line\n pointerEvents=\"none\"\n style={{\n coords: label.leader.map((p) => [p[0], p[1]]),\n stroke: resolveSignalValue(style.leaderStroke) ?? \"#94a3b8\",\n strokeWidth: resolveSignalValue(style.leaderWidth) ?? 1,\n }}\n />\n )}\n <Rectangle\n pointerEvents={pointerEvents}\n style={{\n left: label.x,\n top: label.y,\n width: label.width,\n height: label.height,\n fill: \"transparent\",\n }}\n />\n <LabelText\n label={label}\n style={{ fill: resolveSignalValue(style.fill) ?? \"#182c42\" }}\n />\n </Group>\n );\n}\n"],
|
|
5
|
-
"mappings": "AAyKM,cAyBA,YAzBA;AAzKN;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,qBAAqB,0BAA0B;AAQxD,SAAS,iBAAiB;AAC1B,SAAS,iBAAiB;AAC1B,SAAS,OAAO,OAAe,MAAc,cAAc,OAAO;AAChE,MAAI,CAAC,OAAO,SAAS,KAAK,KAAM,eAAe,QAAQ;AACrD,UAAM,IAAI;AAAA,MACR,cAAc,IAAI,kBAAkB,cAAc,qBAAqB,EAAE;AAAA,IAC3E;AACF,SAAO;AACT;AASO,SAAS,UAAa,OAA0B;AACrD,QAAM,aAAa,aAAa;AAChC,QAAM,UAAU,iBAAiB;AACjC,QAAM,QAAQ,mBAAmB,MAAM,KAAK,KAAK,CAAC;AAClD,QAAM,SAAS,mBAAmB,MAAM,MAAM,KAAK;AAAA,IACjD,GAAG;AAAA,IACH,GAAG;AAAA,IACH,OA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A,MACN,MAAM;AAAA,MACN,MAAM;AAAA,MACN,MAAM;AAAA,MACN,MAAM;AAAA,MACN;AAAA,IACF;AAAA,MACG,MAAK,OAAO,MAAM,IAAI,MAAM,EAAE;AACnC,OAAK,UAAU;AACf,SACE,qBAAC,SACC;AAAA;AAAA,MAAC;AAAA;AAAA,QACE,GAAG;AAAA,QACJ,0BACE,OAAO,4BACP,mBAAmB,OAAO,KAAK;AAAA,QAEjC,OAAO;AAAA,UACL,GAAG;AAAA,UACH,GAAG;AAAA,QACL;AAAA;AAAA,IACF;AAAA,IACC;AAAA,KACH;AAEJ;AAGA,SAAS,mBACP,OACA,OACA;AACA,MAAI,MAAM,UAAU,EAAG,QAAO;AAC9B,MAAI,MAAM;AACR,WAAO;AAAA,MACL,GAAG,MAAM,KAAK,MAAM;AAAA,MACpB,GAAG,MAAM,KAAK,MAAM;AAAA,MACpB,OAAO,MAAM,SAAS;AAAA,MACtB,QAAQ,MAAM,SAAS;AAAA,IACzB;AACF,QAAM,SAAS,CAAC,MAAM,YAAY,MAAM,QAAQ;AAChD,
|
|
4
|
+
"sourcesContent": ["import {\n Group,\n Path,\n Wedge,\n definePrimitive,\n Line,\n Rectangle,\n resolveSignalValue,\n useComputed,\n useCanvasContext,\n useLayoutBox,\n} from \"@pibbl/core\";\nimport { resolveTexturePaint, withHooksForbidden } from \"@pibbl/core/internal\";\nimport type {\n PieLayoutProps,\n PieLayoutSlice,\n PieSliceProps,\n PieLabelProps,\n PieLabelLayout,\n} from \"./pie-types.js\";\nimport { pieSlices } from \"./pie-slices.js\";\nimport { layoutPie } from \"./layout-pie.js\";\nfunction finite(value: number, name: string, nonnegative = false) {\n if (!Number.isFinite(value) || (nonnegative && value < 0))\n throw new RangeError(\n `PieLayout: ${name} must be finite${nonnegative ? \" and nonnegative\" : \"\"}.`,\n );\n return value;\n}\n/**\n * Computes pie geometry and label placement, then renders children for each resolved slice.\n *\n * @param props - Data, pie geometry, label policy, and child renderer. See {@link PieLayoutProps}.\n * @returns Pibbl content arranged as pie slices.\n *\n * @see {@link PieLayoutProps}\n */\nexport function PieLayout<D>(props: PieLayoutProps<D>) {\n const allocation = useLayoutBox();\n const context = useCanvasContext();\n const style = resolveSignalValue(props.style) ?? {};\n const bounds = resolveSignalValue(props.bounds) ?? {\n x: 0,\n y: 0,\n width: allocation.width,\n height: allocation.height,\n };\n const bx = finite(bounds.x, \"bounds.x\"),\n by = finite(bounds.y, \"bounds.y\");\n const bw = finite(bounds.width, \"bounds.width\", true),\n bh = finite(bounds.height, \"bounds.height\", true);\n finite(bx + bw, \"bounds right\");\n finite(by + bh, \"bounds bottom\");\n const cx = finite(resolveSignalValue(style.cx) ?? bx + bw / 2, \"cx\");\n const cy = finite(resolveSignalValue(style.cy) ?? by + bh / 2, \"cy\");\n const radius = finite(\n resolveSignalValue(style.radius) ?? Math.min(bw * 0.28, bh * 0.4),\n \"radius\",\n true,\n );\n const innerRadius = finite(\n resolveSignalValue(style.innerRadius) ?? 0,\n \"innerRadius\",\n true,\n );\n if (radius === 0 ? innerRadius !== 0 : innerRadius >= radius)\n throw new RangeError(\n \"PieLayout: innerRadius must be zero when radius is zero, or less than radius.\",\n );\n const gap = finite(resolveSignalValue(style.labelGap) ?? 8, \"labelGap\", true);\n finite(cx + radius + gap, \"right label edge\");\n finite(cx - radius - gap, \"left label edge\");\n finite(cy + radius, \"bottom\");\n finite(cy - radius, \"top\");\n const font = resolveSignalValue(style.labelFont) ?? \"14px sans-serif\";\n if (typeof font !== \"string\" || !font.trim())\n throw new TypeError(\"PieLayout: labelFont must be a Canvas font string.\");\n const placement = resolveSignalValue(props.placement) ?? \"outside\";\n if (![\"inside\", \"outside\", \"auto\"].includes(placement))\n throw new TypeError(\n \"PieLayout: placement must be inside, outside, or auto.\",\n );\n if (typeof props.children !== \"function\")\n throw new TypeError(\n \"PieLayout: children must be a function returning Pibbl elements.\",\n );\n const revision =\n props.revision === undefined ? undefined : resolveSignalValue(props.revision);\n if (\n revision !== undefined &&\n (!Number.isSafeInteger(revision) || revision < 0)\n )\n throw new RangeError(\n \"PieLayout: revision must be a finite nonnegative safe integer.\",\n );\n // An omitted revision deliberately replaces this token on every evaluation.\n // Stable callback identities alone are not evidence of stable results.\n const cacheKey = revision === undefined ? {} : revision;\n const slices = useComputed(\n () =>\n pieSlices(resolveSignalValue(props.data), {\n value: props.value,\n keyBy: props.keyBy,\n }),\n [cacheKey, props.data, props.value, props.keyBy],\n );\n const layout = useComputed(() => {\n context.save();\n try {\n // Canvas silently ignores malformed fonts. Two distinct sentinels detect\n // that without depending on the caller's inherited font or CSS spelling.\n context.font = \"10px serif\";\n context.font = font;\n const normalized = context.font;\n context.font = \"11px monospace\";\n context.font = font;\n if (context.font !== normalized)\n throw new TypeError(\"PieLayout: labelFont must be a valid Canvas font.\");\n context.textAlign = \"left\";\n context.textBaseline = \"alphabetic\";\n return layoutPie(\n slices.get(),\n cx,\n cy,\n radius,\n innerRadius,\n { x: bx, y: by, width: bw, height: bh },\n context.font,\n gap,\n placement,\n props.label,\n (text) => {\n const m = context.measureText(text);\n const width = Math.max(\n m.width,\n m.actualBoundingBoxLeft + m.actualBoundingBoxRight,\n );\n const ascent = Math.max(0, m.actualBoundingBoxAscent),\n descent = Math.max(0, m.actualBoundingBoxDescent);\n return {\n width: finite(width, \"label width\", true),\n height: finite(Math.max(1, ascent + descent), \"label height\", true),\n left: Math.max(0, m.actualBoundingBoxLeft),\n ascent,\n };\n },\n );\n } finally {\n context.restore();\n }\n }, [\n slices,\n cx,\n cy,\n radius,\n innerRadius,\n bx,\n by,\n bw,\n bh,\n font,\n gap,\n placement,\n props.label,\n context,\n ]);\n return layout\n .get()\n .map((slice) => (\n <Group key={slice.key}>\n {withHooksForbidden(\n \"PieLayout children cannot call hooks; return a component instead.\",\n () => props.children(slice),\n )}\n </Group>\n ));\n}\n/**\n * Draws a resolved pie slice using wedge geometry and the supplied paint style.\n *\n * @param props - Slice geometry, appearance, handlers, and children. See {@link PieSliceProps}.\n * @returns Pibbl nodes drawing one pie slice and its children.\n *\n * @see {@link PieSliceProps}\n */\nexport function PieSlice<D>({\n slice,\n style: input,\n children,\n ...events\n}: PieSliceProps<D>) {\n const style = resolveSignalValue(input) ?? {};\n if (slice.innerRadius === 0) {\n return (\n <Group>\n <Wedge\n {...events}\n style={{\n ...style,\n cx: slice.cx,\n cy: slice.cy,\n radius: slice.radius,\n startAngle: slice.startAngle,\n endAngle: slice.endAngle,\n }}\n />\n {children}\n </Group>\n );\n }\n const sweep = resolveClockwiseSweep(slice.startAngle, slice.endAngle);\n const path = new Path2D();\n path.arc(\n slice.cx,\n slice.cy,\n slice.radius,\n sweep.startAngle,\n sweep.endAngle,\n );\n if (slice.innerRadius > 0)\n path.arc(\n slice.cx,\n slice.cy,\n slice.innerRadius,\n sweep.endAngle,\n sweep.startAngle,\n true,\n );\n else path.lineTo(slice.cx, slice.cy);\n path.closePath();\n return (\n <Group>\n <Path\n {...events}\n keyboardNavigationBounds={\n events.keyboardNavigationBounds ??\n annularSliceBounds(slice, sweep)\n }\n style={{\n ...style,\n d: path,\n }}\n />\n {children}\n </Group>\n );\n}\n\n/** The outer and inner arcs both contribute to an annular path's focus box. */\nfunction annularSliceBounds(\n slice: PieLayoutSlice<unknown>,\n sweep: Readonly<ClockwiseSweep>,\n) {\n if (sweep.sweep === 0) return undefined;\n if (sweep.fullCircle)\n return {\n x: slice.cx - slice.radius,\n y: slice.cy - slice.radius,\n width: slice.radius * 2,\n height: slice.radius * 2,\n };\n const angles = [sweep.startAngle, sweep.endAngle];\n for (let cardinalIndex = 0; cardinalIndex < 4; cardinalIndex++) {\n const cardinal = cardinalIndex * (Math.PI / 2);\n const angle = cardinal < sweep.startAngle ? cardinal + fullTurn : cardinal;\n if (angle <= sweep.endAngle) angles.push(angle);\n }\n const xs: number[] = [];\n const ys: number[] = [];\n for (const angle of angles) {\n const cosine = Math.cos(angle);\n const sine = Math.sin(angle);\n xs.push(\n slice.cx + slice.radius * cosine,\n slice.cx + slice.innerRadius * cosine,\n );\n ys.push(\n slice.cy + slice.radius * sine,\n slice.cy + slice.innerRadius * sine,\n );\n }\n const left = Math.min(...xs);\n const right = Math.max(...xs);\n const top = Math.min(...ys);\n const bottom = Math.max(...ys);\n return { x: left, y: top, width: right - left, height: bottom - top };\n}\n\nconst fullTurn = Math.PI * 2;\n\ninterface ClockwiseSweep {\n readonly startAngle: number;\n readonly endAngle: number;\n readonly sweep: number;\n readonly fullCircle: boolean;\n}\n\n/** Matches Canvas's bounded clockwise arc rule without retaining unbounded turns. */\nfunction resolveClockwiseSweep(\n startAngle: number,\n endAngle: number,\n): ClockwiseSweep {\n if (!Number.isFinite(startAngle) || !Number.isFinite(endAngle))\n throw new RangeError(\"PieSlice: slice angles must be finite.\");\n const start = positiveModulo(startAngle, fullTurn);\n if (endAngle - startAngle >= fullTurn)\n return {\n startAngle: start,\n endAngle: start + fullTurn,\n sweep: fullTurn,\n fullCircle: true,\n };\n const sweep = positiveModulo(\n positiveModulo(endAngle, fullTurn) - start,\n fullTurn,\n );\n return {\n startAngle: start,\n endAngle: start + sweep,\n sweep,\n fullCircle: false,\n };\n}\n\nfunction positiveModulo(value: number, divisor: number) {\n const result = value % divisor;\n if (result === 0) return 0;\n return result < 0 ? result + divisor : result;\n}\n\nconst LabelText = definePrimitive<\n { label: Extract<PieLabelLayout, { status: \"placed\" }> },\n { readonly custom?: never; fill: import(\"@pibbl/core\").FillStyle }\n>(({ label }, style, context) => {\n context.font = label.font;\n context.textAlign = \"left\";\n context.textBaseline = \"alphabetic\";\n context.fillStyle = resolveTexturePaint(style.fill, context, { x: label.x, y: label.y, width: label.width, height: label.height });\n context.fillText(label.text, label.textX, label.textY);\n});\n\n/**\n * Draws a resolved slice label and optional leader line; decorative labels ignore pointer\n * targeting\n * by default.\n *\n * @param props - Slice geometry, label appearance, and interaction options. See\n * {@link PieLabelProps} .\n * @returns Pibbl content drawing the slice label, or null when the label was not placed.\n *\n * @see {@link PieLabelProps}\n */\nexport function PieLabel<D>({\n slice,\n style: input,\n pointerEvents = \"none\",\n ...events\n}: PieLabelProps<D>) {\n const style = resolveSignalValue(input) ?? {};\n const label = slice.label;\n if (!label || label.status !== \"placed\") return null;\n return (\n <Group {...events}>\n {label.leader && (\n <Line\n pointerEvents=\"none\"\n style={{\n coords: label.leader.map((p) => [p[0], p[1]]),\n stroke: resolveSignalValue(style.leaderStroke) ?? \"#94a3b8\",\n strokeWidth: resolveSignalValue(style.leaderWidth) ?? 1,\n }}\n />\n )}\n <Rectangle\n pointerEvents={pointerEvents}\n style={{\n left: label.x,\n top: label.y,\n width: label.width,\n height: label.height,\n fill: \"transparent\",\n }}\n />\n <LabelText\n label={label}\n style={{ fill: resolveSignalValue(style.fill) ?? \"#182c42\" }}\n />\n </Group>\n );\n}\n"],
|
|
5
|
+
"mappings": "AAyKM,cAyBA,YAzBA;AAzKN;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,qBAAqB,0BAA0B;AAQxD,SAAS,iBAAiB;AAC1B,SAAS,iBAAiB;AAC1B,SAAS,OAAO,OAAe,MAAc,cAAc,OAAO;AAChE,MAAI,CAAC,OAAO,SAAS,KAAK,KAAM,eAAe,QAAQ;AACrD,UAAM,IAAI;AAAA,MACR,cAAc,IAAI,kBAAkB,cAAc,qBAAqB,EAAE;AAAA,IAC3E;AACF,SAAO;AACT;AASO,SAAS,UAAa,OAA0B;AACrD,QAAM,aAAa,aAAa;AAChC,QAAM,UAAU,iBAAiB;AACjC,QAAM,QAAQ,mBAAmB,MAAM,KAAK,KAAK,CAAC;AAClD,QAAM,SAAS,mBAAmB,MAAM,MAAM,KAAK;AAAA,IACjD,GAAG;AAAA,IACH,GAAG;AAAA,IACH,OAAO,WAAW;AAAA,IAClB,QAAQ,WAAW;AAAA,EACrB;AACA,QAAM,KAAK,OAAO,OAAO,GAAG,UAAU,GACpC,KAAK,OA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;AAC5C,QAAM,QAAQ,MAAM;AACpB,MAAI,CAAC,SAAS,MAAM,WAAW,SAAU,QAAO;AAChD,SACE,qBAAC,SAAO,GAAG,QACR;AAAA,UAAM,UACL;AAAA,MAAC;AAAA;AAAA,QACC,eAAc;AAAA,QACd,OAAO;AAAA,UACL,QAAQ,MAAM,OAAO,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;AAAA,UAC5C,QAAQ,mBAAmB,MAAM,YAAY,KAAK;AAAA,UAClD,aAAa,mBAAmB,MAAM,WAAW,KAAK;AAAA,QACxD;AAAA;AAAA,IACF;AAAA,IAEF;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA,OAAO;AAAA,UACL,MAAM,MAAM;AAAA,UACZ,KAAK,MAAM;AAAA,UACX,OAAO,MAAM;AAAA,UACb,QAAQ,MAAM;AAAA,UACd,MAAM;AAAA,QACR;AAAA;AAAA,IACF;AAAA,IACA;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA,OAAO,EAAE,MAAM,mBAAmB,MAAM,IAAI,KAAK,UAAU;AAAA;AAAA,IAC7D;AAAA,KACF;AAEJ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { jsx } from "@pibbl/core/jsx-runtime";
|
|
2
2
|
import { Group, resolveSignalValue } from "@pibbl/core";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { pointData } from "./point-data.js";
|
|
4
|
+
import {
|
|
5
|
+
useSeriesPosition,
|
|
6
|
+
seriesAccessor,
|
|
7
|
+
mapSeriesPosition
|
|
8
|
+
} from "./series-position.js";
|
|
5
9
|
function PlotRow({
|
|
6
10
|
datum,
|
|
7
11
|
index,
|
|
@@ -21,19 +25,20 @@ function PlotSeries({
|
|
|
21
25
|
render,
|
|
22
26
|
...events
|
|
23
27
|
}) {
|
|
24
|
-
const xs =
|
|
28
|
+
const xs = useSeriesPosition(xId), ys = useSeriesPosition(yId);
|
|
25
29
|
const data = pointData(resolveSignalValue(input), "PlotSeries");
|
|
26
30
|
if (typeof render !== "function")
|
|
27
31
|
throw new TypeError("PlotSeries: render must be a synchronous function.");
|
|
28
|
-
const x =
|
|
32
|
+
const x = seriesAccessor(xInput), y = seriesAccessor(yInput);
|
|
29
33
|
const keys = /* @__PURE__ */ new Set();
|
|
30
34
|
const nodes = [];
|
|
31
35
|
for (let i = 0; i < data.length; i++) {
|
|
32
36
|
const datum = data[i];
|
|
33
37
|
if (defined && !defined(datum, i, data)) continue;
|
|
34
38
|
const xv = x(datum, i, data), yv = y(datum, i, data);
|
|
35
|
-
|
|
36
|
-
|
|
39
|
+
const mappedX = mapSeriesPosition(xs, xv), mappedY = mapSeriesPosition(ys, yv);
|
|
40
|
+
if (mappedX === void 0 || mappedY === void 0) continue;
|
|
41
|
+
const px = mappedX, py = mappedY;
|
|
37
42
|
const key = keyBy === void 0 ? i : typeof keyBy === "function" ? keyBy(datum, i, data) : datum[keyBy];
|
|
38
43
|
if (typeof key !== "string" && typeof key !== "number")
|
|
39
44
|
throw new TypeError("PlotSeries: keyBy must return a string or number.");
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/features/viz/lib/plot-series.tsx"],
|
|
4
|
-
"sourcesContent": ["import { Group, resolveSignalValue } from \"@pibbl/core\";\nimport type { PibblNode } from \"@pibbl/core\";\nimport type { PlotSeriesProps } from \"./plot-types.js\";\nimport {
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["import { Group, resolveSignalValue } from \"@pibbl/core\";\nimport type { PibblNode } from \"@pibbl/core\";\nimport type { PlotSeriesProps } from \"./plot-types.js\";\nimport { pointData } from \"./point-data.js\";\nimport {\n useSeriesPosition,\n seriesAccessor,\n mapSeriesPosition,\n} from \"./series-position.js\";\nfunction PlotRow<D>({\n datum,\n index,\n data,\n render,\n}: {\n datum: D;\n index: number;\n data: readonly D[];\n render: PlotSeriesProps<D>[\"render\"];\n}): PibblNode {\n return render(datum, index, data);\n}\n/**\n * Places keyed custom Pibbl subtrees at local data coordinates.\n *\n * @param props - Data, coordinate accessors, scales, keys, and per-datum renderer. See\n * {@link PlotSeriesProps} .\n * @returns Pibbl nodes placing each rendered datum at its mapped coordinates. See {@link PibblNode}.\n *\n * @see {@link PlotSeriesProps}\n * @see {@link PibblNode}\n */\nexport function PlotSeries<D>({\n data: input,\n x: xInput,\n y: yInput,\n xScale: xId,\n yScale: yId,\n defined,\n keyBy,\n render,\n ...events\n}: PlotSeriesProps<D>): PibblNode {\n const xs = useSeriesPosition(xId),\n ys = useSeriesPosition(yId);\n const data = pointData(resolveSignalValue(input), \"PlotSeries\");\n if (typeof render !== \"function\")\n throw new TypeError(\"PlotSeries: render must be a synchronous function.\");\n const x = seriesAccessor(xInput),\n y = seriesAccessor(yInput);\n const keys = new Set<string>();\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 xv = x(datum, i, data),\n yv = y(datum, i, data);\n const mappedX = mapSeriesPosition(xs, xv),\n mappedY = mapSeriesPosition(ys, yv);\n if (mappedX === undefined || mappedY === undefined) continue;\n const px = mappedX,\n py = mappedY;\n const key =\n keyBy === undefined\n ? i\n : typeof keyBy === \"function\"\n ? keyBy(datum, i, data)\n : datum[keyBy];\n if (typeof key !== \"string\" && typeof key !== \"number\")\n throw new TypeError(\"PlotSeries: keyBy must return a string or number.\");\n const normalized = String(key);\n if (keys.has(normalized))\n throw new Error(`PlotSeries: duplicate key \"${normalized}\".`);\n keys.add(normalized);\n nodes.push(\n <Group key={normalized} style={{ translateX: px, translateY: py }}>\n <PlotRow datum={datum} index={i} data={data} render={render} />\n </Group>,\n );\n }\n return <Group {...events}>{nodes}</Group>;\n}\n"],
|
|
5
|
+
"mappings": "AA4EQ;AA5ER,SAAS,OAAO,0BAA0B;AAG1C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I,MAAM,8BAA8B,UAAU,IAAI;AAC9D,SAAK,IAAI,UAAU;AACnB,UAAM;AAAA,MACJ,oBAAC,SAAuB,OAAO,EAAE,YAAY,IAAI,YAAY,GAAG,GAC9D,8BAAC,WAAQ,OAAc,OAAO,GAAG,MAAY,QAAgB,KADnD,UAEZ;AAAA,IACF;AAAA,EACF;AACA,SAAO,oBAAC,SAAO,GAAG,QAAS,iBAAM;AACnC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { PlotSeries } from "./plot-series.js";
|
|
2
2
|
import type { PieOptions } from "./pie-slices.js";
|
|
3
|
-
import type { PibblEventHandlers, PibblNode, SignalValue } from "@pibbl/core";
|
|
4
3
|
import type { PointAccessor } from "./point-types.js";
|
|
4
|
+
import type { SeriesAccessor } from "./types.js";
|
|
5
|
+
import type { PibblEventHandlers, PibblNode, SignalValue } from "@pibbl/core";
|
|
5
6
|
import type { ScaleId } from "./types.js";
|
|
6
7
|
/**
|
|
7
8
|
* A property or callback that provides stable identity for a plotted datum.
|
|
@@ -34,9 +35,9 @@ export interface PlotSeriesProps<D> extends PibblEventHandlers {
|
|
|
34
35
|
*/
|
|
35
36
|
readonly data: SignalValue<readonly D[]>;
|
|
36
37
|
/** Property key or callback extracting the horizontal domain coordinate. See {@link PointAccessor}. */
|
|
37
|
-
readonly x:
|
|
38
|
+
readonly x: SeriesAccessor<D>;
|
|
38
39
|
/** Property key or callback extracting the vertical domain coordinate. See {@link PointAccessor}. */
|
|
39
|
-
readonly y:
|
|
40
|
+
readonly y: SeriesAccessor<D>;
|
|
40
41
|
/** The scale used to map horizontal data coordinates. See {@link ScaleId}. */
|
|
41
42
|
readonly xScale: ScaleId;
|
|
42
43
|
/** The scale used to map vertical data coordinates. See {@link ScaleId}. */
|
|
@@ -8,4 +8,4 @@ import type { PointSeriesProps } from "./point-types.js";
|
|
|
8
8
|
*
|
|
9
9
|
* @see {@link PointSeriesProps}
|
|
10
10
|
*/
|
|
11
|
-
export declare function PointSeries<D>({ data: input, x: xInput, y: yInput, xScale: xId, yScale: yId, defined, style: styleInput, ...events }: PointSeriesProps<D>): import("../../../jsx-runtime.js").JSX.Element;
|
|
11
|
+
export declare function PointSeries<D>({ data: input, x: xInput, y: yInput, xScale: xId, yScale: yId, defined, inspection, style: styleInput, ...events }: PointSeriesProps<D>): import("../../../jsx-runtime.js").JSX.Element;
|
|
@@ -6,8 +6,12 @@ import {
|
|
|
6
6
|
resolveSignalValue,
|
|
7
7
|
useCanvasContext
|
|
8
8
|
} from "@pibbl/core";
|
|
9
|
-
import {
|
|
10
|
-
|
|
9
|
+
import {
|
|
10
|
+
useSeriesPosition,
|
|
11
|
+
seriesAccessor,
|
|
12
|
+
mapSeriesPosition
|
|
13
|
+
} from "./series-position.js";
|
|
14
|
+
import { pointData } from "./point-data.js";
|
|
11
15
|
import { appendPointTarget, pointPath } from "./point-geometry.js";
|
|
12
16
|
import { opacity, width } from "./paint.js";
|
|
13
17
|
const fields = ["radius", "fill", "stroke", "strokeWidth", "opacity", "cursor"];
|
|
@@ -52,22 +56,33 @@ function PointSeries({
|
|
|
52
56
|
xScale: xId,
|
|
53
57
|
yScale: yId,
|
|
54
58
|
defined,
|
|
59
|
+
inspection,
|
|
55
60
|
style: styleInput,
|
|
56
61
|
...events
|
|
57
62
|
}) {
|
|
58
|
-
const xs =
|
|
63
|
+
const xs = useSeriesPosition(xId), ys = useSeriesPosition(yId);
|
|
59
64
|
const data = pointData(resolveSignalValue(input), "PointSeries");
|
|
60
|
-
const x =
|
|
65
|
+
const x = seriesAccessor(xInput), y = seriesAccessor(yInput);
|
|
61
66
|
const specified = resolveSignalValue(styleInput);
|
|
62
67
|
const shared = typeof specified === "function" ? void 0 : normalized(styleObject(specified ?? {}, false));
|
|
63
68
|
const ctx = useCanvasContext();
|
|
64
69
|
const target = new Path2D();
|
|
70
|
+
const captured = inspection ? [] : void 0;
|
|
71
|
+
let run = 0;
|
|
72
|
+
if (inspection && (xs.type === "point" || ys.type === "point")) throw new TypeError("Numeric point inspection requires numeric continuous scales.");
|
|
65
73
|
for (let i = 0; i < data.length; i++) {
|
|
66
74
|
const datum = data[i];
|
|
67
|
-
if (defined && !defined(datum, i, data))
|
|
75
|
+
if (defined && !defined(datum, i, data)) {
|
|
76
|
+
run++;
|
|
77
|
+
continue;
|
|
78
|
+
}
|
|
68
79
|
const xv = x(datum, i, data), yv = y(datum, i, data);
|
|
69
|
-
|
|
70
|
-
|
|
80
|
+
const mappedX = mapSeriesPosition(xs, xv), mappedY = mapSeriesPosition(ys, yv);
|
|
81
|
+
if (mappedX === void 0 || mappedY === void 0) {
|
|
82
|
+
run++;
|
|
83
|
+
continue;
|
|
84
|
+
}
|
|
85
|
+
const px = mappedX, py = mappedY;
|
|
71
86
|
const style = shared ?? normalized(
|
|
72
87
|
styleObject(
|
|
73
88
|
specified(
|
|
@@ -78,6 +93,7 @@ function PointSeries({
|
|
|
78
93
|
true
|
|
79
94
|
)
|
|
80
95
|
);
|
|
96
|
+
captured?.push(Object.freeze({ datum, sourceIndex: i, domainX: xv, domainY: yv, anchorLocal: Object.freeze({ x: px, y: py }), run, radiusLocal: style.radius, fill: !!style.fill, strokeWidthLocal: style.stroke ? style.strokeWidth : 0 }));
|
|
81
97
|
if (style.radius === 0) continue;
|
|
82
98
|
appendPointTarget(
|
|
83
99
|
target,
|
|
@@ -92,11 +108,21 @@ function PointSeries({
|
|
|
92
108
|
try {
|
|
93
109
|
ctx.globalAlpha *= style.opacity;
|
|
94
110
|
if (style.fill) {
|
|
95
|
-
ctx.fillStyle = resolveTexturePaint(style.fill, ctx, {
|
|
111
|
+
ctx.fillStyle = resolveTexturePaint(style.fill, ctx, {
|
|
112
|
+
x: px - style.radius,
|
|
113
|
+
y: py - style.radius,
|
|
114
|
+
width: style.radius * 2,
|
|
115
|
+
height: style.radius * 2
|
|
116
|
+
});
|
|
96
117
|
ctx.fill(path);
|
|
97
118
|
}
|
|
98
119
|
if (style.stroke && style.strokeWidth > 0) {
|
|
99
|
-
ctx.strokeStyle = resolveTexturePaint(style.stroke, ctx, {
|
|
120
|
+
ctx.strokeStyle = resolveTexturePaint(style.stroke, ctx, {
|
|
121
|
+
x: px - style.radius,
|
|
122
|
+
y: py - style.radius,
|
|
123
|
+
width: style.radius * 2,
|
|
124
|
+
height: style.radius * 2
|
|
125
|
+
});
|
|
100
126
|
ctx.lineWidth = style.strokeWidth;
|
|
101
127
|
ctx.stroke(path);
|
|
102
128
|
}
|
|
@@ -104,6 +130,7 @@ function PointSeries({
|
|
|
104
130
|
ctx.restore();
|
|
105
131
|
}
|
|
106
132
|
}
|
|
133
|
+
if (inspection && xs.type !== "point" && ys.type !== "point") inspection.capture({ observations: captured, xScale: xs, yScale: ys });
|
|
107
134
|
return /* @__PURE__ */ jsx(
|
|
108
135
|
Path,
|
|
109
136
|
{
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/features/viz/lib/point-series.tsx"],
|
|
4
|
-
"sourcesContent": ["import { resolveTexturePaint } from
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["import { resolveTexturePaint } from \"@pibbl/core/internal\";\nimport {\n Path,\n isSignal,\n resolveSignalValue,\n useCanvasContext,\n} from \"@pibbl/core\";\nimport type { FillStyle, StrokeStyle } from \"@pibbl/core\";\nimport type {\n PointMarkStyle,\n PointSeriesProps,\n PointSeriesStyle,\n} from \"./point-types.js\";\nimport {\n useSeriesPosition,\n seriesAccessor,\n mapSeriesPosition,\n} from \"./series-position.js\";\nimport { pointData } from \"./point-data.js\";\nimport { appendPointTarget, pointPath } from \"./point-geometry.js\";\nimport { opacity, width } from \"./paint.js\";\nconst fields = [\"radius\", \"fill\", \"stroke\", \"strokeWidth\", \"opacity\", \"cursor\"];\nfunction paint(\n value: unknown,\n name: string,\n): FillStyle | StrokeStyle | undefined {\n if (\n value === undefined ||\n typeof value === \"string\" ||\n value instanceof CanvasGradient ||\n value instanceof CanvasPattern\n )\n return value;\n throw new TypeError(`PointSeries: invalid ${name}.`);\n}\nfunction styleObject(input: unknown, callback: boolean): PointSeriesStyle {\n if (input === null || typeof input !== \"object\" || Array.isArray(input))\n throw new TypeError(\"PointSeries: style must be an object.\");\n const result: Record<string, unknown> = {};\n for (const key of Object.keys(input)) {\n if (!fields.includes(key) || (callback && key === \"cursor\"))\n throw new TypeError(`PointSeries: unsupported style field ${key}.`);\n const value = (input as Record<string, unknown>)[key];\n if (callback && isSignal(value))\n throw new TypeError(\n \"PointSeries: datum styles must contain plain values; read signals explicitly.\",\n );\n result[key] = callback ? value : resolveSignalValue(value);\n }\n return result as PointSeriesStyle;\n}\nfunction normalized(style: PointSeriesStyle) {\n const radius = width(style.radius ?? 3, \"PointSeries radius\");\n if (style.cursor !== undefined && typeof style.cursor !== \"string\")\n throw new TypeError(\"PointSeries: cursor must be a string.\");\n return {\n radius,\n fill: paint(style.fill ?? \"#2563eb\", \"fill\"),\n stroke: paint(style.stroke, \"stroke\"),\n strokeWidth: width(style.strokeWidth ?? 1, \"PointSeries\"),\n opacity: opacity(style.opacity ?? 1, \"PointSeries\"),\n cursor: style.cursor,\n };\n}\n/**\n * Batched circles in source paint order with one ordinary Pibbl target.\n *\n * @param props - Data, coordinate accessors, scales, and point styling. See\n * {@link PointSeriesProps} .\n * @returns Pibbl nodes drawing the point marks.\n *\n * @see {@link PointSeriesProps}\n */\nexport function PointSeries<D>({\n data: input,\n x: xInput,\n y: yInput,\n xScale: xId,\n yScale: yId,\n defined,\n inspection,\n style: styleInput,\n ...events\n}: PointSeriesProps<D>) {\n const xs = useSeriesPosition(xId),\n ys = useSeriesPosition(yId);\n const data = pointData(resolveSignalValue(input), \"PointSeries\");\n const x = seriesAccessor(xInput),\n y = seriesAccessor(yInput);\n const specified = resolveSignalValue(styleInput);\n const shared =\n typeof specified === \"function\"\n ? undefined\n : normalized(styleObject(specified ?? {}, false));\n const ctx = useCanvasContext();\n const target = new Path2D();\n const captured: import(\"../inspection/capture-types.js\").CapturedNumericObservation<D>[] | undefined = inspection ? [] : undefined;\n let run = 0;\n if (inspection && (xs.type === \"point\" || ys.type === \"point\")) throw new TypeError(\"Numeric point inspection requires numeric continuous scales.\");\n for (let i = 0; i < data.length; i++) {\n const datum = data[i];\n if (defined && !defined(datum, i, data)) { run++; continue; }\n const xv = x(datum, i, data),\n yv = y(datum, i, data);\n const mappedX = mapSeriesPosition(xs, xv),\n mappedY = mapSeriesPosition(ys, yv);\n if (mappedX === undefined || mappedY === undefined) { run++; continue; }\n const px = mappedX,\n py = mappedY;\n const style =\n shared ??\n normalized(\n styleObject(\n (specified as (d: D, i: number, a: readonly D[]) => PointMarkStyle)(\n datum,\n i,\n data,\n ),\n true,\n ),\n );\n captured?.push(Object.freeze({datum,sourceIndex:i,domainX:xv as number,domainY:yv as number,anchorLocal:Object.freeze({x:px,y:py}),run,radiusLocal:style.radius,fill:!!style.fill,strokeWidthLocal:style.stroke ? style.strokeWidth : 0}));\n if (style.radius === 0) continue;\n appendPointTarget(\n target,\n px,\n py,\n style.radius,\n !!style.fill,\n style.stroke ? style.strokeWidth : 0,\n );\n const path = pointPath(px, py, style.radius);\n ctx.save();\n try {\n ctx.globalAlpha *= style.opacity;\n if (style.fill) {\n ctx.fillStyle = resolveTexturePaint(style.fill, ctx, {\n x: px - style.radius,\n y: py - style.radius,\n width: style.radius * 2,\n height: style.radius * 2,\n });\n ctx.fill(path);\n }\n if (style.stroke && style.strokeWidth > 0) {\n ctx.strokeStyle = resolveTexturePaint(style.stroke, ctx, {\n x: px - style.radius,\n y: py - style.radius,\n width: style.radius * 2,\n height: style.radius * 2,\n });\n ctx.lineWidth = style.strokeWidth;\n ctx.stroke(path);\n }\n } finally {\n ctx.restore();\n }\n }\n if (inspection && xs.type !== \"point\" && ys.type !== \"point\") inspection.capture({observations:captured!,xScale:xs,yScale:ys});\n return (\n <Path\n {...events}\n style={{ d: target, fill: \"transparent\", cursor: shared?.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,cAAa,UAAU,QAAO,IAAG,QAAO,GAAE,CAAC;AAC7H,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ,OAAO,EAAE,GAAG,QAAQ,MAAM,eAAe,QAAQ,QAAQ,OAAO;AAAA;AAAA,EAClE;AAEJ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { PlotSeriesProps } from "./plot-types.js";
|
|
2
|
+
import type { SeriesAccessor } from "./types.js";
|
|
2
3
|
import type { PibblEventHandlers, PibblEventParticipationOptions, FillStyle, SignalValue, StrokeStyle } from "@pibbl/core";
|
|
3
4
|
import type { SignalStyle } from "@pibbl/core/internal";
|
|
4
5
|
import type { LineAccessor, ScaleId } from "./types.js";
|
|
@@ -69,10 +70,12 @@ export interface PointSeriesProps<D> extends PibblEventHandlers, PibblEventParti
|
|
|
69
70
|
* Application data supplied to the component or reported by the event. See {@link SignalValue}.
|
|
70
71
|
*/
|
|
71
72
|
readonly data: SignalValue<readonly D[]>;
|
|
73
|
+
/** Optional committed numeric inspection capture; rendering alone performs no queries. */
|
|
74
|
+
readonly inspection?: import("../inspection/capture-types.js").NumericInspectionRef<D>;
|
|
72
75
|
/** Property key or callback extracting the horizontal domain coordinate. See {@link PointAccessor}. */
|
|
73
|
-
readonly x:
|
|
76
|
+
readonly x: SeriesAccessor<D>;
|
|
74
77
|
/** Property key or callback extracting the vertical domain coordinate. See {@link PointAccessor}. */
|
|
75
|
-
readonly y:
|
|
78
|
+
readonly y: SeriesAccessor<D>;
|
|
76
79
|
/** The scale used to map horizontal data coordinates. See {@link ScaleId}. */
|
|
77
80
|
readonly xScale: ScaleId;
|
|
78
81
|
/** The scale used to map vertical data coordinates. See {@link ScaleId}. */
|
|
@@ -9,7 +9,10 @@ function ReferenceBand(props) {
|
|
|
9
9
|
const scale = source.get();
|
|
10
10
|
if (scale.type === "point" || scale.type === "band") throw new TypeError("ReferenceBand requires a continuous scale.");
|
|
11
11
|
const values = resolveSignalValue(props.values), span = resolveSignalValue(props.span);
|
|
12
|
-
|
|
12
|
+
if (!Array.isArray(values) || values.length !== 2 || !values.every(
|
|
13
|
+
(value) => typeof value === "number" && Number.isFinite(value)
|
|
14
|
+
) || !Array.isArray(span) || span.length !== 2 || !span.every((value) => typeof value === "number" && Number.isFinite(value)))
|
|
15
|
+
throw new RangeError("ReferenceBand values and span require two finite endpoints.");
|
|
13
16
|
const lo = Math.min(...scale.domain), hi = Math.max(...scale.domain);
|
|
14
17
|
if (values.some((value) => value < lo || value > hi)) throw new RangeError("ReferenceBand values must be within the scale domain.");
|
|
15
18
|
const a = scale.map(values[0]), b = scale.map(values[1]);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/features/viz/lib/reference-band.tsx"],
|
|
4
|
-
"sourcesContent": ["import { Path, resolveSignalValue, type SignalValue } from \"@pibbl/core\";\nimport type { SignalStyle } from \"@pibbl/core/internal\";\nimport type { AxisStyle } from \"./types.js\";\nimport type { ChartLineProps } from \"./chart-lines.js\";\nimport { lookupScale } from \"./scale-context.js\";\nimport { opacity } from \"./paint.js\";\n/** A continuous domain interval painted across an explicit local pixel span. See {@link ReferenceBand}. */\nexport interface ReferenceBandProps extends Omit<ChartLineProps, \"style\"> {\n /** Two finite in-domain numeric endpoints; either order, including equal values. */\n readonly values: SignalValue<readonly [number, number]>;\n /** Fill defaults to #dce5e8; opacity defaults to 0.35. */\n readonly style?: SignalValue<SignalStyle<Pick<AxisStyle, \"fill\" | \"opacity\">>>;\n}\n/** Paint a decorative interval without owning layout, labels, or hit geometry.\n * @param props - Scale geometry and presentation. See {@link ReferenceBandProps}.\n * @returns Decorative chart content in the caller's coordinate space.\n */\nexport function ReferenceBand(props: ReferenceBandProps) {\n if (props.direction !== \"horizontal\" && props.direction !== \"vertical\") throw new TypeError(\"ReferenceBand direction must be horizontal or vertical.\");\n const source = lookupScale(props.scale, \"ReferenceBand\");\n if (!source) throw new TypeError(\"ReferenceBand requires a scale ID.\");\n const scale = source.get();\n if (scale.type === \"point\" || scale.type === \"band\") throw new TypeError(\"ReferenceBand requires a continuous scale.\");\n const values = resolveSignalValue(props.values), span = resolveSignalValue(props.span);\n
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["import { Path, resolveSignalValue, type SignalValue } from \"@pibbl/core\";\nimport type { SignalStyle } from \"@pibbl/core/internal\";\nimport type { AxisStyle } from \"./types.js\";\nimport type { ChartLineProps } from \"./chart-lines.js\";\nimport { lookupScale } from \"./scale-context.js\";\nimport { opacity } from \"./paint.js\";\n/** A continuous domain interval painted across an explicit local pixel span. See {@link ReferenceBand}. */\nexport interface ReferenceBandProps extends Omit<ChartLineProps, \"style\"> {\n /** Two finite in-domain numeric endpoints; either order, including equal values. */\n readonly values: SignalValue<readonly [number, number]>;\n /** Fill defaults to #dce5e8; opacity defaults to 0.35. */\n readonly style?: SignalValue<SignalStyle<Pick<AxisStyle, \"fill\" | \"opacity\">>>;\n}\n/** Paint a decorative interval without owning layout, labels, or hit geometry.\n * @param props - Scale geometry and presentation. See {@link ReferenceBandProps}.\n * @returns Decorative chart content in the caller's coordinate space.\n */\nexport function ReferenceBand(props: ReferenceBandProps) {\n if (props.direction !== \"horizontal\" && props.direction !== \"vertical\") throw new TypeError(\"ReferenceBand direction must be horizontal or vertical.\");\n const source = lookupScale(props.scale, \"ReferenceBand\");\n if (!source) throw new TypeError(\"ReferenceBand requires a scale ID.\");\n const scale = source.get();\n if (scale.type === \"point\" || scale.type === \"band\") throw new TypeError(\"ReferenceBand requires a continuous scale.\");\n const values = resolveSignalValue(props.values), span = resolveSignalValue(props.span);\n if (\n !Array.isArray(values) ||\n values.length !== 2 ||\n !values.every(\n value => typeof value === \"number\" && Number.isFinite(value),\n ) ||\n !Array.isArray(span) ||\n span.length !== 2 ||\n !span.every(value => typeof value === \"number\" && Number.isFinite(value))\n )\n throw new RangeError(\"ReferenceBand values and span require two finite endpoints.\");\n const lo = Math.min(...scale.domain), hi = Math.max(...scale.domain);\n if (values.some(value => value < lo || value > hi)) throw new RangeError(\"ReferenceBand values must be within the scale domain.\");\n const a = scale.map(values[0]), b = scale.map(values[1]);\n const start = Math.min(...span), length = Math.abs(span[1] - span[0]);\n if (!Number.isFinite(length)) throw new RangeError(\"ReferenceBand span length must be finite.\");\n const path = new Path2D();\n if (props.direction === \"horizontal\") path.rect(start, Math.min(a, b), length, Math.abs(b - a));\n else path.rect(Math.min(a, b), start, Math.abs(b - a), length);\n const style = resolveSignalValue(props.style) ?? {};\n return <Path pointerEvents=\"none\" style={{ d: path, fill: resolveSignalValue(style.fill) ?? \"#dce5e8\", opacity: opacity(resolveSignalValue(style.opacity) ?? 0.35, \"ReferenceBand\") }} />;\n}\n"],
|
|
5
|
+
"mappings": "AA4CS;AA5CT,SAAS,MAAM,0BAA4C;AAI3D,SAAS,mBAAmB;AAC5B,SAAS,eAAe;AAYjB,SAAS,cAAc,OAA2B;AACvD,MAAI,MAAM,cAAc,gBAAgB,MAAM,cAAc,WAAY,OAAM,IAAI,UAAU,yDAAyD;AACrJ,QAAM,SAAS,YAAY,MAAM,OAAO,eAAe;AACvD,MAAI,CAAC,OAAQ,OAAM,IAAI,UAAU,oCAAoC;AACrE,QAAM,QAAQ,OAAO,IAAI;AACzB,MAAI,MAAM,SAAS,WAAW,MAAM,SAAS,OAAQ,OAAM,IAAI,UAAU,4CAA4C;AACrH,QAAM,SAAS,mBAAmB,MAAM,MAAM,GAAG,OAAO,mBAAmB,MAAM,IAAI;AACrF,MACE,CAAC,MAAM,QAAQ,MAAM,KACrB,OAAO,WAAW,KAClB,CAAC,OAAO;AAAA,IACN,WAAS,OAAO,UAAU,YAAY,OAAO,SAAS,KAAK;AAAA,EAC7D,KACA,CAAC,MAAM,QAAQ,IAAI,KACnB,KAAK,WAAW,KAChB,CAAC,KAAK,MAAM,WAAS,OAAO,UAAU,YAAY,OAAO,SAAS,KAAK,CAAC;AAExE,UAAM,IAAI,WAAW,6DAA6D;AACpF,QAAM,KAAK,KAAK,IAAI,GAAG,MAAM,MAAM,GAAG,KAAK,KAAK,IAAI,GAAG,MAAM,MAAM;AACnE,MAAI,OAAO,KAAK,WAAS,QAAQ,MAAM,QAAQ,EAAE,EAAG,OAAM,IAAI,WAAW,uDAAuD;AAChI,QAAM,IAAI,MAAM,IAAI,OAAO,CAAC,CAAC,GAAG,IAAI,MAAM,IAAI,OAAO,CAAC,CAAC;AACvD,QAAM,QAAQ,KAAK,IAAI,GAAG,IAAI,GAAG,SAAS,KAAK,IAAI,KAAK,CAAC,IAAI,KAAK,CAAC,CAAC;AACpE,MAAI,CAAC,OAAO,SAAS,MAAM,EAAG,OAAM,IAAI,WAAW,2CAA2C;AAC9F,QAAM,OAAO,IAAI,OAAO;AACxB,MAAI,MAAM,cAAc,aAAc,MAAK,KAAK,OAAO,KAAK,IAAI,GAAG,CAAC,GAAG,QAAQ,KAAK,IAAI,IAAI,CAAC,CAAC;AAAA,MACzF,MAAK,KAAK,KAAK,IAAI,GAAG,CAAC,GAAG,OAAO,KAAK,IAAI,IAAI,CAAC,GAAG,MAAM;AAC7D,QAAM,QAAQ,mBAAmB,MAAM,KAAK,KAAK,CAAC;AAClD,SAAO,oBAAC,QAAK,eAAc,QAAO,OAAO,EAAE,GAAG,MAAM,MAAM,mBAAmB,MAAM,IAAI,KAAK,WAAW,SAAS,QAAQ,mBAAmB,MAAM,OAAO,KAAK,MAAM,eAAe,EAAE,GAAG;AACzL;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Signal } from "@pibbl/core";
|
|
2
2
|
import type { ResolvedScale, ScaleId } from "./types.js";
|
|
3
|
-
export declare function scaleKind(value: Signal<ResolvedScale>): "band" | "linear" | "log" | "point" | "symlog" | "utc" | undefined;
|
|
3
|
+
export declare function scaleKind(value: Signal<ResolvedScale>): "band" | "linear" | "log" | "point" | "symlog" | "trading-time" | "utc" | undefined;
|
|
4
4
|
export declare function provideScale(id: ScaleId, value: Signal<ResolvedScale>, kind: ResolvedScale["type"]): void;
|
|
5
5
|
export declare function lookupScale(id: ScaleId | undefined, receiver: string): Signal<ResolvedScale> | undefined;
|
|
6
6
|
/** Invocation-scoped lookup for official viz receivers; does not allocate a hook. */
|
|
@@ -1,21 +1,35 @@
|
|
|
1
1
|
import { resolveSignalValue } from "@pibbl/core";
|
|
2
2
|
function ticks(scale, props) {
|
|
3
3
|
if (props.tickValues !== void 0 && props.tickCount !== void 0)
|
|
4
|
-
throw new TypeError(
|
|
4
|
+
throw new TypeError(
|
|
5
|
+
"Axis tickValues and tickCount are mutually exclusive."
|
|
6
|
+
);
|
|
5
7
|
const explicit = props.tickValues === void 0 ? void 0 : resolveSignalValue(props.tickValues);
|
|
6
8
|
if (explicit !== void 0) {
|
|
7
9
|
if (!Array.isArray(explicit) || explicit.length > 100)
|
|
8
|
-
throw new RangeError(
|
|
10
|
+
throw new RangeError(
|
|
11
|
+
"Axis tickValues must be an array with at most 100 values."
|
|
12
|
+
);
|
|
9
13
|
const seen = /* @__PURE__ */ new Set();
|
|
10
14
|
for (const value of explicit) {
|
|
11
|
-
if (seen.has(value))
|
|
15
|
+
if (seen.has(value))
|
|
16
|
+
throw new RangeError("Axis tickValues must not contain duplicates.");
|
|
12
17
|
seen.add(value);
|
|
13
|
-
if (scale.type
|
|
18
|
+
if (scale.type === "trading-time") {
|
|
19
|
+
if (typeof value !== "number" || scale.slotAtTime(value) === void 0)
|
|
20
|
+
throw new RangeError(
|
|
21
|
+
"Axis trading-time ticks must be supplied timestamps."
|
|
22
|
+
);
|
|
23
|
+
} else if (scale.type !== "band" && scale.type !== "point") {
|
|
14
24
|
if (typeof value !== "number" || !Number.isFinite(value))
|
|
15
|
-
throw new TypeError(
|
|
25
|
+
throw new TypeError(
|
|
26
|
+
"Axis tickValues for a continuous scale must be finite numbers."
|
|
27
|
+
);
|
|
16
28
|
const [a, b] = scale.domain;
|
|
17
29
|
if (value < Math.min(a, b) || value > Math.max(a, b))
|
|
18
|
-
throw new RangeError(
|
|
30
|
+
throw new RangeError(
|
|
31
|
+
"Axis tickValues must be within the scale domain."
|
|
32
|
+
);
|
|
19
33
|
} else if (typeof value !== "string" && (typeof value !== "number" || !Number.isFinite(value)) || scale.map(value) === void 0) {
|
|
20
34
|
throw new RangeError("Axis tickValues must be known band categories.");
|
|
21
35
|
}
|
|
@@ -26,6 +40,7 @@ function ticks(scale, props) {
|
|
|
26
40
|
if (!Number.isInteger(count) || count < 0 || count > 100)
|
|
27
41
|
throw new RangeError("Axis tickCount must be an integer from 0 to 100.");
|
|
28
42
|
if (count === 0) return [];
|
|
43
|
+
if (scale.type === "trading-time") return scale.ticks(count);
|
|
29
44
|
if (scale.type !== "band" && scale.type !== "point")
|
|
30
45
|
return count === 1 ? [scale.domain[0]] : scale.ticks(count);
|
|
31
46
|
const n = scale.domain.length;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/features/viz/lib/scale-ticks.ts"],
|
|
4
|
-
"sourcesContent": ["import { resolveSignalValue } from \"@pibbl/core\";\nimport type { AxisProps, BandCategory, ResolvedScale } from \"./types.js\";\ntype Tick = number | string;\n\nexport function ticks(scale: ResolvedScale
|
|
5
|
-
"mappings": "AAAA,SAAS,0BAA0B;AAI5B,SAAS,
|
|
4
|
+
"sourcesContent": ["import { resolveSignalValue } from \"@pibbl/core\";\nimport type { AxisProps, BandCategory, ResolvedScale } from \"./types.js\";\ntype Tick = number | string;\n\nexport function ticks(\n scale: ResolvedScale,\n props: Pick<AxisProps, \"tickValues\" | \"tickCount\">,\n): readonly Tick[] {\n if (props.tickValues !== undefined && props.tickCount !== undefined)\n throw new TypeError(\n \"Axis tickValues and tickCount are mutually exclusive.\",\n );\n const explicit =\n props.tickValues === undefined\n ? undefined\n : resolveSignalValue(props.tickValues);\n if (explicit !== undefined) {\n if (!Array.isArray(explicit) || explicit.length > 100)\n throw new RangeError(\n \"Axis tickValues must be an array with at most 100 values.\",\n );\n const seen = new Set<Tick>();\n for (const value of explicit) {\n if (seen.has(value))\n throw new RangeError(\"Axis tickValues must not contain duplicates.\");\n seen.add(value);\n if (scale.type === \"trading-time\") {\n if (typeof value !== \"number\" || scale.slotAtTime(value) === undefined)\n throw new RangeError(\n \"Axis trading-time ticks must be supplied timestamps.\",\n );\n } else if (scale.type !== \"band\" && scale.type !== \"point\") {\n if (typeof value !== \"number\" || !Number.isFinite(value))\n throw new TypeError(\n \"Axis tickValues for a continuous scale must be finite numbers.\",\n );\n const [a, b] = scale.domain;\n if (value < Math.min(a, b) || value > Math.max(a, b))\n throw new RangeError(\n \"Axis tickValues must be within the scale domain.\",\n );\n } else if (\n (typeof value !== \"string\" &&\n (typeof value !== \"number\" || !Number.isFinite(value))) ||\n scale.map(value as BandCategory) === undefined\n ) {\n throw new RangeError(\"Axis tickValues must be known band categories.\");\n }\n }\n return explicit;\n }\n const count = resolveSignalValue(props.tickCount ?? 5);\n if (!Number.isInteger(count) || count < 0 || count > 100)\n throw new RangeError(\"Axis tickCount must be an integer from 0 to 100.\");\n if (count === 0) return [];\n if (scale.type === \"trading-time\") return scale.ticks(count);\n if (scale.type !== \"band\" && scale.type !== \"point\")\n return count === 1 ? [scale.domain[0]] : scale.ticks(count);\n const n = scale.domain.length;\n if (n === 0) return [];\n if (count === 1) return [scale.domain[0]];\n const m = Math.min(count, n);\n if (m === 1) return [scale.domain[0]];\n return Array.from(\n { length: m },\n (_, index) => scale.domain[Math.round((index * (n - 1)) / (m - 1))]!,\n );\n}\n\nexport function position(scale: ResolvedScale, value: Tick): number {\n if (scale.type === \"point\") return scale.map(value as BandCategory)!;\n return scale.type === \"band\"\n ? scale.map(value as BandCategory)! + scale.bandwidth / 2\n : scale.map(value as number);\n}\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,0BAA0B;AAI5B,SAAS,MACd,OACA,OACiB;AACjB,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AgB,QAAO,MAAM,MAAM,KAAK;AAC3D,MAAI,MAAM,SAAS,UAAU,MAAM,SAAS;AAC1C,WAAO,UAAU,IAAI,CAAC,MAAM,OAAO,CAAC,CAAC,IAAI,MAAM,MAAM,KAAK;AAC5D,QAAM,IAAI,MAAM,OAAO;AACvB,MAAI,MAAM,EAAG,QAAO,CAAC;AACrB,MAAI,UAAU,EAAG,QAAO,CAAC,MAAM,OAAO,CAAC,CAAC;AACxC,QAAM,IAAI,KAAK,IAAI,OAAO,CAAC;AAC3B,MAAI,MAAM,EAAG,QAAO,CAAC,MAAM,OAAO,CAAC,CAAC;AACpC,SAAO,MAAM;AAAA,IACX,EAAE,QAAQ,EAAE;AAAA,IACZ,CAAC,GAAG,UAAU,MAAM,OAAO,KAAK,MAAO,SAAS,IAAI,MAAO,IAAI,EAAE,CAAC;AAAA,EACpE;AACF;AAEO,SAAS,SAAS,OAAsB,OAAqB;AAClE,MAAI,MAAM,SAAS,QAAS,QAAO,MAAM,IAAI,KAAqB;AAClE,SAAO,MAAM,SAAS,SAClB,MAAM,IAAI,KAAqB,IAAK,MAAM,YAAY,IACtD,MAAM,IAAI,KAAe;AAC/B;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type Signal } from "@pibbl/core";
|
|
2
|
+
import type { SequentialColorScaleProps, ResolvedSequentialColorScale } from "./color-types.js";
|
|
3
|
+
import type { ScaleId } from "./types.js";
|
|
4
|
+
/** Provides an allocation-independent sequential color mapping.
|
|
5
|
+
* @param props - Explicit domain, colors, identity, and children. See {@link SequentialColorScaleProps}.
|
|
6
|
+
* @returns Descendant content. */
|
|
7
|
+
export declare function SequentialColorScale(props: SequentialColorScaleProps): import("@pibbl/core").PibblNode;
|
|
8
|
+
/** Reads the dedicated ancestor sequential mapping.
|
|
9
|
+
* @param id - Color-scale identity. See {@link ScaleId}.
|
|
10
|
+
* @returns Shared readonly mapping signal. See {@link ResolvedSequentialColorScale}. */
|
|
11
|
+
export declare function useSequentialColorScale(id: ScaleId): Signal<ResolvedSequentialColorScale>;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { resolveSignalValue } from "@pibbl/core";
|
|
2
|
+
import { provideColor, useColor } from "./color-context.js";
|
|
3
|
+
import {
|
|
4
|
+
colorMix,
|
|
5
|
+
colorPosition,
|
|
6
|
+
finiteColorValue,
|
|
7
|
+
hexColor
|
|
8
|
+
} from "./color-math.js";
|
|
9
|
+
function resolve(props) {
|
|
10
|
+
const input = resolveSignalValue(props.domain), paint = resolveSignalValue(props.colors);
|
|
11
|
+
if (!Array.isArray(input) || input.length !== 2 || !Array.isArray(paint) || paint.length !== 2)
|
|
12
|
+
throw new RangeError(
|
|
13
|
+
"Sequential color scales require two domain endpoints and two colors."
|
|
14
|
+
);
|
|
15
|
+
const domain = Object.freeze(
|
|
16
|
+
Array.from(input, finiteColorValue)
|
|
17
|
+
), colors = Object.freeze(Array.from(paint, hexColor));
|
|
18
|
+
const stops = Object.freeze(
|
|
19
|
+
domain.map((value, i) => Object.freeze({ value, color: colors[i] }))
|
|
20
|
+
);
|
|
21
|
+
return Object.freeze({
|
|
22
|
+
domain,
|
|
23
|
+
colors,
|
|
24
|
+
stops,
|
|
25
|
+
map(value) {
|
|
26
|
+
finiteColorValue(value);
|
|
27
|
+
return colorMix(
|
|
28
|
+
colors[0],
|
|
29
|
+
colors[1],
|
|
30
|
+
colorPosition(value, domain[0], domain[1])
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
function SequentialColorScale(props) {
|
|
36
|
+
provideColor(props.id, "sequential", () => resolve(props), [
|
|
37
|
+
props.domain,
|
|
38
|
+
props.colors
|
|
39
|
+
]);
|
|
40
|
+
return props.children;
|
|
41
|
+
}
|
|
42
|
+
function useSequentialColorScale(id) {
|
|
43
|
+
return useColor(id, "sequential");
|
|
44
|
+
}
|
|
45
|
+
export {
|
|
46
|
+
SequentialColorScale,
|
|
47
|
+
useSequentialColorScale
|
|
48
|
+
};
|
|
49
|
+
//# sourceMappingURL=sequential-color-scale.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/features/viz/lib/sequential-color-scale.ts"],
|
|
4
|
+
"sourcesContent": ["import { resolveSignalValue, type Signal } from \"@pibbl/core\";\nimport type {\n SequentialColorScaleProps,\n ResolvedSequentialColorScale,\n} from \"./color-types.js\";\nimport type { ScaleId } from \"./types.js\";\nimport { provideColor, useColor } from \"./color-context.js\";\nimport {\n colorMix,\n colorPosition,\n finiteColorValue,\n hexColor,\n} from \"./color-math.js\";\nfunction resolve(\n props: SequentialColorScaleProps,\n): ResolvedSequentialColorScale {\n const input = resolveSignalValue(props.domain),\n paint = resolveSignalValue(props.colors);\n if (\n !Array.isArray(input) ||\n input.length !== 2 ||\n !Array.isArray(paint) ||\n paint.length !== 2\n )\n throw new RangeError(\n \"Sequential color scales require two domain endpoints and two colors.\",\n );\n const domain = Object.freeze(\n Array.from(input, finiteColorValue),\n ) as readonly [number, number],\n colors = Object.freeze(Array.from(paint, hexColor)) as readonly [\n string,\n string,\n ];\n const stops = Object.freeze(\n domain.map((value, i) => Object.freeze({ value, color: colors[i] })),\n );\n return Object.freeze({\n domain,\n colors,\n stops,\n map(value: number) {\n finiteColorValue(value);\n return colorMix(\n colors[0],\n colors[1],\n colorPosition(value, domain[0], domain[1]),\n );\n },\n });\n}\n/** Provides an allocation-independent sequential color mapping.\n * @param props - Explicit domain, colors, identity, and children. See {@link SequentialColorScaleProps}.\n * @returns Descendant content. */\nexport function SequentialColorScale(props: SequentialColorScaleProps) {\n provideColor(props.id, \"sequential\", () => resolve(props), [\n props.domain,\n props.colors,\n ]);\n return props.children;\n}\n/** Reads the dedicated ancestor sequential mapping.\n * @param id - Color-scale identity. See {@link ScaleId}.\n * @returns Shared readonly mapping signal. See {@link ResolvedSequentialColorScale}. */\nexport function useSequentialColorScale(\n id: ScaleId,\n): Signal<ResolvedSequentialColorScale> {\n return useColor(id, \"sequential\");\n}\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,0BAAuC;AAMhD,SAAS,cAAc,gBAAgB;AACvC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,QACP,OAC8B;AAC9B,QAAM,QAAQ,mBAAmB,MAAM,MAAM,GAC3C,QAAQ,mBAAmB,MAAM,MAAM;AACzC,MACE,CAAC,MAAM,QAAQ,KAAK,KACpB,MAAM,WAAW,KACjB,CAAC,MAAM,QAAQ,KAAK,KACpB,MAAM,WAAW;AAEjB,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AACF,QAAM,SAAS,OAAO;AAAA,IAClB,MAAM,KAAK,OAAO,gBAAgB;AAAA,EACpC,GACA,SAAS,OAAO,OAAO,MAAM,KAAK,OAAO,QAAQ,CAAC;AAIpD,QAAM,QAAQ,OAAO;AAAA,IACnB,OAAO,IAAI,CAAC,OAAO,MAAM,OAAO,OAAO,EAAE,OAAO,OAAO,OAAO,CAAC,EAAE,CAAC,CAAC;AAAA,EACrE;AACA,SAAO,OAAO,OAAO;AAAA,IACnB;AAAA,IACA;AAAA,IACA;AAAA,IACA,IAAI,OAAe;AACjB,uBAAiB,KAAK;AACtB,aAAO;AAAA,QACL,OAAO,CAAC;AAAA,QACR,OAAO,CAAC;AAAA,QACR,cAAc,OAAO,OAAO,CAAC,GAAG,OAAO,CAAC,CAAC;AAAA,MAC3C;AAAA,IACF;AAAA,EACF,CAAC;AACH;AAIO,SAAS,qBAAqB,OAAkC;AACrE,eAAa,MAAM,IAAI,cAAc,MAAM,QAAQ,KAAK,GAAG;AAAA,IACzD,MAAM;AAAA,IACN,MAAM;AAAA,EACR,CAAC;AACD,SAAO,MAAM;AACf;AAIO,SAAS,wBACd,IACsC;AACtC,SAAO,SAAS,IAAI,YAAY;AAClC;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ResolvedContinuousScale, ResolvedPointScale, ScaleId, SeriesAccessor, SeriesCoordinate } from "./types.js";
|
|
2
|
+
export type NumericPositionScale = ResolvedContinuousScale | import("./trading-time-scale.js").ResolvedTradingTimeScale;
|
|
3
|
+
type PositionScale = NumericPositionScale | ResolvedPointScale;
|
|
4
|
+
/** Private position receiver; public scale hooks retain their dedicated contracts. */
|
|
5
|
+
export declare function useSeriesPosition(id: ScaleId): PositionScale;
|
|
6
|
+
export declare function seriesAccessor<D>(input: SeriesAccessor<D>): (datum: D, index: number, data: readonly D[]) => SeriesCoordinate;
|
|
7
|
+
export declare function mapSeriesPosition(scale: PositionScale, value: SeriesCoordinate): number | undefined;
|
|
8
|
+
/** Private numeric/trading receiver; public continuous hook stays unchanged. */
|
|
9
|
+
export declare function useNumericPosition(id: ScaleId): NumericPositionScale;
|
|
10
|
+
/** Returns explicit supplied time for trading positions, continuous inverse otherwise. */
|
|
11
|
+
export declare function invertNumericPosition(scale: NumericPositionScale, position: number): number | undefined;
|
|
12
|
+
export {};
|