@pibbl/core 0.0.1 → 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/README.md +1 -1
- package/THIRD_PARTY_NOTICES.txt +81 -0
- package/dist/features/machines/animation.d.ts +64 -0
- package/dist/features/machines/animation.js +55 -0
- package/dist/features/machines/animation.js.map +7 -0
- package/dist/features/machines/animation.mjs +1 -0
- package/dist/features/machines/assign.d.ts +16 -0
- package/dist/features/machines/assign.js +15 -0
- package/dist/features/machines/assign.js.map +7 -0
- package/dist/features/machines/callback.d.ts +9 -0
- package/dist/features/machines/callback.js +7 -0
- package/dist/features/machines/callback.js.map +7 -0
- package/dist/features/machines/hook.d.ts +30 -0
- package/dist/features/machines/hook.js +37 -0
- package/dist/features/machines/hook.js.map +7 -0
- package/dist/features/machines/index.d.ts +6 -0
- package/dist/features/machines/index.js +12 -0
- package/dist/features/machines/index.js.map +7 -0
- package/dist/features/machines/index.mjs +1 -0
- package/dist/features/machines/runtime.d.ts +18 -0
- package/dist/features/machines/runtime.js +363 -0
- package/dist/features/machines/runtime.js.map +7 -0
- package/dist/features/machines/types.d.ts +164 -0
- package/dist/features/physics/2d-geometry.d.ts +3 -3
- package/dist/features/physics/2d-geometry.js.map +1 -1
- package/dist/features/physics/2d-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/2d.d.ts +115 -62
- package/dist/features/physics/2d.js +59 -28
- package/dist/features/physics/2d.js.map +2 -2
- package/dist/features/physics/lib/2d/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/query-types.d.ts +6 -0
- package/dist/features/physics/lib/2d/runtime/controller.d.ts +7 -6
- package/dist/features/physics/lib/2d/runtime/controller.js +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/types.d.ts +8 -30
- package/dist/features/physics/lib/2d/world/queries.d.ts +7 -6
- package/dist/features/physics/lib/2d/world/queries.js.map +2 -2
- package/dist/features/physics/lib/2d/world/rapier.js +22 -26
- package/dist/features/physics/lib/2d/world/rapier.js.map +2 -2
- package/dist/features/sprites/formats/aseprite.d.ts +5 -0
- package/dist/features/sprites/formats/texture-packer.d.ts +5 -0
- package/dist/features/sprites/index.d.ts +6 -0
- package/dist/features/sprites/loader.d.ts +25 -0
- package/dist/features/sprites/loader.js +6 -3
- package/dist/features/sprites/loader.js.map +2 -2
- package/dist/features/sprites/model.d.ts +75 -0
- package/dist/features/sprites/sprite.d.ts +22 -0
- package/dist/features/textures/index.d.ts +12 -2
- package/dist/features/textures/index.js +33 -1
- package/dist/features/textures/index.js.map +2 -2
- package/dist/features/textures/lib/chemical-field.d.ts +56 -0
- package/dist/features/textures/lib/chemical-field.js +154 -0
- package/dist/features/textures/lib/chemical-field.js.map +7 -0
- package/dist/features/textures/lib/chemical-recipes.d.ts +119 -0
- package/dist/features/textures/lib/chemical-recipes.js +275 -0
- package/dist/features/textures/lib/chemical-recipes.js.map +7 -0
- package/dist/features/textures/lib/definitions.d.ts +3 -18
- package/dist/features/textures/lib/definitions.js +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 +92 -5
- package/dist/features/viz/index.js +202 -4
- package/dist/features/viz/index.js.map +2 -2
- package/dist/features/viz/inspection/bar.d.ts +79 -0
- package/dist/features/viz/inspection/bar.js +49 -0
- package/dist/features/viz/inspection/bar.js.map +7 -0
- package/dist/features/viz/inspection/candle.d.ts +156 -0
- package/dist/features/viz/inspection/candle.js +120 -0
- package/dist/features/viz/inspection/candle.js.map +7 -0
- package/dist/features/viz/inspection/capture-types.d.ts +65 -0
- package/dist/features/viz/inspection/capture.d.ts +16 -0
- package/dist/features/viz/inspection/capture.js +49 -0
- package/dist/features/viz/inspection/capture.js.map +7 -0
- package/dist/features/viz/inspection/handler.d.ts +36 -0
- package/dist/features/viz/inspection/handler.js +91 -0
- package/dist/features/viz/inspection/handler.js.map +7 -0
- package/dist/features/viz/inspection/ohlc-bar.d.ts +132 -0
- package/dist/features/viz/inspection/ohlc-bar.js +118 -0
- package/dist/features/viz/inspection/ohlc-bar.js.map +7 -0
- package/dist/features/viz/inspection/owned-ref.d.ts +16 -0
- package/dist/features/viz/inspection/owned-ref.js +99 -0
- package/dist/features/viz/inspection/owned-ref.js.map +7 -0
- package/dist/features/viz/inspection/painted-point.d.ts +22 -0
- package/dist/features/viz/inspection/painted-point.js +29 -0
- package/dist/features/viz/inspection/painted-point.js.map +7 -0
- package/dist/features/viz/inspection/queries.d.ts +100 -0
- package/dist/features/viz/inspection/queries.js +192 -0
- package/dist/features/viz/inspection/queries.js.map +7 -0
- package/dist/features/viz/inspection/query-types.d.ts +177 -0
- package/dist/features/viz/inspection/volume.d.ts +104 -0
- package/dist/features/viz/inspection/volume.js +95 -0
- package/dist/features/viz/inspection/volume.js.map +7 -0
- package/dist/features/viz/inspection.d.ts +19 -0
- package/dist/features/viz/inspection.js +54 -0
- package/dist/features/viz/inspection.js.map +7 -0
- package/dist/features/viz/inspection.mjs +1 -0
- package/dist/features/viz/lib/area-series.d.ts +62 -0
- package/dist/features/viz/lib/area-series.js +120 -0
- package/dist/features/viz/lib/area-series.js.map +7 -0
- package/dist/features/viz/lib/axis-labels.d.ts +2 -0
- package/dist/features/viz/lib/axis-labels.js +41 -0
- package/dist/features/viz/lib/axis-labels.js.map +7 -0
- package/dist/features/viz/lib/axis-title.d.ts +23 -0
- package/dist/features/viz/lib/axis-title.js +24 -0
- package/dist/features/viz/lib/axis-title.js.map +7 -0
- package/dist/features/viz/lib/axis.d.ts +1 -1
- package/dist/features/viz/lib/axis.js +50 -50
- package/dist/features/viz/lib/axis.js.map +2 -2
- package/dist/features/viz/lib/bar-scale.d.ts +7 -0
- package/dist/features/viz/lib/bar-scale.js +34 -0
- package/dist/features/viz/lib/bar-scale.js.map +7 -0
- package/dist/features/viz/lib/bar-series.d.ts +3 -1
- package/dist/features/viz/lib/bar-series.js +21 -5
- package/dist/features/viz/lib/bar-series.js.map +2 -2
- package/dist/features/viz/lib/baseline-series.d.ts +55 -0
- package/dist/features/viz/lib/baseline-series.js +136 -0
- package/dist/features/viz/lib/baseline-series.js.map +7 -0
- package/dist/features/viz/lib/candlestick-series.d.ts +62 -0
- package/dist/features/viz/lib/candlestick-series.js +150 -0
- package/dist/features/viz/lib/candlestick-series.js.map +7 -0
- package/dist/features/viz/lib/censored-point-series.d.ts +71 -0
- package/dist/features/viz/lib/censored-point-series.js +129 -0
- package/dist/features/viz/lib/censored-point-series.js.map +7 -0
- package/dist/features/viz/lib/chart-lines.d.ts +41 -0
- package/dist/features/viz/lib/chart-lines.js +32 -0
- package/dist/features/viz/lib/chart-lines.js.map +7 -0
- package/dist/features/viz/lib/color-context.d.ts +4 -0
- package/dist/features/viz/lib/color-context.js +41 -0
- package/dist/features/viz/lib/color-context.js.map +7 -0
- package/dist/features/viz/lib/color-math.d.ts +4 -0
- package/dist/features/viz/lib/color-math.js +31 -0
- package/dist/features/viz/lib/color-math.js.map +7 -0
- package/dist/features/viz/lib/color-types.d.ts +53 -0
- package/dist/features/viz/lib/curve-definition.d.ts +49 -0
- package/dist/features/viz/lib/curve-definition.js +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 +6 -3
- package/dist/features/viz/lib/hover-data.js.map +2 -2
- package/dist/features/viz/lib/hover-types.d.ts +5 -5
- package/dist/features/viz/lib/interval-band-series.d.ts +49 -0
- package/dist/features/viz/lib/interval-band-series.js +136 -0
- package/dist/features/viz/lib/interval-band-series.js.map +7 -0
- package/dist/features/viz/lib/interval-diamond-series.d.ts +43 -0
- package/dist/features/viz/lib/interval-diamond-series.js +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-component.d.ts +7 -0
- package/dist/features/viz/lib/linear-scale-component.js +18 -0
- package/dist/features/viz/lib/linear-scale-component.js.map +7 -0
- package/dist/features/viz/lib/linear-scale.js +1 -1
- package/dist/features/viz/lib/linear-scale.js.map +2 -2
- package/dist/features/viz/lib/log-scale-component.d.ts +7 -0
- package/dist/features/viz/lib/log-scale-component.js +19 -0
- package/dist/features/viz/lib/log-scale-component.js.map +7 -0
- package/dist/features/viz/lib/log-scale.d.ts +2 -0
- package/dist/features/viz/lib/log-scale.js +53 -0
- package/dist/features/viz/lib/log-scale.js.map +7 -0
- package/dist/features/viz/lib/monotone-curve.d.ts +11 -0
- package/dist/features/viz/lib/monotone-curve.js +63 -0
- package/dist/features/viz/lib/monotone-curve.js.map +7 -0
- package/dist/features/viz/lib/nearest.d.ts +9 -9
- package/dist/features/viz/lib/nearest.js.map +1 -1
- package/dist/features/viz/lib/numeric-range-interpolation.d.ts +15 -0
- package/dist/features/viz/lib/numeric-range-interpolation.js +36 -0
- package/dist/features/viz/lib/numeric-range-interpolation.js.map +7 -0
- package/dist/features/viz/lib/numeric-ticks.d.ts +38 -0
- package/dist/features/viz/lib/numeric-ticks.js +54 -0
- package/dist/features/viz/lib/numeric-ticks.js.map +7 -0
- package/dist/features/viz/lib/ohlc-bar-series.d.ts +55 -0
- package/dist/features/viz/lib/ohlc-bar-series.js +168 -0
- package/dist/features/viz/lib/ohlc-bar-series.js.map +7 -0
- package/dist/features/viz/lib/paired-series.d.ts +44 -0
- package/dist/features/viz/lib/paired-series.js +93 -0
- package/dist/features/viz/lib/paired-series.js.map +7 -0
- package/dist/features/viz/lib/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-scale-component.d.ts +7 -0
- package/dist/features/viz/lib/point-scale-component.js +19 -0
- package/dist/features/viz/lib/point-scale-component.js.map +7 -0
- package/dist/features/viz/lib/point-scale.d.ts +2 -0
- package/dist/features/viz/lib/point-scale.js +45 -0
- package/dist/features/viz/lib/point-scale.js.map +7 -0
- package/dist/features/viz/lib/point-series.d.ts +1 -1
- package/dist/features/viz/lib/point-series.js +36 -9
- package/dist/features/viz/lib/point-series.js.map +2 -2
- package/dist/features/viz/lib/point-types.d.ts +5 -2
- package/dist/features/viz/lib/reference-band.d.ts +16 -0
- package/dist/features/viz/lib/reference-band.js +30 -0
- package/dist/features/viz/lib/reference-band.js.map +7 -0
- package/dist/features/viz/lib/scale-adjust.js +9 -4
- package/dist/features/viz/lib/scale-adjust.js.map +2 -2
- package/dist/features/viz/lib/scale-context.d.ts +5 -4
- package/dist/features/viz/lib/scale-context.js +15 -11
- package/dist/features/viz/lib/scale-context.js.map +2 -2
- package/dist/features/viz/lib/scale-provider.d.ts +2 -0
- package/dist/features/viz/lib/scale-provider.js +13 -0
- package/dist/features/viz/lib/scale-provider.js.map +7 -0
- package/dist/features/viz/lib/scale-ticks.d.ts +5 -0
- package/dist/features/viz/lib/scale-ticks.js +64 -0
- package/dist/features/viz/lib/scale-ticks.js.map +7 -0
- package/dist/features/viz/lib/scale-view.d.ts +4 -0
- package/dist/features/viz/lib/scale-view.js +21 -0
- package/dist/features/viz/lib/scale-view.js.map +7 -0
- package/dist/features/viz/lib/sequential-color-scale.d.ts +11 -0
- package/dist/features/viz/lib/sequential-color-scale.js +49 -0
- package/dist/features/viz/lib/sequential-color-scale.js.map +7 -0
- package/dist/features/viz/lib/series-position.d.ts +12 -0
- package/dist/features/viz/lib/series-position.js +44 -0
- package/dist/features/viz/lib/series-position.js.map +7 -0
- package/dist/features/viz/lib/step-curves.d.ts +19 -0
- package/dist/features/viz/lib/step-curves.js +53 -0
- package/dist/features/viz/lib/step-curves.js.map +7 -0
- package/dist/features/viz/lib/symlog-scale-component.d.ts +7 -0
- package/dist/features/viz/lib/symlog-scale-component.js +19 -0
- package/dist/features/viz/lib/symlog-scale-component.js.map +7 -0
- package/dist/features/viz/lib/symlog-scale.d.ts +2 -0
- package/dist/features/viz/lib/symlog-scale.js +38 -0
- package/dist/features/viz/lib/symlog-scale.js.map +7 -0
- package/dist/features/viz/lib/threshold-color-scale.d.ts +43 -0
- package/dist/features/viz/lib/threshold-color-scale.js +59 -0
- package/dist/features/viz/lib/threshold-color-scale.js.map +7 -0
- package/dist/features/viz/lib/trading-time-mapping.d.ts +32 -0
- package/dist/features/viz/lib/trading-time-mapping.js +89 -0
- package/dist/features/viz/lib/trading-time-mapping.js.map +7 -0
- package/dist/features/viz/lib/trading-time-scale.d.ts +83 -0
- package/dist/features/viz/lib/trading-time-scale.js +96 -0
- package/dist/features/viz/lib/trading-time-scale.js.map +7 -0
- package/dist/features/viz/lib/trajectory-series.d.ts +71 -0
- package/dist/features/viz/lib/trajectory-series.js +111 -0
- package/dist/features/viz/lib/trajectory-series.js.map +7 -0
- package/dist/features/viz/lib/types.d.ts +114 -21
- package/dist/features/viz/lib/use-bar-scale.d.ts +8 -0
- package/dist/features/viz/lib/use-bar-scale.js +9 -0
- package/dist/features/viz/lib/use-bar-scale.js.map +7 -0
- package/dist/features/viz/lib/use-continuous-scale.d.ts +8 -0
- package/dist/features/viz/lib/use-continuous-scale.js +14 -0
- package/dist/features/viz/lib/use-continuous-scale.js.map +7 -0
- package/dist/features/viz/lib/use-linear-scale.d.ts +8 -0
- package/dist/features/viz/lib/use-linear-scale.js +9 -0
- package/dist/features/viz/lib/use-linear-scale.js.map +7 -0
- package/dist/features/viz/lib/use-log-scale.d.ts +8 -0
- package/dist/features/viz/lib/use-log-scale.js +9 -0
- package/dist/features/viz/lib/use-log-scale.js.map +7 -0
- package/dist/features/viz/lib/use-point-scale.d.ts +8 -0
- package/dist/features/viz/lib/use-point-scale.js +9 -0
- package/dist/features/viz/lib/use-point-scale.js.map +7 -0
- package/dist/features/viz/lib/use-symlog-scale.d.ts +8 -0
- package/dist/features/viz/lib/use-symlog-scale.js +9 -0
- package/dist/features/viz/lib/use-symlog-scale.js.map +7 -0
- package/dist/features/viz/lib/use-utc-scale.d.ts +8 -0
- package/dist/features/viz/lib/use-utc-scale.js +9 -0
- package/dist/features/viz/lib/use-utc-scale.js.map +7 -0
- package/dist/features/viz/lib/utc-labels.d.ts +12 -0
- package/dist/features/viz/lib/utc-labels.js +27 -0
- package/dist/features/viz/lib/utc-labels.js.map +7 -0
- package/dist/features/viz/lib/utc-scale-component.d.ts +7 -0
- package/dist/features/viz/lib/utc-scale-component.js +18 -0
- package/dist/features/viz/lib/utc-scale-component.js.map +7 -0
- package/dist/features/viz/lib/utc-scale.d.ts +21 -0
- package/dist/features/viz/lib/utc-scale.js +124 -0
- package/dist/features/viz/lib/utc-scale.js.map +7 -0
- package/dist/features/viz/lib/volume-series.d.ts +59 -0
- package/dist/features/viz/lib/volume-series.js +117 -0
- package/dist/features/viz/lib/volume-series.js.map +7 -0
- package/dist/features/viz/lib/weighted-point-series.d.ts +71 -0
- package/dist/features/viz/lib/weighted-point-series.js +169 -0
- package/dist/features/viz/lib/weighted-point-series.js.map +7 -0
- package/dist/filters/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 +10 -6
- 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/animation/definition.d.ts +5 -3
- package/dist/lib/animation/definition.js +29 -4
- package/dist/lib/animation/definition.js.map +2 -2
- package/dist/lib/animation/playback.d.ts +8 -0
- package/dist/lib/animation/playback.js +33 -11
- package/dist/lib/animation/playback.js.map +2 -2
- package/dist/lib/animation/spring.d.ts +3 -1
- package/dist/lib/animation/spring.js.map +2 -2
- package/dist/lib/animation/types.d.ts +29 -73
- package/dist/lib/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/hooks/use-animated-value.d.ts +11 -21
- package/dist/lib/hooks/use-animated-value.js +23 -70
- package/dist/lib/hooks/use-animated-value.js.map +3 -3
- package/dist/lib/hooks/use-playback.js +1 -0
- package/dist/lib/hooks/use-playback.js.map +2 -2
- package/dist/lib/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 +43 -6
- package/dist/features/viz/lib/scale.d.ts +0 -11
- package/dist/features/viz/lib/scale.js +0 -80
- package/dist/features/viz/lib/scale.js.map +0 -7
- package/dist/features/viz/lib/use-scale.d.ts +0 -20
- package/dist/features/viz/lib/use-scale.js +0 -10
- package/dist/features/viz/lib/use-scale.js.map +0 -7
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { HtmlNativeEvents } from "./html-events.js";
|
|
2
|
+
import { stageLayoutHtmlGeometry } from "../layout/geometry-publication.js";
|
|
3
|
+
import { isLayoutComponentSuspended, isLayoutInstanceSuspended } from "../layout/participation.js";
|
|
1
4
|
import { GLOBAL_STATE } from "../global-state.js";
|
|
2
5
|
import { withSignalWriteForbidden } from "../signals/graph.js";
|
|
3
6
|
import { validateHtmlOverlay } from "./overlay-config.js";
|
|
@@ -21,6 +24,9 @@ class HtmlService {
|
|
|
21
24
|
svg;
|
|
22
25
|
viewport;
|
|
23
26
|
disposed = false;
|
|
27
|
+
suspended = false;
|
|
28
|
+
projections;
|
|
29
|
+
nextSnapshots;
|
|
24
30
|
rendered = /* @__PURE__ */ new Set();
|
|
25
31
|
enterTransaction() {
|
|
26
32
|
const transaction = this.root.renderTransaction;
|
|
@@ -29,12 +35,17 @@ class HtmlService {
|
|
|
29
35
|
this.transaction = transaction;
|
|
30
36
|
this.pending = new Map(this.snapshots);
|
|
31
37
|
this.rendered = /* @__PURE__ */ new Set();
|
|
38
|
+
this.suspended = false;
|
|
39
|
+
transaction.onPreflight(() => this.prepare());
|
|
32
40
|
transaction.onPublish(() => this.publish());
|
|
41
|
+
transaction.onAdopt(() => this.adopt());
|
|
33
42
|
transaction.onFinish((success) => {
|
|
34
|
-
if (!success) this.reset();
|
|
43
|
+
if (!success && transaction.failed !== false) this.reset();
|
|
35
44
|
this.pending = void 0;
|
|
36
45
|
this.transaction = void 0;
|
|
37
46
|
this.rendered.clear();
|
|
47
|
+
this.projections = void 0;
|
|
48
|
+
this.nextSnapshots = void 0;
|
|
38
49
|
});
|
|
39
50
|
}
|
|
40
51
|
beginRender(instance) {
|
|
@@ -44,14 +55,7 @@ class HtmlService {
|
|
|
44
55
|
suspend(instance) {
|
|
45
56
|
if (instance !== this.root.rootInstance) return;
|
|
46
57
|
this.enterTransaction();
|
|
47
|
-
this.
|
|
48
|
-
this.root.focusPolicy?.suspendHtmlRegions?.();
|
|
49
|
-
if (this.viewport) this.viewport.hidden = true;
|
|
50
|
-
for (const slot of this.live) {
|
|
51
|
-
slot.region.active = false;
|
|
52
|
-
if (slot.shell) slot.shell.inert = true;
|
|
53
|
-
}
|
|
54
|
-
});
|
|
58
|
+
this.suspended = true;
|
|
55
59
|
}
|
|
56
60
|
register(registration) {
|
|
57
61
|
assertEffects();
|
|
@@ -94,6 +98,7 @@ class HtmlService {
|
|
|
94
98
|
retire(slot) {
|
|
95
99
|
if (slot.disposed) return;
|
|
96
100
|
slot.disposed = true;
|
|
101
|
+
slot.events?.dispose();
|
|
97
102
|
slot.region.active = false;
|
|
98
103
|
this.root.focusPolicy?.removeHtmlFocusRegion?.(slot.region);
|
|
99
104
|
try {
|
|
@@ -107,19 +112,18 @@ class HtmlService {
|
|
|
107
112
|
this.live.delete(slot);
|
|
108
113
|
}
|
|
109
114
|
}
|
|
110
|
-
|
|
115
|
+
prepare() {
|
|
111
116
|
if (this.disposed || !this.pending) return;
|
|
112
117
|
const canvas = this.root.canvas;
|
|
113
118
|
const overlay = this.root.htmlOverlay;
|
|
114
119
|
validateHtmlOverlay(canvas, overlay);
|
|
115
120
|
const rootInstance = this.root.rootInstance;
|
|
116
121
|
if (rootInstance.surface.kind === "root" && (!rootInstance.surface.display.width || !rootInstance.surface.display.height)) {
|
|
117
|
-
this.
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
slot.region.
|
|
121
|
-
|
|
122
|
-
}
|
|
122
|
+
this.suspended = true;
|
|
123
|
+
for (const slot of this.live) stageLayoutHtmlGeometry(this.transaction, slot.region, {
|
|
124
|
+
active: false,
|
|
125
|
+
bounds: slot.region.rootBounds ?? { x: 0, y: 0, width: 0, height: 0 }
|
|
126
|
+
});
|
|
123
127
|
return;
|
|
124
128
|
}
|
|
125
129
|
const surface = rootInstance.surface.snapshot;
|
|
@@ -138,18 +142,84 @@ class HtmlService {
|
|
|
138
142
|
walk(entry.child, childWorld, inherited.concat({ data: rectangleSvg(entry.bounds), matrix: childWorld, rule: "nonzero" }), opacity * entry.opacity);
|
|
139
143
|
} else if (!entry.slot.disposed) {
|
|
140
144
|
const hostWorld = world.multiply(entry.matrix);
|
|
141
|
-
if (!
|
|
142
|
-
|
|
145
|
+
if (!(Number.isFinite(hostWorld.a) && Number.isFinite(hostWorld.b) && Number.isFinite(hostWorld.c) && Number.isFinite(hostWorld.d) && Number.isFinite(hostWorld.e) && Number.isFinite(hostWorld.f)))
|
|
146
|
+
throw new Error("HtmlBox transform must be finite.");
|
|
147
|
+
projections.push(prepareProjection(entry, hostWorld, rootMatrix, inherited, opacity * entry.opacity));
|
|
143
148
|
}
|
|
144
149
|
}
|
|
145
150
|
};
|
|
146
151
|
walk(rootInstance, new DOMMatrix(), [], 1);
|
|
152
|
+
for (const projection of projections) {
|
|
153
|
+
projection.transformCss = cssMatrix(projection.matrix);
|
|
154
|
+
const slot = projection.registration.slot;
|
|
155
|
+
slot.events ??= new HtmlNativeEvents(slot, () => this.svg, (target) => {
|
|
156
|
+
const doc = this.root.canvas.ownerDocument;
|
|
157
|
+
if (!(target instanceof doc.defaultView.Node)) return null;
|
|
158
|
+
for (const candidate of this.live) {
|
|
159
|
+
if (candidate.events?.node.live && candidate.shell?.contains(target)) return candidate.events.node;
|
|
160
|
+
}
|
|
161
|
+
return null;
|
|
162
|
+
});
|
|
163
|
+
projection.events = slot.events.prepare(
|
|
164
|
+
projection.registration.handlers,
|
|
165
|
+
projection.world,
|
|
166
|
+
projection.rootMatrix,
|
|
167
|
+
projection.visible && projection.registration.interactive
|
|
168
|
+
);
|
|
169
|
+
stageLayoutHtmlGeometry(this.transaction, projection.registration.slot.region, {
|
|
170
|
+
bounds: projection.bounds,
|
|
171
|
+
active: projection.visible && projection.registration.interactive
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
this.projections = projections;
|
|
175
|
+
this.nextSnapshots = new Map([...this.pending].filter(([owner]) => visited.has(owner)));
|
|
176
|
+
}
|
|
177
|
+
publish() {
|
|
178
|
+
if (this.suspended) {
|
|
179
|
+
this.root.focusPolicy?.suspendHtmlRegions?.();
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
182
|
+
const projections = this.projections;
|
|
183
|
+
if (!projections || this.disposed) return;
|
|
147
184
|
const desired = new Set(projections.map((p) => p.registration.slot));
|
|
148
|
-
for (const slot of this.live) if (!desired.has(slot))
|
|
185
|
+
for (const slot of this.live) if (!desired.has(slot)) {
|
|
186
|
+
if (!slot.owner.mainTeardowns.closed && (isLayoutComponentSuspended(slot.component) || isLayoutInstanceSuspended(slot.owner))) {
|
|
187
|
+
slot.region.active = false;
|
|
188
|
+
slot.events?.suspend();
|
|
189
|
+
this.root.focusPolicy?.removeHtmlFocusRegion?.(slot.region);
|
|
190
|
+
if (slot.shell) {
|
|
191
|
+
slot.shell.inert = true;
|
|
192
|
+
slot.shell.style.visibility = "hidden";
|
|
193
|
+
}
|
|
194
|
+
} else this.retire(slot);
|
|
195
|
+
}
|
|
149
196
|
if (projections.length) this.ensureDOM();
|
|
197
|
+
for (const projection of projections) this.prepareClips(projection);
|
|
198
|
+
for (const projection of projections) {
|
|
199
|
+
const slot = projection.registration.slot;
|
|
200
|
+
if ((!projection.visible || !projection.registration.interactive) && slot.region.active) {
|
|
201
|
+
this.root.focusPolicy?.removeHtmlFocusRegion?.(slot.region);
|
|
202
|
+
const active = this.root.canvas.ownerDocument.activeElement;
|
|
203
|
+
if (active instanceof HTMLElement && slot.content?.contains(active)) active.blur();
|
|
204
|
+
}
|
|
205
|
+
this.publishContent(projection);
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
adopt() {
|
|
209
|
+
if (this.disposed) return;
|
|
210
|
+
if (this.suspended) {
|
|
211
|
+
if (this.viewport) this.viewport.hidden = true;
|
|
212
|
+
for (const slot of this.live) {
|
|
213
|
+
slot.region.active = false;
|
|
214
|
+
slot.events?.suspend();
|
|
215
|
+
if (slot.shell) slot.shell.inert = true;
|
|
216
|
+
}
|
|
217
|
+
return;
|
|
218
|
+
}
|
|
219
|
+
if (!this.projections) return;
|
|
150
220
|
if (this.viewport) this.viewport.hidden = false;
|
|
151
|
-
for (
|
|
152
|
-
this.snapshots =
|
|
221
|
+
for (let index = 0; index < this.projections.length; index++) this.applyGeometry(this.projections[index], index);
|
|
222
|
+
this.snapshots = this.nextSnapshots;
|
|
153
223
|
}
|
|
154
224
|
ensureDOM() {
|
|
155
225
|
if (this.viewport) return;
|
|
@@ -161,18 +231,18 @@ class HtmlService {
|
|
|
161
231
|
this.svg.setAttribute("width", "0");
|
|
162
232
|
this.svg.setAttribute("height", "0");
|
|
163
233
|
this.svg.setAttribute("aria-hidden", "true");
|
|
164
|
-
this.svg.style.cssText = "position:absolute;pointer-events:none";
|
|
234
|
+
this.svg.style.cssText = "position:absolute;left:0;top:0;pointer-events:none";
|
|
165
235
|
this.root.htmlOverlay.append(this.svg, this.viewport);
|
|
166
236
|
}
|
|
167
|
-
|
|
168
|
-
const
|
|
237
|
+
publishContent(projection) {
|
|
238
|
+
const r = projection.registration;
|
|
169
239
|
const slot = r.slot;
|
|
170
240
|
const first = !slot.shell;
|
|
171
241
|
const doc = this.root.canvas.ownerDocument;
|
|
172
242
|
if (first) {
|
|
173
243
|
slot.shell = doc.createElement("div");
|
|
174
244
|
slot.shell.dataset.pibblHtmlBox = "";
|
|
175
|
-
slot.shell.style.cssText = "position:absolute;left:0;top:0;transform-origin:0 0;pointer-events:none;isolation:isolate";
|
|
245
|
+
slot.shell.style.cssText = "position:absolute;left:0;top:0;transform-origin:0 0;pointer-events:none;isolation:isolate;opacity:0";
|
|
176
246
|
slot.content = doc.createElement("div");
|
|
177
247
|
slot.content.dataset.pibblHtmlContent = "";
|
|
178
248
|
slot.content.style.cssText = "position:absolute;box-sizing:border-box";
|
|
@@ -183,28 +253,7 @@ class HtmlService {
|
|
|
183
253
|
slot.region.content = slot.content;
|
|
184
254
|
this.live.add(slot);
|
|
185
255
|
}
|
|
186
|
-
|
|
187
|
-
const determinant = matrix.a * matrix.d - matrix.b * matrix.c;
|
|
188
|
-
const visible = r.border.width > 0 && r.border.height > 0 && determinant !== 0;
|
|
189
|
-
slot.shell.style.width = `${r.border.width}px`;
|
|
190
|
-
slot.shell.style.height = `${r.border.height}px`;
|
|
191
|
-
slot.shell.style.transform = cssMatrix(matrix);
|
|
192
|
-
slot.shell.style.zIndex = String(index);
|
|
193
|
-
slot.shell.style.opacity = String(opacity);
|
|
194
|
-
slot.shell.style.overflow = r.overflow;
|
|
195
|
-
slot.content.style.left = `${r.content.x}px`;
|
|
196
|
-
slot.content.style.top = `${r.content.y}px`;
|
|
197
|
-
slot.content.style.width = `${r.content.width}px`;
|
|
198
|
-
slot.content.style.height = `${r.content.height}px`;
|
|
199
|
-
slot.content.style.pointerEvents = r.interactive ? "auto" : "none";
|
|
200
|
-
slot.shell.inert = !visible || !r.interactive;
|
|
201
|
-
slot.shell.style.visibility = visible ? "visible" : "hidden";
|
|
202
|
-
slot.region.active = visible && r.interactive;
|
|
203
|
-
const corners = [[0, 0], [r.border.width, 0], [0, r.border.height], [r.border.width, r.border.height]].map(([x, y]) => world.transformPoint({ x, y }));
|
|
204
|
-
const xs = corners.map((p) => p.x), ys = corners.map((p) => p.y);
|
|
205
|
-
slot.region.rootBounds = { x: Math.min(...xs), y: Math.min(...ys), width: Math.max(...xs) - Math.min(...xs), height: Math.max(...ys) - Math.min(...ys) };
|
|
206
|
-
slot.callback = r.onFocusChange;
|
|
207
|
-
if (visible) this.applyClips(slot, clips, world.inverse());
|
|
256
|
+
slot.events.prepareListeners(projection.events);
|
|
208
257
|
try {
|
|
209
258
|
if (first) {
|
|
210
259
|
const update = withSignalWriteForbidden("HtmlBox mount", () => slot.mount(slot.content, r.data, slot.abort.signal));
|
|
@@ -218,31 +267,70 @@ class HtmlService {
|
|
|
218
267
|
this.retire(slot);
|
|
219
268
|
throw error;
|
|
220
269
|
}
|
|
270
|
+
}
|
|
271
|
+
applyGeometry(projection, index) {
|
|
272
|
+
const { registration: r, bounds, visible, opacity } = projection;
|
|
273
|
+
const slot = r.slot;
|
|
274
|
+
if (slot.disposed) return;
|
|
275
|
+
slot.shell.style.width = `${r.border.width}px`;
|
|
276
|
+
slot.shell.style.height = `${r.border.height}px`;
|
|
277
|
+
slot.shell.style.transform = projection.transformCss;
|
|
278
|
+
slot.shell.style.zIndex = String(index);
|
|
279
|
+
slot.shell.style.opacity = String(opacity);
|
|
280
|
+
slot.shell.style.overflow = r.overflow;
|
|
281
|
+
slot.content.style.left = `${r.content.x}px`;
|
|
282
|
+
slot.content.style.top = `${r.content.y}px`;
|
|
283
|
+
slot.content.style.width = `${r.content.width}px`;
|
|
284
|
+
slot.content.style.height = `${r.content.height}px`;
|
|
285
|
+
slot.content.style.pointerEvents = r.interactive ? "auto" : "none";
|
|
221
286
|
slot.shell.inert = !visible || !r.interactive;
|
|
222
287
|
slot.shell.style.visibility = visible ? "visible" : "hidden";
|
|
288
|
+
slot.region.active = visible && r.interactive;
|
|
289
|
+
slot.region.rootBounds = bounds;
|
|
290
|
+
slot.callback = r.onFocusChange;
|
|
291
|
+
slot.events.adopt(projection.events);
|
|
292
|
+
if (visible) {
|
|
293
|
+
const previous = slot.clipping;
|
|
294
|
+
slot.clipping = projection.definitions;
|
|
295
|
+
slot.shell.style.clipPath = projection.clipPath;
|
|
296
|
+
if (previous !== slot.clipping) for (const definition of previous ?? []) definition.remove();
|
|
297
|
+
}
|
|
223
298
|
}
|
|
224
|
-
|
|
225
|
-
|
|
299
|
+
prepareClips(projection) {
|
|
300
|
+
if (!projection.visible) return;
|
|
301
|
+
const slot = projection.registration.slot;
|
|
302
|
+
const clips = projection.clips;
|
|
303
|
+
const previous = slot.clipping;
|
|
304
|
+
let unchanged = previous?.length === clips.length;
|
|
305
|
+
const matrices = [];
|
|
306
|
+
for (let index = 0; index < clips.length; index++) {
|
|
307
|
+
const clip = clips[index];
|
|
308
|
+
matrices.push(cssMatrix(clip.matrix));
|
|
309
|
+
const path = previous?.[index]?.firstElementChild;
|
|
310
|
+
if (!path || path.getAttribute("d") !== clip.data || path.getAttribute("clip-rule") !== clip.rule || path.getAttribute("transform") !== matrices[index]) unchanged = false;
|
|
311
|
+
}
|
|
312
|
+
if (unchanged) {
|
|
313
|
+
projection.definitions = previous;
|
|
314
|
+
projection.clipPath = clips.length ? `url(#${previous[0].id})` : "none";
|
|
315
|
+
return;
|
|
316
|
+
}
|
|
317
|
+
const definitions = [];
|
|
226
318
|
const doc = this.root.canvas.ownerDocument;
|
|
227
|
-
|
|
319
|
+
for (let index = 0; index < clips.length; index++) {
|
|
228
320
|
const definition = doc.createElementNS(SVG, "clipPath");
|
|
229
321
|
definition.id = `pibbl-html-clip-${++nextId}`;
|
|
230
322
|
definition.setAttribute("clipPathUnits", "userSpaceOnUse");
|
|
231
|
-
|
|
232
|
-
|
|
323
|
+
const path = doc.createElementNS(SVG, "path");
|
|
324
|
+
path.setAttribute("d", clips[index].data);
|
|
325
|
+
path.setAttribute("clip-rule", clips[index].rule);
|
|
326
|
+
path.setAttribute("transform", matrices[index]);
|
|
327
|
+
definition.append(path);
|
|
233
328
|
definitions.push(definition);
|
|
234
329
|
}
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
setAttribute(path, "clip-rule", clip.rule);
|
|
240
|
-
setAttribute(path, "transform", cssMatrix(inverseWorld.multiply(clip.matrix)));
|
|
241
|
-
if (index + 1 < clips.length) setAttribute(definition, "clip-path", `url(#${definitions[index + 1].id})`);
|
|
242
|
-
else definition.removeAttribute("clip-path");
|
|
243
|
-
});
|
|
244
|
-
slot.shell.style.clipPath = clips.length ? `url(#${definitions[0].id})` : "none";
|
|
245
|
-
while (definitions.length > clips.length) definitions.pop().remove();
|
|
330
|
+
for (let index = 0; index + 1 < definitions.length; index++) definitions[index].firstElementChild.setAttribute("clip-path", `url(#${definitions[index + 1].id})`);
|
|
331
|
+
for (const definition of definitions) this.svg.append(definition);
|
|
332
|
+
projection.definitions = definitions;
|
|
333
|
+
projection.clipPath = definitions.length ? `url(#${definitions[0].id})` : "none";
|
|
246
334
|
}
|
|
247
335
|
reset() {
|
|
248
336
|
for (const slot of this.live) this.retire(slot);
|
|
@@ -270,8 +358,53 @@ function snapshotClips(clips) {
|
|
|
270
358
|
function cssMatrix(m) {
|
|
271
359
|
return `matrix(${m.a},${m.b},${m.c},${m.d},${m.e},${m.f})`;
|
|
272
360
|
}
|
|
273
|
-
function
|
|
274
|
-
|
|
361
|
+
function prepareProjection(registration, world, rootMatrix, clips, opacity) {
|
|
362
|
+
const matrix = rootMatrix.multiply(world);
|
|
363
|
+
assertFiniteProjectionMatrix(matrix);
|
|
364
|
+
const width = registration.border.width;
|
|
365
|
+
const height = registration.border.height;
|
|
366
|
+
let minX = Infinity, minY = Infinity, maxX = -Infinity, maxY = -Infinity;
|
|
367
|
+
for (let space = 0; space < 2; space++) {
|
|
368
|
+
const transform = space === 0 ? world : matrix;
|
|
369
|
+
let left = Infinity, top = Infinity, right = -Infinity, bottom = -Infinity;
|
|
370
|
+
for (let corner = 0; corner < 4; corner++) {
|
|
371
|
+
const x = corner & 1 ? width : 0;
|
|
372
|
+
const y = corner & 2 ? height : 0;
|
|
373
|
+
const projectedX = transform.a * x + transform.c * y + transform.e;
|
|
374
|
+
const projectedY = transform.b * x + transform.d * y + transform.f;
|
|
375
|
+
if (!Number.isFinite(projectedX) || !Number.isFinite(projectedY)) throw new Error("HtmlBox projection must be finite.");
|
|
376
|
+
left = Math.min(left, projectedX);
|
|
377
|
+
top = Math.min(top, projectedY);
|
|
378
|
+
right = Math.max(right, projectedX);
|
|
379
|
+
bottom = Math.max(bottom, projectedY);
|
|
380
|
+
}
|
|
381
|
+
if (!Number.isFinite(right - left) || !Number.isFinite(bottom - top)) throw new Error("HtmlBox projection must be finite.");
|
|
382
|
+
if (space === 0) {
|
|
383
|
+
minX = left;
|
|
384
|
+
minY = top;
|
|
385
|
+
maxX = right;
|
|
386
|
+
maxY = bottom;
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
const bounds = { x: minX, y: minY, width: maxX - minX, height: maxY - minY };
|
|
390
|
+
if (!Number.isFinite(bounds.width) || !Number.isFinite(bounds.height)) throw new Error("HtmlBox projection must be finite.");
|
|
391
|
+
const determinant = matrix.a * matrix.d - matrix.b * matrix.c;
|
|
392
|
+
if (Number.isNaN(determinant)) throw new Error("HtmlBox projection must be finite.");
|
|
393
|
+
const visible = width > 0 && height > 0 && determinant !== 0;
|
|
394
|
+
const localClips = [];
|
|
395
|
+
if (visible && clips.length) {
|
|
396
|
+
const inverse = world.inverse();
|
|
397
|
+
assertFiniteProjectionMatrix(inverse);
|
|
398
|
+
for (const clip of clips) {
|
|
399
|
+
const local = inverse.multiply(clip.matrix);
|
|
400
|
+
assertFiniteProjectionMatrix(local);
|
|
401
|
+
localClips.push({ data: clip.data, rule: clip.rule, matrix: local });
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
return { registration, world, rootMatrix, matrix, bounds, visible, clips: localClips, opacity };
|
|
405
|
+
}
|
|
406
|
+
function assertFiniteProjectionMatrix(matrix) {
|
|
407
|
+
if (!(Number.isFinite(matrix.a) && Number.isFinite(matrix.b) && Number.isFinite(matrix.c) && Number.isFinite(matrix.d) && Number.isFinite(matrix.e) && Number.isFinite(matrix.f))) throw new Error("HtmlBox projection must be finite.");
|
|
275
408
|
}
|
|
276
409
|
export {
|
|
277
410
|
HtmlService,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/lib/html/html-service.ts"],
|
|
4
|
-
"sourcesContent": ["import { GLOBAL_STATE } from '../global-state.js';\nimport { withSignalWriteForbidden } from '../signals/graph.js';\nimport type { PibblClippingStackEntry, PibblEventRoot, PibblInstance, PibblInteractionLayer, PibblRenderTransaction } from '../types.js';\nimport type { HtmlBoxRegistration, HtmlBoxSlot, HtmlBridge } from './types.js';\nimport { validateHtmlOverlay } from './overlay-config.js';\nimport { rectangleSvg } from './portable-clips.js';\n\nconst SVG = 'http://www.w3.org/2000/svg';\nlet nextId = 0;\ntype Entry = HtmlBoxRegistration | { child: PibblInstance; matrix: DOMMatrix; clips: readonly PibblClippingStackEntry[]; opacity: number; bounds: {x:number;y:number;width:number;height:number} };\ntype Clip = { data: string; matrix: DOMMatrix; rule: CanvasFillRule };\ninterface Projection { registration: HtmlBoxRegistration; world: DOMMatrix; clips: Clip[]; opacity: number; }\n\nexport function requireHtmlService(owner: PibblInstance): HtmlService {\n const root = owner.eventRoot;\n if (!root.htmlOverlay || !root.canvas) throw new Error('HtmlBox requires an HTMLCanvasElement root configured with htmlOverlay.');\n return (root.html ??= new HtmlService(root)) as HtmlService;\n}\n\nexport class HtmlService implements HtmlBridge {\n private snapshots = new Map<PibblInstance, Entry[]>();\n private pending: Map<PibblInstance, Entry[]> | undefined;\n private transaction: PibblRenderTransaction | undefined;\n private live = new Set<HtmlBoxSlot>();\n private svg: SVGSVGElement | undefined;\n private viewport: HTMLDivElement | undefined;\n private disposed = false;\n private rendered = new Set<HtmlBoxSlot>();\n constructor(private readonly root: PibblEventRoot) {}\n\n private enterTransaction(): void {\n const transaction = this.root.renderTransaction;\n if (!transaction) throw new Error('HtmlBox requires an active render transaction.');\n if (transaction === this.transaction) return;\n this.transaction = transaction;\n this.pending = new Map(this.snapshots);\n this.rendered = new Set();\n transaction.onPublish!(() => this.publish());\n transaction.onFinish(success => {\n if (!success) this.reset();\n this.pending = undefined;\n this.transaction = undefined;\n this.rendered.clear();\n });\n }\n\n beginRender(instance: PibblInstance): void {\n this.enterTransaction();\n this.pending!.set(instance, []);\n }\n\n suspend(instance: PibblInstance): void {\n if (instance !== this.root.rootInstance) return;\n this.enterTransaction();\n this.root.renderTransaction!.onPublish!(() => {\n this.root.focusPolicy?.suspendHtmlRegions?.();\n if (this.viewport) this.viewport.hidden = true;\n for (const slot of this.live) { slot.region.active = false; if (slot.shell) slot.shell.inert = true; }\n });\n }\n\n register(registration: HtmlBoxRegistration): void {\n assertEffects();\n this.enterTransaction();\n const owner = registration.slot.owner;\n let entries = this.pending!.get(owner);\n // A service first created during this render has no candidate array yet.\n if (!entries || entries === this.snapshots.get(owner)) this.pending!.set(owner, entries = []);\n entries.push(registration);\n this.rendered.add(registration.slot);\n this.root.focusPolicy?.observeHtmlRegion?.(registration.slot.region);\n }\n\n recordLayer(parent: PibblInstance, child: PibblInstance, bridge: PibblInteractionLayer, opacity: number, composite: GlobalCompositeOperation): void {\n this.enterTransaction();\n if (this.hasHosts(child)) {\n assertEffects(composite);\n const entries = this.pending!.get(parent) ?? [];\n if (!this.pending!.has(parent)) this.pending!.set(parent, entries);\n entries.push({ child, matrix: copy(bridge.transform), clips: snapshotClips(bridge.clippingStack), opacity,\n bounds: { x: 0, y: 0, width: child.rootLayoutBox.width, height: child.rootLayoutBox.height } });\n }\n }\n\n private hasHosts(instance: PibblInstance): boolean {\n return (this.pending?.get(instance) ?? this.snapshots.get(instance) ?? []).length > 0;\n }\n\n release(slot: HtmlBoxSlot): void {\n if (slot.disposed) return;\n const transaction = this.root.renderTransaction;\n if (transaction) {\n transaction.onPublish!(() => this.retire(slot));\n transaction.onFinish(success => { if (!success) this.retire(slot); });\n } else this.retire(slot);\n }\n\n private retire(slot: HtmlBoxSlot): void {\n if (slot.disposed) return;\n slot.disposed = true;\n slot.region.active = false;\n this.root.focusPolicy?.removeHtmlFocusRegion?.(slot.region);\n try { withSignalWriteForbidden('HtmlBox abort cleanup', () => slot.abort?.abort()); }\n finally {\n slot.shell?.remove();\n for (const clip of slot.clipping ?? []) clip.remove();\n slot.clipping = [];\n slot.update = undefined;\n slot.region.content = undefined;\n this.live.delete(slot);\n }\n }\n\n private publish(): void {\n if (this.disposed || !this.pending) return;\n const canvas = this.root.canvas!;\n const overlay = this.root.htmlOverlay!;\n validateHtmlOverlay(canvas, overlay);\n const rootInstance = this.root.rootInstance!;\n if (rootInstance.surface.kind === 'root' && (!rootInstance.surface.display.width || !rootInstance.surface.display.height)) {\n this.root.focusPolicy?.suspendHtmlRegions?.();\n if (this.viewport) this.viewport.hidden = true;\n for (const slot of this.live) { slot.region.active = false; if (slot.shell) slot.shell.inert = true; }\n return;\n }\n const surface = rootInstance.surface.snapshot!;\n const rootMatrix = new DOMMatrix().scale(1 / surface.backingPixelsPerCssPixelX, 1 / surface.backingPixelsPerCssPixelY).multiply(surface.renderTransform);\n const projections: Projection[] = [];\n const visited = new Set<PibblInstance>();\n const walk = (instance: PibblInstance, world: DOMMatrix, clips: Clip[], opacity: number) => {\n visited.add(instance);\n for (const entry of this.pending!.get(instance) ?? []) {\n const inherited = clips.concat(entry.clips.map(clip => {\n if (clip.svgPath === undefined) throw new Error('HtmlBox cannot project a native Path2D clip. Use PathGeometry for clips enclosing HtmlBox.');\n return { data: clip.svgPath, rule: clip.fillRule, matrix: world.multiply(clip.transform) };\n }));\n if ('child' in entry) {\n const childWorld = world.multiply(entry.matrix);\n walk(entry.child, childWorld, inherited.concat({ data: rectangleSvg(entry.bounds), matrix: childWorld, rule: 'nonzero' }), opacity * entry.opacity);\n } else if (!entry.slot.disposed) {\n const hostWorld = world.multiply(entry.matrix);\n if (![hostWorld.a,hostWorld.b,hostWorld.c,hostWorld.d,hostWorld.e,hostWorld.f].every(Number.isFinite)) throw new Error('HtmlBox transform must be finite.');\n projections.push({ registration: entry, world: hostWorld, clips: inherited, opacity: opacity * entry.opacity });\n }\n }\n };\n walk(rootInstance, new DOMMatrix(), [], 1);\n const desired = new Set(projections.map(p => p.registration.slot));\n for (const slot of this.live) if (!desired.has(slot)) this.retire(slot);\n if (projections.length) this.ensureDOM();\n if (this.viewport) this.viewport.hidden = false;\n for (const [index, projection] of projections.entries()) this.apply(projection, rootMatrix, index);\n this.snapshots = new Map([...this.pending].filter(([owner]) => visited.has(owner)));\n }\n\n private ensureDOM(): void {\n if (this.viewport) return;\n const doc = this.root.canvas!.ownerDocument;\n this.viewport = doc.createElement('div');\n this.viewport.dataset.pibblHtmlViewport = '';\n this.viewport.style.cssText = 'position:absolute;inset:0;overflow:clip;pointer-events:none';\n this.svg = doc.createElementNS(SVG, 'svg');\n this.svg.setAttribute('width', '0'); this.svg.setAttribute('height', '0');\n this.svg.setAttribute('aria-hidden', 'true');\n this.svg.style.cssText = 'position:absolute;pointer-events:none';\n this.root.htmlOverlay!.append(this.svg, this.viewport);\n }\n\n private apply(projection: Projection, rootMatrix: DOMMatrix, index: number): void {\n const { registration: r, world, clips, opacity } = projection;\n const slot = r.slot;\n const first = !slot.shell;\n const doc = this.root.canvas!.ownerDocument;\n if (first) {\n slot.shell = doc.createElement('div'); slot.shell.dataset.pibblHtmlBox = '';\n slot.shell.style.cssText = 'position:absolute;left:0;top:0;transform-origin:0 0;pointer-events:none;isolation:isolate';\n slot.content = doc.createElement('div'); slot.content.dataset.pibblHtmlContent = '';\n slot.content.style.cssText = 'position:absolute;box-sizing:border-box';\n slot.shell.append(slot.content); this.viewport!.append(slot.shell);\n slot.clipping = []; slot.abort = new (doc.defaultView!.AbortController)();\n slot.region.content = slot.content;\n this.live.add(slot);\n }\n const matrix = rootMatrix.multiply(world);\n const determinant = matrix.a * matrix.d - matrix.b * matrix.c;\n const visible = r.border.width > 0 && r.border.height > 0 && determinant !== 0;\n slot.shell!.style.width = `${r.border.width}px`; slot.shell!.style.height = `${r.border.height}px`;\n slot.shell!.style.transform = cssMatrix(matrix); slot.shell!.style.zIndex = String(index);\n slot.shell!.style.opacity = String(opacity); slot.shell!.style.overflow = r.overflow;\n slot.content!.style.left = `${r.content.x}px`; slot.content!.style.top = `${r.content.y}px`;\n slot.content!.style.width = `${r.content.width}px`; slot.content!.style.height = `${r.content.height}px`;\n slot.content!.style.pointerEvents = r.interactive ? 'auto' : 'none';\n slot.shell!.inert = !visible || !r.interactive;\n slot.shell!.style.visibility = visible ? 'visible' : 'hidden';\n slot.region.active = visible && r.interactive;\n const corners = [[0,0],[r.border.width,0],[0,r.border.height],[r.border.width,r.border.height]].map(([x,y]) => world.transformPoint({x,y}));\n const xs = corners.map(p => p.x), ys = corners.map(p => p.y);\n slot.region.rootBounds = { x: Math.min(...xs), y: Math.min(...ys), width: Math.max(...xs)-Math.min(...xs), height: Math.max(...ys)-Math.min(...ys) };\n slot.callback = r.onFocusChange;\n if (visible) this.applyClips(slot, clips, world.inverse());\n try {\n if (first) {\n const update = withSignalWriteForbidden('HtmlBox mount', () => slot.mount(slot.content!, r.data, slot.abort!.signal));\n if (typeof update !== 'function') throw new TypeError('HtmlBox mount must synchronously return an update function.');\n slot.update = update;\n } else if (this.rendered.has(slot)) {\n const result: unknown = withSignalWriteForbidden('HtmlBox update', () => slot.update!(r.data));\n if (result && typeof (result as PromiseLike<unknown>).then === 'function') throw new TypeError('HtmlBox update must be synchronous.');\n }\n } catch (error) { this.retire(slot); throw error; }\n slot.shell!.inert = !visible || !r.interactive;\n slot.shell!.style.visibility = visible ? 'visible' : 'hidden';\n }\n\n private applyClips(slot: HtmlBoxSlot, clips: Clip[], inverseWorld: DOMMatrix): void {\n const definitions = slot.clipping!;\n const doc = this.root.canvas!.ownerDocument;\n while (definitions.length < clips.length) {\n const definition = doc.createElementNS(SVG, 'clipPath');\n definition.id = `pibbl-html-clip-${++nextId}`;\n definition.setAttribute('clipPathUnits', 'userSpaceOnUse');\n definition.append(doc.createElementNS(SVG, 'path'));\n this.svg!.append(definition); definitions.push(definition);\n }\n clips.forEach((clip, index) => {\n const definition = definitions[index]; const path = definition.firstElementChild!;\n setAttribute(path, 'd', clip.data);\n setAttribute(path, 'clip-rule', clip.rule);\n setAttribute(path, 'transform', cssMatrix(inverseWorld.multiply(clip.matrix)));\n if (index + 1 < clips.length) setAttribute(definition, 'clip-path', `url(#${definitions[index+1].id})`);\n else definition.removeAttribute('clip-path');\n });\n slot.shell!.style.clipPath = clips.length ? `url(#${definitions[0].id})` : 'none';\n while (definitions.length > clips.length) definitions.pop()!.remove();\n }\n\n private reset(): void {\n for (const slot of this.live) this.retire(slot);\n this.snapshots.clear();\n this.viewport?.remove(); this.svg?.remove(); this.viewport = undefined; this.svg = undefined;\n }\n dispose(): void { if (this.disposed) return; this.disposed = true; this.reset(); }\n}\n\nfunction assertEffects(composite = GLOBAL_STATE.renderContext?.globalCompositeOperation): void {\n if (GLOBAL_STATE.htmlFilterDepth || composite !== 'source-over') throw new Error('HtmlBox cannot be enclosed by Canvas filters or non-default compositing. Use CSS effects inside its content instead.');\n}\nfunction copy(matrix: DOMMatrixReadOnly): DOMMatrix { return new DOMMatrix([matrix.a,matrix.b,matrix.c,matrix.d,matrix.e,matrix.f]); }\nexport function snapshotClips(clips: readonly PibblClippingStackEntry[]): PibblClippingStackEntry[] {\n return clips.map(clip => ({ ...clip, transform: copy(clip.transform) }));\n}\nfunction cssMatrix(m: DOMMatrixReadOnly): string { return `matrix(${m.a},${m.b},${m.c},${m.d},${m.e},${m.f})`; }\nfunction setAttribute(element: Element, name: string, value: string): void { if (element.getAttribute(name) !== value) element.setAttribute(name, value); }\n"],
|
|
5
|
-
"mappings": "AAAA,SAAS,oBAAoB;AAC7B,SAAS,gCAAgC;AAGzC,SAAS,2BAA2B;AACpC,SAAS,oBAAoB;AAE7B,MAAM,MAAM;AACZ,IAAI,SAAS;AAKN,SAAS,mBAAmB,OAAmC;AACpE,QAAM,OAAO,MAAM;AACnB,MAAI,CAAC,KAAK,eAAe,CAAC,KAAK,OAAQ,OAAM,IAAI,MAAM,yEAAyE;AAChI,SAAQ,KAAK,SAAS,IAAI,YAAY,IAAI;AAC5C;AAEO,MAAM,YAAkC;AAAA,EAS7C,YAA6B,MAAsB;AAAtB;AAAA,EAAuB;AAAA,EAAvB;AAAA,EARrB,YAAY,oBAAI,IAA4B;AAAA,EAC5C;AAAA,EACA;AAAA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Content": ["import { HtmlNativeEvents, type HtmlNativeEventSnapshot } from './html-events.js';\nimport { stageLayoutHtmlGeometry } from '../layout/geometry-publication.js';\nimport { isLayoutComponentSuspended, isLayoutInstanceSuspended } from '../layout/participation.js';\nimport { GLOBAL_STATE } from '../global-state.js';\nimport { withSignalWriteForbidden } from '../signals/graph.js';\nimport type { PibblClippingStackEntry, PibblEventRoot, PibblInstance, PibblInteractionLayer, PibblRenderTransaction } from '../types.js';\nimport type { HtmlBoxRegistration, HtmlBoxSlot, HtmlBridge } from './types.js';\nimport { validateHtmlOverlay } from './overlay-config.js';\nimport { rectangleSvg } from './portable-clips.js';\n\nconst SVG = 'http://www.w3.org/2000/svg';\nlet nextId = 0;\ntype Entry = HtmlBoxRegistration | { child: PibblInstance; matrix: DOMMatrix; clips: readonly PibblClippingStackEntry[]; opacity: number; bounds: {x:number;y:number;width:number;height:number} };\ntype Clip = { data: string; matrix: DOMMatrix; rule: CanvasFillRule };\ninterface Projection { events?: HtmlNativeEventSnapshot; world: DOMMatrix; rootMatrix: DOMMatrix; transformCss?: string; definitions?: SVGClipPathElement[]; clipPath?: string; registration: HtmlBoxRegistration; matrix: DOMMatrix; bounds: { x: number; y: number; width: number; height: number }; visible: boolean; clips: Clip[]; opacity: number; }\n\nexport function requireHtmlService(owner: PibblInstance): HtmlService {\n const root = owner.eventRoot;\n if (!root.htmlOverlay || !root.canvas) throw new Error('HtmlBox requires an HTMLCanvasElement root configured with htmlOverlay.');\n return (root.html ??= new HtmlService(root)) as HtmlService;\n}\n\nexport class HtmlService implements HtmlBridge {\n private snapshots = new Map<PibblInstance, Entry[]>();\n private pending: Map<PibblInstance, Entry[]> | undefined;\n private transaction: PibblRenderTransaction | undefined;\n private live = new Set<HtmlBoxSlot>();\n private svg: SVGSVGElement | undefined;\n private viewport: HTMLDivElement | undefined;\n private disposed = false;\n private suspended = false;\n private projections: Projection[] | undefined;\n private nextSnapshots: Map<PibblInstance, Entry[]> | undefined;\n private rendered = new Set<HtmlBoxSlot>();\n constructor(private readonly root: PibblEventRoot) {}\n\n private enterTransaction(): void {\n const transaction = this.root.renderTransaction;\n if (!transaction) throw new Error('HtmlBox requires an active render transaction.');\n if (transaction === this.transaction) return;\n this.transaction = transaction;\n this.pending = new Map(this.snapshots);\n this.rendered = new Set();\n this.suspended = false;\n transaction.onPreflight!(() => this.prepare());\n transaction.onPublish!(() => this.publish());\n transaction.onAdopt!(() => this.adopt());\n transaction.onFinish(success => {\n if (!success && transaction.failed !== false) this.reset();\n this.pending = undefined;\n this.transaction = undefined;\n this.rendered.clear();\n this.projections = undefined;\n this.nextSnapshots = undefined;\n });\n }\n\n beginRender(instance: PibblInstance): void {\n this.enterTransaction();\n this.pending!.set(instance, []);\n }\n\n suspend(instance: PibblInstance): void {\n if (instance !== this.root.rootInstance) return;\n this.enterTransaction();\n this.suspended = true;\n }\n\n register(registration: HtmlBoxRegistration): void {\n assertEffects();\n this.enterTransaction();\n const owner = registration.slot.owner;\n let entries = this.pending!.get(owner);\n // A service first created during this render has no candidate array yet.\n if (!entries || entries === this.snapshots.get(owner)) this.pending!.set(owner, entries = []);\n entries.push(registration);\n this.rendered.add(registration.slot);\n this.root.focusPolicy?.observeHtmlRegion?.(registration.slot.region);\n }\n\n recordLayer(parent: PibblInstance, child: PibblInstance, bridge: PibblInteractionLayer, opacity: number, composite: GlobalCompositeOperation): void {\n this.enterTransaction();\n if (this.hasHosts(child)) {\n assertEffects(composite);\n const entries = this.pending!.get(parent) ?? [];\n if (!this.pending!.has(parent)) this.pending!.set(parent, entries);\n entries.push({ child, matrix: copy(bridge.transform), clips: snapshotClips(bridge.clippingStack), opacity,\n bounds: { x: 0, y: 0, width: child.rootLayoutBox.width, height: child.rootLayoutBox.height } });\n }\n }\n\n private hasHosts(instance: PibblInstance): boolean {\n return (this.pending?.get(instance) ?? this.snapshots.get(instance) ?? []).length > 0;\n }\n\n release(slot: HtmlBoxSlot): void {\n if (slot.disposed) return;\n const transaction = this.root.renderTransaction;\n if (transaction) {\n transaction.onPublish!(() => this.retire(slot));\n transaction.onFinish(success => { if (!success) this.retire(slot); });\n } else this.retire(slot);\n }\n\n private retire(slot: HtmlBoxSlot): void {\n if (slot.disposed) return;\n slot.disposed = true;\n slot.events?.dispose();\n slot.region.active = false;\n this.root.focusPolicy?.removeHtmlFocusRegion?.(slot.region);\n try { withSignalWriteForbidden('HtmlBox abort cleanup', () => slot.abort?.abort()); }\n finally {\n slot.shell?.remove();\n for (const clip of slot.clipping ?? []) clip.remove();\n slot.clipping = [];\n slot.update = undefined;\n slot.region.content = undefined;\n this.live.delete(slot);\n }\n }\n\n private prepare(): void {\n if (this.disposed || !this.pending) return;\n const canvas = this.root.canvas!;\n const overlay = this.root.htmlOverlay!;\n validateHtmlOverlay(canvas, overlay);\n const rootInstance = this.root.rootInstance!;\n if (rootInstance.surface.kind === 'root' && (!rootInstance.surface.display.width || !rootInstance.surface.display.height)) {\n this.suspended = true;\n for (const slot of this.live) stageLayoutHtmlGeometry(this.transaction!, slot.region, {\n active: false, bounds: slot.region.rootBounds ?? { x: 0, y: 0, width: 0, height: 0 },\n });\n return;\n }\n const surface = rootInstance.surface.snapshot!;\n const rootMatrix = new DOMMatrix().scale(1 / surface.backingPixelsPerCssPixelX, 1 / surface.backingPixelsPerCssPixelY).multiply(surface.renderTransform);\n const projections: Projection[] = [];\n const visited = new Set<PibblInstance>();\n const walk = (\n instance: PibblInstance,\n world: DOMMatrix,\n clips: Clip[],\n opacity: number,\n ) => {\n visited.add(instance);\n for (const entry of this.pending!.get(instance) ?? []) {\n const inherited = clips.concat(entry.clips.map(clip => {\n if (clip.svgPath === undefined) throw new Error('HtmlBox cannot project a native Path2D clip. Use PathGeometry for clips enclosing HtmlBox.');\n return { data: clip.svgPath, rule: clip.fillRule, matrix: world.multiply(clip.transform) };\n }));\n if ('child' in entry) {\n const childWorld = world.multiply(entry.matrix);\n walk(entry.child, childWorld, inherited.concat({ data: rectangleSvg(entry.bounds), matrix: childWorld, rule: 'nonzero' }), opacity * entry.opacity);\n } else if (!entry.slot.disposed) {\n const hostWorld = world.multiply(entry.matrix);\n if (!(\n Number.isFinite(hostWorld.a) &&\n Number.isFinite(hostWorld.b) &&\n Number.isFinite(hostWorld.c) &&\n Number.isFinite(hostWorld.d) &&\n Number.isFinite(hostWorld.e) &&\n Number.isFinite(hostWorld.f)\n ))\n throw new Error('HtmlBox transform must be finite.');\n projections.push(prepareProjection(entry, hostWorld, rootMatrix, inherited, opacity * entry.opacity));\n }\n }\n };\n walk(rootInstance, new DOMMatrix(), [], 1);\n for (const projection of projections) {\n projection.transformCss = cssMatrix(projection.matrix);\n const slot = projection.registration.slot;\n slot.events ??= new HtmlNativeEvents(slot, () => this.svg!, target => {\n const doc = this.root.canvas!.ownerDocument;\n if (!(target instanceof doc.defaultView!.Node)) return null;\n for (const candidate of this.live) {\n if (candidate.events?.node.live && candidate.shell?.contains(target)) return candidate.events.node;\n }\n return null;\n });\n projection.events = slot.events.prepare(projection.registration.handlers, projection.world,\n projection.rootMatrix, projection.visible && projection.registration.interactive);\n stageLayoutHtmlGeometry(this.transaction!, projection.registration.slot.region, {\n bounds: projection.bounds, active: projection.visible && projection.registration.interactive,\n });\n }\n this.projections = projections;\n this.nextSnapshots = new Map([...this.pending].filter(([owner]) => visited.has(owner)));\n }\n\n private publish(): void {\n if (this.suspended) { this.root.focusPolicy?.suspendHtmlRegions?.(); return; }\n const projections = this.projections;\n if (!projections || this.disposed) return;\n const desired = new Set(projections.map(p => p.registration.slot));\n for (const slot of this.live) if (!desired.has(slot)) {\n if (!slot.owner.mainTeardowns.closed && (isLayoutComponentSuspended(slot.component) || isLayoutInstanceSuspended(slot.owner))) {\n slot.region.active = false; slot.events?.suspend();\n this.root.focusPolicy?.removeHtmlFocusRegion?.(slot.region);\n if (slot.shell) { slot.shell.inert = true; slot.shell.style.visibility = 'hidden'; }\n } else this.retire(slot);\n }\n if (projections.length) this.ensureDOM();\n for (const projection of projections) this.prepareClips(projection);\n for (const projection of projections) {\n const slot = projection.registration.slot;\n if ((!projection.visible || !projection.registration.interactive) && slot.region.active) {\n this.root.focusPolicy?.removeHtmlFocusRegion?.(slot.region);\n const active = this.root.canvas!.ownerDocument.activeElement;\n if (active instanceof HTMLElement && slot.content?.contains(active)) active.blur();\n }\n this.publishContent(projection);\n }\n }\n\n private adopt(): void {\n if (this.disposed) return;\n if (this.suspended) {\n if (this.viewport) this.viewport.hidden = true;\n for (const slot of this.live) { slot.region.active = false; slot.events?.suspend(); if (slot.shell) slot.shell.inert = true; }\n return;\n }\n if (!this.projections) return;\n if (this.viewport) this.viewport.hidden = false;\n for (let index = 0; index < this.projections.length; index++) this.applyGeometry(this.projections[index], index);\n this.snapshots = this.nextSnapshots!;\n }\n\n private ensureDOM(): void {\n if (this.viewport) return;\n const doc = this.root.canvas!.ownerDocument;\n this.viewport = doc.createElement('div');\n this.viewport.dataset.pibblHtmlViewport = '';\n this.viewport.style.cssText = 'position:absolute;inset:0;overflow:clip;pointer-events:none';\n this.svg = doc.createElementNS(SVG, 'svg');\n this.svg.setAttribute('width', '0'); this.svg.setAttribute('height', '0');\n this.svg.setAttribute('aria-hidden', 'true');\n this.svg.style.cssText = 'position:absolute;left:0;top:0;pointer-events:none';\n this.root.htmlOverlay!.append(this.svg, this.viewport);\n }\n\n private publishContent(projection: Projection): void {\n const r = projection.registration;\n const slot = r.slot;\n const first = !slot.shell;\n const doc = this.root.canvas!.ownerDocument;\n if (first) {\n slot.shell = doc.createElement('div'); slot.shell.dataset.pibblHtmlBox = '';\n slot.shell.style.cssText = 'position:absolute;left:0;top:0;transform-origin:0 0;pointer-events:none;isolation:isolate;opacity:0';\n slot.content = doc.createElement('div'); slot.content.dataset.pibblHtmlContent = '';\n slot.content.style.cssText = 'position:absolute;box-sizing:border-box';\n slot.shell.append(slot.content); this.viewport!.append(slot.shell);\n slot.clipping = []; slot.abort = new (doc.defaultView!.AbortController)();\n slot.region.content = slot.content;\n this.live.add(slot);\n }\n slot.events!.prepareListeners(projection.events!);\n try {\n if (first) {\n const update = withSignalWriteForbidden('HtmlBox mount', () => slot.mount(slot.content!, r.data, slot.abort!.signal));\n if (typeof update !== 'function') throw new TypeError('HtmlBox mount must synchronously return an update function.');\n slot.update = update;\n } else if (this.rendered.has(slot)) {\n const result: unknown = withSignalWriteForbidden('HtmlBox update', () => slot.update!(r.data));\n if (result && typeof (result as PromiseLike<unknown>).then === 'function') throw new TypeError('HtmlBox update must be synchronous.');\n }\n } catch (error) { this.retire(slot); throw error; }\n }\n\n private applyGeometry(projection: Projection, index: number): void {\n const { registration: r, bounds, visible, opacity } = projection;\n const slot = r.slot;\n if (slot.disposed) return;\n slot.shell!.style.width = `${r.border.width}px`; slot.shell!.style.height = `${r.border.height}px`;\n slot.shell!.style.transform = projection.transformCss!; slot.shell!.style.zIndex = String(index);\n slot.shell!.style.opacity = String(opacity); slot.shell!.style.overflow = r.overflow;\n slot.content!.style.left = `${r.content.x}px`; slot.content!.style.top = `${r.content.y}px`;\n slot.content!.style.width = `${r.content.width}px`; slot.content!.style.height = `${r.content.height}px`;\n slot.content!.style.pointerEvents = r.interactive ? 'auto' : 'none';\n slot.shell!.inert = !visible || !r.interactive;\n slot.shell!.style.visibility = visible ? 'visible' : 'hidden';\n slot.region.active = visible && r.interactive;\n slot.region.rootBounds = bounds;\n slot.callback = r.onFocusChange;\n slot.events!.adopt(projection.events!);\n if (visible) {\n const previous = slot.clipping;\n slot.clipping = projection.definitions!;\n slot.shell!.style.clipPath = projection.clipPath!;\n if (previous !== slot.clipping) for (const definition of previous ?? []) definition.remove();\n }\n }\n\n private prepareClips(projection: Projection): void {\n if (!projection.visible) return;\n const slot = projection.registration.slot;\n const clips = projection.clips;\n const previous = slot.clipping;\n let unchanged = previous?.length === clips.length;\n const matrices: string[] = [];\n for (let index = 0; index < clips.length; index++) {\n const clip = clips[index];\n matrices.push(cssMatrix(clip.matrix));\n const path = previous?.[index]?.firstElementChild;\n if (!path || path.getAttribute('d') !== clip.data || path.getAttribute('clip-rule') !== clip.rule ||\n path.getAttribute('transform') !== matrices[index]) unchanged = false;\n }\n if (unchanged) {\n projection.definitions = previous;\n projection.clipPath = clips.length ? `url(#${previous![0].id})` : 'none';\n return;\n }\n const definitions: SVGClipPathElement[] = [];\n const doc = this.root.canvas!.ownerDocument;\n for (let index = 0; index < clips.length; index++) {\n const definition = doc.createElementNS(SVG, 'clipPath');\n definition.id = `pibbl-html-clip-${++nextId}`;\n definition.setAttribute('clipPathUnits', 'userSpaceOnUse');\n const path = doc.createElementNS(SVG, 'path');\n path.setAttribute('d', clips[index].data);\n path.setAttribute('clip-rule', clips[index].rule);\n path.setAttribute('transform', matrices[index]);\n definition.append(path); definitions.push(definition);\n }\n for (let index = 0; index + 1 < definitions.length; index++) definitions[index].firstElementChild!.setAttribute('clip-path', `url(#${definitions[index + 1].id})`);\n // New definitions cannot affect the live shell until its clip-path is adopted.\n for (const definition of definitions) this.svg!.append(definition);\n projection.definitions = definitions;\n projection.clipPath = definitions.length ? `url(#${definitions[0].id})` : 'none';\n }\n\n private reset(): void {\n for (const slot of this.live) this.retire(slot);\n this.snapshots.clear();\n this.viewport?.remove(); this.svg?.remove(); this.viewport = undefined; this.svg = undefined;\n }\n dispose(): void { if (this.disposed) return; this.disposed = true; this.reset(); }\n}\n\nfunction assertEffects(composite = GLOBAL_STATE.renderContext?.globalCompositeOperation): void {\n if (GLOBAL_STATE.htmlFilterDepth || composite !== 'source-over') throw new Error('HtmlBox cannot be enclosed by Canvas filters or non-default compositing. Use CSS effects inside its content instead.');\n}\nfunction copy(matrix: DOMMatrixReadOnly): DOMMatrix { return new DOMMatrix([matrix.a,matrix.b,matrix.c,matrix.d,matrix.e,matrix.f]); }\nexport function snapshotClips(clips: readonly PibblClippingStackEntry[]): PibblClippingStackEntry[] {\n return clips.map(clip => ({ ...clip, transform: copy(clip.transform) }));\n}\nfunction cssMatrix(m: DOMMatrixReadOnly): string { return `matrix(${m.a},${m.b},${m.c},${m.d},${m.e},${m.f})`; }\n\n\n/** Settle all fallible numeric projection work before publishing any host. */\nfunction prepareProjection(registration: HtmlBoxRegistration, world: DOMMatrix, rootMatrix: DOMMatrix, clips: Clip[], opacity: number): Projection {\n const matrix = rootMatrix.multiply(world);\n assertFiniteProjectionMatrix(matrix);\n const width = registration.border.width;\n const height = registration.border.height;\n let minX = Infinity, minY = Infinity, maxX = -Infinity, maxY = -Infinity;\n for (let space = 0; space < 2; space++) {\n const transform = space === 0 ? world : matrix;\n let left = Infinity, top = Infinity, right = -Infinity, bottom = -Infinity;\n for (let corner = 0; corner < 4; corner++) {\n const x = corner & 1 ? width : 0;\n const y = corner & 2 ? height : 0;\n const projectedX = transform.a * x + transform.c * y + transform.e;\n const projectedY = transform.b * x + transform.d * y + transform.f;\n if (!Number.isFinite(projectedX) || !Number.isFinite(projectedY)) throw new Error('HtmlBox projection must be finite.');\n left = Math.min(left, projectedX); top = Math.min(top, projectedY);\n right = Math.max(right, projectedX); bottom = Math.max(bottom, projectedY);\n }\n if (!Number.isFinite(right - left) || !Number.isFinite(bottom - top)) throw new Error('HtmlBox projection must be finite.');\n if (space === 0) { minX = left; minY = top; maxX = right; maxY = bottom; }\n }\n const bounds = { x: minX, y: minY, width: maxX - minX, height: maxY - minY };\n if (!Number.isFinite(bounds.width) || !Number.isFinite(bounds.height)) throw new Error('HtmlBox projection must be finite.');\n const determinant = matrix.a * matrix.d - matrix.b * matrix.c;\n if (Number.isNaN(determinant)) throw new Error('HtmlBox projection must be finite.');\n const visible = width > 0 && height > 0 && determinant !== 0;\n const localClips: Clip[] = [];\n if (visible && clips.length) {\n const inverse = world.inverse();\n assertFiniteProjectionMatrix(inverse);\n for (const clip of clips) {\n const local = inverse.multiply(clip.matrix);\n assertFiniteProjectionMatrix(local);\n localClips.push({ data: clip.data, rule: clip.rule, matrix: local });\n }\n }\n return { registration, world, rootMatrix, matrix, bounds, visible, clips: localClips, opacity };\n}\nfunction assertFiniteProjectionMatrix(matrix: DOMMatrixReadOnly): void {\n if (!(Number.isFinite(matrix.a) && Number.isFinite(matrix.b) && Number.isFinite(matrix.c) && Number.isFinite(matrix.d) && Number.isFinite(matrix.e) && Number.isFinite(matrix.f))) throw new Error('HtmlBox projection must be finite.');\n}\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,wBAAsD;AAC/D,SAAS,+BAA+B;AACxC,SAAS,4BAA4B,iCAAiC;AACtE,SAAS,oBAAoB;AAC7B,SAAS,gCAAgC;AAGzC,SAAS,2BAA2B;AACpC,SAAS,oBAAoB;AAE7B,MAAM,MAAM;AACZ,IAAI,SAAS;AAKN,SAAS,mBAAmB,OAAmC;AACpE,QAAM,OAAO,MAAM;AACnB,MAAI,CAAC,KAAK,eAAe,CAAC,KAAK,OAAQ,OAAM,IAAI,MAAM,yEAAyE;AAChI,SAAQ,KAAK,SAAS,IAAI,YAAY,IAAI;AAC5C;AAEO,MAAM,YAAkC;AAAA,EAY7C,YAA6B,MAAsB;AAAtB;AAAA,EAAuB;AAAA,EAAvB;AAAA,EAXrB,YAAY,oBAAI,IAA4B;AAAA,EAC5C;AAAA,EACA;AAAA,EACA,OAAO,oBAAI,IAAiB;AAAA,EAC5B;AAAA,EACA;AAAA,EACA,WAAW;AAAA,EACX,YAAY;AAAA,EACZ;AAAA,EACA;AAAA,EACA,WAAW,oBAAI,IAAiB;AAAA,EAGhC,mBAAyB;AAC/B,UAAM,cAAc,KAAK,KAAK;AAC9B,QAAI,CAAC,YAAa,OAAM,IAAI,MAAM,gDAAgD;AAClF,QAAI,gBAAgB,KAAK,YAAa;AACtC,SAAK,cAAc;AACnB,SAAK,UAAU,IAAI,IAAI,KAAK,SAAS;AACrC,SAAK,WAAW,oBAAI,IAAI;AACxB,SAAK,YAAY;AACjB,gBAAY,YAAa,MAAM,KAAK,QAAQ,CAAC;AAC7C,gBAAY,UAAW,MAAM,KAAK,QAAQ,CAAC;AAC3C,gBAAY,QAAS,MAAM,KAAK,MAAM,CAAC;AACvC,gBAAY,SAAS,aAAW;AAC9B,UAAI,CAAC,WAAW,Y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OAAO,SAAS,OAAO,MAAM,EAAG,OAAM,IAAI,MAAM,oCAAoC;AAC3H,QAAM,cAAc,OAAO,IAAI,OAAO,IAAI,OAAO,IAAI,OAAO;AAC5D,MAAI,OAAO,MAAM,WAAW,EAAG,OAAM,IAAI,MAAM,oCAAoC;AACnF,QAAM,UAAU,QAAQ,KAAK,SAAS,KAAK,gBAAgB;AAC3D,QAAM,aAAqB,CAAC;AAC5B,MAAI,WAAW,MAAM,QAAQ;AAC3B,UAAM,UAAU,MAAM,QAAQ;AAC9B,iCAA6B,OAAO;AACpC,eAAW,QAAQ,OAAO;AACxB,YAAM,QAAQ,QAAQ,SAAS,KAAK,MAAM;AAC1C,mCAA6B,KAAK;AAClC,iBAAW,KAAK,EAAE,MAAM,KAAK,MAAM,MAAM,KAAK,MAAM,QAAQ,MAAM,CAAC;AAAA,IACrE;AAAA,EACF;AACA,SAAO,EAAE,cAAc,OAAO,YAAY,QAAQ,QAAQ,SAAS,OAAO,YAAY,QAAQ;AAChG;AACA,SAAS,6BAA6B,QAAiC;AACrE,MAAI,EAAE,OAAO,SAAS,OAAO,CAAC,KAAK,OAAO,SAAS,OAAO,CAAC,KAAK,OAAO,SAAS,OAAO,CAAC,KAAK,OAAO,SAAS,OAAO,CAAC,KAAK,OAAO,SAAS,OAAO,CAAC,KAAK,OAAO,SAAS,OAAO,CAAC,GAAI,OAAM,IAAI,MAAM,oCAAoC;AACzO;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -20,16 +20,17 @@ function validateHtmlOverlay(canvas, overlay) {
|
|
|
20
20
|
if (!canvas.isConnected || !overlay.isConnected || canvas.parentElement !== overlay.parentElement || canvas.nextElementSibling !== overlay) {
|
|
21
21
|
throw new Error("HtmlBox overlay and canvas must remain connected adjacent siblings.");
|
|
22
22
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
if (style.transform !== "none" || ["paddingLeft", "paddingRight", "paddingTop", "paddingBottom", "borderLeftWidth", "borderRightWidth", "borderTopWidth", "borderBottomWidth"].some((key) => parseFloat(style[key]) !== 0)) {
|
|
26
|
-
throw new Error("HtmlBox canvas and overlay must have no independent CSS transform, padding, or border. Style their common wrapper instead.");
|
|
27
|
-
}
|
|
28
|
-
}
|
|
23
|
+
validateOverlayElement(view.getComputedStyle(canvas));
|
|
24
|
+
validateOverlayElement(view.getComputedStyle(overlay));
|
|
29
25
|
if (Math.abs(canvas.clientWidth - overlay.clientWidth) > 1 || Math.abs(canvas.clientHeight - overlay.clientHeight) > 1 || canvas.offsetLeft !== overlay.offsetLeft || canvas.offsetTop !== overlay.offsetTop) {
|
|
30
26
|
throw new Error("HtmlBox overlay must share the canvas content rectangle.");
|
|
31
27
|
}
|
|
32
28
|
}
|
|
29
|
+
function validateOverlayElement(style) {
|
|
30
|
+
if (style.transform !== "none" || parseFloat(style.paddingLeft) !== 0 || parseFloat(style.paddingRight) !== 0 || parseFloat(style.paddingTop) !== 0 || parseFloat(style.paddingBottom) !== 0 || parseFloat(style.borderLeftWidth) !== 0 || parseFloat(style.borderRightWidth) !== 0 || parseFloat(style.borderTopWidth) !== 0 || parseFloat(style.borderBottomWidth) !== 0) {
|
|
31
|
+
throw new Error("HtmlBox canvas and overlay must have no independent CSS transform, padding, or border. Style their common wrapper instead.");
|
|
32
|
+
}
|
|
33
|
+
}
|
|
33
34
|
export {
|
|
34
35
|
reserveHtmlOverlay,
|
|
35
36
|
validateHtmlOverlay
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/lib/html/overlay-config.ts"],
|
|
4
|
-
"sourcesContent": ["import type { PibblInstance } from '../types.js';\n\nconst leases = new WeakMap<HTMLElement, PibblInstance>();\n\nexport function reserveHtmlOverlay(instance: PibblInstance, overlay: HTMLElement): void {\n const canvas = instance.eventRoot.canvas;\n if (!canvas || instance.parent) throw new Error('htmlOverlay requires an HTMLCanvasElement root, not a Layer.');\n if (overlay?.nodeType !== 1 || overlay.namespaceURI !== 'http://www.w3.org/1999/xhtml' ||\n overlay.ownerDocument !== canvas.ownerDocument || !overlay.isConnected || !canvas.isConnected ||\n canvas.parentElement !== overlay.parentElement || canvas.nextElementSibling !== overlay) {\n throw new Error('htmlOverlay must be a connected HTML element immediately after the canvas in the same parent and document.');\n }\n if (leases.has(overlay) || overlay.childNodes.length) throw new Error('htmlOverlay must be empty and exclusively owned by one Pibbl root.');\n leases.set(overlay, instance);\n instance.eventRoot.htmlOverlay = overlay;\n instance.mainTeardowns.add(() => {\n instance.eventRoot.html?.dispose();\n instance.eventRoot.html = undefined;\n instance.eventRoot.htmlOverlay = undefined;\n if (leases.get(overlay) === instance) leases.delete(overlay);\n });\n}\n\nexport function validateHtmlOverlay(canvas: HTMLCanvasElement, overlay: HTMLElement): void {\n const view = canvas.ownerDocument.defaultView!;\n if (!canvas.isConnected || !overlay.isConnected || canvas.parentElement !== overlay.parentElement || canvas.nextElementSibling !== overlay) {\n throw new Error('HtmlBox overlay and canvas must remain connected adjacent siblings.');\n }\n
|
|
5
|
-
"mappings": "AAEA,MAAM,SAAS,oBAAI,QAAoC;AAEhD,SAAS,mBAAmB,UAAyB,SAA4B;AACtF,QAAM,SAAS,SAAS,UAAU;AAClC,MAAI,CAAC,UAAU,SAAS,OAAQ,OAAM,IAAI,MAAM,8DAA8D;AAC9G,MAAI,SAAS,aAAa,KAAK,QAAQ,iBAAiB,kCACpD,QAAQ,kBAAkB,OAAO,iBAAiB,CAAC,QAAQ,eAAe,CAAC,OAAO,eAClF,OAAO,kBAAkB,QAAQ,iBAAiB,OAAO,uBAAuB,SAAS;AAC3F,UAAM,IAAI,MAAM,4GAA4G;AAAA,EAC9H;AACA,MAAI,OAAO,IAAI,OAAO,KAAK,QAAQ,WAAW,OAAQ,OAAM,IAAI,MAAM,oEAAoE;AAC1I,SAAO,IAAI,SAAS,QAAQ;AAC5B,WAAS,UAAU,cAAc;AACjC,WAAS,cAAc,IAAI,MAAM;AAC/B,aAAS,UAAU,MAAM,QAAQ;AACjC,aAAS,UAAU,OAAO;AAC1B,aAAS,UAAU,cAAc;AACjC,QAAI,OAAO,IAAI,OAAO,MAAM,SAAU,QAAO,OAAO,OAAO;AAAA,EAC7D,CAAC;AACH;AAEO,SAAS,oBAAoB,QAA2B,SAA4B;AACzF,QAAM,OAAO,OAAO,cAAc;AAClC,MAAI,CAAC,OAAO,eAAe,CAAC,QAAQ,eAAe,OAAO,kBAAkB,QAAQ,iBAAiB,OAAO,uBAAuB,SAAS;AAC1I,UAAM,IAAI,MAAM,qEAAqE;AAAA,EACvF;AACA,
|
|
4
|
+
"sourcesContent": ["import type { PibblInstance } from '../types.js';\n\nconst leases = new WeakMap<HTMLElement, PibblInstance>();\n\nexport function reserveHtmlOverlay(instance: PibblInstance, overlay: HTMLElement): void {\n const canvas = instance.eventRoot.canvas;\n if (!canvas || instance.parent) throw new Error('htmlOverlay requires an HTMLCanvasElement root, not a Layer.');\n if (overlay?.nodeType !== 1 || overlay.namespaceURI !== 'http://www.w3.org/1999/xhtml' ||\n overlay.ownerDocument !== canvas.ownerDocument || !overlay.isConnected || !canvas.isConnected ||\n canvas.parentElement !== overlay.parentElement || canvas.nextElementSibling !== overlay) {\n throw new Error('htmlOverlay must be a connected HTML element immediately after the canvas in the same parent and document.');\n }\n if (leases.has(overlay) || overlay.childNodes.length) throw new Error('htmlOverlay must be empty and exclusively owned by one Pibbl root.');\n leases.set(overlay, instance);\n instance.eventRoot.htmlOverlay = overlay;\n instance.mainTeardowns.add(() => {\n instance.eventRoot.html?.dispose();\n instance.eventRoot.html = undefined;\n instance.eventRoot.htmlOverlay = undefined;\n if (leases.get(overlay) === instance) leases.delete(overlay);\n });\n}\n\nexport function validateHtmlOverlay(canvas: HTMLCanvasElement, overlay: HTMLElement): void {\n const view = canvas.ownerDocument.defaultView!;\n if (!canvas.isConnected || !overlay.isConnected || canvas.parentElement !== overlay.parentElement || canvas.nextElementSibling !== overlay) {\n throw new Error('HtmlBox overlay and canvas must remain connected adjacent siblings.');\n }\n validateOverlayElement(view.getComputedStyle(canvas));\n validateOverlayElement(view.getComputedStyle(overlay));\n if (Math.abs(canvas.clientWidth - overlay.clientWidth) > 1 || Math.abs(canvas.clientHeight - overlay.clientHeight) > 1 || canvas.offsetLeft !== overlay.offsetLeft || canvas.offsetTop !== overlay.offsetTop) {\n throw new Error('HtmlBox overlay must share the canvas content rectangle.');\n }\n}\n\nfunction validateOverlayElement(style: CSSStyleDeclaration): void {\n if (\n style.transform !== 'none' ||\n parseFloat(style.paddingLeft) !== 0 || parseFloat(style.paddingRight) !== 0 ||\n parseFloat(style.paddingTop) !== 0 || parseFloat(style.paddingBottom) !== 0 ||\n parseFloat(style.borderLeftWidth) !== 0 || parseFloat(style.borderRightWidth) !== 0 ||\n parseFloat(style.borderTopWidth) !== 0 || parseFloat(style.borderBottomWidth) !== 0\n ) {\n throw new Error('HtmlBox canvas and overlay must have no independent CSS transform, padding, or border. Style their common wrapper instead.');\n }\n}\n"],
|
|
5
|
+
"mappings": "AAEA,MAAM,SAAS,oBAAI,QAAoC;AAEhD,SAAS,mBAAmB,UAAyB,SAA4B;AACtF,QAAM,SAAS,SAAS,UAAU;AAClC,MAAI,CAAC,UAAU,SAAS,OAAQ,OAAM,IAAI,MAAM,8DAA8D;AAC9G,MAAI,SAAS,aAAa,KAAK,QAAQ,iBAAiB,kCACpD,QAAQ,kBAAkB,OAAO,iBAAiB,CAAC,QAAQ,eAAe,CAAC,OAAO,eAClF,OAAO,kBAAkB,QAAQ,iBAAiB,OAAO,uBAAuB,SAAS;AAC3F,UAAM,IAAI,MAAM,4GAA4G;AAAA,EAC9H;AACA,MAAI,OAAO,IAAI,OAAO,KAAK,QAAQ,WAAW,OAAQ,OAAM,IAAI,MAAM,oEAAoE;AAC1I,SAAO,IAAI,SAAS,QAAQ;AAC5B,WAAS,UAAU,cAAc;AACjC,WAAS,cAAc,IAAI,MAAM;AAC/B,aAAS,UAAU,MAAM,QAAQ;AACjC,aAAS,UAAU,OAAO;AAC1B,aAAS,UAAU,cAAc;AACjC,QAAI,OAAO,IAAI,OAAO,MAAM,SAAU,QAAO,OAAO,OAAO;AAAA,EAC7D,CAAC;AACH;AAEO,SAAS,oBAAoB,QAA2B,SAA4B;AACzF,QAAM,OAAO,OAAO,cAAc;AAClC,MAAI,CAAC,OAAO,eAAe,CAAC,QAAQ,eAAe,OAAO,kBAAkB,QAAQ,iBAAiB,OAAO,uBAAuB,SAAS;AAC1I,UAAM,IAAI,MAAM,qEAAqE;AAAA,EACvF;AACA,yBAAuB,KAAK,iBAAiB,MAAM,CAAC;AACpD,yBAAuB,KAAK,iBAAiB,OAAO,CAAC;AACrD,MAAI,KAAK,IAAI,OAAO,cAAc,QAAQ,WAAW,IAAI,KAAK,KAAK,IAAI,OAAO,eAAe,QAAQ,YAAY,IAAI,KAAK,OAAO,eAAe,QAAQ,cAAc,OAAO,cAAc,QAAQ,WAAW;AAC5M,UAAM,IAAI,MAAM,0DAA0D;AAAA,EAC5E;AACF;AAEA,SAAS,uBAAuB,OAAkC;AAChE,MACE,MAAM,cAAc,UACpB,WAAW,MAAM,WAAW,MAAM,KAAK,WAAW,MAAM,YAAY,MAAM,KAC1E,WAAW,MAAM,UAAU,MAAM,KAAK,WAAW,MAAM,aAAa,MAAM,KAC1E,WAAW,MAAM,eAAe,MAAM,KAAK,WAAW,MAAM,gBAAgB,MAAM,KAClF,WAAW,MAAM,cAAc,MAAM,KAAK,WAAW,MAAM,iBAAiB,MAAM,GAClF;AACE,UAAM,IAAI,MAAM,4HAA4H;AAAA,EAC9I;AACJ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/lib/html/types.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import type { HtmlBox } from "../components/html-box.js";
|
|
2
|
+
import type { PibblEventHandlers } from '../events/types.js';
|
|
3
|
+
import type { HtmlNativeEvents } from './html-events.js';
|
|
2
4
|
import type { GStyle } from '../components/g.js';
|
|
3
5
|
import type { HtmlFocusRegion } from '../focus/html-focus-region.js';
|
|
4
|
-
import type { PibblClippingStackEntry, PibblInstance, PibblInteractionLayer } from '../types.js';
|
|
6
|
+
import type { PibblClippingStackEntry, PibblComponentRefs, PibblInstance, PibblInteractionLayer } from '../types.js';
|
|
5
7
|
import type { LayoutBox } from '../layout/types.js';
|
|
6
8
|
/**
|
|
7
9
|
* Updates mounted application HTML when the owning HtmlBox receives new props.
|
|
@@ -40,6 +42,27 @@ export interface HtmlBoxFocusState {
|
|
|
40
42
|
/** Whether focus should be presented as keyboard-visible. See {@link HtmlBoxFocusState}. */
|
|
41
43
|
readonly isFocusVisible: boolean;
|
|
42
44
|
}
|
|
45
|
+
type HtmlBoxEvent<Event> = Event extends {
|
|
46
|
+
readonly x: number;
|
|
47
|
+
readonly y: number;
|
|
48
|
+
} ? Event & {
|
|
49
|
+
readonly localX: number;
|
|
50
|
+
readonly localY: number;
|
|
51
|
+
} : Event;
|
|
52
|
+
/**
|
|
53
|
+
* Optional native event callbacks using Pibbl event names and capture/bubble phases.
|
|
54
|
+
* Coordinate events retain root-logical x/y and add border-local localX/localY,
|
|
55
|
+
* before padding and independent of the current ancestor handler. The originalEvent
|
|
56
|
+
* retains the real DOM target; target/currentTarget identify the logical Pibbl path.
|
|
57
|
+
* Native editing, cancellation and pointer capture remain browser-owned.
|
|
58
|
+
*
|
|
59
|
+
* @see {@link PibblEventHandlers}
|
|
60
|
+
* @see {@link HtmlBoxProps}
|
|
61
|
+
* @see {@link HtmlBox}
|
|
62
|
+
*/
|
|
63
|
+
export type HtmlBoxEventHandlers = {
|
|
64
|
+
[Key in keyof PibblEventHandlers]: (event: HtmlBoxEvent<Parameters<NonNullable<PibblEventHandlers[Key]>>[0]>) => void;
|
|
65
|
+
};
|
|
43
66
|
/**
|
|
44
67
|
* Props for a DOM-hosting region, including mount ownership, updates, and focus behavior.
|
|
45
68
|
*
|
|
@@ -47,7 +70,7 @@ export interface HtmlBoxFocusState {
|
|
|
47
70
|
* @see {@link HtmlBoxFocusState}
|
|
48
71
|
* @see {@link HtmlBox}
|
|
49
72
|
*/
|
|
50
|
-
export interface HtmlBoxProps<Props> {
|
|
73
|
+
export interface HtmlBoxProps<Props> extends HtmlBoxEventHandlers {
|
|
51
74
|
/**
|
|
52
75
|
* Application data supplied to the component or reported by the event. See {@link HtmlBoxProps}
|
|
53
76
|
* .
|
|
@@ -82,6 +105,7 @@ export interface HtmlBridge {
|
|
|
82
105
|
}
|
|
83
106
|
export interface HtmlBoxRegistration {
|
|
84
107
|
slot: HtmlBoxSlot;
|
|
108
|
+
handlers: HtmlBoxEventHandlers;
|
|
85
109
|
data: unknown;
|
|
86
110
|
matrix: DOMMatrix;
|
|
87
111
|
clips: readonly PibblClippingStackEntry[];
|
|
@@ -93,8 +117,10 @@ export interface HtmlBoxRegistration {
|
|
|
93
117
|
onFocusChange?: (state: Readonly<HtmlBoxFocusState>) => void;
|
|
94
118
|
}
|
|
95
119
|
export interface HtmlBoxSlot {
|
|
120
|
+
readonly component: PibblComponentRefs<any>;
|
|
96
121
|
readonly owner: PibblInstance;
|
|
97
122
|
readonly mount: HtmlMountCallback<unknown>;
|
|
123
|
+
events?: HtmlNativeEvents;
|
|
98
124
|
region: HtmlFocusRegion & {
|
|
99
125
|
content: HTMLDivElement | undefined;
|
|
100
126
|
rootBounds: Readonly<LayoutBox> | undefined;
|
|
@@ -108,3 +134,4 @@ export interface HtmlBoxSlot {
|
|
|
108
134
|
disposed: boolean;
|
|
109
135
|
callback?: (state: Readonly<HtmlBoxFocusState>) => void;
|
|
110
136
|
}
|
|
137
|
+
export {};
|