@pibbl/core 0.0.2 → 0.0.3-alpha.109.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/THIRD_PARTY_NOTICES.txt +81 -0
- package/dist/features/physics/2d-testing.d.ts +1 -1
- package/dist/features/physics/2d-testing.js +2 -2
- package/dist/features/physics/2d-testing.js.map +2 -2
- package/dist/features/physics/lib/2d/canvas/components.js +25 -21
- package/dist/features/physics/lib/2d/canvas/components.js.map +2 -2
- package/dist/features/physics/lib/2d/canvas/presentation.js +1 -2
- package/dist/features/physics/lib/2d/canvas/presentation.js.map +2 -2
- package/dist/features/physics/lib/2d/collision/casts.js +4 -2
- package/dist/features/physics/lib/2d/collision/casts.js.map +2 -2
- package/dist/features/physics/lib/2d/runtime/controller.js +1 -1
- package/dist/features/physics/lib/2d/runtime/controller.js.map +2 -2
- package/dist/features/physics/lib/2d/runtime/obstacles.js +9 -11
- package/dist/features/physics/lib/2d/runtime/obstacles.js.map +2 -2
- package/dist/features/physics/lib/2d/shapes.js +8 -9
- package/dist/features/physics/lib/2d/shapes.js.map +2 -2
- package/dist/features/physics/lib/2d/world/rapier.js +22 -26
- package/dist/features/physics/lib/2d/world/rapier.js.map +2 -2
- package/dist/features/sprites/loader.js +6 -3
- package/dist/features/sprites/loader.js.map +2 -2
- package/dist/features/textures/index.d.ts +12 -2
- package/dist/features/textures/index.js +33 -1
- package/dist/features/textures/index.js.map +2 -2
- package/dist/features/textures/lib/chemical-field.d.ts +56 -0
- package/dist/features/textures/lib/chemical-field.js +154 -0
- package/dist/features/textures/lib/chemical-field.js.map +7 -0
- package/dist/features/textures/lib/chemical-recipes.d.ts +119 -0
- package/dist/features/textures/lib/chemical-recipes.js +275 -0
- package/dist/features/textures/lib/chemical-recipes.js.map +7 -0
- package/dist/features/textures/lib/definitions.d.ts +3 -18
- package/dist/features/textures/lib/definitions.js +17 -24
- package/dist/features/textures/lib/definitions.js.map +2 -2
- package/dist/features/textures/lib/geometric-patterns.d.ts +149 -0
- package/dist/features/textures/lib/geometric-patterns.js +305 -0
- package/dist/features/textures/lib/geometric-patterns.js.map +7 -0
- package/dist/features/textures/lib/gray-scott.d.ts +55 -0
- package/dist/features/textures/lib/gray-scott.js +37 -0
- package/dist/features/textures/lib/gray-scott.js.map +7 -0
- package/dist/features/textures/lib/palette.js +1 -3
- package/dist/features/textures/lib/palette.js.map +2 -2
- package/dist/features/textures/lib/patterns.d.ts +123 -0
- package/dist/features/textures/lib/patterns.js +344 -0
- package/dist/features/textures/lib/patterns.js.map +7 -0
- package/dist/features/textures/lib/rain-drops.js +2 -1
- package/dist/features/textures/lib/rain-drops.js.map +2 -2
- package/dist/features/textures/lib/reaction-diffusion.d.ts +3 -2
- package/dist/features/textures/lib/reaction-diffusion.js +9 -20
- package/dist/features/textures/lib/reaction-diffusion.js.map +2 -2
- package/dist/features/textures/lib/simulation.d.ts +10 -4
- package/dist/features/textures/lib/simulation.js +23 -13
- package/dist/features/textures/lib/simulation.js.map +2 -2
- package/dist/features/textures/lib/wasm/electric.js +8 -1
- package/dist/features/textures/lib/wasm/electric.js.map +2 -2
- package/dist/features/textures/lib/water-surface.js +1 -3
- package/dist/features/textures/lib/water-surface.js.map +2 -2
- package/dist/features/viz/index.d.ts +68 -6
- package/dist/features/viz/index.js +164 -2
- package/dist/features/viz/index.js.map +2 -2
- package/dist/features/viz/inspection/bar.d.ts +79 -0
- package/dist/features/viz/inspection/bar.js +49 -0
- package/dist/features/viz/inspection/bar.js.map +7 -0
- package/dist/features/viz/inspection/candle.d.ts +156 -0
- package/dist/features/viz/inspection/candle.js +120 -0
- package/dist/features/viz/inspection/candle.js.map +7 -0
- package/dist/features/viz/inspection/capture-types.d.ts +65 -0
- package/dist/features/viz/inspection/capture.d.ts +16 -0
- package/dist/features/viz/inspection/capture.js +49 -0
- package/dist/features/viz/inspection/capture.js.map +7 -0
- package/dist/features/viz/inspection/handler.d.ts +36 -0
- package/dist/features/viz/inspection/handler.js +91 -0
- package/dist/features/viz/inspection/handler.js.map +7 -0
- package/dist/features/viz/inspection/ohlc-bar.d.ts +132 -0
- package/dist/features/viz/inspection/ohlc-bar.js +118 -0
- package/dist/features/viz/inspection/ohlc-bar.js.map +7 -0
- package/dist/features/viz/inspection/owned-ref.d.ts +16 -0
- package/dist/features/viz/inspection/owned-ref.js +99 -0
- package/dist/features/viz/inspection/owned-ref.js.map +7 -0
- package/dist/features/viz/inspection/painted-point.d.ts +22 -0
- package/dist/features/viz/inspection/painted-point.js +29 -0
- package/dist/features/viz/inspection/painted-point.js.map +7 -0
- package/dist/features/viz/inspection/queries.d.ts +100 -0
- package/dist/features/viz/inspection/queries.js +192 -0
- package/dist/features/viz/inspection/queries.js.map +7 -0
- package/dist/features/viz/inspection/query-types.d.ts +177 -0
- package/dist/features/viz/inspection/volume.d.ts +104 -0
- package/dist/features/viz/inspection/volume.js +95 -0
- package/dist/features/viz/inspection/volume.js.map +7 -0
- package/dist/features/viz/inspection.d.ts +19 -0
- package/dist/features/viz/inspection.js +54 -0
- package/dist/features/viz/inspection.js.map +7 -0
- package/dist/features/viz/inspection.mjs +1 -0
- package/dist/features/viz/lib/area-series.d.ts +62 -0
- package/dist/features/viz/lib/area-series.js +120 -0
- package/dist/features/viz/lib/area-series.js.map +7 -0
- package/dist/features/viz/lib/axis-title.js +2 -1
- package/dist/features/viz/lib/axis-title.js.map +2 -2
- package/dist/features/viz/lib/axis.js +1 -1
- package/dist/features/viz/lib/axis.js.map +2 -2
- package/dist/features/viz/lib/bar-series.d.ts +3 -1
- package/dist/features/viz/lib/bar-series.js +16 -1
- package/dist/features/viz/lib/bar-series.js.map +2 -2
- package/dist/features/viz/lib/baseline-series.d.ts +55 -0
- package/dist/features/viz/lib/baseline-series.js +136 -0
- package/dist/features/viz/lib/baseline-series.js.map +7 -0
- package/dist/features/viz/lib/candlestick-series.d.ts +62 -0
- package/dist/features/viz/lib/candlestick-series.js +150 -0
- package/dist/features/viz/lib/candlestick-series.js.map +7 -0
- package/dist/features/viz/lib/censored-point-series.d.ts +71 -0
- package/dist/features/viz/lib/censored-point-series.js +129 -0
- package/dist/features/viz/lib/censored-point-series.js.map +7 -0
- package/dist/features/viz/lib/color-context.d.ts +4 -0
- package/dist/features/viz/lib/color-context.js +41 -0
- package/dist/features/viz/lib/color-context.js.map +7 -0
- package/dist/features/viz/lib/color-math.d.ts +4 -0
- package/dist/features/viz/lib/color-math.js +31 -0
- package/dist/features/viz/lib/color-math.js.map +7 -0
- package/dist/features/viz/lib/color-types.d.ts +53 -0
- package/dist/features/viz/lib/curve-definition.d.ts +49 -0
- package/dist/features/viz/lib/curve-definition.js +142 -0
- package/dist/features/viz/lib/curve-definition.js.map +7 -0
- package/dist/features/viz/lib/diverging-color-scale.d.ts +11 -0
- package/dist/features/viz/lib/diverging-color-scale.js +51 -0
- package/dist/features/viz/lib/diverging-color-scale.js.map +7 -0
- package/dist/features/viz/lib/domain-navigation.d.ts +40 -0
- package/dist/features/viz/lib/domain-navigation.js +77 -0
- package/dist/features/viz/lib/domain-navigation.js.map +7 -0
- package/dist/features/viz/lib/editable-chart-elements.d.ts +178 -0
- package/dist/features/viz/lib/editable-chart-elements.js +733 -0
- package/dist/features/viz/lib/editable-chart-elements.js.map +7 -0
- package/dist/features/viz/lib/financial-aggregation.d.ts +127 -0
- package/dist/features/viz/lib/financial-aggregation.js +116 -0
- package/dist/features/viz/lib/financial-aggregation.js.map +7 -0
- package/dist/features/viz/lib/financial-autoscale.d.ts +64 -0
- package/dist/features/viz/lib/financial-autoscale.js +61 -0
- package/dist/features/viz/lib/financial-autoscale.js.map +7 -0
- package/dist/features/viz/lib/financial-comparison.d.ts +62 -0
- package/dist/features/viz/lib/financial-comparison.js +98 -0
- package/dist/features/viz/lib/financial-comparison.js.map +7 -0
- package/dist/features/viz/lib/financial-geometry.d.ts +77 -0
- package/dist/features/viz/lib/financial-geometry.js +67 -0
- package/dist/features/viz/lib/financial-geometry.js.map +7 -0
- package/dist/features/viz/lib/financial-indicators.d.ts +114 -0
- package/dist/features/viz/lib/financial-indicators.js +135 -0
- package/dist/features/viz/lib/financial-indicators.js.map +7 -0
- package/dist/features/viz/lib/financial-oscillators.d.ts +171 -0
- package/dist/features/viz/lib/financial-oscillators.js +265 -0
- package/dist/features/viz/lib/financial-oscillators.js.map +7 -0
- package/dist/features/viz/lib/graph/bipartite.d.ts +14 -0
- package/dist/features/viz/lib/graph/bipartite.js +250 -0
- package/dist/features/viz/lib/graph/bipartite.js.map +7 -0
- package/dist/features/viz/lib/graph/chord.d.ts +44 -0
- package/dist/features/viz/lib/graph/chord.js +348 -0
- package/dist/features/viz/lib/graph/chord.js.map +7 -0
- package/dist/features/viz/lib/graph/dependency.d.ts +26 -0
- package/dist/features/viz/lib/graph/dependency.js +140 -0
- package/dist/features/viz/lib/graph/dependency.js.map +7 -0
- package/dist/features/viz/lib/graph/force.d.ts +28 -0
- package/dist/features/viz/lib/graph/force.js +580 -0
- package/dist/features/viz/lib/graph/force.js.map +7 -0
- package/dist/features/viz/lib/graph/hierarchy.d.ts +21 -0
- package/dist/features/viz/lib/graph/hierarchy.js +112 -0
- package/dist/features/viz/lib/graph/hierarchy.js.map +7 -0
- package/dist/features/viz/lib/graph/icicle.d.ts +16 -0
- package/dist/features/viz/lib/graph/icicle.js +153 -0
- package/dist/features/viz/lib/graph/icicle.js.map +7 -0
- package/dist/features/viz/lib/graph/matrix.d.ts +30 -0
- package/dist/features/viz/lib/graph/matrix.js +243 -0
- package/dist/features/viz/lib/graph/matrix.js.map +7 -0
- package/dist/features/viz/lib/graph/neighborhood.d.ts +11 -0
- package/dist/features/viz/lib/graph/neighborhood.js +281 -0
- package/dist/features/viz/lib/graph/neighborhood.js.map +7 -0
- package/dist/features/viz/lib/graph/routes.d.ts +35 -0
- package/dist/features/viz/lib/graph/routes.js +101 -0
- package/dist/features/viz/lib/graph/routes.js.map +7 -0
- package/dist/features/viz/lib/graph/sankey.d.ts +44 -0
- package/dist/features/viz/lib/graph/sankey.js +341 -0
- package/dist/features/viz/lib/graph/sankey.js.map +7 -0
- package/dist/features/viz/lib/graph/shared.d.ts +59 -0
- package/dist/features/viz/lib/graph/shared.js +301 -0
- package/dist/features/viz/lib/graph/shared.js.map +7 -0
- package/dist/features/viz/lib/graph/tree.d.ts +11 -0
- package/dist/features/viz/lib/graph/tree.js +232 -0
- package/dist/features/viz/lib/graph/tree.js.map +7 -0
- package/dist/features/viz/lib/graph/treemap.d.ts +20 -0
- package/dist/features/viz/lib/graph/treemap.js +227 -0
- package/dist/features/viz/lib/graph/treemap.js.map +7 -0
- package/dist/features/viz/lib/graph/types.d.ts +1097 -0
- package/dist/features/viz/lib/hover-card.js +8 -9
- package/dist/features/viz/lib/hover-card.js.map +2 -2
- package/dist/features/viz/lib/hover-data.d.ts +1 -1
- package/dist/features/viz/lib/hover-data.js +5 -2
- package/dist/features/viz/lib/hover-data.js.map +2 -2
- package/dist/features/viz/lib/interval-band-series.d.ts +49 -0
- package/dist/features/viz/lib/interval-band-series.js +136 -0
- package/dist/features/viz/lib/interval-band-series.js.map +7 -0
- package/dist/features/viz/lib/interval-diamond-series.d.ts +43 -0
- package/dist/features/viz/lib/interval-diamond-series.js +122 -0
- package/dist/features/viz/lib/interval-diamond-series.js.map +7 -0
- package/dist/features/viz/lib/interval-series.d.ts +79 -0
- package/dist/features/viz/lib/interval-series.js +158 -0
- package/dist/features/viz/lib/interval-series.js.map +7 -0
- package/dist/features/viz/lib/layout-pie.js +9 -13
- package/dist/features/viz/lib/layout-pie.js.map +2 -2
- package/dist/features/viz/lib/line-series.d.ts +1 -1
- package/dist/features/viz/lib/line-series.js +47 -28
- package/dist/features/viz/lib/line-series.js.map +2 -2
- package/dist/features/viz/lib/linear-scale.js +1 -1
- package/dist/features/viz/lib/linear-scale.js.map +2 -2
- package/dist/features/viz/lib/monotone-curve.d.ts +11 -0
- package/dist/features/viz/lib/monotone-curve.js +63 -0
- package/dist/features/viz/lib/monotone-curve.js.map +7 -0
- package/dist/features/viz/lib/numeric-range-interpolation.d.ts +15 -0
- package/dist/features/viz/lib/numeric-range-interpolation.js +36 -0
- package/dist/features/viz/lib/numeric-range-interpolation.js.map +7 -0
- package/dist/features/viz/lib/ohlc-bar-series.d.ts +55 -0
- package/dist/features/viz/lib/ohlc-bar-series.js +168 -0
- package/dist/features/viz/lib/ohlc-bar-series.js.map +7 -0
- package/dist/features/viz/lib/paired-series.d.ts +44 -0
- package/dist/features/viz/lib/paired-series.js +93 -0
- package/dist/features/viz/lib/paired-series.js.map +7 -0
- package/dist/features/viz/lib/pie-layout.js +2 -1
- package/dist/features/viz/lib/pie-layout.js.map +2 -2
- package/dist/features/viz/lib/plot-series.js +11 -6
- package/dist/features/viz/lib/plot-series.js.map +2 -2
- package/dist/features/viz/lib/plot-types.d.ts +4 -3
- package/dist/features/viz/lib/point-series.d.ts +1 -1
- package/dist/features/viz/lib/point-series.js +36 -9
- package/dist/features/viz/lib/point-series.js.map +2 -2
- package/dist/features/viz/lib/point-types.d.ts +5 -2
- package/dist/features/viz/lib/reference-band.js +4 -1
- package/dist/features/viz/lib/reference-band.js.map +2 -2
- package/dist/features/viz/lib/scale-context.d.ts +1 -1
- package/dist/features/viz/lib/scale-ticks.js +21 -6
- package/dist/features/viz/lib/scale-ticks.js.map +2 -2
- package/dist/features/viz/lib/sequential-color-scale.d.ts +11 -0
- package/dist/features/viz/lib/sequential-color-scale.js +49 -0
- package/dist/features/viz/lib/sequential-color-scale.js.map +7 -0
- package/dist/features/viz/lib/series-position.d.ts +12 -0
- package/dist/features/viz/lib/series-position.js +44 -0
- package/dist/features/viz/lib/series-position.js.map +7 -0
- package/dist/features/viz/lib/step-curves.d.ts +19 -0
- package/dist/features/viz/lib/step-curves.js +53 -0
- package/dist/features/viz/lib/step-curves.js.map +7 -0
- package/dist/features/viz/lib/threshold-color-scale.d.ts +43 -0
- package/dist/features/viz/lib/threshold-color-scale.js +59 -0
- package/dist/features/viz/lib/threshold-color-scale.js.map +7 -0
- package/dist/features/viz/lib/trading-time-mapping.d.ts +32 -0
- package/dist/features/viz/lib/trading-time-mapping.js +89 -0
- package/dist/features/viz/lib/trading-time-mapping.js.map +7 -0
- package/dist/features/viz/lib/trading-time-scale.d.ts +83 -0
- package/dist/features/viz/lib/trading-time-scale.js +96 -0
- package/dist/features/viz/lib/trading-time-scale.js.map +7 -0
- package/dist/features/viz/lib/trajectory-series.d.ts +71 -0
- package/dist/features/viz/lib/trajectory-series.js +111 -0
- package/dist/features/viz/lib/trajectory-series.js.map +7 -0
- package/dist/features/viz/lib/types.d.ts +20 -4
- package/dist/features/viz/lib/use-continuous-scale.js +6 -1
- package/dist/features/viz/lib/use-continuous-scale.js.map +2 -2
- package/dist/features/viz/lib/utc-scale.js +11 -10
- package/dist/features/viz/lib/utc-scale.js.map +2 -2
- package/dist/features/viz/lib/volume-series.d.ts +59 -0
- package/dist/features/viz/lib/volume-series.js +117 -0
- package/dist/features/viz/lib/volume-series.js.map +7 -0
- package/dist/features/viz/lib/weighted-point-series.d.ts +71 -0
- package/dist/features/viz/lib/weighted-point-series.js +169 -0
- package/dist/features/viz/lib/weighted-point-series.js.map +7 -0
- package/dist/filters/backdrop-contrast-gpu.d.ts +5 -0
- package/dist/filters/backdrop-contrast-gpu.js +33 -0
- package/dist/filters/backdrop-contrast-gpu.js.map +7 -0
- package/dist/filters/backdrop-contrast.d.ts +21 -0
- package/dist/filters/backdrop-contrast.js +61 -0
- package/dist/filters/backdrop-contrast.js.map +7 -0
- package/dist/filters/displacement.js +1 -1
- package/dist/filters/displacement.js.map +2 -2
- package/dist/filters/emboss-gpu.d.ts +4 -0
- package/dist/filters/emboss-gpu.js +39 -0
- package/dist/filters/emboss-gpu.js.map +7 -0
- package/dist/filters/emboss.d.ts +32 -0
- package/dist/filters/emboss.js +104 -0
- package/dist/filters/emboss.js.map +7 -0
- package/dist/filters/filter-executor.d.ts +11 -4
- package/dist/filters/filter-executor.js +104 -49
- package/dist/filters/filter-executor.js.map +2 -2
- package/dist/filters/reflected-light.js +1 -1
- package/dist/filters/reflected-light.js.map +2 -2
- package/dist/filters/reflection-gpu.d.ts +3 -1
- package/dist/filters/reflection-gpu.js +5 -2
- package/dist/filters/reflection-gpu.js.map +2 -2
- package/dist/filters/render-backdrop-contrast-boundary.d.ts +31 -0
- package/dist/filters/render-backdrop-contrast-boundary.js +116 -0
- package/dist/filters/render-backdrop-contrast-boundary.js.map +7 -0
- package/dist/filters/render-emboss-boundary.d.ts +13 -0
- package/dist/filters/render-emboss-boundary.js +131 -0
- package/dist/filters/render-emboss-boundary.js.map +7 -0
- package/dist/filters.d.ts +9 -5
- package/dist/filters.js +4 -0
- package/dist/filters.js.map +2 -2
- package/dist/index.d.ts +9 -5
- package/dist/index.js +18 -2
- package/dist/index.js.map +2 -2
- package/dist/internal.d.ts +4 -0
- package/dist/internal.js +6 -0
- package/dist/internal.js.map +2 -2
- package/dist/layout-kernel.d.ts +12 -0
- package/dist/layout-kernel.js +11 -0
- package/dist/layout-kernel.js.map +7 -0
- package/dist/layout-kernel.mjs +1 -0
- package/dist/lib/backend/types.d.ts +13 -1
- package/dist/lib/backend/types.js.map +2 -2
- package/dist/lib/components/arc-geometry.js +2 -1
- package/dist/lib/components/arc-geometry.js.map +2 -2
- package/dist/lib/components/g.js +2 -0
- package/dist/lib/components/g.js.map +2 -2
- package/dist/lib/components/html-box.js +2 -1
- package/dist/lib/components/html-box.js.map +2 -2
- package/dist/lib/components/img.js +3 -3
- package/dist/lib/components/img.js.map +2 -2
- package/dist/lib/components/layer.js +98 -16
- package/dist/lib/components/layer.js.map +3 -3
- package/dist/lib/components/text.d.ts +16 -0
- package/dist/lib/components/text.js +131 -24
- package/dist/lib/components/text.js.map +2 -2
- package/dist/lib/define-primitive.d.ts +4 -2
- package/dist/lib/define-primitive.js +3 -1
- package/dist/lib/define-primitive.js.map +2 -2
- package/dist/lib/element/metadata.d.ts +9 -0
- package/dist/lib/element/metadata.js +19 -0
- package/dist/lib/element/metadata.js.map +2 -2
- package/dist/lib/element/resolve-primitive-inputs.d.ts +2 -0
- package/dist/lib/element/resolve-primitive-inputs.js +17 -4
- package/dist/lib/element/resolve-primitive-inputs.js.map +2 -2
- package/dist/lib/events/event-facade.d.ts +18 -0
- package/dist/lib/events/event-facade.js +28 -2
- package/dist/lib/events/event-facade.js.map +2 -2
- package/dist/lib/events/hit-test.js +2 -1
- package/dist/lib/events/hit-test.js.map +2 -2
- package/dist/lib/events/propagation.d.ts +2 -1
- package/dist/lib/events/propagation.js +22 -16
- package/dist/lib/events/propagation.js.map +2 -2
- package/dist/lib/events/registrations.d.ts +10 -0
- package/dist/lib/events/registrations.js +160 -5
- package/dist/lib/events/registrations.js.map +2 -2
- package/dist/lib/execute-render.js +25 -1
- package/dist/lib/execute-render.js.map +2 -2
- package/dist/lib/filter/filter-region.js +3 -10
- package/dist/lib/filter/filter-region.js.map +2 -2
- package/dist/lib/focus/focus-manager.d.ts +8 -1
- package/dist/lib/focus/focus-manager.js +87 -43
- package/dist/lib/focus/focus-manager.js.map +2 -2
- package/dist/lib/focus/geometry.d.ts +2 -0
- package/dist/lib/focus/geometry.js +6 -0
- package/dist/lib/focus/geometry.js.map +2 -2
- package/dist/lib/geometry/path-bend-guide.js +1 -1
- package/dist/lib/geometry/path-bend-guide.js.map +2 -2
- package/dist/lib/geometry/path-geometry.js +12 -11
- package/dist/lib/geometry/path-geometry.js.map +2 -2
- package/dist/lib/geometry/path-transforms.js +17 -21
- package/dist/lib/geometry/path-transforms.js.map +2 -2
- package/dist/lib/geometry/path-warp-bezier.js +3 -1
- package/dist/lib/geometry/path-warp-bezier.js.map +2 -2
- package/dist/lib/geometry/path-warp.js +1 -1
- package/dist/lib/geometry/path-warp.js.map +2 -2
- package/dist/lib/global-state.js +2 -0
- package/dist/lib/global-state.js.map +2 -2
- package/dist/lib/html/html-events.d.ts +32 -0
- package/dist/lib/html/html-events.js +179 -0
- package/dist/lib/html/html-events.js.map +7 -0
- package/dist/lib/html/html-service.d.ts +8 -2
- package/dist/lib/html/html-service.js +198 -65
- package/dist/lib/html/html-service.js.map +2 -2
- package/dist/lib/html/overlay-config.js +7 -6
- package/dist/lib/html/overlay-config.js.map +2 -2
- package/dist/lib/html/types.d.ts +29 -2
- package/dist/lib/layout/absolute.d.ts +11 -5
- package/dist/lib/layout/absolute.js +329 -55
- package/dist/lib/layout/absolute.js.map +3 -3
- package/dist/lib/layout/allocation-checkpoint-owner.d.ts +11 -0
- package/dist/lib/layout/allocation-checkpoint-owner.js +86 -0
- package/dist/lib/layout/allocation-checkpoint-owner.js.map +7 -0
- package/dist/lib/layout/allocation-checkpoint.d.ts +53 -0
- package/dist/lib/layout/allocation-checkpoint.js +463 -0
- package/dist/lib/layout/allocation-checkpoint.js.map +7 -0
- package/dist/lib/layout/allocation-dependencies.d.ts +30 -0
- package/dist/lib/layout/allocation-dependencies.js +90 -0
- package/dist/lib/layout/allocation-dependencies.js.map +7 -0
- package/dist/lib/layout/allocation-revision.d.ts +13 -0
- package/dist/lib/layout/allocation-revision.js +67 -0
- package/dist/lib/layout/allocation-revision.js.map +7 -0
- package/dist/lib/layout/box-insets.d.ts +17 -0
- package/dist/lib/layout/box-insets.js +138 -0
- package/dist/lib/layout/box-insets.js.map +7 -0
- package/dist/lib/layout/box-sizing.d.ts +16 -0
- package/dist/lib/layout/box-sizing.js +77 -0
- package/dist/lib/layout/box-sizing.js.map +7 -0
- package/dist/lib/layout/box.js +42 -12
- package/dist/lib/layout/box.js.map +2 -2
- package/dist/lib/layout/canvas-measurement.d.ts +13 -0
- package/dist/lib/layout/canvas-measurement.js +57 -0
- package/dist/lib/layout/canvas-measurement.js.map +7 -0
- package/dist/lib/layout/context.d.ts +35 -6
- package/dist/lib/layout/context.js +72 -3
- package/dist/lib/layout/context.js.map +2 -2
- package/dist/lib/layout/define-layout-component.d.ts +23 -0
- package/dist/lib/layout/define-layout-component.js +84 -0
- package/dist/lib/layout/define-layout-component.js.map +7 -0
- package/dist/lib/layout/flex-allocation-cache.d.ts +42 -0
- package/dist/lib/layout/flex-baseline-mode.d.ts +2 -0
- package/dist/lib/layout/flex-baseline-mode.js +7 -0
- package/dist/lib/layout/flex-baseline-mode.js.map +7 -0
- package/dist/lib/layout/flex.d.ts +50 -15
- package/dist/lib/layout/flex.js +2124 -195
- package/dist/lib/layout/flex.js.map +3 -3
- package/dist/lib/layout/flow.js +225 -49
- package/dist/lib/layout/flow.js.map +2 -2
- package/dist/lib/layout/geometry-publication.d.ts +53 -0
- package/dist/lib/layout/geometry-publication.js +244 -0
- package/dist/lib/layout/geometry-publication.js.map +7 -0
- package/dist/lib/layout/grid-kernel.d.ts +63 -0
- package/dist/lib/layout/grid-kernel.js +168 -0
- package/dist/lib/layout/grid-kernel.js.map +7 -0
- package/dist/lib/layout/grid.d.ts +63 -4
- package/dist/lib/layout/grid.js +767 -171
- package/dist/lib/layout/grid.js.map +3 -3
- package/dist/lib/layout/measure.d.ts +55 -3
- package/dist/lib/layout/measure.js +448 -15
- package/dist/lib/layout/measure.js.map +2 -2
- package/dist/lib/layout/overlay.js +81 -23
- package/dist/lib/layout/overlay.js.map +2 -2
- package/dist/lib/layout/participation.d.ts +27 -0
- package/dist/lib/layout/participation.js +188 -0
- package/dist/lib/layout/participation.js.map +7 -0
- package/dist/lib/layout/place-child.js +1 -1
- package/dist/lib/layout/place-child.js.map +2 -2
- package/dist/lib/layout/positioning-diagnostics.d.ts +1 -1
- package/dist/lib/layout/positioning-diagnostics.js +13 -2
- package/dist/lib/layout/positioning-diagnostics.js.map +2 -2
- package/dist/lib/layout/prepared-root.d.ts +121 -0
- package/dist/lib/layout/prepared-root.js +360 -0
- package/dist/lib/layout/prepared-root.js.map +7 -0
- package/dist/lib/layout/standalone-kernel.d.ts +60 -0
- package/dist/lib/layout/standalone-kernel.js +722 -0
- package/dist/lib/layout/standalone-kernel.js.map +7 -0
- package/dist/lib/layout/topology.d.ts +21 -0
- package/dist/lib/layout/topology.js +113 -0
- package/dist/lib/layout/topology.js.map +7 -0
- package/dist/lib/layout/types.d.ts +5 -0
- package/dist/lib/layout/wasm/artifact.d.ts +1 -0
- package/dist/lib/layout/wasm/artifact.js +5 -0
- package/dist/lib/layout/wasm/artifact.js.map +7 -0
- package/dist/lib/layout/wasm/bytes.d.ts +1 -0
- package/dist/lib/layout/wasm/bytes.js +5 -0
- package/dist/lib/layout/wasm/bytes.js.map +7 -0
- package/dist/lib/layout/wasm/embedded.d.ts +2 -0
- package/dist/lib/layout/wasm/embedded.js +12 -0
- package/dist/lib/layout/wasm/embedded.js.map +7 -0
- package/dist/lib/layout/wasm/layout.wasm +0 -0
- package/dist/lib/layout/wasm/module.d.ts +8 -0
- package/dist/lib/layout/wasm/module.js +70 -0
- package/dist/lib/layout/wasm/module.js.map +7 -0
- package/dist/lib/layout/wasm/region.d.ts +267 -0
- package/dist/lib/layout/wasm/region.js +1018 -0
- package/dist/lib/layout/wasm/region.js.map +7 -0
- package/dist/lib/manipulation/controller.js +4 -7
- package/dist/lib/manipulation/controller.js.map +2 -2
- package/dist/lib/manipulation/frame.js +1 -1
- package/dist/lib/manipulation/frame.js.map +2 -2
- package/dist/lib/manipulation/handles.js +32 -33
- package/dist/lib/manipulation/handles.js.map +2 -2
- package/dist/lib/manipulation/solve.js +12 -10
- package/dist/lib/manipulation/solve.js.map +2 -2
- package/dist/lib/mount-pibbl.js +1 -0
- package/dist/lib/mount-pibbl.js.map +2 -2
- package/dist/lib/mount-prepared-pibbl.d.ts +5 -0
- package/dist/lib/mount-prepared-pibbl.js +29 -0
- package/dist/lib/mount-prepared-pibbl.js.map +7 -0
- package/dist/lib/mount-request.d.ts +8 -0
- package/dist/lib/mount-request.js +41 -0
- package/dist/lib/mount-request.js.map +7 -0
- package/dist/lib/pibbl.d.ts +21 -13
- package/dist/lib/pibbl.js +18 -16
- package/dist/lib/pibbl.js.map +2 -2
- package/dist/lib/recording/recording.d.ts +43 -0
- package/dist/lib/recording/recording.js +555 -0
- package/dist/lib/recording/recording.js.map +7 -0
- package/dist/lib/recording/types.d.ts +118 -0
- package/dist/lib/recording/wasm-bytes.d.ts +1 -0
- package/dist/lib/recording/wasm-bytes.js +5 -0
- package/dist/lib/recording/wasm-bytes.js.map +7 -0
- package/dist/lib/recording/worker-source.d.ts +1 -0
- package/dist/lib/recording/worker-source.js +5 -0
- package/dist/lib/recording/worker-source.js.map +7 -0
- package/dist/lib/render-layer/controller.d.ts +9 -3
- package/dist/lib/render-layer/controller.js +259 -110
- package/dist/lib/render-layer/controller.js.map +2 -2
- package/dist/lib/render-transaction.d.ts +12 -2
- package/dist/lib/render-transaction.js +69 -1
- package/dist/lib/render-transaction.js.map +2 -2
- package/dist/lib/render.js +32 -8
- package/dist/lib/render.js.map +2 -2
- package/dist/lib/scheduler/realm-scheduler.d.ts +2 -0
- package/dist/lib/scheduler/realm-scheduler.js +55 -26
- package/dist/lib/scheduler/realm-scheduler.js.map +2 -2
- package/dist/lib/scheduler/renderer-participant.js +1 -0
- package/dist/lib/scheduler/renderer-participant.js.map +2 -2
- package/dist/lib/series-inspection-frame.d.ts +18 -0
- package/dist/lib/series-inspection-frame.js +70 -0
- package/dist/lib/series-inspection-frame.js.map +7 -0
- package/dist/lib/signals/edge.d.ts +7 -4
- package/dist/lib/signals/edge.js +25 -3
- package/dist/lib/signals/edge.js.map +2 -2
- package/dist/lib/signals/graph.d.ts +16 -2
- package/dist/lib/signals/graph.js +54 -12
- package/dist/lib/signals/graph.js.map +2 -2
- package/dist/lib/signals/input-provision.d.ts +15 -0
- package/dist/lib/signals/input-provision.js +53 -3
- package/dist/lib/signals/input-provision.js.map +2 -2
- package/dist/lib/signals/render-consumer.d.ts +3 -0
- package/dist/lib/signals/render-consumer.js +22 -14
- package/dist/lib/signals/render-consumer.js.map +2 -2
- package/dist/lib/style/positioning.d.ts +50 -2
- package/dist/lib/style/positioning.js +28 -4
- package/dist/lib/style/positioning.js.map +2 -2
- package/dist/lib/style/resolve-built-in.d.ts +4 -3
- package/dist/lib/style/resolve-built-in.js +17 -3
- package/dist/lib/style/resolve-built-in.js.map +2 -2
- package/dist/lib/style/resolve-dispatch.d.ts +3 -0
- package/dist/lib/style/resolve-dispatch.js +77 -4
- package/dist/lib/style/resolve-dispatch.js.map +2 -2
- package/dist/lib/style/resolve-length.d.ts +2 -0
- package/dist/lib/style/resolve-length.js +13 -9
- package/dist/lib/style/resolve-length.js.map +2 -2
- package/dist/lib/style/sizing-length.d.ts +51 -0
- package/dist/lib/style/sizing-length.js +77 -0
- package/dist/lib/style/sizing-length.js.map +7 -0
- package/dist/lib/style/types.d.ts +63 -25
- package/dist/lib/surface/root-surface.js +10 -6
- package/dist/lib/surface/root-surface.js.map +2 -2
- package/dist/lib/textures/texture.js +10 -8
- package/dist/lib/textures/texture.js.map +2 -2
- package/dist/lib/transitions/capture.js +4 -1
- package/dist/lib/transitions/capture.js.map +2 -2
- package/dist/lib/transitions/embers-physics.js +17 -10
- package/dist/lib/transitions/embers-physics.js.map +2 -2
- package/dist/lib/types.d.ts +110 -1
- package/dist/sync.d.ts +16 -0
- package/dist/sync.js +13 -0
- package/dist/sync.js.map +7 -0
- package/dist/sync.mjs +1 -0
- package/package.json +26 -3
package/dist/lib/layout/flow.js
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { withAllocationCheckpoint } from "./allocation-checkpoint.js";
|
|
2
|
+
import { contentBoxStyle } from "./box-sizing.js";
|
|
3
|
+
import { canvasMeasurementService } from "./canvas-measurement.js";
|
|
4
|
+
import { nativeLayout, mountedLayoutRegion, recordWasmAllocationPass, recordWasmAllocationItem, recordWasmAllocationCacheHit } from "./wasm/region.js";
|
|
5
|
+
import { prepareKnownLayoutDescendants, registerKnownLayoutPreflight, claimPreparedLayoutPlan, stagePreparedLayoutPlan, preparePlacedKnownLayout } from "./prepared-root.js";
|
|
6
|
+
import { getStyleMeasurementMode, preparedStyleValue, preparedStyleQuery } from "../style/responsive.js";
|
|
2
7
|
import { definePrimitive } from "../define-primitive.js";
|
|
3
8
|
import { clonePibblElement } from "../element/create-element.js";
|
|
4
9
|
import { getChildPrimitiveReceiverToken } from "../element/metadata.js";
|
|
@@ -7,7 +12,7 @@ import { layoutDiagnostic } from "../style/diagnostics.js";
|
|
|
7
12
|
import {
|
|
8
13
|
wireStructuralEvents
|
|
9
14
|
} from "../components/structural-events.js";
|
|
10
|
-
import {
|
|
15
|
+
import { normalizeBoxInsets, hasPercentageBoxPadding, resolveAllocatedInsets } from "./box-insets.js";
|
|
11
16
|
import { setPreNormalizedStyle } from "../style/resolve-dispatch.js";
|
|
12
17
|
import {
|
|
13
18
|
childWithUsedSize,
|
|
@@ -18,13 +23,13 @@ import {
|
|
|
18
23
|
resolveContainerBox,
|
|
19
24
|
resolveDirectChildBox
|
|
20
25
|
} from "./absolute.js";
|
|
21
|
-
import { pushLayoutBox } from "./context.js";
|
|
26
|
+
import { pushLayoutBox, resolvePositionedContainingBox } from "./context.js";
|
|
22
27
|
import { recordLayoutEvaluation } from "./diagnostics.js";
|
|
23
28
|
import { assertSupportedChildPosition } from "./positioning-diagnostics.js";
|
|
24
|
-
import { measureElement } from "./measure.js";
|
|
29
|
+
import { measureElement, measureIntrinsicElement } from "./measure.js";
|
|
30
|
+
const FLOW_CONTAINING_BOX_STYLE = /* @__PURE__ */ Symbol("pibbl.flow-containing-box-style");
|
|
25
31
|
function renderFlow(props, style, ctx) {
|
|
26
32
|
wireStructuralEvents(props);
|
|
27
|
-
const children = prepareLayoutChildren(props.children, "Flow");
|
|
28
33
|
recordLayoutEvaluation();
|
|
29
34
|
const content = style.box.contentBox;
|
|
30
35
|
ctx.translate(content.x, content.y);
|
|
@@ -34,61 +39,230 @@ function renderFlow(props, style, ctx) {
|
|
|
34
39
|
width: content.width,
|
|
35
40
|
height: content.height
|
|
36
41
|
});
|
|
37
|
-
const releaseLayout = pushLayoutBox(localContent
|
|
42
|
+
const releaseLayout = pushLayoutBox(localContent, {
|
|
43
|
+
logicalOffset: content,
|
|
44
|
+
containingBlock: resolvePositionedContainingBox(
|
|
45
|
+
style[FLOW_CONTAINING_BOX_STYLE],
|
|
46
|
+
localContent,
|
|
47
|
+
"Flow"
|
|
48
|
+
)
|
|
49
|
+
});
|
|
38
50
|
GLOBAL_STATE.componentRefs.onAfterRender = releaseLayout;
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
return ctx.measureText(value);
|
|
45
|
-
} finally {
|
|
46
|
-
ctx.restore();
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
};
|
|
50
|
-
const placements = resolveFlowPlacements(
|
|
51
|
-
localContent,
|
|
52
|
-
children,
|
|
53
|
-
style,
|
|
54
|
-
{
|
|
55
|
-
service,
|
|
56
|
-
measureElement: (element, constraints) => measureElement(element, constraints, service)
|
|
57
|
-
}
|
|
58
|
-
);
|
|
51
|
+
const prepared = nativeLayout ? claimPreparedLayoutPlan(GLOBAL_STATE.componentRefs.element, localContent) : void 0;
|
|
52
|
+
const nativeRegion = prepared?.region ?? (nativeLayout ? mountedLayoutRegion() : void 0);
|
|
53
|
+
if (nativeLayout && !nativeRegion) throw new Error("Experimental Flow requires its mounted native region.");
|
|
54
|
+
const plan = prepared ?? prepareFlowAllocation(props, style, localContent, ctx, nativeRegion);
|
|
55
|
+
const { children, placements } = plan;
|
|
59
56
|
let index = 0;
|
|
60
57
|
return placeDirectChildren(
|
|
61
58
|
children,
|
|
62
59
|
localContent,
|
|
63
|
-
() =>
|
|
60
|
+
(_child, occurrence) => {
|
|
61
|
+
const placement = placements[index++];
|
|
62
|
+
if (nativeLayout && !prepared) preparePlacedKnownLayout(placement.element, occurrence);
|
|
63
|
+
return placement;
|
|
64
|
+
},
|
|
64
65
|
style.overflow
|
|
65
66
|
);
|
|
66
67
|
}
|
|
67
68
|
const Flow = definePrimitive(renderFlow, {
|
|
68
69
|
childInput: "structural",
|
|
69
|
-
resolveStyle: (style, context) =>
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
70
|
+
resolveStyle: (style, context) => {
|
|
71
|
+
if (nativeLayout && hasPercentageBoxPadding(style)) {
|
|
72
|
+
style = resolveAllocatedInsets(style, {
|
|
73
|
+
width: context.percentageBasis.width,
|
|
74
|
+
context: { ...context, component: "Flow", algorithm: "flow" }
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
return {
|
|
78
|
+
box: resolveContainerBox(style, context, "Flow", "flow"),
|
|
79
|
+
[FLOW_CONTAINING_BOX_STYLE]: style,
|
|
80
|
+
overflow: style.overflow ?? "visible",
|
|
81
|
+
...normalizeFlowOptions(style, context.allocation)
|
|
82
|
+
};
|
|
83
|
+
},
|
|
84
|
+
measure: (input) => measureFlow(input),
|
|
85
|
+
measureIntrinsic: (input) => measureFlowIntrinsic(input)
|
|
86
|
+
});
|
|
87
|
+
function measureFlowIntrinsic(input) {
|
|
88
|
+
const maximumWidth = intrinsicConstraintMaximum(input.constraints.width);
|
|
89
|
+
const maximumHeight = intrinsicConstraintMaximum(input.constraints.height);
|
|
90
|
+
const owner = { x: 0, y: 0, width: maximumWidth, height: maximumHeight };
|
|
91
|
+
const options = normalizeFlowOptions(input.style, owner);
|
|
92
|
+
const children = materializeLayoutChildren(input.props.children, "Flow");
|
|
93
|
+
const items = [];
|
|
94
|
+
let maximumWidthContribution = 0;
|
|
95
|
+
let minimumWidthContribution = 0;
|
|
96
|
+
for (let index = 0; index < children.length; index++) {
|
|
97
|
+
const child = children[index];
|
|
98
|
+
const receiver = getChildPrimitiveReceiverToken(
|
|
99
|
+
GLOBAL_STATE.renderTransaction,
|
|
100
|
+
GLOBAL_STATE.primitiveReceiverToken,
|
|
101
|
+
index
|
|
102
|
+
);
|
|
103
|
+
const prepared = prepareDirectChildStyle(child, receiver, owner);
|
|
104
|
+
let style = preparedStyleValue(prepared);
|
|
105
|
+
if (hasIntrinsicPercentageCycle(style)) {
|
|
106
|
+
return { status: "unsupported", reason: "Flow intrinsic percentage child sizes require a definite owner allocation" };
|
|
107
|
+
}
|
|
108
|
+
if (style.boxSizing !== void 0) {
|
|
109
|
+
style = contentBoxStyle(style, {
|
|
110
|
+
width: owner.width,
|
|
111
|
+
height: owner.height,
|
|
112
|
+
context: {
|
|
113
|
+
component: child.type.name || "Anonymous",
|
|
114
|
+
algorithm: "Flow intrinsic measurement",
|
|
115
|
+
constraints: { minWidth: 0, maxWidth: owner.width, minHeight: 0, maxHeight: owner.height }
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
assertSupportedChildPosition("Flow", child, style);
|
|
120
|
+
const insets = normalizeBoxInsets(style, {
|
|
121
|
+
component: child.type.name || "Anonymous",
|
|
122
|
+
algorithm: "Flow intrinsic measurement",
|
|
123
|
+
constraints: { minWidth: 0, maxWidth: owner.width, minHeight: 0, maxHeight: owner.height }
|
|
124
|
+
});
|
|
125
|
+
const horizontalInsets = insets.left + insets.right;
|
|
126
|
+
const verticalInsets = insets.top + insets.bottom;
|
|
127
|
+
let minWidth;
|
|
128
|
+
let maxWidth;
|
|
129
|
+
if (typeof style.width === "number" && typeof style.height === "number") {
|
|
130
|
+
minWidth = style.width + horizontalInsets;
|
|
131
|
+
maxWidth = minWidth;
|
|
132
|
+
} else {
|
|
133
|
+
const measuredChild = clonePibblElement(child);
|
|
134
|
+
setPreNormalizedStyle(measuredChild, style, child, receiver, preparedStyleQuery(prepared));
|
|
135
|
+
const measured = measureIntrinsicElement(measuredChild, {
|
|
136
|
+
minWidth: 0,
|
|
137
|
+
maxWidth: owner.width,
|
|
138
|
+
minHeight: 0,
|
|
139
|
+
maxHeight: owner.height
|
|
140
|
+
}, input.service);
|
|
141
|
+
if (measured.status !== "measured") return measured;
|
|
142
|
+
minWidth = (typeof style.width === "number" ? style.width : measured.minContent.width) + horizontalInsets;
|
|
143
|
+
maxWidth = (typeof style.width === "number" ? style.width : measured.maxContent.width) + horizontalInsets;
|
|
144
|
+
}
|
|
145
|
+
if (!Number.isFinite(minWidth) || !Number.isFinite(maxWidth) || minWidth < 0 || maxWidth < minWidth) {
|
|
146
|
+
return { status: "unsupported", reason: "Flow intrinsic child widths must be finite and ordered" };
|
|
147
|
+
}
|
|
148
|
+
items.push({ child, style, receiver, query: preparedStyleQuery(prepared), horizontalInsets, verticalInsets, minWidth, maxWidth });
|
|
149
|
+
minimumWidthContribution = options.wrap ? Math.max(minimumWidthContribution, minWidth) : minimumWidthContribution + minWidth;
|
|
150
|
+
maximumWidthContribution += maxWidth;
|
|
151
|
+
}
|
|
152
|
+
const gaps = Math.max(0, items.length - 1) * options.gap;
|
|
153
|
+
if (!options.wrap) minimumWidthContribution += gaps;
|
|
154
|
+
maximumWidthContribution += gaps;
|
|
155
|
+
const minimumHeight = measureIntrinsicFlowHeight(items, minimumWidthContribution, false, options, input, owner);
|
|
156
|
+
if (minimumHeight.status !== "measured") return minimumHeight;
|
|
157
|
+
const maximumHeightResult = measureIntrinsicFlowHeight(items, maximumWidthContribution, true, options, input, owner);
|
|
158
|
+
if (maximumHeightResult.status !== "measured") return maximumHeightResult;
|
|
159
|
+
return {
|
|
160
|
+
status: "measured",
|
|
161
|
+
minContent: { width: minimumWidthContribution, height: minimumHeight.height },
|
|
162
|
+
maxContent: { width: maximumWidthContribution, height: maximumHeightResult.height }
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
function intrinsicConstraintMaximum(constraint) {
|
|
166
|
+
return constraint.kind === "bounded" ? constraint.max : Number.MAX_SAFE_INTEGER;
|
|
167
|
+
}
|
|
168
|
+
function hasIntrinsicPercentageCycle(style) {
|
|
169
|
+
return hasPercentageBoxPadding(style) || isPercentageLength(style.width) || isPercentageLength(style.height) || isPercentageLength(style.minWidth) || isPercentageLength(style.maxWidth) || isPercentageLength(style.minHeight) || isPercentageLength(style.maxHeight);
|
|
170
|
+
}
|
|
171
|
+
function isPercentageLength(value) {
|
|
172
|
+
return typeof value === "string" && value.endsWith("%");
|
|
173
|
+
}
|
|
174
|
+
function measureIntrinsicFlowHeight(items, width, maximumWidths, options, input, owner) {
|
|
175
|
+
const placements = [];
|
|
176
|
+
for (const item of items) {
|
|
177
|
+
const selectedWidth = maximumWidths ? item.maxWidth : item.minWidth;
|
|
178
|
+
const contentWidth = Math.max(0, (width === 0 ? 0 : options.wrap ? Math.min(width, selectedWidth) : selectedWidth) - item.horizontalInsets);
|
|
179
|
+
let contentHeight;
|
|
180
|
+
if (typeof item.style.height === "number") {
|
|
181
|
+
contentHeight = item.style.height;
|
|
182
|
+
} else {
|
|
183
|
+
const measuredChild = clonePibblElement(item.child);
|
|
184
|
+
setPreNormalizedStyle(measuredChild, { ...item.style, width: contentWidth }, item.child, item.receiver, item.query);
|
|
185
|
+
const measured = measureElement(measuredChild, {
|
|
186
|
+
minWidth: contentWidth,
|
|
187
|
+
maxWidth: contentWidth,
|
|
188
|
+
minHeight: 0,
|
|
189
|
+
maxHeight: owner.height
|
|
190
|
+
}, input.service);
|
|
191
|
+
if (measured.status !== "measured") return measured;
|
|
192
|
+
contentHeight = measured.size.height;
|
|
193
|
+
}
|
|
194
|
+
if (!Number.isFinite(contentHeight) || contentHeight < 0) {
|
|
195
|
+
return { status: "unsupported", reason: "Flow intrinsic child heights must be finite and nonnegative" };
|
|
196
|
+
}
|
|
197
|
+
placements.push({
|
|
198
|
+
child: item.child,
|
|
199
|
+
normalized: item.style,
|
|
200
|
+
width: contentWidth + item.horizontalInsets,
|
|
201
|
+
height: contentHeight + item.verticalInsets,
|
|
202
|
+
horizontalPadding: item.horizontalInsets,
|
|
203
|
+
verticalPadding: item.verticalInsets,
|
|
204
|
+
alignment: options.alignItems,
|
|
205
|
+
receiverToken: item.receiver,
|
|
206
|
+
query: item.query
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
const boxes = arrangeFlowItems({ x: 0, y: 0, width, height: owner.height }, placements, options);
|
|
210
|
+
let height = 0;
|
|
211
|
+
for (const box of boxes) height = Math.max(height, box.y + box.height);
|
|
212
|
+
return { status: "measured", height };
|
|
213
|
+
}
|
|
214
|
+
function prepareFlowAllocation(props, style, content, ctx, region) {
|
|
215
|
+
const children = prepareLayoutChildren(props.children, "Flow");
|
|
216
|
+
const service = canvasMeasurementService(ctx);
|
|
217
|
+
const placements = withAllocationCheckpoint(region, { children, content, settings: style, onHit: recordWasmAllocationCacheHit, calculate: () => resolveFlowPlacements(content, children, style, { service, measureElement: (child, constraints) => measureElement(child, constraints, service) }, region) });
|
|
218
|
+
return { children, placements };
|
|
219
|
+
}
|
|
220
|
+
if (nativeLayout) registerKnownLayoutPreflight(Flow, (element, style, content, receiver, slot) => {
|
|
221
|
+
const previous = GLOBAL_STATE.primitiveReceiverToken;
|
|
222
|
+
GLOBAL_STATE.primitiveReceiverToken = receiver;
|
|
223
|
+
const releaseLayout = pushLayoutBox(content, {
|
|
224
|
+
containingBlock: resolvePositionedContainingBox(
|
|
225
|
+
style,
|
|
226
|
+
content,
|
|
227
|
+
"Flow"
|
|
228
|
+
)
|
|
229
|
+
});
|
|
230
|
+
try {
|
|
231
|
+
const options = normalizeFlowOptions(style, content);
|
|
232
|
+
const ctx = GLOBAL_STATE.renderContext;
|
|
233
|
+
if (!ctx) throw new Error("Known Flow preparation requires a Canvas measurement context.");
|
|
234
|
+
const region = slot.acquire();
|
|
235
|
+
const allocation = prepareFlowAllocation(element.props, options, content, ctx, region);
|
|
236
|
+
const plan = { region, content, ...allocation };
|
|
237
|
+
prepareKnownLayoutDescendants(plan, slot);
|
|
238
|
+
stagePreparedLayoutPlan(slot, plan);
|
|
239
|
+
} finally {
|
|
240
|
+
releaseLayout();
|
|
241
|
+
GLOBAL_STATE.primitiveReceiverToken = previous;
|
|
242
|
+
}
|
|
75
243
|
});
|
|
76
244
|
function layoutFlow(container, children, style, measurement) {
|
|
77
245
|
const prepared = materializeLayoutChildren(children, "Flow");
|
|
78
246
|
return resolveFlowPlacements(container, prepared, style, measurement).map((placement) => placement.box);
|
|
79
247
|
}
|
|
80
|
-
function resolveFlowPlacements(container, children, style, measurement) {
|
|
248
|
+
function resolveFlowPlacements(container, children, style, measurement, nativeRegion) {
|
|
249
|
+
if (nativeRegion) recordWasmAllocationPass();
|
|
81
250
|
assertFiniteContainer(container);
|
|
82
251
|
const options = normalizeFlowOptions(style, container);
|
|
83
252
|
const items = [];
|
|
84
253
|
for (const child of children) {
|
|
254
|
+
if (nativeRegion) recordWasmAllocationItem();
|
|
85
255
|
const receiverToken = getChildPrimitiveReceiverToken(
|
|
86
256
|
GLOBAL_STATE.renderTransaction,
|
|
87
257
|
GLOBAL_STATE.primitiveReceiverToken,
|
|
88
258
|
items.length
|
|
89
259
|
);
|
|
90
260
|
const prepared = prepareDirectChildStyle(child, receiverToken, container);
|
|
91
|
-
|
|
261
|
+
let normalized = preparedStyleValue(prepared);
|
|
262
|
+
if (nativeLayout && GLOBAL_STATE.currentPibblInstance && getStyleMeasurementMode() === void 0 && hasPercentageBoxPadding(normalized)) {
|
|
263
|
+
normalized = resolveAllocatedInsets(normalized, { width: container.width, context: { component: child.type.name || "Anonymous", algorithm: "flow" } });
|
|
264
|
+
}
|
|
265
|
+
if (normalized.boxSizing !== void 0) normalized = contentBoxStyle(normalized, { width: container.width, height: container.height, context: { component: child.type.name || "Anonymous", algorithm: "flow", constraints: { minWidth: 0, maxWidth: container.width, minHeight: 0, maxHeight: container.height } } });
|
|
92
266
|
assertSupportedChildPosition("Flow", child, normalized);
|
|
93
267
|
const needsWidth = normalized.width === void 0 || normalized.width === "auto";
|
|
94
268
|
const needsHeight = normalized.height === void 0 || normalized.height === "auto";
|
|
@@ -133,7 +307,9 @@ function resolveFlowPlacements(container, children, style, measurement) {
|
|
|
133
307
|
container,
|
|
134
308
|
child,
|
|
135
309
|
"flow",
|
|
136
|
-
resolvedStyle
|
|
310
|
+
resolvedStyle,
|
|
311
|
+
measurement.service,
|
|
312
|
+
receiverToken
|
|
137
313
|
);
|
|
138
314
|
const box = resolved.borderBox;
|
|
139
315
|
items.push({
|
|
@@ -153,18 +329,18 @@ function resolveFlowPlacements(container, children, style, measurement) {
|
|
|
153
329
|
query: preparedStyleQuery(prepared)
|
|
154
330
|
});
|
|
155
331
|
}
|
|
156
|
-
const
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
items[index].query
|
|
166
|
-
|
|
167
|
-
})
|
|
332
|
+
const nativeBoxes = nativeRegion?.placeFlow(items, { horizontal: options.direction === "horizontal", mainBound: options.direction === "horizontal" ? container.width : container.height, gap: options.gap, lineGap: options.lineGap, wrap: options.wrap });
|
|
333
|
+
const boxes = nativeBoxes ?? arrangeFlowItems(container, items, options);
|
|
334
|
+
return boxes.map((box, index) => {
|
|
335
|
+
const usedWidth = Math.max(0, box.width - items[index].horizontalPadding);
|
|
336
|
+
const usedHeight = Math.max(0, box.height - items[index].verticalPadding);
|
|
337
|
+
return {
|
|
338
|
+
box: nativeBoxes && (container.x !== 0 || container.y !== 0) ? { x: container.x + box.x, y: container.y + box.y, width: box.width, height: box.height } : box,
|
|
339
|
+
usedWidth,
|
|
340
|
+
usedHeight,
|
|
341
|
+
element: childWithUsedSize(items[index].child, items[index].normalized, usedWidth, usedHeight, items[index].receiverToken, items[index].query)
|
|
342
|
+
};
|
|
343
|
+
});
|
|
168
344
|
}
|
|
169
345
|
function measureFlow(input) {
|
|
170
346
|
const children = prepareLayoutChildren(input.props.children, "Flow");
|
|
@@ -208,7 +384,7 @@ function provisionalFlowBox(style, constraints) {
|
|
|
208
384
|
algorithm: "measurement",
|
|
209
385
|
constraints
|
|
210
386
|
};
|
|
211
|
-
const padding =
|
|
387
|
+
const padding = normalizeBoxInsets(style, diagnosticContext);
|
|
212
388
|
const width = finiteMeasurementBound(
|
|
213
389
|
constraints.maxWidth,
|
|
214
390
|
[style.width, style.minWidth, style.maxWidth],
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/lib/layout/flow.ts"],
|
|
4
|
-
"sourcesContent": ["import { preparedStyleValue, preparedStyleQuery, type PreparedQuery } from '../style/responsive.js';\nimport { definePrimitive } from '../define-primitive.js';\nimport { clonePibblElement } from '../element/create-element.js';\nimport { getChildPrimitiveReceiverToken } from '../element/metadata.js';\nimport type { PibblElement } from '../element/types.js';\nimport { GLOBAL_STATE } from '../global-state.js';\nimport { layoutDiagnostic } from '../style/diagnostics.js';\nimport {\n type PibblStructuralEventProps,\n wireStructuralEvents,\n} from '../components/structural-events.js';\nimport { normalizeEdges } from '../style/normalize.js';\nimport { setPreNormalizedStyle } from '../style/resolve-dispatch.js';\nimport type { BoxStyle, LayoutItemStyle, ResolvedBoxStyle } from '../style/types.js';\nimport type {\n CanvasMeasurementService,\n PibblNodeInput,\n MeasureInput,\n MeasureResult,\n RenderingContext2D,\n SystemStyle,\n} from '../types.js';\nimport {\n childWithUsedSize,\n materializeLayoutChildren,\n prepareDirectChildStyle,\n placeDirectChildren,\n prepareLayoutChildren,\n resolveContainerBox,\n resolveDirectChildBox,\n} from './absolute.js';\nimport { pushLayoutBox } from './context.js';\nimport { recordLayoutEvaluation } from './diagnostics.js';\nimport { assertSupportedChildPosition } from './positioning-diagnostics.js';\nimport { measureElement } from './measure.js';\nimport type { Constraints, LayoutBox } from './types.js';\n\ntype FlowDirection = 'horizontal' | 'vertical';\ntype FlowAlignment = 'start' | 'center' | 'end' | 'stretch';\n\n/**\n * Supported geometry and presentation properties for Flow.\n *\n * @see {@link BoxStyle}\n * @see {@link LayoutItemStyle}\n * @see {@link Flow}\n */\nexport interface FlowStyle extends BoxStyle, LayoutItemStyle {\n /** Direction in which this operation proceeds. See {@link FlowDirection}. */\n direction?: FlowDirection;\n /** Whether content may wrap into additional lines. See {@link FlowStyle}. */\n wrap?: boolean;\n /** Spacing between adjacent items. See {@link FlowStyle}. */\n gap?: number;\n /** Space between wrapped flow lines. See {@link FlowStyle}. */\n lineGap?: number;\n /** Default alignment of children on the cross or block axis. See {@link FlowAlignment}. */\n alignItems?: FlowAlignment;\n}\n\n/**\n * Authored inputs for Flow, including the declared data and presentation options.\n *\n * @see {@link PibblNodeInput}\n * @see {@link Flow}\n */\nexport interface FlowProps extends PibblStructuralEventProps {\n /** Descendant content or the callback that supplies it. See {@link PibblNodeInput}. */\n children: PibblNodeInput;\n}\n\ninterface ResolvedFlowStyle extends SystemStyle {\n box: ResolvedBoxStyle;\n overflow: 'visible' | 'clip';\n direction: FlowDirection;\n wrap: boolean;\n gap: number;\n lineGap: number;\n alignItems: FlowAlignment;\n}\n\ninterface FlowItem {\n child: PibblElement<any>;\n normalized: Readonly<SystemStyle>;\n width: number;\n height: number;\n horizontalPadding: number;\n verticalPadding: number;\n alignment: FlowAlignment;\n receiverToken: object;\n query?: PreparedQuery;\n}\n\nexport interface FlowMeasurementInput {\n service: CanvasMeasurementService;\n measureElement(\n element: PibblElement<any>,\n constraints: Readonly<Constraints>,\n ): MeasureResult;\n}\n\ninterface FlowPlacement {\n box: LayoutBox;\n element: PibblElement<any>;\n}\n\nfunction renderFlow(\n props: FlowProps,\n style: Readonly<ResolvedFlowStyle>,\n ctx: RenderingContext2D,\n) {\n wireStructuralEvents(props);\n const children = prepareLayoutChildren(props.children, 'Flow');\n recordLayoutEvaluation();\n const content = style.box.contentBox;\n ctx.translate(content.x, content.y);\n const localContent = Object.freeze({\n x: 0,\n y: 0,\n width: content.width,\n height: content.height,\n });\n const releaseLayout = pushLayoutBox(localContent);\n GLOBAL_STATE.componentRefs!.onAfterRender = releaseLayout;\n const service = {\n measureText(value: string, font: string) {\n ctx.save();\n try {\n ctx.font = font;\n return ctx.measureText(value);\n } finally {\n ctx.restore();\n }\n },\n };\n const placements = resolveFlowPlacements(\n localContent,\n children,\n style,\n {\n service,\n measureElement: (element, constraints) =>\n measureElement(element, constraints, service),\n },\n );\n let index = 0;\n return placeDirectChildren(\n children,\n localContent,\n () => placements[index++],\n style.overflow,\n );\n}\n\n/**\n * Describes sequential flow layout for JSX or createElement authoring.\n *\n * @param props - Authored component inputs, supplied through JSX or createElement. See the linked\n * props and style types.\n * @throws When called directly; Pibbl mounts this component through JSX or createElement.\n *\n * @see {@link FlowProps}\n * @see {@link FlowStyle}\n */\nexport const Flow = definePrimitive<\n FlowProps,\n FlowStyle,\n FlowStyle,\n ResolvedFlowStyle\n>(renderFlow, {\n childInput: 'structural',\n resolveStyle: (style, context) => ({\n box: resolveContainerBox(style, context, 'Flow', 'flow'),\n overflow: style.overflow ?? 'visible',\n ...normalizeFlowOptions(style, context.allocation),\n }),\n measure: input => measureFlow(input),\n});\n\nexport function layoutFlow(\n container: Readonly<LayoutBox>,\n children: PibblNodeInput,\n style: Readonly<FlowStyle>,\n measurement: FlowMeasurementInput,\n): LayoutBox[] {\n const prepared = materializeLayoutChildren(children, 'Flow');\n return resolveFlowPlacements(container, prepared, style, measurement)\n .map(placement => placement.box);\n}\n\nfunction resolveFlowPlacements(\n container: Readonly<LayoutBox>,\n children: readonly PibblElement<any>[],\n style: Readonly<FlowStyle>,\n measurement: FlowMeasurementInput,\n): FlowPlacement[] {\n assertFiniteContainer(container);\n const options = normalizeFlowOptions(style, container);\n const items: FlowItem[] = [];\n for (const child of children) {\n const receiverToken = getChildPrimitiveReceiverToken(\n GLOBAL_STATE.renderTransaction,\n GLOBAL_STATE.primitiveReceiverToken,\n items.length,\n );\n const prepared = prepareDirectChildStyle(child, receiverToken, container);\n const normalized = preparedStyleValue(prepared) as Readonly<\n BoxStyle & LayoutItemStyle\n >;\n assertSupportedChildPosition('Flow', child, normalized);\n const needsWidth = normalized.width === undefined || normalized.width === 'auto';\n const needsHeight = normalized.height === undefined || normalized.height === 'auto';\n let measuredWidth: number | undefined;\n let measuredHeight: number | undefined;\n if (needsWidth || needsHeight) {\n const constraints = {\n minWidth: 0,\n maxWidth: container.width,\n minHeight: 0,\n maxHeight: container.height,\n };\n const measurementChild = clonePibblElement(child);\n setPreNormalizedStyle(\n measurementChild,\n normalized,\n child,\n receiverToken,\n preparedStyleQuery(prepared),\n );\n const result = measurement.measureElement(measurementChild, constraints);\n if (result.status === 'unsupported') {\n const axis = needsWidth ? 'width' : 'height';\n throw layoutDiagnostic({\n component: child.type.name || 'Anonymous',\n property: axis,\n value: normalized[axis] ?? 'auto',\n algorithm: 'flow',\n constraints,\n reason: `measurement is required but unsupported: ${result.reason}`,\n });\n }\n measuredWidth = result.size.width;\n measuredHeight = result.size.height;\n }\n const resolvedStyle = {\n ...normalized,\n width: needsWidth ? measuredWidth : normalized.width,\n height: needsHeight ? measuredHeight : normalized.height,\n };\n const resolved = resolveDirectChildBox(\n container,\n child,\n 'flow',\n resolvedStyle,\n );\n const box = resolved.borderBox;\n items.push({\n child,\n normalized: Object.freeze(resolvedStyle),\n width: box.width,\n height: box.height,\n horizontalPadding: box.width - resolved.contentBox.width,\n verticalPadding: box.height - resolved.contentBox.height,\n alignment: resolveItemAlignment(\n normalized.alignSelf,\n options.alignItems,\n child,\n container,\n ),\n receiverToken,\n query: preparedStyleQuery(prepared),\n });\n }\n\n const boxes = arrangeFlowItems(container, items, options);\n return boxes.map((box, index) => ({\n box,\n element: childWithUsedSize(\n items[index].child,\n items[index].normalized,\n Math.max(0, box.width - items[index].horizontalPadding),\n Math.max(0, box.height - items[index].verticalPadding),\n items[index].receiverToken,\n items[index].query,\n ),\n }));\n}\n\nfunction measureFlow(\n input: MeasureInput<FlowProps, FlowStyle>,\n): MeasureResult {\n const children = prepareLayoutChildren(input.props.children, 'Flow');\n const widthDefinite = input.style.width !== undefined &&\n input.style.width !== 'auto';\n const heightDefinite = input.style.height !== undefined &&\n input.style.height !== 'auto';\n const provisional = provisionalFlowBox(input.style, input.constraints);\n if (widthDefinite && heightDefinite) {\n return { status: 'measured', size: {\n width: provisional.content.width,\n height: provisional.content.height,\n } };\n }\n\n const placements = resolveFlowPlacements(\n provisional.content,\n children,\n input.style,\n input,\n );\n let intrinsicWidth = 0;\n let intrinsicHeight = 0;\n for (const placement of placements) {\n intrinsicWidth = Math.max(\n intrinsicWidth,\n placement.box.x - provisional.content.x + placement.box.width,\n );\n intrinsicHeight = Math.max(\n intrinsicHeight,\n placement.box.y - provisional.content.y + placement.box.height,\n );\n }\n validateMeasuredExtent(intrinsicWidth, 'width', input.constraints);\n validateMeasuredExtent(intrinsicHeight, 'height', input.constraints);\n return { status: 'measured', size: {\n width: widthDefinite ? provisional.content.width : intrinsicWidth,\n height: heightDefinite ? provisional.content.height : intrinsicHeight,\n } };\n}\n\nfunction provisionalFlowBox(\n style: Readonly<FlowStyle>,\n constraints: Readonly<Constraints>,\n): { border: LayoutBox; content: LayoutBox } {\n const diagnosticContext = {\n component: 'Flow',\n algorithm: 'measurement',\n constraints,\n };\n const padding = normalizeEdges(style.padding, 'padding', diagnosticContext);\n const width = finiteMeasurementBound(\n constraints.maxWidth,\n [style.width, style.minWidth, style.maxWidth],\n padding.left + padding.right,\n 'width',\n constraints,\n );\n const height = finiteMeasurementBound(\n constraints.maxHeight,\n [style.height, style.minHeight, style.maxHeight],\n padding.top + padding.bottom,\n 'height',\n constraints,\n );\n const box = resolveContainerBox(style, {\n allocation: { x: 0, y: 0, width, height },\n percentageBasis: { x: 0, y: 0, width, height },\n constraints,\n component: 'Flow',\n algorithm: 'render-dispatch',\n }, 'Flow', 'measurement');\n return { border: box.borderBox, content: box.contentBox };\n}\n\nfunction finiteMeasurementBound(\n maximum: number,\n specified: readonly (BoxStyle['width'] | undefined)[],\n padding: number,\n property: 'width' | 'height',\n constraints: Readonly<Constraints>,\n): number {\n if (Number.isFinite(maximum)) return maximum;\n const numeric = specified.filter(\n (value): value is number => typeof value === 'number' && Number.isFinite(value),\n );\n if (numeric.length > 0) {\n const bound = Math.max(...numeric) + padding;\n if (Number.isFinite(bound)) return bound;\n throw layoutDiagnostic({\n component: 'Flow',\n property,\n value: bound,\n algorithm: 'measurement',\n constraints,\n reason: 'measurement allocation arithmetic must remain finite',\n });\n }\n const percentage = specified.find(\n value => typeof value === 'string' && value.endsWith('%'),\n );\n if (percentage !== undefined) {\n throw layoutDiagnostic({\n component: 'Flow',\n property,\n value: percentage,\n algorithm: 'measurement',\n constraints,\n reason: 'requires a definite finite percentage reference',\n });\n }\n return Number.MAX_SAFE_INTEGER;\n}\n\nfunction validateMeasuredExtent(\n value: number,\n property: string,\n constraints: Readonly<Constraints>,\n): void {\n if (!Number.isFinite(value) || value < 0) {\n throw layoutDiagnostic({\n component: 'Flow',\n property,\n value,\n algorithm: 'measurement',\n constraints,\n reason: 'intrinsic flow extent must be finite and nonnegative',\n });\n }\n}\n\nfunction arrangeFlowItems(\n container: Readonly<LayoutBox>,\n items: readonly FlowItem[],\n options: ReturnType<typeof normalizeFlowOptions>,\n): LayoutBox[] {\n const horizontal = options.direction === 'horizontal';\n const mainBound = horizontal ? container.width : container.height;\n const lines: FlowItem[][] = [];\n let line: FlowItem[] = [];\n let occupiedMain = 0;\n for (const item of items) {\n const mainSize = horizontal ? item.width : item.height;\n const nextMain = line.length === 0 ?\n mainSize :\n occupiedMain + options.gap + mainSize;\n if (options.wrap && line.length > 0 && nextMain > mainBound) {\n lines.push(line);\n line = [];\n occupiedMain = 0;\n }\n occupiedMain = line.length === 0 ?\n mainSize :\n occupiedMain + options.gap + mainSize;\n line.push(item);\n }\n if (line.length > 0) lines.push(line);\n\n const placements: LayoutBox[] = [];\n let crossCursor = 0;\n for (const currentLine of lines) {\n const lineCross = Math.max(0, ...currentLine.map(item =>\n horizontal ? item.height : item.width,\n ));\n let mainCursor = 0;\n for (const item of currentLine) {\n const itemMain = horizontal ? item.width : item.height;\n const itemCross = horizontal ? item.height : item.width;\n const crossOffset = alignCross(lineCross, itemCross, item.alignment);\n const placedCross = item.alignment === 'stretch' ?\n Math.max(0, lineCross) :\n itemCross;\n placements.push(horizontal ? {\n x: container.x + mainCursor,\n y: container.y + crossCursor + crossOffset,\n width: itemMain,\n height: placedCross,\n } : {\n x: container.x + crossCursor + crossOffset,\n y: container.y + mainCursor,\n width: placedCross,\n height: itemMain,\n });\n mainCursor += itemMain + options.gap;\n }\n crossCursor += lineCross + options.lineGap;\n }\n return placements;\n}\n\nfunction normalizeFlowOptions(\n style: Readonly<FlowStyle>,\n container: Readonly<LayoutBox>,\n) {\n const direction = style.direction ?? 'horizontal';\n if (direction !== 'horizontal' && direction !== 'vertical') {\n throw optionDiagnostic('direction', direction, container);\n }\n if (style.wrap !== undefined && typeof style.wrap !== 'boolean') {\n throw optionDiagnostic('wrap', style.wrap, container);\n }\n const alignItems = style.alignItems ?? 'start';\n if (\n alignItems !== 'start' && alignItems !== 'center' &&\n alignItems !== 'end' && alignItems !== 'stretch'\n ) {\n throw optionDiagnostic('alignItems', alignItems, container);\n }\n return {\n direction,\n wrap: style.wrap ?? false,\n gap: nonnegativeOption(style.gap ?? 0, 'gap', container),\n lineGap: nonnegativeOption(style.lineGap ?? 0, 'lineGap', container),\n alignItems,\n };\n}\n\nfunction nonnegativeOption(\n value: number,\n property: string,\n container: Readonly<LayoutBox>,\n): number {\n if (!Number.isFinite(value) || value < 0) {\n throw optionDiagnostic(property, value, container);\n }\n return value;\n}\n\nfunction resolveItemAlignment(\n value: LayoutItemStyle['alignSelf'],\n fallback: FlowAlignment,\n child: PibblElement<any>,\n container: Readonly<LayoutBox>,\n): FlowAlignment {\n if (value === undefined || value === 'auto') return fallback;\n if (value === 'start' || value === 'center' || value === 'end' || value === 'stretch') {\n return value;\n }\n throw layoutDiagnostic({\n component: child.type.name || 'Anonymous',\n property: 'alignSelf',\n value,\n algorithm: 'flow',\n constraints: constraintsFor(container),\n reason: 'uses an unsupported flow alignment value',\n });\n}\n\nfunction alignCross(\n lineCross: number,\n itemCross: number,\n alignment: FlowAlignment,\n): number {\n if (alignment === 'center') return (lineCross - itemCross) / 2;\n if (alignment === 'end') return lineCross - itemCross;\n return 0;\n}\n\nfunction assertFiniteContainer(container: Readonly<LayoutBox>): void {\n for (const [property, value] of Object.entries(container)) {\n if (!Number.isFinite(value) ||\n ((property === 'width' || property === 'height') && value < 0)) {\n throw optionDiagnostic(property, value, container);\n }\n }\n}\n\nfunction optionDiagnostic(\n property: string,\n value: unknown,\n container: Readonly<LayoutBox>,\n) {\n return layoutDiagnostic({\n component: 'Flow',\n property,\n value,\n algorithm: 'flow',\n constraints: constraintsFor(container),\n reason: 'uses an unsupported flow value',\n });\n}\n\nfunction constraintsFor(container: Readonly<LayoutBox>) {\n return {\n minWidth: 0,\n maxWidth: container.width,\n minHeight: 0,\n maxHeight: container.height,\n };\n}\n"],
|
|
5
|
-
"mappings": "AAAA,SAAS,oBAAoB,0BAA8C;AAC3E,SAAS,uBAAuB;AAChC,SAAS,yBAAyB;AAClC,SAAS,sCAAsC;AAE/C,SAAS,oBAAoB;AAC7B,SAAS,wBAAwB;AACjC;AAAA,EAEE;AAAA,OACK;AACP,SAAS,sBAAsB;AAC/B,SAAS,6BAA6B;AAUtC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,qBAAqB;AAC9B,SAAS,8BAA8B;AACvC,SAAS,oCAAoC;AAC7C,SAAS,sBAAsB;AAwE/B,SAAS,WACP,OACA,OACA,KACA;AACA,uBAAqB,KAAK;AAC1B,QAAM,WAAW,sBAAsB,MAAM,UAAU,MAAM;AAC7D,yBAAuB;AACvB,QAAM,UAAU,MAAM,IAAI;AAC1B,MAAI,UAAU,QAAQ,GAAG,QAAQ,CAAC;AAClC,QAAM,eAAe,OAAO,OAAO;AAAA,IACjC,GAAG;AAAA,IACH,GAAG;AAAA,IACH,OAAO,QAAQ;AAAA,IACf,QAAQ,QAAQ;AAAA,EAClB,CAAC;AACD,QAAM,gBAAgB,cAAc,YAAY;AAChD,eAAa,cAAe,gBAAgB;AAC5C,QAAM,UAAU;AAAA,IACd,YAAY,OAAe,MAAc;AACvC,UAAI,KAAK;AACT,UAAI;AACF,YAAI,OAAO;AACX,eAAO,IAAI,YAAY,KAAK;AAAA,MAC9B,UAAE;AACA,YAAI,QAAQ;AAAA,MACd;AAAA,IACF;AAAA,EACF;AACA,QAAM,aAAa;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
+
"sourcesContent": ["import { withAllocationCheckpoint } from './allocation-checkpoint.js';\nimport { contentBoxStyle } from './box-sizing.js';\nimport { canvasMeasurementService } from './canvas-measurement.js';\nimport { nativeLayout, mountedLayoutRegion, type LayoutRegion, recordWasmAllocationPass, recordWasmAllocationItem, recordWasmAllocationCacheHit } from './wasm/region.js';\nimport { prepareKnownLayoutDescendants, registerKnownLayoutPreflight, claimPreparedLayoutPlan, stagePreparedLayoutPlan, preparePlacedKnownLayout, type PreparedLayoutPlan } from './prepared-root.js';\nimport { getStyleMeasurementMode, preparedStyleValue, preparedStyleQuery, type PreparedQuery } from '../style/responsive.js';\nimport { definePrimitive } from '../define-primitive.js';\nimport { clonePibblElement } from '../element/create-element.js';\nimport { getChildPrimitiveReceiverToken } from '../element/metadata.js';\nimport type { PibblElement } from '../element/types.js';\nimport { GLOBAL_STATE } from '../global-state.js';\nimport { layoutDiagnostic } from '../style/diagnostics.js';\nimport {\n type PibblStructuralEventProps,\n wireStructuralEvents,\n} from '../components/structural-events.js';\nimport { normalizeBoxInsets, hasPercentageBoxPadding, resolveAllocatedInsets } from './box-insets.js';\nimport { setPreNormalizedStyle } from '../style/resolve-dispatch.js';\nimport type { BoxStyle, LayoutItemStyle, ResolvedBoxStyle } from '../style/types.js';\nimport type {\n CanvasMeasurementService,\n PibblNodeInput,\n IntrinsicMeasureInput,\n IntrinsicSizesResult,\n MeasureInput,\n MeasureResult,\n RenderingContext2D,\n SystemStyle,\n} from '../types.js';\nimport {\n childWithUsedSize,\n materializeLayoutChildren,\n prepareDirectChildStyle,\n placeDirectChildren,\n prepareLayoutChildren,\n resolveContainerBox,\n resolveDirectChildBox,\n} from './absolute.js';\nimport { pushLayoutBox, resolvePositionedContainingBox } from './context.js';\nimport { recordLayoutEvaluation } from './diagnostics.js';\nimport { assertSupportedChildPosition } from './positioning-diagnostics.js';\nimport { measureElement, measureIntrinsicElement } from './measure.js';\nimport type { Constraints, LayoutBox } from './types.js';\n\ntype FlowDirection = 'horizontal' | 'vertical';\ntype FlowAlignment = 'start' | 'center' | 'end' | 'stretch';\n\n/**\n * Supported geometry and presentation properties for Flow.\n *\n * @see {@link BoxStyle}\n * @see {@link LayoutItemStyle}\n * @see {@link Flow}\n */\nexport interface FlowStyle extends BoxStyle, LayoutItemStyle {\n /** Direction in which this operation proceeds. See {@link FlowDirection}. */\n direction?: FlowDirection;\n /** Whether content may wrap into additional lines. See {@link FlowStyle}. */\n wrap?: boolean;\n /** Spacing between adjacent items. See {@link FlowStyle}. */\n gap?: number;\n /** Space between wrapped flow lines. See {@link FlowStyle}. */\n lineGap?: number;\n /** Default alignment of children on the cross or block axis. See {@link FlowAlignment}. */\n alignItems?: FlowAlignment;\n}\n\n/**\n * Authored inputs for Flow, including the declared data and presentation options.\n *\n * @see {@link PibblNodeInput}\n * @see {@link Flow}\n */\nexport interface FlowProps extends PibblStructuralEventProps {\n /** Descendant content or the callback that supplies it. See {@link PibblNodeInput}. */\n children: PibblNodeInput;\n}\n\n// Parent input is private metadata, not a recursively validated resolved value.\nconst FLOW_CONTAINING_BOX_STYLE = Symbol('pibbl.flow-containing-box-style');\n\ninterface ResolvedFlowStyle extends SystemStyle {\n box: ResolvedBoxStyle;\n [FLOW_CONTAINING_BOX_STYLE]: Readonly<FlowStyle>;\n overflow: 'visible' | 'clip';\n direction: FlowDirection;\n wrap: boolean;\n gap: number;\n lineGap: number;\n alignItems: FlowAlignment;\n}\n\ninterface FlowItem {\n child: PibblElement<any>;\n normalized: Readonly<SystemStyle>;\n width: number;\n height: number;\n horizontalPadding: number;\n verticalPadding: number;\n alignment: FlowAlignment;\n receiverToken: object;\n query?: PreparedQuery;\n}\n\nexport interface FlowMeasurementInput {\n service: CanvasMeasurementService;\n measureElement(\n element: PibblElement<any>,\n constraints: Readonly<Constraints>,\n ): MeasureResult;\n}\n\ninterface FlowPlacement {\n usedWidth: number; usedHeight: number;\n box: LayoutBox;\n element: PibblElement<any>;\n}\n\nfunction renderFlow(\n props: FlowProps,\n style: Readonly<ResolvedFlowStyle>,\n ctx: RenderingContext2D,\n) {\n wireStructuralEvents(props);\n recordLayoutEvaluation();\n const content = style.box.contentBox;\n ctx.translate(content.x, content.y);\n const localContent = Object.freeze({\n x: 0,\n y: 0,\n width: content.width,\n height: content.height,\n });\n const releaseLayout = pushLayoutBox(localContent, {\n logicalOffset: content,\n containingBlock: resolvePositionedContainingBox(\n style[FLOW_CONTAINING_BOX_STYLE],\n localContent,\n 'Flow',\n ),\n });\n GLOBAL_STATE.componentRefs!.onAfterRender = releaseLayout;\n const prepared = nativeLayout ? claimPreparedLayoutPlan(GLOBAL_STATE.componentRefs!.element, localContent) : undefined;\n const nativeRegion = prepared?.region ?? (nativeLayout ? mountedLayoutRegion() : undefined);\n if (nativeLayout && !nativeRegion) throw new Error('Experimental Flow requires its mounted native region.');\n const plan = prepared ?? prepareFlowAllocation(props, style, localContent, ctx, nativeRegion);\n const { children, placements } = plan;\n let index = 0;\n return placeDirectChildren(\n children,\n localContent,\n (_child, occurrence) => {\n const placement = placements[index++];\n if (nativeLayout && !prepared) preparePlacedKnownLayout(placement.element, occurrence);\n return placement;\n },\n style.overflow,\n );\n}\n\n/**\n * Describes sequential flow layout for JSX or createElement authoring.\n *\n * @param props - Authored component inputs, supplied through JSX or createElement. See the linked\n * props and style types.\n * @throws When called directly; Pibbl mounts this component through JSX or createElement.\n *\n * @see {@link FlowProps}\n * @see {@link FlowStyle}\n */\nexport const Flow = definePrimitive<\n FlowProps,\n FlowStyle,\n FlowStyle,\n ResolvedFlowStyle\n>(renderFlow, {\n childInput: 'structural',\n resolveStyle: (style, context) => {\n if (nativeLayout && hasPercentageBoxPadding(style)) {\n style = resolveAllocatedInsets(style, { width: context.percentageBasis.width,\n context: { ...context, component: 'Flow', algorithm: 'flow' } });\n }\n return {\n box: resolveContainerBox(style, context, 'Flow', 'flow'),\n [FLOW_CONTAINING_BOX_STYLE]: style,\n overflow: style.overflow ?? 'visible',\n ...normalizeFlowOptions(style, context.allocation),\n };\n },\n measure: input => measureFlow(input),\n measureIntrinsic: input => measureFlowIntrinsic(input),\n});\n\ninterface IntrinsicFlowItem {\n readonly child: PibblElement<any>;\n readonly style: Readonly<BoxStyle & LayoutItemStyle>;\n readonly receiver: object;\n readonly query?: PreparedQuery;\n readonly horizontalInsets: number;\n readonly verticalInsets: number;\n readonly minWidth: number;\n readonly maxWidth: number;\n}\n\n/** Pure paired contributions for a declared Flow sequence. */\nfunction measureFlowIntrinsic(\n input: IntrinsicMeasureInput<FlowProps, FlowStyle>,\n): IntrinsicSizesResult {\n const maximumWidth = intrinsicConstraintMaximum(input.constraints.width);\n const maximumHeight = intrinsicConstraintMaximum(input.constraints.height);\n const owner = { x: 0, y: 0, width: maximumWidth, height: maximumHeight };\n const options = normalizeFlowOptions(input.style, owner);\n const children = materializeLayoutChildren(input.props.children, 'Flow');\n const items: IntrinsicFlowItem[] = [];\n let maximumWidthContribution = 0;\n let minimumWidthContribution = 0;\n\n for (let index = 0; index < children.length; index++) {\n const child = children[index]!;\n const receiver = getChildPrimitiveReceiverToken(\n GLOBAL_STATE.renderTransaction,\n GLOBAL_STATE.primitiveReceiverToken,\n index,\n );\n const prepared = prepareDirectChildStyle(child, receiver, owner);\n let style = preparedStyleValue(prepared) as Readonly<BoxStyle & LayoutItemStyle>;\n if (hasIntrinsicPercentageCycle(style)) {\n return { status: 'unsupported', reason: 'Flow intrinsic percentage child sizes require a definite owner allocation' };\n }\n if (style.boxSizing !== undefined) {\n style = contentBoxStyle(style, {\n width: owner.width,\n height: owner.height,\n context: {\n component: child.type.name || 'Anonymous', algorithm: 'Flow intrinsic measurement',\n constraints: { minWidth: 0, maxWidth: owner.width, minHeight: 0, maxHeight: owner.height },\n },\n });\n }\n assertSupportedChildPosition('Flow', child, style);\n const insets = normalizeBoxInsets(style, {\n component: child.type.name || 'Anonymous', algorithm: 'Flow intrinsic measurement',\n constraints: { minWidth: 0, maxWidth: owner.width, minHeight: 0, maxHeight: owner.height },\n });\n const horizontalInsets = insets.left + insets.right;\n const verticalInsets = insets.top + insets.bottom;\n let minWidth: number;\n let maxWidth: number;\n if (typeof style.width === 'number' && typeof style.height === 'number') {\n minWidth = style.width + horizontalInsets;\n maxWidth = minWidth;\n } else {\n const measuredChild = clonePibblElement(child);\n setPreNormalizedStyle(measuredChild, style, child, receiver, preparedStyleQuery(prepared));\n const measured = measureIntrinsicElement(measuredChild, {\n minWidth: 0, maxWidth: owner.width, minHeight: 0, maxHeight: owner.height,\n }, input.service);\n if (measured.status !== 'measured') return measured;\n minWidth = (typeof style.width === 'number' ? style.width : measured.minContent.width) + horizontalInsets;\n maxWidth = (typeof style.width === 'number' ? style.width : measured.maxContent.width) + horizontalInsets;\n }\n if (!Number.isFinite(minWidth) || !Number.isFinite(maxWidth) || minWidth < 0 || maxWidth < minWidth) {\n return { status: 'unsupported', reason: 'Flow intrinsic child widths must be finite and ordered' };\n }\n items.push({ child, style, receiver, query: preparedStyleQuery(prepared), horizontalInsets, verticalInsets, minWidth, maxWidth });\n minimumWidthContribution = options.wrap ? Math.max(minimumWidthContribution, minWidth) : minimumWidthContribution + minWidth;\n maximumWidthContribution += maxWidth;\n }\n const gaps = Math.max(0, items.length - 1) * options.gap;\n if (!options.wrap) minimumWidthContribution += gaps;\n maximumWidthContribution += gaps;\n const minimumHeight = measureIntrinsicFlowHeight(items, minimumWidthContribution, false, options, input, owner);\n if (minimumHeight.status !== 'measured') return minimumHeight;\n const maximumHeightResult = measureIntrinsicFlowHeight(items, maximumWidthContribution, true, options, input, owner);\n if (maximumHeightResult.status !== 'measured') return maximumHeightResult;\n return {\n status: 'measured',\n minContent: { width: minimumWidthContribution, height: minimumHeight.height },\n maxContent: { width: maximumWidthContribution, height: maximumHeightResult.height },\n };\n}\n\nfunction intrinsicConstraintMaximum(constraint: IntrinsicMeasureInput<FlowProps, FlowStyle>['constraints']['width']): number {\n return constraint.kind === 'bounded' ? constraint.max : Number.MAX_SAFE_INTEGER;\n}\n\nfunction hasIntrinsicPercentageCycle(style: Readonly<BoxStyle>): boolean {\n return hasPercentageBoxPadding(style) || isPercentageLength(style.width) || isPercentageLength(style.height) ||\n isPercentageLength(style.minWidth) || isPercentageLength(style.maxWidth) ||\n isPercentageLength(style.minHeight) || isPercentageLength(style.maxHeight);\n}\n\nfunction isPercentageLength(value: unknown): boolean {\n return typeof value === 'string' && value.endsWith('%');\n}\n\nfunction measureIntrinsicFlowHeight(\n items: readonly IntrinsicFlowItem[],\n width: number,\n maximumWidths: boolean,\n options: ReturnType<typeof normalizeFlowOptions>,\n input: IntrinsicMeasureInput<FlowProps, FlowStyle>,\n owner: Readonly<LayoutBox>,\n): Readonly<{ status: 'measured'; height: number }> | Readonly<{ status: 'unsupported'; reason: string }> {\n const placements: FlowItem[] = [];\n for (const item of items) {\n const selectedWidth = maximumWidths ? item.maxWidth : item.minWidth;\n const contentWidth = Math.max(0, (width === 0 ? 0 : options.wrap ? Math.min(width, selectedWidth) : selectedWidth) - item.horizontalInsets);\n let contentHeight: number;\n if (typeof item.style.height === 'number') {\n contentHeight = item.style.height;\n } else {\n const measuredChild = clonePibblElement(item.child);\n setPreNormalizedStyle(measuredChild, { ...item.style, width: contentWidth } as Readonly<BoxStyle & LayoutItemStyle>, item.child, item.receiver, item.query);\n const measured = measureElement(measuredChild, {\n minWidth: contentWidth, maxWidth: contentWidth,\n minHeight: 0, maxHeight: owner.height,\n }, input.service);\n if (measured.status !== 'measured') return measured;\n contentHeight = measured.size.height;\n }\n if (!Number.isFinite(contentHeight) || contentHeight < 0) {\n return { status: 'unsupported', reason: 'Flow intrinsic child heights must be finite and nonnegative' };\n }\n placements.push({\n child: item.child, normalized: item.style, width: contentWidth + item.horizontalInsets,\n height: contentHeight + item.verticalInsets, horizontalPadding: item.horizontalInsets,\n verticalPadding: item.verticalInsets, alignment: options.alignItems, receiverToken: item.receiver,\n query: item.query,\n });\n }\n const boxes = arrangeFlowItems({ x: 0, y: 0, width, height: owner.height }, placements, options);\n let height = 0;\n for (const box of boxes) height = Math.max(height, box.y + box.height);\n return { status: 'measured', height };\n}\n\nfunction prepareFlowAllocation(props: FlowProps, style: Readonly<FlowStyle>, content: Readonly<LayoutBox>, ctx: RenderingContext2D, region?: LayoutRegion): { children: readonly PibblElement<any>[]; placements: FlowPlacement[] } {\n const children = prepareLayoutChildren(props.children, 'Flow');\n const service = canvasMeasurementService(ctx);\n const placements = withAllocationCheckpoint(region, { children, content, settings: style, onHit: recordWasmAllocationCacheHit, calculate: () => resolveFlowPlacements(content, children, style, { service, measureElement: (child, constraints) => measureElement(child, constraints, service) }, region) });\n return { children, placements };\n}\nif (nativeLayout) registerKnownLayoutPreflight(Flow, (element, style, content, receiver, slot) => {\n const previous = GLOBAL_STATE.primitiveReceiverToken;\n GLOBAL_STATE.primitiveReceiverToken = receiver;\n const releaseLayout = pushLayoutBox(content, {\n containingBlock: resolvePositionedContainingBox(\n style as Readonly<FlowStyle>,\n content,\n 'Flow',\n ),\n });\n try {\n const options = normalizeFlowOptions(style as Readonly<FlowStyle>, content);\n const ctx = GLOBAL_STATE.renderContext;\n if (!ctx) throw new Error('Known Flow preparation requires a Canvas measurement context.');\n const region = slot.acquire();\n const allocation = prepareFlowAllocation(element.props as FlowProps, options, content, ctx, region);\n const plan: PreparedLayoutPlan = { region, content, ...allocation };\n prepareKnownLayoutDescendants(plan, slot);\n stagePreparedLayoutPlan(slot, plan);\n } finally {\n releaseLayout();\n GLOBAL_STATE.primitiveReceiverToken = previous;\n }\n});\n\nexport function layoutFlow(\n container: Readonly<LayoutBox>,\n children: PibblNodeInput,\n style: Readonly<FlowStyle>,\n measurement: FlowMeasurementInput,\n): LayoutBox[] {\n const prepared = materializeLayoutChildren(children, 'Flow');\n return resolveFlowPlacements(container, prepared, style, measurement)\n .map(placement => placement.box);\n}\n\nfunction resolveFlowPlacements(\n container: Readonly<LayoutBox>,\n children: readonly PibblElement<any>[],\n style: Readonly<FlowStyle>,\n measurement: FlowMeasurementInput,\n nativeRegion?: LayoutRegion,\n): FlowPlacement[] {\n if (nativeRegion) recordWasmAllocationPass();\n assertFiniteContainer(container);\n const options = normalizeFlowOptions(style, container);\n const items: FlowItem[] = [];\n for (const child of children) {\n if (nativeRegion) recordWasmAllocationItem();\n const receiverToken = getChildPrimitiveReceiverToken(\n GLOBAL_STATE.renderTransaction,\n GLOBAL_STATE.primitiveReceiverToken,\n items.length,\n );\n const prepared = prepareDirectChildStyle(child, receiverToken, container);\n let normalized = preparedStyleValue(prepared) as Readonly<\n BoxStyle & LayoutItemStyle\n >;\n if (nativeLayout && GLOBAL_STATE.currentPibblInstance && getStyleMeasurementMode() === undefined && hasPercentageBoxPadding(normalized)) {\n normalized = resolveAllocatedInsets(normalized, { width: container.width, context: { component: child.type.name || 'Anonymous', algorithm: 'flow' } });\n }\n if (normalized.boxSizing !== undefined) normalized = contentBoxStyle(normalized, { width: container.width, height: container.height, context: { component: child.type.name || 'Anonymous', algorithm: 'flow', constraints: { minWidth: 0, maxWidth: container.width, minHeight: 0, maxHeight: container.height } } });\n assertSupportedChildPosition('Flow', child, normalized);\n const needsWidth = normalized.width === undefined || normalized.width === 'auto';\n const needsHeight = normalized.height === undefined || normalized.height === 'auto';\n let measuredWidth: number | undefined;\n let measuredHeight: number | undefined;\n if (needsWidth || needsHeight) {\n const constraints = {\n minWidth: 0,\n maxWidth: container.width,\n minHeight: 0,\n maxHeight: container.height,\n };\n const measurementChild = clonePibblElement(child);\n setPreNormalizedStyle(\n measurementChild,\n normalized,\n child,\n receiverToken,\n preparedStyleQuery(prepared),\n );\n const result = measurement.measureElement(measurementChild, constraints);\n if (result.status === 'unsupported') {\n const axis = needsWidth ? 'width' : 'height';\n throw layoutDiagnostic({\n component: child.type.name || 'Anonymous',\n property: axis,\n value: normalized[axis] ?? 'auto',\n algorithm: 'flow',\n constraints,\n reason: `measurement is required but unsupported: ${result.reason}`,\n });\n }\n measuredWidth = result.size.width;\n measuredHeight = result.size.height;\n }\n const resolvedStyle = {\n ...normalized,\n width: needsWidth ? measuredWidth : normalized.width,\n height: needsHeight ? measuredHeight : normalized.height,\n };\n const resolved = resolveDirectChildBox(\n container,\n child,\n 'flow',\n resolvedStyle,\n measurement.service,\n receiverToken,\n );\n const box = resolved.borderBox;\n items.push({\n child,\n normalized: Object.freeze(resolvedStyle),\n width: box.width,\n height: box.height,\n horizontalPadding: box.width - resolved.contentBox.width,\n verticalPadding: box.height - resolved.contentBox.height,\n alignment: resolveItemAlignment(\n normalized.alignSelf,\n options.alignItems,\n child,\n container,\n ),\n receiverToken,\n query: preparedStyleQuery(prepared),\n });\n }\n\n const nativeBoxes = nativeRegion?.placeFlow(items, { horizontal: options.direction === 'horizontal', mainBound: options.direction === 'horizontal' ? container.width : container.height, gap: options.gap, lineGap: options.lineGap, wrap: options.wrap });\n const boxes = nativeBoxes ?? arrangeFlowItems(container, items, options);\n return boxes.map((box, index) => {\n const usedWidth = Math.max(0, box.width - items[index].horizontalPadding);\n const usedHeight = Math.max(0, box.height - items[index].verticalPadding);\n return {\n box: nativeBoxes && (container.x !== 0 || container.y !== 0) ? { x: container.x + box.x, y: container.y + box.y, width: box.width, height: box.height } : box,\n usedWidth, usedHeight,\n element: childWithUsedSize(items[index].child, items[index].normalized, usedWidth, usedHeight, items[index].receiverToken, items[index].query),\n };\n });\n}\n\nfunction measureFlow(\n input: MeasureInput<FlowProps, FlowStyle>,\n): MeasureResult {\n const children = prepareLayoutChildren(input.props.children, 'Flow');\n const widthDefinite = input.style.width !== undefined &&\n input.style.width !== 'auto';\n const heightDefinite = input.style.height !== undefined &&\n input.style.height !== 'auto';\n const provisional = provisionalFlowBox(input.style, input.constraints);\n if (widthDefinite && heightDefinite) {\n return { status: 'measured', size: {\n width: provisional.content.width,\n height: provisional.content.height,\n } };\n }\n\n const placements = resolveFlowPlacements(\n provisional.content,\n children,\n input.style,\n input,\n );\n let intrinsicWidth = 0;\n let intrinsicHeight = 0;\n for (const placement of placements) {\n intrinsicWidth = Math.max(\n intrinsicWidth,\n placement.box.x - provisional.content.x + placement.box.width,\n );\n intrinsicHeight = Math.max(\n intrinsicHeight,\n placement.box.y - provisional.content.y + placement.box.height,\n );\n }\n validateMeasuredExtent(intrinsicWidth, 'width', input.constraints);\n validateMeasuredExtent(intrinsicHeight, 'height', input.constraints);\n return { status: 'measured', size: {\n width: widthDefinite ? provisional.content.width : intrinsicWidth,\n height: heightDefinite ? provisional.content.height : intrinsicHeight,\n } };\n}\n\nfunction provisionalFlowBox(\n style: Readonly<FlowStyle>,\n constraints: Readonly<Constraints>,\n): { border: LayoutBox; content: LayoutBox } {\n const diagnosticContext = {\n component: 'Flow',\n algorithm: 'measurement',\n constraints,\n };\n const padding = normalizeBoxInsets(style, diagnosticContext);\n const width = finiteMeasurementBound(\n constraints.maxWidth,\n [style.width, style.minWidth, style.maxWidth],\n padding.left + padding.right,\n 'width',\n constraints,\n );\n const height = finiteMeasurementBound(\n constraints.maxHeight,\n [style.height, style.minHeight, style.maxHeight],\n padding.top + padding.bottom,\n 'height',\n constraints,\n );\n const box = resolveContainerBox(style, {\n allocation: { x: 0, y: 0, width, height },\n percentageBasis: { x: 0, y: 0, width, height },\n constraints,\n component: 'Flow',\n algorithm: 'render-dispatch',\n }, 'Flow', 'measurement');\n return { border: box.borderBox, content: box.contentBox };\n}\n\nfunction finiteMeasurementBound(\n maximum: number,\n specified: readonly (BoxStyle['width'] | undefined)[],\n padding: number,\n property: 'width' | 'height',\n constraints: Readonly<Constraints>,\n): number {\n if (Number.isFinite(maximum)) return maximum;\n const numeric = specified.filter(\n (value): value is number => typeof value === 'number' && Number.isFinite(value),\n );\n if (numeric.length > 0) {\n const bound = Math.max(...numeric) + padding;\n if (Number.isFinite(bound)) return bound;\n throw layoutDiagnostic({\n component: 'Flow',\n property,\n value: bound,\n algorithm: 'measurement',\n constraints,\n reason: 'measurement allocation arithmetic must remain finite',\n });\n }\n const percentage = specified.find(\n value => typeof value === 'string' && value.endsWith('%'),\n );\n if (percentage !== undefined) {\n throw layoutDiagnostic({\n component: 'Flow',\n property,\n value: percentage,\n algorithm: 'measurement',\n constraints,\n reason: 'requires a definite finite percentage reference',\n });\n }\n return Number.MAX_SAFE_INTEGER;\n}\n\nfunction validateMeasuredExtent(\n value: number,\n property: string,\n constraints: Readonly<Constraints>,\n): void {\n if (!Number.isFinite(value) || value < 0) {\n throw layoutDiagnostic({\n component: 'Flow',\n property,\n value,\n algorithm: 'measurement',\n constraints,\n reason: 'intrinsic flow extent must be finite and nonnegative',\n });\n }\n}\n\nfunction arrangeFlowItems(\n container: Readonly<LayoutBox>,\n items: readonly FlowItem[],\n options: ReturnType<typeof normalizeFlowOptions>,\n): LayoutBox[] {\n const horizontal = options.direction === 'horizontal';\n const mainBound = horizontal ? container.width : container.height;\n const lines: FlowItem[][] = [];\n let line: FlowItem[] = [];\n let occupiedMain = 0;\n for (const item of items) {\n const mainSize = horizontal ? item.width : item.height;\n const nextMain = line.length === 0 ?\n mainSize :\n occupiedMain + options.gap + mainSize;\n if (options.wrap && line.length > 0 && nextMain > mainBound) {\n lines.push(line);\n line = [];\n occupiedMain = 0;\n }\n occupiedMain = line.length === 0 ?\n mainSize :\n occupiedMain + options.gap + mainSize;\n line.push(item);\n }\n if (line.length > 0) lines.push(line);\n\n const placements: LayoutBox[] = [];\n let crossCursor = 0;\n for (const currentLine of lines) {\n const lineCross = Math.max(0, ...currentLine.map(item =>\n horizontal ? item.height : item.width,\n ));\n let mainCursor = 0;\n for (const item of currentLine) {\n const itemMain = horizontal ? item.width : item.height;\n const itemCross = horizontal ? item.height : item.width;\n const crossOffset = alignCross(lineCross, itemCross, item.alignment);\n const placedCross = item.alignment === 'stretch' ?\n Math.max(0, lineCross) :\n itemCross;\n placements.push(horizontal ? {\n x: container.x + mainCursor,\n y: container.y + crossCursor + crossOffset,\n width: itemMain,\n height: placedCross,\n } : {\n x: container.x + crossCursor + crossOffset,\n y: container.y + mainCursor,\n width: placedCross,\n height: itemMain,\n });\n mainCursor += itemMain + options.gap;\n }\n crossCursor += lineCross + options.lineGap;\n }\n return placements;\n}\n\nfunction normalizeFlowOptions(\n style: Readonly<FlowStyle>,\n container: Readonly<LayoutBox>,\n) {\n const direction = style.direction ?? 'horizontal';\n if (direction !== 'horizontal' && direction !== 'vertical') {\n throw optionDiagnostic('direction', direction, container);\n }\n if (style.wrap !== undefined && typeof style.wrap !== 'boolean') {\n throw optionDiagnostic('wrap', style.wrap, container);\n }\n const alignItems = style.alignItems ?? 'start';\n if (\n alignItems !== 'start' && alignItems !== 'center' &&\n alignItems !== 'end' && alignItems !== 'stretch'\n ) {\n throw optionDiagnostic('alignItems', alignItems, container);\n }\n return {\n direction,\n wrap: style.wrap ?? false,\n gap: nonnegativeOption(style.gap ?? 0, 'gap', container),\n lineGap: nonnegativeOption(style.lineGap ?? 0, 'lineGap', container),\n alignItems,\n };\n}\n\nfunction nonnegativeOption(\n value: number,\n property: string,\n container: Readonly<LayoutBox>,\n): number {\n if (!Number.isFinite(value) || value < 0) {\n throw optionDiagnostic(property, value, container);\n }\n return value;\n}\n\nfunction resolveItemAlignment(\n value: LayoutItemStyle['alignSelf'],\n fallback: FlowAlignment,\n child: PibblElement<any>,\n container: Readonly<LayoutBox>,\n): FlowAlignment {\n if (value === undefined || value === 'auto') return fallback;\n if (value === 'start' || value === 'center' || value === 'end' || value === 'stretch') {\n return value;\n }\n throw layoutDiagnostic({\n component: child.type.name || 'Anonymous',\n property: 'alignSelf',\n value,\n algorithm: 'flow',\n constraints: constraintsFor(container),\n reason: 'uses an unsupported flow alignment value',\n });\n}\n\nfunction alignCross(\n lineCross: number,\n itemCross: number,\n alignment: FlowAlignment,\n): number {\n if (alignment === 'center') return (lineCross - itemCross) / 2;\n if (alignment === 'end') return lineCross - itemCross;\n return 0;\n}\n\nfunction assertFiniteContainer(container: Readonly<LayoutBox>): void {\n for (const [property, value] of Object.entries(container)) {\n if (!Number.isFinite(value) ||\n ((property === 'width' || property === 'height') && value < 0)) {\n throw optionDiagnostic(property, value, container);\n }\n }\n}\n\nfunction optionDiagnostic(\n property: string,\n value: unknown,\n container: Readonly<LayoutBox>,\n) {\n return layoutDiagnostic({\n component: 'Flow',\n property,\n value,\n algorithm: 'flow',\n constraints: constraintsFor(container),\n reason: 'uses an unsupported flow value',\n });\n}\n\nfunction constraintsFor(container: Readonly<LayoutBox>) {\n return {\n minWidth: 0,\n maxWidth: container.width,\n minHeight: 0,\n maxHeight: container.height,\n };\n}\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,gCAAgC;AACzC,SAAS,uBAAuB;AAChC,SAAS,gCAAgC;AACzC,SAAS,cAAc,qBAAwC,0BAA0B,0BAA0B,oCAAoC;AACvJ,SAAS,+BAA+B,8BAA8B,yBAAyB,yBAAyB,gCAAyD;AACjL,SAAS,yBAAyB,oBAAoB,0BAA8C;AACpG,SAAS,uBAAuB;AAChC,SAAS,yBAAyB;AAClC,SAAS,sCAAsC;AAE/C,SAAS,oBAAoB;AAC7B,SAAS,wBAAwB;AACjC;AAAA,EAEE;AAAA,OACK;AACP,SAAS,oBAAoB,yBAAyB,8BAA8B;AACpF,SAAS,6BAA6B;AAYtC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,eAAe,sCAAsC;AAC9D,SAAS,8BAA8B;AACvC,SAAS,oCAAoC;AAC7C,SAAS,gBAAgB,+BAA+B;AAsCxD,MAAM,4BAA4B,uBAAO,iCAAiC;AAuC1E,SAAS,WACP,OACA,OACA,KACA;AACA,uBAAqB,KAAK;AAC1B,yBAAuB;AACvB,QAAM,UAAU,MAAM,IAAI;AAC1B,MAAI,UAAU,QAAQ,GAAG,QAAQ,CAAC;AAClC,QAAM,eAAe,OAAO,OAAO;AAAA,IACjC,GAAG;AAAA,IACH,GAAG;AAAA,IACH,OAAO,QAAQ;AAAA,IACf,QAAQ,QAAQ;AAAA,EAClB,CAAC;AACD,QAAM,gBAAgB,cAAc,cAAc;AAAA,IAChD,eAAe;AAAA,IACf,iBAAiB;AAAA,MACf,MAA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AACA,QAAM,iBAAiB;AAAA,IACrB,WAAW,MAAM,KAAK,QAAQ;AAAA,IAC9B,UAAU;AAAA,IACV;AAAA,IACA,WAAW;AAAA,IACX,aAAa,eAAe,SAAS;AAAA,IACrC,QAAQ;AAAA,EACV,CAAC;AACH;AAEA,SAAS,WACP,WACA,WACA,WACQ;AACR,MAAI,cAAc,SAAU,SAAQ,YAAY,aAAa;AAC7D,MAAI,cAAc,MAAO,QAAO,YAAY;AAC5C,SAAO;AACT;AAEA,SAAS,sBAAsB,WAAsC;AACnE,aAAW,CAAC,UAAU,KAAK,KAAK,OAAO,QAAQ,SAAS,GAAG;AACzD,QAAI,CAAC,OAAO,SAAS,KAAK,MACtB,aAAa,WAAW,aAAa,aAAa,QAAQ,GAAI;AAChE,YAAM,iBAAiB,UAAU,OAAO,SAAS;AAAA,IACnD;AAAA,EACF;AACF;AAEA,SAAS,iBACP,UACA,OACA,WACA;AACA,SAAO,iBAAiB;AAAA,IACtB,WAAW;AAAA,IACX;AAAA,IACA;AAAA,IACA,WAAW;AAAA,IACX,aAAa,eAAe,SAAS;AAAA,IACrC,QAAQ;AAAA,EACV,CAAC;AACH;AAEA,SAAS,eAAe,WAAgC;AACtD,SAAO;AAAA,IACL,UAAU;AAAA,IACV,UAAU,UAAU;AAAA,IACpB,WAAW;AAAA,IACX,WAAW,UAAU;AAAA,EACvB;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { HtmlFocusRegion } from '../focus/html-focus-region.js';
|
|
2
|
+
import type { PibblEventTargetRegistration } from '../events/registrations.js';
|
|
3
|
+
import type { LayoutBox } from './types.js';
|
|
4
|
+
import { type PibblPaintEntry } from '../events/paint-entry.js';
|
|
5
|
+
import type { PibblComponentRefs, PibblInstance, PibblRenderTransaction } from '../types.js';
|
|
6
|
+
interface GeometryBox {
|
|
7
|
+
readonly nodeId: number;
|
|
8
|
+
readonly width: number;
|
|
9
|
+
readonly height: number;
|
|
10
|
+
readonly x: number;
|
|
11
|
+
readonly y: number;
|
|
12
|
+
}
|
|
13
|
+
interface GeometryChange {
|
|
14
|
+
readonly previous: GeometryBox | undefined;
|
|
15
|
+
readonly current: GeometryBox | undefined;
|
|
16
|
+
}
|
|
17
|
+
interface GeometrySnapshot {
|
|
18
|
+
readonly generation: number;
|
|
19
|
+
readonly boxes: readonly GeometryBox[];
|
|
20
|
+
readonly changed: readonly GeometryChange[];
|
|
21
|
+
}
|
|
22
|
+
/** Internal immutable receipt; it never establishes a reactive geometry-to-style edge. */
|
|
23
|
+
export declare function snapshotLayoutGeometry(instance: PibblInstance): GeometrySnapshot;
|
|
24
|
+
/** Start one instance's staged geometry, preserving clean managed Layer receipts. */
|
|
25
|
+
export declare function beginLayoutGeometry(instance: PibblInstance, transaction: PibblRenderTransaction): void;
|
|
26
|
+
/** Record the final logical allocation and accumulated layout origin for this generation. */
|
|
27
|
+
export declare function stageLayoutGeometry(component: PibblComponentRefs<any>): void;
|
|
28
|
+
/** Input reads the last successful geometry, never the mutable paint preparation ledger. */
|
|
29
|
+
export declare function committedLayoutPaintEntries(instance: PibblInstance): readonly PibblPaintEntry[] | undefined;
|
|
30
|
+
/** Composes only committed parent bridges, including clean managed Layers. */
|
|
31
|
+
export declare function committedInstanceRootTransform(instance: PibblInstance): DOMMatrix | undefined;
|
|
32
|
+
/** Released registrations cannot be retained by either committed or prepared geometry. */
|
|
33
|
+
export declare function releaseLayoutTargetGeometry(target: PibblEventTargetRegistration): void;
|
|
34
|
+
/** Returns a published target rectangle, including an intentional absent rectangle. */
|
|
35
|
+
export declare function committedLayoutTargetBounds(target: PibblEventTargetRegistration): ReadonlyMap<PibblEventTargetRegistration, Readonly<LayoutBox> | undefined> | undefined;
|
|
36
|
+
interface PreparedHtmlGeometry {
|
|
37
|
+
readonly active: boolean;
|
|
38
|
+
readonly bounds: Readonly<LayoutBox>;
|
|
39
|
+
}
|
|
40
|
+
/** HTML and focus preflight share one candidate, without mutating the live region. */
|
|
41
|
+
export declare function stageLayoutHtmlGeometry(transaction: PibblRenderTransaction, region: HtmlFocusRegion, geometry: PreparedHtmlGeometry): void;
|
|
42
|
+
export declare function preparedLayoutHtmlGeometry(transaction: PibblRenderTransaction, region: HtmlFocusRegion): PreparedHtmlGeometry | undefined;
|
|
43
|
+
interface PreparedTargetGeometry {
|
|
44
|
+
readonly bounds: Readonly<LayoutBox> | undefined;
|
|
45
|
+
readonly transform: DOMMatrix;
|
|
46
|
+
}
|
|
47
|
+
/** Excludes retiring registrations from the candidate without touching committed ownership. */
|
|
48
|
+
export declare function stageLayoutTargetRetirement(transaction: PibblRenderTransaction, target: PibblEventTargetRegistration): void;
|
|
49
|
+
/** External renderer targets join geometry preparation without changing live registrations. */
|
|
50
|
+
export declare function stageLayoutTargetGeometry(transaction: PibblRenderTransaction, target: PibblEventTargetRegistration, geometry: PreparedTargetGeometry): void;
|
|
51
|
+
/** The shared preflight result used by both the receipt and focus candidates. */
|
|
52
|
+
export declare function preparedLayoutTargetBounds(transaction: PibblRenderTransaction, target: PibblEventTargetRegistration): Readonly<LayoutBox> | undefined;
|
|
53
|
+
export {};
|