@pibbl/core 0.0.1 → 0.0.3-alpha.109.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/THIRD_PARTY_NOTICES.txt +81 -0
- package/dist/features/machines/animation.d.ts +64 -0
- package/dist/features/machines/animation.js +55 -0
- package/dist/features/machines/animation.js.map +7 -0
- package/dist/features/machines/animation.mjs +1 -0
- package/dist/features/machines/assign.d.ts +16 -0
- package/dist/features/machines/assign.js +15 -0
- package/dist/features/machines/assign.js.map +7 -0
- package/dist/features/machines/callback.d.ts +9 -0
- package/dist/features/machines/callback.js +7 -0
- package/dist/features/machines/callback.js.map +7 -0
- package/dist/features/machines/hook.d.ts +30 -0
- package/dist/features/machines/hook.js +37 -0
- package/dist/features/machines/hook.js.map +7 -0
- package/dist/features/machines/index.d.ts +6 -0
- package/dist/features/machines/index.js +12 -0
- package/dist/features/machines/index.js.map +7 -0
- package/dist/features/machines/index.mjs +1 -0
- package/dist/features/machines/runtime.d.ts +18 -0
- package/dist/features/machines/runtime.js +363 -0
- package/dist/features/machines/runtime.js.map +7 -0
- package/dist/features/machines/types.d.ts +164 -0
- package/dist/features/physics/2d-geometry.d.ts +3 -3
- package/dist/features/physics/2d-geometry.js.map +1 -1
- package/dist/features/physics/2d-testing.d.ts +1 -1
- package/dist/features/physics/2d-testing.js +2 -2
- package/dist/features/physics/2d-testing.js.map +2 -2
- package/dist/features/physics/2d.d.ts +115 -62
- package/dist/features/physics/2d.js +59 -28
- package/dist/features/physics/2d.js.map +2 -2
- package/dist/features/physics/lib/2d/canvas/components.js +25 -21
- package/dist/features/physics/lib/2d/canvas/components.js.map +2 -2
- package/dist/features/physics/lib/2d/canvas/presentation.js +1 -2
- package/dist/features/physics/lib/2d/canvas/presentation.js.map +2 -2
- package/dist/features/physics/lib/2d/collision/casts.js +4 -2
- package/dist/features/physics/lib/2d/collision/casts.js.map +2 -2
- package/dist/features/physics/lib/2d/query-types.d.ts +6 -0
- package/dist/features/physics/lib/2d/runtime/controller.d.ts +7 -6
- package/dist/features/physics/lib/2d/runtime/controller.js +1 -1
- package/dist/features/physics/lib/2d/runtime/controller.js.map +2 -2
- package/dist/features/physics/lib/2d/runtime/obstacles.js +9 -11
- package/dist/features/physics/lib/2d/runtime/obstacles.js.map +2 -2
- package/dist/features/physics/lib/2d/shapes.js +8 -9
- package/dist/features/physics/lib/2d/shapes.js.map +2 -2
- package/dist/features/physics/lib/2d/types.d.ts +8 -30
- package/dist/features/physics/lib/2d/world/queries.d.ts +7 -6
- package/dist/features/physics/lib/2d/world/queries.js.map +2 -2
- package/dist/features/physics/lib/2d/world/rapier.js +22 -26
- package/dist/features/physics/lib/2d/world/rapier.js.map +2 -2
- package/dist/features/sprites/formats/aseprite.d.ts +5 -0
- package/dist/features/sprites/formats/texture-packer.d.ts +5 -0
- package/dist/features/sprites/index.d.ts +6 -0
- package/dist/features/sprites/loader.d.ts +25 -0
- package/dist/features/sprites/loader.js +6 -3
- package/dist/features/sprites/loader.js.map +2 -2
- package/dist/features/sprites/model.d.ts +75 -0
- package/dist/features/sprites/sprite.d.ts +22 -0
- package/dist/features/textures/index.d.ts +12 -2
- package/dist/features/textures/index.js +33 -1
- package/dist/features/textures/index.js.map +2 -2
- package/dist/features/textures/lib/chemical-field.d.ts +56 -0
- package/dist/features/textures/lib/chemical-field.js +154 -0
- package/dist/features/textures/lib/chemical-field.js.map +7 -0
- package/dist/features/textures/lib/chemical-recipes.d.ts +119 -0
- package/dist/features/textures/lib/chemical-recipes.js +275 -0
- package/dist/features/textures/lib/chemical-recipes.js.map +7 -0
- package/dist/features/textures/lib/definitions.d.ts +3 -18
- package/dist/features/textures/lib/definitions.js +17 -24
- package/dist/features/textures/lib/definitions.js.map +2 -2
- package/dist/features/textures/lib/geometric-patterns.d.ts +149 -0
- package/dist/features/textures/lib/geometric-patterns.js +305 -0
- package/dist/features/textures/lib/geometric-patterns.js.map +7 -0
- package/dist/features/textures/lib/gray-scott.d.ts +55 -0
- package/dist/features/textures/lib/gray-scott.js +37 -0
- package/dist/features/textures/lib/gray-scott.js.map +7 -0
- package/dist/features/textures/lib/palette.js +1 -3
- package/dist/features/textures/lib/palette.js.map +2 -2
- package/dist/features/textures/lib/patterns.d.ts +123 -0
- package/dist/features/textures/lib/patterns.js +344 -0
- package/dist/features/textures/lib/patterns.js.map +7 -0
- package/dist/features/textures/lib/rain-drops.js +2 -1
- package/dist/features/textures/lib/rain-drops.js.map +2 -2
- package/dist/features/textures/lib/reaction-diffusion.d.ts +3 -2
- package/dist/features/textures/lib/reaction-diffusion.js +9 -20
- package/dist/features/textures/lib/reaction-diffusion.js.map +2 -2
- package/dist/features/textures/lib/simulation.d.ts +10 -4
- package/dist/features/textures/lib/simulation.js +23 -13
- package/dist/features/textures/lib/simulation.js.map +2 -2
- package/dist/features/textures/lib/wasm/electric.js +8 -1
- package/dist/features/textures/lib/wasm/electric.js.map +2 -2
- package/dist/features/textures/lib/water-surface.js +1 -3
- package/dist/features/textures/lib/water-surface.js.map +2 -2
- package/dist/features/viz/index.d.ts +92 -5
- package/dist/features/viz/index.js +202 -4
- package/dist/features/viz/index.js.map +2 -2
- package/dist/features/viz/inspection/bar.d.ts +79 -0
- package/dist/features/viz/inspection/bar.js +49 -0
- package/dist/features/viz/inspection/bar.js.map +7 -0
- package/dist/features/viz/inspection/candle.d.ts +156 -0
- package/dist/features/viz/inspection/candle.js +120 -0
- package/dist/features/viz/inspection/candle.js.map +7 -0
- package/dist/features/viz/inspection/capture-types.d.ts +65 -0
- package/dist/features/viz/inspection/capture.d.ts +16 -0
- package/dist/features/viz/inspection/capture.js +49 -0
- package/dist/features/viz/inspection/capture.js.map +7 -0
- package/dist/features/viz/inspection/handler.d.ts +36 -0
- package/dist/features/viz/inspection/handler.js +91 -0
- package/dist/features/viz/inspection/handler.js.map +7 -0
- package/dist/features/viz/inspection/ohlc-bar.d.ts +132 -0
- package/dist/features/viz/inspection/ohlc-bar.js +118 -0
- package/dist/features/viz/inspection/ohlc-bar.js.map +7 -0
- package/dist/features/viz/inspection/owned-ref.d.ts +16 -0
- package/dist/features/viz/inspection/owned-ref.js +99 -0
- package/dist/features/viz/inspection/owned-ref.js.map +7 -0
- package/dist/features/viz/inspection/painted-point.d.ts +22 -0
- package/dist/features/viz/inspection/painted-point.js +29 -0
- package/dist/features/viz/inspection/painted-point.js.map +7 -0
- package/dist/features/viz/inspection/queries.d.ts +100 -0
- package/dist/features/viz/inspection/queries.js +192 -0
- package/dist/features/viz/inspection/queries.js.map +7 -0
- package/dist/features/viz/inspection/query-types.d.ts +177 -0
- package/dist/features/viz/inspection/volume.d.ts +104 -0
- package/dist/features/viz/inspection/volume.js +95 -0
- package/dist/features/viz/inspection/volume.js.map +7 -0
- package/dist/features/viz/inspection.d.ts +19 -0
- package/dist/features/viz/inspection.js +54 -0
- package/dist/features/viz/inspection.js.map +7 -0
- package/dist/features/viz/inspection.mjs +1 -0
- package/dist/features/viz/lib/area-series.d.ts +62 -0
- package/dist/features/viz/lib/area-series.js +120 -0
- package/dist/features/viz/lib/area-series.js.map +7 -0
- package/dist/features/viz/lib/axis-labels.d.ts +2 -0
- package/dist/features/viz/lib/axis-labels.js +41 -0
- package/dist/features/viz/lib/axis-labels.js.map +7 -0
- package/dist/features/viz/lib/axis-title.d.ts +23 -0
- package/dist/features/viz/lib/axis-title.js +24 -0
- package/dist/features/viz/lib/axis-title.js.map +7 -0
- package/dist/features/viz/lib/axis.d.ts +1 -1
- package/dist/features/viz/lib/axis.js +50 -50
- package/dist/features/viz/lib/axis.js.map +2 -2
- package/dist/features/viz/lib/bar-scale.d.ts +7 -0
- package/dist/features/viz/lib/bar-scale.js +34 -0
- package/dist/features/viz/lib/bar-scale.js.map +7 -0
- package/dist/features/viz/lib/bar-series.d.ts +3 -1
- package/dist/features/viz/lib/bar-series.js +21 -5
- package/dist/features/viz/lib/bar-series.js.map +2 -2
- package/dist/features/viz/lib/baseline-series.d.ts +55 -0
- package/dist/features/viz/lib/baseline-series.js +136 -0
- package/dist/features/viz/lib/baseline-series.js.map +7 -0
- package/dist/features/viz/lib/candlestick-series.d.ts +62 -0
- package/dist/features/viz/lib/candlestick-series.js +150 -0
- package/dist/features/viz/lib/candlestick-series.js.map +7 -0
- package/dist/features/viz/lib/censored-point-series.d.ts +71 -0
- package/dist/features/viz/lib/censored-point-series.js +129 -0
- package/dist/features/viz/lib/censored-point-series.js.map +7 -0
- package/dist/features/viz/lib/chart-lines.d.ts +41 -0
- package/dist/features/viz/lib/chart-lines.js +32 -0
- package/dist/features/viz/lib/chart-lines.js.map +7 -0
- package/dist/features/viz/lib/color-context.d.ts +4 -0
- package/dist/features/viz/lib/color-context.js +41 -0
- package/dist/features/viz/lib/color-context.js.map +7 -0
- package/dist/features/viz/lib/color-math.d.ts +4 -0
- package/dist/features/viz/lib/color-math.js +31 -0
- package/dist/features/viz/lib/color-math.js.map +7 -0
- package/dist/features/viz/lib/color-types.d.ts +53 -0
- package/dist/features/viz/lib/curve-definition.d.ts +49 -0
- package/dist/features/viz/lib/curve-definition.js +142 -0
- package/dist/features/viz/lib/curve-definition.js.map +7 -0
- package/dist/features/viz/lib/diverging-color-scale.d.ts +11 -0
- package/dist/features/viz/lib/diverging-color-scale.js +51 -0
- package/dist/features/viz/lib/diverging-color-scale.js.map +7 -0
- package/dist/features/viz/lib/domain-navigation.d.ts +40 -0
- package/dist/features/viz/lib/domain-navigation.js +77 -0
- package/dist/features/viz/lib/domain-navigation.js.map +7 -0
- package/dist/features/viz/lib/editable-chart-elements.d.ts +178 -0
- package/dist/features/viz/lib/editable-chart-elements.js +733 -0
- package/dist/features/viz/lib/editable-chart-elements.js.map +7 -0
- package/dist/features/viz/lib/financial-aggregation.d.ts +127 -0
- package/dist/features/viz/lib/financial-aggregation.js +116 -0
- package/dist/features/viz/lib/financial-aggregation.js.map +7 -0
- package/dist/features/viz/lib/financial-autoscale.d.ts +64 -0
- package/dist/features/viz/lib/financial-autoscale.js +61 -0
- package/dist/features/viz/lib/financial-autoscale.js.map +7 -0
- package/dist/features/viz/lib/financial-comparison.d.ts +62 -0
- package/dist/features/viz/lib/financial-comparison.js +98 -0
- package/dist/features/viz/lib/financial-comparison.js.map +7 -0
- package/dist/features/viz/lib/financial-geometry.d.ts +77 -0
- package/dist/features/viz/lib/financial-geometry.js +67 -0
- package/dist/features/viz/lib/financial-geometry.js.map +7 -0
- package/dist/features/viz/lib/financial-indicators.d.ts +114 -0
- package/dist/features/viz/lib/financial-indicators.js +135 -0
- package/dist/features/viz/lib/financial-indicators.js.map +7 -0
- package/dist/features/viz/lib/financial-oscillators.d.ts +171 -0
- package/dist/features/viz/lib/financial-oscillators.js +265 -0
- package/dist/features/viz/lib/financial-oscillators.js.map +7 -0
- package/dist/features/viz/lib/graph/bipartite.d.ts +14 -0
- package/dist/features/viz/lib/graph/bipartite.js +250 -0
- package/dist/features/viz/lib/graph/bipartite.js.map +7 -0
- package/dist/features/viz/lib/graph/chord.d.ts +44 -0
- package/dist/features/viz/lib/graph/chord.js +348 -0
- package/dist/features/viz/lib/graph/chord.js.map +7 -0
- package/dist/features/viz/lib/graph/dependency.d.ts +26 -0
- package/dist/features/viz/lib/graph/dependency.js +140 -0
- package/dist/features/viz/lib/graph/dependency.js.map +7 -0
- package/dist/features/viz/lib/graph/force.d.ts +28 -0
- package/dist/features/viz/lib/graph/force.js +580 -0
- package/dist/features/viz/lib/graph/force.js.map +7 -0
- package/dist/features/viz/lib/graph/hierarchy.d.ts +21 -0
- package/dist/features/viz/lib/graph/hierarchy.js +112 -0
- package/dist/features/viz/lib/graph/hierarchy.js.map +7 -0
- package/dist/features/viz/lib/graph/icicle.d.ts +16 -0
- package/dist/features/viz/lib/graph/icicle.js +153 -0
- package/dist/features/viz/lib/graph/icicle.js.map +7 -0
- package/dist/features/viz/lib/graph/matrix.d.ts +30 -0
- package/dist/features/viz/lib/graph/matrix.js +243 -0
- package/dist/features/viz/lib/graph/matrix.js.map +7 -0
- package/dist/features/viz/lib/graph/neighborhood.d.ts +11 -0
- package/dist/features/viz/lib/graph/neighborhood.js +281 -0
- package/dist/features/viz/lib/graph/neighborhood.js.map +7 -0
- package/dist/features/viz/lib/graph/routes.d.ts +35 -0
- package/dist/features/viz/lib/graph/routes.js +101 -0
- package/dist/features/viz/lib/graph/routes.js.map +7 -0
- package/dist/features/viz/lib/graph/sankey.d.ts +44 -0
- package/dist/features/viz/lib/graph/sankey.js +341 -0
- package/dist/features/viz/lib/graph/sankey.js.map +7 -0
- package/dist/features/viz/lib/graph/shared.d.ts +59 -0
- package/dist/features/viz/lib/graph/shared.js +301 -0
- package/dist/features/viz/lib/graph/shared.js.map +7 -0
- package/dist/features/viz/lib/graph/tree.d.ts +11 -0
- package/dist/features/viz/lib/graph/tree.js +232 -0
- package/dist/features/viz/lib/graph/tree.js.map +7 -0
- package/dist/features/viz/lib/graph/treemap.d.ts +20 -0
- package/dist/features/viz/lib/graph/treemap.js +227 -0
- package/dist/features/viz/lib/graph/treemap.js.map +7 -0
- package/dist/features/viz/lib/graph/types.d.ts +1097 -0
- package/dist/features/viz/lib/hover-card.js +8 -9
- package/dist/features/viz/lib/hover-card.js.map +2 -2
- package/dist/features/viz/lib/hover-data.d.ts +1 -1
- package/dist/features/viz/lib/hover-data.js +6 -3
- package/dist/features/viz/lib/hover-data.js.map +2 -2
- package/dist/features/viz/lib/hover-types.d.ts +5 -5
- package/dist/features/viz/lib/interval-band-series.d.ts +49 -0
- package/dist/features/viz/lib/interval-band-series.js +136 -0
- package/dist/features/viz/lib/interval-band-series.js.map +7 -0
- package/dist/features/viz/lib/interval-diamond-series.d.ts +43 -0
- package/dist/features/viz/lib/interval-diamond-series.js +122 -0
- package/dist/features/viz/lib/interval-diamond-series.js.map +7 -0
- package/dist/features/viz/lib/interval-series.d.ts +79 -0
- package/dist/features/viz/lib/interval-series.js +158 -0
- package/dist/features/viz/lib/interval-series.js.map +7 -0
- package/dist/features/viz/lib/layout-pie.js +9 -13
- package/dist/features/viz/lib/layout-pie.js.map +2 -2
- package/dist/features/viz/lib/line-series.d.ts +1 -1
- package/dist/features/viz/lib/line-series.js +47 -28
- package/dist/features/viz/lib/line-series.js.map +2 -2
- package/dist/features/viz/lib/linear-scale-component.d.ts +7 -0
- package/dist/features/viz/lib/linear-scale-component.js +18 -0
- package/dist/features/viz/lib/linear-scale-component.js.map +7 -0
- package/dist/features/viz/lib/linear-scale.js +1 -1
- package/dist/features/viz/lib/linear-scale.js.map +2 -2
- package/dist/features/viz/lib/log-scale-component.d.ts +7 -0
- package/dist/features/viz/lib/log-scale-component.js +19 -0
- package/dist/features/viz/lib/log-scale-component.js.map +7 -0
- package/dist/features/viz/lib/log-scale.d.ts +2 -0
- package/dist/features/viz/lib/log-scale.js +53 -0
- package/dist/features/viz/lib/log-scale.js.map +7 -0
- package/dist/features/viz/lib/monotone-curve.d.ts +11 -0
- package/dist/features/viz/lib/monotone-curve.js +63 -0
- package/dist/features/viz/lib/monotone-curve.js.map +7 -0
- package/dist/features/viz/lib/nearest.d.ts +9 -9
- package/dist/features/viz/lib/nearest.js.map +1 -1
- package/dist/features/viz/lib/numeric-range-interpolation.d.ts +15 -0
- package/dist/features/viz/lib/numeric-range-interpolation.js +36 -0
- package/dist/features/viz/lib/numeric-range-interpolation.js.map +7 -0
- package/dist/features/viz/lib/numeric-ticks.d.ts +38 -0
- package/dist/features/viz/lib/numeric-ticks.js +54 -0
- package/dist/features/viz/lib/numeric-ticks.js.map +7 -0
- package/dist/features/viz/lib/ohlc-bar-series.d.ts +55 -0
- package/dist/features/viz/lib/ohlc-bar-series.js +168 -0
- package/dist/features/viz/lib/ohlc-bar-series.js.map +7 -0
- package/dist/features/viz/lib/paired-series.d.ts +44 -0
- package/dist/features/viz/lib/paired-series.js +93 -0
- package/dist/features/viz/lib/paired-series.js.map +7 -0
- package/dist/features/viz/lib/pie-layout.js +2 -1
- package/dist/features/viz/lib/pie-layout.js.map +2 -2
- package/dist/features/viz/lib/plot-series.js +11 -6
- package/dist/features/viz/lib/plot-series.js.map +2 -2
- package/dist/features/viz/lib/plot-types.d.ts +4 -3
- package/dist/features/viz/lib/point-scale-component.d.ts +7 -0
- package/dist/features/viz/lib/point-scale-component.js +19 -0
- package/dist/features/viz/lib/point-scale-component.js.map +7 -0
- package/dist/features/viz/lib/point-scale.d.ts +2 -0
- package/dist/features/viz/lib/point-scale.js +45 -0
- package/dist/features/viz/lib/point-scale.js.map +7 -0
- package/dist/features/viz/lib/point-series.d.ts +1 -1
- package/dist/features/viz/lib/point-series.js +36 -9
- package/dist/features/viz/lib/point-series.js.map +2 -2
- package/dist/features/viz/lib/point-types.d.ts +5 -2
- package/dist/features/viz/lib/reference-band.d.ts +16 -0
- package/dist/features/viz/lib/reference-band.js +30 -0
- package/dist/features/viz/lib/reference-band.js.map +7 -0
- package/dist/features/viz/lib/scale-adjust.js +9 -4
- package/dist/features/viz/lib/scale-adjust.js.map +2 -2
- package/dist/features/viz/lib/scale-context.d.ts +5 -4
- package/dist/features/viz/lib/scale-context.js +15 -11
- package/dist/features/viz/lib/scale-context.js.map +2 -2
- package/dist/features/viz/lib/scale-provider.d.ts +2 -0
- package/dist/features/viz/lib/scale-provider.js +13 -0
- package/dist/features/viz/lib/scale-provider.js.map +7 -0
- package/dist/features/viz/lib/scale-ticks.d.ts +5 -0
- package/dist/features/viz/lib/scale-ticks.js +64 -0
- package/dist/features/viz/lib/scale-ticks.js.map +7 -0
- package/dist/features/viz/lib/scale-view.d.ts +4 -0
- package/dist/features/viz/lib/scale-view.js +21 -0
- package/dist/features/viz/lib/scale-view.js.map +7 -0
- package/dist/features/viz/lib/sequential-color-scale.d.ts +11 -0
- package/dist/features/viz/lib/sequential-color-scale.js +49 -0
- package/dist/features/viz/lib/sequential-color-scale.js.map +7 -0
- package/dist/features/viz/lib/series-position.d.ts +12 -0
- package/dist/features/viz/lib/series-position.js +44 -0
- package/dist/features/viz/lib/series-position.js.map +7 -0
- package/dist/features/viz/lib/step-curves.d.ts +19 -0
- package/dist/features/viz/lib/step-curves.js +53 -0
- package/dist/features/viz/lib/step-curves.js.map +7 -0
- package/dist/features/viz/lib/symlog-scale-component.d.ts +7 -0
- package/dist/features/viz/lib/symlog-scale-component.js +19 -0
- package/dist/features/viz/lib/symlog-scale-component.js.map +7 -0
- package/dist/features/viz/lib/symlog-scale.d.ts +2 -0
- package/dist/features/viz/lib/symlog-scale.js +38 -0
- package/dist/features/viz/lib/symlog-scale.js.map +7 -0
- package/dist/features/viz/lib/threshold-color-scale.d.ts +43 -0
- package/dist/features/viz/lib/threshold-color-scale.js +59 -0
- package/dist/features/viz/lib/threshold-color-scale.js.map +7 -0
- package/dist/features/viz/lib/trading-time-mapping.d.ts +32 -0
- package/dist/features/viz/lib/trading-time-mapping.js +89 -0
- package/dist/features/viz/lib/trading-time-mapping.js.map +7 -0
- package/dist/features/viz/lib/trading-time-scale.d.ts +83 -0
- package/dist/features/viz/lib/trading-time-scale.js +96 -0
- package/dist/features/viz/lib/trading-time-scale.js.map +7 -0
- package/dist/features/viz/lib/trajectory-series.d.ts +71 -0
- package/dist/features/viz/lib/trajectory-series.js +111 -0
- package/dist/features/viz/lib/trajectory-series.js.map +7 -0
- package/dist/features/viz/lib/types.d.ts +114 -21
- package/dist/features/viz/lib/use-bar-scale.d.ts +8 -0
- package/dist/features/viz/lib/use-bar-scale.js +9 -0
- package/dist/features/viz/lib/use-bar-scale.js.map +7 -0
- package/dist/features/viz/lib/use-continuous-scale.d.ts +8 -0
- package/dist/features/viz/lib/use-continuous-scale.js +14 -0
- package/dist/features/viz/lib/use-continuous-scale.js.map +7 -0
- package/dist/features/viz/lib/use-linear-scale.d.ts +8 -0
- package/dist/features/viz/lib/use-linear-scale.js +9 -0
- package/dist/features/viz/lib/use-linear-scale.js.map +7 -0
- package/dist/features/viz/lib/use-log-scale.d.ts +8 -0
- package/dist/features/viz/lib/use-log-scale.js +9 -0
- package/dist/features/viz/lib/use-log-scale.js.map +7 -0
- package/dist/features/viz/lib/use-point-scale.d.ts +8 -0
- package/dist/features/viz/lib/use-point-scale.js +9 -0
- package/dist/features/viz/lib/use-point-scale.js.map +7 -0
- package/dist/features/viz/lib/use-symlog-scale.d.ts +8 -0
- package/dist/features/viz/lib/use-symlog-scale.js +9 -0
- package/dist/features/viz/lib/use-symlog-scale.js.map +7 -0
- package/dist/features/viz/lib/use-utc-scale.d.ts +8 -0
- package/dist/features/viz/lib/use-utc-scale.js +9 -0
- package/dist/features/viz/lib/use-utc-scale.js.map +7 -0
- package/dist/features/viz/lib/utc-labels.d.ts +12 -0
- package/dist/features/viz/lib/utc-labels.js +27 -0
- package/dist/features/viz/lib/utc-labels.js.map +7 -0
- package/dist/features/viz/lib/utc-scale-component.d.ts +7 -0
- package/dist/features/viz/lib/utc-scale-component.js +18 -0
- package/dist/features/viz/lib/utc-scale-component.js.map +7 -0
- package/dist/features/viz/lib/utc-scale.d.ts +21 -0
- package/dist/features/viz/lib/utc-scale.js +124 -0
- package/dist/features/viz/lib/utc-scale.js.map +7 -0
- package/dist/features/viz/lib/volume-series.d.ts +59 -0
- package/dist/features/viz/lib/volume-series.js +117 -0
- package/dist/features/viz/lib/volume-series.js.map +7 -0
- package/dist/features/viz/lib/weighted-point-series.d.ts +71 -0
- package/dist/features/viz/lib/weighted-point-series.js +169 -0
- package/dist/features/viz/lib/weighted-point-series.js.map +7 -0
- package/dist/filters/backdrop-contrast-gpu.d.ts +5 -0
- package/dist/filters/backdrop-contrast-gpu.js +33 -0
- package/dist/filters/backdrop-contrast-gpu.js.map +7 -0
- package/dist/filters/backdrop-contrast.d.ts +21 -0
- package/dist/filters/backdrop-contrast.js +61 -0
- package/dist/filters/backdrop-contrast.js.map +7 -0
- package/dist/filters/displacement.js +1 -1
- package/dist/filters/displacement.js.map +2 -2
- package/dist/filters/emboss-gpu.d.ts +4 -0
- package/dist/filters/emboss-gpu.js +39 -0
- package/dist/filters/emboss-gpu.js.map +7 -0
- package/dist/filters/emboss.d.ts +32 -0
- package/dist/filters/emboss.js +104 -0
- package/dist/filters/emboss.js.map +7 -0
- package/dist/filters/filter-executor.d.ts +11 -4
- package/dist/filters/filter-executor.js +104 -49
- package/dist/filters/filter-executor.js.map +2 -2
- package/dist/filters/reflected-light.js +1 -1
- package/dist/filters/reflected-light.js.map +2 -2
- package/dist/filters/reflection-gpu.d.ts +3 -1
- package/dist/filters/reflection-gpu.js +5 -2
- package/dist/filters/reflection-gpu.js.map +2 -2
- package/dist/filters/render-backdrop-contrast-boundary.d.ts +31 -0
- package/dist/filters/render-backdrop-contrast-boundary.js +116 -0
- package/dist/filters/render-backdrop-contrast-boundary.js.map +7 -0
- package/dist/filters/render-emboss-boundary.d.ts +13 -0
- package/dist/filters/render-emboss-boundary.js +131 -0
- package/dist/filters/render-emboss-boundary.js.map +7 -0
- package/dist/filters.d.ts +9 -5
- package/dist/filters.js +4 -0
- package/dist/filters.js.map +2 -2
- package/dist/index.d.ts +10 -6
- package/dist/index.js +18 -2
- package/dist/index.js.map +2 -2
- package/dist/internal.d.ts +4 -0
- package/dist/internal.js +6 -0
- package/dist/internal.js.map +2 -2
- package/dist/layout-kernel.d.ts +12 -0
- package/dist/layout-kernel.js +11 -0
- package/dist/layout-kernel.js.map +7 -0
- package/dist/layout-kernel.mjs +1 -0
- package/dist/lib/animation/definition.d.ts +5 -3
- package/dist/lib/animation/definition.js +29 -4
- package/dist/lib/animation/definition.js.map +2 -2
- package/dist/lib/animation/playback.d.ts +8 -0
- package/dist/lib/animation/playback.js +33 -11
- package/dist/lib/animation/playback.js.map +2 -2
- package/dist/lib/animation/spring.d.ts +3 -1
- package/dist/lib/animation/spring.js.map +2 -2
- package/dist/lib/animation/types.d.ts +29 -73
- package/dist/lib/backend/types.d.ts +13 -1
- package/dist/lib/backend/types.js.map +2 -2
- package/dist/lib/components/arc-geometry.js +2 -1
- package/dist/lib/components/arc-geometry.js.map +2 -2
- package/dist/lib/components/g.js +2 -0
- package/dist/lib/components/g.js.map +2 -2
- package/dist/lib/components/html-box.js +2 -1
- package/dist/lib/components/html-box.js.map +2 -2
- package/dist/lib/components/img.js +3 -3
- package/dist/lib/components/img.js.map +2 -2
- package/dist/lib/components/layer.js +98 -16
- package/dist/lib/components/layer.js.map +3 -3
- package/dist/lib/components/text.d.ts +16 -0
- package/dist/lib/components/text.js +131 -24
- package/dist/lib/components/text.js.map +2 -2
- package/dist/lib/define-primitive.d.ts +4 -2
- package/dist/lib/define-primitive.js +3 -1
- package/dist/lib/define-primitive.js.map +2 -2
- package/dist/lib/element/metadata.d.ts +9 -0
- package/dist/lib/element/metadata.js +19 -0
- package/dist/lib/element/metadata.js.map +2 -2
- package/dist/lib/element/resolve-primitive-inputs.d.ts +2 -0
- package/dist/lib/element/resolve-primitive-inputs.js +17 -4
- package/dist/lib/element/resolve-primitive-inputs.js.map +2 -2
- package/dist/lib/events/event-facade.d.ts +18 -0
- package/dist/lib/events/event-facade.js +28 -2
- package/dist/lib/events/event-facade.js.map +2 -2
- package/dist/lib/events/hit-test.js +2 -1
- package/dist/lib/events/hit-test.js.map +2 -2
- package/dist/lib/events/propagation.d.ts +2 -1
- package/dist/lib/events/propagation.js +22 -16
- package/dist/lib/events/propagation.js.map +2 -2
- package/dist/lib/events/registrations.d.ts +10 -0
- package/dist/lib/events/registrations.js +160 -5
- package/dist/lib/events/registrations.js.map +2 -2
- package/dist/lib/execute-render.js +25 -1
- package/dist/lib/execute-render.js.map +2 -2
- package/dist/lib/filter/filter-region.js +3 -10
- package/dist/lib/filter/filter-region.js.map +2 -2
- package/dist/lib/focus/focus-manager.d.ts +8 -1
- package/dist/lib/focus/focus-manager.js +87 -43
- package/dist/lib/focus/focus-manager.js.map +2 -2
- package/dist/lib/focus/geometry.d.ts +2 -0
- package/dist/lib/focus/geometry.js +6 -0
- package/dist/lib/focus/geometry.js.map +2 -2
- package/dist/lib/geometry/path-bend-guide.js +1 -1
- package/dist/lib/geometry/path-bend-guide.js.map +2 -2
- package/dist/lib/geometry/path-geometry.js +12 -11
- package/dist/lib/geometry/path-geometry.js.map +2 -2
- package/dist/lib/geometry/path-transforms.js +17 -21
- package/dist/lib/geometry/path-transforms.js.map +2 -2
- package/dist/lib/geometry/path-warp-bezier.js +3 -1
- package/dist/lib/geometry/path-warp-bezier.js.map +2 -2
- package/dist/lib/geometry/path-warp.js +1 -1
- package/dist/lib/geometry/path-warp.js.map +2 -2
- package/dist/lib/global-state.js +2 -0
- package/dist/lib/global-state.js.map +2 -2
- package/dist/lib/hooks/use-animated-value.d.ts +11 -21
- package/dist/lib/hooks/use-animated-value.js +23 -70
- package/dist/lib/hooks/use-animated-value.js.map +3 -3
- package/dist/lib/hooks/use-playback.js +1 -0
- package/dist/lib/hooks/use-playback.js.map +2 -2
- package/dist/lib/html/html-events.d.ts +32 -0
- package/dist/lib/html/html-events.js +179 -0
- package/dist/lib/html/html-events.js.map +7 -0
- package/dist/lib/html/html-service.d.ts +8 -2
- package/dist/lib/html/html-service.js +198 -65
- package/dist/lib/html/html-service.js.map +2 -2
- package/dist/lib/html/overlay-config.js +7 -6
- package/dist/lib/html/overlay-config.js.map +2 -2
- package/dist/lib/html/types.d.ts +29 -2
- package/dist/lib/layout/absolute.d.ts +11 -5
- package/dist/lib/layout/absolute.js +329 -55
- package/dist/lib/layout/absolute.js.map +3 -3
- package/dist/lib/layout/allocation-checkpoint-owner.d.ts +11 -0
- package/dist/lib/layout/allocation-checkpoint-owner.js +86 -0
- package/dist/lib/layout/allocation-checkpoint-owner.js.map +7 -0
- package/dist/lib/layout/allocation-checkpoint.d.ts +53 -0
- package/dist/lib/layout/allocation-checkpoint.js +463 -0
- package/dist/lib/layout/allocation-checkpoint.js.map +7 -0
- package/dist/lib/layout/allocation-dependencies.d.ts +30 -0
- package/dist/lib/layout/allocation-dependencies.js +90 -0
- package/dist/lib/layout/allocation-dependencies.js.map +7 -0
- package/dist/lib/layout/allocation-revision.d.ts +13 -0
- package/dist/lib/layout/allocation-revision.js +67 -0
- package/dist/lib/layout/allocation-revision.js.map +7 -0
- package/dist/lib/layout/box-insets.d.ts +17 -0
- package/dist/lib/layout/box-insets.js +138 -0
- package/dist/lib/layout/box-insets.js.map +7 -0
- package/dist/lib/layout/box-sizing.d.ts +16 -0
- package/dist/lib/layout/box-sizing.js +77 -0
- package/dist/lib/layout/box-sizing.js.map +7 -0
- package/dist/lib/layout/box.js +42 -12
- package/dist/lib/layout/box.js.map +2 -2
- package/dist/lib/layout/canvas-measurement.d.ts +13 -0
- package/dist/lib/layout/canvas-measurement.js +57 -0
- package/dist/lib/layout/canvas-measurement.js.map +7 -0
- package/dist/lib/layout/context.d.ts +35 -6
- package/dist/lib/layout/context.js +72 -3
- package/dist/lib/layout/context.js.map +2 -2
- package/dist/lib/layout/define-layout-component.d.ts +23 -0
- package/dist/lib/layout/define-layout-component.js +84 -0
- package/dist/lib/layout/define-layout-component.js.map +7 -0
- package/dist/lib/layout/flex-allocation-cache.d.ts +42 -0
- package/dist/lib/layout/flex-baseline-mode.d.ts +2 -0
- package/dist/lib/layout/flex-baseline-mode.js +7 -0
- package/dist/lib/layout/flex-baseline-mode.js.map +7 -0
- package/dist/lib/layout/flex.d.ts +50 -15
- package/dist/lib/layout/flex.js +2124 -195
- package/dist/lib/layout/flex.js.map +3 -3
- package/dist/lib/layout/flow.js +225 -49
- package/dist/lib/layout/flow.js.map +2 -2
- package/dist/lib/layout/geometry-publication.d.ts +53 -0
- package/dist/lib/layout/geometry-publication.js +244 -0
- package/dist/lib/layout/geometry-publication.js.map +7 -0
- package/dist/lib/layout/grid-kernel.d.ts +63 -0
- package/dist/lib/layout/grid-kernel.js +168 -0
- package/dist/lib/layout/grid-kernel.js.map +7 -0
- package/dist/lib/layout/grid.d.ts +63 -4
- package/dist/lib/layout/grid.js +767 -171
- package/dist/lib/layout/grid.js.map +3 -3
- package/dist/lib/layout/measure.d.ts +55 -3
- package/dist/lib/layout/measure.js +448 -15
- package/dist/lib/layout/measure.js.map +2 -2
- package/dist/lib/layout/overlay.js +81 -23
- package/dist/lib/layout/overlay.js.map +2 -2
- package/dist/lib/layout/participation.d.ts +27 -0
- package/dist/lib/layout/participation.js +188 -0
- package/dist/lib/layout/participation.js.map +7 -0
- package/dist/lib/layout/place-child.js +1 -1
- package/dist/lib/layout/place-child.js.map +2 -2
- package/dist/lib/layout/positioning-diagnostics.d.ts +1 -1
- package/dist/lib/layout/positioning-diagnostics.js +13 -2
- package/dist/lib/layout/positioning-diagnostics.js.map +2 -2
- package/dist/lib/layout/prepared-root.d.ts +121 -0
- package/dist/lib/layout/prepared-root.js +360 -0
- package/dist/lib/layout/prepared-root.js.map +7 -0
- package/dist/lib/layout/standalone-kernel.d.ts +60 -0
- package/dist/lib/layout/standalone-kernel.js +722 -0
- package/dist/lib/layout/standalone-kernel.js.map +7 -0
- package/dist/lib/layout/topology.d.ts +21 -0
- package/dist/lib/layout/topology.js +113 -0
- package/dist/lib/layout/topology.js.map +7 -0
- package/dist/lib/layout/types.d.ts +5 -0
- package/dist/lib/layout/wasm/artifact.d.ts +1 -0
- package/dist/lib/layout/wasm/artifact.js +5 -0
- package/dist/lib/layout/wasm/artifact.js.map +7 -0
- package/dist/lib/layout/wasm/bytes.d.ts +1 -0
- package/dist/lib/layout/wasm/bytes.js +5 -0
- package/dist/lib/layout/wasm/bytes.js.map +7 -0
- package/dist/lib/layout/wasm/embedded.d.ts +2 -0
- package/dist/lib/layout/wasm/embedded.js +12 -0
- package/dist/lib/layout/wasm/embedded.js.map +7 -0
- package/dist/lib/layout/wasm/layout.wasm +0 -0
- package/dist/lib/layout/wasm/module.d.ts +8 -0
- package/dist/lib/layout/wasm/module.js +70 -0
- package/dist/lib/layout/wasm/module.js.map +7 -0
- package/dist/lib/layout/wasm/region.d.ts +267 -0
- package/dist/lib/layout/wasm/region.js +1018 -0
- package/dist/lib/layout/wasm/region.js.map +7 -0
- package/dist/lib/manipulation/controller.js +4 -7
- package/dist/lib/manipulation/controller.js.map +2 -2
- package/dist/lib/manipulation/frame.js +1 -1
- package/dist/lib/manipulation/frame.js.map +2 -2
- package/dist/lib/manipulation/handles.js +32 -33
- package/dist/lib/manipulation/handles.js.map +2 -2
- package/dist/lib/manipulation/solve.js +12 -10
- package/dist/lib/manipulation/solve.js.map +2 -2
- package/dist/lib/mount-pibbl.js +1 -0
- package/dist/lib/mount-pibbl.js.map +2 -2
- package/dist/lib/mount-prepared-pibbl.d.ts +5 -0
- package/dist/lib/mount-prepared-pibbl.js +29 -0
- package/dist/lib/mount-prepared-pibbl.js.map +7 -0
- package/dist/lib/mount-request.d.ts +8 -0
- package/dist/lib/mount-request.js +41 -0
- package/dist/lib/mount-request.js.map +7 -0
- package/dist/lib/pibbl.d.ts +21 -13
- package/dist/lib/pibbl.js +18 -16
- package/dist/lib/pibbl.js.map +2 -2
- package/dist/lib/recording/recording.d.ts +43 -0
- package/dist/lib/recording/recording.js +555 -0
- package/dist/lib/recording/recording.js.map +7 -0
- package/dist/lib/recording/types.d.ts +118 -0
- package/dist/lib/recording/wasm-bytes.d.ts +1 -0
- package/dist/lib/recording/wasm-bytes.js +5 -0
- package/dist/lib/recording/wasm-bytes.js.map +7 -0
- package/dist/lib/recording/worker-source.d.ts +1 -0
- package/dist/lib/recording/worker-source.js +5 -0
- package/dist/lib/recording/worker-source.js.map +7 -0
- package/dist/lib/render-layer/controller.d.ts +9 -3
- package/dist/lib/render-layer/controller.js +259 -110
- package/dist/lib/render-layer/controller.js.map +2 -2
- package/dist/lib/render-transaction.d.ts +12 -2
- package/dist/lib/render-transaction.js +69 -1
- package/dist/lib/render-transaction.js.map +2 -2
- package/dist/lib/render.js +32 -8
- package/dist/lib/render.js.map +2 -2
- package/dist/lib/scheduler/realm-scheduler.d.ts +2 -0
- package/dist/lib/scheduler/realm-scheduler.js +55 -26
- package/dist/lib/scheduler/realm-scheduler.js.map +2 -2
- package/dist/lib/scheduler/renderer-participant.js +1 -0
- package/dist/lib/scheduler/renderer-participant.js.map +2 -2
- package/dist/lib/series-inspection-frame.d.ts +18 -0
- package/dist/lib/series-inspection-frame.js +70 -0
- package/dist/lib/series-inspection-frame.js.map +7 -0
- package/dist/lib/signals/edge.d.ts +7 -4
- package/dist/lib/signals/edge.js +25 -3
- package/dist/lib/signals/edge.js.map +2 -2
- package/dist/lib/signals/graph.d.ts +16 -2
- package/dist/lib/signals/graph.js +54 -12
- package/dist/lib/signals/graph.js.map +2 -2
- package/dist/lib/signals/input-provision.d.ts +15 -0
- package/dist/lib/signals/input-provision.js +53 -3
- package/dist/lib/signals/input-provision.js.map +2 -2
- package/dist/lib/signals/render-consumer.d.ts +3 -0
- package/dist/lib/signals/render-consumer.js +22 -14
- package/dist/lib/signals/render-consumer.js.map +2 -2
- package/dist/lib/style/positioning.d.ts +50 -2
- package/dist/lib/style/positioning.js +28 -4
- package/dist/lib/style/positioning.js.map +2 -2
- package/dist/lib/style/resolve-built-in.d.ts +4 -3
- package/dist/lib/style/resolve-built-in.js +17 -3
- package/dist/lib/style/resolve-built-in.js.map +2 -2
- package/dist/lib/style/resolve-dispatch.d.ts +3 -0
- package/dist/lib/style/resolve-dispatch.js +77 -4
- package/dist/lib/style/resolve-dispatch.js.map +2 -2
- package/dist/lib/style/resolve-length.d.ts +2 -0
- package/dist/lib/style/resolve-length.js +13 -9
- package/dist/lib/style/resolve-length.js.map +2 -2
- package/dist/lib/style/sizing-length.d.ts +51 -0
- package/dist/lib/style/sizing-length.js +77 -0
- package/dist/lib/style/sizing-length.js.map +7 -0
- package/dist/lib/style/types.d.ts +63 -25
- package/dist/lib/surface/root-surface.js +10 -6
- package/dist/lib/surface/root-surface.js.map +2 -2
- package/dist/lib/textures/texture.js +10 -8
- package/dist/lib/textures/texture.js.map +2 -2
- package/dist/lib/transitions/capture.js +4 -1
- package/dist/lib/transitions/capture.js.map +2 -2
- package/dist/lib/transitions/embers-physics.js +17 -10
- package/dist/lib/transitions/embers-physics.js.map +2 -2
- package/dist/lib/types.d.ts +110 -1
- package/dist/sync.d.ts +16 -0
- package/dist/sync.js +13 -0
- package/dist/sync.js.map +7 -0
- package/dist/sync.mjs +1 -0
- package/package.json +43 -6
- package/dist/features/viz/lib/scale.d.ts +0 -11
- package/dist/features/viz/lib/scale.js +0 -80
- package/dist/features/viz/lib/scale.js.map +0 -7
- package/dist/features/viz/lib/use-scale.d.ts +0 -20
- package/dist/features/viz/lib/use-scale.js +0 -10
- package/dist/features/viz/lib/use-scale.js.map +0 -7
package/dist/lib/layout/grid.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, LayoutRegion, 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,9 +12,9 @@ import { layoutDiagnostic } from "../style/diagnostics.js";
|
|
|
7
12
|
import {
|
|
8
13
|
wireStructuralEvents
|
|
9
14
|
} from "../components/structural-events.js";
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import { setPreNormalizedStyle } from "../style/resolve-dispatch.js";
|
|
15
|
+
import { normalizeBoxInsets, hasPercentageBoxPadding, resolveAllocatedInsets } from "./box-insets.js";
|
|
16
|
+
import { isFitContent, resolveScalarSizingLength } from "../style/sizing-length.js";
|
|
17
|
+
import { setPreNormalizedStyle, registerOpaqueStyleProperties } from "../style/resolve-dispatch.js";
|
|
13
18
|
import {
|
|
14
19
|
childWithUsedSize,
|
|
15
20
|
prepareDirectChildStyle,
|
|
@@ -19,13 +24,28 @@ import {
|
|
|
19
24
|
resolveContainerBox,
|
|
20
25
|
resolveDirectChildBox
|
|
21
26
|
} from "./absolute.js";
|
|
22
|
-
import { pushLayoutBox } from "./context.js";
|
|
27
|
+
import { getLayoutDirection, pushLayoutBox, resolvePositionedContainingBox } from "./context.js";
|
|
23
28
|
import { recordLayoutEvaluation } from "./diagnostics.js";
|
|
24
29
|
import { assertSupportedChildPosition } from "./positioning-diagnostics.js";
|
|
25
|
-
import { measureElement } from "./measure.js";
|
|
30
|
+
import { measureElement, measureIntrinsicElement } from "./measure.js";
|
|
31
|
+
import { resolveAbsoluteFlexPlacement } from "./flex.js";
|
|
32
|
+
import { GRID_V2_TRACK_STRIDE } from "./grid-kernel.js";
|
|
33
|
+
const unsupportedProperties = ["gridColumnEnd", "gridRowEnd", "gridArea", "order"];
|
|
34
|
+
function minmax(options) {
|
|
35
|
+
return Object.freeze({ kind: "minmax", min: options.min, max: options.max });
|
|
36
|
+
}
|
|
37
|
+
function repeatTracks(tracks, options) {
|
|
38
|
+
return Object.freeze({ kind: "repeat", count: options.count, tracks: Object.freeze([...tracks]) });
|
|
39
|
+
}
|
|
40
|
+
function autoFillTracks(...tracks) {
|
|
41
|
+
return Object.freeze({ kind: "repeat", count: "auto-fill", tracks: Object.freeze([...tracks]) });
|
|
42
|
+
}
|
|
43
|
+
function autoFitTracks(...tracks) {
|
|
44
|
+
return Object.freeze({ kind: "repeat", count: "auto-fit", tracks: Object.freeze([...tracks]) });
|
|
45
|
+
}
|
|
46
|
+
const GRID_CONTAINING_BOX_STYLE = /* @__PURE__ */ Symbol("pibbl.grid-containing-box-style");
|
|
26
47
|
function renderGrid(props, style, ctx) {
|
|
27
48
|
wireStructuralEvents(props);
|
|
28
|
-
const children = prepareLayoutChildren(props.children, "Grid");
|
|
29
49
|
recordLayoutEvaluation();
|
|
30
50
|
const content = style.box.contentBox;
|
|
31
51
|
ctx.translate(content.x, content.y);
|
|
@@ -35,141 +55,192 @@ function renderGrid(props, style, ctx) {
|
|
|
35
55
|
width: content.width,
|
|
36
56
|
height: content.height
|
|
37
57
|
});
|
|
38
|
-
const releaseLayout = pushLayoutBox(localContent
|
|
58
|
+
const releaseLayout = pushLayoutBox(localContent, {
|
|
59
|
+
logicalOffset: content,
|
|
60
|
+
containingBlock: resolvePositionedContainingBox(
|
|
61
|
+
style[GRID_CONTAINING_BOX_STYLE],
|
|
62
|
+
localContent,
|
|
63
|
+
"Grid"
|
|
64
|
+
)
|
|
65
|
+
});
|
|
39
66
|
GLOBAL_STATE.componentRefs.onAfterRender = releaseLayout;
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
} finally {
|
|
47
|
-
ctx.restore();
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
const placements = resolveGridPlacements(
|
|
67
|
+
const prepared = nativeLayout ? claimPreparedLayoutPlan(GLOBAL_STATE.componentRefs.element, localContent) : void 0;
|
|
68
|
+
const children = prepared?.children ?? prepareLayoutChildren(props.children, "Grid");
|
|
69
|
+
const service = canvasMeasurementService(ctx);
|
|
70
|
+
const nativeRegion = prepared?.region ?? (nativeLayout ? mountedLayoutRegion() : void 0);
|
|
71
|
+
if (nativeLayout && !nativeRegion) throw new Error("Experimental Grid requires its mounted native region.");
|
|
72
|
+
const placements = prepared?.placements ?? withAllocationCheckpoint(nativeRegion, { children, content: localContent, settings: style, onHit: recordWasmAllocationCacheHit, calculate: () => resolveGridPlacements(
|
|
52
73
|
localContent,
|
|
53
74
|
children,
|
|
54
75
|
style,
|
|
55
76
|
{
|
|
56
77
|
service,
|
|
57
78
|
measureElement: (element, constraints) => measureElement(element, constraints, service)
|
|
58
|
-
}
|
|
59
|
-
|
|
79
|
+
},
|
|
80
|
+
nativeRegion
|
|
81
|
+
) });
|
|
60
82
|
let index = 0;
|
|
61
83
|
return placeDirectChildren(
|
|
62
84
|
children,
|
|
63
85
|
localContent,
|
|
64
|
-
() =>
|
|
86
|
+
(_child, occurrence) => {
|
|
87
|
+
const placement = placements[index++];
|
|
88
|
+
if (nativeLayout && !prepared) preparePlacedKnownLayout(placement.element, occurrence);
|
|
89
|
+
return placement;
|
|
90
|
+
},
|
|
65
91
|
style.overflow
|
|
66
92
|
);
|
|
67
93
|
}
|
|
68
94
|
const Grid = definePrimitive(renderGrid, {
|
|
69
95
|
childInput: "structural",
|
|
70
|
-
resolveStyle: (style, context) =>
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
96
|
+
resolveStyle: (style, context) => {
|
|
97
|
+
if (nativeLayout && hasPercentageBoxPadding(style)) {
|
|
98
|
+
style = resolveAllocatedInsets(style, {
|
|
99
|
+
width: context.percentageBasis.width,
|
|
100
|
+
context: { ...context, component: "Grid", algorithm: "grid" }
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
return {
|
|
104
|
+
box: resolveContainerBox(style, context, "Grid", "grid"),
|
|
105
|
+
[GRID_CONTAINING_BOX_STYLE]: style,
|
|
106
|
+
overflow: style.overflow ?? "visible",
|
|
107
|
+
...normalizeGridOptions(style, context.allocation)
|
|
108
|
+
};
|
|
109
|
+
},
|
|
110
|
+
measure: (input) => measureGrid(input),
|
|
111
|
+
measureIntrinsic: (input) => measureGridIntrinsic(input)
|
|
112
|
+
});
|
|
113
|
+
registerOpaqueStyleProperties(Grid, [
|
|
114
|
+
"columns",
|
|
115
|
+
"rows",
|
|
116
|
+
"autoColumn",
|
|
117
|
+
"autoRow",
|
|
118
|
+
"gridAutoColumns",
|
|
119
|
+
"gridAutoRows"
|
|
120
|
+
]);
|
|
121
|
+
if (nativeLayout) registerKnownLayoutPreflight(Grid, (element, style, content, receiver, slot) => {
|
|
122
|
+
const previous = GLOBAL_STATE.primitiveReceiverToken;
|
|
123
|
+
GLOBAL_STATE.primitiveReceiverToken = receiver;
|
|
124
|
+
const releaseLayout = pushLayoutBox(content, {
|
|
125
|
+
containingBlock: resolvePositionedContainingBox(
|
|
126
|
+
style,
|
|
127
|
+
content,
|
|
128
|
+
"Grid"
|
|
129
|
+
)
|
|
130
|
+
});
|
|
131
|
+
try {
|
|
132
|
+
const children = prepareLayoutChildren(element.props.children, "Grid");
|
|
133
|
+
const options = normalizeGridOptions(style, content);
|
|
134
|
+
const ctx = GLOBAL_STATE.renderContext;
|
|
135
|
+
if (!ctx) throw new Error("Known Grid preparation requires a Canvas measurement context.");
|
|
136
|
+
const service = canvasMeasurementService(ctx);
|
|
137
|
+
const region = slot.acquire();
|
|
138
|
+
const placements = withAllocationCheckpoint(region, { children, content, settings: options, onHit: recordWasmAllocationCacheHit, calculate: () => resolveGridPlacements(content, children, options, { service, measureElement: (child, constraints) => measureElement(child, constraints, service) }, region) });
|
|
139
|
+
const plan = { region, content, children, placements };
|
|
140
|
+
prepareKnownLayoutDescendants(plan, slot);
|
|
141
|
+
stagePreparedLayoutPlan(slot, plan);
|
|
142
|
+
} finally {
|
|
143
|
+
releaseLayout();
|
|
144
|
+
GLOBAL_STATE.primitiveReceiverToken = previous;
|
|
145
|
+
}
|
|
76
146
|
});
|
|
77
147
|
function layoutGrid(container, children, style, measurement) {
|
|
78
148
|
const prepared = materializeLayoutChildren(children, "Grid");
|
|
79
149
|
const options = normalizeGridOptions(style, container);
|
|
80
|
-
|
|
150
|
+
const region = nativeLayout ? new LayoutRegion() : void 0;
|
|
151
|
+
try {
|
|
152
|
+
return resolveGridPlacements(container, prepared, options, measurement, region).map((placement) => placement.box);
|
|
153
|
+
} finally {
|
|
154
|
+
region?.dispose();
|
|
155
|
+
}
|
|
81
156
|
}
|
|
82
|
-
function resolveGridPlacements(container, children, options, measurement) {
|
|
157
|
+
function resolveGridPlacements(container, children, options, measurement, nativeRegion, assignedCells) {
|
|
158
|
+
if (nativeRegion) recordWasmAllocationPass();
|
|
83
159
|
assertFiniteContainer(container);
|
|
84
|
-
const
|
|
85
|
-
|
|
160
|
+
const cells = assignedCells ?? (nativeRegion ? prepareGridCells(children, container) : prepareExplicitGridCells(children, container, options.columns.length, options.rows.length));
|
|
161
|
+
const flowCells = cells.filter((cell) => cell.normalized.position !== "absolute");
|
|
162
|
+
if (nativeRegion && !assignedCells) {
|
|
163
|
+
const assigned = nativeRegion.gridV2Region().assign(flowCells, options.columns.length, options.rows.length, gridFlowCode(options.gridAutoFlow)).cells;
|
|
164
|
+
for (let index = 0; index < flowCells.length; index++) {
|
|
165
|
+
flowCells[index].columnStart = assigned[index].columnStart;
|
|
166
|
+
flowCells[index].rowStart = assigned[index].rowStart;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
let expandedColumns = appendImplicitTracks(options.columns, options.autoColumn, maxGridExtent(flowCells, "column"));
|
|
170
|
+
let expandedRows = appendImplicitTracks(options.rows, options.autoRow, maxGridExtent(flowCells, "row"));
|
|
171
|
+
if (nativeRegion && options.autoFitColumns) expandedColumns = collapseParsedAutoFit(expandedColumns, flowCells, "column");
|
|
172
|
+
if (nativeRegion && options.autoFitRows) expandedRows = collapseParsedAutoFit(expandedRows, flowCells, "row");
|
|
173
|
+
let columns = nativeRegion ? resolveNativeGridTracks(nativeRegion, expandedColumns, container.width, options.columnGap, "columns", container) : resolveParsedGridTracks(
|
|
174
|
+
expandedColumns,
|
|
86
175
|
container.width,
|
|
87
176
|
options.columnGap,
|
|
88
177
|
"columns",
|
|
89
178
|
container
|
|
90
179
|
);
|
|
91
|
-
|
|
92
|
-
|
|
180
|
+
if (nativeRegion) {
|
|
181
|
+
nativeRegion.applyGridV2Contributions(
|
|
182
|
+
gatherGridIntrinsicContributions(expandedColumns, cells, measurement, container, "columns"),
|
|
183
|
+
options.columnGap,
|
|
184
|
+
0
|
|
185
|
+
);
|
|
186
|
+
columns = nativeRegion.snapshotGridV2Tracks(0);
|
|
187
|
+
}
|
|
188
|
+
let rows = nativeRegion ? resolveNativeGridTracks(nativeRegion, expandedRows, container.height, options.rowGap, "rows", container) : resolveParsedGridTracks(
|
|
189
|
+
expandedRows,
|
|
93
190
|
container.height,
|
|
94
191
|
options.rowGap,
|
|
95
192
|
"rows",
|
|
96
193
|
container
|
|
97
194
|
);
|
|
195
|
+
if (nativeRegion) {
|
|
196
|
+
nativeRegion.applyGridV2Contributions(
|
|
197
|
+
gatherGridIntrinsicContributions(
|
|
198
|
+
expandedRows,
|
|
199
|
+
cells,
|
|
200
|
+
measurement,
|
|
201
|
+
container,
|
|
202
|
+
"rows",
|
|
203
|
+
columns,
|
|
204
|
+
options.columnGap
|
|
205
|
+
),
|
|
206
|
+
options.rowGap,
|
|
207
|
+
1
|
|
208
|
+
);
|
|
209
|
+
rows = nativeRegion.snapshotGridV2Tracks(1);
|
|
210
|
+
}
|
|
211
|
+
if (!nativeRegion && options.autoFitColumns) columns = collapseAutoFitTracks(columns, cells, "column");
|
|
212
|
+
if (!nativeRegion && options.autoFitRows) rows = collapseAutoFitTracks(rows, cells, "row");
|
|
213
|
+
const nativeItems = cells;
|
|
214
|
+
const nativeBoxes = nativeRegion ? nativeRegion.placeGridV2Cells(flowCells, gridFlowCode(options.gridAutoFlow), options.columnGap, options.rowGap) : void 0;
|
|
98
215
|
const placements = [];
|
|
216
|
+
let flowIndex = 0;
|
|
99
217
|
for (const child of children) {
|
|
100
|
-
const
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
const
|
|
117
|
-
normalized.gridRowStart,
|
|
118
|
-
"gridRowStart",
|
|
119
|
-
child,
|
|
120
|
-
container,
|
|
121
|
-
true
|
|
122
|
-
);
|
|
123
|
-
const columnSpan = placementInteger(
|
|
124
|
-
normalized.gridColumnSpan ?? 1,
|
|
125
|
-
"gridColumnSpan",
|
|
126
|
-
child,
|
|
127
|
-
container,
|
|
128
|
-
false
|
|
129
|
-
);
|
|
130
|
-
const rowSpan = placementInteger(
|
|
131
|
-
normalized.gridRowSpan ?? 1,
|
|
132
|
-
"gridRowSpan",
|
|
133
|
-
child,
|
|
134
|
-
container,
|
|
135
|
-
false
|
|
136
|
-
);
|
|
137
|
-
validateStart(
|
|
138
|
-
columnStart,
|
|
139
|
-
columns.length,
|
|
140
|
-
"gridColumnStart",
|
|
141
|
-
child,
|
|
142
|
-
container
|
|
143
|
-
);
|
|
144
|
-
validateStart(
|
|
145
|
-
rowStart,
|
|
146
|
-
rows.length,
|
|
147
|
-
"gridRowStart",
|
|
148
|
-
child,
|
|
149
|
-
container
|
|
150
|
-
);
|
|
151
|
-
validateSpan(
|
|
152
|
-
columnStart,
|
|
153
|
-
columnSpan,
|
|
154
|
-
columns.length,
|
|
155
|
-
"gridColumnSpan",
|
|
156
|
-
child,
|
|
157
|
-
container
|
|
158
|
-
);
|
|
159
|
-
validateSpan(
|
|
160
|
-
rowStart,
|
|
161
|
-
rowSpan,
|
|
162
|
-
rows.length,
|
|
163
|
-
"gridRowSpan",
|
|
164
|
-
child,
|
|
165
|
-
container
|
|
166
|
-
);
|
|
167
|
-
const area = {
|
|
218
|
+
const item = nativeItems[placements.length];
|
|
219
|
+
const { prepared, receiverToken, columnStart, columnSpan, rowStart, rowSpan } = item;
|
|
220
|
+
let normalized = item.normalized;
|
|
221
|
+
if (normalized.position === "absolute") {
|
|
222
|
+
const needsNaturalMeasurement = normalized.width === void 0 || normalized.width === "auto" || normalized.height === void 0 || normalized.height === "auto";
|
|
223
|
+
const absolute = resolveAbsoluteFlexPlacement(container, child, normalized, receiverToken, preparedStyleQuery(prepared), container, {
|
|
224
|
+
flexDirection: "row",
|
|
225
|
+
flexWrap: "nowrap",
|
|
226
|
+
justifyContent: "flex-start",
|
|
227
|
+
alignItems: options.alignItems === "start" ? "flex-start" : options.alignItems === "end" ? "flex-end" : options.alignItems,
|
|
228
|
+
layoutDirection: options.layoutDirection
|
|
229
|
+
}, needsNaturalMeasurement ? measurement : void 0);
|
|
230
|
+
placements.push({ usedWidth: absolute.usedWidth, usedHeight: absolute.usedHeight, box: absolute.box, element: absolute.element });
|
|
231
|
+
continue;
|
|
232
|
+
}
|
|
233
|
+
const nativeBox = nativeBoxes?.[flowIndex++];
|
|
234
|
+
const area = nativeBox ? { x: container.x + nativeBox.x, y: container.y + nativeBox.y, width: nativeBox.width, height: nativeBox.height } : {
|
|
168
235
|
x: container.x + trackOffset(columns, columnStart - 1, options.columnGap),
|
|
169
236
|
y: container.y + trackOffset(rows, rowStart - 1, options.rowGap),
|
|
170
237
|
width: trackSpan(columns, columnStart - 1, columnSpan, options.columnGap),
|
|
171
238
|
height: trackSpan(rows, rowStart - 1, rowSpan, options.rowGap)
|
|
172
239
|
};
|
|
240
|
+
if (nativeLayout && GLOBAL_STATE.currentPibblInstance && getStyleMeasurementMode() === void 0 && hasPercentageBoxPadding(normalized)) {
|
|
241
|
+
normalized = resolveAllocatedInsets(normalized, { width: area.width, context: childContext(child, area) });
|
|
242
|
+
}
|
|
243
|
+
if (normalized.boxSizing !== void 0) normalized = contentBoxStyle(normalized, { width: area.width, height: area.height, context: childContext(child, area) });
|
|
173
244
|
const widthAuto = normalized.width === void 0 || normalized.width === "auto";
|
|
174
245
|
const heightAuto = normalized.height === void 0 || normalized.height === "auto";
|
|
175
246
|
const justify = itemAlignment(
|
|
@@ -212,17 +283,13 @@ function resolveGridPlacements(container, children, options, measurement) {
|
|
|
212
283
|
);
|
|
213
284
|
}
|
|
214
285
|
}
|
|
215
|
-
const padding =
|
|
216
|
-
normalized.padding,
|
|
217
|
-
"padding",
|
|
218
|
-
childContext(child, container)
|
|
219
|
-
);
|
|
286
|
+
const padding = normalizeBoxInsets(normalized, childContext(child, container));
|
|
220
287
|
const usedStyle = {
|
|
221
288
|
...normalized,
|
|
222
289
|
width: widthAuto ? justify === "stretch" ? Math.max(0, area.width - padding.left - padding.right) : measured.status === "measured" ? measured.size.width : 0 : normalized.width,
|
|
223
290
|
height: heightAuto ? align === "stretch" ? Math.max(0, area.height - padding.top - padding.bottom) : measured.status === "measured" ? measured.size.height : 0 : normalized.height
|
|
224
291
|
};
|
|
225
|
-
const resolved = resolveDirectChildBox(area, child, "grid", usedStyle);
|
|
292
|
+
const resolved = resolveDirectChildBox(area, child, "grid", usedStyle, measurement.service, receiverToken);
|
|
226
293
|
const border = resolved.borderBox;
|
|
227
294
|
const box = {
|
|
228
295
|
x: area.x + alignmentOffset(area.width, border.width, justify),
|
|
@@ -231,6 +298,8 @@ function resolveGridPlacements(container, children, options, measurement) {
|
|
|
231
298
|
height: border.height
|
|
232
299
|
};
|
|
233
300
|
placements.push({
|
|
301
|
+
usedWidth: resolved.contentBox.width,
|
|
302
|
+
usedHeight: resolved.contentBox.height,
|
|
234
303
|
box,
|
|
235
304
|
element: childWithUsedSize(
|
|
236
305
|
child,
|
|
@@ -251,9 +320,253 @@ function resolveGridTracks(tracks, bound, gap, axis) {
|
|
|
251
320
|
width: axis === "columns" ? bound : 0,
|
|
252
321
|
height: axis === "rows" ? bound : 0
|
|
253
322
|
};
|
|
254
|
-
const parsed = parseGridTracks(tracks, axis, container);
|
|
323
|
+
const parsed = parseGridTracks(tracks, axis, container, gap);
|
|
255
324
|
return resolveParsedGridTracks(parsed, bound, gap, axis, container);
|
|
256
325
|
}
|
|
326
|
+
function assignGridCells(children, container, columns, rows, options) {
|
|
327
|
+
const cells = prepareGridCells(children, container);
|
|
328
|
+
const flow = cells.filter((cell) => cell.normalized.position !== "absolute");
|
|
329
|
+
const region = new LayoutRegion();
|
|
330
|
+
try {
|
|
331
|
+
const assigned = region.gridV2Region().assign(flow, columns, rows, gridFlowCode(options.gridAutoFlow)).cells;
|
|
332
|
+
for (let index = 0; index < flow.length; index++) {
|
|
333
|
+
flow[index].columnStart = assigned[index].columnStart;
|
|
334
|
+
flow[index].rowStart = assigned[index].rowStart;
|
|
335
|
+
}
|
|
336
|
+
return cells;
|
|
337
|
+
} finally {
|
|
338
|
+
region.dispose();
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
function prepareExplicitGridCells(children, container, columns, rows) {
|
|
342
|
+
const cells = prepareGridCells(children, container);
|
|
343
|
+
for (let index = 0; index < cells.length; index++) {
|
|
344
|
+
const cell = cells[index];
|
|
345
|
+
assertSupportedChildPosition("Grid", cell.child, cell.normalized);
|
|
346
|
+
cell.columnStart = placementInteger(cell.normalized.gridColumnStart, "gridColumnStart", cell.child, container, true);
|
|
347
|
+
cell.rowStart = placementInteger(cell.normalized.gridRowStart, "gridRowStart", cell.child, container, true);
|
|
348
|
+
if (cell.columnStart > columns) throw childDiagnostic(cell.child, "gridColumnStart", cell.columnStart, container, `must reference one of the explicit ${columns} columns`);
|
|
349
|
+
if (cell.rowStart > rows) throw childDiagnostic(cell.child, "gridRowStart", cell.rowStart, container, `must reference one of the explicit ${rows} rows`);
|
|
350
|
+
if (cell.columnStart + cell.columnSpan - 1 > columns) throw childDiagnostic(cell.child, "gridColumnSpan", cell.columnSpan, container, `start ${cell.columnStart} plus span ${cell.columnSpan} must remain inside the explicit column tracks`);
|
|
351
|
+
if (cell.rowStart + cell.rowSpan - 1 > rows) throw childDiagnostic(cell.child, "gridRowSpan", cell.rowSpan, container, `start ${cell.rowStart} plus span ${cell.rowSpan} must remain inside the explicit row tracks`);
|
|
352
|
+
}
|
|
353
|
+
return cells;
|
|
354
|
+
}
|
|
355
|
+
function prepareGridCells(children, container) {
|
|
356
|
+
const result = [];
|
|
357
|
+
for (let index = 0; index < children.length; index++) {
|
|
358
|
+
recordWasmAllocationItem();
|
|
359
|
+
const child = children[index];
|
|
360
|
+
const receiverToken = getChildPrimitiveReceiverToken(GLOBAL_STATE.renderTransaction, GLOBAL_STATE.primitiveReceiverToken, index);
|
|
361
|
+
const prepared = prepareDirectChildStyle(child, receiverToken, container);
|
|
362
|
+
const normalized = preparedStyleValue(prepared);
|
|
363
|
+
if (normalized.position !== "absolute") assertSupportedChildPosition("Grid", child, normalized);
|
|
364
|
+
rejectUnsupportedItemFields(child, normalized, container);
|
|
365
|
+
const columnSpan = placementInteger(normalized.gridColumnSpan ?? 1, "gridColumnSpan", child, container, false);
|
|
366
|
+
const rowSpan = placementInteger(normalized.gridRowSpan ?? 1, "gridRowSpan", child, container, false);
|
|
367
|
+
const columnStart = normalized.gridColumnStart === void 0 ? 0 : placementInteger(normalized.gridColumnStart, "gridColumnStart", child, container, false);
|
|
368
|
+
const rowStart = normalized.gridRowStart === void 0 ? 0 : placementInteger(normalized.gridRowStart, "gridRowStart", child, container, false);
|
|
369
|
+
result.push({ child, prepared, normalized, receiverToken, columnStart, columnSpan, rowStart, rowSpan });
|
|
370
|
+
}
|
|
371
|
+
return result;
|
|
372
|
+
}
|
|
373
|
+
function maxGridExtent(cells, axis) {
|
|
374
|
+
let extent = 0;
|
|
375
|
+
for (let index = 0; index < cells.length; index++) {
|
|
376
|
+
const cell = cells[index];
|
|
377
|
+
extent = Math.max(extent, axis === "column" ? cell.columnStart + cell.columnSpan - 1 : cell.rowStart + cell.rowSpan - 1);
|
|
378
|
+
}
|
|
379
|
+
return extent;
|
|
380
|
+
}
|
|
381
|
+
function collapseAutoFitTracks(tracks, cells, axis) {
|
|
382
|
+
const out = tracks.slice();
|
|
383
|
+
for (let index = 0; index < out.length; index++) {
|
|
384
|
+
let used = false;
|
|
385
|
+
for (let cellIndex = 0; cellIndex < cells.length; cellIndex++) {
|
|
386
|
+
const cell = cells[cellIndex];
|
|
387
|
+
const start = axis === "column" ? cell.columnStart : cell.rowStart, span = axis === "column" ? cell.columnSpan : cell.rowSpan;
|
|
388
|
+
if (start <= index + 1 && index + 1 < start + span) {
|
|
389
|
+
used = true;
|
|
390
|
+
break;
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
if (!used) out[index] = 0;
|
|
394
|
+
}
|
|
395
|
+
return out;
|
|
396
|
+
}
|
|
397
|
+
function containsAutoFit(tracks) {
|
|
398
|
+
for (const track of tracks) if (typeof track === "object" && track !== null && "kind" in track && track.kind === "repeat" && (track.count === "auto-fit" || containsAutoFit(track.tracks))) return true;
|
|
399
|
+
return false;
|
|
400
|
+
}
|
|
401
|
+
function collapseParsedAutoFit(tracks, cells, axis) {
|
|
402
|
+
const occupied = new Int32Array(tracks.length + 1);
|
|
403
|
+
for (const cell of cells) {
|
|
404
|
+
const start = (axis === "column" ? cell.columnStart : cell.rowStart) - 1;
|
|
405
|
+
const span = axis === "column" ? cell.columnSpan : cell.rowSpan;
|
|
406
|
+
occupied[start]++;
|
|
407
|
+
occupied[start + span]--;
|
|
408
|
+
}
|
|
409
|
+
const offsets = new Uint32Array(tracks.length + 1), kept = [];
|
|
410
|
+
let count = 0;
|
|
411
|
+
for (let index = 0; index < tracks.length; index++) {
|
|
412
|
+
count += occupied[index];
|
|
413
|
+
if (!tracks[index].autoFit || count > 0) kept.push(tracks[index]);
|
|
414
|
+
offsets[index + 1] = kept.length;
|
|
415
|
+
}
|
|
416
|
+
for (const cell of cells) {
|
|
417
|
+
if (axis === "column") cell.columnStart = offsets[cell.columnStart - 1] + 1;
|
|
418
|
+
else cell.rowStart = offsets[cell.rowStart - 1] + 1;
|
|
419
|
+
}
|
|
420
|
+
return kept;
|
|
421
|
+
}
|
|
422
|
+
function appendImplicitTracks(explicit, automatic, extent) {
|
|
423
|
+
if (extent <= explicit.length) return explicit;
|
|
424
|
+
const tracks = explicit.slice();
|
|
425
|
+
while (tracks.length < extent) tracks.push(automatic);
|
|
426
|
+
return tracks;
|
|
427
|
+
}
|
|
428
|
+
function gatherGridIntrinsicContributions(tracks, cells, measurement, container, axis, selectedColumns, columnGap = 0) {
|
|
429
|
+
const records = [];
|
|
430
|
+
for (let index = 0; index < cells.length; index++) {
|
|
431
|
+
const cell = cells[index];
|
|
432
|
+
if (cell.normalized.position === "absolute") continue;
|
|
433
|
+
const start = axis === "columns" ? cell.columnStart : cell.rowStart;
|
|
434
|
+
const span = axis === "columns" ? cell.columnSpan : cell.rowSpan;
|
|
435
|
+
if (start < 1 || start + span - 1 > tracks.length) continue;
|
|
436
|
+
let needed = false;
|
|
437
|
+
for (let track = start - 1; track < start - 1 + span; track++) {
|
|
438
|
+
if (trackNeedsIntrinsic(tracks[track])) needed = true;
|
|
439
|
+
}
|
|
440
|
+
if (!needed) continue;
|
|
441
|
+
if (axis === "rows") {
|
|
442
|
+
if (!selectedColumns) throw new Error("Grid row contributions require resolved column tracks.");
|
|
443
|
+
const width = trackSpan(selectedColumns, cell.columnStart - 1, cell.columnSpan, columnGap);
|
|
444
|
+
const height = measureGridCellAtSelectedWidth(cell, width, measurement, container);
|
|
445
|
+
records.push(start, span, height, height);
|
|
446
|
+
continue;
|
|
447
|
+
}
|
|
448
|
+
const contributionChild = clonePibblElement(cell.child);
|
|
449
|
+
setPreNormalizedStyle(contributionChild, cell.normalized, cell.child, cell.receiverToken, preparedStyleQuery(cell.prepared));
|
|
450
|
+
const result = measureIntrinsicElement(
|
|
451
|
+
contributionChild,
|
|
452
|
+
{
|
|
453
|
+
minWidth: 0,
|
|
454
|
+
maxWidth: container.width,
|
|
455
|
+
minHeight: 0,
|
|
456
|
+
maxHeight: container.height
|
|
457
|
+
},
|
|
458
|
+
measurement.service
|
|
459
|
+
);
|
|
460
|
+
if (result.status !== "measured") {
|
|
461
|
+
throw childDiagnostic(
|
|
462
|
+
cell.child,
|
|
463
|
+
"measureIntrinsic",
|
|
464
|
+
"unsupported",
|
|
465
|
+
container,
|
|
466
|
+
`intrinsic grid track contribution requires a declared intrinsic measurement: ${result.reason}`
|
|
467
|
+
);
|
|
468
|
+
}
|
|
469
|
+
records.push(start, span, result.minContent.width, result.maxContent.width);
|
|
470
|
+
}
|
|
471
|
+
return records;
|
|
472
|
+
}
|
|
473
|
+
function measureGridCellAtSelectedWidth(cell, width, measurement, container) {
|
|
474
|
+
const area = { x: 0, y: 0, width, height: container.height };
|
|
475
|
+
let normalized = cell.normalized;
|
|
476
|
+
if (nativeLayout && GLOBAL_STATE.currentPibblInstance && getStyleMeasurementMode() === void 0 && hasPercentageBoxPadding(normalized)) {
|
|
477
|
+
normalized = resolveAllocatedInsets(normalized, {
|
|
478
|
+
width,
|
|
479
|
+
context: childContext(cell.child, area)
|
|
480
|
+
});
|
|
481
|
+
}
|
|
482
|
+
if (normalized.boxSizing !== void 0) {
|
|
483
|
+
normalized = contentBoxStyle(normalized, {
|
|
484
|
+
width,
|
|
485
|
+
height: container.height,
|
|
486
|
+
context: childContext(cell.child, area)
|
|
487
|
+
});
|
|
488
|
+
}
|
|
489
|
+
const child = clonePibblElement(cell.child);
|
|
490
|
+
setPreNormalizedStyle(
|
|
491
|
+
child,
|
|
492
|
+
normalized,
|
|
493
|
+
cell.child,
|
|
494
|
+
cell.receiverToken,
|
|
495
|
+
preparedStyleQuery(cell.prepared)
|
|
496
|
+
);
|
|
497
|
+
const result = measurement.measureElement(child, {
|
|
498
|
+
minWidth: width,
|
|
499
|
+
maxWidth: width,
|
|
500
|
+
minHeight: 0,
|
|
501
|
+
maxHeight: container.height
|
|
502
|
+
});
|
|
503
|
+
if (result.status !== "measured") {
|
|
504
|
+
throw childDiagnostic(
|
|
505
|
+
cell.child,
|
|
506
|
+
"height",
|
|
507
|
+
"auto",
|
|
508
|
+
container,
|
|
509
|
+
`selected Grid column width requires measurement: ${result.reason}`
|
|
510
|
+
);
|
|
511
|
+
}
|
|
512
|
+
return result.size.height;
|
|
513
|
+
}
|
|
514
|
+
function trackNeedsIntrinsic(track) {
|
|
515
|
+
return track.kind === "intrinsic" || track.kind === "minmax" && (trackNeedsIntrinsic(track.min) || trackNeedsIntrinsic(track.max));
|
|
516
|
+
}
|
|
517
|
+
function resolveNativeGridTracks(region, tracks, bound, gap, axis, container) {
|
|
518
|
+
try {
|
|
519
|
+
return region.resolveGridV2Tracks(gridTrackRecords(tracks, bound), { bound, gap, axis: axis === "columns" ? 0 : 1 });
|
|
520
|
+
} catch (error) {
|
|
521
|
+
if (error instanceof RangeError) throw trackDiagnostic(tracks, axis, container);
|
|
522
|
+
throw error;
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
function gridTrackRecords(tracks, bound) {
|
|
526
|
+
const records = new Array(tracks.length * GRID_V2_TRACK_STRIDE).fill(0);
|
|
527
|
+
for (let index = 0; index < tracks.length; index++) {
|
|
528
|
+
const track = tracks[index], offset = index * GRID_V2_TRACK_STRIDE;
|
|
529
|
+
if (track.kind === "fixed") {
|
|
530
|
+
records[offset] = 0;
|
|
531
|
+
records[offset + 1] = track.value;
|
|
532
|
+
} else if (track.kind === "percentage") {
|
|
533
|
+
records[offset] = 1;
|
|
534
|
+
records[offset + 1] = track.factor;
|
|
535
|
+
} else if (track.kind === "fraction") {
|
|
536
|
+
records[offset] = 2;
|
|
537
|
+
records[offset + 1] = track.factor;
|
|
538
|
+
} else if (track.kind === "intrinsic") {
|
|
539
|
+
writeGridBreadth(records, offset, track, bound);
|
|
540
|
+
} else {
|
|
541
|
+
records[offset] = 6;
|
|
542
|
+
writeGridBreadth(records, offset + 2, track.min, bound);
|
|
543
|
+
writeGridBreadth(records, offset + 4, track.max, bound);
|
|
544
|
+
}
|
|
545
|
+
}
|
|
546
|
+
return records;
|
|
547
|
+
}
|
|
548
|
+
function writeGridBreadth(records, offset, track, bound) {
|
|
549
|
+
if (track.kind === "fixed") {
|
|
550
|
+
records[offset] = 0;
|
|
551
|
+
records[offset + 1] = track.value;
|
|
552
|
+
} else if (track.kind === "percentage") {
|
|
553
|
+
records[offset] = 1;
|
|
554
|
+
records[offset + 1] = track.factor;
|
|
555
|
+
} else if (track.kind === "fraction") {
|
|
556
|
+
records[offset] = 2;
|
|
557
|
+
records[offset + 1] = track.factor;
|
|
558
|
+
} else if (track.kind === "minmax") writeGridBreadth(records, offset, track.min, bound);
|
|
559
|
+
else if (track.value === "min-content") records[offset] = 3;
|
|
560
|
+
else if (track.value === "max-content") records[offset] = 4;
|
|
561
|
+
else if (track.value === "auto") records[offset] = 5;
|
|
562
|
+
else if (isFitContent(track.value)) {
|
|
563
|
+
records[offset] = 7;
|
|
564
|
+
records[offset + 1] = typeof track.value.limit === "number" ? track.value.limit : bound * Number.parseFloat(track.value.limit) / 100;
|
|
565
|
+
}
|
|
566
|
+
}
|
|
567
|
+
function gridFlowCode(flow) {
|
|
568
|
+
return flow === "row" ? 0 : flow === "column" ? 1 : flow === "row dense" ? 2 : 3;
|
|
569
|
+
}
|
|
257
570
|
function resolveParsedGridTracks(tracks, bound, gap, axis, container) {
|
|
258
571
|
if (!Number.isFinite(bound) || bound < 0) {
|
|
259
572
|
throw optionDiagnostic(
|
|
@@ -276,8 +589,16 @@ function resolveParsedGridTracks(tracks, bound, gap, axis, container) {
|
|
|
276
589
|
if (!Number.isFinite(size)) throw trackDiagnostic(track, axis, container);
|
|
277
590
|
resolved[index] = size;
|
|
278
591
|
allocated += size;
|
|
279
|
-
} else {
|
|
592
|
+
} else if (track.kind === "fraction") {
|
|
280
593
|
fractions.push({ index, factor: track.factor });
|
|
594
|
+
} else if (track.kind === "minmax") {
|
|
595
|
+
const min = resolvedTrackMinimum(track.min, bound, axis, container);
|
|
596
|
+
const max = resolvedTrackMaximum(track.max, bound, axis, container);
|
|
597
|
+
if (max < min) throw trackDiagnostic(track, axis, container);
|
|
598
|
+
resolved[index] = min;
|
|
599
|
+
allocated += min;
|
|
600
|
+
} else {
|
|
601
|
+
resolved[index] = 0;
|
|
281
602
|
}
|
|
282
603
|
}
|
|
283
604
|
const totalFr = fractions.reduce((total, track) => total + track.factor, 0);
|
|
@@ -292,7 +613,7 @@ function resolveParsedGridTracks(tracks, bound, gap, axis, container) {
|
|
|
292
613
|
}
|
|
293
614
|
return resolved;
|
|
294
615
|
}
|
|
295
|
-
function parseGridTracks(tracks, axis, container) {
|
|
616
|
+
function parseGridTracks(tracks, axis, container, gap = 0) {
|
|
296
617
|
if (!Array.isArray(tracks) || tracks.length === 0) {
|
|
297
618
|
throw optionDiagnostic(
|
|
298
619
|
axis === "columns" ? "gridTemplateColumns" : "gridTemplateRows",
|
|
@@ -301,16 +622,52 @@ function parseGridTracks(tracks, axis, container) {
|
|
|
301
622
|
`requires a nonempty explicit ${axis} list`
|
|
302
623
|
);
|
|
303
624
|
}
|
|
304
|
-
|
|
625
|
+
if (!nativeLayout) for (let index = 0; index < tracks.length; index++) {
|
|
626
|
+
const track = tracks[index];
|
|
627
|
+
if (typeof track === "object" || track === "auto" || track === "min-content" || track === "max-content") throw trackDiagnostic(track, axis, container);
|
|
628
|
+
}
|
|
629
|
+
let autoRepeatIndex = -1;
|
|
630
|
+
for (let index = 0; index < tracks.length; index++) {
|
|
631
|
+
const track = tracks[index];
|
|
632
|
+
if (!isAutoRepeatTrack(track)) continue;
|
|
633
|
+
if (autoRepeatIndex !== -1) throw trackDiagnostic(tracks, axis, container);
|
|
634
|
+
autoRepeatIndex = index;
|
|
635
|
+
}
|
|
636
|
+
const autoRepeatCount = autoRepeatIndex === -1 ? void 0 : resolveAutoRepeatCount(
|
|
637
|
+
tracks,
|
|
638
|
+
autoRepeatIndex,
|
|
639
|
+
axis,
|
|
640
|
+
container,
|
|
641
|
+
gap
|
|
642
|
+
);
|
|
643
|
+
const expanded = [];
|
|
644
|
+
const autoFit = autoRepeatIndex !== -1 && tracks[autoRepeatIndex].count === "auto-fit" ? /* @__PURE__ */ new Set() : void 0;
|
|
645
|
+
for (let index = 0; index < tracks.length; index++) {
|
|
646
|
+
expandGridTrack(
|
|
647
|
+
tracks[index],
|
|
648
|
+
axis,
|
|
649
|
+
container,
|
|
650
|
+
expanded,
|
|
651
|
+
index === autoRepeatIndex ? autoRepeatCount : void 0,
|
|
652
|
+
autoFit
|
|
653
|
+
);
|
|
654
|
+
}
|
|
655
|
+
if (!expanded.length) throw trackDiagnostic(tracks, axis, container);
|
|
656
|
+
const parsed = expanded.map((track) => {
|
|
305
657
|
if (typeof track === "number") {
|
|
306
658
|
if (!Number.isFinite(track) || track < 0) {
|
|
307
659
|
throw trackDiagnostic(track, axis, container);
|
|
308
660
|
}
|
|
309
661
|
return Object.freeze({ kind: "fixed", value: track });
|
|
310
662
|
}
|
|
311
|
-
if (
|
|
312
|
-
|
|
663
|
+
if (isFitContent(track)) return Object.freeze({ kind: "intrinsic", value: track });
|
|
664
|
+
if (typeof track === "object" && track !== null && "kind" in track && track.kind === "minmax") {
|
|
665
|
+
const min = parseSingleGridTrack(track.min, axis, container);
|
|
666
|
+
const max = parseSingleGridTrack(track.max, axis, container);
|
|
667
|
+
return Object.freeze({ kind: "minmax", min, max });
|
|
313
668
|
}
|
|
669
|
+
if (typeof track !== "string") throw trackDiagnostic(track, axis, container);
|
|
670
|
+
if (track === "auto" || track === "min-content" || track === "max-content") return Object.freeze({ kind: "intrinsic", value: track });
|
|
314
671
|
const match = /^(?:\d+(?:\.\d+)?|\.\d+)(%|fr)$/.exec(track);
|
|
315
672
|
if (!match) throw trackDiagnostic(track, axis, container);
|
|
316
673
|
const factor = Number.parseFloat(track);
|
|
@@ -319,6 +676,94 @@ function parseGridTracks(tracks, axis, container) {
|
|
|
319
676
|
}
|
|
320
677
|
return Object.freeze(match[1] === "%" ? { kind: "percentage", factor } : { kind: "fraction", factor });
|
|
321
678
|
});
|
|
679
|
+
return autoFit ? parsed.map((track, index) => autoFit.has(index) ? Object.freeze({ ...track, autoFit: true }) : track) : parsed;
|
|
680
|
+
}
|
|
681
|
+
function parseSingleGridTrack(track, axis, container) {
|
|
682
|
+
const parsed = parseGridTracks([track], axis, container);
|
|
683
|
+
return parsed[0];
|
|
684
|
+
}
|
|
685
|
+
function expandGridTrack(track, axis, container, into, resolvedAutoRepeatCount, autoFit, inheritedAutoFit = false) {
|
|
686
|
+
if (typeof track === "object" && track !== null && "kind" in track && track.kind === "repeat") {
|
|
687
|
+
if (!Array.isArray(track.tracks) || !track.tracks.length) throw trackDiagnostic(track, axis, container);
|
|
688
|
+
let count = track.count;
|
|
689
|
+
if (count === "auto-fill" || count === "auto-fit") {
|
|
690
|
+
if (resolvedAutoRepeatCount === void 0) throw trackDiagnostic(track, axis, container);
|
|
691
|
+
count = resolvedAutoRepeatCount;
|
|
692
|
+
}
|
|
693
|
+
if (!Number.isInteger(count) || count < 0) throw trackDiagnostic(track, axis, container);
|
|
694
|
+
for (let repeat = 0; repeat < count; repeat++) for (let index = 0; index < track.tracks.length; index++) expandGridTrack(track.tracks[index], axis, container, into, void 0, autoFit, inheritedAutoFit || track.count === "auto-fit");
|
|
695
|
+
return;
|
|
696
|
+
}
|
|
697
|
+
if (inheritedAutoFit) autoFit?.add(into.length);
|
|
698
|
+
into.push(track);
|
|
699
|
+
}
|
|
700
|
+
function isAutoRepeatTrack(track) {
|
|
701
|
+
return typeof track === "object" && track !== null && "kind" in track && track.kind === "repeat" && (track.count === "auto-fill" || track.count === "auto-fit");
|
|
702
|
+
}
|
|
703
|
+
function resolveAutoRepeatCount(tracks, autoRepeatIndex, axis, container, gap) {
|
|
704
|
+
const autoRepeat = tracks[autoRepeatIndex];
|
|
705
|
+
const repeated = trackListMetrics(autoRepeat.tracks, axis, container);
|
|
706
|
+
let fixedBreadth = 0;
|
|
707
|
+
let fixedCount = 0;
|
|
708
|
+
for (let index = 0; index < tracks.length; index++) {
|
|
709
|
+
if (index === autoRepeatIndex) continue;
|
|
710
|
+
const metrics = trackMetrics(tracks[index], axis, container);
|
|
711
|
+
fixedBreadth += metrics.breadth;
|
|
712
|
+
fixedCount += metrics.count;
|
|
713
|
+
}
|
|
714
|
+
const bound = axis === "columns" ? container.width : container.height;
|
|
715
|
+
const available = bound - fixedBreadth - (fixedCount - 1) * gap;
|
|
716
|
+
const repeatedBreadth = repeated.breadth + repeated.count * gap;
|
|
717
|
+
return Math.max(1, Math.floor(available / Math.max(1, repeatedBreadth)));
|
|
718
|
+
}
|
|
719
|
+
function trackListMetrics(tracks, axis, container) {
|
|
720
|
+
let breadth = 0;
|
|
721
|
+
let count = 0;
|
|
722
|
+
for (let index = 0; index < tracks.length; index++) {
|
|
723
|
+
const metrics = trackMetrics(tracks[index], axis, container);
|
|
724
|
+
breadth += metrics.breadth;
|
|
725
|
+
count += metrics.count;
|
|
726
|
+
}
|
|
727
|
+
return { breadth, count };
|
|
728
|
+
}
|
|
729
|
+
function trackMetrics(track, axis, container) {
|
|
730
|
+
if (typeof track === "object" && track !== null && "kind" in track && track.kind === "repeat") {
|
|
731
|
+
if (!Array.isArray(track.tracks) || !track.tracks.length || typeof track.count !== "number" || !Number.isInteger(track.count) || track.count < 0) {
|
|
732
|
+
throw trackDiagnostic(track, axis, container);
|
|
733
|
+
}
|
|
734
|
+
let breadth = 0;
|
|
735
|
+
let count = 0;
|
|
736
|
+
for (let index = 0; index < track.tracks.length; index++) {
|
|
737
|
+
const metrics = trackMetrics(track.tracks[index], axis, container);
|
|
738
|
+
breadth += metrics.breadth * track.count;
|
|
739
|
+
count += metrics.count * track.count;
|
|
740
|
+
}
|
|
741
|
+
return { breadth, count };
|
|
742
|
+
}
|
|
743
|
+
return {
|
|
744
|
+
breadth: minimumRepeatBreadth([track], axis, container),
|
|
745
|
+
count: 1
|
|
746
|
+
};
|
|
747
|
+
}
|
|
748
|
+
function minimumRepeatBreadth(tracks, axis, container) {
|
|
749
|
+
let size = 0;
|
|
750
|
+
for (let index = 0; index < tracks.length; index++) {
|
|
751
|
+
const parsed = parseSingleGridTrack(tracks[index], axis, container);
|
|
752
|
+
size += resolvedTrackMinimum(parsed, axis === "columns" ? container.width : container.height, axis, container);
|
|
753
|
+
}
|
|
754
|
+
return size;
|
|
755
|
+
}
|
|
756
|
+
function resolvedTrackMinimum(track, bound, axis, container) {
|
|
757
|
+
if (track.kind === "fixed") return track.value;
|
|
758
|
+
if (track.kind === "percentage") return bound * track.factor / 100;
|
|
759
|
+
if (track.kind === "minmax") return resolvedTrackMinimum(track.min, bound, axis, container);
|
|
760
|
+
return 0;
|
|
761
|
+
}
|
|
762
|
+
function resolvedTrackMaximum(track, bound, axis, container) {
|
|
763
|
+
if (track.kind === "fixed") return track.value;
|
|
764
|
+
if (track.kind === "percentage") return bound * track.factor / 100;
|
|
765
|
+
if (track.kind === "fraction" || track.kind === "intrinsic") return Number.POSITIVE_INFINITY;
|
|
766
|
+
return resolvedTrackMaximum(track.max, bound, axis, container);
|
|
322
767
|
}
|
|
323
768
|
function measureGrid(input) {
|
|
324
769
|
prepareLayoutChildren(input.props.children, "Grid");
|
|
@@ -331,48 +776,205 @@ function measureGrid(input) {
|
|
|
331
776
|
const options = normalizeGridOptions(input.style, diagnosticBox);
|
|
332
777
|
const widthDefinite = input.style.width !== void 0 && input.style.width !== "auto";
|
|
333
778
|
const heightDefinite = input.style.height !== void 0 && input.style.height !== "auto";
|
|
334
|
-
if (!
|
|
335
|
-
const
|
|
336
|
-
|
|
337
|
-
|
|
779
|
+
if (widthDefinite && !heightDefinite) {
|
|
780
|
+
const width2 = measuredLength(
|
|
781
|
+
input.style.width,
|
|
782
|
+
input.constraints.maxWidth,
|
|
783
|
+
"width",
|
|
784
|
+
input.constraints
|
|
338
785
|
);
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
786
|
+
const selected = measureGridRowsAtSelectedWidth(
|
|
787
|
+
input.props.children,
|
|
788
|
+
input.style,
|
|
789
|
+
input.service,
|
|
790
|
+
(element, constraints) => input.measureElement(element, constraints),
|
|
791
|
+
input.constraints,
|
|
792
|
+
width2
|
|
793
|
+
);
|
|
794
|
+
if (selected.status === "unsupported") return selected;
|
|
795
|
+
return { status: "measured", size: { width: width2, height: selected.height } };
|
|
344
796
|
}
|
|
797
|
+
const intrinsic = !widthDefinite && !fixedIntrinsicAxis(options.columns) || !heightDefinite && !fixedIntrinsicAxis(options.rows) ? measureGridIntrinsic({
|
|
798
|
+
props: input.props,
|
|
799
|
+
style: input.style,
|
|
800
|
+
constraints: {
|
|
801
|
+
width: { kind: "bounded", min: input.constraints.minWidth, max: input.constraints.maxWidth },
|
|
802
|
+
height: { kind: "bounded", min: input.constraints.minHeight, max: input.constraints.maxHeight }
|
|
803
|
+
},
|
|
804
|
+
service: input.service
|
|
805
|
+
}) : void 0;
|
|
806
|
+
if (intrinsic?.status === "unsupported") return intrinsic;
|
|
345
807
|
const width = widthDefinite ? measuredLength(
|
|
346
808
|
input.style.width,
|
|
347
809
|
input.constraints.maxWidth,
|
|
348
810
|
"width",
|
|
349
811
|
input.constraints
|
|
350
|
-
) : intrinsicTrackSize(
|
|
351
|
-
options.columns,
|
|
352
|
-
options.columnGap,
|
|
353
|
-
"columns"
|
|
354
|
-
);
|
|
812
|
+
) : fixedIntrinsicAxis(options.columns) ? intrinsicTrackSize(options.columns, options.columnGap) : intrinsic.maxContent.width;
|
|
355
813
|
const height = heightDefinite ? measuredLength(
|
|
356
814
|
input.style.height,
|
|
357
815
|
input.constraints.maxHeight,
|
|
358
816
|
"height",
|
|
359
817
|
input.constraints
|
|
360
|
-
) : intrinsicTrackSize(options.rows, options.rowGap
|
|
818
|
+
) : fixedIntrinsicAxis(options.rows) ? intrinsicTrackSize(options.rows, options.rowGap) : intrinsic.maxContent.height;
|
|
361
819
|
return { status: "measured", size: { width, height } };
|
|
362
820
|
}
|
|
363
|
-
function
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
821
|
+
function measureGridRowsAtSelectedWidth(childInput, style, service, measure, constraints, width) {
|
|
822
|
+
if (!Number.isFinite(width) || width < 0 || !Number.isFinite(constraints.maxHeight)) {
|
|
823
|
+
return { status: "unsupported", reason: "Grid selected-width row measurement requires finite owner constraints" };
|
|
824
|
+
}
|
|
825
|
+
const allocatedHeight = typeof style.height === "number" ? measuredLength(style.height, constraints.maxHeight, "height", constraints) : void 0;
|
|
826
|
+
const container = { x: 0, y: 0, width, height: allocatedHeight ?? constraints.maxHeight };
|
|
827
|
+
const options = normalizeGridOptions(style, container);
|
|
828
|
+
if (allocatedHeight === void 0 && (style.gridTemplateRows.some(isAutoRepeatTrack) || options.rows.some(trackNeedsAllocatedAxis))) {
|
|
829
|
+
return { status: "unsupported", reason: "Grid intrinsic row measurement is allocation-dependent" };
|
|
830
|
+
}
|
|
831
|
+
const children = materializeLayoutChildren(childInput, "Grid");
|
|
832
|
+
const dependentImplicitRows = allocatedHeight === void 0 && (trackNeedsAllocatedAxis(options.autoRow) || style.gridAutoRows !== void 0 && isAutoRepeatTrack(style.gridAutoRows));
|
|
833
|
+
const canSumRows = fixedIntrinsicAxis(options.rows) && !options.autoFitRows;
|
|
834
|
+
let assignedCells;
|
|
835
|
+
if (dependentImplicitRows || canSumRows) {
|
|
836
|
+
assignedCells = assignGridCells(children, container, options.columns.length, options.rows.length, options);
|
|
837
|
+
const extent = maxGridExtent(assignedCells.filter((cell) => cell.normalized.position !== "absolute"), "row");
|
|
838
|
+
if (dependentImplicitRows && extent > options.rows.length) {
|
|
839
|
+
return { status: "unsupported", reason: "Grid intrinsic implicit-row measurement is allocation-dependent" };
|
|
840
|
+
}
|
|
841
|
+
const rows = appendImplicitTracks(options.rows, options.autoRow, extent);
|
|
842
|
+
if (canSumRows && fixedIntrinsicAxis(rows)) {
|
|
843
|
+
return { status: "measured", height: intrinsicTrackSize(rows, options.rowGap) };
|
|
844
|
+
}
|
|
845
|
+
}
|
|
846
|
+
const region = new LayoutRegion();
|
|
847
|
+
try {
|
|
848
|
+
resolveGridPlacements(container, children, options, { service, measureElement: measure }, region, assignedCells);
|
|
849
|
+
const rows = region.snapshotGridV2Tracks(1);
|
|
850
|
+
let height = Math.max(0, rows.length - 1) * options.rowGap;
|
|
851
|
+
for (let index = 0; index < rows.length; index++) height += rows[index];
|
|
852
|
+
return { status: "measured", height };
|
|
853
|
+
} finally {
|
|
854
|
+
region.dispose();
|
|
855
|
+
}
|
|
856
|
+
}
|
|
857
|
+
function trackNeedsAllocatedAxis(track) {
|
|
858
|
+
if (track.kind === "percentage" || track.kind === "fraction") return true;
|
|
859
|
+
if (track.kind === "minmax") return trackNeedsAllocatedAxis(track.min) || trackNeedsAllocatedAxis(track.max);
|
|
860
|
+
return track.kind === "intrinsic" && isFitContent(track.value) && typeof track.value.limit === "string";
|
|
861
|
+
}
|
|
862
|
+
function fixedIntrinsicAxis(tracks) {
|
|
863
|
+
return tracks.every((track) => track.kind === "fixed");
|
|
864
|
+
}
|
|
865
|
+
function intrinsicTrackSize(tracks, gap) {
|
|
866
|
+
return tracks.reduce((total, track) => total + (track.kind === "fixed" ? track.value : 0), Math.max(0, tracks.length - 1) * gap);
|
|
867
|
+
}
|
|
868
|
+
function measureGridIntrinsic(input) {
|
|
869
|
+
const selected = intrinsicGridSelectedWidth(input);
|
|
870
|
+
if (selected !== void 0) {
|
|
871
|
+
const rows2 = measureGridRowsAtSelectedWidth(
|
|
872
|
+
input.props.children,
|
|
873
|
+
input.style,
|
|
874
|
+
input.service,
|
|
875
|
+
(element, constraints) => measureElement(element, constraints, input.service),
|
|
876
|
+
selected.constraints,
|
|
877
|
+
selected.width
|
|
878
|
+
);
|
|
879
|
+
if (rows2.status === "unsupported") return rows2;
|
|
880
|
+
return {
|
|
881
|
+
status: "measured",
|
|
882
|
+
minContent: { width: selected.width, height: rows2.height },
|
|
883
|
+
maxContent: { width: selected.width, height: rows2.height }
|
|
884
|
+
};
|
|
885
|
+
}
|
|
886
|
+
if (containsFractionTrack(input.style.gridTemplateColumns) || containsFractionTrack(input.style.gridTemplateRows)) {
|
|
887
|
+
return { status: "unsupported", reason: "Grid fractional intrinsic measurement is allocation-dependent" };
|
|
888
|
+
}
|
|
889
|
+
const width = input.constraints.width.kind === "bounded" ? input.constraints.width.max : Number.POSITIVE_INFINITY;
|
|
890
|
+
const height = input.constraints.height.kind === "bounded" ? input.constraints.height.max : Number.POSITIVE_INFINITY;
|
|
891
|
+
if (!Number.isFinite(width) || !Number.isFinite(height)) {
|
|
892
|
+
return { status: "unsupported", reason: "Grid intrinsic measurement requires finite owner constraints" };
|
|
893
|
+
}
|
|
894
|
+
const container = { x: 0, y: 0, width, height };
|
|
895
|
+
const options = normalizeGridOptions(input.style, container);
|
|
896
|
+
if (options.columns.some((track) => track.kind === "percentage") || options.rows.some((track) => track.kind === "percentage")) {
|
|
897
|
+
return { status: "unsupported", reason: "Grid percentage intrinsic measurement is allocation-dependent" };
|
|
898
|
+
}
|
|
899
|
+
const children = materializeLayoutChildren(input.props.children, "Grid");
|
|
900
|
+
const cells = assignGridCells(children, container, options.columns.length, options.rows.length, options);
|
|
901
|
+
const columns = intrinsicGridAxis(appendImplicitTracks(options.columns, options.autoColumn, maxGridExtent(cells.filter((cell) => cell.normalized.position !== "absolute"), "column")), cells, "columns", options.columnGap, container, input.service);
|
|
902
|
+
if (columns.status === "unsupported") return columns;
|
|
903
|
+
const rows = intrinsicGridAxis(appendImplicitTracks(options.rows, options.autoRow, maxGridExtent(cells.filter((cell) => cell.normalized.position !== "absolute"), "row")), cells, "rows", options.rowGap, container, input.service);
|
|
904
|
+
if (rows.status === "unsupported") return rows;
|
|
905
|
+
return {
|
|
906
|
+
status: "measured",
|
|
907
|
+
minContent: { width: columns.min, height: rows.min },
|
|
908
|
+
maxContent: { width: columns.max, height: rows.max }
|
|
909
|
+
};
|
|
910
|
+
}
|
|
911
|
+
function intrinsicGridSelectedWidth(input) {
|
|
912
|
+
const widthConstraint = input.constraints.width;
|
|
913
|
+
const heightConstraint = input.constraints.height;
|
|
914
|
+
if (input.style.width === void 0 || input.style.width === "auto" || widthConstraint.kind !== "bounded" || heightConstraint.kind !== "bounded") {
|
|
915
|
+
return void 0;
|
|
916
|
+
}
|
|
917
|
+
const constraints = {
|
|
918
|
+
minWidth: widthConstraint.min,
|
|
919
|
+
maxWidth: widthConstraint.max,
|
|
920
|
+
minHeight: heightConstraint.min,
|
|
921
|
+
maxHeight: heightConstraint.max
|
|
922
|
+
};
|
|
923
|
+
const width = resolveScalarSizingLength(input.style.width, widthConstraint.max, "width", {
|
|
924
|
+
component: "Grid",
|
|
925
|
+
algorithm: "intrinsic measurement",
|
|
926
|
+
constraints
|
|
927
|
+
});
|
|
928
|
+
return width === void 0 || width < 0 ? void 0 : { width, constraints };
|
|
929
|
+
}
|
|
930
|
+
function containsFractionTrack(tracks) {
|
|
931
|
+
for (const track of tracks) {
|
|
932
|
+
if (typeof track === "string" && track.endsWith("fr")) return true;
|
|
933
|
+
if (typeof track === "object" && track !== null && "kind" in track) {
|
|
934
|
+
if (track.kind === "minmax" && (typeof track.min === "string" && track.min.endsWith("fr") || typeof track.max === "string" && track.max.endsWith("fr"))) return true;
|
|
935
|
+
if (track.kind === "repeat" && containsFractionTrack(track.tracks)) return true;
|
|
936
|
+
}
|
|
937
|
+
}
|
|
938
|
+
return false;
|
|
368
939
|
}
|
|
369
|
-
function
|
|
370
|
-
|
|
371
|
-
const
|
|
372
|
-
|
|
940
|
+
function intrinsicGridAxis(tracks, cells, axis, gap, container, service) {
|
|
941
|
+
const minimum = new Array(tracks.length).fill(0);
|
|
942
|
+
const maximum = new Array(tracks.length).fill(0);
|
|
943
|
+
for (let index = 0; index < tracks.length; index++) {
|
|
944
|
+
const track = tracks[index];
|
|
945
|
+
if (track.kind === "fixed") minimum[index] = maximum[index] = track.value;
|
|
946
|
+
else if (track.kind === "fraction") return { status: "unsupported", reason: `Grid fractional intrinsic measurement for ${axis} is allocation-dependent` };
|
|
947
|
+
else if (track.kind === "minmax" && track.max.kind === "fraction") return { status: "unsupported", reason: `Grid fractional intrinsic measurement for ${axis} is allocation-dependent` };
|
|
948
|
+
}
|
|
949
|
+
for (const cell of cells) {
|
|
950
|
+
if (cell.normalized.position === "absolute") continue;
|
|
951
|
+
const start = axis === "columns" ? cell.columnStart : cell.rowStart;
|
|
952
|
+
const span = axis === "columns" ? cell.columnSpan : cell.rowSpan;
|
|
953
|
+
if (start < 1 || start + span - 1 > tracks.length) continue;
|
|
954
|
+
const measured = measureIntrinsicElement(cell.child, { minWidth: 0, maxWidth: container.width, minHeight: 0, maxHeight: container.height }, service);
|
|
955
|
+
if (measured.status === "unsupported") return measured;
|
|
956
|
+
const min = axis === "columns" ? measured.minContent.width : measured.minContent.height;
|
|
957
|
+
const max = axis === "columns" ? measured.maxContent.width : measured.maxContent.height;
|
|
958
|
+
let fixed = Math.max(0, span - 1) * gap;
|
|
959
|
+
const eligible = [];
|
|
960
|
+
for (let index = start - 1; index < start - 1 + span; index++) {
|
|
961
|
+
if (trackNeedsIntrinsic(tracks[index])) eligible.push(index);
|
|
962
|
+
else fixed += minimum[index];
|
|
963
|
+
}
|
|
964
|
+
if (eligible.length) {
|
|
965
|
+
const minimumContribution = Math.max(0, min - fixed) / eligible.length;
|
|
966
|
+
const maximumContribution = Math.max(0, max - fixed) / eligible.length;
|
|
967
|
+
for (const index of eligible) {
|
|
968
|
+
minimum[index] = Math.max(minimum[index], minimumContribution);
|
|
969
|
+
maximum[index] = Math.max(maximum[index], maximumContribution);
|
|
970
|
+
}
|
|
971
|
+
}
|
|
972
|
+
}
|
|
973
|
+
const gaps = Math.max(0, tracks.length - 1) * gap;
|
|
974
|
+
return { status: "measured", min: minimum.reduce((total, value) => total + value, gaps), max: maximum.reduce((total, value) => total + value, gaps) };
|
|
373
975
|
}
|
|
374
976
|
function measuredLength(value, reference, property, constraints) {
|
|
375
|
-
const resolved =
|
|
977
|
+
const resolved = resolveScalarSizingLength(value, reference, property, {
|
|
376
978
|
component: "Grid",
|
|
377
979
|
algorithm: "measurement",
|
|
378
980
|
constraints
|
|
@@ -417,21 +1019,32 @@ function normalizeGridOptions(style, container) {
|
|
|
417
1019
|
container
|
|
418
1020
|
);
|
|
419
1021
|
const gap = nonnegativeOption(style.gap ?? 0, "gap", container);
|
|
1022
|
+
const rowGap = nonnegativeOption(style.rowGap ?? gap, "rowGap", container);
|
|
1023
|
+
const columnGap = nonnegativeOption(
|
|
1024
|
+
style.columnGap ?? gap,
|
|
1025
|
+
"columnGap",
|
|
1026
|
+
container
|
|
1027
|
+
);
|
|
1028
|
+
if (!nativeLayout && (style.gridAutoFlow !== void 0 || style.gridAutoColumns !== void 0 || style.gridAutoRows !== void 0)) throw optionDiagnostic("gridAutoFlow", style.gridAutoFlow, container, "requires the native layout engine");
|
|
1029
|
+
const gridAutoFlow = style.gridAutoFlow ?? "row";
|
|
420
1030
|
return {
|
|
1031
|
+
gridAutoFlow,
|
|
421
1032
|
columns: parseGridTracks(
|
|
422
1033
|
style.gridTemplateColumns,
|
|
423
1034
|
"columns",
|
|
424
|
-
container
|
|
1035
|
+
container,
|
|
1036
|
+
columnGap
|
|
425
1037
|
),
|
|
426
|
-
rows: parseGridTracks(style.gridTemplateRows, "rows", container),
|
|
1038
|
+
rows: parseGridTracks(style.gridTemplateRows, "rows", container, rowGap),
|
|
1039
|
+
autoColumn: nativeLayout ? parseGridTracks([style.gridAutoColumns ?? "auto"], "columns", container)[0] : { kind: "fixed", value: 0 },
|
|
1040
|
+
autoRow: nativeLayout ? parseGridTracks([style.gridAutoRows ?? "auto"], "rows", container)[0] : { kind: "fixed", value: 0 },
|
|
1041
|
+
autoFitColumns: containsAutoFit(style.gridTemplateColumns),
|
|
1042
|
+
autoFitRows: containsAutoFit(style.gridTemplateRows),
|
|
1043
|
+
layoutDirection: getLayoutDirection(),
|
|
427
1044
|
justifyItems,
|
|
428
1045
|
alignItems,
|
|
429
|
-
rowGap
|
|
430
|
-
columnGap
|
|
431
|
-
style.columnGap ?? gap,
|
|
432
|
-
"columnGap",
|
|
433
|
-
container
|
|
434
|
-
)
|
|
1046
|
+
rowGap,
|
|
1047
|
+
columnGap
|
|
435
1048
|
};
|
|
436
1049
|
}
|
|
437
1050
|
function containerAlignment(value, property, container) {
|
|
@@ -477,28 +1090,6 @@ function placementInteger(value, property, child, container, required) {
|
|
|
477
1090
|
}
|
|
478
1091
|
return value;
|
|
479
1092
|
}
|
|
480
|
-
function validateSpan(start, span, trackCount, property, child, container) {
|
|
481
|
-
if (start - 1 + span > trackCount) {
|
|
482
|
-
throw childDiagnostic(
|
|
483
|
-
child,
|
|
484
|
-
property,
|
|
485
|
-
span,
|
|
486
|
-
container,
|
|
487
|
-
`grid area start ${start} plus span ${span} exceeds the explicit ${trackCount}-track list`
|
|
488
|
-
);
|
|
489
|
-
}
|
|
490
|
-
}
|
|
491
|
-
function validateStart(start, trackCount, property, child, container) {
|
|
492
|
-
if (start > trackCount) {
|
|
493
|
-
throw childDiagnostic(
|
|
494
|
-
child,
|
|
495
|
-
property,
|
|
496
|
-
start,
|
|
497
|
-
container,
|
|
498
|
-
`must reference the explicit ${trackCount}-track list`
|
|
499
|
-
);
|
|
500
|
-
}
|
|
501
|
-
}
|
|
502
1093
|
function trackOffset(tracks, index, gap) {
|
|
503
1094
|
return tracks.slice(0, index).reduce((total, size) => total + size, 0) + index * gap;
|
|
504
1095
|
}
|
|
@@ -534,7 +1125,8 @@ function assertFiniteContainer(container) {
|
|
|
534
1125
|
}
|
|
535
1126
|
}
|
|
536
1127
|
function rejectUnsupportedItemFields(child, style, container) {
|
|
537
|
-
for (
|
|
1128
|
+
for (let propertyIndex = 0; propertyIndex < unsupportedProperties.length; propertyIndex++) {
|
|
1129
|
+
const property = unsupportedProperties[propertyIndex];
|
|
538
1130
|
if (style[property] !== void 0) {
|
|
539
1131
|
throw childDiagnostic(
|
|
540
1132
|
child,
|
|
@@ -591,7 +1183,11 @@ function constraintsFor(container) {
|
|
|
591
1183
|
}
|
|
592
1184
|
export {
|
|
593
1185
|
Grid,
|
|
1186
|
+
autoFillTracks,
|
|
1187
|
+
autoFitTracks,
|
|
594
1188
|
layoutGrid,
|
|
1189
|
+
minmax,
|
|
1190
|
+
repeatTracks,
|
|
595
1191
|
resolveGridTracks
|
|
596
1192
|
};
|
|
597
1193
|
//# sourceMappingURL=grid.js.map
|