@pibbl/core 0.0.1 → 0.0.3-alpha.85.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/THIRD_PARTY_NOTICES.txt +81 -0
- package/dist/features/machines/animation.d.ts +64 -0
- package/dist/features/machines/animation.js +55 -0
- package/dist/features/machines/animation.js.map +7 -0
- package/dist/features/machines/animation.mjs +1 -0
- package/dist/features/machines/assign.d.ts +16 -0
- package/dist/features/machines/assign.js +15 -0
- package/dist/features/machines/assign.js.map +7 -0
- package/dist/features/machines/callback.d.ts +9 -0
- package/dist/features/machines/callback.js +7 -0
- package/dist/features/machines/callback.js.map +7 -0
- package/dist/features/machines/hook.d.ts +30 -0
- package/dist/features/machines/hook.js +37 -0
- package/dist/features/machines/hook.js.map +7 -0
- package/dist/features/machines/index.d.ts +6 -0
- package/dist/features/machines/index.js +12 -0
- package/dist/features/machines/index.js.map +7 -0
- package/dist/features/machines/index.mjs +1 -0
- package/dist/features/machines/runtime.d.ts +18 -0
- package/dist/features/machines/runtime.js +363 -0
- package/dist/features/machines/runtime.js.map +7 -0
- package/dist/features/machines/types.d.ts +164 -0
- package/dist/features/physics/2d-geometry.d.ts +3 -3
- package/dist/features/physics/2d-geometry.js.map +1 -1
- package/dist/features/physics/2d.d.ts +115 -62
- package/dist/features/physics/2d.js +59 -28
- package/dist/features/physics/2d.js.map +2 -2
- package/dist/features/physics/lib/2d/query-types.d.ts +6 -0
- package/dist/features/physics/lib/2d/runtime/controller.d.ts +7 -6
- package/dist/features/physics/lib/2d/runtime/controller.js.map +2 -2
- package/dist/features/physics/lib/2d/types.d.ts +8 -30
- package/dist/features/physics/lib/2d/world/queries.d.ts +7 -6
- package/dist/features/physics/lib/2d/world/queries.js.map +2 -2
- package/dist/features/sprites/formats/aseprite.d.ts +5 -0
- package/dist/features/sprites/formats/texture-packer.d.ts +5 -0
- package/dist/features/sprites/index.d.ts +6 -0
- package/dist/features/sprites/loader.d.ts +25 -0
- package/dist/features/sprites/model.d.ts +75 -0
- package/dist/features/sprites/sprite.d.ts +22 -0
- 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 +15 -20
- 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 +39 -0
- package/dist/features/textures/lib/gray-scott.js.map +7 -0
- 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/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/viz/index.d.ts +79 -5
- package/dist/features/viz/index.js +145 -4
- 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-labels.d.ts +2 -0
- package/dist/features/viz/lib/axis-labels.js +41 -0
- package/dist/features/viz/lib/axis-labels.js.map +7 -0
- package/dist/features/viz/lib/axis-title.d.ts +23 -0
- package/dist/features/viz/lib/axis-title.js +23 -0
- package/dist/features/viz/lib/axis-title.js.map +7 -0
- package/dist/features/viz/lib/axis.d.ts +1 -1
- package/dist/features/viz/lib/axis.js +50 -50
- package/dist/features/viz/lib/axis.js.map +2 -2
- package/dist/features/viz/lib/bar-scale.d.ts +7 -0
- package/dist/features/viz/lib/bar-scale.js +34 -0
- package/dist/features/viz/lib/bar-scale.js.map +7 -0
- package/dist/features/viz/lib/bar-series.d.ts +3 -1
- package/dist/features/viz/lib/bar-series.js +21 -5
- 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/chart-lines.d.ts +41 -0
- package/dist/features/viz/lib/chart-lines.js +32 -0
- package/dist/features/viz/lib/chart-lines.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 +148 -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/hover-data.d.ts +1 -1
- package/dist/features/viz/lib/hover-data.js +6 -3
- package/dist/features/viz/lib/hover-data.js.map +2 -2
- package/dist/features/viz/lib/hover-types.d.ts +5 -5
- 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 +124 -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/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-component.d.ts +7 -0
- package/dist/features/viz/lib/linear-scale-component.js +18 -0
- package/dist/features/viz/lib/linear-scale-component.js.map +7 -0
- 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/log-scale-component.d.ts +7 -0
- package/dist/features/viz/lib/log-scale-component.js +19 -0
- package/dist/features/viz/lib/log-scale-component.js.map +7 -0
- package/dist/features/viz/lib/log-scale.d.ts +2 -0
- package/dist/features/viz/lib/log-scale.js +53 -0
- package/dist/features/viz/lib/log-scale.js.map +7 -0
- 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/nearest.d.ts +9 -9
- package/dist/features/viz/lib/nearest.js.map +1 -1
- 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/numeric-ticks.d.ts +38 -0
- package/dist/features/viz/lib/numeric-ticks.js +54 -0
- package/dist/features/viz/lib/numeric-ticks.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/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-scale-component.d.ts +7 -0
- package/dist/features/viz/lib/point-scale-component.js +19 -0
- package/dist/features/viz/lib/point-scale-component.js.map +7 -0
- package/dist/features/viz/lib/point-scale.d.ts +2 -0
- package/dist/features/viz/lib/point-scale.js +45 -0
- package/dist/features/viz/lib/point-scale.js.map +7 -0
- 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.d.ts +16 -0
- package/dist/features/viz/lib/reference-band.js +27 -0
- package/dist/features/viz/lib/reference-band.js.map +7 -0
- package/dist/features/viz/lib/scale-adjust.js +9 -4
- package/dist/features/viz/lib/scale-adjust.js.map +2 -2
- package/dist/features/viz/lib/scale-context.d.ts +5 -4
- package/dist/features/viz/lib/scale-context.js +15 -11
- package/dist/features/viz/lib/scale-context.js.map +2 -2
- package/dist/features/viz/lib/scale-provider.d.ts +2 -0
- package/dist/features/viz/lib/scale-provider.js +13 -0
- package/dist/features/viz/lib/scale-provider.js.map +7 -0
- package/dist/features/viz/lib/scale-ticks.d.ts +5 -0
- package/dist/features/viz/lib/scale-ticks.js +64 -0
- package/dist/features/viz/lib/scale-ticks.js.map +7 -0
- package/dist/features/viz/lib/scale-view.d.ts +4 -0
- package/dist/features/viz/lib/scale-view.js +21 -0
- package/dist/features/viz/lib/scale-view.js.map +7 -0
- 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/symlog-scale-component.d.ts +7 -0
- package/dist/features/viz/lib/symlog-scale-component.js +19 -0
- package/dist/features/viz/lib/symlog-scale-component.js.map +7 -0
- package/dist/features/viz/lib/symlog-scale.d.ts +2 -0
- package/dist/features/viz/lib/symlog-scale.js +38 -0
- package/dist/features/viz/lib/symlog-scale.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 +114 -21
- package/dist/features/viz/lib/use-bar-scale.d.ts +8 -0
- package/dist/features/viz/lib/use-bar-scale.js +9 -0
- package/dist/features/viz/lib/use-bar-scale.js.map +7 -0
- package/dist/features/viz/lib/use-continuous-scale.d.ts +8 -0
- package/dist/features/viz/lib/use-continuous-scale.js +14 -0
- package/dist/features/viz/lib/use-continuous-scale.js.map +7 -0
- package/dist/features/viz/lib/use-linear-scale.d.ts +8 -0
- package/dist/features/viz/lib/use-linear-scale.js +9 -0
- package/dist/features/viz/lib/use-linear-scale.js.map +7 -0
- package/dist/features/viz/lib/use-log-scale.d.ts +8 -0
- package/dist/features/viz/lib/use-log-scale.js +9 -0
- package/dist/features/viz/lib/use-log-scale.js.map +7 -0
- package/dist/features/viz/lib/use-point-scale.d.ts +8 -0
- package/dist/features/viz/lib/use-point-scale.js +9 -0
- package/dist/features/viz/lib/use-point-scale.js.map +7 -0
- package/dist/features/viz/lib/use-symlog-scale.d.ts +8 -0
- package/dist/features/viz/lib/use-symlog-scale.js +9 -0
- package/dist/features/viz/lib/use-symlog-scale.js.map +7 -0
- package/dist/features/viz/lib/use-utc-scale.d.ts +8 -0
- package/dist/features/viz/lib/use-utc-scale.js +9 -0
- package/dist/features/viz/lib/use-utc-scale.js.map +7 -0
- package/dist/features/viz/lib/utc-labels.d.ts +12 -0
- package/dist/features/viz/lib/utc-labels.js +27 -0
- package/dist/features/viz/lib/utc-labels.js.map +7 -0
- package/dist/features/viz/lib/utc-scale-component.d.ts +7 -0
- package/dist/features/viz/lib/utc-scale-component.js +18 -0
- package/dist/features/viz/lib/utc-scale-component.js.map +7 -0
- package/dist/features/viz/lib/utc-scale.d.ts +21 -0
- package/dist/features/viz/lib/utc-scale.js +123 -0
- package/dist/features/viz/lib/utc-scale.js.map +7 -0
- 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/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 +106 -0
- package/dist/filters/emboss.js.map +7 -0
- 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-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 +2 -0
- package/dist/filters.js +2 -0
- package/dist/filters.js.map +2 -2
- package/dist/index.d.ts +3 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +2 -2
- package/dist/internal.d.ts +2 -0
- package/dist/internal.js +4 -0
- package/dist/internal.js.map +2 -2
- package/dist/lib/animation/definition.d.ts +5 -3
- package/dist/lib/animation/definition.js +29 -4
- package/dist/lib/animation/definition.js.map +2 -2
- package/dist/lib/animation/playback.d.ts +8 -0
- package/dist/lib/animation/playback.js +33 -11
- package/dist/lib/animation/playback.js.map +2 -2
- package/dist/lib/animation/spring.d.ts +3 -1
- package/dist/lib/animation/spring.js.map +2 -2
- package/dist/lib/animation/types.d.ts +29 -73
- package/dist/lib/events/event-facade.d.ts +13 -0
- package/dist/lib/events/event-facade.js +23 -0
- package/dist/lib/events/event-facade.js.map +2 -2
- package/dist/lib/events/propagation.js +19 -14
- package/dist/lib/events/propagation.js.map +2 -2
- package/dist/lib/execute-render.js +13 -0
- package/dist/lib/execute-render.js.map +2 -2
- package/dist/lib/hooks/use-animated-value.d.ts +11 -21
- package/dist/lib/hooks/use-animated-value.js +23 -70
- package/dist/lib/hooks/use-animated-value.js.map +3 -3
- package/dist/lib/hooks/use-playback.js +1 -0
- package/dist/lib/hooks/use-playback.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-transaction.d.ts +5 -2
- package/dist/lib/render-transaction.js +23 -1
- package/dist/lib/render-transaction.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/types.d.ts +6 -0
- package/package.json +27 -5
- package/dist/features/viz/lib/scale.d.ts +0 -11
- package/dist/features/viz/lib/scale.js +0 -80
- package/dist/features/viz/lib/scale.js.map +0 -7
- package/dist/features/viz/lib/use-scale.d.ts +0 -20
- package/dist/features/viz/lib/use-scale.js +0 -10
- package/dist/features/viz/lib/use-scale.js.map +0 -7
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { jsx } from "@pibbl/core/jsx-runtime";
|
|
2
|
+
import { useNumericPosition } from "./series-position.js";
|
|
3
|
+
import {
|
|
4
|
+
Group,
|
|
5
|
+
Path,
|
|
6
|
+
resolveSignalValue
|
|
7
|
+
} from "@pibbl/core";
|
|
8
|
+
import { withHooksForbidden } from "@pibbl/core/internal";
|
|
9
|
+
import { useContinuousScale } from "./use-continuous-scale.js";
|
|
10
|
+
import { pointAccessor, pointData, finiteCoordinate } from "./point-data.js";
|
|
11
|
+
import { financialMarkWidth, volumeGeometry } from "./financial-geometry.js";
|
|
12
|
+
import { opacity, width } from "./paint.js";
|
|
13
|
+
function VolumeSeries({
|
|
14
|
+
data: input,
|
|
15
|
+
time: timeInput,
|
|
16
|
+
volume: volumeInput,
|
|
17
|
+
xScale,
|
|
18
|
+
yScale,
|
|
19
|
+
defined,
|
|
20
|
+
style: styleInput,
|
|
21
|
+
inspection,
|
|
22
|
+
pointerEvents,
|
|
23
|
+
...events
|
|
24
|
+
}) {
|
|
25
|
+
const xs = useNumericPosition(xScale), ys = useContinuousScale(yScale).get();
|
|
26
|
+
const data = pointData(resolveSignalValue(input), "VolumeSeries");
|
|
27
|
+
const time = pointAccessor(timeInput), volume = pointAccessor(volumeInput);
|
|
28
|
+
const rows = [];
|
|
29
|
+
for (let i = 0; i < data.length; i++) {
|
|
30
|
+
const datum = data[i];
|
|
31
|
+
if (defined && !defined(datum, i, data)) continue;
|
|
32
|
+
const t = time(datum, i, data), v = volume(datum, i, data);
|
|
33
|
+
if (!finiteCoordinate(t) || !finiteCoordinate(v)) continue;
|
|
34
|
+
if (v < 0)
|
|
35
|
+
throw new RangeError(
|
|
36
|
+
`VolumeSeries: negative volume at source index ${i}.`
|
|
37
|
+
);
|
|
38
|
+
rows.push({
|
|
39
|
+
datum,
|
|
40
|
+
sourceIndex: i,
|
|
41
|
+
time: t,
|
|
42
|
+
volume: v,
|
|
43
|
+
x: xs.map(t),
|
|
44
|
+
y: ys.map(v)
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
const positions = rows.map((row) => row.x), baselineY = ys.map(0), defaultWidth = financialMarkWidth(positions);
|
|
48
|
+
const specified = typeof styleInput === "function" ? styleInput : resolveSignalValue(styleInput);
|
|
49
|
+
const marks = inspection ? [] : void 0;
|
|
50
|
+
const batches = [];
|
|
51
|
+
for (const row of rows) {
|
|
52
|
+
const style = typeof specified === "function" ? withHooksForbidden(
|
|
53
|
+
"VolumeSeries style callback",
|
|
54
|
+
() => specified(row.datum, row.sourceIndex, data)
|
|
55
|
+
) : specified ?? {};
|
|
56
|
+
const markWidth = style.width === void 0 ? defaultWidth : financialMarkWidth([], { width: style.width });
|
|
57
|
+
const b = volumeGeometry({
|
|
58
|
+
centerX: row.x,
|
|
59
|
+
valueY: row.y,
|
|
60
|
+
baselineY,
|
|
61
|
+
width: markWidth
|
|
62
|
+
});
|
|
63
|
+
const fill = style.fill ?? "#087f8c", stroke = style.stroke, strokeWidth = width(style.strokeWidth ?? 1, "VolumeSeries"), alpha = opacity(style.opacity ?? 1, "VolumeSeries");
|
|
64
|
+
marks?.push(
|
|
65
|
+
Object.freeze({
|
|
66
|
+
datum: row.datum,
|
|
67
|
+
sourceIndex: row.sourceIndex,
|
|
68
|
+
time: row.time,
|
|
69
|
+
volume: row.volume,
|
|
70
|
+
baseline: 0,
|
|
71
|
+
anchorLocal: Object.freeze({ x: row.x, y: row.y }),
|
|
72
|
+
boundsLocal: b,
|
|
73
|
+
fill: !!fill && alpha > 0,
|
|
74
|
+
strokeWidthLocal: stroke && alpha > 0 ? strokeWidth : 0
|
|
75
|
+
})
|
|
76
|
+
);
|
|
77
|
+
if (b.height === 0 || alpha === 0) continue;
|
|
78
|
+
let batch = batches.at(-1);
|
|
79
|
+
const half = stroke ? strokeWidth / 2 : 0, minX = b.x - half, maxX = b.x + b.width + half;
|
|
80
|
+
if (!batch || minX < batch.maxX && maxX > batch.minX || batch.fill !== fill || batch.stroke !== stroke || batch.strokeWidth !== strokeWidth || batch.opacity !== alpha || batch.cursor !== style.cursor) {
|
|
81
|
+
batch = {
|
|
82
|
+
path: new Path2D(),
|
|
83
|
+
fill,
|
|
84
|
+
stroke,
|
|
85
|
+
strokeWidth,
|
|
86
|
+
opacity: alpha,
|
|
87
|
+
cursor: style.cursor,
|
|
88
|
+
minX,
|
|
89
|
+
maxX
|
|
90
|
+
};
|
|
91
|
+
batches.push(batch);
|
|
92
|
+
}
|
|
93
|
+
batch.minX = Math.min(batch.minX, minX);
|
|
94
|
+
batch.maxX = Math.max(batch.maxX, maxX);
|
|
95
|
+
batch.path.rect(b.x, b.y, b.width, b.height);
|
|
96
|
+
}
|
|
97
|
+
inspection?.capture({ marks, xScale: xs, yScale: ys });
|
|
98
|
+
return /* @__PURE__ */ jsx(Group, { ...events, children: batches.map((batch, index) => /* @__PURE__ */ jsx(
|
|
99
|
+
Path,
|
|
100
|
+
{
|
|
101
|
+
pointerEvents,
|
|
102
|
+
style: {
|
|
103
|
+
d: batch.path,
|
|
104
|
+
fill: batch.fill,
|
|
105
|
+
stroke: batch.stroke,
|
|
106
|
+
strokeWidth: batch.strokeWidth,
|
|
107
|
+
opacity: batch.opacity,
|
|
108
|
+
cursor: batch.cursor
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
index
|
|
112
|
+
)) });
|
|
113
|
+
}
|
|
114
|
+
export {
|
|
115
|
+
VolumeSeries
|
|
116
|
+
};
|
|
117
|
+
//# sourceMappingURL=volume-series.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/features/viz/lib/volume-series.tsx"],
|
|
4
|
+
"sourcesContent": ["import { useNumericPosition } from \"./series-position.js\";\nimport {\n Group,\n Path,\n resolveSignalValue,\n type FillStyle,\n type StrokeStyle,\n type SignalValue,\n type PibblEventHandlers,\n type PibblEventParticipationOptions,\n type PibblNode,\n} from \"@pibbl/core\";\nimport { withHooksForbidden } from \"@pibbl/core/internal\";\nimport type { LineAccessor, ScaleId } from \"./types.js\";\nimport type {\n VolumeInspectionRef,\n CapturedVolumeMark,\n} from \"../inspection/volume.js\";\nimport { useContinuousScale } from \"./use-continuous-scale.js\";\nimport { pointAccessor, pointData, finiteCoordinate } from \"./point-data.js\";\nimport { financialMarkWidth, volumeGeometry } from \"./financial-geometry.js\";\nimport { opacity, width } from \"./paint.js\";\n\n/** Local column presentation; color meaning is supplied by the application.\n * @see {@link VolumeSeries}\n */\nexport interface VolumeSeriesStyle {\n /** Positive column width in local logical units; default 70% spacing capped at 12. */\n readonly width?: number;\n /** Interior paint; defaults to teal. */\n readonly fill?: FillStyle;\n /** Optional column outline paint. */\n readonly stroke?: StrokeStyle;\n /** Nonnegative outline width in local units; default 1. */\n readonly strokeWidth?: number;\n /** Paint opacity from zero through one; default 1. */\n readonly opacity?: number;\n /** Cursor when the series owns coordinate targeting. */\n readonly cursor?: string;\n}\n/** Time-aligned volume columns with an independent numeric y-scale.\n * @see {@link VolumeSeries}\n */\nexport interface VolumeSeriesProps<D>\n extends PibblEventHandlers, PibblEventParticipationOptions {\n /** Original records or a signal of records; never sorted or mutated. */\n readonly data: SignalValue<readonly D[]>;\n /** UTC-millisecond property or callback; missing/nonfinite values skip the row. */\n readonly time: LineAccessor<D>;\n /** Nonnegative volume property or callback; missing/nonfinite values skip the row. */\n readonly volume: LineAccessor<D>;\n /** Selects source records before evaluating accessors.\n * @param datum - Original record.\n * @param index - Original source index.\n * @param data - Complete source array.\n * @returns Whether the row participates.\n */\n readonly defined?: (datum: D, index: number, data: readonly D[]) => boolean;\n /** Numeric time scale identity. */\n readonly xScale: ScaleId;\n /** Independent numeric volume scale identity; the baseline is zero. */\n readonly yScale: ScaleId;\n /** Constant presentation or a hook-free per-record resolver.\n * @param datum - Original record.\n * @param index - Original source index.\n * @param data - Complete source array.\n * @returns Column presentation.\n */\n readonly style?:\n | SignalValue<VolumeSeriesStyle>\n | ((datum: D, index: number, data: readonly D[]) => VolumeSeriesStyle);\n /** Optional committed capture; importing the renderer does not import inspection queries. */\n readonly inspection?: VolumeInspectionRef<D>;\n}\n/**\n * Paints source-ordered time-aligned volume columns, batching adjacent equal styles.\n * Zero volume is recorded but has no painted coverage. Finite negative volume rejects.\n * @param props - Original records, numeric scales, accessors and optional capture.\n * @returns Ordinary Pibbl paint/event composition.\n * @see {@link VolumeSeriesProps}\n */\nexport function VolumeSeries<D>({\n data: input,\n time: timeInput,\n volume: volumeInput,\n xScale,\n yScale,\n defined,\n style: styleInput,\n inspection,\n pointerEvents,\n ...events\n}: VolumeSeriesProps<D>): PibblNode {\n const xs = useNumericPosition(xScale),\n ys = useContinuousScale(yScale).get();\n const data = pointData(resolveSignalValue(input), \"VolumeSeries\");\n const time = pointAccessor(timeInput),\n volume = pointAccessor(volumeInput);\n const rows: {\n datum: D;\n sourceIndex: number;\n time: number;\n volume: number;\n x: number;\n y: number;\n }[] = [];\n for (let i = 0; i < data.length; i++) {\n const datum = data[i];\n if (defined && !defined(datum, i, data)) continue;\n const t = time(datum, i, data),\n v = volume(datum, i, data);\n if (!finiteCoordinate(t) || !finiteCoordinate(v)) continue;\n if (v < 0)\n throw new RangeError(\n `VolumeSeries: negative volume at source index ${i}.`,\n );\n rows.push({\n datum,\n sourceIndex: i,\n time: t,\n volume: v,\n x: xs.map(t),\n y: ys.map(v),\n });\n }\n const positions = rows.map((row) => row.x),\n baselineY = ys.map(0),\n defaultWidth = financialMarkWidth(positions);\n const specified =\n typeof styleInput === \"function\"\n ? styleInput\n : resolveSignalValue(styleInput);\n const marks: CapturedVolumeMark<D>[] | undefined = inspection\n ? []\n : undefined;\n const batches: {\n path: Path2D;\n fill: FillStyle;\n stroke: StrokeStyle | undefined;\n strokeWidth: number;\n opacity: number;\n cursor: string | undefined;\n minX: number;\n maxX: number;\n }[] = [];\n for (const row of rows) {\n const style =\n typeof specified === \"function\"\n ? withHooksForbidden(\"VolumeSeries style callback\", () =>\n specified(row.datum, row.sourceIndex, data),\n )\n : (specified ?? {});\n const markWidth =\n style.width === undefined\n ? defaultWidth\n : financialMarkWidth([], { width: style.width });\n const b = volumeGeometry({\n centerX: row.x,\n valueY: row.y,\n baselineY,\n width: markWidth,\n });\n const fill = style.fill ?? \"#087f8c\",\n stroke = style.stroke,\n strokeWidth = width(style.strokeWidth ?? 1, \"VolumeSeries\"),\n alpha = opacity(style.opacity ?? 1, \"VolumeSeries\");\n marks?.push(\n Object.freeze({\n datum: row.datum,\n sourceIndex: row.sourceIndex,\n time: row.time,\n volume: row.volume,\n baseline: 0,\n anchorLocal: Object.freeze({ x: row.x, y: row.y }),\n boundsLocal: b,\n fill: !!fill && alpha > 0,\n strokeWidthLocal: stroke && alpha > 0 ? strokeWidth : 0,\n }),\n );\n if (b.height === 0 || alpha === 0) continue;\n let batch = batches.at(-1);\n const half = stroke ? strokeWidth / 2 : 0,\n minX = b.x - half,\n maxX = b.x + b.width + half;\n if (\n !batch ||\n (minX < batch.maxX && maxX > batch.minX) ||\n batch.fill !== fill ||\n batch.stroke !== stroke ||\n batch.strokeWidth !== strokeWidth ||\n batch.opacity !== alpha ||\n batch.cursor !== style.cursor\n ) {\n batch = {\n path: new Path2D(),\n fill,\n stroke,\n strokeWidth,\n opacity: alpha,\n cursor: style.cursor,\n minX,\n maxX,\n };\n batches.push(batch);\n }\n batch.minX = Math.min(batch.minX, minX);\n batch.maxX = Math.max(batch.maxX, maxX);\n batch.path.rect(b.x, b.y, b.width, b.height);\n }\n inspection?.capture({ marks: marks!, xScale: xs, yScale: ys });\n return (\n <Group {...events}>\n {batches.map((batch, index) => (\n <Path\n key={index}\n pointerEvents={pointerEvents}\n style={{\n d: batch.path,\n fill: batch.fill,\n stroke: batch.stroke,\n strokeWidth: batch.strokeWidth,\n opacity: batch.opacity,\n cursor: batch.cursor,\n }}\n />\n ))}\n </Group>\n );\n}\n"],
|
|
5
|
+
"mappings": "AAqNQ;AArNR,SAAS,0BAA0B;AACnC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OAOK;AACP,SAAS,0BAA0B;AAMnC,SAAS,0BAA0B;AACnC,SAAS,eAAe,WAAW,wBAAwB;AAC3D,SAAS,oBAAoB,sBAAsB;AACnD,SAAS,SAAS,aAAa;AA4DxB,SAAS,aAAgB;AAAA,EAC9B,MAAM;AAAA,EACN,MAAM;AAAA,EACN,QAAQ;AAAA,EACR;AAAA,EACA;AAAA,EACA;AAAA,EACA,OAAO;AAAA,EACP;AAAA,EACA;AAAA,EACA,GAAG;AACL,GAAoC;AAClC,QAAM,KAAK,mBAAmB,MAAM,GAClC,KAAK,mBAAmB,MAAM,EAAE,IAAI;AACtC,QAAM,OAAO,UAAU,mBAAmB,KAAK,GAAG,cAAc;AAChE,QAAM,OAAO,cAAc,SAAS,GAClC,SAAS,cAAc,WAAW;AACpC,QAAM,OAOA,CAAC;AACP,WAAS,IAAI,GAAG,IAAI,KAAK,QAAQ,KAAK;AACpC,UAAM,QAAQ,KAAK,CAAC;AACpB,QAAI,WAAW,CAAC,QAAQ,OAAO,GAAG,IAAI,EAAG;AACzC,UAAM,IAAI,KAAK,OAAO,GAAG,IAAI,GAC3B,IAAI,OAAO,OAAO,GAAG,IAAI;AAC3B,QAAI,CAAC,iBAAiB,CAAC,KAAK,CAAC,iBAAiB,CAAC,EAAG;AAClD,QAAI,IAAI;AACN,YAAM,IAAI;AAAA,QACR,iDAAiD,CAAC;AAAA,MACpD;AACF,SAAK,KAAK;AAAA,MACR;AAAA,MACA,aAAa;AAAA,MACb,MAAM;AAAA,MACN,QAAQ;AAAA,MACR,GAAG,GAAG,IAAI,CAAC;AAAA,MACX,GAAG,GAAG,IAAI,CAAC;AAAA,I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OAAO,EAAE,IAAI,MACb,OAAO,EAAE,IAAI,EAAE,QAAQ;AACzB,QACE,CAAC,SACA,OAAO,MAAM,QAAQ,OAAO,MAAM,QACnC,MAAM,SAAS,QACf,MAAM,WAAW,UACjB,MAAM,gBAAgB,eACtB,MAAM,YAAY,SAClB,MAAM,WAAW,MAAM,QACvB;AACA,cAAQ;AAAA,QACN,MAAM,IAAI,OAAO;AAAA,QACjB;AAAA,QACA;AAAA,QACA;AAAA,QACA,SAAS;AAAA,QACT,QAAQ,MAAM;AAAA,QACd;AAAA,QACA;AAAA,MACF;AACA,cAAQ,KAAK,KAAK;AAAA,IACpB;AACA,UAAM,OAAO,KAAK,IAAI,MAAM,MAAM,IAAI;AACtC,UAAM,OAAO,KAAK,IAAI,MAAM,MAAM,IAAI;AACtC,UAAM,KAAK,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM;AAAA,EAC7C;AACA,cAAY,QAAQ,EAAE,OAAe,QAAQ,IAAI,QAAQ,GAAG,CAAC;AAC7D,SACE,oBAAC,SAAO,GAAG,QACR,kBAAQ,IAAI,CAAC,OAAO,UACnB;AAAA,IAAC;AAAA;AAAA,MAEC;AAAA,MACA,OAAO;AAAA,QACL,GAAG,MAAM;AAAA,QACT,MAAM,MAAM;AAAA,QACZ,QAAQ,MAAM;AAAA,QACd,aAAa,MAAM;AAAA,QACnB,SAAS,MAAM;AAAA,QACf,QAAQ,MAAM;AAAA,MAChB;AAAA;AAAA,IATK;AAAA,EAUP,CACD,GACH;AAEJ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import type { FillStyle, PibblEventHandlers, PibblEventParticipationOptions, SignalValue, StrokeStyle } from "@pibbl/core";
|
|
2
|
+
import type { SignalStyle } from "@pibbl/core/internal";
|
|
3
|
+
import type { LineAccessor, ScaleId, SeriesAccessor } from "./types.js";
|
|
4
|
+
/**
|
|
5
|
+
* A data property or callback extracting a nonnegative research weight.
|
|
6
|
+
*
|
|
7
|
+
* @see {@link WeightedPointSeriesProps}
|
|
8
|
+
*/
|
|
9
|
+
export type WeightAccessor<D> = LineAccessor<D>;
|
|
10
|
+
/** Shared presentation for {@link WeightedPointSeries}. */
|
|
11
|
+
export interface WeightedPointSeriesStyle {
|
|
12
|
+
/** Paint used for point interiors. Defaults to `#087f8c`. */
|
|
13
|
+
readonly fill?: FillStyle;
|
|
14
|
+
/** Paint used for point outlines. Defaults to no outline. */
|
|
15
|
+
readonly stroke?: StrokeStyle;
|
|
16
|
+
/** Outline width in local coordinate units. Defaults to 1. */
|
|
17
|
+
readonly strokeWidth?: number;
|
|
18
|
+
/** Opacity in the inclusive range [0, 1]. Defaults to 1. */
|
|
19
|
+
readonly opacity?: number;
|
|
20
|
+
/** Pointer cursor while the series owns a target. */
|
|
21
|
+
readonly cursor?: string;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Authored inputs for {@link WeightedPointSeries}.
|
|
25
|
+
*
|
|
26
|
+
* Weights are supplied data, not calculated precision, sample size, or evidence.
|
|
27
|
+
* The zero baseline and squared-radius interpolation make displayed area linear in
|
|
28
|
+
* the supplied weight.
|
|
29
|
+
*/
|
|
30
|
+
export interface WeightedPointSeriesProps<D> extends PibblEventHandlers, PibblEventParticipationOptions {
|
|
31
|
+
/** Readonly data or a signal containing it. */
|
|
32
|
+
readonly data: SignalValue<readonly D[]>;
|
|
33
|
+
/** Horizontal coordinate property or synchronous accessor. */
|
|
34
|
+
readonly x: SeriesAccessor<D>;
|
|
35
|
+
/** Vertical coordinate property or synchronous accessor. */
|
|
36
|
+
readonly y: SeriesAccessor<D>;
|
|
37
|
+
/** Nonnegative supplied weight property or synchronous accessor. */
|
|
38
|
+
readonly weight: WeightAccessor<D>;
|
|
39
|
+
/** Scale used to map x coordinates. */
|
|
40
|
+
readonly xScale: ScaleId;
|
|
41
|
+
/** Scale used to map y coordinates. */
|
|
42
|
+
readonly yScale: ScaleId;
|
|
43
|
+
/** Supplied inclusive weight extent. The lower bound must be zero. */
|
|
44
|
+
readonly weightDomain: readonly [0, number];
|
|
45
|
+
/** Radius extent `[0, maximumRadius]`; defaults to `[0, 6]`. */
|
|
46
|
+
readonly radiusRange?: readonly [0, number];
|
|
47
|
+
/**
|
|
48
|
+
* Excludes a datum before coordinate and weight accessors run.
|
|
49
|
+
* @param datum - Candidate source datum.
|
|
50
|
+
* @param index - Zero-based source index.
|
|
51
|
+
* @param data - Complete source data array.
|
|
52
|
+
* @returns Whether this datum contributes a mark.
|
|
53
|
+
*/
|
|
54
|
+
readonly defined?: (datum: D, index: number, data: readonly D[]) => boolean;
|
|
55
|
+
/** Shared presentation. Whole-object and shallow field signals are supported. */
|
|
56
|
+
readonly style?: SignalValue<SignalStyle<WeightedPointSeriesStyle>>;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Draws batched circles whose visible area is proportional to supplied weights.
|
|
60
|
+
*
|
|
61
|
+
* Nullish weights and zero weights omit their marks. Finite positive weights must
|
|
62
|
+
* fall inside `weightDomain`; the component never clamps or infers weights.
|
|
63
|
+
* `data` and shared style signals schedule ordinary Pibbl updates. The component
|
|
64
|
+
* owns no retained resources and returns one ordinary Pibbl pointer target.
|
|
65
|
+
*
|
|
66
|
+
* @param props - Supplied observations, coordinate and weight accessors, scales, and paint.
|
|
67
|
+
* See {@link WeightedPointSeriesProps}.
|
|
68
|
+
* @returns One batched Pibbl Path whose mark area is proportional to each supplied weight.
|
|
69
|
+
* @see {@link WeightedPointSeriesProps}
|
|
70
|
+
*/
|
|
71
|
+
export declare function WeightedPointSeries<D>({ data: input, x: xInput, y: yInput, weight: weightInput, xScale: xId, yScale: yId, weightDomain, radiusRange, defined, style: styleInput, ...events }: WeightedPointSeriesProps<D>): import("../../../jsx-runtime.js").JSX.Element;
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import { jsx } from "@pibbl/core/jsx-runtime";
|
|
2
|
+
import { resolveTexturePaint } from "@pibbl/core/internal";
|
|
3
|
+
import { Path, resolveSignalValue, useCanvasContext } from "@pibbl/core";
|
|
4
|
+
import { validateTexturePaint, withHooksForbidden } from "@pibbl/core/internal";
|
|
5
|
+
import { pointAccessor, pointData } from "./point-data.js";
|
|
6
|
+
import { appendPointTarget, pointPath } from "./point-geometry.js";
|
|
7
|
+
import { opacity, width } from "./paint.js";
|
|
8
|
+
import {
|
|
9
|
+
mapSeriesPosition,
|
|
10
|
+
seriesAccessor,
|
|
11
|
+
useSeriesPosition
|
|
12
|
+
} from "./series-position.js";
|
|
13
|
+
const fields = ["fill", "stroke", "strokeWidth", "opacity", "cursor"];
|
|
14
|
+
function paint(value, name) {
|
|
15
|
+
if (value === void 0 || typeof value === "string" || value instanceof CanvasGradient || value instanceof CanvasPattern)
|
|
16
|
+
return value;
|
|
17
|
+
try {
|
|
18
|
+
validateTexturePaint(value);
|
|
19
|
+
return value;
|
|
20
|
+
} catch {
|
|
21
|
+
}
|
|
22
|
+
throw new TypeError(`WeightedPointSeries: invalid ${name}.`);
|
|
23
|
+
}
|
|
24
|
+
function styleObject(input) {
|
|
25
|
+
if (input === null || typeof input !== "object" || Array.isArray(input))
|
|
26
|
+
throw new TypeError("WeightedPointSeries: style must be an object.");
|
|
27
|
+
const result = {};
|
|
28
|
+
for (const key of Object.keys(input)) {
|
|
29
|
+
if (!fields.includes(key))
|
|
30
|
+
throw new TypeError(
|
|
31
|
+
`WeightedPointSeries: unsupported style field ${key}.`
|
|
32
|
+
);
|
|
33
|
+
result[key] = resolveSignalValue(input[key]);
|
|
34
|
+
}
|
|
35
|
+
return result;
|
|
36
|
+
}
|
|
37
|
+
function normalized(style) {
|
|
38
|
+
if (style.cursor !== void 0 && typeof style.cursor !== "string")
|
|
39
|
+
throw new TypeError("WeightedPointSeries: cursor must be a string.");
|
|
40
|
+
return {
|
|
41
|
+
fill: paint(style.fill ?? "#087f8c", "fill"),
|
|
42
|
+
stroke: paint(style.stroke, "stroke"),
|
|
43
|
+
strokeWidth: width(
|
|
44
|
+
style.strokeWidth ?? 1,
|
|
45
|
+
"WeightedPointSeries strokeWidth"
|
|
46
|
+
),
|
|
47
|
+
opacity: opacity(style.opacity ?? 1, "WeightedPointSeries opacity"),
|
|
48
|
+
cursor: style.cursor
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
function range(value) {
|
|
52
|
+
const actual = value ?? [0, 6];
|
|
53
|
+
if (!Array.isArray(actual) || actual.length !== 2 || actual[0] !== 0 || !Number.isFinite(actual[1]) || actual[1] < 0)
|
|
54
|
+
throw new RangeError(
|
|
55
|
+
"WeightedPointSeries: radiusRange must be [0, a finite nonnegative maximum]."
|
|
56
|
+
);
|
|
57
|
+
return actual;
|
|
58
|
+
}
|
|
59
|
+
function domain(value) {
|
|
60
|
+
if (!Array.isArray(value) || value.length !== 2 || value[0] !== 0 || !Number.isFinite(value[1]) || value[1] <= 0)
|
|
61
|
+
throw new RangeError(
|
|
62
|
+
"WeightedPointSeries: weightDomain must be [0, a finite positive maximum]."
|
|
63
|
+
);
|
|
64
|
+
return value;
|
|
65
|
+
}
|
|
66
|
+
function WeightedPointSeries({
|
|
67
|
+
data: input,
|
|
68
|
+
x: xInput,
|
|
69
|
+
y: yInput,
|
|
70
|
+
weight: weightInput,
|
|
71
|
+
xScale: xId,
|
|
72
|
+
yScale: yId,
|
|
73
|
+
weightDomain,
|
|
74
|
+
radiusRange,
|
|
75
|
+
defined,
|
|
76
|
+
style: styleInput,
|
|
77
|
+
...events
|
|
78
|
+
}) {
|
|
79
|
+
const xs = useSeriesPosition(xId);
|
|
80
|
+
const ys = useSeriesPosition(yId);
|
|
81
|
+
const data = pointData(resolveSignalValue(input), "WeightedPointSeries");
|
|
82
|
+
const x = seriesAccessor(xInput);
|
|
83
|
+
const y = seriesAccessor(yInput);
|
|
84
|
+
const weight = pointAccessor(weightInput);
|
|
85
|
+
const [, maximumWeight] = domain(weightDomain);
|
|
86
|
+
const [, maximumRadius] = range(radiusRange);
|
|
87
|
+
const style = normalized(styleObject(resolveSignalValue(styleInput) ?? {}));
|
|
88
|
+
const ctx = useCanvasContext();
|
|
89
|
+
const target = new Path2D();
|
|
90
|
+
const marks = [];
|
|
91
|
+
for (let i = 0; i < data.length; i++) {
|
|
92
|
+
const datum = data[i];
|
|
93
|
+
const values = withHooksForbidden(
|
|
94
|
+
"WeightedPointSeries: accessors cannot call hooks.",
|
|
95
|
+
() => {
|
|
96
|
+
if (defined && !defined(datum, i, data)) return void 0;
|
|
97
|
+
return {
|
|
98
|
+
x: x(datum, i, data),
|
|
99
|
+
y: y(datum, i, data),
|
|
100
|
+
weight: weight(datum, i, data)
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
);
|
|
104
|
+
if (!values) continue;
|
|
105
|
+
const mappedX = mapSeriesPosition(xs, values.x);
|
|
106
|
+
const mappedY = mapSeriesPosition(ys, values.y);
|
|
107
|
+
if (mappedX === void 0 || mappedY === void 0) continue;
|
|
108
|
+
const supplied = values.weight;
|
|
109
|
+
if (supplied == null) continue;
|
|
110
|
+
if (typeof supplied !== "number" || !Number.isFinite(supplied))
|
|
111
|
+
throw new TypeError(
|
|
112
|
+
"WeightedPointSeries: weight must be a finite number."
|
|
113
|
+
);
|
|
114
|
+
if (supplied < 0)
|
|
115
|
+
throw new RangeError("WeightedPointSeries: weight must be nonnegative.");
|
|
116
|
+
if (supplied > maximumWeight)
|
|
117
|
+
throw new RangeError("WeightedPointSeries: weight exceeds weightDomain.");
|
|
118
|
+
if (supplied === 0 || maximumRadius === 0) continue;
|
|
119
|
+
const radius = maximumRadius * Math.sqrt(supplied / maximumWeight);
|
|
120
|
+
marks.push({ x: mappedX, y: mappedY, radius });
|
|
121
|
+
}
|
|
122
|
+
for (const { x: x2, y: y2, radius } of marks) {
|
|
123
|
+
appendPointTarget(
|
|
124
|
+
target,
|
|
125
|
+
x2,
|
|
126
|
+
y2,
|
|
127
|
+
radius,
|
|
128
|
+
!!style.fill,
|
|
129
|
+
style.stroke ? style.strokeWidth : 0
|
|
130
|
+
);
|
|
131
|
+
const path = pointPath(x2, y2, radius);
|
|
132
|
+
ctx.save();
|
|
133
|
+
try {
|
|
134
|
+
ctx.globalAlpha *= style.opacity;
|
|
135
|
+
if (style.fill) {
|
|
136
|
+
ctx.fillStyle = resolveTexturePaint(style.fill, ctx, {
|
|
137
|
+
x: x2 - radius,
|
|
138
|
+
y: y2 - radius,
|
|
139
|
+
width: radius * 2,
|
|
140
|
+
height: radius * 2
|
|
141
|
+
});
|
|
142
|
+
ctx.fill(path);
|
|
143
|
+
}
|
|
144
|
+
if (style.stroke && style.strokeWidth > 0) {
|
|
145
|
+
ctx.strokeStyle = resolveTexturePaint(style.stroke, ctx, {
|
|
146
|
+
x: x2 - radius,
|
|
147
|
+
y: y2 - radius,
|
|
148
|
+
width: radius * 2,
|
|
149
|
+
height: radius * 2
|
|
150
|
+
});
|
|
151
|
+
ctx.lineWidth = style.strokeWidth;
|
|
152
|
+
ctx.stroke(path);
|
|
153
|
+
}
|
|
154
|
+
} finally {
|
|
155
|
+
ctx.restore();
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
return /* @__PURE__ */ jsx(
|
|
159
|
+
Path,
|
|
160
|
+
{
|
|
161
|
+
...events,
|
|
162
|
+
style: { d: target, fill: "transparent", cursor: style.cursor }
|
|
163
|
+
}
|
|
164
|
+
);
|
|
165
|
+
}
|
|
166
|
+
export {
|
|
167
|
+
WeightedPointSeries
|
|
168
|
+
};
|
|
169
|
+
//# sourceMappingURL=weighted-point-series.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/features/viz/lib/weighted-point-series.tsx"],
|
|
4
|
+
"sourcesContent": ["import { resolveTexturePaint } from \"@pibbl/core/internal\";\nimport { Path, resolveSignalValue, useCanvasContext } from \"@pibbl/core\";\nimport type {\n FillStyle,\n PibblEventHandlers,\n PibblEventParticipationOptions,\n SignalValue,\n StrokeStyle,\n} from \"@pibbl/core\";\nimport type { SignalStyle } from \"@pibbl/core/internal\";\nimport { validateTexturePaint, withHooksForbidden } from \"@pibbl/core/internal\";\nimport type { LineAccessor, ScaleId, SeriesAccessor } from \"./types.js\";\nimport { pointAccessor, pointData } from \"./point-data.js\";\nimport { appendPointTarget, pointPath } from \"./point-geometry.js\";\nimport { opacity, width } from \"./paint.js\";\nimport {\n mapSeriesPosition,\n seriesAccessor,\n useSeriesPosition,\n} from \"./series-position.js\";\n\nconst fields = [\"fill\", \"stroke\", \"strokeWidth\", \"opacity\", \"cursor\"];\n\n/**\n * A data property or callback extracting a nonnegative research weight.\n *\n * @see {@link WeightedPointSeriesProps}\n */\nexport type WeightAccessor<D> = LineAccessor<D>;\n\n/** Shared presentation for {@link WeightedPointSeries}. */\nexport interface WeightedPointSeriesStyle {\n /** Paint used for point interiors. Defaults to `#087f8c`. */\n readonly fill?: FillStyle;\n /** Paint used for point outlines. Defaults to no outline. */\n readonly stroke?: StrokeStyle;\n /** Outline width in local coordinate units. Defaults to 1. */\n readonly strokeWidth?: number;\n /** Opacity in the inclusive range [0, 1]. Defaults to 1. */\n readonly opacity?: number;\n /** Pointer cursor while the series owns a target. */\n readonly cursor?: string;\n}\n\n/**\n * Authored inputs for {@link WeightedPointSeries}.\n *\n * Weights are supplied data, not calculated precision, sample size, or evidence.\n * The zero baseline and squared-radius interpolation make displayed area linear in\n * the supplied weight.\n */\nexport interface WeightedPointSeriesProps<D>\n extends PibblEventHandlers, PibblEventParticipationOptions {\n /** Readonly data or a signal containing it. */\n readonly data: SignalValue<readonly D[]>;\n /** Horizontal coordinate property or synchronous accessor. */\n readonly x: SeriesAccessor<D>;\n /** Vertical coordinate property or synchronous accessor. */\n readonly y: SeriesAccessor<D>;\n /** Nonnegative supplied weight property or synchronous accessor. */\n readonly weight: WeightAccessor<D>;\n /** Scale used to map x coordinates. */\n readonly xScale: ScaleId;\n /** Scale used to map y coordinates. */\n readonly yScale: ScaleId;\n /** Supplied inclusive weight extent. The lower bound must be zero. */\n readonly weightDomain: readonly [0, number];\n /** Radius extent `[0, maximumRadius]`; defaults to `[0, 6]`. */\n readonly radiusRange?: readonly [0, number];\n /**\n * Excludes a datum before coordinate and weight accessors run.\n * @param datum - Candidate source datum.\n * @param index - Zero-based source index.\n * @param data - Complete source data array.\n * @returns Whether this datum contributes a mark.\n */\n readonly defined?: (datum: D, index: number, data: readonly D[]) => boolean;\n /** Shared presentation. Whole-object and shallow field signals are supported. */\n readonly style?: SignalValue<SignalStyle<WeightedPointSeriesStyle>>;\n}\n\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 try {\n validateTexturePaint(value as never);\n return value as FillStyle | StrokeStyle;\n } catch {\n // Normalize all unsupported public paint values to the series error.\n }\n throw new TypeError(`WeightedPointSeries: invalid ${name}.`);\n}\n\nfunction styleObject(input: unknown): WeightedPointSeriesStyle {\n if (input === null || typeof input !== \"object\" || Array.isArray(input))\n throw new TypeError(\"WeightedPointSeries: style must be an object.\");\n const result: Record<string, unknown> = {};\n for (const key of Object.keys(input)) {\n if (!fields.includes(key))\n throw new TypeError(\n `WeightedPointSeries: unsupported style field ${key}.`,\n );\n result[key] = resolveSignalValue((input as Record<string, unknown>)[key]);\n }\n return result as WeightedPointSeriesStyle;\n}\n\nfunction normalized(style: WeightedPointSeriesStyle) {\n if (style.cursor !== undefined && typeof style.cursor !== \"string\")\n throw new TypeError(\"WeightedPointSeries: cursor must be a string.\");\n return {\n fill: paint(style.fill ?? \"#087f8c\", \"fill\"),\n stroke: paint(style.stroke, \"stroke\"),\n strokeWidth: width(\n style.strokeWidth ?? 1,\n \"WeightedPointSeries strokeWidth\",\n ),\n opacity: opacity(style.opacity ?? 1, \"WeightedPointSeries opacity\"),\n cursor: style.cursor,\n };\n}\n\nfunction range(\n value: readonly [number, number] | undefined,\n): readonly [number, number] {\n const actual: readonly [number, number] = value ?? [0, 6];\n if (\n !Array.isArray(actual) ||\n actual.length !== 2 ||\n actual[0] !== 0 ||\n !Number.isFinite(actual[1]) ||\n actual[1] < 0\n )\n throw new RangeError(\n \"WeightedPointSeries: radiusRange must be [0, a finite nonnegative maximum].\",\n );\n return actual;\n}\n\nfunction domain(value: readonly [0, number]): readonly [number, number] {\n if (\n !Array.isArray(value) ||\n value.length !== 2 ||\n value[0] !== 0 ||\n !Number.isFinite(value[1]) ||\n value[1] <= 0\n )\n throw new RangeError(\n \"WeightedPointSeries: weightDomain must be [0, a finite positive maximum].\",\n );\n return value;\n}\n\n/**\n * Draws batched circles whose visible area is proportional to supplied weights.\n *\n * Nullish weights and zero weights omit their marks. Finite positive weights must\n * fall inside `weightDomain`; the component never clamps or infers weights.\n * `data` and shared style signals schedule ordinary Pibbl updates. The component\n * owns no retained resources and returns one ordinary Pibbl pointer target.\n *\n * @param props - Supplied observations, coordinate and weight accessors, scales, and paint.\n * See {@link WeightedPointSeriesProps}.\n * @returns One batched Pibbl Path whose mark area is proportional to each supplied weight.\n * @see {@link WeightedPointSeriesProps}\n */\nexport function WeightedPointSeries<D>({\n data: input,\n x: xInput,\n y: yInput,\n weight: weightInput,\n xScale: xId,\n yScale: yId,\n weightDomain,\n radiusRange,\n defined,\n style: styleInput,\n ...events\n}: WeightedPointSeriesProps<D>) {\n const xs = useSeriesPosition(xId);\n const ys = useSeriesPosition(yId);\n const data = pointData(resolveSignalValue(input), \"WeightedPointSeries\");\n const x = seriesAccessor(xInput);\n const y = seriesAccessor(yInput);\n const weight = pointAccessor(weightInput);\n const [, maximumWeight] = domain(weightDomain);\n const [, maximumRadius] = range(radiusRange);\n const style = normalized(styleObject(resolveSignalValue(styleInput) ?? {}));\n const ctx = useCanvasContext();\n const target = new Path2D();\n const marks: {\n readonly x: number;\n readonly y: number;\n readonly radius: number;\n }[] = [];\n for (let i = 0; i < data.length; i++) {\n const datum = data[i];\n const values = withHooksForbidden(\n \"WeightedPointSeries: accessors cannot call hooks.\",\n () => {\n if (defined && !defined(datum, i, data)) return undefined;\n return {\n x: x(datum, i, data),\n y: y(datum, i, data),\n weight: weight(datum, i, data),\n };\n },\n );\n if (!values) continue;\n const mappedX = mapSeriesPosition(xs, values.x);\n const mappedY = mapSeriesPosition(ys, values.y);\n if (mappedX === undefined || mappedY === undefined) continue;\n const supplied = values.weight;\n if (supplied == null) continue;\n if (typeof supplied !== \"number\" || !Number.isFinite(supplied))\n throw new TypeError(\n \"WeightedPointSeries: weight must be a finite number.\",\n );\n if (supplied < 0)\n throw new RangeError(\"WeightedPointSeries: weight must be nonnegative.\");\n if (supplied > maximumWeight)\n throw new RangeError(\"WeightedPointSeries: weight exceeds weightDomain.\");\n if (supplied === 0 || maximumRadius === 0) continue;\n const radius = maximumRadius * Math.sqrt(supplied / maximumWeight);\n marks.push({ x: mappedX, y: mappedY, radius });\n }\n for (const { x, y, radius } of marks) {\n appendPointTarget(\n target,\n x,\n y,\n radius,\n !!style.fill,\n style.stroke ? style.strokeWidth : 0,\n );\n const path = pointPath(x, y, radius);\n ctx.save();\n try {\n ctx.globalAlpha *= style.opacity;\n if (style.fill) {\n ctx.fillStyle = resolveTexturePaint(style.fill, ctx, {\n x: x - radius,\n y: y - radius,\n width: radius * 2,\n height: radius * 2,\n });\n ctx.fill(path);\n }\n if (style.stroke && style.strokeWidth > 0) {\n ctx.strokeStyle = resolveTexturePaint(style.stroke, ctx, {\n x: x - radius,\n y: y - radius,\n width: radius * 2,\n height: radius * 2,\n });\n ctx.lineWidth = style.strokeWidth;\n ctx.stroke(path);\n }\n } finally {\n ctx.restore();\n }\n }\n return (\n <Path\n {...events}\n style={{ d: target, fill: \"transparent\", cursor: style.cursor }}\n />\n );\n}\n"],
|
|
5
|
+
"mappings": "AA+QI;AA/QJ,SAAS,2BAA2B;AACpC,SAAS,MAAM,oBAAoB,wBAAwB;AAS3D,SAAS,sBAAsB,0BAA0B;AAEzD,SAAS,eAAe,iBAAiB;AACzC,S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,UAAI,MAAM,UAAU,MAAM,cAAc,GAAG;AACzC,YAAI,cAAc,oBAAoB,MAAM,QAAQ,KAAK;AAAA,UACvD,GAAGD,KAAI;AAAA,UACP,GAAGC,KAAI;AAAA,UACP,OAAO,SAAS;AAAA,UAChB,QAAQ,SAAS;AAAA,QACnB,CAAC;AACD,YAAI,YAAY,MAAM;AACtB,YAAI,OAAO,IAAI;AAAA,MACjB;AAAA,IACF,UAAE;AACA,UAAI,QAAQ;AAAA,IACd;AAAA,EACF;AACA,SACE;AAAA,IAAC;AAAA;AAAA,MACE,GAAG;AAAA,MACJ,OAAO,EAAE,GAAG,QAAQ,MAAM,eAAe,QAAQ,MAAM,OAAO;AAAA;AAAA,EAChE;AAEJ;",
|
|
6
|
+
"names": ["x", "y"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ReflectionGpu
|
|
3
|
+
} from "./reflection-gpu.js";
|
|
4
|
+
const fragment = `#version 300 es
|
|
5
|
+
precision highp float;
|
|
6
|
+
uniform sampler2D scene, map;
|
|
7
|
+
uniform vec2 logicalOrigin, logicalSize, mapOrigin, tileSize, direction;
|
|
8
|
+
uniform float rotation, opacity, depth;
|
|
9
|
+
in vec2 uv;
|
|
10
|
+
out vec4 outputColor;
|
|
11
|
+
vec2 coordinates(vec2 logical) {
|
|
12
|
+
vec2 p=logical-mapOrigin;
|
|
13
|
+
float c=cos(rotation),s=sin(rotation);
|
|
14
|
+
return vec2(c*p.x+s*p.y,-s*p.x+c*p.y)/tileSize;
|
|
15
|
+
}
|
|
16
|
+
float height(vec2 p) {
|
|
17
|
+
vec4 field=texture(map,coordinates(p));
|
|
18
|
+
return dot(field.rgb,vec3(.2126,.7152,.0722))*field.a;
|
|
19
|
+
}
|
|
20
|
+
void main() {
|
|
21
|
+
vec4 base=texture(scene,uv);
|
|
22
|
+
vec2 p=logicalOrigin+uv*logicalSize;
|
|
23
|
+
vec2 gradient=.5*vec2(height(p+vec2(1,0))-height(p-vec2(1,0)),height(p+vec2(0,1))-height(p-vec2(0,1)));
|
|
24
|
+
vec3 normal=normalize(vec3(-depth*gradient,1.));
|
|
25
|
+
vec3 light=normalize(vec3(direction*.8,1.));
|
|
26
|
+
float shade=max(0.,dot(normal,light))/light.z;
|
|
27
|
+
// A flat map is exactly neutral. Multiply premultiplied color, preserve alpha.
|
|
28
|
+
outputColor=vec4(clamp(base.rgb*mix(1.,shade,opacity),vec3(0),vec3(base.a)),base.a);
|
|
29
|
+
}
|
|
30
|
+
`;
|
|
31
|
+
class EmbossGpu extends ReflectionGpu {
|
|
32
|
+
constructor(callbacks = {}) {
|
|
33
|
+
super(callbacks, fragment);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
export {
|
|
37
|
+
EmbossGpu
|
|
38
|
+
};
|
|
39
|
+
//# sourceMappingURL=emboss-gpu.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/filters/emboss-gpu.ts"],
|
|
4
|
+
"sourcesContent": ["import {\n ReflectionGpu,\n type ReflectionGpuCallbacks,\n} from \"./reflection-gpu.js\";\n\n// Reuses the existing GPU surface/cache ownership; this shader consumes scalar\n// height instead of the reflected-light operation's pre-encoded RG slopes.\nconst fragment = `#version 300 es\nprecision highp float;\nuniform sampler2D scene, map;\nuniform vec2 logicalOrigin, logicalSize, mapOrigin, tileSize, direction;\nuniform float rotation, opacity, depth;\nin vec2 uv;\nout vec4 outputColor;\nvec2 coordinates(vec2 logical) {\n vec2 p=logical-mapOrigin;\n float c=cos(rotation),s=sin(rotation);\n return vec2(c*p.x+s*p.y,-s*p.x+c*p.y)/tileSize;\n}\nfloat height(vec2 p) {\n vec4 field=texture(map,coordinates(p));\n return dot(field.rgb,vec3(.2126,.7152,.0722))*field.a;\n}\nvoid main() {\n vec4 base=texture(scene,uv);\n vec2 p=logicalOrigin+uv*logicalSize;\n vec2 gradient=.5*vec2(height(p+vec2(1,0))-height(p-vec2(1,0)),height(p+vec2(0,1))-height(p-vec2(0,1)));\n vec3 normal=normalize(vec3(-depth*gradient,1.));\n vec3 light=normalize(vec3(direction*.8,1.));\n float shade=max(0.,dot(normal,light))/light.z;\n // A flat map is exactly neutral. Multiply premultiplied color, preserve alpha.\n outputColor=vec4(clamp(base.rgb*mix(1.,shade,opacity),vec3(0),vec3(base.a)),base.a);\n}\n`;\nexport class EmbossGpu extends ReflectionGpu {\n constructor(callbacks: Readonly<ReflectionGpuCallbacks> = {}) {\n super(callbacks, fragment);\n }\n}\n"],
|
|
5
|
+
"mappings": "AAAA;AAAA,EACE;AAAA,OAEK;AAIP,MAAM,WAAW;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA2BV,MAAM,kBAAkB,cAAc;AAAA,EAC3C,YAAY,YAA8C,CAAC,GAAG;AAC5D,UAAM,WAAW,QAAQ;AAAA,EAC3B;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { SignalValue } from "../lib/signals/types.js";
|
|
2
|
+
import { type PibblFilter } from "../lib/style/filter-types.js";
|
|
3
|
+
import { type TexturePaint } from "../lib/textures/texture-protocol.js";
|
|
4
|
+
/** Directional lighting of grayscale texture height. See {@link emboss}. */
|
|
5
|
+
export interface PibblEmbossFilterOptions {
|
|
6
|
+
/** Local texture placement region with finite coordinates and positive dimensions. See {@link TexturePaint}. */
|
|
7
|
+
readonly region: Readonly<{
|
|
8
|
+
/** Horizontal origin in local logical coordinates. See {@link PibblEmbossFilterOptions}. */
|
|
9
|
+
x: number;
|
|
10
|
+
/** Vertical origin in local logical coordinates. See {@link PibblEmbossFilterOptions}. */
|
|
11
|
+
y: number;
|
|
12
|
+
/** Positive logical region width. See {@link PibblEmbossFilterOptions}. */
|
|
13
|
+
width: number;
|
|
14
|
+
/** Positive logical region height. See {@link PibblEmbossFilterOptions}. */
|
|
15
|
+
height: number;
|
|
16
|
+
}>;
|
|
17
|
+
/** Height range in logical pixels, finite 0–32; default 3. See {@link emboss}. */
|
|
18
|
+
readonly depth?: SignalValue<number>;
|
|
19
|
+
/** Lighting strength, finite 0–1; default 1. Zero bypasses processing. See {@link emboss}. */
|
|
20
|
+
readonly strength?: SignalValue<number>;
|
|
21
|
+
/** Nonzero finite direction toward the light in local coordinates; default [-0.6, -0.8]. See {@link emboss}. */
|
|
22
|
+
readonly direction?: readonly [number, number];
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Lights captured pixels using normals derived from a grayscale texture height map.
|
|
26
|
+
* Flat heights are neutral; opposing slopes brighten and darken without changing alpha or geometry.
|
|
27
|
+
* @param map - Mounted height texture, luminance times alpha; white is high. See {@link TexturePaint}.
|
|
28
|
+
* @param options - Local placement, height depth, strength, and light direction. See {@link PibblEmbossFilterOptions}.
|
|
29
|
+
* @returns A filter descriptor for style.filter. See {@link PibblFilter}.
|
|
30
|
+
* @see {@link PibblEmbossFilterOptions}
|
|
31
|
+
*/
|
|
32
|
+
export declare function emboss(map: SignalValue<TexturePaint>, options: PibblEmbossFilterOptions): PibblFilter;
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { isSignal } from "../lib/signals/graph.js";
|
|
2
|
+
import { layoutDiagnostic } from "../lib/style/diagnostics.js";
|
|
3
|
+
import {
|
|
4
|
+
PIBBL_FILTER_EXECUTOR
|
|
5
|
+
} from "../lib/style/filter-types.js";
|
|
6
|
+
import {
|
|
7
|
+
borrowTextureRaster,
|
|
8
|
+
validateTexturePaint
|
|
9
|
+
} from "../lib/textures/texture-protocol.js";
|
|
10
|
+
import {
|
|
11
|
+
filterBoundaryExecutor
|
|
12
|
+
} from "./filter-executor.js";
|
|
13
|
+
import { processEmboss } from "./render-emboss-boundary.js";
|
|
14
|
+
const definitions = /* @__PURE__ */ new WeakMap();
|
|
15
|
+
const executor = {
|
|
16
|
+
prepare(value, property, context) {
|
|
17
|
+
const definition = definitions.get(value);
|
|
18
|
+
if (!definition)
|
|
19
|
+
throw new Error(
|
|
20
|
+
"An emboss filter was created by an incompatible Pibbl runtime."
|
|
21
|
+
);
|
|
22
|
+
const { options } = definition;
|
|
23
|
+
const fail = (key, value2, reason) => layoutDiagnostic({
|
|
24
|
+
component: context.component,
|
|
25
|
+
property: `${property}.${key}`,
|
|
26
|
+
value: value2,
|
|
27
|
+
algorithm: context.algorithm,
|
|
28
|
+
constraints: context.constraints,
|
|
29
|
+
reason
|
|
30
|
+
});
|
|
31
|
+
const numeric = (key, fallback, maximum) => {
|
|
32
|
+
const input = options[key];
|
|
33
|
+
const value2 = input === void 0 ? fallback : isSignal(input) ? input.get() : input;
|
|
34
|
+
if (typeof value2 !== "number" || !Number.isFinite(value2) || value2 < 0 || value2 > maximum)
|
|
35
|
+
throw fail(key, value2, `must be finite within 0..${maximum}`);
|
|
36
|
+
return value2;
|
|
37
|
+
};
|
|
38
|
+
const depth = numeric("depth", 3, 32), strength = numeric("strength", 1, 1);
|
|
39
|
+
const direction = options.direction ?? [-0.6, -0.8];
|
|
40
|
+
if (!Array.isArray(direction) || direction.length !== 2 || !direction.every(
|
|
41
|
+
(value2) => typeof value2 === "number" && Number.isFinite(value2)
|
|
42
|
+
) || Math.hypot(...direction) === 0)
|
|
43
|
+
throw fail(
|
|
44
|
+
"direction",
|
|
45
|
+
direction,
|
|
46
|
+
"must contain two finite components with nonzero length"
|
|
47
|
+
);
|
|
48
|
+
const length = Math.hypot(...direction);
|
|
49
|
+
const candidate = options.region;
|
|
50
|
+
if (!candidate || typeof candidate !== "object")
|
|
51
|
+
throw fail(
|
|
52
|
+
"region",
|
|
53
|
+
candidate,
|
|
54
|
+
"must contain finite coordinates and positive dimensions"
|
|
55
|
+
);
|
|
56
|
+
const { x, y, width, height } = candidate;
|
|
57
|
+
if (![x, y, width, height].every(
|
|
58
|
+
(value2) => typeof value2 === "number" && Number.isFinite(value2)
|
|
59
|
+
) || width <= 0 || height <= 0)
|
|
60
|
+
throw fail(
|
|
61
|
+
"region",
|
|
62
|
+
candidate,
|
|
63
|
+
"must contain finite coordinates and positive dimensions"
|
|
64
|
+
);
|
|
65
|
+
const region = { x, y, width, height };
|
|
66
|
+
const map = isSignal(definition.map) ? definition.map.get() : definition.map;
|
|
67
|
+
try {
|
|
68
|
+
validateTexturePaint(map);
|
|
69
|
+
if (strength !== 0 && depth !== 0)
|
|
70
|
+
borrowTextureRaster(map, () => void 0);
|
|
71
|
+
} catch (error) {
|
|
72
|
+
throw fail(
|
|
73
|
+
"map",
|
|
74
|
+
map,
|
|
75
|
+
error instanceof Error ? error.message : String(error)
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
const settings = {
|
|
79
|
+
opacity: strength,
|
|
80
|
+
depth,
|
|
81
|
+
threshold: 0,
|
|
82
|
+
softness: 1,
|
|
83
|
+
direction: [direction[0] / length, direction[1] / length]
|
|
84
|
+
};
|
|
85
|
+
return Object.freeze({
|
|
86
|
+
executor: filterBoundaryExecutor,
|
|
87
|
+
reverseInfluence: (output) => ({ ...output }),
|
|
88
|
+
process: strength === 0 || depth === 0 ? void 0 : (source, windows) => processEmboss(source, windows, map, settings, region)
|
|
89
|
+
});
|
|
90
|
+
},
|
|
91
|
+
render: filterBoundaryExecutor.render
|
|
92
|
+
};
|
|
93
|
+
function emboss(map, options) {
|
|
94
|
+
const frozen = Object.freeze({
|
|
95
|
+
...options,
|
|
96
|
+
region: Object.freeze({ ...options.region }),
|
|
97
|
+
direction: options.direction && Object.freeze([...options.direction])
|
|
98
|
+
});
|
|
99
|
+
const value = Object.freeze({ [PIBBL_FILTER_EXECUTOR]: executor });
|
|
100
|
+
definitions.set(value, { map, options: frozen });
|
|
101
|
+
return value;
|
|
102
|
+
}
|
|
103
|
+
export {
|
|
104
|
+
emboss
|
|
105
|
+
};
|
|
106
|
+
//# sourceMappingURL=emboss.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/filters/emboss.ts"],
|
|
4
|
+
"sourcesContent": ["import { isSignal } from \"../lib/signals/graph.js\";\nimport type { SignalValue } from \"../lib/signals/types.js\";\nimport { layoutDiagnostic } from \"../lib/style/diagnostics.js\";\nimport {\n PIBBL_FILTER_EXECUTOR,\n type PibblFilter,\n type PibblFilterExecutor,\n} from \"../lib/style/filter-types.js\";\nimport {\n borrowTextureRaster,\n validateTexturePaint,\n type TexturePaint,\n} from \"../lib/textures/texture-protocol.js\";\nimport {\n filterBoundaryExecutor,\n type CustomPreparedFilter,\n} from \"./filter-executor.js\";\nimport { processEmboss } from \"./render-emboss-boundary.js\";\n\n/** Directional lighting of grayscale texture height. See {@link emboss}. */\nexport interface PibblEmbossFilterOptions {\n /** Local texture placement region with finite coordinates and positive dimensions. See {@link TexturePaint}. */\n readonly region: Readonly<{\n /** Horizontal origin in local logical coordinates. See {@link PibblEmbossFilterOptions}. */\n x: number;\n /** Vertical origin in local logical coordinates. See {@link PibblEmbossFilterOptions}. */\n y: number;\n /** Positive logical region width. See {@link PibblEmbossFilterOptions}. */\n width: number;\n /** Positive logical region height. See {@link PibblEmbossFilterOptions}. */\n height: number;\n }>;\n /** Height range in logical pixels, finite 0\u201332; default 3. See {@link emboss}. */\n readonly depth?: SignalValue<number>;\n /** Lighting strength, finite 0\u20131; default 1. Zero bypasses processing. See {@link emboss}. */\n readonly strength?: SignalValue<number>;\n /** Nonzero finite direction toward the light in local coordinates; default [-0.6, -0.8]. See {@link emboss}. */\n readonly direction?: readonly [number, number];\n}\nconst definitions = new WeakMap<\n PibblFilter,\n {\n map: SignalValue<TexturePaint>;\n options: Readonly<PibblEmbossFilterOptions>;\n }\n>();\nconst executor: PibblFilterExecutor = {\n prepare(value, property, context) {\n const definition = definitions.get(value);\n if (!definition)\n throw new Error(\n \"An emboss filter was created by an incompatible Pibbl runtime.\",\n );\n const { options } = definition;\n const fail = (key: string, value: unknown, reason: string) =>\n layoutDiagnostic({\n component: context.component,\n property: `${property}.${key}`,\n value,\n algorithm: context.algorithm,\n constraints: context.constraints,\n reason,\n });\n const numeric = (\n key: \"depth\" | \"strength\",\n fallback: number,\n maximum: number,\n ) => {\n const input = options[key];\n const value =\n input === undefined ? fallback : isSignal(input) ? input.get() : input;\n if (\n typeof value !== \"number\" ||\n !Number.isFinite(value) ||\n value < 0 ||\n value > maximum\n )\n throw fail(key, value, `must be finite within 0..${maximum}`);\n return value;\n };\n const depth = numeric(\"depth\", 3, 32),\n strength = numeric(\"strength\", 1, 1);\n const direction: unknown = options.direction ?? [-0.6, -0.8];\n if (\n !Array.isArray(direction) ||\n direction.length !== 2 ||\n !direction.every(\n (value) => typeof value === \"number\" && Number.isFinite(value),\n ) ||\n Math.hypot(...direction) === 0\n )\n throw fail(\n \"direction\",\n direction,\n \"must contain two finite components with nonzero length\",\n );\n const length = Math.hypot(...direction);\n const candidate: unknown = options.region;\n if (!candidate || typeof candidate !== \"object\")\n throw fail(\n \"region\",\n candidate,\n \"must contain finite coordinates and positive dimensions\",\n );\n const { x, y, width, height } = candidate as {\n x: number;\n y: number;\n width: number;\n height: number;\n };\n if (\n ![x, y, width, height].every(\n (value) => typeof value === \"number\" && Number.isFinite(value),\n ) ||\n width <= 0 ||\n height <= 0\n )\n throw fail(\n \"region\",\n candidate,\n \"must contain finite coordinates and positive dimensions\",\n );\n const region = { x, y, width, height };\n const map = isSignal(definition.map)\n ? definition.map.get()\n : definition.map;\n try {\n validateTexturePaint(map);\n if (strength !== 0 && depth !== 0)\n borrowTextureRaster(map, () => undefined);\n } catch (error) {\n throw fail(\n \"map\",\n map,\n error instanceof Error ? error.message : String(error),\n );\n }\n const settings = {\n opacity: strength,\n depth,\n threshold: 0,\n softness: 1,\n direction: [direction[0] / length, direction[1] / length] as const,\n };\n return Object.freeze({\n executor: filterBoundaryExecutor,\n reverseInfluence: (output) => ({ ...output }),\n process:\n strength === 0 || depth === 0\n ? undefined\n : (source, windows) =>\n processEmboss(source, windows, map, settings, region),\n } satisfies CustomPreparedFilter);\n },\n render: filterBoundaryExecutor.render,\n};\n/**\n * Lights captured pixels using normals derived from a grayscale texture height map.\n * Flat heights are neutral; opposing slopes brighten and darken without changing alpha or geometry.\n * @param map - Mounted height texture, luminance times alpha; white is high. See {@link TexturePaint}.\n * @param options - Local placement, height depth, strength, and light direction. See {@link PibblEmbossFilterOptions}.\n * @returns A filter descriptor for style.filter. See {@link PibblFilter}.\n * @see {@link PibblEmbossFilterOptions}\n */\nexport function emboss(\n map: SignalValue<TexturePaint>,\n options: PibblEmbossFilterOptions,\n): PibblFilter {\n const frozen = Object.freeze({\n ...options,\n region: Object.freeze({ ...options.region }),\n direction:\n options.direction &&\n (Object.freeze([...options.direction]) as readonly [number, number]),\n });\n const value = Object.freeze({ [PIBBL_FILTER_EXECUTOR]: executor });\n definitions.set(value, { map, options: frozen });\n return value;\n}\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,gBAAgB;AAEzB,SAAS,wBAAwB;AACjC;AAAA,EACE;AAAA,OAGK;AACP;AAAA,EACE;AAAA,EACA;AAAA,OAEK;AACP;AAAA,EACE;AAAA,OAEK;AACP,SAAS,qBAAqB;AAsB9B,MAAM,cAAc,oBAAI,QAMtB;AACF,MAAM,WAAgC;AAAA,EACpC,QAAQ,OAAO,UAAU,SAAS;AAChC,UAAM,aAAa,YAAY,IAAI,KAAK;AACxC,QAAI,CAAC;AACH,YAAM,IAAI;AAAA,QACR;AAAA,MACF;AACF,UAAM,EAAE,QAAQ,IAAI;AACpB,UAAM,OAAO,CAAC,KAAaA,QAAgB,WACzC,iBAAiB;AAAA,MACf,WAAW,QAAQ;AAAA,MACnB,UAAU,GAAG,QAAQ,IAAI,GAAG;AAAA,MAC5B,OAAAA;AAAA,MACA,WAAW,QAAQ;AAAA,MACnB,aAAa,QAAQ;AAAA,MACrB;AAAA,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