@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,6 +1,7 @@
|
|
|
1
1
|
import { getPibblEventDefinition } from "./event-definitions.js";
|
|
2
2
|
import {
|
|
3
3
|
createPibblEvent,
|
|
4
|
+
finishEventDispatch,
|
|
4
5
|
isPibblImmediatePropagationStopped,
|
|
5
6
|
isPibblPropagationStopped,
|
|
6
7
|
setPibblEventInvocation
|
|
@@ -14,25 +15,29 @@ function dispatchEventPath(input) {
|
|
|
14
15
|
const path = buildEventPath(input.target);
|
|
15
16
|
const event = createPibblEvent({ ...input, path });
|
|
16
17
|
const targetIndex = path.length - 1;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
invoke(path[index], input.type, true, 1, event);
|
|
20
|
-
}
|
|
21
|
-
if (!isPibblPropagationStopped(event) && input.target.live) {
|
|
22
|
-
invoke(input.target, input.type, true, 2, event);
|
|
23
|
-
if (!isPibblImmediatePropagationStopped(event)) {
|
|
24
|
-
invoke(input.target, input.type, false, 2, event);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
if (definition.bubbles && !isPibblPropagationStopped(event)) {
|
|
28
|
-
for (let index = targetIndex - 1; index >= 0; index--) {
|
|
18
|
+
try {
|
|
19
|
+
for (let index = 0; index < targetIndex; index++) {
|
|
29
20
|
if (isPibblPropagationStopped(event)) break;
|
|
30
|
-
|
|
21
|
+
invokePibblEventHandler(path[index], input.type, true, 1, event);
|
|
22
|
+
}
|
|
23
|
+
if (!isPibblPropagationStopped(event) && input.target.live) {
|
|
24
|
+
invokePibblEventHandler(input.target, input.type, true, 2, event);
|
|
25
|
+
if (!isPibblImmediatePropagationStopped(event)) {
|
|
26
|
+
invokePibblEventHandler(input.target, input.type, false, 2, event);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
if (definition.bubbles && !isPibblPropagationStopped(event)) {
|
|
30
|
+
for (let index = targetIndex - 1; index >= 0; index--) {
|
|
31
|
+
if (isPibblPropagationStopped(event)) break;
|
|
32
|
+
invokePibblEventHandler(path[index], input.type, false, 3, event);
|
|
33
|
+
}
|
|
31
34
|
}
|
|
35
|
+
return event;
|
|
36
|
+
} finally {
|
|
37
|
+
finishEventDispatch(event);
|
|
32
38
|
}
|
|
33
|
-
return event;
|
|
34
39
|
}
|
|
35
|
-
function
|
|
40
|
+
function invokePibblEventHandler(node, type, capture, phase, event) {
|
|
36
41
|
if (!node.live) return;
|
|
37
42
|
const key = capture ? `${type}Capture` : type;
|
|
38
43
|
const handler = node.handlers[key];
|
|
@@ -51,6 +56,7 @@ function reportDispatchError(error) {
|
|
|
51
56
|
}
|
|
52
57
|
}
|
|
53
58
|
export {
|
|
54
|
-
dispatchEventPath
|
|
59
|
+
dispatchEventPath,
|
|
60
|
+
invokePibblEventHandler
|
|
55
61
|
};
|
|
56
62
|
//# sourceMappingURL=propagation.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/lib/events/propagation.ts"],
|
|
4
|
-
"sourcesContent": ["import { getPibblEventDefinition } from './event-definitions.js';\nimport {\n createPibblEvent,\n isPibblImmediatePropagationStopped,\n isPibblPropagationStopped,\n setPibblEventInvocation,\n type CreatePibblEventInput,\n} from './event-facade.js';\nimport { buildEventPath } from './event-path.js';\nimport type {\n PibblEventNode,\n PibblNormalizedHandlers,\n} from './registrations.js';\nimport type {\n PibblEvent,\n PibblEventMap,\n PibblEventPhase,\n PibblEventType,\n} from './types.js';\n\nexport interface DispatchEventPathInput<K extends PibblEventType>\n extends Omit<CreatePibblEventInput<K>, 'path'> {\n readonly target: PibblEventNode;\n}\n\ntype PibblNormalizedCaptureKey = `${PibblEventType}Capture`;\n\nexport function dispatchEventPath<K extends PibblEventType>(\n input: DispatchEventPathInput<K>,\n): PibblEventMap[K] {\n const definition = getPibblEventDefinition(input.type);\n if (!definition) {\n throw new Error(`Unsupported Pibbl event type: ${input.type}`);\n }\n const path = buildEventPath(input.target);\n const event = createPibblEvent({ ...input, path });\n const targetIndex = path.length - 1;\n\n for (let index = 0; index < targetIndex; index++) {\n if (isPibblPropagationStopped(event)) break;\n
|
|
5
|
-
"mappings": "AAAA,SAAS,+BAA+B;AACxC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AACP,SAAS,sBAAsB;AAmBxB,SAAS,kBACd,OACkB;AAClB,QAAM,aAAa,wBAAwB,MAAM,IAAI;AACrD,MAAI,CAAC,YAAY;AACf,UAAM,IAAI,MAAM,iCAAiC,MAAM,IAAI,EAAE;AAAA,EAC/D;AACA,QAAM,OAAO,eAAe,MAAM,MAAM;AACxC,QAAM,QAAQ,iBAAiB,EAAE,GAAG,OAAO,KAAK,CAAC;AACjD,QAAM,cAAc,KAAK,SAAS;
|
|
4
|
+
"sourcesContent": ["import { getPibblEventDefinition } from './event-definitions.js';\nimport {\n createPibblEvent,\n finishEventDispatch,\n isPibblImmediatePropagationStopped,\n isPibblPropagationStopped,\n setPibblEventInvocation,\n type CreatePibblEventInput,\n} from './event-facade.js';\nimport { buildEventPath } from './event-path.js';\nimport type {\n PibblEventNode,\n PibblNormalizedHandlers,\n} from './registrations.js';\nimport type {\n PibblEvent,\n PibblEventMap,\n PibblEventPhase,\n PibblEventType,\n} from './types.js';\n\nexport interface DispatchEventPathInput<K extends PibblEventType>\n extends Omit<CreatePibblEventInput<K>, 'path'> {\n readonly target: PibblEventNode;\n}\n\ntype PibblNormalizedCaptureKey = `${PibblEventType}Capture`;\n\nexport function dispatchEventPath<K extends PibblEventType>(\n input: DispatchEventPathInput<K>,\n): PibblEventMap[K] {\n const definition = getPibblEventDefinition(input.type);\n if (!definition) {\n throw new Error(`Unsupported Pibbl event type: ${input.type}`);\n }\n const path = buildEventPath(input.target);\n const event = createPibblEvent({ ...input, path });\n const targetIndex = path.length - 1;\n try {\n for (let index = 0; index < targetIndex; index++) {\n if (isPibblPropagationStopped(event)) break;\n invokePibblEventHandler(path[index], input.type, true, 1, event);\n }\n\n if (!isPibblPropagationStopped(event) && input.target.live) {\n invokePibblEventHandler(input.target, input.type, true, 2, event);\n if (!isPibblImmediatePropagationStopped(event)) {\n invokePibblEventHandler(input.target, input.type, false, 2, event);\n }\n }\n\n if (definition.bubbles && !isPibblPropagationStopped(event)) {\n for (let index = targetIndex - 1; index >= 0; index--) {\n if (isPibblPropagationStopped(event)) break;\n invokePibblEventHandler(path[index], input.type, false, 3, event);\n }\n }\n\n return event;\n } finally { finishEventDispatch(event); }\n}\n\nexport function invokePibblEventHandler(\n node: PibblEventNode,\n type: PibblEventType,\n capture: boolean,\n phase: PibblEventPhase,\n event: PibblEvent,\n): void {\n if (!node.live) return;\n const key = capture ? `${type}Capture` as PibblNormalizedCaptureKey : type;\n const handler = node.handlers[key as keyof PibblNormalizedHandlers];\n if (!handler) return;\n setPibblEventInvocation(event, node.publicTarget, phase);\n try {\n (handler as (event: PibblEvent) => void)(event);\n } catch (error) {\n reportDispatchError(error);\n }\n}\n\nfunction reportDispatchError(error: unknown): void {\n try {\n globalThis.reportError(error);\n } catch {\n // Reporting cannot suppress unrelated handlers in this logical dispatch.\n }\n}\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,+BAA+B;AACxC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AACP,SAAS,sBAAsB;AAmBxB,SAAS,kBACd,OACkB;AAClB,QAAM,aAAa,wBAAwB,MAAM,IAAI;AACrD,MAAI,CAAC,YAAY;AACf,UAAM,IAAI,MAAM,iCAAiC,MAAM,IAAI,EAAE;AAAA,EAC/D;AACA,QAAM,OAAO,eAAe,MAAM,MAAM;AACxC,QAAM,QAAQ,iBAAiB,EAAE,GAAG,OAAO,KAAK,CAAC;AACjD,QAAM,cAAc,KAAK,SAAS;AAClC,MAAI;AACJ,aAAS,QAAQ,GAAG,QAAQ,aAAa,SAAS;AAChD,UAAI,0BAA0B,KAAK,EAAG;AACtC,8BAAwB,KAAK,KAAK,GAAG,MAAM,MAAM,MAAM,GAAG,KAAK;AAAA,IACjE;AAEA,QAAI,CAAC,0BAA0B,KAAK,KAAK,MAAM,OAAO,MAAM;AAC1D,8BAAwB,MAAM,QAAQ,MAAM,MAAM,MAAM,GAAG,KAAK;AAChE,UAAI,CAAC,mCAAmC,KAAK,GAAG;AAC9C,gCAAwB,MAAM,QAAQ,MAAM,MAAM,OAAO,GAAG,KAAK;AAAA,MACnE;AAAA,IACF;AAEA,QAAI,WAAW,WAAW,CAAC,0BAA0B,KAAK,GAAG;AAC3D,eAAS,QAAQ,cAAc,GAAG,SAAS,GAAG,SAAS;AACrD,YAAI,0BAA0B,KAAK,EAAG;AACtC,gCAAwB,KAAK,KAAK,GAAG,MAAM,MAAM,OAAO,GAAG,KAAK;AAAA,MAClE;AAAA,IACF;AAEA,WAAO;AAAA,EACP,UAAE;AAAU,wBAAoB,KAAK;AAAA,EAAG;AAC1C;AAEO,SAAS,wBACd,MACA,MACA,SACA,OACA,OACM;AACN,MAAI,CAAC,KAAK,KAAM;AAChB,QAAM,MAAM,UAAU,GAAG,IAAI,YAAyC;AACtE,QAAM,UAAU,KAAK,SAAS,GAAoC;AAClE,MAAI,CAAC,QAAS;AACd,0BAAwB,OAAO,KAAK,cAAc,KAAK;AACvD,MAAI;AACF,IAAC,QAAwC,KAAK;AAAA,EAChD,SAAS,OAAO;AACd,wBAAoB,KAAK;AAAA,EAC3B;AACF;AAEA,SAAS,oBAAoB,OAAsB;AACjD,MAAI;AACF,eAAW,YAAY,KAAK;AAAA,EAC9B,QAAQ;AAAA,EAER;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -20,6 +20,8 @@ export type PibblNormalizedHandlers = Partial<{
|
|
|
20
20
|
* @see {@link isBackendEventTargetLive}
|
|
21
21
|
*/
|
|
22
22
|
export interface PibblEventTargetRegistration {
|
|
23
|
+
/** @internal Withdraws published interaction while preserving mount-owned resources. */
|
|
24
|
+
suspendLayout(): void;
|
|
23
25
|
/** Selects the kind of geometry, material, or result. See {@link PibblEventTargetRegistration}. */
|
|
24
26
|
readonly kind: "target";
|
|
25
27
|
/** Mount or runtime resource owning this registration. See {@link PibblInstance}. */
|
|
@@ -87,6 +89,8 @@ export interface PibblEventTargetRegistration {
|
|
|
87
89
|
live: boolean;
|
|
88
90
|
}
|
|
89
91
|
export interface PibblEventListenerRegistration {
|
|
92
|
+
/** @internal Withdraws listeners while preserving mount-owned resources. */
|
|
93
|
+
suspendLayout(): void;
|
|
90
94
|
readonly kind: "listener";
|
|
91
95
|
readonly owner: PibblInstance;
|
|
92
96
|
readonly component: PibblComponentRefs<any>;
|
|
@@ -106,6 +110,12 @@ export interface PibblEventListenerRegistration {
|
|
|
106
110
|
}
|
|
107
111
|
export type PibblEventNode = PibblEventTargetRegistration | PibblEventListenerRegistration;
|
|
108
112
|
export declare function createTarget(owner: PibblInstance, component: PibblComponentRefs<any>, slot: number): PibblEventTargetRegistration;
|
|
113
|
+
/** Prepared external registrations acquire fallible native leases before adoption. */
|
|
114
|
+
export declare function prepareTargetUpdate(target: PibblEventTargetRegistration, handlers: PibblEventHandlers, options: PibblEventTargetOptions, transform: DOMMatrix, clippingStack: PibblPathPaintEntry['clippingStack']): {
|
|
115
|
+
adopt(): void;
|
|
116
|
+
finish(): void;
|
|
117
|
+
notify(): void;
|
|
118
|
+
};
|
|
109
119
|
export declare function updateTarget(target: PibblEventTargetRegistration, handlers: PibblEventHandlers, options: PibblEventTargetOptions, participatesInPaint?: boolean, preserveKeyboardNavigationGeometry?: boolean): void;
|
|
110
120
|
export declare function updateCursorTarget(target: PibblEventTargetRegistration, { path, fill, lineInteractionWidth, cursor, }: {
|
|
111
121
|
path: Path2D | PathGeometry;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { releaseLayoutTargetGeometry } from "../layout/geometry-publication.js";
|
|
2
|
+
import { registerLayoutSuspensionResource, unregisterLayoutSuspensionResource, isLayoutComponentSuspended, isLayoutInstanceSuspended } from "../layout/participation.js";
|
|
1
3
|
import { PIBBL_EVENT_DEFINITIONS } from "./event-definitions.js";
|
|
2
4
|
import { GLOBAL_STATE } from "../global-state.js";
|
|
3
5
|
import { resolvePath } from "../geometry/resolve-path.js";
|
|
@@ -15,6 +17,7 @@ function createTarget(owner, component, slot) {
|
|
|
15
17
|
const publicTarget = createPublicTarget(() => target);
|
|
16
18
|
Object.assign(target, {
|
|
17
19
|
kind: "target",
|
|
20
|
+
suspendLayout: suspendTargetLayout,
|
|
18
21
|
owner,
|
|
19
22
|
component,
|
|
20
23
|
slot,
|
|
@@ -33,8 +36,109 @@ function createTarget(owner, component, slot) {
|
|
|
33
36
|
keyboardNavigationPoints: void 0,
|
|
34
37
|
live: false
|
|
35
38
|
});
|
|
39
|
+
registerLayoutSuspensionResource(component, target);
|
|
36
40
|
return target;
|
|
37
41
|
}
|
|
42
|
+
function prepareTargetUpdate(target, handlers, options, transform, clippingStack) {
|
|
43
|
+
const state = { ...target };
|
|
44
|
+
refreshHandlers(state, handlers, Boolean(options.cursor));
|
|
45
|
+
const paintEntry = {
|
|
46
|
+
paintKind: PibblPaintEntryKind.Path,
|
|
47
|
+
target,
|
|
48
|
+
path: resolvePath(options.path),
|
|
49
|
+
fill: options.fill ?? false,
|
|
50
|
+
lineInteractionWidth: options.lineInteractionWidth ?? 0,
|
|
51
|
+
transform,
|
|
52
|
+
clippingStack
|
|
53
|
+
};
|
|
54
|
+
const leases = /* @__PURE__ */ new Map();
|
|
55
|
+
const existing = nativeReleases.get(target);
|
|
56
|
+
const additions = [];
|
|
57
|
+
const hub = target.owner.eventRoot.nativeListeners;
|
|
58
|
+
try {
|
|
59
|
+
if (hub) forEachChangedType(
|
|
60
|
+
state.requiredNativeTypesLow,
|
|
61
|
+
state.requiredNativeTypesHigh,
|
|
62
|
+
(type) => {
|
|
63
|
+
let lease = existing?.get(type);
|
|
64
|
+
if (!lease) {
|
|
65
|
+
lease = hub.acquire(type);
|
|
66
|
+
additions.push(lease);
|
|
67
|
+
}
|
|
68
|
+
leases.set(type, lease);
|
|
69
|
+
}
|
|
70
|
+
);
|
|
71
|
+
} catch (error) {
|
|
72
|
+
const errors = [error];
|
|
73
|
+
for (const release of additions) {
|
|
74
|
+
try {
|
|
75
|
+
release();
|
|
76
|
+
} catch (releaseError) {
|
|
77
|
+
errors.push(releaseError);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
if (errors.length > 1) throw new AggregateError(errors, "Prepared target acquisition failed.", { cause: error });
|
|
81
|
+
throw error;
|
|
82
|
+
}
|
|
83
|
+
let previous;
|
|
84
|
+
let adopted = false;
|
|
85
|
+
return {
|
|
86
|
+
adopt() {
|
|
87
|
+
previous = nativeReleases.get(target);
|
|
88
|
+
nativeReleases.set(target, leases);
|
|
89
|
+
if (target.paintEntry) target.owner.paintEntries.delete(target.paintEntry);
|
|
90
|
+
target.handlers = state.handlers;
|
|
91
|
+
target.handlerTypesLow = state.handlerTypesLow;
|
|
92
|
+
target.handlerTypesHigh = state.handlerTypesHigh;
|
|
93
|
+
target.requiredNativeTypesLow = target.ownedNativeTypesLow = state.requiredNativeTypesLow;
|
|
94
|
+
target.requiredNativeTypesHigh = target.ownedNativeTypesHigh = state.requiredNativeTypesHigh;
|
|
95
|
+
target.cursor = options.cursor;
|
|
96
|
+
target.keyboardFocusable = options.keyboardFocusable;
|
|
97
|
+
target.keyboardNavigationBounds = options.keyboardNavigationBounds;
|
|
98
|
+
target.keyboardNavigationPoints = void 0;
|
|
99
|
+
target.paintEntry = paintEntry;
|
|
100
|
+
target.live = true;
|
|
101
|
+
target.owner.regions.add(target);
|
|
102
|
+
target.owner.eventRoot.targets.add(target);
|
|
103
|
+
adopted = true;
|
|
104
|
+
},
|
|
105
|
+
finish() {
|
|
106
|
+
const errors = [];
|
|
107
|
+
const complete = (callback) => {
|
|
108
|
+
try {
|
|
109
|
+
callback();
|
|
110
|
+
} catch (error) {
|
|
111
|
+
errors.push(error);
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
if (adopted) {
|
|
115
|
+
for (const [type, release] of previous ?? []) if (!leases.has(type)) complete(release);
|
|
116
|
+
previous = void 0;
|
|
117
|
+
} else {
|
|
118
|
+
for (const release of additions) complete(release);
|
|
119
|
+
additions.length = 0;
|
|
120
|
+
}
|
|
121
|
+
if (errors.length === 1) throw errors[0];
|
|
122
|
+
if (errors.length) throw new AggregateError(errors, "Prepared target completion failed.");
|
|
123
|
+
},
|
|
124
|
+
notify() {
|
|
125
|
+
if (!adopted || !target.live) return;
|
|
126
|
+
const errors = [];
|
|
127
|
+
try {
|
|
128
|
+
target.owner.eventRoot.focusPolicy?.observeTarget(target);
|
|
129
|
+
} catch (error) {
|
|
130
|
+
errors.push(error);
|
|
131
|
+
}
|
|
132
|
+
try {
|
|
133
|
+
target.owner.eventRoot.onTargetUpdate?.(target);
|
|
134
|
+
} catch (error) {
|
|
135
|
+
errors.push(error);
|
|
136
|
+
}
|
|
137
|
+
if (errors.length === 1) throw errors[0];
|
|
138
|
+
if (errors.length) throw new AggregateError(errors, "Prepared target notification failed.");
|
|
139
|
+
}
|
|
140
|
+
};
|
|
141
|
+
}
|
|
38
142
|
function updateTarget(target, handlers, options, participatesInPaint = false, preserveKeyboardNavigationGeometry = false) {
|
|
39
143
|
updateTargetRegistration(
|
|
40
144
|
target,
|
|
@@ -106,27 +210,64 @@ function updateTargetRegistration(target, handlers, options, participatesInPaint
|
|
|
106
210
|
target.owner.paintEntries.add(paintEntry);
|
|
107
211
|
target.owner.eventRoot.targets.add(target);
|
|
108
212
|
updateNativeOwnership(target);
|
|
213
|
+
if (isLayoutComponentSuspended(target.component) || isLayoutInstanceSuspended(target.owner)) {
|
|
214
|
+
target.suspendLayout();
|
|
215
|
+
return;
|
|
216
|
+
}
|
|
109
217
|
target.owner.eventRoot.focusPolicy?.observeTarget(target);
|
|
110
218
|
target.owner.eventRoot.onTargetUpdate?.(target);
|
|
111
219
|
}
|
|
220
|
+
function suspendTargetLayout() {
|
|
221
|
+
if (!this.live) return;
|
|
222
|
+
if (this.paintEntry) this.owner.paintEntries.delete(this.paintEntry);
|
|
223
|
+
this.owner.regions.delete(this);
|
|
224
|
+
this.owner.eventRoot.targets.delete(this);
|
|
225
|
+
this.owner.eventRoot.focusPolicy?.removeTarget(this);
|
|
226
|
+
this.owner.eventRoot.onNodeRelease?.(this);
|
|
227
|
+
this.paintEntry = void 0;
|
|
228
|
+
this.live = false;
|
|
229
|
+
clearPointerCapturesForTarget(this);
|
|
230
|
+
}
|
|
231
|
+
function suspendListenerLayout() {
|
|
232
|
+
if (!this.live) return;
|
|
233
|
+
const entries = this.owner.eventRoot.listenersByComponent.get(this.component.id);
|
|
234
|
+
entries?.delete(this);
|
|
235
|
+
if (entries?.size === 0) this.owner.eventRoot.listenersByComponent.delete(this.component.id);
|
|
236
|
+
this.owner.eventRoot.onNodeRelease?.(this);
|
|
237
|
+
this.live = false;
|
|
238
|
+
clearPointerCapturesForTarget(this);
|
|
239
|
+
}
|
|
112
240
|
function releaseTarget(target) {
|
|
241
|
+
releaseLayoutTargetGeometry(target);
|
|
242
|
+
const errors = [];
|
|
243
|
+
const release = (callback) => {
|
|
244
|
+
try {
|
|
245
|
+
callback();
|
|
246
|
+
} catch (error) {
|
|
247
|
+
errors.push(error);
|
|
248
|
+
}
|
|
249
|
+
};
|
|
250
|
+
release(() => unregisterLayoutSuspensionResource(target.component, target));
|
|
113
251
|
if (target.live) {
|
|
114
252
|
if (target.paintEntry) target.owner.paintEntries.delete(target.paintEntry);
|
|
115
253
|
target.owner.eventRoot.targets.delete(target);
|
|
116
|
-
target.owner.eventRoot.focusPolicy?.removeTarget(target);
|
|
117
|
-
target.owner.eventRoot.onNodeRelease?.(target);
|
|
254
|
+
release(() => target.owner.eventRoot.focusPolicy?.removeTarget(target));
|
|
255
|
+
release(() => target.owner.eventRoot.onNodeRelease?.(target));
|
|
118
256
|
}
|
|
119
257
|
target.owner.regions.delete(target);
|
|
120
258
|
target.paintEntry = void 0;
|
|
121
259
|
target.live = false;
|
|
122
|
-
clearPointerCapturesForTarget(target);
|
|
123
|
-
releaseNativeOwnership(target);
|
|
260
|
+
release(() => clearPointerCapturesForTarget(target));
|
|
261
|
+
release(() => releaseNativeOwnership(target));
|
|
262
|
+
if (errors.length === 1) throw errors[0];
|
|
263
|
+
if (errors.length) throw new AggregateError(errors, "Target release failed.");
|
|
124
264
|
}
|
|
125
265
|
function createListener(owner, component, slot) {
|
|
126
266
|
const listener = {};
|
|
127
267
|
const publicTarget = createPublicTarget(() => listener);
|
|
128
268
|
Object.assign(listener, {
|
|
129
269
|
kind: "listener",
|
|
270
|
+
suspendLayout: suspendListenerLayout,
|
|
130
271
|
owner,
|
|
131
272
|
component,
|
|
132
273
|
slot,
|
|
@@ -140,6 +281,7 @@ function createListener(owner, component, slot) {
|
|
|
140
281
|
ownedNativeTypesHigh: 0,
|
|
141
282
|
live: false
|
|
142
283
|
});
|
|
284
|
+
registerLayoutSuspensionResource(component, listener);
|
|
143
285
|
return listener;
|
|
144
286
|
}
|
|
145
287
|
function updateListener(listener, handlers) {
|
|
@@ -171,9 +313,14 @@ function updateListener(listener, handlers) {
|
|
|
171
313
|
}
|
|
172
314
|
registrations.add(listener);
|
|
173
315
|
listener.live = true;
|
|
316
|
+
if (isLayoutComponentSuspended(listener.component) || isLayoutInstanceSuspended(listener.owner)) {
|
|
317
|
+
listener.suspendLayout();
|
|
318
|
+
return;
|
|
319
|
+
}
|
|
174
320
|
updateNativeOwnership(listener);
|
|
175
321
|
}
|
|
176
322
|
function releaseListener(listener) {
|
|
323
|
+
unregisterLayoutSuspensionResource(listener.component, listener);
|
|
177
324
|
if (listener.live) {
|
|
178
325
|
const registrations = listener.owner.eventRoot.listenersByComponent.get(
|
|
179
326
|
listener.component.id
|
|
@@ -354,10 +501,17 @@ function releaseNativeOwnership(registration) {
|
|
|
354
501
|
const releases = nativeReleases.get(registration);
|
|
355
502
|
if (!releases) return;
|
|
356
503
|
nativeReleases.delete(registration);
|
|
504
|
+
const errors = [];
|
|
357
505
|
for (const release of releases.values()) {
|
|
358
|
-
|
|
506
|
+
try {
|
|
507
|
+
release();
|
|
508
|
+
} catch (error) {
|
|
509
|
+
errors.push(error);
|
|
510
|
+
}
|
|
359
511
|
}
|
|
360
512
|
releases.clear();
|
|
513
|
+
if (errors.length === 1) throw errors[0];
|
|
514
|
+
if (errors.length) throw new AggregateError(errors, "Native listener release failed.");
|
|
361
515
|
}
|
|
362
516
|
function forEachChangedType(low, high, visit) {
|
|
363
517
|
while (low !== 0) {
|
|
@@ -388,6 +542,7 @@ export {
|
|
|
388
542
|
createListener,
|
|
389
543
|
createTarget,
|
|
390
544
|
normalizeHandlers,
|
|
545
|
+
prepareTargetUpdate,
|
|
391
546
|
releaseListener,
|
|
392
547
|
releaseTarget,
|
|
393
548
|
updateCursorTarget,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/lib/events/registrations.ts"],
|
|
4
|
-
"sourcesContent": ["import type { PibblHitTestOutput } from './paint-entry.js';\nimport type { isBackendEventTargetLive, useBackendEventTarget } from '../../internal.js';\nimport { PIBBL_EVENT_DEFINITIONS } from \"./event-definitions.js\";\nimport type {\n PibblEventHandler,\n PibblEventHandlers,\n PibblEventTarget,\n PibblEventTargetOptions,\n PibblEventType,\n} from \"./types.js\";\nimport { GLOBAL_STATE } from \"../global-state.js\";\nimport { resolvePath } from '../geometry/resolve-path.js';\nimport type { PathGeometry } from '../geometry/path-geometry.js';\nimport type { LayoutBox } from \"../layout/types.js\";\nimport { getCurrentWorldTransform } from \"../render-target.js\";\nimport type {\n PibblComponentRefs,\n PibblInstance,\n} from \"../types.js\";\nimport { PibblPaintEntryKind, type PibblPathPaintEntry } from \"./paint-entry.js\";\nimport {\n clearPointerCapturesForTarget,\n hasLogicalPointerCapture,\n releaseLogicalPointerCapture,\n setLogicalPointerCapture,\n} from \"./pointer-capture.js\";\n\ntype PibblNormalizedCaptureKey = `${PibblEventType}Capture`;\n\nexport type PibblNormalizedHandlers = Partial<\n {\n [K in PibblEventType]: PibblEventHandler<K>;\n } & {\n [K in PibblEventType as `${K}Capture`]: PibblEventHandler<K>;\n }\n>;\n\n/**\n * Mount-owned event target registration and cleanup state.\n *\n * @see {@link PibblEventTarget}\n * @see {@link LayoutBox}\n * @see {@link PibblHitTestOutput}\n * @see {@link useBackendEventTarget}\n * @see {@link isBackendEventTargetLive}\n */\nexport interface PibblEventTargetRegistration {\n /** Selects the kind of geometry, material, or result. See {@link PibblEventTargetRegistration}. */\n readonly kind: \"target\";\n /** Mount or runtime resource owning this registration. See {@link PibblInstance}. */\n readonly owner: PibblInstance;\n /**\n * Component identity or diagnostic name associated with this value. See {@link PibblComponentRefs}\n * .\n */\n readonly component: PibblComponentRefs<any>;\n /** Mount-local hook or registration slot. See {@link PibblEventTargetRegistration}. */\n readonly slot: number;\n /** Logical target exposed to application event handlers. See {@link PibblEventTarget}. */\n readonly publicTarget: PibblEventTarget;\n /** Paint-ledger entry associated with this registration. See {@link PibblPathPaintEntry}. */\n paintEntry: PibblPathPaintEntry | undefined;\n /** Event handlers dispatched for this logical target. See {@link PibblNormalizedHandlers}. */\n handlers: PibblNormalizedHandlers;\n /** Logical event types currently present in `handlers`, split across two 32-bit words. */\n handlerTypesLow: number;\n /**\n * High event-mask bits identifying registered handler types. See\n * {@link PibblEventTargetRegistration}.\n */\n handlerTypesHigh: number;\n /** Native event dependency signature derived from the current handlers and cursor. */\n requiredNativeTypesLow: number;\n /**\n * High event-mask bits identifying required native listeners. See\n * {@link PibblEventTargetRegistration}.\n */\n requiredNativeTypesHigh: number;\n /** Last native signature reconciled with `nativeReleases`. */\n ownedNativeTypesLow: number;\n /**\n * High event-mask bits identifying native listeners owned by this registration. See\n * {@link PibblEventTargetRegistration}.\n */\n ownedNativeTypesHigh: number;\n /**\n * Cursor shown while this target owns pointer presentation. See\n * {@link PibblEventTargetRegistration}.\n */\n cursor: string | undefined;\n /** Whether the target may receive keyboard focus. See {@link PibblEventTargetRegistration}. */\n keyboardFocusable: boolean | undefined;\n /** Logical rectangle used for directional keyboard navigation. See {@link LayoutBox}. */\n keyboardNavigationBounds: Readonly<LayoutBox> | undefined;\n /** @internal Backend-projected points retained until root-space resolution. */\n keyboardNavigationPoints:\n | readonly Readonly<{\n /**\n * Horizontal coordinate or displacement in the containing coordinate system. See\n * {@link PibblEventTargetRegistration}.\n */\n x: number;\n /**\n * Vertical coordinate or displacement in the containing coordinate system. See\n * {@link PibblEventTargetRegistration}.\n */\n y: number;\n }>[]\n | undefined;\n /**\n * Whether this registration is currently attached to a live owner. See\n * {@link PibblEventTargetRegistration}.\n */\n live: boolean;\n}\n\nexport interface PibblEventListenerRegistration {\n readonly kind: \"listener\";\n readonly owner: PibblInstance;\n readonly component: PibblComponentRefs<any>;\n readonly slot: number;\n readonly publicTarget: PibblEventTarget;\n handlers: PibblNormalizedHandlers;\n /** Logical event types currently present in `handlers`, split across two 32-bit words. */\n handlerTypesLow: number;\n handlerTypesHigh: number;\n /** Native event dependency signature derived from the current handlers. */\n requiredNativeTypesLow: number;\n requiredNativeTypesHigh: number;\n /** Last native signature reconciled with `nativeReleases`. */\n ownedNativeTypesLow: number;\n ownedNativeTypesHigh: number;\n live: boolean;\n}\n\nexport type PibblEventNode =\n PibblEventTargetRegistration | PibblEventListenerRegistration;\n\n// Masks make membership/diff checks cheap; this map retains the exact release\n// closure returned by the shared hub for each bit that was actually acquired.\nconst nativeReleases = new WeakMap<\n PibblEventTargetRegistration | PibblEventListenerRegistration,\n Map<PibblEventType, () => void>\n>();\n\nexport function createTarget(\n owner: PibblInstance,\n component: PibblComponentRefs<any>,\n slot: number,\n): PibblEventTargetRegistration {\n const target = {} as PibblEventTargetRegistration;\n const publicTarget = createPublicTarget(() => target);\n Object.assign(target, {\n kind: \"target\" as const,\n owner,\n component,\n slot,\n publicTarget,\n paintEntry: undefined,\n handlers: {},\n handlerTypesLow: 0,\n handlerTypesHigh: 0,\n requiredNativeTypesLow: 0,\n requiredNativeTypesHigh: 0,\n ownedNativeTypesLow: 0,\n ownedNativeTypesHigh: 0,\n cursor: undefined,\n keyboardFocusable: undefined,\n keyboardNavigationBounds: undefined,\n keyboardNavigationPoints: undefined,\n live: false,\n });\n return target;\n}\n\nexport function updateTarget(\n target: PibblEventTargetRegistration,\n handlers: PibblEventHandlers,\n options: PibblEventTargetOptions,\n participatesInPaint = false,\n preserveKeyboardNavigationGeometry = false,\n): void {\n updateTargetRegistration(\n target,\n handlers,\n { ...options, path: resolvePath(options.path) },\n participatesInPaint,\n preserveKeyboardNavigationGeometry,\n );\n if (target.live) target.owner.regions.add(target);\n}\n\nexport function updateCursorTarget(\n target: PibblEventTargetRegistration,\n {\n path,\n fill = false,\n lineInteractionWidth = 0,\n cursor,\n }: {\n path: Path2D | PathGeometry;\n fill?: boolean;\n lineInteractionWidth?: number;\n cursor?: string;\n },\n): void {\n updateTargetRegistration(\n target,\n {},\n {\n path: resolvePath(path),\n fill,\n lineInteractionWidth,\n cursor,\n },\n );\n if (target.live) target.owner.regions.add(target);\n}\n\nfunction updateTargetRegistration(\n target: PibblEventTargetRegistration,\n handlers: PibblEventHandlers,\n options: Omit<PibblEventTargetOptions, 'path'> & { readonly path: Path2D },\n participatesInPaint = false,\n preserveKeyboardNavigationGeometry = false,\n): void {\n if (target.live) {\n // Remove while the previous handler map is still current so ownership\n // diagnostics and mutation observers attribute the release correctly.\n if (target.paintEntry) target.owner.paintEntries.delete(target.paintEntry);\n target.owner.eventRoot.targets.delete(target);\n }\n\n refreshHandlers(target, handlers, Boolean(options.cursor));\n const paintEntry =\n target.paintEntry ??\n ({\n paintKind: PibblPaintEntryKind.Path,\n } as PibblPathPaintEntry);\n paintEntry.target = target;\n paintEntry.path = options.path;\n paintEntry.fill = options.fill ?? false;\n paintEntry.lineInteractionWidth = options.lineInteractionWidth ?? 0;\n if (GLOBAL_STATE.renderContext) {\n paintEntry.transform = getCurrentWorldTransform();\n paintEntry.clippingStack = Array.from(GLOBAL_STATE.clippingStack);\n } else {\n paintEntry.transform ??= new DOMMatrix();\n paintEntry.clippingStack ??= [];\n }\n target.cursor = options.cursor;\n target.keyboardFocusable = options.keyboardFocusable;\n if (!preserveKeyboardNavigationGeometry) {\n target.keyboardNavigationBounds = options.keyboardNavigationBounds;\n target.keyboardNavigationPoints = undefined;\n }\n\n if (\n !participatesInPaint &&\n target.handlerTypesLow === 0 &&\n target.handlerTypesHigh === 0 &&\n !target.cursor &&\n target.keyboardFocusable !== true\n ) {\n if (target.live) {\n target.owner.eventRoot.focusPolicy?.removeTarget(target);\n target.owner.eventRoot.onNodeRelease?.(target);\n }\n target.owner.regions.delete(target);\n target.paintEntry = undefined;\n target.live = false;\n clearPointerCapturesForTarget(target);\n releaseNativeOwnership(target);\n return;\n }\n\n target.live = true;\n target.paintEntry = paintEntry;\n target.owner.paintEntries.add(paintEntry);\n target.owner.eventRoot.targets.add(target);\n updateNativeOwnership(target);\n target.owner.eventRoot.focusPolicy?.observeTarget(target);\n target.owner.eventRoot.onTargetUpdate?.(target);\n}\n\nexport function releaseTarget(target: PibblEventTargetRegistration): void {\n if (target.live) {\n if (target.paintEntry) target.owner.paintEntries.delete(target.paintEntry);\n target.owner.eventRoot.targets.delete(target);\n target.owner.eventRoot.focusPolicy?.removeTarget(target);\n target.owner.eventRoot.onNodeRelease?.(target);\n }\n target.owner.regions.delete(target);\n target.paintEntry = undefined;\n target.live = false;\n clearPointerCapturesForTarget(target);\n releaseNativeOwnership(target);\n}\n\nexport function createListener(\n owner: PibblInstance,\n component: PibblComponentRefs<any>,\n slot: number,\n): PibblEventListenerRegistration {\n const listener = {} as PibblEventListenerRegistration;\n const publicTarget = createPublicTarget(() => listener);\n Object.assign(listener, {\n kind: \"listener\",\n owner,\n component,\n slot,\n publicTarget,\n handlers: {},\n handlerTypesLow: 0,\n handlerTypesHigh: 0,\n requiredNativeTypesLow: 0,\n requiredNativeTypesHigh: 0,\n ownedNativeTypesLow: 0,\n ownedNativeTypesHigh: 0,\n live: false,\n });\n return listener;\n}\n\nexport function updateListener(\n listener: PibblEventListenerRegistration,\n handlers: PibblEventHandlers,\n): void {\n let registrations = listener.owner.eventRoot.listenersByComponent.get(\n listener.component.id,\n );\n if (listener.live) {\n // Keep the registration stable while refreshing its current source-order\n // position and preserving the previous handler map for release observers.\n registrations?.delete(listener);\n }\n refreshHandlers(listener, handlers, false);\n\n if (listener.handlerTypesLow === 0 && listener.handlerTypesHigh === 0) {\n if (registrations?.size === 0) {\n listener.owner.eventRoot.listenersByComponent.delete(\n listener.component.id,\n );\n }\n if (listener.live) listener.owner.eventRoot.onNodeRelease?.(listener);\n listener.live = false;\n clearPointerCapturesForTarget(listener);\n releaseNativeOwnership(listener);\n return;\n }\n\n if (!registrations) {\n registrations = new Set();\n listener.owner.eventRoot.listenersByComponent.set(\n listener.component.id,\n registrations,\n );\n }\n registrations.add(listener);\n listener.live = true;\n updateNativeOwnership(listener);\n}\n\nexport function releaseListener(listener: PibblEventListenerRegistration): void {\n if (listener.live) {\n const registrations = listener.owner.eventRoot.listenersByComponent.get(\n listener.component.id,\n );\n registrations?.delete(listener);\n if (registrations?.size === 0) {\n listener.owner.eventRoot.listenersByComponent.delete(\n listener.component.id,\n );\n }\n listener.owner.eventRoot.onNodeRelease?.(listener);\n }\n listener.live = false;\n clearPointerCapturesForTarget(listener);\n releaseNativeOwnership(listener);\n}\n\nexport function normalizeHandlers(\n handlers: PibblEventHandlers,\n): PibblNormalizedHandlers {\n const state = createHandlerState();\n refreshHandlers(state, handlers, false);\n return state.handlers;\n}\n\ninterface PibblHandlerState {\n handlers: PibblNormalizedHandlers;\n handlerTypesLow: number;\n handlerTypesHigh: number;\n requiredNativeTypesLow: number;\n requiredNativeTypesHigh: number;\n}\n\ninterface PibblEventPropMetadata {\n readonly normalizedKey: PibblEventType | PibblNormalizedCaptureKey;\n readonly handlerTypesLow: number;\n readonly handlerTypesHigh: number;\n readonly requiredNativeTypesLow: number;\n readonly requiredNativeTypesHigh: number;\n}\n\n/**\n * Hot-path property lookup built once from the closed event vocabulary.\n *\n * Each definition owns one bit position. JavaScript bitwise operators use\n * signed 32-bit integers, but sign is irrelevant here: the words are opaque\n * bit sets compared and combined only with bitwise operations.\n */\nconst eventPropMetadata = Object.create(null) as Record<\n string,\n PibblEventPropMetadata | undefined\n>;\nconst eventIndexByType = Object.create(null) as Record<\n string,\n number | undefined\n>;\n\nif (PIBBL_EVENT_DEFINITIONS.length > 64) {\n throw new Error(\"Pibbl event masks support at most 64 logical event types.\");\n}\n\nfor (let index = 0; index < PIBBL_EVENT_DEFINITIONS.length; index++) {\n eventIndexByType[PIBBL_EVENT_DEFINITIONS[index]!.type] = index;\n}\n\nfor (let index = 0; index < PIBBL_EVENT_DEFINITIONS.length; index++) {\n const definition = PIBBL_EVENT_DEFINITIONS[index]!;\n const handlerTypesLow = index < 32 ? 1 << index : 0;\n const handlerTypesHigh = index < 32 ? 0 : 1 << (index - 32);\n // Expand logical-to-native prerequisites once. The render path only ORs\n // these precomputed words and never allocates dependency Sets.\n const nativeTypes = expandNativeTypesForMetadata(\n new Set([definition.type]),\n false,\n );\n let requiredNativeTypesLow = 0;\n let requiredNativeTypesHigh = 0;\n for (const type of nativeTypes) {\n const nativeIndex = eventIndexByType[type]!;\n if (nativeIndex < 32) {\n requiredNativeTypesLow |= 1 << nativeIndex;\n } else {\n requiredNativeTypesHigh |= 1 << (nativeIndex - 32);\n }\n }\n const bubble: PibblEventPropMetadata = Object.freeze({\n normalizedKey: definition.type,\n handlerTypesLow,\n handlerTypesHigh,\n requiredNativeTypesLow,\n requiredNativeTypesHigh,\n });\n const capture: PibblEventPropMetadata = Object.freeze({\n ...bubble,\n normalizedKey: `${definition.type}Capture` as PibblNormalizedCaptureKey,\n });\n eventPropMetadata[definition.prop] = bubble;\n eventPropMetadata[definition.captureProp] = capture;\n}\n\n// Cursor tracking has native movement/exit requirements even without a\n// logical callback, so it receives the same precomputed representation.\nconst cursorNativeTypes = expandNativeTypesForMetadata(new Set(), true);\nlet cursorNativeTypesLow = 0;\nlet cursorNativeTypesHigh = 0;\nfor (const type of cursorNativeTypes) {\n const index = eventIndexByType[type]!;\n if (index < 32) {\n cursorNativeTypesLow |= 1 << index;\n } else {\n cursorNativeTypesHigh |= 1 << (index - 32);\n }\n}\n\nfunction createHandlerState(): PibblHandlerState {\n return {\n handlers: {},\n handlerTypesLow: 0,\n handlerTypesHigh: 0,\n requiredNativeTypesLow: 0,\n requiredNativeTypesHigh: 0,\n };\n}\n\nfunction refreshHandlers(\n state: PibblHandlerState,\n handlers: PibblEventHandlers,\n hasCursor: boolean,\n): void {\n const normalized: PibblNormalizedHandlers = {};\n let handlerTypesLow = 0;\n let handlerTypesHigh = 0;\n let requiredNativeTypesLow = hasCursor ? cursorNativeTypesLow : 0;\n let requiredNativeTypesHigh = hasCursor ? cursorNativeTypesHigh : 0;\n // Iterate supplied props rather than probing every supported bubble and\n // capture name. Keep the normalized object fresh so dispatch always sees\n // the newest closures even when the type signature is unchanged.\n for (const prop in handlers) {\n const metadata = eventPropMetadata[prop];\n if (!metadata) continue;\n const handler = handlers[prop as keyof PibblEventHandlers];\n if (handler) {\n (normalized as Record<string, unknown>)[metadata.normalizedKey] = handler;\n handlerTypesLow |= metadata.handlerTypesLow;\n handlerTypesHigh |= metadata.handlerTypesHigh;\n requiredNativeTypesLow |= metadata.requiredNativeTypesLow;\n requiredNativeTypesHigh |= metadata.requiredNativeTypesHigh;\n }\n }\n state.handlers = normalized;\n state.handlerTypesLow = handlerTypesLow;\n state.handlerTypesHigh = handlerTypesHigh;\n state.requiredNativeTypesLow = requiredNativeTypesLow;\n state.requiredNativeTypesHigh = requiredNativeTypesHigh;\n}\n\n/**\n * Cold module-initialization helper. Do not call this from registration or\n * render code: its Sets deliberately trade startup simplicity for precomputed\n * allocation-free metadata in the hot path.\n */\nfunction expandNativeTypesForMetadata(\n types: ReadonlySet<PibblEventType>,\n hasCursor: boolean,\n): ReadonlySet<PibblEventType> {\n const nativeTypes = new Set(types);\n const hasPointerBoundary =\n types.has(\"pointerover\") ||\n types.has(\"pointerenter\") ||\n types.has(\"pointerout\") ||\n types.has(\"pointerleave\");\n if (hasPointerBoundary || types.has(\"pointermove\")) {\n nativeTypes.delete(\"pointerenter\");\n nativeTypes.delete(\"pointerleave\");\n nativeTypes.add(\"pointermove\");\n nativeTypes.add(\"pointerout\");\n if (hasPointerBoundary) nativeTypes.add(\"pointerover\");\n }\n if (\n hasCursor ||\n types.has(\"mouseover\") ||\n types.has(\"mouseenter\") ||\n types.has(\"mousemove\") ||\n types.has(\"mouseout\") ||\n types.has(\"mouseleave\")\n ) {\n nativeTypes.delete(\"mouseover\");\n nativeTypes.delete(\"mouseenter\");\n nativeTypes.delete(\"mouseleave\");\n nativeTypes.add(\"mousemove\");\n nativeTypes.add(\"mouseout\");\n }\n if (types.has(\"click\") || types.has(\"dblclick\") || types.has(\"auxclick\")) {\n nativeTypes.add(\"mousedown\");\n nativeTypes.add(\"mouseup\");\n }\n if (types.has(\"dblclick\")) nativeTypes.add(\"click\");\n if (\n types.has(\"touchstart\") ||\n types.has(\"touchmove\") ||\n types.has(\"touchend\") ||\n types.has(\"touchcancel\")\n ) {\n nativeTypes.add(\"touchstart\");\n nativeTypes.add(\"touchend\");\n nativeTypes.add(\"touchcancel\");\n }\n const hasDragBoundary = types.has(\"dragenter\") || types.has(\"dragleave\");\n if (hasDragBoundary) nativeTypes.add(\"dragenter\");\n if (hasDragBoundary || types.has(\"dragover\")) {\n nativeTypes.add(\"dragover\");\n nativeTypes.add(\"dragleave\");\n nativeTypes.add(\"drop\");\n nativeTypes.add(\"dragend\");\n }\n return nativeTypes;\n}\n\nfunction updateNativeOwnership(\n registration: PibblEventTargetRegistration | PibblEventListenerRegistration,\n): void {\n const previousLow = registration.ownedNativeTypesLow;\n const previousHigh = registration.ownedNativeTypesHigh;\n const nextLow = registration.requiredNativeTypesLow;\n const nextHigh = registration.requiredNativeTypesHigh;\n // Callback values may change every render while their native requirements\n // remain identical. Two integer comparisons make that common case a no-op.\n if (previousLow === nextLow && previousHigh === nextHigh) return;\n\n let releases = nativeReleases.get(registration);\n if (!releases) {\n releases = new Map();\n nativeReleases.set(registration, releases);\n }\n\n // A & ~B is the set difference A \u2212 B. Release all removals before\n // acquiring additions so hub reference counts always describe this target's\n // current requirement transition.\n forEachChangedType(\n previousLow & ~nextLow,\n previousHigh & ~nextHigh,\n (type) => {\n releases.get(type)?.();\n releases.delete(type);\n },\n );\n\n const hub = registration.owner.eventRoot.nativeListeners;\n if (hub) {\n // B & ~A is B \u2212 A: only newly required native types are acquired.\n forEachChangedType(\n nextLow & ~previousLow,\n nextHigh & ~previousHigh,\n (type) => {\n if (!releases.has(type)) releases.set(type, hub.acquire(type));\n },\n );\n }\n registration.ownedNativeTypesLow = nextLow;\n registration.ownedNativeTypesHigh = nextHigh;\n}\n\nfunction releaseNativeOwnership(\n registration: PibblEventTargetRegistration | PibblEventListenerRegistration,\n): void {\n // Zero first so a stable hook slot revived after release cannot mistake its\n // old signature for live ownership and skip reacquisition.\n registration.ownedNativeTypesLow = 0;\n registration.ownedNativeTypesHigh = 0;\n const releases = nativeReleases.get(registration);\n if (!releases) return;\n nativeReleases.delete(registration);\n for (const release of releases.values()) {\n release();\n }\n releases.clear();\n}\n\nfunction forEachChangedType(\n low: number,\n high: number,\n visit: (type: PibblEventType) => void,\n): void {\n // `word & -word` isolates the least-significant set bit. `word & (word - 1)`\n // clears it, so this loop is O(number of changed types), not O(52 events).\n // Math.clz32 converts the isolated bit to its definition index; the high\n // word starts at definition 32.\n while (low !== 0) {\n const bit = low & -low;\n visit(PIBBL_EVENT_DEFINITIONS[31 - Math.clz32(bit)]!.type);\n low &= low - 1;\n }\n while (high !== 0) {\n const bit = high & -high;\n visit(PIBBL_EVENT_DEFINITIONS[32 + 31 - Math.clz32(bit)]!.type);\n high &= high - 1;\n }\n}\n\nfunction createPublicTarget(\n getRegistration: () => PibblEventNode,\n): PibblEventTarget {\n return {\n setPointerCapture(pointerId) {\n setLogicalPointerCapture(getRegistration(), pointerId);\n },\n hasPointerCapture(pointerId) {\n return hasLogicalPointerCapture(getRegistration(), pointerId);\n },\n releasePointerCapture(pointerId) {\n releaseLogicalPointerCapture(getRegistration(), pointerId);\n },\n };\n}\n"],
|
|
5
|
-
"mappings": "AAEA,SAAS,+BAA+B;AAQxC,SAAS,oBAAoB;AAC7B,SAAS,mBAAmB;AAG5B,SAAS,gCAAgC;AAKzC,SAAS,2BAAqD;AAC9D;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAmHP,MAAM,iBAAiB,oBAAI,QAGzB;AAEK,SAAS,aACd,OACA,WACA,MAC8B;AAC9B,QAAM,SAAS,CAAC;AAChB,QAAM,eAAe,mBAAmB,MAAM,MAAM;AACpD,SAAO,OAAO,QAAQ;AAAA,IACpB,MAAM;AAAA,IACN;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,YAAY;AAAA,IACZ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C;AACpB,UAAM,wBAAwB,KAAK,KAAK,KAAK,MAAM,GAAG,CAAC,EAAG,IAAI;AAC9D,YAAQ,OAAO;AAAA,EACjB;AACF;AAEA,SAAS,mBACP,iBACkB;AAClB,SAAO;AAAA,IACL,kBAAkB,WAAW;AAC3B,+BAAyB,gBAAgB,GAAG,SAAS;AAAA,IACvD;AAAA,IACA,kBAAkB,WAAW;AAC3B,aAAO,yBAAyB,gBAAgB,GAAG,SAAS;AAAA,IAC9D;AAAA,IACA,sBAAsB,WAAW;AAC/B,mCAA6B,gBAAgB,GAAG,SAAS;AAAA,IAC3D;AAAA,EACF;AACF;",
|
|
4
|
+
"sourcesContent": ["import { releaseLayoutTargetGeometry } from '../layout/geometry-publication.js';\nimport { registerLayoutSuspensionResource, unregisterLayoutSuspensionResource, isLayoutComponentSuspended, isLayoutInstanceSuspended } from '../layout/participation.js';\nimport type { PibblHitTestOutput } from './paint-entry.js';\nimport type { isBackendEventTargetLive, useBackendEventTarget } from '../../internal.js';\nimport { PIBBL_EVENT_DEFINITIONS } from \"./event-definitions.js\";\nimport type {\n PibblEventHandler,\n PibblEventHandlers,\n PibblEventTarget,\n PibblEventTargetOptions,\n PibblEventType,\n} from \"./types.js\";\nimport { GLOBAL_STATE } from \"../global-state.js\";\nimport { resolvePath } from '../geometry/resolve-path.js';\nimport type { PathGeometry } from '../geometry/path-geometry.js';\nimport type { LayoutBox } from \"../layout/types.js\";\nimport { getCurrentWorldTransform } from \"../render-target.js\";\nimport type {\n PibblComponentRefs,\n PibblInstance,\n} from \"../types.js\";\nimport { PibblPaintEntryKind, type PibblPathPaintEntry } from \"./paint-entry.js\";\nimport {\n clearPointerCapturesForTarget,\n hasLogicalPointerCapture,\n releaseLogicalPointerCapture,\n setLogicalPointerCapture,\n} from \"./pointer-capture.js\";\n\ntype PibblNormalizedCaptureKey = `${PibblEventType}Capture`;\n\nexport type PibblNormalizedHandlers = Partial<\n {\n [K in PibblEventType]: PibblEventHandler<K>;\n } & {\n [K in PibblEventType as `${K}Capture`]: PibblEventHandler<K>;\n }\n>;\n\n/**\n * Mount-owned event target registration and cleanup state.\n *\n * @see {@link PibblEventTarget}\n * @see {@link LayoutBox}\n * @see {@link PibblHitTestOutput}\n * @see {@link useBackendEventTarget}\n * @see {@link isBackendEventTargetLive}\n */\nexport interface PibblEventTargetRegistration {\n /** @internal Withdraws published interaction while preserving mount-owned resources. */\n suspendLayout(): void;\n /** Selects the kind of geometry, material, or result. See {@link PibblEventTargetRegistration}. */\n readonly kind: \"target\";\n /** Mount or runtime resource owning this registration. See {@link PibblInstance}. */\n readonly owner: PibblInstance;\n /**\n * Component identity or diagnostic name associated with this value. See {@link PibblComponentRefs}\n * .\n */\n readonly component: PibblComponentRefs<any>;\n /** Mount-local hook or registration slot. See {@link PibblEventTargetRegistration}. */\n readonly slot: number;\n /** Logical target exposed to application event handlers. See {@link PibblEventTarget}. */\n readonly publicTarget: PibblEventTarget;\n /** Paint-ledger entry associated with this registration. See {@link PibblPathPaintEntry}. */\n paintEntry: PibblPathPaintEntry | undefined;\n /** Event handlers dispatched for this logical target. See {@link PibblNormalizedHandlers}. */\n handlers: PibblNormalizedHandlers;\n /** Logical event types currently present in `handlers`, split across two 32-bit words. */\n handlerTypesLow: number;\n /**\n * High event-mask bits identifying registered handler types. See\n * {@link PibblEventTargetRegistration}.\n */\n handlerTypesHigh: number;\n /** Native event dependency signature derived from the current handlers and cursor. */\n requiredNativeTypesLow: number;\n /**\n * High event-mask bits identifying required native listeners. See\n * {@link PibblEventTargetRegistration}.\n */\n requiredNativeTypesHigh: number;\n /** Last native signature reconciled with `nativeReleases`. */\n ownedNativeTypesLow: number;\n /**\n * High event-mask bits identifying native listeners owned by this registration. See\n * {@link PibblEventTargetRegistration}.\n */\n ownedNativeTypesHigh: number;\n /**\n * Cursor shown while this target owns pointer presentation. See\n * {@link PibblEventTargetRegistration}.\n */\n cursor: string | undefined;\n /** Whether the target may receive keyboard focus. See {@link PibblEventTargetRegistration}. */\n keyboardFocusable: boolean | undefined;\n /** Logical rectangle used for directional keyboard navigation. See {@link LayoutBox}. */\n keyboardNavigationBounds: Readonly<LayoutBox> | undefined;\n /** @internal Backend-projected points retained until root-space resolution. */\n keyboardNavigationPoints:\n | readonly Readonly<{\n /**\n * Horizontal coordinate or displacement in the containing coordinate system. See\n * {@link PibblEventTargetRegistration}.\n */\n x: number;\n /**\n * Vertical coordinate or displacement in the containing coordinate system. See\n * {@link PibblEventTargetRegistration}.\n */\n y: number;\n }>[]\n | undefined;\n /**\n * Whether this registration is currently attached to a live owner. See\n * {@link PibblEventTargetRegistration}.\n */\n live: boolean;\n}\n\nexport interface PibblEventListenerRegistration {\n /** @internal Withdraws listeners while preserving mount-owned resources. */\n suspendLayout(): void;\n readonly kind: \"listener\";\n readonly owner: PibblInstance;\n readonly component: PibblComponentRefs<any>;\n readonly slot: number;\n readonly publicTarget: PibblEventTarget;\n handlers: PibblNormalizedHandlers;\n /** Logical event types currently present in `handlers`, split across two 32-bit words. */\n handlerTypesLow: number;\n handlerTypesHigh: number;\n /** Native event dependency signature derived from the current handlers. */\n requiredNativeTypesLow: number;\n requiredNativeTypesHigh: number;\n /** Last native signature reconciled with `nativeReleases`. */\n ownedNativeTypesLow: number;\n ownedNativeTypesHigh: number;\n live: boolean;\n}\n\nexport type PibblEventNode =\n PibblEventTargetRegistration | PibblEventListenerRegistration;\n\n// Masks make membership/diff checks cheap; this map retains the exact release\n// closure returned by the shared hub for each bit that was actually acquired.\nconst nativeReleases = new WeakMap<\n PibblEventTargetRegistration | PibblEventListenerRegistration,\n Map<PibblEventType, () => void>\n>();\n\nexport function createTarget(\n owner: PibblInstance,\n component: PibblComponentRefs<any>,\n slot: number,\n): PibblEventTargetRegistration {\n const target = {} as PibblEventTargetRegistration;\n const publicTarget = createPublicTarget(() => target);\n Object.assign(target, {\n kind: \"target\" as const,\n suspendLayout: suspendTargetLayout,\n owner,\n component,\n slot,\n publicTarget,\n paintEntry: undefined,\n handlers: {},\n handlerTypesLow: 0,\n handlerTypesHigh: 0,\n requiredNativeTypesLow: 0,\n requiredNativeTypesHigh: 0,\n ownedNativeTypesLow: 0,\n ownedNativeTypesHigh: 0,\n cursor: undefined,\n keyboardFocusable: undefined,\n keyboardNavigationBounds: undefined,\n keyboardNavigationPoints: undefined,\n live: false,\n });\n registerLayoutSuspensionResource(component, target);\n return target;\n}\n\n/** Prepared external registrations acquire fallible native leases before adoption. */\nexport function prepareTargetUpdate(\n target: PibblEventTargetRegistration,\n handlers: PibblEventHandlers,\n options: PibblEventTargetOptions,\n transform: DOMMatrix,\n clippingStack: PibblPathPaintEntry['clippingStack'],\n): { adopt(): void; finish(): void; notify(): void } {\n const state = { ...target };\n refreshHandlers(state, handlers, Boolean(options.cursor));\n const paintEntry: PibblPathPaintEntry = {\n paintKind: PibblPaintEntryKind.Path, target, path: resolvePath(options.path),\n fill: options.fill ?? false, lineInteractionWidth: options.lineInteractionWidth ?? 0,\n transform, clippingStack,\n };\n const leases = new Map<PibblEventType, () => void>();\n const existing = nativeReleases.get(target);\n const additions: (() => void)[] = [];\n const hub = target.owner.eventRoot.nativeListeners;\n try {\n if (hub) forEachChangedType(state.requiredNativeTypesLow, state.requiredNativeTypesHigh,\n type => {\n let lease = existing?.get(type);\n if (!lease) { lease = hub.acquire(type); additions.push(lease); }\n leases.set(type, lease);\n });\n } catch (error) {\n const errors: unknown[] = [error];\n for (const release of additions) { try { release(); } catch (releaseError) { errors.push(releaseError); } }\n if (errors.length > 1) throw new AggregateError(errors, 'Prepared target acquisition failed.', { cause: error });\n throw error;\n }\n let previous: Map<PibblEventType, () => void> | undefined;\n let adopted = false;\n return {\n adopt() {\n previous = nativeReleases.get(target);\n nativeReleases.set(target, leases);\n if (target.paintEntry) target.owner.paintEntries.delete(target.paintEntry);\n target.handlers = state.handlers;\n target.handlerTypesLow = state.handlerTypesLow; target.handlerTypesHigh = state.handlerTypesHigh;\n target.requiredNativeTypesLow = target.ownedNativeTypesLow = state.requiredNativeTypesLow;\n target.requiredNativeTypesHigh = target.ownedNativeTypesHigh = state.requiredNativeTypesHigh;\n target.cursor = options.cursor; target.keyboardFocusable = options.keyboardFocusable;\n target.keyboardNavigationBounds = options.keyboardNavigationBounds;\n target.keyboardNavigationPoints = undefined;\n target.paintEntry = paintEntry; target.live = true;\n target.owner.regions.add(target); target.owner.eventRoot.targets.add(target);\n adopted = true;\n },\n finish() {\n const errors: unknown[] = [];\n const complete = (callback: () => void) => { try { callback(); } catch (error) { errors.push(error); } };\n if (adopted) {\n for (const [type, release] of previous ?? []) if (!leases.has(type)) complete(release);\n previous = undefined;\n\n } else {\n for (const release of additions) complete(release);\n additions.length = 0;\n }\n if (errors.length === 1) throw errors[0];\n if (errors.length) throw new AggregateError(errors, 'Prepared target completion failed.');\n },\n notify() {\n if (!adopted || !target.live) return;\n const errors: unknown[] = [];\n try { target.owner.eventRoot.focusPolicy?.observeTarget(target); } catch (error) { errors.push(error); }\n try { target.owner.eventRoot.onTargetUpdate?.(target); } catch (error) { errors.push(error); }\n if (errors.length === 1) throw errors[0];\n if (errors.length) throw new AggregateError(errors, 'Prepared target notification failed.');\n },\n };\n}\n\nexport function updateTarget(\n target: PibblEventTargetRegistration,\n handlers: PibblEventHandlers,\n options: PibblEventTargetOptions,\n participatesInPaint = false,\n preserveKeyboardNavigationGeometry = false,\n): void {\n updateTargetRegistration(\n target,\n handlers,\n { ...options, path: resolvePath(options.path) },\n participatesInPaint,\n preserveKeyboardNavigationGeometry,\n );\n if (target.live) target.owner.regions.add(target);\n}\n\nexport function updateCursorTarget(\n target: PibblEventTargetRegistration,\n {\n path,\n fill = false,\n lineInteractionWidth = 0,\n cursor,\n }: {\n path: Path2D | PathGeometry;\n fill?: boolean;\n lineInteractionWidth?: number;\n cursor?: string;\n },\n): void {\n updateTargetRegistration(\n target,\n {},\n {\n path: resolvePath(path),\n fill,\n lineInteractionWidth,\n cursor,\n },\n );\n if (target.live) target.owner.regions.add(target);\n}\n\nfunction updateTargetRegistration(\n target: PibblEventTargetRegistration,\n handlers: PibblEventHandlers,\n options: Omit<PibblEventTargetOptions, 'path'> & { readonly path: Path2D },\n participatesInPaint = false,\n preserveKeyboardNavigationGeometry = false,\n): void {\n if (target.live) {\n // Remove while the previous handler map is still current so ownership\n // diagnostics and mutation observers attribute the release correctly.\n if (target.paintEntry) target.owner.paintEntries.delete(target.paintEntry);\n target.owner.eventRoot.targets.delete(target);\n }\n\n refreshHandlers(target, handlers, Boolean(options.cursor));\n const paintEntry =\n target.paintEntry ??\n ({\n paintKind: PibblPaintEntryKind.Path,\n } as PibblPathPaintEntry);\n paintEntry.target = target;\n paintEntry.path = options.path;\n paintEntry.fill = options.fill ?? false;\n paintEntry.lineInteractionWidth = options.lineInteractionWidth ?? 0;\n if (GLOBAL_STATE.renderContext) {\n paintEntry.transform = getCurrentWorldTransform();\n paintEntry.clippingStack = Array.from(GLOBAL_STATE.clippingStack);\n } else {\n paintEntry.transform ??= new DOMMatrix();\n paintEntry.clippingStack ??= [];\n }\n target.cursor = options.cursor;\n target.keyboardFocusable = options.keyboardFocusable;\n if (!preserveKeyboardNavigationGeometry) {\n target.keyboardNavigationBounds = options.keyboardNavigationBounds;\n target.keyboardNavigationPoints = undefined;\n }\n\n if (\n !participatesInPaint &&\n target.handlerTypesLow === 0 &&\n target.handlerTypesHigh === 0 &&\n !target.cursor &&\n target.keyboardFocusable !== true\n ) {\n if (target.live) {\n target.owner.eventRoot.focusPolicy?.removeTarget(target);\n target.owner.eventRoot.onNodeRelease?.(target);\n }\n target.owner.regions.delete(target);\n target.paintEntry = undefined;\n target.live = false;\n clearPointerCapturesForTarget(target);\n releaseNativeOwnership(target);\n return;\n }\n\n target.live = true;\n target.paintEntry = paintEntry;\n target.owner.paintEntries.add(paintEntry);\n target.owner.eventRoot.targets.add(target);\n updateNativeOwnership(target);\n if (isLayoutComponentSuspended(target.component) || isLayoutInstanceSuspended(target.owner)) { target.suspendLayout(); return; }\n target.owner.eventRoot.focusPolicy?.observeTarget(target);\n target.owner.eventRoot.onTargetUpdate?.(target);\n}\n\nfunction suspendTargetLayout(this: PibblEventTargetRegistration): void {\n if (!this.live) return;\n if (this.paintEntry) this.owner.paintEntries.delete(this.paintEntry);\n this.owner.regions.delete(this);\n this.owner.eventRoot.targets.delete(this);\n this.owner.eventRoot.focusPolicy?.removeTarget(this);\n this.owner.eventRoot.onNodeRelease?.(this);\n this.paintEntry = undefined;\n this.live = false;\n clearPointerCapturesForTarget(this);\n}\n\nfunction suspendListenerLayout(this: PibblEventListenerRegistration): void {\n if (!this.live) return;\n const entries = this.owner.eventRoot.listenersByComponent.get(this.component.id);\n entries?.delete(this);\n if (entries?.size === 0) this.owner.eventRoot.listenersByComponent.delete(this.component.id);\n this.owner.eventRoot.onNodeRelease?.(this);\n this.live = false;\n clearPointerCapturesForTarget(this);\n}\n\nexport function releaseTarget(target: PibblEventTargetRegistration): void {\n releaseLayoutTargetGeometry(target);\n const errors: unknown[] = [];\n const release = (callback: () => void) => { try { callback(); } catch (error) { errors.push(error); } };\n release(() => unregisterLayoutSuspensionResource(target.component, target));\n if (target.live) {\n if (target.paintEntry) target.owner.paintEntries.delete(target.paintEntry);\n target.owner.eventRoot.targets.delete(target);\n release(() => target.owner.eventRoot.focusPolicy?.removeTarget(target));\n release(() => target.owner.eventRoot.onNodeRelease?.(target));\n }\n target.owner.regions.delete(target);\n target.paintEntry = undefined;\n target.live = false;\n release(() => clearPointerCapturesForTarget(target));\n release(() => releaseNativeOwnership(target));\n if (errors.length === 1) throw errors[0];\n if (errors.length) throw new AggregateError(errors, 'Target release failed.');\n}\n\nexport function createListener(\n owner: PibblInstance,\n component: PibblComponentRefs<any>,\n slot: number,\n): PibblEventListenerRegistration {\n const listener = {} as PibblEventListenerRegistration;\n const publicTarget = createPublicTarget(() => listener);\n Object.assign(listener, {\n kind: \"listener\",\n suspendLayout: suspendListenerLayout,\n owner,\n component,\n slot,\n publicTarget,\n handlers: {},\n handlerTypesLow: 0,\n handlerTypesHigh: 0,\n requiredNativeTypesLow: 0,\n requiredNativeTypesHigh: 0,\n ownedNativeTypesLow: 0,\n ownedNativeTypesHigh: 0,\n live: false,\n });\n registerLayoutSuspensionResource(component, listener);\n return listener;\n}\n\nexport function updateListener(\n listener: PibblEventListenerRegistration,\n handlers: PibblEventHandlers,\n): void {\n let registrations = listener.owner.eventRoot.listenersByComponent.get(\n listener.component.id,\n );\n if (listener.live) {\n // Keep the registration stable while refreshing its current source-order\n // position and preserving the previous handler map for release observers.\n registrations?.delete(listener);\n }\n refreshHandlers(listener, handlers, false);\n\n if (listener.handlerTypesLow === 0 && listener.handlerTypesHigh === 0) {\n if (registrations?.size === 0) {\n listener.owner.eventRoot.listenersByComponent.delete(\n listener.component.id,\n );\n }\n if (listener.live) listener.owner.eventRoot.onNodeRelease?.(listener);\n listener.live = false;\n clearPointerCapturesForTarget(listener);\n releaseNativeOwnership(listener);\n return;\n }\n\n if (!registrations) {\n registrations = new Set();\n listener.owner.eventRoot.listenersByComponent.set(\n listener.component.id,\n registrations,\n );\n }\n registrations.add(listener);\n listener.live = true;\n if (isLayoutComponentSuspended(listener.component) || isLayoutInstanceSuspended(listener.owner)) { listener.suspendLayout(); return; }\n updateNativeOwnership(listener);\n}\n\nexport function releaseListener(listener: PibblEventListenerRegistration): void {\n unregisterLayoutSuspensionResource(listener.component, listener);\n if (listener.live) {\n const registrations = listener.owner.eventRoot.listenersByComponent.get(\n listener.component.id,\n );\n registrations?.delete(listener);\n if (registrations?.size === 0) {\n listener.owner.eventRoot.listenersByComponent.delete(\n listener.component.id,\n );\n }\n listener.owner.eventRoot.onNodeRelease?.(listener);\n }\n listener.live = false;\n clearPointerCapturesForTarget(listener);\n releaseNativeOwnership(listener);\n}\n\nexport function normalizeHandlers(\n handlers: PibblEventHandlers,\n): PibblNormalizedHandlers {\n const state = createHandlerState();\n refreshHandlers(state, handlers, false);\n return state.handlers;\n}\n\ninterface PibblHandlerState {\n handlers: PibblNormalizedHandlers;\n handlerTypesLow: number;\n handlerTypesHigh: number;\n requiredNativeTypesLow: number;\n requiredNativeTypesHigh: number;\n}\n\ninterface PibblEventPropMetadata {\n readonly normalizedKey: PibblEventType | PibblNormalizedCaptureKey;\n readonly handlerTypesLow: number;\n readonly handlerTypesHigh: number;\n readonly requiredNativeTypesLow: number;\n readonly requiredNativeTypesHigh: number;\n}\n\n/**\n * Hot-path property lookup built once from the closed event vocabulary.\n *\n * Each definition owns one bit position. JavaScript bitwise operators use\n * signed 32-bit integers, but sign is irrelevant here: the words are opaque\n * bit sets compared and combined only with bitwise operations.\n */\nconst eventPropMetadata = Object.create(null) as Record<\n string,\n PibblEventPropMetadata | undefined\n>;\nconst eventIndexByType = Object.create(null) as Record<\n string,\n number | undefined\n>;\n\nif (PIBBL_EVENT_DEFINITIONS.length > 64) {\n throw new Error(\"Pibbl event masks support at most 64 logical event types.\");\n}\n\nfor (let index = 0; index < PIBBL_EVENT_DEFINITIONS.length; index++) {\n eventIndexByType[PIBBL_EVENT_DEFINITIONS[index]!.type] = index;\n}\n\nfor (let index = 0; index < PIBBL_EVENT_DEFINITIONS.length; index++) {\n const definition = PIBBL_EVENT_DEFINITIONS[index]!;\n const handlerTypesLow = index < 32 ? 1 << index : 0;\n const handlerTypesHigh = index < 32 ? 0 : 1 << (index - 32);\n // Expand logical-to-native prerequisites once. The render path only ORs\n // these precomputed words and never allocates dependency Sets.\n const nativeTypes = expandNativeTypesForMetadata(\n new Set([definition.type]),\n false,\n );\n let requiredNativeTypesLow = 0;\n let requiredNativeTypesHigh = 0;\n for (const type of nativeTypes) {\n const nativeIndex = eventIndexByType[type]!;\n if (nativeIndex < 32) {\n requiredNativeTypesLow |= 1 << nativeIndex;\n } else {\n requiredNativeTypesHigh |= 1 << (nativeIndex - 32);\n }\n }\n const bubble: PibblEventPropMetadata = Object.freeze({\n normalizedKey: definition.type,\n handlerTypesLow,\n handlerTypesHigh,\n requiredNativeTypesLow,\n requiredNativeTypesHigh,\n });\n const capture: PibblEventPropMetadata = Object.freeze({\n ...bubble,\n normalizedKey: `${definition.type}Capture` as PibblNormalizedCaptureKey,\n });\n eventPropMetadata[definition.prop] = bubble;\n eventPropMetadata[definition.captureProp] = capture;\n}\n\n// Cursor tracking has native movement/exit requirements even without a\n// logical callback, so it receives the same precomputed representation.\nconst cursorNativeTypes = expandNativeTypesForMetadata(new Set(), true);\nlet cursorNativeTypesLow = 0;\nlet cursorNativeTypesHigh = 0;\nfor (const type of cursorNativeTypes) {\n const index = eventIndexByType[type]!;\n if (index < 32) {\n cursorNativeTypesLow |= 1 << index;\n } else {\n cursorNativeTypesHigh |= 1 << (index - 32);\n }\n}\n\nfunction createHandlerState(): PibblHandlerState {\n return {\n handlers: {},\n handlerTypesLow: 0,\n handlerTypesHigh: 0,\n requiredNativeTypesLow: 0,\n requiredNativeTypesHigh: 0,\n };\n}\n\nfunction refreshHandlers(\n state: PibblHandlerState,\n handlers: PibblEventHandlers,\n hasCursor: boolean,\n): void {\n const normalized: PibblNormalizedHandlers = {};\n let handlerTypesLow = 0;\n let handlerTypesHigh = 0;\n let requiredNativeTypesLow = hasCursor ? cursorNativeTypesLow : 0;\n let requiredNativeTypesHigh = hasCursor ? cursorNativeTypesHigh : 0;\n // Iterate supplied props rather than probing every supported bubble and\n // capture name. Keep the normalized object fresh so dispatch always sees\n // the newest closures even when the type signature is unchanged.\n for (const prop in handlers) {\n const metadata = eventPropMetadata[prop];\n if (!metadata) continue;\n const handler = handlers[prop as keyof PibblEventHandlers];\n if (handler) {\n (normalized as Record<string, unknown>)[metadata.normalizedKey] = handler;\n handlerTypesLow |= metadata.handlerTypesLow;\n handlerTypesHigh |= metadata.handlerTypesHigh;\n requiredNativeTypesLow |= metadata.requiredNativeTypesLow;\n requiredNativeTypesHigh |= metadata.requiredNativeTypesHigh;\n }\n }\n state.handlers = normalized;\n state.handlerTypesLow = handlerTypesLow;\n state.handlerTypesHigh = handlerTypesHigh;\n state.requiredNativeTypesLow = requiredNativeTypesLow;\n state.requiredNativeTypesHigh = requiredNativeTypesHigh;\n}\n\n/**\n * Cold module-initialization helper. Do not call this from registration or\n * render code: its Sets deliberately trade startup simplicity for precomputed\n * allocation-free metadata in the hot path.\n */\nfunction expandNativeTypesForMetadata(\n types: ReadonlySet<PibblEventType>,\n hasCursor: boolean,\n): ReadonlySet<PibblEventType> {\n const nativeTypes = new Set(types);\n const hasPointerBoundary =\n types.has(\"pointerover\") ||\n types.has(\"pointerenter\") ||\n types.has(\"pointerout\") ||\n types.has(\"pointerleave\");\n if (hasPointerBoundary || types.has(\"pointermove\")) {\n nativeTypes.delete(\"pointerenter\");\n nativeTypes.delete(\"pointerleave\");\n nativeTypes.add(\"pointermove\");\n nativeTypes.add(\"pointerout\");\n if (hasPointerBoundary) nativeTypes.add(\"pointerover\");\n }\n if (\n hasCursor ||\n types.has(\"mouseover\") ||\n types.has(\"mouseenter\") ||\n types.has(\"mousemove\") ||\n types.has(\"mouseout\") ||\n types.has(\"mouseleave\")\n ) {\n nativeTypes.delete(\"mouseover\");\n nativeTypes.delete(\"mouseenter\");\n nativeTypes.delete(\"mouseleave\");\n nativeTypes.add(\"mousemove\");\n nativeTypes.add(\"mouseout\");\n }\n if (types.has(\"click\") || types.has(\"dblclick\") || types.has(\"auxclick\")) {\n nativeTypes.add(\"mousedown\");\n nativeTypes.add(\"mouseup\");\n }\n if (types.has(\"dblclick\")) nativeTypes.add(\"click\");\n if (\n types.has(\"touchstart\") ||\n types.has(\"touchmove\") ||\n types.has(\"touchend\") ||\n types.has(\"touchcancel\")\n ) {\n nativeTypes.add(\"touchstart\");\n nativeTypes.add(\"touchend\");\n nativeTypes.add(\"touchcancel\");\n }\n const hasDragBoundary = types.has(\"dragenter\") || types.has(\"dragleave\");\n if (hasDragBoundary) nativeTypes.add(\"dragenter\");\n if (hasDragBoundary || types.has(\"dragover\")) {\n nativeTypes.add(\"dragover\");\n nativeTypes.add(\"dragleave\");\n nativeTypes.add(\"drop\");\n nativeTypes.add(\"dragend\");\n }\n return nativeTypes;\n}\n\nfunction updateNativeOwnership(\n registration: PibblEventTargetRegistration | PibblEventListenerRegistration,\n): void {\n const previousLow = registration.ownedNativeTypesLow;\n const previousHigh = registration.ownedNativeTypesHigh;\n const nextLow = registration.requiredNativeTypesLow;\n const nextHigh = registration.requiredNativeTypesHigh;\n // Callback values may change every render while their native requirements\n // remain identical. Two integer comparisons make that common case a no-op.\n if (previousLow === nextLow && previousHigh === nextHigh) return;\n\n let releases = nativeReleases.get(registration);\n if (!releases) {\n releases = new Map();\n nativeReleases.set(registration, releases);\n }\n\n // A & ~B is the set difference A \u2212 B. Release all removals before\n // acquiring additions so hub reference counts always describe this target's\n // current requirement transition.\n forEachChangedType(\n previousLow & ~nextLow,\n previousHigh & ~nextHigh,\n (type) => {\n releases.get(type)?.();\n releases.delete(type);\n },\n );\n\n const hub = registration.owner.eventRoot.nativeListeners;\n if (hub) {\n // B & ~A is B \u2212 A: only newly required native types are acquired.\n forEachChangedType(\n nextLow & ~previousLow,\n nextHigh & ~previousHigh,\n (type) => {\n if (!releases.has(type)) releases.set(type, hub.acquire(type));\n },\n );\n }\n registration.ownedNativeTypesLow = nextLow;\n registration.ownedNativeTypesHigh = nextHigh;\n}\n\nfunction releaseNativeOwnership(\n registration: PibblEventTargetRegistration | PibblEventListenerRegistration,\n): void {\n // Zero first so a stable hook slot revived after release cannot mistake its\n // old signature for live ownership and skip reacquisition.\n registration.ownedNativeTypesLow = 0;\n registration.ownedNativeTypesHigh = 0;\n const releases = nativeReleases.get(registration);\n if (!releases) return;\n nativeReleases.delete(registration);\n const errors: unknown[] = [];\n for (const release of releases.values()) {\n try { release(); } catch (error) { errors.push(error); }\n }\n releases.clear();\n if (errors.length === 1) throw errors[0];\n if (errors.length) throw new AggregateError(errors, 'Native listener release failed.');\n}\n\nfunction forEachChangedType(\n low: number,\n high: number,\n visit: (type: PibblEventType) => void,\n): void {\n // `word & -word` isolates the least-significant set bit. `word & (word - 1)`\n // clears it, so this loop is O(number of changed types), not O(52 events).\n // Math.clz32 converts the isolated bit to its definition index; the high\n // word starts at definition 32.\n while (low !== 0) {\n const bit = low & -low;\n visit(PIBBL_EVENT_DEFINITIONS[31 - Math.clz32(bit)]!.type);\n low &= low - 1;\n }\n while (high !== 0) {\n const bit = high & -high;\n visit(PIBBL_EVENT_DEFINITIONS[32 + 31 - Math.clz32(bit)]!.type);\n high &= high - 1;\n }\n}\n\nfunction createPublicTarget(\n getRegistration: () => PibblEventNode,\n): PibblEventTarget {\n return {\n setPointerCapture(pointerId) {\n setLogicalPointerCapture(getRegistration(), pointerId);\n },\n hasPointerCapture(pointerId) {\n return hasLogicalPointerCapture(getRegistration(), pointerId);\n },\n releasePointerCapture(pointerId) {\n releaseLogicalPointerCapture(getRegistration(), pointerId);\n },\n };\n}\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,mCAAmC;AAC5C,SAAS,kCAAkC,oCAAoC,4BAA4B,iCAAiC;AAG5I,SAAS,+BAA+B;AAQxC,SAAS,oBAAoB;AAC7B,SAAS,mBAAmB;AAG5B,SAAS,gCAAgC;AAKzC,SAAS,2BAAqD;AAC9D;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAuHP,MAAM,iBAAiB,oBAAI,QAGzB;AAEK,SAAS,aACd,OACA,WACA,MAC8B;AAC9B,QAAM,SAAS,CAAC;AAChB,QAAM,eAAe,mBAAmB,MAAM,MAAM;AACpD,SAAO,OAAO,QAAQ;AAAA,IACpB,MAAM;AAAA,IACN,eAAe;AAAA,IACf;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,YAAY;AAAA,IACZ,UAAU,CAAC;AAAA,IACX,iBAAiB;AAAA,IACjB,kBAAkB;AAAA,IAClB,wBAAwB;AAAA,IACxB,yBAAyB;AAAA,IACzB,qBAAqB;AAAA,IACrB,sBAAsB;AAAA,IACtB,QAAQ;AAAA,IACR,mBAAmB;AAAA,IACnB,0BAA0B;AAAA,IAC1B,0BAA0B;AAAA,IAC1B,MAAM;AAAA,EACR,CAAC;AACD,m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KN,SAAO,QAAQ,GAAG;AAChB,UAAM,MAAM,MAAM,CAAC;AACnB,UAAM,wBAAwB,KAAK,KAAK,MAAM,GAAG,CAAC,EAAG,IAAI;AACzD,WAAO,MAAM;AAAA,EACf;AACA,SAAO,SAAS,GAAG;AACjB,UAAM,MAAM,OAAO,CAAC;AACpB,UAAM,wBAAwB,KAAK,KAAK,KAAK,MAAM,GAAG,CAAC,EAAG,IAAI;AAC9D,YAAQ,OAAO;AAAA,EACjB;AACF;AAEA,SAAS,mBACP,iBACkB;AAClB,SAAO;AAAA,IACL,kBAAkB,WAAW;AAC3B,+BAAyB,gBAAgB,GAAG,SAAS;AAAA,IACvD;AAAA,IACA,kBAAkB,WAAW;AAC3B,aAAO,yBAAyB,gBAAgB,GAAG,SAAS;AAAA,IAC9D;AAAA,IACA,sBAAsB,WAAW;AAC/B,mCAA6B,gBAAgB,GAAG,SAAS;AAAA,IAC3D;AAAA,EACF;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { beginLayoutGeometry } from "./layout/geometry-publication.js";
|
|
1
2
|
import { RootRenderTransaction } from "./render-transaction.js";
|
|
2
3
|
import {
|
|
3
4
|
clearTempState,
|
|
@@ -64,6 +65,14 @@ function executeRender(canvas, renderTimestamp, updatedRoot, _updateParents = fa
|
|
|
64
65
|
GLOBAL_STATE.currentPibblInstance = pibblInstance;
|
|
65
66
|
for (const service of pibblInstance.optionalServices.values()) service.beginRender?.();
|
|
66
67
|
GLOBAL_STATE.renderTransaction = renderTransaction;
|
|
68
|
+
beginLayoutGeometry(pibblInstance, renderTransaction);
|
|
69
|
+
const releaseFailedGeneration = (success) => {
|
|
70
|
+
if (success || renderTransaction.failed === false) return;
|
|
71
|
+
for (const refs of pibblInstance.refs.values()) refs.teardowns.execute();
|
|
72
|
+
pibblInstance.refs.clear();
|
|
73
|
+
};
|
|
74
|
+
if (renderTransaction.onAfterFinish) renderTransaction.onAfterFinish(releaseFailedGeneration);
|
|
75
|
+
else renderTransaction.onFinish(releaseFailedGeneration);
|
|
67
76
|
GLOBAL_STATE.currentPibblInstance.renderTimestamp = activeFrameSnapshot.logicalTime;
|
|
68
77
|
GLOBAL_STATE.canvas = canvas;
|
|
69
78
|
const rootNode = arguments.length >= 3 && updatedRoot !== NO_PENDING_ROOT ? updatedRoot : GLOBAL_STATE.currentPibblInstance.root;
|
|
@@ -111,9 +120,23 @@ function executeRender(canvas, renderTimestamp, updatedRoot, _updateParents = fa
|
|
|
111
120
|
}
|
|
112
121
|
GLOBAL_STATE.layoutStack = [{
|
|
113
122
|
allocation: pibblInstance.rootLayoutBox,
|
|
114
|
-
percentageBasis: pibblInstance.rootLayoutBox
|
|
123
|
+
percentageBasis: pibblInstance.rootLayoutBox,
|
|
124
|
+
layoutDirection: pibblInstance.rootLayoutDirection
|
|
115
125
|
}];
|
|
116
126
|
const renderGeneration = ++pibblInstance.renderGeneration;
|
|
127
|
+
if (!pibblInstance.parent) {
|
|
128
|
+
renderTransaction.onFinish((success) => {
|
|
129
|
+
if (success) pibblInstance.committedRenderGeneration = renderGeneration;
|
|
130
|
+
});
|
|
131
|
+
if (pibblInstance.rootFrameObservers?.size) {
|
|
132
|
+
renderTransaction.onAfterFinish?.((success) => {
|
|
133
|
+
const observers = pibblInstance.rootFrameObservers;
|
|
134
|
+
if (!observers) return;
|
|
135
|
+
for (const observer of observers)
|
|
136
|
+
observer(success, renderGeneration);
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
}
|
|
117
140
|
renderSeenIds = pibblInstance.renderSeenIds;
|
|
118
141
|
renderSeenKeys = pibblInstance.renderSeenKeys;
|
|
119
142
|
renderSeenIds.clear();
|
|
@@ -136,6 +159,7 @@ function executeRender(canvas, renderTimestamp, updatedRoot, _updateParents = fa
|
|
|
136
159
|
driver.finishFrame(frame, true);
|
|
137
160
|
finishTransaction(true);
|
|
138
161
|
} catch (error) {
|
|
162
|
+
renderTransaction.fail?.();
|
|
139
163
|
for (const service of pibblInstance.optionalServices.values()) service.endRender?.(false);
|
|
140
164
|
finishTransaction(false);
|
|
141
165
|
for (const refs of pibblInstance.refs.values()) {
|