@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/filters/reflection-gpu.ts"],
|
|
4
|
-
"sourcesContent": ["import type { BorrowedTextureRaster, TexturePlacement } from '../lib/textures/texture-protocol.js';\n\nexport interface ReflectionCoordinates {\n readonly originX: number;\n readonly originY: number;\n readonly density: number;\n readonly region: Readonly<{ x: number; y: number; width: number; height: number }>;\n}\nexport interface ReflectionGpuCallbacks {\n readonly onContextLost?: () => void;\n readonly onContextRestored?: () => void;\n}\nconst vertexSource = `#version 300 es\nin vec2 p;\nout vec2 uv;\nvoid main() { uv = vec2((p.x + 1.) * .5, 1. - (p.y + 1.) * .5); gl_Position = vec4(p, 0, 1); }\n`;\nexport interface ReflectionSettings {\n readonly opacity: number; readonly threshold: number; readonly softness: number;\n readonly direction: readonly [number, number];\n}\nexport type ReflectionLight = { readonly color: string } | { readonly image: HTMLImageElement | ImageBitmap } | { readonly raster: BorrowedTextureRaster };\nexport interface ReflectionWarp { readonly map: BorrowedTextureRaster; readonly strength: number; readonly region: ReflectionCoordinates['region']; }\nconst fragmentSource = `#version 300 es\nprecision highp float;\nuniform sampler2D scene, map, lightMap, warpMap;\nuniform vec2 logicalOrigin, logicalSize, mapOrigin, tileSize, lightOrigin, lightSize, warpOrigin, warpSize, warpStrength, direction;\nuniform float rotation, lightRotation, warpRotation, opacity, threshold, softness;\nin vec2 uv;\nout vec4 outputColor;\nfloat decode(float c) { float b=c*255.; return (b-128.)/(b<128.?128.:127.); }\nvec2 coordinates(vec2 origin, vec2 size, float angle) {\n vec2 p=logicalOrigin+uv*logicalSize-origin;\n float c=cos(angle),s=sin(angle);\n return vec2(c*p.x+s*p.y,-s*p.x+c*p.y)/size;\n}\nvec4 sourcePixel(ivec2 p) {\n ivec2 size=textureSize(scene,0);\n if(any(lessThan(p,ivec2(0)))||any(greaterThanEqual(p,size))) return vec4(0);\n return texelFetch(scene,p,0);\n}\nvec4 sourceSample(vec2 p) {\n vec2 pixel=p*vec2(textureSize(scene,0))-.5;\n ivec2 base=ivec2(floor(pixel)); vec2 f=fract(pixel);\n return mix(mix(sourcePixel(base),sourcePixel(base+ivec2(1,0)),f.x),mix(sourcePixel(base+ivec2(0,1)),sourcePixel(base+ivec2(1,1)),f.x),f.y);\n}\nvoid main() {\n vec4 warp=texture(warpMap,coordinates(warpOrigin,warpSize,warpRotation));\n vec4 base=sourceSample(uv+vec2(decode(warp.r),decode(warp.g))*warp.a*warpStrength);\n vec4 field=texture(map,coordinates(mapOrigin,tileSize,rotation));\n vec2 slope=vec2(decode(field.r),decode(field.g));\n float coverage=smoothstep(threshold,threshold+softness,dot(slope,direction))*field.a*opacity;\n vec4 light=texture(lightMap,coordinates(lightOrigin,lightSize,lightRotation)+slope*.035);\n float amount=coverage*light.a;\n outputColor=vec4(base.rgb*(1.-amount)+base.a*light.rgb*amount,base.a);\n}\n`;\n\n/** Optional synchronous image processor; scene pixels are never read back. */\nexport class ReflectionGpu {\n private readonly canvas = new OffscreenCanvas(1, 1);\n private gl: WebGL2RenderingContext | undefined;\n private resources: ReflectionResources | undefined;\n private readonly maps = new Map<object, { texture: WebGLTexture; revision: number }>();\n private readonly directKey = {};\n private colorCanvas: OffscreenCanvas | undefined;\n private directRevision = 0;\n private disposed = false;\n private lost = false;\n private readonly onContextLost = (event: Event): void => {\n event.preventDefault();\n if (this.disposed || this.lost) return;\n this.lost = true;\n this.releaseResources(false);\n this.callbacks.onContextLost?.();\n };\n private readonly onContextRestored = (): void => {\n if (this.disposed || !this.lost) return;\n this.lost = false;\n this.callbacks.onContextRestored?.();\n };\n\n constructor(private readonly callbacks: Readonly<ReflectionGpuCallbacks> = {}) {\n this.canvas.addEventListener('webglcontextlost', this.onContextLost);\n this.canvas.addEventListener('webglcontextrestored', this.onContextRestored);\n }\n\n get isContextLost(): boolean {\n return this.lost || this.gl?.isContextLost() === true;\n }\n\n private acquireResources(): ReflectionResources {\n if (this.disposed) throw new Error('Cannot use a disposed reflection processor.');\n if (this.isContextLost) throw new Error('Reflection WebGL2 context was lost.');\n if (this.resources) return this.resources;\n const gl = this.canvas.getContext('webgl2', { premultipliedAlpha: true, preserveDrawingBuffer: false });\n if (!gl) throw new Error('Reflection requires OffscreenCanvas WebGL2 support.');\n if (gl.isContextLost()) throw new Error('Reflection WebGL2 context was lost.');\n this.gl = gl;\n const vertex = compile(gl, gl.VERTEX_SHADER, vertexSource);\n let fragment: WebGLShader | undefined;\n let program: WebGLProgram | null = null;\n try {\n fragment = compile(gl, gl.FRAGMENT_SHADER, fragmentSource);\n program = gl.createProgram();\n if (!program) throw new Error('Could not allocate reflection program.');\n gl.attachShader(program, vertex); gl.attachShader(program, fragment); gl.linkProgram(program);\n if (!gl.getProgramParameter(program, gl.LINK_STATUS)) throw new Error(`Reflection shader link failed: ${gl.getProgramInfoLog(program)}`);\n } catch (error) { if (program) gl.deleteProgram(program); throw error; }\n finally { gl.deleteShader(vertex); if (fragment) gl.deleteShader(fragment); }\n const vao = gl.createVertexArray(), buffer = gl.createBuffer();\n if (!vao || !buffer) { if (vao) gl.deleteVertexArray(vao); if (buffer) gl.deleteBuffer(buffer); gl.deleteProgram(program); throw new Error('Could not allocate reflection geometry.'); }\n gl.bindVertexArray(vao); gl.bindBuffer(gl.ARRAY_BUFFER, buffer);\n gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([-1, -1, 1, -1, -1, 1, 1, 1]), gl.STATIC_DRAW);\n const location = gl.getAttribLocation(program, 'p');\n gl.enableVertexAttribArray(location); gl.vertexAttribPointer(location, 2, gl.FLOAT, false, 0, 0);\n const source = gl.createTexture();\n if (!source) {\n if (source) gl.deleteTexture(source);\n gl.deleteBuffer(buffer); gl.deleteVertexArray(vao); gl.deleteProgram(program);\n throw new Error('Could not allocate reflection textures.');\n }\n const resources: ReflectionResources = { program, vao, buffer, source };\n gl.pixelStorei(gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, gl.NONE);\n this.resources = resources;\n return resources;\n }\n\n apply(source: OffscreenCanvas, map: BorrowedTextureRaster, light: ReflectionLight, settings: ReflectionSettings, coordinates: ReflectionCoordinates, warp?: ReflectionWarp): ImageBitmap {\n const { gl, program, vao, source: sourceTexture } = this.acquireResourcesWithContext();\n const maximum = gl.getParameter(gl.MAX_TEXTURE_SIZE) as number;\n if (Math.max(source.width, source.height, map.width, map.height, warp?.map.width ?? 0, warp?.map.height ?? 0) > maximum) throw new RangeError('Reflection target exceeds WebGL2 maximum texture size.');\n if (this.canvas.width !== source.width) this.canvas.width = source.width;\n if (this.canvas.height !== source.height) this.canvas.height = source.height;\n gl.viewport(0, 0, source.width, source.height); gl.useProgram(program); gl.bindVertexArray(vao);\n this.upload(gl, 0, sourceTexture, source, true, false);\n const uploaded = new Map<object, number>();\n const bind = (unit: number, raster: {source: TexImageSource; width:number; height:number; resource:object; revision:number; placement:Readonly<TexturePlacement>}) => {\n if (Math.max(raster.width,raster.height)>maximum) throw new RangeError('Reflection light exceeds WebGL2 maximum texture size.');\n let cached=this.maps.get(raster.resource);\n if (!cached) {\n const texture=gl.createTexture(); if(!texture) throw new Error('Could not allocate reflection input texture.');\n cached={texture,revision:-1}; this.maps.set(raster.resource,cached);\n }\n this.upload(gl,unit,cached.texture,raster.source,false,raster.placement.mode!=='stretch',cached.revision!==raster.revision && uploaded.get(raster.resource)!==raster.revision);\n uploaded.set(raster.resource,raster.revision);\n };\n bind(1,map); bind(3,warp?.map ?? map);\n let lightPlacement: Readonly<TexturePlacement> = {mode:'stretch'};\n let lightWidth=1,lightHeight=1;\n if ('raster' in light) { bind(2,light.raster); lightPlacement=light.raster.placement; lightWidth=light.raster.width; lightHeight=light.raster.height; }\n else {\n let image: TexImageSource;\n if ('color' in light) {\n const canvas=this.colorCanvas ??= new OffscreenCanvas(1,1);\n const ctx=canvas.getContext('2d'); if(!ctx) throw new Error('Reflection colors require Canvas 2D.');\n ctx.clearRect(0,0,1,1); ctx.fillStyle=light.color; ctx.fillRect(0,0,1,1); image=canvas;\n } else { image=light.image; lightWidth='naturalWidth' in light.image?light.image.naturalWidth:light.image.width; lightHeight='naturalHeight' in light.image?light.image.naturalHeight:light.image.height; }\n bind(2,{source:image,width:lightWidth,height:lightHeight,resource:this.directKey,revision:++this.directRevision,placement:lightPlacement});\n }\n const uniform=(name:string)=>gl.getUniformLocation(program,name);\n const placement=(origin:string,size:string,angle:string,value:Readonly<TexturePlacement>,region:ReflectionCoordinates['region'],width:number,height:number)=>{\n gl.uniform2f(uniform(origin),region.x+(value.offsetX??0),region.y+(value.offsetY??0));\n gl.uniform2f(uniform(size),value.mode==='stretch'?region.width:value.tileWidth??width,value.mode==='stretch'?region.height:value.tileHeight??height);\n gl.uniform1f(uniform(angle),(value.rotation??0)*Math.PI/180);\n };\n gl.uniform1i(uniform('scene'),0); gl.uniform1i(uniform('map'),1); gl.uniform1i(uniform('lightMap'),2); gl.uniform1i(uniform('warpMap'),3);\n gl.uniform2f(uniform('logicalOrigin'),coordinates.originX,coordinates.originY);\n gl.uniform2f(uniform('logicalSize'),source.width/coordinates.density,source.height/coordinates.density);\n placement('mapOrigin','tileSize','rotation',map.placement,coordinates.region,map.width,map.height);\n placement('lightOrigin','lightSize','lightRotation',lightPlacement,coordinates.region,lightWidth,lightHeight);\n placement('warpOrigin','warpSize','warpRotation',warp?.map.placement??map.placement,warp?.region??coordinates.region,warp?.map.width??map.width,warp?.map.height??map.height);\n gl.uniform2f(uniform('warpStrength'),(warp?.strength??0)*coordinates.density/source.width,(warp?.strength??0)*coordinates.density/source.height);\n gl.uniform2f(uniform('direction'),settings.direction[0],settings.direction[1]);\n gl.uniform1f(uniform('opacity'),settings.opacity); gl.uniform1f(uniform('threshold'),settings.threshold); gl.uniform1f(uniform('softness'),settings.softness);\n gl.drawArrays(gl.TRIANGLE_STRIP,0,4);\n if(this.isContextLost) throw new Error('Reflection WebGL2 context was lost.');\n const error=gl.getError(); if(error!==gl.NO_ERROR) throw new Error(`Reflection GPU processing failed (${error}).`);\n for(const [resource,revision] of uploaded) this.maps.get(resource)!.revision=revision;\n return this.canvas.transferToImageBitmap();\n }\n private acquireResourcesWithContext(): ReflectionResources & { gl: WebGL2RenderingContext } {\n const resources = this.acquireResources();\n const gl = this.gl;\n if (!gl || gl.isContextLost()) throw new Error('Reflection WebGL2 context was lost.');\n return { ...resources, gl };\n }\n private upload(gl: WebGL2RenderingContext, unit: number, texture: WebGLTexture, canvas: TexImageSource, premultiply: boolean, repeat: boolean, upload = true): void {\n gl.activeTexture(gl.TEXTURE0 + unit); gl.bindTexture(gl.TEXTURE_2D, texture);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, repeat ? gl.REPEAT : gl.CLAMP_TO_EDGE);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, repeat ? gl.REPEAT : gl.CLAMP_TO_EDGE);\n gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, premultiply);\n if (upload) gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, canvas);\n }\n retainMaps(resources: ReadonlySet<object>): void {\n const gl = this.gl;\n for (const [resource, cached] of this.maps) {\n if (resource !== this.directKey && !resources.has(resource)) { if (gl && !gl.isContextLost()) gl.deleteTexture(cached.texture); this.maps.delete(resource); }\n }\n }\n private releaseResources(deleteResources: boolean): void {\n const gl = this.gl;\n const resources = this.resources;\n this.resources = undefined;\n if (gl && !gl.isContextLost() && deleteResources) {\n gl.deleteTexture(resources?.source ?? null);\n for (const cached of this.maps.values()) gl.deleteTexture(cached.texture);\n if (resources) { gl.deleteBuffer(resources.buffer); gl.deleteVertexArray(resources.vao); gl.deleteProgram(resources.program); }\n }\n this.maps.clear();\n }\n dispose(): void {\n if (this.disposed) return;\n this.disposed = true;\n this.canvas.removeEventListener('webglcontextlost', this.onContextLost);\n this.canvas.removeEventListener('webglcontextrestored', this.onContextRestored);\n this.releaseResources(true);\n this.canvas.width = 0; this.canvas.height = 0;\n if(this.colorCanvas) this.colorCanvas.width=this.colorCanvas.height=0;\n this.colorCanvas=undefined;\n }\n}\ninterface ReflectionResources {\n readonly program: WebGLProgram;\n readonly vao: WebGLVertexArrayObject;\n readonly buffer: WebGLBuffer;\n readonly source: WebGLTexture;\n}\nfunction compile(gl: WebGL2RenderingContext, kind: number, source: string): WebGLShader {\n const shader = gl.createShader(kind);\n if (!shader) throw new Error('Could not allocate reflection shader.');\n gl.shaderSource(shader, source); gl.compileShader(shader);\n if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) {\n const error = gl.getShaderInfoLog(shader); gl.deleteShader(shader);\n throw new Error(`Reflection shader compile failed: ${error}`);\n }\n return shader;\n}\n"],
|
|
5
|
-
"mappings": "AAYA,MAAM,eAAe;AAAA;AAAA;AAAA;AAAA;
|
|
4
|
+
"sourcesContent": ["import type { BorrowedTextureRaster, TexturePlacement } from '../lib/textures/texture-protocol.js';\n\nexport interface ReflectionCoordinates {\n readonly originX: number;\n readonly originY: number;\n readonly density: number;\n readonly region: Readonly<{ x: number; y: number; width: number; height: number }>;\n}\nexport interface ReflectionGpuCallbacks {\n readonly onContextLost?: () => void;\n readonly onContextRestored?: () => void;\n}\nconst vertexSource = `#version 300 es\nin vec2 p;\nout vec2 uv;\nvoid main() { uv = vec2((p.x + 1.) * .5, 1. - (p.y + 1.) * .5); gl_Position = vec4(p, 0, 1); }\n`;\nexport interface ReflectionSettings {\n readonly opacity: number; readonly threshold: number; readonly softness: number;\n readonly direction: readonly [number, number];\n readonly depth?: number;\n}\nexport type ReflectionLight = { readonly color: string } | { readonly image: HTMLImageElement | ImageBitmap } | { readonly raster: BorrowedTextureRaster };\nexport interface ReflectionWarp { readonly map: BorrowedTextureRaster; readonly strength: number; readonly region: ReflectionCoordinates['region']; }\nconst fragmentSource = `#version 300 es\nprecision highp float;\nuniform sampler2D scene, map, lightMap, warpMap;\nuniform vec2 logicalOrigin, logicalSize, mapOrigin, tileSize, lightOrigin, lightSize, warpOrigin, warpSize, warpStrength, direction;\nuniform float rotation, lightRotation, warpRotation, opacity, threshold, softness;\nin vec2 uv;\nout vec4 outputColor;\nfloat decode(float c) { float b=c*255.; return (b-128.)/(b<128.?128.:127.); }\nvec2 coordinates(vec2 origin, vec2 size, float angle) {\n vec2 p=logicalOrigin+uv*logicalSize-origin;\n float c=cos(angle),s=sin(angle);\n return vec2(c*p.x+s*p.y,-s*p.x+c*p.y)/size;\n}\nvec4 sourcePixel(ivec2 p) {\n ivec2 size=textureSize(scene,0);\n if(any(lessThan(p,ivec2(0)))||any(greaterThanEqual(p,size))) return vec4(0);\n return texelFetch(scene,p,0);\n}\nvec4 sourceSample(vec2 p) {\n vec2 pixel=p*vec2(textureSize(scene,0))-.5;\n ivec2 base=ivec2(floor(pixel)); vec2 f=fract(pixel);\n return mix(mix(sourcePixel(base),sourcePixel(base+ivec2(1,0)),f.x),mix(sourcePixel(base+ivec2(0,1)),sourcePixel(base+ivec2(1,1)),f.x),f.y);\n}\nvoid main() {\n vec4 warp=texture(warpMap,coordinates(warpOrigin,warpSize,warpRotation));\n vec4 base=sourceSample(uv+vec2(decode(warp.r),decode(warp.g))*warp.a*warpStrength);\n vec4 field=texture(map,coordinates(mapOrigin,tileSize,rotation));\n vec2 slope=vec2(decode(field.r),decode(field.g));\n float coverage=smoothstep(threshold,threshold+softness,dot(slope,direction))*field.a*opacity;\n vec4 light=texture(lightMap,coordinates(lightOrigin,lightSize,lightRotation)+slope*.035);\n float amount=coverage*light.a;\n outputColor=vec4(base.rgb*(1.-amount)+base.a*light.rgb*amount,base.a);\n}\n`;\n\n/** Optional synchronous image processor; scene pixels are never read back. */\nexport class ReflectionGpu {\n private readonly canvas = new OffscreenCanvas(1, 1);\n private gl: WebGL2RenderingContext | undefined;\n private resources: ReflectionResources | undefined;\n private readonly maps = new Map<object, { texture: WebGLTexture; revision: number }>();\n private readonly directKey = {};\n private colorCanvas: OffscreenCanvas | undefined;\n private directRevision = 0;\n private disposed = false;\n private lost = false;\n private readonly onContextLost = (event: Event): void => {\n event.preventDefault();\n if (this.disposed || this.lost) return;\n this.lost = true;\n this.releaseResources(false);\n this.callbacks.onContextLost?.();\n };\n private readonly onContextRestored = (): void => {\n if (this.disposed || !this.lost) return;\n this.lost = false;\n this.callbacks.onContextRestored?.();\n };\n\n constructor(private readonly callbacks: Readonly<ReflectionGpuCallbacks> = {}, private readonly fragment = fragmentSource) {\n this.canvas.addEventListener('webglcontextlost', this.onContextLost);\n this.canvas.addEventListener('webglcontextrestored', this.onContextRestored);\n }\n\n get isContextLost(): boolean {\n return this.lost || this.gl?.isContextLost() === true;\n }\n\n private acquireResources(): ReflectionResources {\n if (this.disposed) throw new Error('Cannot use a disposed reflection processor.');\n if (this.isContextLost) throw new Error('Reflection WebGL2 context was lost.');\n if (this.resources) return this.resources;\n const gl = this.canvas.getContext('webgl2', { premultipliedAlpha: true, preserveDrawingBuffer: false });\n if (!gl) throw new Error('Reflection requires OffscreenCanvas WebGL2 support.');\n if (gl.isContextLost()) throw new Error('Reflection WebGL2 context was lost.');\n this.gl = gl;\n const vertex = compile(gl, gl.VERTEX_SHADER, vertexSource);\n let fragment: WebGLShader | undefined;\n let program: WebGLProgram | null = null;\n try {\n fragment = compile(gl, gl.FRAGMENT_SHADER, this.fragment);\n program = gl.createProgram();\n if (!program) throw new Error('Could not allocate reflection program.');\n gl.attachShader(program, vertex); gl.attachShader(program, fragment); gl.linkProgram(program);\n if (!gl.getProgramParameter(program, gl.LINK_STATUS)) throw new Error(`Reflection shader link failed: ${gl.getProgramInfoLog(program)}`);\n } catch (error) { if (program) gl.deleteProgram(program); throw error; }\n finally { gl.deleteShader(vertex); if (fragment) gl.deleteShader(fragment); }\n const vao = gl.createVertexArray(), buffer = gl.createBuffer();\n if (!vao || !buffer) { if (vao) gl.deleteVertexArray(vao); if (buffer) gl.deleteBuffer(buffer); gl.deleteProgram(program); throw new Error('Could not allocate reflection geometry.'); }\n gl.bindVertexArray(vao); gl.bindBuffer(gl.ARRAY_BUFFER, buffer);\n gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([-1, -1, 1, -1, -1, 1, 1, 1]), gl.STATIC_DRAW);\n const location = gl.getAttribLocation(program, 'p');\n gl.enableVertexAttribArray(location); gl.vertexAttribPointer(location, 2, gl.FLOAT, false, 0, 0);\n const source = gl.createTexture();\n if (!source) {\n if (source) gl.deleteTexture(source);\n gl.deleteBuffer(buffer); gl.deleteVertexArray(vao); gl.deleteProgram(program);\n throw new Error('Could not allocate reflection textures.');\n }\n const resources: ReflectionResources = { program, vao, buffer, source };\n gl.pixelStorei(gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, gl.NONE);\n this.resources = resources;\n return resources;\n }\n\n apply(source: OffscreenCanvas, map: BorrowedTextureRaster, light: ReflectionLight, settings: ReflectionSettings, coordinates: ReflectionCoordinates, warp?: ReflectionWarp): ImageBitmap {\n const { gl, program, vao, source: sourceTexture } = this.acquireResourcesWithContext();\n const maximum = gl.getParameter(gl.MAX_TEXTURE_SIZE) as number;\n if (Math.max(source.width, source.height, map.width, map.height, warp?.map.width ?? 0, warp?.map.height ?? 0) > maximum) throw new RangeError('Reflection target exceeds WebGL2 maximum texture size.');\n if (this.canvas.width !== source.width) this.canvas.width = source.width;\n if (this.canvas.height !== source.height) this.canvas.height = source.height;\n gl.viewport(0, 0, source.width, source.height); gl.useProgram(program); gl.bindVertexArray(vao);\n this.upload(gl, 0, sourceTexture, source, true, false);\n const uploaded = new Map<object, number>();\n const bind = (unit: number, raster: {source: TexImageSource; width:number; height:number; resource:object; revision:number; placement:Readonly<TexturePlacement>}) => {\n if (Math.max(raster.width,raster.height)>maximum) throw new RangeError('Reflection light exceeds WebGL2 maximum texture size.');\n let cached=this.maps.get(raster.resource);\n if (!cached) {\n const texture=gl.createTexture(); if(!texture) throw new Error('Could not allocate reflection input texture.');\n cached={texture,revision:-1}; this.maps.set(raster.resource,cached);\n }\n this.upload(gl,unit,cached.texture,raster.source,false,raster.placement.mode!=='stretch',cached.revision!==raster.revision && uploaded.get(raster.resource)!==raster.revision);\n uploaded.set(raster.resource,raster.revision);\n };\n bind(1,map); bind(3,warp?.map ?? map);\n let lightPlacement: Readonly<TexturePlacement> = {mode:'stretch'};\n let lightWidth=1,lightHeight=1;\n if ('raster' in light) { bind(2,light.raster); lightPlacement=light.raster.placement; lightWidth=light.raster.width; lightHeight=light.raster.height; }\n else {\n let image: TexImageSource;\n if ('color' in light) {\n const canvas=this.colorCanvas ??= new OffscreenCanvas(1,1);\n const ctx=canvas.getContext('2d'); if(!ctx) throw new Error('Reflection colors require Canvas 2D.');\n ctx.clearRect(0,0,1,1); ctx.fillStyle=light.color; ctx.fillRect(0,0,1,1); image=canvas;\n } else { image=light.image; lightWidth='naturalWidth' in light.image?light.image.naturalWidth:light.image.width; lightHeight='naturalHeight' in light.image?light.image.naturalHeight:light.image.height; }\n bind(2,{source:image,width:lightWidth,height:lightHeight,resource:this.directKey,revision:++this.directRevision,placement:lightPlacement});\n }\n const uniform=(name:string)=>gl.getUniformLocation(program,name);\n const placement=(origin:string,size:string,angle:string,value:Readonly<TexturePlacement>,region:ReflectionCoordinates['region'],width:number,height:number)=>{\n gl.uniform2f(uniform(origin),region.x+(value.offsetX??0),region.y+(value.offsetY??0));\n gl.uniform2f(uniform(size),value.mode==='stretch'?region.width:value.tileWidth??width,value.mode==='stretch'?region.height:value.tileHeight??height);\n gl.uniform1f(uniform(angle),(value.rotation??0)*Math.PI/180);\n };\n gl.uniform1i(uniform('scene'),0); gl.uniform1i(uniform('map'),1); gl.uniform1i(uniform('lightMap'),2); gl.uniform1i(uniform('warpMap'),3);\n gl.uniform2f(uniform('logicalOrigin'),coordinates.originX,coordinates.originY);\n gl.uniform2f(uniform('logicalSize'),source.width/coordinates.density,source.height/coordinates.density);\n placement('mapOrigin','tileSize','rotation',map.placement,coordinates.region,map.width,map.height);\n placement('lightOrigin','lightSize','lightRotation',lightPlacement,coordinates.region,lightWidth,lightHeight);\n placement('warpOrigin','warpSize','warpRotation',warp?.map.placement??map.placement,warp?.region??coordinates.region,warp?.map.width??map.width,warp?.map.height??map.height);\n gl.uniform2f(uniform('warpStrength'),(warp?.strength??0)*coordinates.density/source.width,(warp?.strength??0)*coordinates.density/source.height);\n gl.uniform2f(uniform('direction'),settings.direction[0],settings.direction[1]);\n gl.uniform1f(uniform('depth'),settings.depth ?? 0);\n gl.uniform1f(uniform('opacity'),settings.opacity); gl.uniform1f(uniform('threshold'),settings.threshold); gl.uniform1f(uniform('softness'),settings.softness);\n gl.drawArrays(gl.TRIANGLE_STRIP,0,4);\n if(this.isContextLost) throw new Error('Reflection WebGL2 context was lost.');\n const error=gl.getError(); if(error!==gl.NO_ERROR) throw new Error(`Reflection GPU processing failed (${error}).`);\n for(const [resource,revision] of uploaded) this.maps.get(resource)!.revision=revision;\n return this.canvas.transferToImageBitmap();\n }\n private acquireResourcesWithContext(): ReflectionResources & { gl: WebGL2RenderingContext } {\n const resources = this.acquireResources();\n const gl = this.gl;\n if (!gl || gl.isContextLost()) throw new Error('Reflection WebGL2 context was lost.');\n return { ...resources, gl };\n }\n private upload(gl: WebGL2RenderingContext, unit: number, texture: WebGLTexture, canvas: TexImageSource, premultiply: boolean, repeat: boolean, upload = true): void {\n gl.activeTexture(gl.TEXTURE0 + unit); gl.bindTexture(gl.TEXTURE_2D, texture);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, repeat ? gl.REPEAT : gl.CLAMP_TO_EDGE);\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, repeat ? gl.REPEAT : gl.CLAMP_TO_EDGE);\n gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, premultiply);\n if (upload) gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, canvas);\n }\n retainMaps(resources: ReadonlySet<object>): void {\n const gl = this.gl;\n for (const [resource, cached] of this.maps) {\n if (resource !== this.directKey && !resources.has(resource)) { if (gl && !gl.isContextLost()) gl.deleteTexture(cached.texture); this.maps.delete(resource); }\n }\n }\n private releaseResources(deleteResources: boolean): void {\n const gl = this.gl;\n const resources = this.resources;\n this.resources = undefined;\n if (gl && !gl.isContextLost() && deleteResources) {\n gl.deleteTexture(resources?.source ?? null);\n for (const cached of this.maps.values()) gl.deleteTexture(cached.texture);\n if (resources) { gl.deleteBuffer(resources.buffer); gl.deleteVertexArray(resources.vao); gl.deleteProgram(resources.program); }\n }\n this.maps.clear();\n }\n dispose(): void {\n if (this.disposed) return;\n this.disposed = true;\n this.canvas.removeEventListener('webglcontextlost', this.onContextLost);\n this.canvas.removeEventListener('webglcontextrestored', this.onContextRestored);\n this.releaseResources(true);\n this.canvas.width = 0; this.canvas.height = 0;\n if(this.colorCanvas) this.colorCanvas.width=this.colorCanvas.height=0;\n this.colorCanvas=undefined;\n }\n}\ninterface ReflectionResources {\n readonly program: WebGLProgram;\n readonly vao: WebGLVertexArrayObject;\n readonly buffer: WebGLBuffer;\n readonly source: WebGLTexture;\n}\nfunction compile(gl: WebGL2RenderingContext, kind: number, source: string): WebGLShader {\n const shader = gl.createShader(kind);\n if (!shader) throw new Error('Could not allocate reflection shader.');\n gl.shaderSource(shader, source); gl.compileShader(shader);\n if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) {\n const error = gl.getShaderInfoLog(shader); gl.deleteShader(shader);\n throw new Error(`Reflection shader compile failed: ${error}`);\n }\n return shader;\n}\n"],
|
|
5
|
+
"mappings": "AAYA,MAAM,eAAe;AAAA;AAAA;AAAA;AAAA;AAYrB,MAAM,iBAAiB;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;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAoChB,MAAM,cAAc;AAAA,EAuBzB,YAA6B,YAA8C,CAAC,GAAoB,WAAW,gBAAgB;AAA9F;AAAmE;AAC9F,SAAK,OAAO,iBAAiB,oBAAoB,KAAK,aAAa;AACnE,SAAK,OAAO,iBAAiB,wBAAwB,KAAK,iBAAiB;AAAA,EAC7E;AAAA,EAH6B;AAAA,EAAmE;AAAA,EAtB/E,SAAS,IAAI,gBAAgB,GAAG,CAAC;AAAA,EAC1C;AAAA,EACA;AAAA,EACS,OAAO,oBAAI,IAAyD;AAAA,EACpE,YAAY,CAAC;AAAA,EAC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,YAAY;AACjB,QAAI,MAAM,CAAC,GAAG,cAAc,KAAK,iBAAiB;AAChD,SAAG,cAAc,WAAW,UAAU,IAAI;AAC1C,iBAAW,UAAU,KAAK,KAAK,OAAO,EAAG,IAAG,cAAc,OAAO,OAAO;AACxE,UAAI,WAAW;AAAE,WAAG,aAAa,UAAU,MAAM;AAAG,WAAG,kBAAkB,UAAU,GAAG;AAAG,WAAG,cAAc,UAAU,OAAO;AAAA,MAAG;AAAA,IAChI;AACA,SAAK,KAAK,MAAM;AAAA,EAClB;AAAA,EACA,UAAgB;AACd,QAAI,KAAK,SAAU;AACnB,SAAK,WAAW;AAChB,SAAK,OAAO,oBAAoB,oBAAoB,KAAK,aAAa;AACtE,SAAK,OAAO,oBAAoB,wBAAwB,KAAK,iBAAiB;AAC9E,SAAK,iBAAiB,IAAI;AAC1B,SAAK,OAAO,QAAQ;AAAG,SAAK,OAAO,SAAS;AAC5C,QAAG,KAAK,YAAa,MAAK,YAAY,QAAM,KAAK,YAAY,SAAO;AACpE,SAAK,cAAY;AAAA,EACnB;AACF;AAOA,SAAS,QAAQ,IAA4B,MAAc,QAA6B;AACtF,QAAM,SAAS,GAAG,aAAa,IAAI;AACnC,MAAI,CAAC,OAAQ,OAAM,IAAI,MAAM,uCAAuC;AACpE,KAAG,aAAa,QAAQ,MAAM;AAAG,KAAG,cAAc,MAAM;AACxD,MAAI,CAAC,GAAG,mBAAmB,QAAQ,GAAG,cAAc,GAAG;AACrD,UAAM,QAAQ,GAAG,iBAAiB,MAAM;AAAG,OAAG,aAAa,MAAM;AACjE,UAAM,IAAI,MAAM,qCAAqC,KAAK,EAAE;AAAA,EAC9D;AACA,SAAO;AACT;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { PibblInstance } from "../lib/types.js";
|
|
2
|
+
import type { FilterWindows } from "../lib/filter/filter-region.js";
|
|
3
|
+
import type { FilterBackdrop } from "./filter-executor.js";
|
|
4
|
+
import { BackdropContrastGpu } from "./backdrop-contrast-gpu.js";
|
|
5
|
+
declare class BackdropContrastService {
|
|
6
|
+
private readonly instance;
|
|
7
|
+
readonly gpu: BackdropContrastGpu;
|
|
8
|
+
private readonly backdrop;
|
|
9
|
+
private readonly palette;
|
|
10
|
+
private revision;
|
|
11
|
+
private paletteRevision;
|
|
12
|
+
private colors;
|
|
13
|
+
private committed;
|
|
14
|
+
private disposed;
|
|
15
|
+
used: boolean;
|
|
16
|
+
constructor(instance: PibblInstance);
|
|
17
|
+
beginRender(): void;
|
|
18
|
+
endRender(success: boolean): void;
|
|
19
|
+
apply(source: OffscreenCanvas, windows: FilterWindows, input: FilterBackdrop, colors: Readonly<{
|
|
20
|
+
light: string;
|
|
21
|
+
dark: string;
|
|
22
|
+
}>): ImageBitmap;
|
|
23
|
+
dispose(): void;
|
|
24
|
+
}
|
|
25
|
+
/** @internal Read-only ownership evidence; never creates resources. */
|
|
26
|
+
export declare function peekBackdropContrastService(instance: PibblInstance): BackdropContrastService | undefined;
|
|
27
|
+
export declare function processBackdropContrast(source: OffscreenCanvas, windows: FilterWindows, backdrop: FilterBackdrop, colors: Readonly<{
|
|
28
|
+
light: string;
|
|
29
|
+
dark: string;
|
|
30
|
+
}>): ImageBitmap;
|
|
31
|
+
export {};
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { GLOBAL_STATE } from "../lib/global-state.js";
|
|
2
|
+
import { getOptionalService } from "../lib/optional-services.js";
|
|
3
|
+
import { update } from "../lib/update.js";
|
|
4
|
+
import { BackdropContrastGpu } from "./backdrop-contrast-gpu.js";
|
|
5
|
+
const SERVICE = /* @__PURE__ */ Symbol("pibbl.backdrop-contrast");
|
|
6
|
+
class BackdropContrastService {
|
|
7
|
+
constructor(instance) {
|
|
8
|
+
this.instance = instance;
|
|
9
|
+
this.gpu = new BackdropContrastGpu({
|
|
10
|
+
onContextRestored: () => {
|
|
11
|
+
if (!this.disposed && !instance.mainTeardowns.closed)
|
|
12
|
+
update(instance.canvas, void 0, true);
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
instance;
|
|
17
|
+
gpu;
|
|
18
|
+
backdrop = new OffscreenCanvas(1, 1);
|
|
19
|
+
palette = new OffscreenCanvas(2, 1);
|
|
20
|
+
revision = 0;
|
|
21
|
+
paletteRevision = 0;
|
|
22
|
+
colors = "";
|
|
23
|
+
committed = false;
|
|
24
|
+
disposed = false;
|
|
25
|
+
used = false;
|
|
26
|
+
beginRender() {
|
|
27
|
+
this.used = false;
|
|
28
|
+
}
|
|
29
|
+
endRender(success) {
|
|
30
|
+
if (success && this.used) {
|
|
31
|
+
this.committed = true;
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
if (success || !this.committed) this.dispose();
|
|
35
|
+
}
|
|
36
|
+
apply(source, windows, input, colors) {
|
|
37
|
+
this.used = true;
|
|
38
|
+
if (this.backdrop.width !== source.width)
|
|
39
|
+
this.backdrop.width = source.width;
|
|
40
|
+
if (this.backdrop.height !== source.height)
|
|
41
|
+
this.backdrop.height = source.height;
|
|
42
|
+
const context = this.backdrop.getContext("2d");
|
|
43
|
+
if (!context)
|
|
44
|
+
throw new Error("backdropContrast requires OffscreenCanvas 2D.");
|
|
45
|
+
context.reset();
|
|
46
|
+
context.setTransform(input.transform);
|
|
47
|
+
context.drawImage(input.canvas, 0, 0);
|
|
48
|
+
const colorKey = JSON.stringify([colors.light, colors.dark]);
|
|
49
|
+
if (this.colors !== colorKey) {
|
|
50
|
+
const palette = this.palette.getContext("2d");
|
|
51
|
+
if (!palette)
|
|
52
|
+
throw new Error("backdropContrast colors require OffscreenCanvas 2D.");
|
|
53
|
+
palette.reset();
|
|
54
|
+
palette.fillStyle = colors.light;
|
|
55
|
+
palette.fillRect(0, 0, 1, 1);
|
|
56
|
+
palette.fillStyle = colors.dark;
|
|
57
|
+
palette.fillRect(1, 0, 1, 1);
|
|
58
|
+
this.colors = colorKey;
|
|
59
|
+
this.paletteRevision++;
|
|
60
|
+
}
|
|
61
|
+
const raster = (canvas, revision) => ({
|
|
62
|
+
source: canvas,
|
|
63
|
+
width: canvas.width,
|
|
64
|
+
height: canvas.height,
|
|
65
|
+
resource: canvas,
|
|
66
|
+
revision,
|
|
67
|
+
placement: { mode: "stretch" }
|
|
68
|
+
});
|
|
69
|
+
const region = windows.source.logicalBounds;
|
|
70
|
+
return this.gpu.apply(
|
|
71
|
+
source,
|
|
72
|
+
raster(this.backdrop, ++this.revision),
|
|
73
|
+
{ raster: raster(this.palette, this.paletteRevision) },
|
|
74
|
+
{ opacity: 1, threshold: 0, softness: 1, direction: [0, 1] },
|
|
75
|
+
{
|
|
76
|
+
originX: region.x,
|
|
77
|
+
originY: region.y,
|
|
78
|
+
density: windows.density,
|
|
79
|
+
region
|
|
80
|
+
}
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
dispose() {
|
|
84
|
+
if (this.disposed) return;
|
|
85
|
+
this.disposed = true;
|
|
86
|
+
this.gpu.dispose();
|
|
87
|
+
this.backdrop.width = this.backdrop.height = this.palette.width = this.palette.height = 0;
|
|
88
|
+
this.instance.optionalServices.delete(SERVICE);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
function peekBackdropContrastService(instance) {
|
|
92
|
+
return instance.optionalServices.get(SERVICE);
|
|
93
|
+
}
|
|
94
|
+
function processBackdropContrast(source, windows, backdrop, colors) {
|
|
95
|
+
const instance = GLOBAL_STATE.currentPibblInstance;
|
|
96
|
+
if (!instance)
|
|
97
|
+
throw new Error("backdropContrast requires an active Pibbl instance.");
|
|
98
|
+
const service = getOptionalService(
|
|
99
|
+
instance,
|
|
100
|
+
SERVICE,
|
|
101
|
+
() => new BackdropContrastService(instance)
|
|
102
|
+
);
|
|
103
|
+
try {
|
|
104
|
+
return service.apply(source, windows, backdrop, colors);
|
|
105
|
+
} catch (error) {
|
|
106
|
+
throw new Error(
|
|
107
|
+
`backdropContrast processing failed: ${error instanceof Error ? error.message : String(error)}`,
|
|
108
|
+
{ cause: error }
|
|
109
|
+
);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
export {
|
|
113
|
+
peekBackdropContrastService,
|
|
114
|
+
processBackdropContrast
|
|
115
|
+
};
|
|
116
|
+
//# sourceMappingURL=render-backdrop-contrast-boundary.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/filters/render-backdrop-contrast-boundary.ts"],
|
|
4
|
+
"sourcesContent": ["import { GLOBAL_STATE } from \"../lib/global-state.js\";\nimport { getOptionalService } from \"../lib/optional-services.js\";\nimport { update } from \"../lib/update.js\";\nimport type { PibblInstance } from \"../lib/types.js\";\nimport type { FilterWindows } from \"../lib/filter/filter-region.js\";\nimport type { FilterBackdrop } from \"./filter-executor.js\";\nimport type { BorrowedTextureRaster } from \"../lib/textures/texture-protocol.js\";\nimport { BackdropContrastGpu } from \"./backdrop-contrast-gpu.js\";\n\nconst SERVICE = Symbol(\"pibbl.backdrop-contrast\");\nclass BackdropContrastService {\n readonly gpu: BackdropContrastGpu;\n private readonly backdrop = new OffscreenCanvas(1, 1);\n private readonly palette = new OffscreenCanvas(2, 1);\n private revision = 0;\n private paletteRevision = 0;\n private colors = \"\";\n private committed = false;\n private disposed = false;\n used = false;\n constructor(private readonly instance: PibblInstance) {\n this.gpu = new BackdropContrastGpu({\n onContextRestored: () => {\n if (!this.disposed && !instance.mainTeardowns.closed)\n update(instance.canvas, undefined, true);\n },\n });\n }\n beginRender(): void {\n this.used = false;\n }\n endRender(success: boolean): void {\n if (success && this.used) {\n this.committed = true;\n return;\n }\n if (success || !this.committed) this.dispose();\n }\n apply(\n source: OffscreenCanvas,\n windows: FilterWindows,\n input: FilterBackdrop,\n colors: Readonly<{ light: string; dark: string }>,\n ): ImageBitmap {\n this.used = true;\n if (this.backdrop.width !== source.width)\n this.backdrop.width = source.width;\n if (this.backdrop.height !== source.height)\n this.backdrop.height = source.height;\n const context = this.backdrop.getContext(\"2d\");\n if (!context)\n throw new Error(\"backdropContrast requires OffscreenCanvas 2D.\");\n context.reset();\n context.setTransform(input.transform);\n context.drawImage(input.canvas, 0, 0);\n const colorKey = JSON.stringify([colors.light, colors.dark]);\n if (this.colors !== colorKey) {\n const palette = this.palette.getContext(\"2d\");\n if (!palette)\n throw new Error(\"backdropContrast colors require OffscreenCanvas 2D.\");\n palette.reset();\n palette.fillStyle = colors.light;\n palette.fillRect(0, 0, 1, 1);\n palette.fillStyle = colors.dark;\n palette.fillRect(1, 0, 1, 1);\n this.colors = colorKey;\n this.paletteRevision++;\n }\n const raster = (\n canvas: OffscreenCanvas,\n revision: number,\n ): BorrowedTextureRaster => ({\n source: canvas,\n width: canvas.width,\n height: canvas.height,\n resource: canvas,\n revision,\n placement: { mode: \"stretch\" },\n });\n const region = windows.source.logicalBounds;\n return this.gpu.apply(\n source,\n raster(this.backdrop, ++this.revision),\n { raster: raster(this.palette, this.paletteRevision) },\n { opacity: 1, threshold: 0, softness: 1, direction: [0, 1] },\n {\n originX: region.x,\n originY: region.y,\n density: windows.density,\n region,\n },\n );\n }\n dispose(): void {\n if (this.disposed) return;\n this.disposed = true;\n this.gpu.dispose();\n this.backdrop.width =\n this.backdrop.height =\n this.palette.width =\n this.palette.height =\n 0;\n this.instance.optionalServices.delete(SERVICE);\n }\n}\n/** @internal Read-only ownership evidence; never creates resources. */\nexport function peekBackdropContrastService(\n instance: PibblInstance,\n): BackdropContrastService | undefined {\n return instance.optionalServices.get(SERVICE) as\n BackdropContrastService | undefined;\n}\nexport function processBackdropContrast(\n source: OffscreenCanvas,\n windows: FilterWindows,\n backdrop: FilterBackdrop,\n colors: Readonly<{ light: string; dark: string }>,\n): ImageBitmap {\n const instance = GLOBAL_STATE.currentPibblInstance;\n if (!instance)\n throw new Error(\"backdropContrast requires an active Pibbl instance.\");\n const service = getOptionalService(\n instance,\n SERVICE,\n () => new BackdropContrastService(instance),\n );\n try {\n return service.apply(source, windows, backdrop, colors);\n } catch (error) {\n throw new Error(\n `backdropContrast processing failed: ${error instanceof Error ? error.message : String(error)}`,\n { cause: error },\n );\n }\n}\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,oBAAoB;AAC7B,SAAS,0BAA0B;AACnC,SAAS,cAAc;AAKvB,SAAS,2BAA2B;AAEpC,MAAM,UAAU,uBAAO,yBAAyB;AAChD,MAAM,wBAAwB;AAAA,EAU5B,YAA6B,UAAyB;AAAzB;AAC3B,SAAK,MAAM,IAAI,oBAAoB;AAAA,MACjC,mBAAmB,MAAM;AACvB,YAAI,CAAC,KAAK,YAAY,CAAC,SAAS,cAAc;AAC5C,iBAAO,SAAS,QAAQ,QAAW,IAAI;AAAA,MAC3C;AAAA,IACF,CAAC;AAAA,EACH;AAAA,EAP6B;AAAA,EATpB;AAAA,EACQ,WAAW,IAAI,gBAAgB,GAAG,CAAC;AAAA,EACnC,UAAU,IAAI,gBAAgB,GAAG,CAAC;AAAA,EAC3C,WAAW;AAAA,EACX,kBAAkB;AAAA,EAClB,SAAS;AAAA,EACT,YAAY;AAAA,EACZ,WAAW;AAAA,EACnB,OAAO;AAAA,EASP,cAAoB;AAClB,SAAK,OAAO;AAAA,EACd;AAAA,EACA,UAAU,SAAwB;AAChC,QAAI,WAAW,KAAK,MAAM;AACxB,WAAK,YAAY;AACjB;AAAA,IACF;AACA,QAAI,WAAW,CAAC,KAAK,UAAW,MAAK,QAAQ;AAAA,EAC/C;AAAA,EACA,MACE,QACA,SACA,OACA,QACa;AACb,SAAK,OAAO;AACZ,QAAI,KAAK,SAAS,UAAU,OAAO;AACjC,WAAK,SAAS,QAAQ,OAAO;AAC/B,QAAI,KAAK,SAAS,WAAW,OAAO;AAClC,WAAK,SAAS,SAAS,OAAO;AAChC,UAAM,UAAU,KAAK,SAAS,WAAW,IAAI;AAC7C,QAAI,CAAC;AACH,YAAM,IAAI,MAAM,+CAA+C;AACjE,YAAQ,MAAM;AACd,YAAQ,aAAa,MAAM,SAAS;AACpC,YAAQ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C;AACrC,SAAO,SAAS,iBAAiB,IAAI,OAAO;AAE9C;AACO,SAAS,wBACd,QACA,SACA,UACA,QACa;AACb,QAAM,WAAW,aAAa;AAC9B,MAAI,CAAC;AACH,UAAM,IAAI,MAAM,qDAAqD;AACvE,QAAM,UAAU;AAAA,IACd;AAAA,IACA;AAAA,IACA,MAAM,IAAI,wBAAwB,QAAQ;AAAA,EAC5C;AACA,MAAI;AACF,WAAO,QAAQ,MAAM,QAAQ,SAAS,UAAU,MAAM;AAAA,EACxD,SAAS,OAAO;AACd,UAAM,IAAI;AAAA,MACR,uCAAuC,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,CAAC;AAAA,MAC7F,EAAE,OAAO,MAAM;AAAA,IACjB;AAAA,EACF;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type TexturePaint } from "../lib/textures/texture-protocol.js";
|
|
2
|
+
import type { PibblInstance } from "../lib/types.js";
|
|
3
|
+
import type { FilterWindows } from "../lib/filter/filter-region.js";
|
|
4
|
+
import { EmbossGpu } from "./emboss-gpu.js";
|
|
5
|
+
import type { ReflectionSettings } from "./reflection-gpu.js";
|
|
6
|
+
/** @internal Test-only read-only access; it never creates a GPU service. */
|
|
7
|
+
export declare function peekEmbossGpu(instance: PibblInstance): EmbossGpu | undefined;
|
|
8
|
+
export declare function processEmboss(source: OffscreenCanvas, windows: FilterWindows, paint: TexturePaint, settings: ReflectionSettings, region: Readonly<{
|
|
9
|
+
x: number;
|
|
10
|
+
y: number;
|
|
11
|
+
width: number;
|
|
12
|
+
height: number;
|
|
13
|
+
}>): ImageBitmap;
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import {
|
|
2
|
+
borrowTextureRaster
|
|
3
|
+
} from "../lib/textures/texture-protocol.js";
|
|
4
|
+
import { GLOBAL_STATE, getPibblInstance } from "../lib/global-state.js";
|
|
5
|
+
import { getOptionalService } from "../lib/optional-services.js";
|
|
6
|
+
import { update } from "../lib/update.js";
|
|
7
|
+
import { EmbossGpu } from "./emboss-gpu.js";
|
|
8
|
+
const GPU_BORROWER = /* @__PURE__ */ Symbol("pibbl.emboss-borrower");
|
|
9
|
+
const rootServices = /* @__PURE__ */ new WeakMap();
|
|
10
|
+
class RootGpuService {
|
|
11
|
+
constructor(root) {
|
|
12
|
+
this.root = root;
|
|
13
|
+
this.gpu = new EmbossGpu({
|
|
14
|
+
onContextRestored: () => {
|
|
15
|
+
if (this.disposed || this.recoveryRequested || this.root.mainTeardowns.closed)
|
|
16
|
+
return;
|
|
17
|
+
this.recoveryRequested = true;
|
|
18
|
+
for (const borrower of this.borrowers)
|
|
19
|
+
update(borrower.instance.canvas, void 0, true);
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
root;
|
|
24
|
+
gpu;
|
|
25
|
+
borrowers = /* @__PURE__ */ new Set();
|
|
26
|
+
disposed = false;
|
|
27
|
+
recoveryRequested = false;
|
|
28
|
+
beginRender() {
|
|
29
|
+
this.recoveryRequested = false;
|
|
30
|
+
}
|
|
31
|
+
pruneMaps() {
|
|
32
|
+
const resources = /* @__PURE__ */ new Set();
|
|
33
|
+
for (const borrower of this.borrowers)
|
|
34
|
+
for (const resource of borrower.resources) resources.add(resource);
|
|
35
|
+
this.gpu.retainMaps(resources);
|
|
36
|
+
}
|
|
37
|
+
dispose() {
|
|
38
|
+
this.disposed = true;
|
|
39
|
+
this.gpu.dispose();
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
class GpuBorrower {
|
|
43
|
+
constructor(instance) {
|
|
44
|
+
this.instance = instance;
|
|
45
|
+
let root = instance;
|
|
46
|
+
while (root.parent) root = getPibblInstance(root.parent);
|
|
47
|
+
this.root = root;
|
|
48
|
+
let shared = rootServices.get(root);
|
|
49
|
+
if (!shared) {
|
|
50
|
+
shared = new RootGpuService(root);
|
|
51
|
+
rootServices.set(root, shared);
|
|
52
|
+
}
|
|
53
|
+
this.shared = shared;
|
|
54
|
+
shared.borrowers.add(this);
|
|
55
|
+
}
|
|
56
|
+
instance;
|
|
57
|
+
used = false;
|
|
58
|
+
resources = /* @__PURE__ */ new Set();
|
|
59
|
+
candidates = /* @__PURE__ */ new Set();
|
|
60
|
+
committed = false;
|
|
61
|
+
disposed = false;
|
|
62
|
+
shared;
|
|
63
|
+
root;
|
|
64
|
+
beginRender() {
|
|
65
|
+
this.shared.beginRender();
|
|
66
|
+
this.used = false;
|
|
67
|
+
this.candidates.clear();
|
|
68
|
+
}
|
|
69
|
+
useMap(resource) {
|
|
70
|
+
this.candidates.add(resource);
|
|
71
|
+
}
|
|
72
|
+
endRender(success) {
|
|
73
|
+
if (success && this.used) {
|
|
74
|
+
this.committed = true;
|
|
75
|
+
this.resources = new Set(this.candidates);
|
|
76
|
+
this.shared.pruneMaps();
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
if (success || !this.committed) {
|
|
80
|
+
this.dispose();
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
if (!this.shared.gpu.isContextLost) this.shared.pruneMaps();
|
|
84
|
+
}
|
|
85
|
+
dispose() {
|
|
86
|
+
if (this.disposed) return;
|
|
87
|
+
this.disposed = true;
|
|
88
|
+
this.instance.optionalServices.delete(GPU_BORROWER);
|
|
89
|
+
this.shared.borrowers.delete(this);
|
|
90
|
+
if (this.shared.borrowers.size === 0) {
|
|
91
|
+
rootServices.delete(this.root);
|
|
92
|
+
this.shared.dispose();
|
|
93
|
+
} else this.shared.pruneMaps();
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
function peekEmbossGpu(instance) {
|
|
97
|
+
let root = instance;
|
|
98
|
+
while (root.parent) root = getPibblInstance(root.parent);
|
|
99
|
+
return rootServices.get(root)?.gpu;
|
|
100
|
+
}
|
|
101
|
+
function processEmboss(source, windows, paint, settings, region) {
|
|
102
|
+
const instance = GLOBAL_STATE.currentPibblInstance;
|
|
103
|
+
if (!instance) throw new Error("Emboss requires an active Pibbl instance.");
|
|
104
|
+
const borrower = getOptionalService(
|
|
105
|
+
instance,
|
|
106
|
+
GPU_BORROWER,
|
|
107
|
+
() => new GpuBorrower(instance)
|
|
108
|
+
);
|
|
109
|
+
borrower.used = true;
|
|
110
|
+
return borrowTextureRaster(paint, (map) => {
|
|
111
|
+
borrower.useMap(map.resource);
|
|
112
|
+
const coordinates = {
|
|
113
|
+
originX: windows.source.backingX / windows.density,
|
|
114
|
+
originY: windows.source.backingY / windows.density,
|
|
115
|
+
density: windows.density,
|
|
116
|
+
region
|
|
117
|
+
};
|
|
118
|
+
return borrower.shared.gpu.apply(
|
|
119
|
+
source,
|
|
120
|
+
map,
|
|
121
|
+
{ color: "#ffffff" },
|
|
122
|
+
settings,
|
|
123
|
+
coordinates
|
|
124
|
+
);
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
export {
|
|
128
|
+
peekEmbossGpu,
|
|
129
|
+
processEmboss
|
|
130
|
+
};
|
|
131
|
+
//# sourceMappingURL=render-emboss-boundary.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/filters/render-emboss-boundary.ts"],
|
|
4
|
+
"sourcesContent": ["import {\n borrowTextureRaster,\n type TexturePaint,\n} from \"../lib/textures/texture-protocol.js\";\nimport { GLOBAL_STATE, getPibblInstance } from \"../lib/global-state.js\";\nimport { getOptionalService } from \"../lib/optional-services.js\";\nimport { update } from \"../lib/update.js\";\nimport type { PibblInstance } from \"../lib/types.js\";\nimport type { FilterWindows } from \"../lib/filter/filter-region.js\";\nimport { EmbossGpu } from \"./emboss-gpu.js\";\nimport type { ReflectionSettings } from \"./reflection-gpu.js\";\n\nconst GPU_BORROWER = Symbol(\"pibbl.emboss-borrower\");\nconst rootServices = new WeakMap<PibblInstance, RootGpuService>();\n\nclass RootGpuService {\n readonly gpu: EmbossGpu;\n readonly borrowers = new Set<GpuBorrower>();\n private disposed = false;\n private recoveryRequested = false;\n constructor(private readonly root: PibblInstance) {\n this.gpu = new EmbossGpu({\n onContextRestored: () => {\n if (\n this.disposed ||\n this.recoveryRequested ||\n this.root.mainTeardowns.closed\n )\n return;\n this.recoveryRequested = true;\n for (const borrower of this.borrowers)\n update(borrower.instance.canvas, undefined, true);\n },\n });\n }\n beginRender(): void {\n this.recoveryRequested = false;\n }\n pruneMaps(): void {\n const resources = new Set<object>();\n for (const borrower of this.borrowers)\n for (const resource of borrower.resources) resources.add(resource);\n this.gpu.retainMaps(resources);\n }\n dispose(): void {\n this.disposed = true;\n this.gpu.dispose();\n }\n}\n\nclass GpuBorrower {\n used = false;\n resources = new Set<object>();\n private candidates = new Set<object>();\n private committed = false;\n private disposed = false;\n readonly shared: RootGpuService;\n private readonly root: PibblInstance;\n constructor(readonly instance: PibblInstance) {\n let root = instance;\n while (root.parent) root = getPibblInstance(root.parent);\n this.root = root;\n let shared = rootServices.get(root);\n if (!shared) {\n shared = new RootGpuService(root);\n rootServices.set(root, shared);\n }\n this.shared = shared;\n shared.borrowers.add(this);\n }\n beginRender(): void {\n this.shared.beginRender();\n this.used = false;\n this.candidates.clear();\n }\n useMap(resource: object): void {\n this.candidates.add(resource);\n }\n endRender(success: boolean): void {\n if (success && this.used) {\n this.committed = true;\n this.resources = new Set(this.candidates);\n this.shared.pruneMaps();\n return;\n }\n if (success || !this.committed) {\n this.dispose();\n return;\n }\n if (!this.shared.gpu.isContextLost) this.shared.pruneMaps();\n }\n dispose(): void {\n if (this.disposed) return;\n this.disposed = true;\n this.instance.optionalServices.delete(GPU_BORROWER);\n this.shared.borrowers.delete(this);\n if (this.shared.borrowers.size === 0) {\n rootServices.delete(this.root);\n this.shared.dispose();\n } else this.shared.pruneMaps();\n }\n}\n\n/** @internal Test-only read-only access; it never creates a GPU service. */\nexport function peekEmbossGpu(instance: PibblInstance): EmbossGpu | undefined {\n let root = instance;\n while (root.parent) root = getPibblInstance(root.parent);\n return rootServices.get(root)?.gpu;\n}\n\nexport function processEmboss(\n source: OffscreenCanvas,\n windows: FilterWindows,\n paint: TexturePaint,\n settings: ReflectionSettings,\n region: Readonly<{ x: number; y: number; width: number; height: number }>,\n): ImageBitmap {\n const instance = GLOBAL_STATE.currentPibblInstance;\n if (!instance) throw new Error(\"Emboss requires an active Pibbl instance.\");\n const borrower = getOptionalService(\n instance,\n GPU_BORROWER,\n () => new GpuBorrower(instance),\n );\n borrower.used = true;\n return borrowTextureRaster(paint, (map) => {\n borrower.useMap(map.resource);\n const coordinates = {\n originX: windows.source.backingX / windows.density,\n originY: windows.source.backingY / windows.density,\n density: windows.density,\n region,\n };\n return borrower.shared.gpu.apply(\n source,\n map,\n { color: \"#ffffff\" },\n settings,\n coordinates,\n );\n });\n}\n"],
|
|
5
|
+
"mappings": "AAAA;AAAA,EACE;AAAA,OAEK;AACP,SAAS,cAAc,wBAAwB;AAC/C,SAAS,0BAA0B;AACnC,SAAS,cAAc;AAGvB,SAAS,iBAAiB;AAG1B,MAAM,eAAe,uBAAO,uBAAuB;AACnD,MAAM,eAAe,oBAAI,QAAuC;AAEhE,MAAM,eAAe;AAAA,EAKnB,YAA6B,MAAqB;AAArB;AAC3B,SAAK,MAAM,IAAI,UAAU;AAAA,MACvB,mBAAmB,MAAM;AACvB,YACE,KAAK,YACL,KAAK,qBACL,KAAK,KAAK,cAAc;AAExB;AACF,aAAK,oBAAoB;AACzB,mBAAW,YAAY,KAAK;AAC1B,iBAAO,SAAS,SAAS,QAAQ,QAAW,IAAI;AAAA,MACpD;AAAA,IACF,CAAC;AAAA,EACH;AAAA,EAd6B;AAAA,EAJpB;AAAA,EACA,YAAY,oBAAI,IAAiB;AAAA,EAClC,WAAW;AAAA,EACX,oBAAoB;AAAA,EAgB5B,cAAoB;AAClB,SAAK,oBAAoB;AAAA,EAC3B;AAAA,EACA,YAAkB;AAChB,UAAM,YAAY,oBAAI,IAAY;AAClC,eAAW,YAAY,KAAK;AAC1B,iBAAW,YAAY,SAAS,UAAW,WAAU,IAAI,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OAAO,UAAU,SAAS,GAAG;AACpC,mBAAa,OAAO,KAAK,IAAI;AAC7B,WAAK,OAAO,QAAQ;AAAA,IACtB,MAAO,MAAK,OAAO,UAAU;AAAA,EAC/B;AACF;AAGO,SAAS,cAAc,UAAgD;AAC5E,MAAI,OAAO;AACX,SAAO,KAAK,OAAQ,QAAO,iBAAiB,KAAK,MAAM;AACvD,SAAO,aAAa,IAAI,IAAI,GAAG;AACjC;AAEO,SAAS,cACd,QACA,SACA,OACA,UACA,QACa;AACb,QAAM,WAAW,aAAa;AAC9B,MAAI,CAAC,SAAU,OAAM,IAAI,MAAM,2CAA2C;AAC1E,QAAM,WAAW;AAAA,IACf;AAAA,IACA;AAAA,IACA,MAAM,IAAI,YAAY,QAAQ;AAAA,EAChC;AACA,WAAS,OAAO;AAChB,SAAO,oBAAoB,OAAO,CAAC,QAAQ;AACzC,aAAS,OAAO,IAAI,QAAQ;AAC5B,UAAM,cAAc;AAAA,MAClB,SAAS,QAAQ,OAAO,WAAW,QAAQ;AAAA,MAC3C,SAAS,QAAQ,OAAO,WAAW,QAAQ;AAAA,MAC3C,SAAS,QAAQ;AAAA,MACjB;AAAA,IACF;AACA,WAAO,SAAS,OAAO,IAAI;AAAA,MACzB;AAAA,MACA;AAAA,MACA,EAAE,OAAO,UAAU;AAAA,MACnB;AAAA,MACA;AAAA,IACF;AAAA,EACF,CAAC;AACH;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/dist/filters.d.ts
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
export { blur, brightness, contrast, dropShadow, grayscale, hueRotate, invert, opacity, saturate, sepia, } from
|
|
2
|
-
export { displacement } from
|
|
3
|
-
export type { PibblFilter, PibblBlurFilterOptions, PibblBrightnessFilterOptions, PibblContrastFilterOptions, PibblDropShadowFilterOptions, PibblGrayscaleFilterOptions, PibblHueRotateFilterOptions, PibblInvertFilterOptions, PibblOpacityFilterOptions, PibblSaturateFilterOptions, PibblSepiaFilterOptions, PibblDisplacementFilterOptions, } from
|
|
4
|
-
export { reflectedLight } from
|
|
5
|
-
export type { PibblReflectedLightFilterOptions, PibblReflectedLightSource } from
|
|
1
|
+
export { blur, brightness, contrast, dropShadow, grayscale, hueRotate, invert, opacity, saturate, sepia, } from "./filters/native.js";
|
|
2
|
+
export { displacement } from "./filters/displacement.js";
|
|
3
|
+
export type { PibblFilter, PibblBlurFilterOptions, PibblBrightnessFilterOptions, PibblContrastFilterOptions, PibblDropShadowFilterOptions, PibblGrayscaleFilterOptions, PibblHueRotateFilterOptions, PibblInvertFilterOptions, PibblOpacityFilterOptions, PibblSaturateFilterOptions, PibblSepiaFilterOptions, PibblDisplacementFilterOptions, } from "./lib/style/filter-types.js";
|
|
4
|
+
export { reflectedLight } from "./filters/reflected-light.js";
|
|
5
|
+
export type { PibblReflectedLightFilterOptions, PibblReflectedLightSource, } from "./lib/style/filter-types.js";
|
|
6
|
+
export { emboss } from "./filters/emboss.js";
|
|
7
|
+
export type { PibblEmbossFilterOptions } from "./filters/emboss.js";
|
|
8
|
+
export { backdropContrast } from "./filters/backdrop-contrast.js";
|
|
9
|
+
export type { PibblBackdropContrastFilterOptions } from "./filters/backdrop-contrast.js";
|
package/dist/filters.js
CHANGED
|
@@ -12,12 +12,16 @@ import {
|
|
|
12
12
|
} from "./filters/native.js";
|
|
13
13
|
import { displacement } from "./filters/displacement.js";
|
|
14
14
|
import { reflectedLight } from "./filters/reflected-light.js";
|
|
15
|
+
import { emboss } from "./filters/emboss.js";
|
|
16
|
+
import { backdropContrast } from "./filters/backdrop-contrast.js";
|
|
15
17
|
export {
|
|
18
|
+
backdropContrast,
|
|
16
19
|
blur,
|
|
17
20
|
brightness,
|
|
18
21
|
contrast,
|
|
19
22
|
displacement,
|
|
20
23
|
dropShadow,
|
|
24
|
+
emboss,
|
|
21
25
|
grayscale,
|
|
22
26
|
hueRotate,
|
|
23
27
|
invert,
|
package/dist/filters.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/filters.ts"],
|
|
4
|
-
"sourcesContent": ["export {\n blur,\n brightness,\n contrast,\n dropShadow,\n grayscale,\n hueRotate,\n invert,\n opacity,\n saturate,\n sepia,\n} from
|
|
5
|
-
"mappings": "AAAA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,oBAAoB;AAgB7B,SAAS,sBAAsB;",
|
|
4
|
+
"sourcesContent": ["export {\n blur,\n brightness,\n contrast,\n dropShadow,\n grayscale,\n hueRotate,\n invert,\n opacity,\n saturate,\n sepia,\n} from \"./filters/native.js\";\nexport { displacement } from \"./filters/displacement.js\";\nexport type {\n PibblFilter,\n PibblBlurFilterOptions,\n PibblBrightnessFilterOptions,\n PibblContrastFilterOptions,\n PibblDropShadowFilterOptions,\n PibblGrayscaleFilterOptions,\n PibblHueRotateFilterOptions,\n PibblInvertFilterOptions,\n PibblOpacityFilterOptions,\n PibblSaturateFilterOptions,\n PibblSepiaFilterOptions,\n PibblDisplacementFilterOptions,\n} from \"./lib/style/filter-types.js\";\n\nexport { reflectedLight } from \"./filters/reflected-light.js\";\nexport type {\n PibblReflectedLightFilterOptions,\n PibblReflectedLightSource,\n} from \"./lib/style/filter-types.js\";\n\nexport { emboss } from \"./filters/emboss.js\";\nexport type { PibblEmbossFilterOptions } from \"./filters/emboss.js\";\n\nexport { backdropContrast } from \"./filters/backdrop-contrast.js\";\nexport type { PibblBackdropContrastFilterOptions } from \"./filters/backdrop-contrast.js\";\n"],
|
|
5
|
+
"mappings": "AAAA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,oBAAoB;AAgB7B,SAAS,sBAAsB;AAM/B,SAAS,cAAc;AAGvB,SAAS,wBAAwB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -33,7 +33,7 @@ export { createRegularPolygonPath, type RegularPolygonNumericSize, type RegularP
|
|
|
33
33
|
export { createStarPath, type StarPathOptions, } from './lib/geometry/star.js';
|
|
34
34
|
export { createSvgPath, type SvgPathOptions, } from './lib/geometry/svg-path.js';
|
|
35
35
|
export type { RoundedCornerPathOptions } from './lib/geometry/rounded-corners.js';
|
|
36
|
-
export { pibbl } from './lib/pibbl.js';
|
|
36
|
+
export { pibbl, prepareLayoutEngine } from './lib/pibbl.js';
|
|
37
37
|
export { batch, computed, isSignal, signal, untracked, } from './lib/signals/graph.js';
|
|
38
38
|
export { resolveSignalValue } from './lib/signals/resolve-signal-value.js';
|
|
39
39
|
export type { Signal, SignalEquals, SignalOptions, SignalValue, WritableSignal, } from './lib/signals/types.js';
|
|
@@ -46,7 +46,7 @@ export { Absolute, type AbsoluteProps, type AbsoluteStyle, } from './lib/layout/
|
|
|
46
46
|
export { Overlay, type OverlayProps, type OverlayStyle, } from './lib/layout/overlay.js';
|
|
47
47
|
export { Flow, type FlowProps, type FlowStyle, } from './lib/layout/flow.js';
|
|
48
48
|
export { Flex, type FlexProps, type FlexStyle, } from './lib/layout/flex.js';
|
|
49
|
-
export { Grid, type GridProps, type GridStyle, type GridTrack, } from './lib/layout/grid.js';
|
|
49
|
+
export { Grid, minmax, repeatTracks, autoFillTracks, autoFitTracks, type GridTrackBreadth, type GridMinMaxTrack, type GridRepeatTrack, type GridProps, type GridStyle, type GridTrack, } from './lib/layout/grid.js';
|
|
50
50
|
export { measureElement } from './lib/layout/measure.js';
|
|
51
51
|
export { FocusManagement, KeyboardNavigation, type FocusManagementProps, type KeyboardNavigationProps, } from './lib/focus/policy-components.js';
|
|
52
52
|
export type { PibblKeyboardNavigationOptions } from './lib/focus/types.js';
|
|
@@ -55,7 +55,8 @@ export { defineRenderLayer } from './lib/render-layer/define-render-layer.js';
|
|
|
55
55
|
export type { PibblRenderLayerComponentProps, PibblRenderLayerDefinition, PibblRenderLayerFrame, PibblRenderLayerContext, PibblRenderLayerHit, PibblRenderLayerInput, PibblRenderLayerInteraction, PibblRenderLayerInteractionSnapshot, PibblRenderLayerProps, PibblRenderLayerSize, PibblRenderLayerStyle, PibblRenderLayerTarget, } from './lib/render-layer/types.js';
|
|
56
56
|
export { createElement } from './lib/element/create-element.js';
|
|
57
57
|
export { Fragment } from './lib/element/fragment.js';
|
|
58
|
-
export type { BoxStyle, CursorStyle, EdgeValues, FlexItemStyle, GridItemStyle, ImgStyle, LayoutItemStyle, Length, PaintStyle, PathStyle, RectStyle, ResolvedBoxStyle, SvgPathStyle, TextFit, TextStyle, Percentage, RoundedCornerStyle, } from './lib/style/types.js';
|
|
58
|
+
export type { BoxStyle, CursorStyle, EdgeValues, FlexItemStyle, FlexMargin, GridItemStyle, ImgStyle, LayoutItemStyle, Length, PaintStyle, PathStyle, RectStyle, ResolvedBoxStyle, SvgPathStyle, TextFit, TextStyle, Percentage, RoundedCornerStyle, } from './lib/style/types.js';
|
|
59
|
+
export { fitContent, type FitContent, type SizingKeyword, type SizingLength } from './lib/style/sizing-length.js';
|
|
59
60
|
export { LayoutDiagnostic, layoutDiagnostic, type LayoutDiagnosticContext, type LayoutDiagnosticInput, } from './lib/style/diagnostics.js';
|
|
60
61
|
export { normalizeEdges } from './lib/style/normalize.js';
|
|
61
62
|
export { resolveLength } from './lib/style/resolve-length.js';
|
|
@@ -77,7 +78,7 @@ export { useReaction, type PibblReactionOptions, } from './lib/hooks/use-reactio
|
|
|
77
78
|
export { useAnimatedValue } from './lib/hooks/use-animated-value.js';
|
|
78
79
|
export { useSignal } from './lib/hooks/use-signal.js';
|
|
79
80
|
export { useSvgPath } from './lib/hooks/use-svg-path.js';
|
|
80
|
-
export type { Canvas, CanvasMeasurementService, PibblController, PibblComponent, PibblContainerChild, PibblElement, PibblElementType, PibblEmptyNode, PibblKey, PibblNode, PibblNodeInput, PibblPhysics2DPropExtension, PibblPrimitiveComponent, PibblTextChild, PibblTextInput, PibblRenderResult, PibblSizeQuery, PibblStyleRule, PibblResponsiveStyle, PrimitiveInputOf, PrimitiveCapabilities, PrimitiveInput, PrimitiveProgramProps, PrimitiveRender, FillStyle, MeasureInput, MeasureResult, PixelGridAlignment, NormalizedStyle, RenderingContext2D, ResolvedStyle, SpecifiedStyle, StyleResolutionContext, StrokeStyle, SystemStyle, } from './lib/types.js';
|
|
81
|
+
export type { Canvas, CanvasMeasurementService, PibblController, PibblComponent, PibblContainerChild, PibblElement, PibblElementType, PibblEmptyNode, PibblKey, PibblNode, PibblNodeInput, PibblPhysics2DPropExtension, PibblPrimitiveComponent, PibblTextChild, PibblTextInput, PibblRenderResult, PibblSizeQuery, PibblStyleRule, PibblResponsiveStyle, PrimitiveInputOf, PrimitiveCapabilities, PrimitiveInput, PrimitiveProgramProps, PrimitiveRender, FillStyle, MeasureInput, IntrinsicAxisConstraints, IntrinsicConstraints, IntrinsicMeasureInput, IntrinsicSizesResult, BaselineMeasureInput, BaselinesResult, MeasureResult, PixelGridAlignment, NormalizedStyle, RenderingContext2D, ResolvedStyle, SpecifiedStyle, StyleResolutionContext, StrokeStyle, SystemStyle, } from './lib/types.js';
|
|
81
82
|
export type { PibblClipboardEvent, PibblCompositionEvent, PibblDragEvent, PibblEvent, PibblEventCapturePropName, PibblEventHandler, PibblEventHandlers, PibblEventMap, PibblEventParticipationOptions, PibblEventPhase, PibblEventPropName, PibblEventTarget, PibblEventTargetOptions, PibblEventTargetSnapshot, PibblEventType, PibblFocusEvent, PibblInputEvent, PibblKeyboardEvent, PibblLogicalMouseEvent, PibblPointerEvent, PibblPointerEvents, PibblTouchEvent, PibblWheelEvent, } from './lib/events/types.js';
|
|
82
83
|
export { useManipulation } from './lib/manipulation/controller.js';
|
|
83
84
|
export { ManipulationFrame } from './lib/manipulation/frame.js';
|
|
@@ -92,7 +93,7 @@ export type { PibblManipulableProps } from './lib/manipulation/manipulable.js';
|
|
|
92
93
|
export { defineTexture, useTexture } from './lib/textures/texture.js';
|
|
93
94
|
export type { Texture, TexturePaint, TextureRecipe, TextureDefinition, TextureOptions, TexturePlacement, TextureContext, TextureFrame } from './lib/textures/texture.js';
|
|
94
95
|
export { HtmlBox } from './lib/components/html-box.js';
|
|
95
|
-
export type { HtmlBoxProps, HtmlBoxStyle, HtmlMountCallback, HtmlUpdateFunction, HtmlBoxFocusState } from './lib/html/types.js';
|
|
96
|
+
export type { HtmlBoxEventHandlers, HtmlBoxProps, HtmlBoxStyle, HtmlMountCallback, HtmlUpdateFunction, HtmlBoxFocusState } from './lib/html/types.js';
|
|
96
97
|
export { fade } from './lib/transitions/fade.js';
|
|
97
98
|
export type { PibblTransitionEffect } from './lib/transitions/fade.js';
|
|
98
99
|
export type { PibblTransitionBinding } from './lib/transitions/binding.js';
|
|
@@ -109,3 +110,6 @@ export type { PibblSlideOptions, PibblZoomOptions, PibblWipeOptions, PibblBlurRe
|
|
|
109
110
|
export { defineTransition } from './lib/transitions/define-transition.js';
|
|
110
111
|
export type { PibblTransitionDefinition, PibblTransitionRenderFrame } from './lib/transitions/define-transition.js';
|
|
111
112
|
export type { PibblEmbersPhysicsOptions, PibblEmberCollision } from './lib/transitions/embers-physics.js';
|
|
113
|
+
export { recordFrames, exportGif } from './lib/recording/recording.js';
|
|
114
|
+
export type { PibblFrameRecordingOptions, PibblFrameRecordingSession, PibblRecordedFrameInfo, PibblRecordedFrame, PibblFrameRecording, PibblGifExportOptions, PibblRenderCompletion, } from './lib/recording/types.js';
|
|
115
|
+
export { defineLayoutComponent } from './lib/layout/define-layout-component.js';
|
package/dist/index.js
CHANGED
|
@@ -91,7 +91,7 @@ import {
|
|
|
91
91
|
import {
|
|
92
92
|
createSvgPath
|
|
93
93
|
} from "./lib/geometry/svg-path.js";
|
|
94
|
-
import { pibbl } from "./lib/pibbl.js";
|
|
94
|
+
import { pibbl, prepareLayoutEngine } from "./lib/pibbl.js";
|
|
95
95
|
import {
|
|
96
96
|
batch,
|
|
97
97
|
computed,
|
|
@@ -129,7 +129,11 @@ import {
|
|
|
129
129
|
Flex
|
|
130
130
|
} from "./lib/layout/flex.js";
|
|
131
131
|
import {
|
|
132
|
-
Grid
|
|
132
|
+
Grid,
|
|
133
|
+
minmax,
|
|
134
|
+
repeatTracks,
|
|
135
|
+
autoFillTracks,
|
|
136
|
+
autoFitTracks
|
|
133
137
|
} from "./lib/layout/grid.js";
|
|
134
138
|
import { measureElement } from "./lib/layout/measure.js";
|
|
135
139
|
import {
|
|
@@ -140,6 +144,7 @@ import { definePrimitive } from "./lib/define-primitive.js";
|
|
|
140
144
|
import { defineRenderLayer } from "./lib/render-layer/define-render-layer.js";
|
|
141
145
|
import { createElement } from "./lib/element/create-element.js";
|
|
142
146
|
import { Fragment } from "./lib/element/fragment.js";
|
|
147
|
+
import { fitContent } from "./lib/style/sizing-length.js";
|
|
143
148
|
import {
|
|
144
149
|
LayoutDiagnostic,
|
|
145
150
|
layoutDiagnostic
|
|
@@ -178,6 +183,8 @@ import { hologram } from "./lib/transitions/hologram.js";
|
|
|
178
183
|
import { bifrost } from "./lib/transitions/bifrost.js";
|
|
179
184
|
import { slide, zoom, wipe, blurReveal, dissolve } from "./lib/transitions/common.js";
|
|
180
185
|
import { defineTransition } from "./lib/transitions/define-transition.js";
|
|
186
|
+
import { recordFrames, exportGif } from "./lib/recording/recording.js";
|
|
187
|
+
import { defineLayoutComponent } from "./lib/layout/define-layout-component.js";
|
|
181
188
|
export {
|
|
182
189
|
Absolute,
|
|
183
190
|
Arc,
|
|
@@ -216,6 +223,8 @@ export {
|
|
|
216
223
|
Wedge,
|
|
217
224
|
affineTransform,
|
|
218
225
|
arcBendTransform,
|
|
226
|
+
autoFillTracks,
|
|
227
|
+
autoFitTracks,
|
|
219
228
|
batch,
|
|
220
229
|
bifrost,
|
|
221
230
|
blurReveal,
|
|
@@ -233,6 +242,7 @@ export {
|
|
|
233
242
|
createSvgPath,
|
|
234
243
|
createWedgePath,
|
|
235
244
|
defineAnimation,
|
|
245
|
+
defineLayoutComponent,
|
|
236
246
|
definePrimitive,
|
|
237
247
|
defineRenderLayer,
|
|
238
248
|
defineTexture,
|
|
@@ -243,7 +253,9 @@ export {
|
|
|
243
253
|
easing,
|
|
244
254
|
embers,
|
|
245
255
|
envelopeTransform,
|
|
256
|
+
exportGif,
|
|
246
257
|
fade,
|
|
258
|
+
fitContent,
|
|
247
259
|
flattenPath,
|
|
248
260
|
flattenPathWang,
|
|
249
261
|
hologram,
|
|
@@ -253,12 +265,16 @@ export {
|
|
|
253
265
|
marker,
|
|
254
266
|
measureElement,
|
|
255
267
|
meshTransform,
|
|
268
|
+
minmax,
|
|
256
269
|
normalizeEdges,
|
|
257
270
|
parallel,
|
|
258
271
|
pathBendTransform,
|
|
259
272
|
pibbl,
|
|
273
|
+
prepareLayoutEngine,
|
|
260
274
|
quadTransform,
|
|
275
|
+
recordFrames,
|
|
261
276
|
repeat,
|
|
277
|
+
repeatTracks,
|
|
262
278
|
resolveBox,
|
|
263
279
|
resolveLength,
|
|
264
280
|
resolveSignalValue,
|