@pibbl/core 0.0.2 → 0.0.3-alpha.109.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/THIRD_PARTY_NOTICES.txt +81 -0
- package/dist/features/physics/2d-testing.d.ts +1 -1
- package/dist/features/physics/2d-testing.js +2 -2
- package/dist/features/physics/2d-testing.js.map +2 -2
- package/dist/features/physics/lib/2d/canvas/components.js +25 -21
- package/dist/features/physics/lib/2d/canvas/components.js.map +2 -2
- package/dist/features/physics/lib/2d/canvas/presentation.js +1 -2
- package/dist/features/physics/lib/2d/canvas/presentation.js.map +2 -2
- package/dist/features/physics/lib/2d/collision/casts.js +4 -2
- package/dist/features/physics/lib/2d/collision/casts.js.map +2 -2
- package/dist/features/physics/lib/2d/runtime/controller.js +1 -1
- package/dist/features/physics/lib/2d/runtime/controller.js.map +2 -2
- package/dist/features/physics/lib/2d/runtime/obstacles.js +9 -11
- package/dist/features/physics/lib/2d/runtime/obstacles.js.map +2 -2
- package/dist/features/physics/lib/2d/shapes.js +8 -9
- package/dist/features/physics/lib/2d/shapes.js.map +2 -2
- package/dist/features/physics/lib/2d/world/rapier.js +22 -26
- package/dist/features/physics/lib/2d/world/rapier.js.map +2 -2
- package/dist/features/sprites/loader.js +6 -3
- package/dist/features/sprites/loader.js.map +2 -2
- package/dist/features/textures/index.d.ts +12 -2
- package/dist/features/textures/index.js +33 -1
- package/dist/features/textures/index.js.map +2 -2
- package/dist/features/textures/lib/chemical-field.d.ts +56 -0
- package/dist/features/textures/lib/chemical-field.js +154 -0
- package/dist/features/textures/lib/chemical-field.js.map +7 -0
- package/dist/features/textures/lib/chemical-recipes.d.ts +119 -0
- package/dist/features/textures/lib/chemical-recipes.js +275 -0
- package/dist/features/textures/lib/chemical-recipes.js.map +7 -0
- package/dist/features/textures/lib/definitions.d.ts +3 -18
- package/dist/features/textures/lib/definitions.js +17 -24
- package/dist/features/textures/lib/definitions.js.map +2 -2
- package/dist/features/textures/lib/geometric-patterns.d.ts +149 -0
- package/dist/features/textures/lib/geometric-patterns.js +305 -0
- package/dist/features/textures/lib/geometric-patterns.js.map +7 -0
- package/dist/features/textures/lib/gray-scott.d.ts +55 -0
- package/dist/features/textures/lib/gray-scott.js +37 -0
- package/dist/features/textures/lib/gray-scott.js.map +7 -0
- package/dist/features/textures/lib/palette.js +1 -3
- package/dist/features/textures/lib/palette.js.map +2 -2
- package/dist/features/textures/lib/patterns.d.ts +123 -0
- package/dist/features/textures/lib/patterns.js +344 -0
- package/dist/features/textures/lib/patterns.js.map +7 -0
- package/dist/features/textures/lib/rain-drops.js +2 -1
- package/dist/features/textures/lib/rain-drops.js.map +2 -2
- package/dist/features/textures/lib/reaction-diffusion.d.ts +3 -2
- package/dist/features/textures/lib/reaction-diffusion.js +9 -20
- package/dist/features/textures/lib/reaction-diffusion.js.map +2 -2
- package/dist/features/textures/lib/simulation.d.ts +10 -4
- package/dist/features/textures/lib/simulation.js +23 -13
- package/dist/features/textures/lib/simulation.js.map +2 -2
- package/dist/features/textures/lib/wasm/electric.js +8 -1
- package/dist/features/textures/lib/wasm/electric.js.map +2 -2
- package/dist/features/textures/lib/water-surface.js +1 -3
- package/dist/features/textures/lib/water-surface.js.map +2 -2
- package/dist/features/viz/index.d.ts +68 -6
- package/dist/features/viz/index.js +164 -2
- package/dist/features/viz/index.js.map +2 -2
- package/dist/features/viz/inspection/bar.d.ts +79 -0
- package/dist/features/viz/inspection/bar.js +49 -0
- package/dist/features/viz/inspection/bar.js.map +7 -0
- package/dist/features/viz/inspection/candle.d.ts +156 -0
- package/dist/features/viz/inspection/candle.js +120 -0
- package/dist/features/viz/inspection/candle.js.map +7 -0
- package/dist/features/viz/inspection/capture-types.d.ts +65 -0
- package/dist/features/viz/inspection/capture.d.ts +16 -0
- package/dist/features/viz/inspection/capture.js +49 -0
- package/dist/features/viz/inspection/capture.js.map +7 -0
- package/dist/features/viz/inspection/handler.d.ts +36 -0
- package/dist/features/viz/inspection/handler.js +91 -0
- package/dist/features/viz/inspection/handler.js.map +7 -0
- package/dist/features/viz/inspection/ohlc-bar.d.ts +132 -0
- package/dist/features/viz/inspection/ohlc-bar.js +118 -0
- package/dist/features/viz/inspection/ohlc-bar.js.map +7 -0
- package/dist/features/viz/inspection/owned-ref.d.ts +16 -0
- package/dist/features/viz/inspection/owned-ref.js +99 -0
- package/dist/features/viz/inspection/owned-ref.js.map +7 -0
- package/dist/features/viz/inspection/painted-point.d.ts +22 -0
- package/dist/features/viz/inspection/painted-point.js +29 -0
- package/dist/features/viz/inspection/painted-point.js.map +7 -0
- package/dist/features/viz/inspection/queries.d.ts +100 -0
- package/dist/features/viz/inspection/queries.js +192 -0
- package/dist/features/viz/inspection/queries.js.map +7 -0
- package/dist/features/viz/inspection/query-types.d.ts +177 -0
- package/dist/features/viz/inspection/volume.d.ts +104 -0
- package/dist/features/viz/inspection/volume.js +95 -0
- package/dist/features/viz/inspection/volume.js.map +7 -0
- package/dist/features/viz/inspection.d.ts +19 -0
- package/dist/features/viz/inspection.js +54 -0
- package/dist/features/viz/inspection.js.map +7 -0
- package/dist/features/viz/inspection.mjs +1 -0
- package/dist/features/viz/lib/area-series.d.ts +62 -0
- package/dist/features/viz/lib/area-series.js +120 -0
- package/dist/features/viz/lib/area-series.js.map +7 -0
- package/dist/features/viz/lib/axis-title.js +2 -1
- package/dist/features/viz/lib/axis-title.js.map +2 -2
- package/dist/features/viz/lib/axis.js +1 -1
- package/dist/features/viz/lib/axis.js.map +2 -2
- package/dist/features/viz/lib/bar-series.d.ts +3 -1
- package/dist/features/viz/lib/bar-series.js +16 -1
- package/dist/features/viz/lib/bar-series.js.map +2 -2
- package/dist/features/viz/lib/baseline-series.d.ts +55 -0
- package/dist/features/viz/lib/baseline-series.js +136 -0
- package/dist/features/viz/lib/baseline-series.js.map +7 -0
- package/dist/features/viz/lib/candlestick-series.d.ts +62 -0
- package/dist/features/viz/lib/candlestick-series.js +150 -0
- package/dist/features/viz/lib/candlestick-series.js.map +7 -0
- package/dist/features/viz/lib/censored-point-series.d.ts +71 -0
- package/dist/features/viz/lib/censored-point-series.js +129 -0
- package/dist/features/viz/lib/censored-point-series.js.map +7 -0
- package/dist/features/viz/lib/color-context.d.ts +4 -0
- package/dist/features/viz/lib/color-context.js +41 -0
- package/dist/features/viz/lib/color-context.js.map +7 -0
- package/dist/features/viz/lib/color-math.d.ts +4 -0
- package/dist/features/viz/lib/color-math.js +31 -0
- package/dist/features/viz/lib/color-math.js.map +7 -0
- package/dist/features/viz/lib/color-types.d.ts +53 -0
- package/dist/features/viz/lib/curve-definition.d.ts +49 -0
- package/dist/features/viz/lib/curve-definition.js +142 -0
- package/dist/features/viz/lib/curve-definition.js.map +7 -0
- package/dist/features/viz/lib/diverging-color-scale.d.ts +11 -0
- package/dist/features/viz/lib/diverging-color-scale.js +51 -0
- package/dist/features/viz/lib/diverging-color-scale.js.map +7 -0
- package/dist/features/viz/lib/domain-navigation.d.ts +40 -0
- package/dist/features/viz/lib/domain-navigation.js +77 -0
- package/dist/features/viz/lib/domain-navigation.js.map +7 -0
- package/dist/features/viz/lib/editable-chart-elements.d.ts +178 -0
- package/dist/features/viz/lib/editable-chart-elements.js +733 -0
- package/dist/features/viz/lib/editable-chart-elements.js.map +7 -0
- package/dist/features/viz/lib/financial-aggregation.d.ts +127 -0
- package/dist/features/viz/lib/financial-aggregation.js +116 -0
- package/dist/features/viz/lib/financial-aggregation.js.map +7 -0
- package/dist/features/viz/lib/financial-autoscale.d.ts +64 -0
- package/dist/features/viz/lib/financial-autoscale.js +61 -0
- package/dist/features/viz/lib/financial-autoscale.js.map +7 -0
- package/dist/features/viz/lib/financial-comparison.d.ts +62 -0
- package/dist/features/viz/lib/financial-comparison.js +98 -0
- package/dist/features/viz/lib/financial-comparison.js.map +7 -0
- package/dist/features/viz/lib/financial-geometry.d.ts +77 -0
- package/dist/features/viz/lib/financial-geometry.js +67 -0
- package/dist/features/viz/lib/financial-geometry.js.map +7 -0
- package/dist/features/viz/lib/financial-indicators.d.ts +114 -0
- package/dist/features/viz/lib/financial-indicators.js +135 -0
- package/dist/features/viz/lib/financial-indicators.js.map +7 -0
- package/dist/features/viz/lib/financial-oscillators.d.ts +171 -0
- package/dist/features/viz/lib/financial-oscillators.js +265 -0
- package/dist/features/viz/lib/financial-oscillators.js.map +7 -0
- package/dist/features/viz/lib/graph/bipartite.d.ts +14 -0
- package/dist/features/viz/lib/graph/bipartite.js +250 -0
- package/dist/features/viz/lib/graph/bipartite.js.map +7 -0
- package/dist/features/viz/lib/graph/chord.d.ts +44 -0
- package/dist/features/viz/lib/graph/chord.js +348 -0
- package/dist/features/viz/lib/graph/chord.js.map +7 -0
- package/dist/features/viz/lib/graph/dependency.d.ts +26 -0
- package/dist/features/viz/lib/graph/dependency.js +140 -0
- package/dist/features/viz/lib/graph/dependency.js.map +7 -0
- package/dist/features/viz/lib/graph/force.d.ts +28 -0
- package/dist/features/viz/lib/graph/force.js +580 -0
- package/dist/features/viz/lib/graph/force.js.map +7 -0
- package/dist/features/viz/lib/graph/hierarchy.d.ts +21 -0
- package/dist/features/viz/lib/graph/hierarchy.js +112 -0
- package/dist/features/viz/lib/graph/hierarchy.js.map +7 -0
- package/dist/features/viz/lib/graph/icicle.d.ts +16 -0
- package/dist/features/viz/lib/graph/icicle.js +153 -0
- package/dist/features/viz/lib/graph/icicle.js.map +7 -0
- package/dist/features/viz/lib/graph/matrix.d.ts +30 -0
- package/dist/features/viz/lib/graph/matrix.js +243 -0
- package/dist/features/viz/lib/graph/matrix.js.map +7 -0
- package/dist/features/viz/lib/graph/neighborhood.d.ts +11 -0
- package/dist/features/viz/lib/graph/neighborhood.js +281 -0
- package/dist/features/viz/lib/graph/neighborhood.js.map +7 -0
- package/dist/features/viz/lib/graph/routes.d.ts +35 -0
- package/dist/features/viz/lib/graph/routes.js +101 -0
- package/dist/features/viz/lib/graph/routes.js.map +7 -0
- package/dist/features/viz/lib/graph/sankey.d.ts +44 -0
- package/dist/features/viz/lib/graph/sankey.js +341 -0
- package/dist/features/viz/lib/graph/sankey.js.map +7 -0
- package/dist/features/viz/lib/graph/shared.d.ts +59 -0
- package/dist/features/viz/lib/graph/shared.js +301 -0
- package/dist/features/viz/lib/graph/shared.js.map +7 -0
- package/dist/features/viz/lib/graph/tree.d.ts +11 -0
- package/dist/features/viz/lib/graph/tree.js +232 -0
- package/dist/features/viz/lib/graph/tree.js.map +7 -0
- package/dist/features/viz/lib/graph/treemap.d.ts +20 -0
- package/dist/features/viz/lib/graph/treemap.js +227 -0
- package/dist/features/viz/lib/graph/treemap.js.map +7 -0
- package/dist/features/viz/lib/graph/types.d.ts +1097 -0
- package/dist/features/viz/lib/hover-card.js +8 -9
- package/dist/features/viz/lib/hover-card.js.map +2 -2
- package/dist/features/viz/lib/hover-data.d.ts +1 -1
- package/dist/features/viz/lib/hover-data.js +5 -2
- package/dist/features/viz/lib/hover-data.js.map +2 -2
- package/dist/features/viz/lib/interval-band-series.d.ts +49 -0
- package/dist/features/viz/lib/interval-band-series.js +136 -0
- package/dist/features/viz/lib/interval-band-series.js.map +7 -0
- package/dist/features/viz/lib/interval-diamond-series.d.ts +43 -0
- package/dist/features/viz/lib/interval-diamond-series.js +122 -0
- package/dist/features/viz/lib/interval-diamond-series.js.map +7 -0
- package/dist/features/viz/lib/interval-series.d.ts +79 -0
- package/dist/features/viz/lib/interval-series.js +158 -0
- package/dist/features/viz/lib/interval-series.js.map +7 -0
- package/dist/features/viz/lib/layout-pie.js +9 -13
- package/dist/features/viz/lib/layout-pie.js.map +2 -2
- package/dist/features/viz/lib/line-series.d.ts +1 -1
- package/dist/features/viz/lib/line-series.js +47 -28
- package/dist/features/viz/lib/line-series.js.map +2 -2
- package/dist/features/viz/lib/linear-scale.js +1 -1
- package/dist/features/viz/lib/linear-scale.js.map +2 -2
- package/dist/features/viz/lib/monotone-curve.d.ts +11 -0
- package/dist/features/viz/lib/monotone-curve.js +63 -0
- package/dist/features/viz/lib/monotone-curve.js.map +7 -0
- package/dist/features/viz/lib/numeric-range-interpolation.d.ts +15 -0
- package/dist/features/viz/lib/numeric-range-interpolation.js +36 -0
- package/dist/features/viz/lib/numeric-range-interpolation.js.map +7 -0
- package/dist/features/viz/lib/ohlc-bar-series.d.ts +55 -0
- package/dist/features/viz/lib/ohlc-bar-series.js +168 -0
- package/dist/features/viz/lib/ohlc-bar-series.js.map +7 -0
- package/dist/features/viz/lib/paired-series.d.ts +44 -0
- package/dist/features/viz/lib/paired-series.js +93 -0
- package/dist/features/viz/lib/paired-series.js.map +7 -0
- package/dist/features/viz/lib/pie-layout.js +2 -1
- package/dist/features/viz/lib/pie-layout.js.map +2 -2
- package/dist/features/viz/lib/plot-series.js +11 -6
- package/dist/features/viz/lib/plot-series.js.map +2 -2
- package/dist/features/viz/lib/plot-types.d.ts +4 -3
- package/dist/features/viz/lib/point-series.d.ts +1 -1
- package/dist/features/viz/lib/point-series.js +36 -9
- package/dist/features/viz/lib/point-series.js.map +2 -2
- package/dist/features/viz/lib/point-types.d.ts +5 -2
- package/dist/features/viz/lib/reference-band.js +4 -1
- package/dist/features/viz/lib/reference-band.js.map +2 -2
- package/dist/features/viz/lib/scale-context.d.ts +1 -1
- package/dist/features/viz/lib/scale-ticks.js +21 -6
- package/dist/features/viz/lib/scale-ticks.js.map +2 -2
- package/dist/features/viz/lib/sequential-color-scale.d.ts +11 -0
- package/dist/features/viz/lib/sequential-color-scale.js +49 -0
- package/dist/features/viz/lib/sequential-color-scale.js.map +7 -0
- package/dist/features/viz/lib/series-position.d.ts +12 -0
- package/dist/features/viz/lib/series-position.js +44 -0
- package/dist/features/viz/lib/series-position.js.map +7 -0
- package/dist/features/viz/lib/step-curves.d.ts +19 -0
- package/dist/features/viz/lib/step-curves.js +53 -0
- package/dist/features/viz/lib/step-curves.js.map +7 -0
- package/dist/features/viz/lib/threshold-color-scale.d.ts +43 -0
- package/dist/features/viz/lib/threshold-color-scale.js +59 -0
- package/dist/features/viz/lib/threshold-color-scale.js.map +7 -0
- package/dist/features/viz/lib/trading-time-mapping.d.ts +32 -0
- package/dist/features/viz/lib/trading-time-mapping.js +89 -0
- package/dist/features/viz/lib/trading-time-mapping.js.map +7 -0
- package/dist/features/viz/lib/trading-time-scale.d.ts +83 -0
- package/dist/features/viz/lib/trading-time-scale.js +96 -0
- package/dist/features/viz/lib/trading-time-scale.js.map +7 -0
- package/dist/features/viz/lib/trajectory-series.d.ts +71 -0
- package/dist/features/viz/lib/trajectory-series.js +111 -0
- package/dist/features/viz/lib/trajectory-series.js.map +7 -0
- package/dist/features/viz/lib/types.d.ts +20 -4
- package/dist/features/viz/lib/use-continuous-scale.js +6 -1
- package/dist/features/viz/lib/use-continuous-scale.js.map +2 -2
- package/dist/features/viz/lib/utc-scale.js +11 -10
- package/dist/features/viz/lib/utc-scale.js.map +2 -2
- package/dist/features/viz/lib/volume-series.d.ts +59 -0
- package/dist/features/viz/lib/volume-series.js +117 -0
- package/dist/features/viz/lib/volume-series.js.map +7 -0
- package/dist/features/viz/lib/weighted-point-series.d.ts +71 -0
- package/dist/features/viz/lib/weighted-point-series.js +169 -0
- package/dist/features/viz/lib/weighted-point-series.js.map +7 -0
- package/dist/filters/backdrop-contrast-gpu.d.ts +5 -0
- package/dist/filters/backdrop-contrast-gpu.js +33 -0
- package/dist/filters/backdrop-contrast-gpu.js.map +7 -0
- package/dist/filters/backdrop-contrast.d.ts +21 -0
- package/dist/filters/backdrop-contrast.js +61 -0
- package/dist/filters/backdrop-contrast.js.map +7 -0
- package/dist/filters/displacement.js +1 -1
- package/dist/filters/displacement.js.map +2 -2
- package/dist/filters/emboss-gpu.d.ts +4 -0
- package/dist/filters/emboss-gpu.js +39 -0
- package/dist/filters/emboss-gpu.js.map +7 -0
- package/dist/filters/emboss.d.ts +32 -0
- package/dist/filters/emboss.js +104 -0
- package/dist/filters/emboss.js.map +7 -0
- package/dist/filters/filter-executor.d.ts +11 -4
- package/dist/filters/filter-executor.js +104 -49
- package/dist/filters/filter-executor.js.map +2 -2
- package/dist/filters/reflected-light.js +1 -1
- package/dist/filters/reflected-light.js.map +2 -2
- package/dist/filters/reflection-gpu.d.ts +3 -1
- package/dist/filters/reflection-gpu.js +5 -2
- package/dist/filters/reflection-gpu.js.map +2 -2
- package/dist/filters/render-backdrop-contrast-boundary.d.ts +31 -0
- package/dist/filters/render-backdrop-contrast-boundary.js +116 -0
- package/dist/filters/render-backdrop-contrast-boundary.js.map +7 -0
- package/dist/filters/render-emboss-boundary.d.ts +13 -0
- package/dist/filters/render-emboss-boundary.js +131 -0
- package/dist/filters/render-emboss-boundary.js.map +7 -0
- package/dist/filters.d.ts +9 -5
- package/dist/filters.js +4 -0
- package/dist/filters.js.map +2 -2
- package/dist/index.d.ts +9 -5
- package/dist/index.js +18 -2
- package/dist/index.js.map +2 -2
- package/dist/internal.d.ts +4 -0
- package/dist/internal.js +6 -0
- package/dist/internal.js.map +2 -2
- package/dist/layout-kernel.d.ts +12 -0
- package/dist/layout-kernel.js +11 -0
- package/dist/layout-kernel.js.map +7 -0
- package/dist/layout-kernel.mjs +1 -0
- package/dist/lib/backend/types.d.ts +13 -1
- package/dist/lib/backend/types.js.map +2 -2
- package/dist/lib/components/arc-geometry.js +2 -1
- package/dist/lib/components/arc-geometry.js.map +2 -2
- package/dist/lib/components/g.js +2 -0
- package/dist/lib/components/g.js.map +2 -2
- package/dist/lib/components/html-box.js +2 -1
- package/dist/lib/components/html-box.js.map +2 -2
- package/dist/lib/components/img.js +3 -3
- package/dist/lib/components/img.js.map +2 -2
- package/dist/lib/components/layer.js +98 -16
- package/dist/lib/components/layer.js.map +3 -3
- package/dist/lib/components/text.d.ts +16 -0
- package/dist/lib/components/text.js +131 -24
- package/dist/lib/components/text.js.map +2 -2
- package/dist/lib/define-primitive.d.ts +4 -2
- package/dist/lib/define-primitive.js +3 -1
- package/dist/lib/define-primitive.js.map +2 -2
- package/dist/lib/element/metadata.d.ts +9 -0
- package/dist/lib/element/metadata.js +19 -0
- package/dist/lib/element/metadata.js.map +2 -2
- package/dist/lib/element/resolve-primitive-inputs.d.ts +2 -0
- package/dist/lib/element/resolve-primitive-inputs.js +17 -4
- package/dist/lib/element/resolve-primitive-inputs.js.map +2 -2
- package/dist/lib/events/event-facade.d.ts +18 -0
- package/dist/lib/events/event-facade.js +28 -2
- package/dist/lib/events/event-facade.js.map +2 -2
- package/dist/lib/events/hit-test.js +2 -1
- package/dist/lib/events/hit-test.js.map +2 -2
- package/dist/lib/events/propagation.d.ts +2 -1
- package/dist/lib/events/propagation.js +22 -16
- package/dist/lib/events/propagation.js.map +2 -2
- package/dist/lib/events/registrations.d.ts +10 -0
- package/dist/lib/events/registrations.js +160 -5
- package/dist/lib/events/registrations.js.map +2 -2
- package/dist/lib/execute-render.js +25 -1
- package/dist/lib/execute-render.js.map +2 -2
- package/dist/lib/filter/filter-region.js +3 -10
- package/dist/lib/filter/filter-region.js.map +2 -2
- package/dist/lib/focus/focus-manager.d.ts +8 -1
- package/dist/lib/focus/focus-manager.js +87 -43
- package/dist/lib/focus/focus-manager.js.map +2 -2
- package/dist/lib/focus/geometry.d.ts +2 -0
- package/dist/lib/focus/geometry.js +6 -0
- package/dist/lib/focus/geometry.js.map +2 -2
- package/dist/lib/geometry/path-bend-guide.js +1 -1
- package/dist/lib/geometry/path-bend-guide.js.map +2 -2
- package/dist/lib/geometry/path-geometry.js +12 -11
- package/dist/lib/geometry/path-geometry.js.map +2 -2
- package/dist/lib/geometry/path-transforms.js +17 -21
- package/dist/lib/geometry/path-transforms.js.map +2 -2
- package/dist/lib/geometry/path-warp-bezier.js +3 -1
- package/dist/lib/geometry/path-warp-bezier.js.map +2 -2
- package/dist/lib/geometry/path-warp.js +1 -1
- package/dist/lib/geometry/path-warp.js.map +2 -2
- package/dist/lib/global-state.js +2 -0
- package/dist/lib/global-state.js.map +2 -2
- package/dist/lib/html/html-events.d.ts +32 -0
- package/dist/lib/html/html-events.js +179 -0
- package/dist/lib/html/html-events.js.map +7 -0
- package/dist/lib/html/html-service.d.ts +8 -2
- package/dist/lib/html/html-service.js +198 -65
- package/dist/lib/html/html-service.js.map +2 -2
- package/dist/lib/html/overlay-config.js +7 -6
- package/dist/lib/html/overlay-config.js.map +2 -2
- package/dist/lib/html/types.d.ts +29 -2
- package/dist/lib/layout/absolute.d.ts +11 -5
- package/dist/lib/layout/absolute.js +329 -55
- package/dist/lib/layout/absolute.js.map +3 -3
- package/dist/lib/layout/allocation-checkpoint-owner.d.ts +11 -0
- package/dist/lib/layout/allocation-checkpoint-owner.js +86 -0
- package/dist/lib/layout/allocation-checkpoint-owner.js.map +7 -0
- package/dist/lib/layout/allocation-checkpoint.d.ts +53 -0
- package/dist/lib/layout/allocation-checkpoint.js +463 -0
- package/dist/lib/layout/allocation-checkpoint.js.map +7 -0
- package/dist/lib/layout/allocation-dependencies.d.ts +30 -0
- package/dist/lib/layout/allocation-dependencies.js +90 -0
- package/dist/lib/layout/allocation-dependencies.js.map +7 -0
- package/dist/lib/layout/allocation-revision.d.ts +13 -0
- package/dist/lib/layout/allocation-revision.js +67 -0
- package/dist/lib/layout/allocation-revision.js.map +7 -0
- package/dist/lib/layout/box-insets.d.ts +17 -0
- package/dist/lib/layout/box-insets.js +138 -0
- package/dist/lib/layout/box-insets.js.map +7 -0
- package/dist/lib/layout/box-sizing.d.ts +16 -0
- package/dist/lib/layout/box-sizing.js +77 -0
- package/dist/lib/layout/box-sizing.js.map +7 -0
- package/dist/lib/layout/box.js +42 -12
- package/dist/lib/layout/box.js.map +2 -2
- package/dist/lib/layout/canvas-measurement.d.ts +13 -0
- package/dist/lib/layout/canvas-measurement.js +57 -0
- package/dist/lib/layout/canvas-measurement.js.map +7 -0
- package/dist/lib/layout/context.d.ts +35 -6
- package/dist/lib/layout/context.js +72 -3
- package/dist/lib/layout/context.js.map +2 -2
- package/dist/lib/layout/define-layout-component.d.ts +23 -0
- package/dist/lib/layout/define-layout-component.js +84 -0
- package/dist/lib/layout/define-layout-component.js.map +7 -0
- package/dist/lib/layout/flex-allocation-cache.d.ts +42 -0
- package/dist/lib/layout/flex-baseline-mode.d.ts +2 -0
- package/dist/lib/layout/flex-baseline-mode.js +7 -0
- package/dist/lib/layout/flex-baseline-mode.js.map +7 -0
- package/dist/lib/layout/flex.d.ts +50 -15
- package/dist/lib/layout/flex.js +2124 -195
- package/dist/lib/layout/flex.js.map +3 -3
- package/dist/lib/layout/flow.js +225 -49
- package/dist/lib/layout/flow.js.map +2 -2
- package/dist/lib/layout/geometry-publication.d.ts +53 -0
- package/dist/lib/layout/geometry-publication.js +244 -0
- package/dist/lib/layout/geometry-publication.js.map +7 -0
- package/dist/lib/layout/grid-kernel.d.ts +63 -0
- package/dist/lib/layout/grid-kernel.js +168 -0
- package/dist/lib/layout/grid-kernel.js.map +7 -0
- package/dist/lib/layout/grid.d.ts +63 -4
- package/dist/lib/layout/grid.js +767 -171
- package/dist/lib/layout/grid.js.map +3 -3
- package/dist/lib/layout/measure.d.ts +55 -3
- package/dist/lib/layout/measure.js +448 -15
- package/dist/lib/layout/measure.js.map +2 -2
- package/dist/lib/layout/overlay.js +81 -23
- package/dist/lib/layout/overlay.js.map +2 -2
- package/dist/lib/layout/participation.d.ts +27 -0
- package/dist/lib/layout/participation.js +188 -0
- package/dist/lib/layout/participation.js.map +7 -0
- package/dist/lib/layout/place-child.js +1 -1
- package/dist/lib/layout/place-child.js.map +2 -2
- package/dist/lib/layout/positioning-diagnostics.d.ts +1 -1
- package/dist/lib/layout/positioning-diagnostics.js +13 -2
- package/dist/lib/layout/positioning-diagnostics.js.map +2 -2
- package/dist/lib/layout/prepared-root.d.ts +121 -0
- package/dist/lib/layout/prepared-root.js +360 -0
- package/dist/lib/layout/prepared-root.js.map +7 -0
- package/dist/lib/layout/standalone-kernel.d.ts +60 -0
- package/dist/lib/layout/standalone-kernel.js +722 -0
- package/dist/lib/layout/standalone-kernel.js.map +7 -0
- package/dist/lib/layout/topology.d.ts +21 -0
- package/dist/lib/layout/topology.js +113 -0
- package/dist/lib/layout/topology.js.map +7 -0
- package/dist/lib/layout/types.d.ts +5 -0
- package/dist/lib/layout/wasm/artifact.d.ts +1 -0
- package/dist/lib/layout/wasm/artifact.js +5 -0
- package/dist/lib/layout/wasm/artifact.js.map +7 -0
- package/dist/lib/layout/wasm/bytes.d.ts +1 -0
- package/dist/lib/layout/wasm/bytes.js +5 -0
- package/dist/lib/layout/wasm/bytes.js.map +7 -0
- package/dist/lib/layout/wasm/embedded.d.ts +2 -0
- package/dist/lib/layout/wasm/embedded.js +12 -0
- package/dist/lib/layout/wasm/embedded.js.map +7 -0
- package/dist/lib/layout/wasm/layout.wasm +0 -0
- package/dist/lib/layout/wasm/module.d.ts +8 -0
- package/dist/lib/layout/wasm/module.js +70 -0
- package/dist/lib/layout/wasm/module.js.map +7 -0
- package/dist/lib/layout/wasm/region.d.ts +267 -0
- package/dist/lib/layout/wasm/region.js +1018 -0
- package/dist/lib/layout/wasm/region.js.map +7 -0
- package/dist/lib/manipulation/controller.js +4 -7
- package/dist/lib/manipulation/controller.js.map +2 -2
- package/dist/lib/manipulation/frame.js +1 -1
- package/dist/lib/manipulation/frame.js.map +2 -2
- package/dist/lib/manipulation/handles.js +32 -33
- package/dist/lib/manipulation/handles.js.map +2 -2
- package/dist/lib/manipulation/solve.js +12 -10
- package/dist/lib/manipulation/solve.js.map +2 -2
- package/dist/lib/mount-pibbl.js +1 -0
- package/dist/lib/mount-pibbl.js.map +2 -2
- package/dist/lib/mount-prepared-pibbl.d.ts +5 -0
- package/dist/lib/mount-prepared-pibbl.js +29 -0
- package/dist/lib/mount-prepared-pibbl.js.map +7 -0
- package/dist/lib/mount-request.d.ts +8 -0
- package/dist/lib/mount-request.js +41 -0
- package/dist/lib/mount-request.js.map +7 -0
- package/dist/lib/pibbl.d.ts +21 -13
- package/dist/lib/pibbl.js +18 -16
- package/dist/lib/pibbl.js.map +2 -2
- package/dist/lib/recording/recording.d.ts +43 -0
- package/dist/lib/recording/recording.js +555 -0
- package/dist/lib/recording/recording.js.map +7 -0
- package/dist/lib/recording/types.d.ts +118 -0
- package/dist/lib/recording/wasm-bytes.d.ts +1 -0
- package/dist/lib/recording/wasm-bytes.js +5 -0
- package/dist/lib/recording/wasm-bytes.js.map +7 -0
- package/dist/lib/recording/worker-source.d.ts +1 -0
- package/dist/lib/recording/worker-source.js +5 -0
- package/dist/lib/recording/worker-source.js.map +7 -0
- package/dist/lib/render-layer/controller.d.ts +9 -3
- package/dist/lib/render-layer/controller.js +259 -110
- package/dist/lib/render-layer/controller.js.map +2 -2
- package/dist/lib/render-transaction.d.ts +12 -2
- package/dist/lib/render-transaction.js +69 -1
- package/dist/lib/render-transaction.js.map +2 -2
- package/dist/lib/render.js +32 -8
- package/dist/lib/render.js.map +2 -2
- package/dist/lib/scheduler/realm-scheduler.d.ts +2 -0
- package/dist/lib/scheduler/realm-scheduler.js +55 -26
- package/dist/lib/scheduler/realm-scheduler.js.map +2 -2
- package/dist/lib/scheduler/renderer-participant.js +1 -0
- package/dist/lib/scheduler/renderer-participant.js.map +2 -2
- package/dist/lib/series-inspection-frame.d.ts +18 -0
- package/dist/lib/series-inspection-frame.js +70 -0
- package/dist/lib/series-inspection-frame.js.map +7 -0
- package/dist/lib/signals/edge.d.ts +7 -4
- package/dist/lib/signals/edge.js +25 -3
- package/dist/lib/signals/edge.js.map +2 -2
- package/dist/lib/signals/graph.d.ts +16 -2
- package/dist/lib/signals/graph.js +54 -12
- package/dist/lib/signals/graph.js.map +2 -2
- package/dist/lib/signals/input-provision.d.ts +15 -0
- package/dist/lib/signals/input-provision.js +53 -3
- package/dist/lib/signals/input-provision.js.map +2 -2
- package/dist/lib/signals/render-consumer.d.ts +3 -0
- package/dist/lib/signals/render-consumer.js +22 -14
- package/dist/lib/signals/render-consumer.js.map +2 -2
- package/dist/lib/style/positioning.d.ts +50 -2
- package/dist/lib/style/positioning.js +28 -4
- package/dist/lib/style/positioning.js.map +2 -2
- package/dist/lib/style/resolve-built-in.d.ts +4 -3
- package/dist/lib/style/resolve-built-in.js +17 -3
- package/dist/lib/style/resolve-built-in.js.map +2 -2
- package/dist/lib/style/resolve-dispatch.d.ts +3 -0
- package/dist/lib/style/resolve-dispatch.js +77 -4
- package/dist/lib/style/resolve-dispatch.js.map +2 -2
- package/dist/lib/style/resolve-length.d.ts +2 -0
- package/dist/lib/style/resolve-length.js +13 -9
- package/dist/lib/style/resolve-length.js.map +2 -2
- package/dist/lib/style/sizing-length.d.ts +51 -0
- package/dist/lib/style/sizing-length.js +77 -0
- package/dist/lib/style/sizing-length.js.map +7 -0
- package/dist/lib/style/types.d.ts +63 -25
- package/dist/lib/surface/root-surface.js +10 -6
- package/dist/lib/surface/root-surface.js.map +2 -2
- package/dist/lib/textures/texture.js +10 -8
- package/dist/lib/textures/texture.js.map +2 -2
- package/dist/lib/transitions/capture.js +4 -1
- package/dist/lib/transitions/capture.js.map +2 -2
- package/dist/lib/transitions/embers-physics.js +17 -10
- package/dist/lib/transitions/embers-physics.js.map +2 -2
- package/dist/lib/types.d.ts +110 -1
- package/dist/sync.d.ts +16 -0
- package/dist/sync.js +13 -0
- package/dist/sync.js.map +7 -0
- package/dist/sync.mjs +1 -0
- package/package.json +26 -3
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import type { PibblBackendPrimitiveProgram, PibblBackendToken } from './backend/types.js';
|
|
2
2
|
import type { PibblPrimitiveComponent, PreservedSignalPropKey, PrimitiveCapabilities, PrimitiveInput, PrimitiveProgramProps, PrimitiveRender, SystemStyle } from './types.js';
|
|
3
|
+
import type { SizingLength } from './style/sizing-length.js';
|
|
3
4
|
type DeclaresWhen<S> = S extends unknown ? 'when' extends keyof S ? true : false : never;
|
|
4
5
|
type PrimitiveStyleGuard<S, N, R> = true extends DeclaresWhen<S> | DeclaresWhen<N> | DeclaresWhen<R> ? {
|
|
5
6
|
readonly 'Pibbl: style.when is framework-owned; remove when from the primitive style type': never;
|
|
6
7
|
} : unknown;
|
|
7
|
-
type AllocationValue =
|
|
8
|
+
type AllocationValue = Exclude<SizingLength, number | 'stretch'>;
|
|
9
|
+
type StretchSizingValue<S> = S extends unknown ? S[Extract<keyof S, 'width' | 'height' | 'minWidth' | 'maxWidth' | 'minHeight' | 'maxHeight' | 'flexBasis'>] : never;
|
|
8
10
|
type DeclaredStyleValue<S> = S extends unknown ? S[Exclude<keyof S, 'custom'>] : never;
|
|
9
11
|
type RequiresResolver<S> = [
|
|
10
|
-
Extract<DeclaredStyleValue<S>, AllocationValue>
|
|
12
|
+
Extract<DeclaredStyleValue<S>, AllocationValue> | Extract<StretchSizingValue<S>, 'stretch'>
|
|
11
13
|
] extends [never] ? false : true;
|
|
12
14
|
type PrimitiveCapabilitiesInput<P, S extends SystemStyle, N extends SystemStyle, R extends SystemStyle> = Readonly<PrimitiveCapabilities<P, S, N, R>> & PrimitiveStyleGuard<S, N, R> & ([
|
|
13
15
|
PreservedSignalPropKey<P>
|
|
@@ -35,7 +35,9 @@ Use <${componentName} ... /> in a Pibbl JSX file or createElement(${componentNam
|
|
|
35
35
|
childInput: capabilities.childInput,
|
|
36
36
|
normalizeStyle: capabilities.normalizeStyle,
|
|
37
37
|
resolveStyle: capabilities.resolveStyle,
|
|
38
|
-
measure: capabilities.measure
|
|
38
|
+
measure: capabilities.measure,
|
|
39
|
+
measureIntrinsic: capabilities.measureIntrinsic,
|
|
40
|
+
measureBaselines: capabilities.measureBaselines
|
|
39
41
|
});
|
|
40
42
|
return component;
|
|
41
43
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/lib/define-primitive.ts"],
|
|
4
|
-
"sourcesContent": ["import {\n derivePrimitiveMetadata,\n getPrimitiveDefinition,\n setPrimitiveDefinition,\n} from './element/metadata.js';\nimport {\n CANVAS_2D_BACKEND,\n} from './backend/canvas-2d-backend.js';\nimport type {\n PibblBackendPrimitiveProgram,\n PibblBackendToken,\n} from './backend/types.js';\nimport type {\n PibblPrimitiveComponent,\n PreservedSignalPropKey,\n PrimitiveCapabilities,\n PrimitiveInput,\n PrimitiveProgramProps,\n PrimitiveRender,\n RenderingContext2D,\n SystemStyle,\n} from './types.js';\nimport { GLOBAL_STATE } from './global-state.js';\nimport { withSignalWriteForbidden } from './signals/graph.js';\n\ntype DeclaresWhen<S> = S extends unknown ? 'when' extends keyof S ? true : false : never;\ntype PrimitiveStyleGuard<S, N, R> = true extends DeclaresWhen<S> | DeclaresWhen<N> | DeclaresWhen<R> ? {\n readonly 'Pibbl: style.when is framework-owned; remove when from the primitive style type': never;\n} : unknown;\n\ntype AllocationValue =
|
|
5
|
-
"mappings": "AAAA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,OACK;AAeP,SAAS,oBAAoB;AAC7B,SAAS,gCAAgC;
|
|
4
|
+
"sourcesContent": ["import {\n derivePrimitiveMetadata,\n getPrimitiveDefinition,\n setPrimitiveDefinition,\n} from './element/metadata.js';\nimport {\n CANVAS_2D_BACKEND,\n} from './backend/canvas-2d-backend.js';\nimport type {\n PibblBackendPrimitiveProgram,\n PibblBackendToken,\n} from './backend/types.js';\nimport type {\n PibblPrimitiveComponent,\n PreservedSignalPropKey,\n PrimitiveCapabilities,\n PrimitiveInput,\n PrimitiveProgramProps,\n PrimitiveRender,\n RenderingContext2D,\n SystemStyle,\n} from './types.js';\nimport { GLOBAL_STATE } from './global-state.js';\nimport { withSignalWriteForbidden } from './signals/graph.js';\nimport type { SizingLength } from './style/sizing-length.js';\n\ntype DeclaresWhen<S> = S extends unknown ? 'when' extends keyof S ? true : false : never;\ntype PrimitiveStyleGuard<S, N, R> = true extends DeclaresWhen<S> | DeclaresWhen<N> | DeclaresWhen<R> ? {\n readonly 'Pibbl: style.when is framework-owned; remove when from the primitive style type': never;\n} : unknown;\n\n// Any nonnumeric sizing syntax depends on allocation or an intrinsic owner.\n// A primitive must normalize it before its render program receives the style.\ntype AllocationValue = Exclude<SizingLength, number | 'stretch'>;\ntype StretchSizingValue<S> = S extends unknown ? S[Extract<keyof S, 'width' | 'height' | 'minWidth' | 'maxWidth' | 'minHeight' | 'maxHeight' | 'flexBasis'>] : never;\ntype DeclaredStyleValue<S> = S extends unknown\n ? S[Exclude<keyof S, 'custom'>]\n : never;\ntype RequiresResolver<S> = [\n Extract<DeclaredStyleValue<S>, AllocationValue> | Extract<StretchSizingValue<S>, 'stretch'>,\n] extends [never] ? false : true;\ntype PrimitiveCapabilitiesInput<\n P,\n S extends SystemStyle,\n N extends SystemStyle,\n R extends SystemStyle,\n> = Readonly<PrimitiveCapabilities<P, S, N, R>> & PrimitiveStyleGuard<S, N, R> & (\n [PreservedSignalPropKey<P>] extends [never] ? object : {\n readonly preserveSignalProps: readonly [\n PreservedSignalPropKey<P>,\n ...PreservedSignalPropKey<P>[],\n ];\n }\n);\ntype CapabilityArguments<\n P,\n S extends SystemStyle,\n N extends SystemStyle,\n R extends SystemStyle,\n> = RequiresResolver<R> extends true ? [capabilities: never] :\n RequiresResolver<S> extends true ? [\n capabilities: PrimitiveCapabilitiesInput<P, S, N, R> & {\n resolveStyle: NonNullable<\n PrimitiveCapabilities<P, S, N, R>['resolveStyle']\n >;\n },\n ] : [PreservedSignalPropKey<P>] extends [never] ? [\n capabilities?: PrimitiveCapabilitiesInput<P, S, N, R>,\n ] : [capabilities: PrimitiveCapabilitiesInput<P, S, N, R>];\n\n/**\n * Defines a platform component with private style and measurement behavior.\n *\n * @param render - Synchronous primitive renderer receiving props, resolved style, and Canvas\n * context. See {@link PrimitiveRender} , {@link PrimitiveStyleGuard} , {@link PrimitiveInput} .\n * @param capabilityArguments - Style normalization, resolution, and measurement capabilities\n * required by the primitive. See {@link CapabilityArguments} .\n * @returns A primitive component usable with JSX or createElement. See\n * {@link PibblPrimitiveComponent} , {@link PrimitiveProgramProps} , {@link PrimitiveInput} .\n *\n * @see {@link PrimitiveRender}\n * @see {@link PrimitiveInput}\n * @see {@link PibblPrimitiveComponent}\n * @see {@link PrimitiveProgramProps}\n * @see {@link SystemStyle}\n */\nexport function definePrimitive<\n P = Record<string, never>,\n S extends SystemStyle = SystemStyle,\n N extends SystemStyle = S,\n R extends SystemStyle = N,\n>(\n render: PrimitiveRender<P, R> & PrimitiveStyleGuard<S, N, R> & (\n PrimitiveInput<P, S> extends never ? never : unknown\n ),\n ...capabilityArguments: CapabilityArguments<P, S, N, R>\n): PibblPrimitiveComponent<PrimitiveProgramProps<P>, PrimitiveInput<P, S>> {\n return defineBackendPrimitive<P, S, N, R, RenderingContext2D>(\n CANVAS_2D_BACKEND.token,\n render,\n ...capabilityArguments,\n );\n}\n\n/**\n * Defines a primitive owned by one official Pibbl rendering backend.\n *\n * @param backend - Identity of the backend that can execute this primitive. See\n * {@link PibblBackendToken} .\n * @param program - Synchronous program using the active backend environment. See\n * {@link PibblBackendPrimitiveProgram} , {@link PrimitiveStyleGuard} , {@link PrimitiveInput} .\n * @param capabilityArguments - Style and measurement capabilities for the primitive. See\n * {@link CapabilityArguments} .\n * @returns A primitive component bound to the specified backend. See {@link PibblPrimitiveComponent}\n * , {@link PrimitiveProgramProps} , {@link PrimitiveInput} .\n *\n * @see {@link PibblBackendToken}\n * @see {@link PibblBackendPrimitiveProgram}\n * @see {@link PrimitiveInput}\n * @see {@link PibblPrimitiveComponent}\n * @see {@link PrimitiveProgramProps}\n * @see {@link SystemStyle}\n */\nexport function defineBackendPrimitive<\n P = Record<string, never>,\n S extends SystemStyle = SystemStyle,\n N extends SystemStyle = S,\n R extends SystemStyle = N,\n E = unknown,\n>(\n backend: PibblBackendToken,\n program: PibblBackendPrimitiveProgram<P, R, E> & PrimitiveStyleGuard<S, N, R> & (\n PrimitiveInput<P, S> extends never ? never : unknown\n ),\n ...capabilityArguments: CapabilityArguments<P, S, N, R>\n): PibblPrimitiveComponent<PrimitiveProgramProps<P>, PrimitiveInput<P, S>> {\n const componentName = primitiveComponentName(program.name);\n const component = function PibblPrimitiveComponent(): never {\n throw new Error(\n `${componentName} is a Pibbl component and was invoked outside the Pibbl ` +\n 'renderer.\\n' +\n `Use <${componentName} ... /> in a Pibbl JSX file or ` +\n `createElement(${componentName}, props).`,\n );\n } as unknown as PibblPrimitiveComponent<\n PrimitiveProgramProps<P>,\n PrimitiveInput<P, S>\n >;\n Object.defineProperty(component, 'name', {\n configurable: true,\n value: componentName,\n });\n\n const capabilities = (capabilityArguments[0] ?? {}) as Readonly<\n PrimitiveCapabilities<P, S, N, R>\n >;\n setPrimitiveDefinition(component, {\n backend,\n program,\n preserveSignalProps: capabilities.preserveSignalProps,\n childInput: capabilities.childInput,\n normalizeStyle: capabilities.normalizeStyle,\n resolveStyle: capabilities.resolveStyle,\n measure: capabilities.measure,\n measureIntrinsic: capabilities.measureIntrinsic,\n measureBaselines: capabilities.measureBaselines,\n });\n return component;\n}\n\n/**\n * Derives a new official-package primitive identity with the source behavior.\n *\n * @param source - Primitive whose rendering and capabilities are reused.\n * @returns A derived primitive with its own component identity.\n *\n * @see {@link PibblPrimitiveComponent}\n */\nexport function derivePrimitive<T extends PibblPrimitiveComponent<any, any>>(\n source: T,\n): T {\n if (!getPrimitiveDefinition(source)) {\n throw new TypeError('Can only derive a Pibbl primitive component.');\n }\n const componentName = source.name || 'Anonymous';\n const derived = function PibblPrimitiveComponent(): never {\n throw new Error(\n `${componentName} is a Pibbl component and was invoked outside the Pibbl ` +\n 'renderer.\\n' +\n `Use <${componentName} ... /> in a Pibbl JSX file or ` +\n `createElement(${componentName}, props).`,\n );\n } as unknown as T;\n Object.defineProperty(derived, 'name', {\n configurable: true,\n value: componentName,\n });\n derivePrimitiveMetadata(source, derived);\n return derived;\n}\n\n/**\n * Runs one official-package primitive resolver without render side-effect authority.\n *\n * @param callback - Synchronous resolver to evaluate with hooks and signal writes forbidden.\n * @returns The resolver's return value.\n *\n * @see {@link PrimitiveCapabilities}\n */\nexport function pibblInternalRunPurePrimitiveResolver<T>(callback: () => T): T {\n const previousComponentRefs = GLOBAL_STATE.componentRefs;\n const previousComponentHookIndex = GLOBAL_STATE.componentHookIndex;\n const previousComponentIsMounting = GLOBAL_STATE.componentIsMounting;\n GLOBAL_STATE.componentRefs = undefined;\n GLOBAL_STATE.componentHookIndex = 0;\n GLOBAL_STATE.componentIsMounting = false;\n try {\n return withSignalWriteForbidden('Pibbl pure primitive resolver', callback);\n } finally {\n GLOBAL_STATE.componentRefs = previousComponentRefs;\n GLOBAL_STATE.componentHookIndex = previousComponentHookIndex;\n GLOBAL_STATE.componentIsMounting = previousComponentIsMounting;\n }\n}\n\nfunction primitiveComponentName(renderName: string): string {\n if (/^render[A-Z]/.test(renderName)) return renderName.slice('render'.length);\n return renderName || 'Anonymous';\n}\n"],
|
|
5
|
+
"mappings": "AAAA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP;AAAA,EACE;AAAA,OACK;AAeP,SAAS,oBAAoB;AAC7B,SAAS,gCAAgC;AA+DlC,SAAS,gBAMd,WAGG,qBACsE;AACzE,SAAO;AAAA,IACL,kBAAkB;AAAA,IAClB;AAAA,IACA,GAAG;AAAA,EACL;AACF;AAqBO,SAAS,uBAOd,SACA,YAGG,qBACsE;AACzE,QAAM,gBAAgB,uBAAuB,QAAQ,IAAI;AACzD,QAAM,YAAY,SAAS,0BAAiC;AAC1D,UAAM,IAAI;AAAA,MACR,GAAG,aAAa;AAAA,OAER,aAAa,gDACJ,aAAa;AAAA,IAChC;AAAA,EACF;AAIA,SAAO,eAAe,WAAW,QAAQ;AAAA,IACvC,cAAc;AAAA,IACd,OAAO;AAAA,EACT,CAAC;AAED,QAAM,eAAgB,oBAAoB,CAAC,KAAK,CAAC;AAGjD,yBAAuB,WAAW;AAAA,IAChC;AAAA,IACA;AAAA,IACA,qBAAqB,aAAa;AAAA,IAClC,YAAY,aAAa;AAAA,IACzB,gBAAgB,aAAa;AAAA,IAC7B,cAAc,aAAa;AAAA,IAC3B,SAAS,aAAa;AAAA,IACtB,kBAAkB,aAAa;AAAA,IAC/B,kBAAkB,aAAa;AAAA,EACjC,CAAC;AACD,SAAO;AACT;AAUO,SAAS,gBACd,QACG;AACH,MAAI,CAAC,uBAAuB,MAAM,GAAG;AACnC,UAAM,IAAI,UAAU,8CAA8C;AAAA,EACpE;AACA,QAAM,gBAAgB,OAAO,QAAQ;AACrC,QAAM,UAAU,SAAS,0BAAiC;AACxD,UAAM,IAAI;AAAA,MACR,GAAG,aAAa;AAAA,OAER,aAAa,gDACJ,aAAa;AAAA,IAChC;AAAA,EACF;AACA,SAAO,eAAe,SAAS,QAAQ;AAAA,IACrC,cAAc;AAAA,IACd,OAAO;AAAA,EACT,CAAC;AACD,0BAAwB,QAAQ,OAAO;AACvC,SAAO;AACT;AAUO,SAAS,sCAAyC,UAAsB;AAC7E,QAAM,wBAAwB,aAAa;AAC3C,QAAM,6BAA6B,aAAa;AAChD,QAAM,8BAA8B,aAAa;AACjD,eAAa,gBAAgB;AAC7B,eAAa,qBAAqB;AAClC,eAAa,sBAAsB;AACnC,MAAI;AACF,WAAO,yBAAyB,iCAAiC,QAAQ;AAAA,EAC3E,UAAE;AACA,iBAAa,gBAAgB;AAC7B,iBAAa,qBAAqB;AAClC,iBAAa,sBAAsB;AAAA,EACrC;AACF;AAEA,SAAS,uBAAuB,YAA4B;AAC1D,MAAI,eAAe,KAAK,UAAU,EAAG,QAAO,WAAW,MAAM,SAAS,MAAM;AAC5E,SAAO,cAAc;AACvB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { PibblBackendPrimitiveInput } from "../backend/types.js";
|
|
2
2
|
import type { PibblInternalPrimitiveAttachmentInput } from "../element-enhancers.js";
|
|
3
3
|
import type { getCurrentElementSource } from "../../internal.js";
|
|
4
|
+
import type { LayoutBox } from '../layout/types.js';
|
|
4
5
|
import type { PibblRenderTransaction, SystemStyle } from '../types.js';
|
|
5
6
|
import type { PibblElement } from './types.js';
|
|
6
7
|
import type { PrimitivePresentation } from '../primitive-presentation.js';
|
|
@@ -26,6 +27,11 @@ export interface InternalElementMetadata {
|
|
|
26
27
|
readonly primitiveProgramProps?: Readonly<Record<PropertyKey, unknown>>;
|
|
27
28
|
readonly primitiveReceiverToken?: object;
|
|
28
29
|
readonly policyPreparationSource?: PibblElement<any>;
|
|
30
|
+
readonly layoutDescriptionSource?: PibblElement<any>;
|
|
31
|
+
readonly preparedLayoutSlot?: object;
|
|
32
|
+
readonly layoutContentsChildren?: readonly PibblElement<any>[];
|
|
33
|
+
/** Ancestor padding box expressed in a placed static Flex content coordinate system. */
|
|
34
|
+
readonly absoluteContainingBlock?: Readonly<LayoutBox>;
|
|
29
35
|
identityHint?: unknown;
|
|
30
36
|
placementConsumed?: boolean;
|
|
31
37
|
placementSignalHandoff?: Readonly<SystemStyle>;
|
|
@@ -79,6 +85,9 @@ export declare function getPrimitiveReceiverToken(element: PibblElement<any>): o
|
|
|
79
85
|
export declare function createPrimitiveReceiverToken(): object;
|
|
80
86
|
/** @internal Reuses a direct-child occurrence across layout measurement and paint. */
|
|
81
87
|
export declare function getChildPrimitiveReceiverToken(transaction: PibblRenderTransaction | undefined, parent: object | undefined, occurrence: number): object;
|
|
88
|
+
/** A transaction-independent numeric child path, never a retained receiver token. */
|
|
89
|
+
export declare function primitiveReceiverPath(receiver: object, root: object): readonly number[] | undefined;
|
|
90
|
+
export declare function primitiveReceiverAtPath(transaction: PibblRenderTransaction, root: object, path: readonly number[]): object;
|
|
82
91
|
/** @internal Reads the private identity override for a placed element. */
|
|
83
92
|
export declare function getPlacementIdentityHint<T>(element: PibblElement<any>): T | undefined;
|
|
84
93
|
/** @internal Stores the private identity override for a placed element. */
|
|
@@ -4,6 +4,7 @@ const primitiveDefinitions = /* @__PURE__ */ new WeakMap();
|
|
|
4
4
|
const primitiveDefinitionTypes = /* @__PURE__ */ new WeakMap();
|
|
5
5
|
const primitivePresentationResolvers = /* @__PURE__ */ new WeakMap();
|
|
6
6
|
const policyDefinitions = /* @__PURE__ */ new WeakMap();
|
|
7
|
+
const receiverParents = /* @__PURE__ */ new WeakMap();
|
|
7
8
|
const childPrimitiveReceiverTransactions = /* @__PURE__ */ new WeakMap();
|
|
8
9
|
function setPrimitiveDefinition(type, definition) {
|
|
9
10
|
const erased = definition;
|
|
@@ -94,10 +95,26 @@ function getChildPrimitiveReceiverToken(transaction, parent, occurrence) {
|
|
|
94
95
|
let token = children.get(occurrence);
|
|
95
96
|
if (!token) {
|
|
96
97
|
token = createPrimitiveReceiverToken();
|
|
98
|
+
receiverParents.set(token, { parent, index: occurrence });
|
|
97
99
|
children.set(occurrence, token);
|
|
98
100
|
}
|
|
99
101
|
return token;
|
|
100
102
|
}
|
|
103
|
+
function primitiveReceiverPath(receiver, root) {
|
|
104
|
+
const reverse = [];
|
|
105
|
+
while (receiver !== root) {
|
|
106
|
+
const edge = receiverParents.get(receiver);
|
|
107
|
+
if (!edge) return;
|
|
108
|
+
reverse.push(edge.index);
|
|
109
|
+
receiver = edge.parent;
|
|
110
|
+
}
|
|
111
|
+
return reverse.reverse();
|
|
112
|
+
}
|
|
113
|
+
function primitiveReceiverAtPath(transaction, root, path) {
|
|
114
|
+
let receiver = root;
|
|
115
|
+
for (let index = 0; index < path.length; index++) receiver = getChildPrimitiveReceiverToken(transaction, receiver, path[index]);
|
|
116
|
+
return receiver;
|
|
117
|
+
}
|
|
101
118
|
function getPlacementIdentityHint(element) {
|
|
102
119
|
return elementMetadata.get(element)?.identityHint;
|
|
103
120
|
}
|
|
@@ -145,6 +162,8 @@ export {
|
|
|
145
162
|
getPrimitiveReceiverToken,
|
|
146
163
|
getSpecifiedStyle,
|
|
147
164
|
isPlacementConsumed,
|
|
165
|
+
primitiveReceiverAtPath,
|
|
166
|
+
primitiveReceiverPath,
|
|
148
167
|
registerElementCloneMetadataHandler,
|
|
149
168
|
registerOpaquePrimitiveProps,
|
|
150
169
|
setElementMetadata,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/lib/element/metadata.ts"],
|
|
4
|
-
"sourcesContent": ["import type { PibblBackendPrimitiveInput } from '../backend/types.js';\nimport type { PibblInternalPrimitiveAttachmentInput } from '../element-enhancers.js';\nimport type { getCurrentElementSource } from '../../internal.js';\nimport type {\n PibblRenderTransaction,\n SystemStyle,\n} from '../types.js';\nimport type { PibblElement } from './types.js';\nimport type { PrimitivePresentation } from '../primitive-presentation.js';\nimport type { PibblBackendPrimitiveDefinition } from '../backend/types.js';\n\n/**\n * Authoring source location attached to an element for diagnostics.\n *\n * @see {@link PibblBackendPrimitiveInput}\n * @see {@link PibblInternalPrimitiveAttachmentInput}\n * @see {@link getCurrentElementSource}\n */\nexport interface PibblElementSource {\n /** Source filename recorded for diagnostics. See {@link PibblElementSource}. */\n readonly fileName: string;\n /** Source line recorded for diagnostics. See {@link PibblElementSource}. */\n readonly lineNumber: number;\n /** Source column recorded for diagnostics. See {@link PibblElementSource}. */\n readonly columnNumber: number;\n}\n\nexport interface InternalElementMetadata {\n readonly source?: PibblElementSource;\n readonly specifiedStyle?: Readonly<SystemStyle>;\n readonly primitiveProgramProps?: Readonly<Record<PropertyKey, unknown>>;\n readonly primitiveReceiverToken?: object;\n readonly policyPreparationSource?: PibblElement<any>;\n identityHint?: unknown;\n placementConsumed?: boolean;\n placementSignalHandoff?: Readonly<SystemStyle>;\n}\n\nconst elementMetadata = new WeakMap<PibblElement<any>, InternalElementMetadata>();\nconst elementCloneMetadataHandlers = new Set<(\n source: PibblElement<any>,\n clone: PibblElement<any>,\n) => void>();\nconst primitiveDefinitions = new WeakMap<Function, PrimitiveDefinition>();\nconst primitiveDefinitionTypes = new WeakMap<PrimitiveDefinition, Function>();\nconst primitivePresentationResolvers = new WeakMap<\n Function,\n (style: Readonly<any>) => Readonly<PrimitivePresentation> | undefined\n>();\nconst policyDefinitions = new WeakMap<Function, ElementPolicyDefinition>();\nconst childPrimitiveReceiverTransactions = new WeakMap<\n PibblRenderTransaction,\n WeakMap<object, Map<number, object>>\n>();\n\nexport interface PrimitiveDefinition<\n P = any,\n S extends SystemStyle = SystemStyle,\n N extends SystemStyle = S,\n R extends SystemStyle = N,\n> extends PibblBackendPrimitiveDefinition<P, S, N, R> {}\n\nexport interface ElementPolicyDefinition {\n readonly prepare: (\n policy: PibblElement<any>,\n child: PibblElement<any>,\n ) => PibblElement<any>;\n}\n\n/** @internal Registers the platform behavior for one component value. */\nexport function setPrimitiveDefinition<\n P,\n S extends SystemStyle,\n N extends SystemStyle,\n R extends SystemStyle,\n>(\n type: Function,\n definition: PrimitiveDefinition<P, S, N, R>,\n): void {\n const erased = definition as PrimitiveDefinition;\n primitiveDefinitions.set(type, erased);\n primitiveDefinitionTypes.set(erased, type);\n}\n\n/** @internal Reads platform behavior without attaching fields to a function. */\nexport function getPrimitiveDefinition(\n type: Function,\n): PrimitiveDefinition | undefined {\n return primitiveDefinitions.get(type);\n}\n\n/** @internal Copies one primitive definition and presentation onto a new identity. */\nexport function derivePrimitiveMetadata(source: Function, derived: Function): void {\n const definition = primitiveDefinitions.get(source);\n if (!definition) throw new TypeError('Can only derive a Pibbl primitive component.');\n setPrimitiveDefinition(derived, { ...definition });\n const presentation = primitivePresentationResolvers.get(source);\n if (presentation) primitivePresentationResolvers.set(derived, presentation);\n}\n\n/** @internal Resolves Canvas presentation behavior from erased backend input. */\nexport function getDefinitionPrimitivePresentation<S>(\n definition: PrimitiveDefinition,\n style: Readonly<S>,\n): Readonly<PrimitivePresentation> | undefined {\n const type = primitiveDefinitionTypes.get(definition);\n return type ? getPrimitivePresentation(type, style) : undefined;\n}\n\n/** @internal Registers private presentation behavior for one primitive. */\nexport function setPrimitivePresentation<S>(\n type: Function,\n resolve: (\n style: Readonly<S>,\n ) => Readonly<PrimitivePresentation> | undefined,\n): void {\n primitivePresentationResolvers.set(type, resolve);\n}\n\n/** @internal Resolves private presentation behavior for one primitive. */\nexport function getPrimitivePresentation<S>(\n type: Function,\n style: Readonly<S>,\n): Readonly<PrimitivePresentation> | undefined {\n return primitivePresentationResolvers.get(type)?.(style);\n}\n\n/** @internal Registers an identity-transparent element preparation policy. */\nexport function setElementPolicyDefinition(\n type: Function,\n definition: ElementPolicyDefinition,\n): void {\n policyDefinitions.set(type, definition);\n}\n\n/** @internal Reads a policy before ordinary component identity is assigned. */\nexport function getElementPolicyDefinition(\n type: Function,\n): ElementPolicyDefinition | undefined {\n return policyDefinitions.get(type);\n}\n\n/** @internal */\nexport function setElementMetadata(\n element: PibblElement<any>,\n metadata: InternalElementMetadata,\n): void {\n elementMetadata.set(element, metadata);\n}\n\n/** @internal */\nexport function getElementMetadata(\n element: PibblElement<any>,\n): InternalElementMetadata | undefined {\n return elementMetadata.get(element);\n}\n\n/** @internal Retains the original measurable identity behind policy clones. */\nexport function setPolicyPreparationSource(\n element: PibblElement<any>,\n source: PibblElement<any>,\n): void {\n elementMetadata.set(element, {\n ...elementMetadata.get(element),\n policyPreparationSource: source,\n });\n}\n\n/** @internal Reads the original measurable identity behind policy clones. */\nexport function getPolicyPreparationSource(\n element: PibblElement<any>,\n): PibblElement<any> | undefined {\n return elementMetadata.get(element)?.policyPreparationSource;\n}\n\n/** @internal Registers private WeakMap-backed annotations for immutable clones. */\nexport function registerElementCloneMetadataHandler(\n handler: (source: PibblElement<any>, clone: PibblElement<any>) => void,\n): void {\n elementCloneMetadataHandlers.add(handler);\n}\n\n/** @internal Copies every registered private annotation to a finalized clone. */\nexport function copyElementCloneMetadata(\n source: PibblElement<any>,\n clone: PibblElement<any>,\n): void {\n for (const handler of elementCloneMetadataHandlers) handler(source, clone);\n}\n\n/** @internal */\nexport function getElementSource(\n element: PibblElement<any>,\n): PibblElementSource | undefined {\n return elementMetadata.get(element)?.source;\n}\n\n/** @internal */\nexport function getSpecifiedStyle<S extends SystemStyle>(\n element: PibblElement<{ style?: S }>,\n): Readonly<S> | undefined {\n return element.props.style;\n}\n\n/** @internal Returns program props with primitive-owned style removed. */\nexport function getPrimitiveProgramProps<P>(element: PibblElement<any>): P {\n const prepared = elementMetadata.get(element)?.primitiveProgramProps;\n if (prepared !== undefined) return prepared as P;\n const { style: _style, ...programProps } = element.props as {\n readonly style?: unknown;\n readonly [key: PropertyKey]: unknown;\n };\n return programProps as P;\n}\n\n/** @internal Associates measurement and paint clones for one occurrence. */\nexport function setPrimitiveReceiverToken(\n element: PibblElement<any>,\n token: object,\n): void {\n const current = elementMetadata.get(element) ?? {};\n elementMetadata.set(element, { ...current, primitiveReceiverToken: token });\n}\n\n/** @internal Reads the occurrence token carried by an internal clone. */\nexport function getPrimitiveReceiverToken(\n element: PibblElement<any>,\n): object | undefined {\n return elementMetadata.get(element)?.primitiveReceiverToken;\n}\n\n/** @internal Creates one receiver identity for a standalone measurement. */\nexport function createPrimitiveReceiverToken(): object {\n return {};\n}\n\n/** @internal Reuses a direct-child occurrence across layout measurement and paint. */\nexport function getChildPrimitiveReceiverToken(\n transaction: PibblRenderTransaction | undefined,\n parent: object | undefined,\n occurrence: number,\n): object {\n if (!transaction || !parent) return createPrimitiveReceiverToken();\n let parents = childPrimitiveReceiverTransactions.get(transaction);\n if (!parents) {\n parents = new WeakMap();\n childPrimitiveReceiverTransactions.set(transaction, parents);\n }\n let children = parents.get(parent);\n if (!children) {\n children = new Map();\n parents.set(parent, children);\n }\n let token = children.get(occurrence);\n if (!token) {\n token = createPrimitiveReceiverToken();\n children.set(occurrence, token);\n }\n return token;\n}\n\n/** @internal Reads the private identity override for a placed element. */\nexport function getPlacementIdentityHint<T>(element: PibblElement<any>): T | undefined {\n return elementMetadata.get(element)?.identityHint as T | undefined;\n}\n\n/** @internal Stores the private identity override for a placed element. */\nexport function setPlacementIdentityHint<T>(element: PibblElement<any>, value: T): void {\n const current = elementMetadata.get(element) ?? {};\n elementMetadata.set(element, { ...current, identityHint: value });\n}\n\nconst opaquePrimitiveProps = new WeakMap<Function, readonly string[]>();\n/** @internal Built-in opaque payloads, without widening definePrimitive's API. */\nexport function registerOpaquePrimitiveProps(type: Function, keys: readonly string[]): void {\n opaquePrimitiveProps.set(type, keys);\n}\nexport function getOpaquePrimitiveProps(type: Function): readonly string[] | undefined {\n return opaquePrimitiveProps.get(type);\n}\n\n/** @internal Marks authored left/top as consumed by a parent layout wrapper. */\nexport function setPlacementConsumed(element: PibblElement<any>): void {\n const current = elementMetadata.get(element) ?? {};\n elementMetadata.set(element, { ...current, placementConsumed: true });\n}\n\n/** @internal */\nexport function isPlacementConsumed(element: PibblElement<any>): boolean {\n return elementMetadata.get(element)?.placementConsumed === true;\n}\n\n\n/** @internal Marks an element created with a forwarded placement style signal. */\nexport function setPlacementSignalHandoff(\n element: PibblElement<any>,\n style: Readonly<SystemStyle>,\n): void {\n const current = elementMetadata.get(element) ?? {};\n elementMetadata.set(element, { ...current, placementSignalHandoff: style });\n}\n\n/** @internal */\nexport function getPlacementSignalHandoffStyle(\n element: PibblElement<any>,\n): Readonly<SystemStyle> | undefined {\n return elementMetadata.get(element)?.placementSignalHandoff;\n}\n"],
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["import type { LayoutBox } from '../layout/types.js';\nimport type { PibblBackendPrimitiveInput } from '../backend/types.js';\nimport type { PibblInternalPrimitiveAttachmentInput } from '../element-enhancers.js';\nimport type { getCurrentElementSource } from '../../internal.js';\nimport type {\n PibblRenderTransaction,\n SystemStyle,\n} from '../types.js';\nimport type { PibblElement } from './types.js';\nimport type { PrimitivePresentation } from '../primitive-presentation.js';\nimport type { PibblBackendPrimitiveDefinition } from '../backend/types.js';\n\n/**\n * Authoring source location attached to an element for diagnostics.\n *\n * @see {@link PibblBackendPrimitiveInput}\n * @see {@link PibblInternalPrimitiveAttachmentInput}\n * @see {@link getCurrentElementSource}\n */\nexport interface PibblElementSource {\n /** Source filename recorded for diagnostics. See {@link PibblElementSource}. */\n readonly fileName: string;\n /** Source line recorded for diagnostics. See {@link PibblElementSource}. */\n readonly lineNumber: number;\n /** Source column recorded for diagnostics. See {@link PibblElementSource}. */\n readonly columnNumber: number;\n}\n\nexport interface InternalElementMetadata {\n readonly source?: PibblElementSource;\n readonly specifiedStyle?: Readonly<SystemStyle>;\n readonly primitiveProgramProps?: Readonly<Record<PropertyKey, unknown>>;\n readonly primitiveReceiverToken?: object;\n readonly policyPreparationSource?: PibblElement<any>;\n readonly layoutDescriptionSource?: PibblElement<any>;\n readonly preparedLayoutSlot?: object;\n readonly layoutContentsChildren?: readonly PibblElement<any>[];\n /** Ancestor padding box expressed in a placed static Flex content coordinate system. */\n readonly absoluteContainingBlock?: Readonly<LayoutBox>;\n identityHint?: unknown;\n placementConsumed?: boolean;\n placementSignalHandoff?: Readonly<SystemStyle>;\n}\n\nconst elementMetadata = new WeakMap<PibblElement<any>, InternalElementMetadata>();\nconst elementCloneMetadataHandlers = new Set<(\n source: PibblElement<any>,\n clone: PibblElement<any>,\n) => void>();\nconst primitiveDefinitions = new WeakMap<Function, PrimitiveDefinition>();\nconst primitiveDefinitionTypes = new WeakMap<PrimitiveDefinition, Function>();\nconst primitivePresentationResolvers = new WeakMap<\n Function,\n (style: Readonly<any>) => Readonly<PrimitivePresentation> | undefined\n>();\nconst policyDefinitions = new WeakMap<Function, ElementPolicyDefinition>();\nconst receiverParents = new WeakMap<object, { parent: object; index: number }>();\nconst childPrimitiveReceiverTransactions = new WeakMap<\n PibblRenderTransaction,\n WeakMap<object, Map<number, object>>\n>();\n\nexport interface PrimitiveDefinition<\n P = any,\n S extends SystemStyle = SystemStyle,\n N extends SystemStyle = S,\n R extends SystemStyle = N,\n> extends PibblBackendPrimitiveDefinition<P, S, N, R> {}\n\nexport interface ElementPolicyDefinition {\n readonly prepare: (\n policy: PibblElement<any>,\n child: PibblElement<any>,\n ) => PibblElement<any>;\n}\n\n/** @internal Registers the platform behavior for one component value. */\nexport function setPrimitiveDefinition<\n P,\n S extends SystemStyle,\n N extends SystemStyle,\n R extends SystemStyle,\n>(\n type: Function,\n definition: PrimitiveDefinition<P, S, N, R>,\n): void {\n const erased = definition as PrimitiveDefinition;\n primitiveDefinitions.set(type, erased);\n primitiveDefinitionTypes.set(erased, type);\n}\n\n/** @internal Reads platform behavior without attaching fields to a function. */\nexport function getPrimitiveDefinition(\n type: Function,\n): PrimitiveDefinition | undefined {\n return primitiveDefinitions.get(type);\n}\n\n/** @internal Copies one primitive definition and presentation onto a new identity. */\nexport function derivePrimitiveMetadata(source: Function, derived: Function): void {\n const definition = primitiveDefinitions.get(source);\n if (!definition) throw new TypeError('Can only derive a Pibbl primitive component.');\n setPrimitiveDefinition(derived, { ...definition });\n const presentation = primitivePresentationResolvers.get(source);\n if (presentation) primitivePresentationResolvers.set(derived, presentation);\n}\n\n/** @internal Resolves Canvas presentation behavior from erased backend input. */\nexport function getDefinitionPrimitivePresentation<S>(\n definition: PrimitiveDefinition,\n style: Readonly<S>,\n): Readonly<PrimitivePresentation> | undefined {\n const type = primitiveDefinitionTypes.get(definition);\n return type ? getPrimitivePresentation(type, style) : undefined;\n}\n\n/** @internal Registers private presentation behavior for one primitive. */\nexport function setPrimitivePresentation<S>(\n type: Function,\n resolve: (\n style: Readonly<S>,\n ) => Readonly<PrimitivePresentation> | undefined,\n): void {\n primitivePresentationResolvers.set(type, resolve);\n}\n\n/** @internal Resolves private presentation behavior for one primitive. */\nexport function getPrimitivePresentation<S>(\n type: Function,\n style: Readonly<S>,\n): Readonly<PrimitivePresentation> | undefined {\n return primitivePresentationResolvers.get(type)?.(style);\n}\n\n/** @internal Registers an identity-transparent element preparation policy. */\nexport function setElementPolicyDefinition(\n type: Function,\n definition: ElementPolicyDefinition,\n): void {\n policyDefinitions.set(type, definition);\n}\n\n/** @internal Reads a policy before ordinary component identity is assigned. */\nexport function getElementPolicyDefinition(\n type: Function,\n): ElementPolicyDefinition | undefined {\n return policyDefinitions.get(type);\n}\n\n/** @internal */\nexport function setElementMetadata(\n element: PibblElement<any>,\n metadata: InternalElementMetadata,\n): void {\n elementMetadata.set(element, metadata);\n}\n\n/** @internal */\nexport function getElementMetadata(\n element: PibblElement<any>,\n): InternalElementMetadata | undefined {\n return elementMetadata.get(element);\n}\n\n/** @internal Retains the original measurable identity behind policy clones. */\nexport function setPolicyPreparationSource(\n element: PibblElement<any>,\n source: PibblElement<any>,\n): void {\n elementMetadata.set(element, {\n ...elementMetadata.get(element),\n policyPreparationSource: source,\n });\n}\n\n/** @internal Reads the original measurable identity behind policy clones. */\nexport function getPolicyPreparationSource(\n element: PibblElement<any>,\n): PibblElement<any> | undefined {\n return elementMetadata.get(element)?.policyPreparationSource;\n}\n\n/** @internal Registers private WeakMap-backed annotations for immutable clones. */\nexport function registerElementCloneMetadataHandler(\n handler: (source: PibblElement<any>, clone: PibblElement<any>) => void,\n): void {\n elementCloneMetadataHandlers.add(handler);\n}\n\n/** @internal Copies every registered private annotation to a finalized clone. */\nexport function copyElementCloneMetadata(\n source: PibblElement<any>,\n clone: PibblElement<any>,\n): void {\n for (const handler of elementCloneMetadataHandlers) handler(source, clone);\n}\n\n/** @internal */\nexport function getElementSource(\n element: PibblElement<any>,\n): PibblElementSource | undefined {\n return elementMetadata.get(element)?.source;\n}\n\n/** @internal */\nexport function getSpecifiedStyle<S extends SystemStyle>(\n element: PibblElement<{ style?: S }>,\n): Readonly<S> | undefined {\n return element.props.style;\n}\n\n/** @internal Returns program props with primitive-owned style removed. */\nexport function getPrimitiveProgramProps<P>(element: PibblElement<any>): P {\n const prepared = elementMetadata.get(element)?.primitiveProgramProps;\n if (prepared !== undefined) return prepared as P;\n const { style: _style, ...programProps } = element.props as {\n readonly style?: unknown;\n readonly [key: PropertyKey]: unknown;\n };\n return programProps as P;\n}\n\n/** @internal Associates measurement and paint clones for one occurrence. */\nexport function setPrimitiveReceiverToken(\n element: PibblElement<any>,\n token: object,\n): void {\n const current = elementMetadata.get(element) ?? {};\n elementMetadata.set(element, { ...current, primitiveReceiverToken: token });\n}\n\n/** @internal Reads the occurrence token carried by an internal clone. */\nexport function getPrimitiveReceiverToken(\n element: PibblElement<any>,\n): object | undefined {\n return elementMetadata.get(element)?.primitiveReceiverToken;\n}\n\n/** @internal Creates one receiver identity for a standalone measurement. */\nexport function createPrimitiveReceiverToken(): object {\n return {};\n}\n\n/** @internal Reuses a direct-child occurrence across layout measurement and paint. */\nexport function getChildPrimitiveReceiverToken(\n transaction: PibblRenderTransaction | undefined,\n parent: object | undefined,\n occurrence: number,\n): object {\n if (!transaction || !parent) return createPrimitiveReceiverToken();\n let parents = childPrimitiveReceiverTransactions.get(transaction);\n if (!parents) {\n parents = new WeakMap();\n childPrimitiveReceiverTransactions.set(transaction, parents);\n }\n let children = parents.get(parent);\n if (!children) {\n children = new Map();\n parents.set(parent, children);\n }\n let token = children.get(occurrence);\n if (!token) {\n token = createPrimitiveReceiverToken();\n receiverParents.set(token, { parent, index: occurrence });\n children.set(occurrence, token);\n }\n return token;\n}\n\n/** A transaction-independent numeric child path, never a retained receiver token. */\nexport function primitiveReceiverPath(receiver: object, root: object): readonly number[] | undefined {\n const reverse: number[] = [];\n while (receiver !== root) {\n const edge = receiverParents.get(receiver);\n if (!edge) return;\n reverse.push(edge.index); receiver = edge.parent;\n }\n return reverse.reverse();\n}\nexport function primitiveReceiverAtPath(transaction: PibblRenderTransaction, root: object, path: readonly number[]): object {\n let receiver = root;\n for (let index = 0; index < path.length; index++) receiver = getChildPrimitiveReceiverToken(transaction, receiver, path[index]);\n return receiver;\n}\n\n/** @internal Reads the private identity override for a placed element. */\nexport function getPlacementIdentityHint<T>(element: PibblElement<any>): T | undefined {\n return elementMetadata.get(element)?.identityHint as T | undefined;\n}\n\n/** @internal Stores the private identity override for a placed element. */\nexport function setPlacementIdentityHint<T>(element: PibblElement<any>, value: T): void {\n const current = elementMetadata.get(element) ?? {};\n elementMetadata.set(element, { ...current, identityHint: value });\n}\n\nconst opaquePrimitiveProps = new WeakMap<Function, readonly string[]>();\n/** @internal Built-in opaque payloads, without widening definePrimitive's API. */\nexport function registerOpaquePrimitiveProps(type: Function, keys: readonly string[]): void {\n opaquePrimitiveProps.set(type, keys);\n}\nexport function getOpaquePrimitiveProps(type: Function): readonly string[] | undefined {\n return opaquePrimitiveProps.get(type);\n}\n\n/** @internal Marks authored left/top as consumed by a parent layout wrapper. */\nexport function setPlacementConsumed(element: PibblElement<any>): void {\n const current = elementMetadata.get(element) ?? {};\n elementMetadata.set(element, { ...current, placementConsumed: true });\n}\n\n/** @internal */\nexport function isPlacementConsumed(element: PibblElement<any>): boolean {\n return elementMetadata.get(element)?.placementConsumed === true;\n}\n\n\n/** @internal Marks an element created with a forwarded placement style signal. */\nexport function setPlacementSignalHandoff(\n element: PibblElement<any>,\n style: Readonly<SystemStyle>,\n): void {\n const current = elementMetadata.get(element) ?? {};\n elementMetadata.set(element, { ...current, placementSignalHandoff: style });\n}\n\n/** @internal */\nexport function getPlacementSignalHandoffStyle(\n element: PibblElement<any>,\n): Readonly<SystemStyle> | undefined {\n return elementMetadata.get(element)?.placementSignalHandoff;\n}\n"],
|
|
5
|
+
"mappings": "AA4CA,MAAM,kBAAkB,oBAAI,QAAoD;AAChF,MAAM,+BAA+B,oBAAI,IAG9B;AACX,MAAM,uBAAuB,oBAAI,QAAuC;AACxE,MAAM,2BAA2B,oBAAI,QAAuC;AAC5E,MAAM,iCAAiC,oBAAI,QAGzC;AACF,MAAM,oBAAoB,oBAAI,QAA2C;AACzE,MAAM,kBAAkB,oBAAI,QAAmD;AAC/E,MAAM,qCAAqC,oBAAI,QAG7C;AAiBK,SAAS,uBAMd,MACA,YACM;AACN,QAAM,SAAS;AACf,uBAAqB,IAAI,MAAM,MAAM;AACrC,2BAAyB,IAAI,QAAQ,IAAI;AAC3C;AAGO,SAAS,uBACd,MACiC;AACjC,SAAO,qBAAqB,IAAI,IAAI;AACtC;AAGO,SAAS,wBAAwB,QAAkB,SAAyB;AACjF,QAAM,aAAa,qBAAqB,IAAI,MAAM;AAClD,MAAI,CAAC,WAAY,OAAM,IAAI,UAAU,8CAA8C;AACnF,yBAAuB,SAAS,EAAE,GAAG,WAAW,CAAC;AACjD,QAAM,eAAe,+BAA+B,IAAI,MAAM;AAC9D,MAAI,aAAc,gCAA+B,IAAI,SAAS,YAAY;AAC5E;AAGO,SAAS,mCACd,YACA,OAC6C;AAC7C,QAAM,OAA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UAAU,gBAAgB,IAAI,OAAO,KAAK,CAAC;AACjD,kBAAgB,IAAI,SAAS,EAAE,GAAG,SAAS,cAAc,MAAM,CAAC;AAClE;AAEA,MAAM,uBAAuB,oBAAI,QAAqC;AAE/D,SAAS,6BAA6B,MAAgB,MAA+B;AAC1F,uBAAqB,IAAI,MAAM,IAAI;AACrC;AACO,SAAS,wBAAwB,MAA+C;AACrF,SAAO,qBAAqB,IAAI,IAAI;AACtC;AAGO,SAAS,qBAAqB,SAAkC;AACrE,QAAM,UAAU,gBAAgB,IAAI,OAAO,KAAK,CAAC;AACjD,kBAAgB,IAAI,SAAS,EAAE,GAAG,SAAS,mBAAmB,KAAK,CAAC;AACtE;AAGO,SAAS,oBAAoB,SAAqC;AACvE,SAAO,gBAAgB,IAAI,OAAO,GAAG,sBAAsB;AAC7D;AAIO,SAAS,0BACd,SACA,OACM;AACN,QAAM,UAAU,gBAAgB,IAAI,OAAO,KAAK,CAAC;AACjD,kBAAgB,IAAI,SAAS,EAAE,GAAG,SAAS,wBAAwB,MAAM,CAAC;AAC5E;AAGO,SAAS,+BACd,SACmC;AACnC,SAAO,gBAAgB,IAAI,OAAO,GAAG;AACvC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -10,3 +10,5 @@ export declare function resolvePrimitiveInputs(element: PibblElement<any>, defin
|
|
|
10
10
|
}, basis?: QueryBasis): ResolvedPrimitiveInputs;
|
|
11
11
|
export declare function resolvePrimitiveStyleInput(input: unknown, element: PibblElement<any> | undefined, basis: QueryBasis | undefined, mode: 'value'): Readonly<Record<PropertyKey, unknown>> | undefined;
|
|
12
12
|
export declare function resolvePrimitiveStyleInput(input: unknown, element?: PibblElement<any>, basis?: QueryBasis): Readonly<Record<PropertyKey, unknown>> | ResponsiveStylePreparation | undefined;
|
|
13
|
+
/** @internal Shared receiver input roles for numeric allocation comparisons. */
|
|
14
|
+
export declare function styleInputRole(key: string): 'layout' | 'measurement' | 'paint' | 'interaction' | 'transform' | 'unknown';
|
|
@@ -8,7 +8,8 @@ import {
|
|
|
8
8
|
isSignal,
|
|
9
9
|
recordPlainInputResolution,
|
|
10
10
|
recordShallowInputCopy,
|
|
11
|
-
recordSignalInputResolution
|
|
11
|
+
recordSignalInputResolution,
|
|
12
|
+
withSignalDependencyRole
|
|
12
13
|
} from "../signals/graph.js";
|
|
13
14
|
function resolvePrimitiveInputs(element, definition, prepared, basis) {
|
|
14
15
|
const rawProps = getPrimitiveProgramProps(element);
|
|
@@ -26,7 +27,7 @@ function resolvePrimitiveInputs(element, definition, prepared, basis) {
|
|
|
26
27
|
programProps = { ...rawProps };
|
|
27
28
|
recordShallowInputCopy();
|
|
28
29
|
}
|
|
29
|
-
programProps[key] = value.get();
|
|
30
|
+
programProps[key] = key === "pointerEvents" || key === "keyboardFocusable" || key === "keyboardNavigationBounds" ? withSignalDependencyRole("interaction", () => value.get()) : value.get();
|
|
30
31
|
} else {
|
|
31
32
|
recordPlainInputResolution();
|
|
32
33
|
if (programProps !== void 0) programProps[key] = value;
|
|
@@ -69,15 +70,27 @@ function resolvePrimitiveStyleInput(input, element, basis, mode = "preparation")
|
|
|
69
70
|
resolved = { ...source };
|
|
70
71
|
recordShallowInputCopy();
|
|
71
72
|
}
|
|
72
|
-
resolved[key] =
|
|
73
|
+
resolved[key] = withSignalDependencyRole(
|
|
74
|
+
styleInputRole(key),
|
|
75
|
+
() => value.get()
|
|
76
|
+
);
|
|
73
77
|
} else {
|
|
74
78
|
recordPlainInputResolution();
|
|
75
79
|
}
|
|
76
80
|
}
|
|
77
81
|
return resolved ?? source;
|
|
78
82
|
}
|
|
83
|
+
function styleInputRole(key) {
|
|
84
|
+
if (key === "fill" || key === "stroke" || key === "strokeWidth" || key === "opacity" || key === "filter") return "paint";
|
|
85
|
+
if (key === "translateX" || key === "translateY" || key === "scaleX" || key === "scaleY" || key === "rotationDegrees" || key === "rotationOrigin" || key === "skewX" || key === "skewY") return "transform";
|
|
86
|
+
if (key === "cursor" || key === "pointerEvents" || key === "lineInteractionWidth") return "interaction";
|
|
87
|
+
if (key === "font" || key === "textBaseline" || key === "textAlign" || key === "lineHeight" || key === "wrap" || key === "fit") return "measurement";
|
|
88
|
+
if (key === "layoutParticipation" || key === "gridAutoFlow" || key === "gridAutoColumns" || key === "gridAutoRows" || key === "gridTemplateColumns" || key === "gridTemplateRows" || key === "gridColumnStart" || key === "gridColumnSpan" || key === "gridRowStart" || key === "gridRowSpan" || key === "aspectRatio" || key === "borderWidth" || key === "borderStartWidth" || key === "borderEndWidth" || key === "boxSizing" || key === "width" || key === "height" || key === "minWidth" || key === "minHeight" || key === "maxWidth" || key === "maxHeight" || key === "position" || key === "left" || key === "right" || key === "top" || key === "bottom" || key === "insetStart" || key === "insetEnd" || key === "flexBasis" || key === "flexGrow" || key === "flexShrink" || key === "layoutDirection" || key === "flexDirection" || key === "flexWrap" || key === "justifyContent" || key === "alignItems" || key === "alignSelf" || key === "alignContent" || key === "gap" || key === "rowGap" || key === "columnGap" || key === "padding" || key === "paddingStart" || key === "paddingEnd" || key === "margin" || key === "marginTop" || key === "marginRight" || key === "marginBottom" || key === "marginLeft" || key === "marginStart" || key === "marginEnd") return "layout";
|
|
89
|
+
return "unknown";
|
|
90
|
+
}
|
|
79
91
|
export {
|
|
80
92
|
resolvePrimitiveInputs,
|
|
81
|
-
resolvePrimitiveStyleInput
|
|
93
|
+
resolvePrimitiveStyleInput,
|
|
94
|
+
styleInputRole
|
|
82
95
|
};
|
|
83
96
|
//# sourceMappingURL=resolve-primitive-inputs.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/lib/element/resolve-primitive-inputs.ts"],
|
|
4
|
-
"sourcesContent": ["import { resolveResponsiveStyle, preparedStyleValue, type ResponsiveStylePreparation, type QueryBasis } from '../style/responsive.js';\nimport {\n getPrimitiveProgramProps,\n getOpaquePrimitiveProps,\n getSpecifiedStyle,\n type PrimitiveDefinition,\n} from './metadata.js';\nimport type { PibblElement } from './types.js';\nimport {\n isSignal,\n recordPlainInputResolution,\n recordShallowInputCopy,\n recordSignalInputResolution,\n} from '../signals/graph.js';\n\nexport interface ResolvedPrimitiveInputs {\n readonly props: Readonly<Record<PropertyKey, unknown>>;\n readonly style: Readonly<Record<PropertyKey, unknown>> | undefined;\n}\n\nexport function resolvePrimitiveInputs(\n element: PibblElement<any>,\n definition: PrimitiveDefinition,\n prepared?: { style: Readonly<Record<PropertyKey, unknown>> },\n basis?: QueryBasis,\n): ResolvedPrimitiveInputs {\n const rawProps = getPrimitiveProgramProps(element) as Readonly<\n Record<PropertyKey, unknown>\n >;\n const preserve = definition.preserveSignalProps as\n readonly PropertyKey[] | undefined;\n let programProps: Record<PropertyKey, unknown> | undefined;\n\n for (const key in rawProps) {\n const value = rawProps[key];\n if (key === 'children' || preserve?.includes(key) || getOpaquePrimitiveProps(element.type)?.includes(key)) {\n if (programProps !== undefined) programProps[key] = value;\n continue;\n }\n if (isSignal(value)) {\n recordSignalInputResolution();\n if (programProps === undefined) {\n programProps = { ...rawProps };\n recordShallowInputCopy();\n }\n programProps[key] = value.get();\n } else {\n recordPlainInputResolution();\n if (programProps !== undefined) programProps[key] = value;\n }\n }\n\n return {\n props: programProps ?? rawProps,\n style: prepared ? prepared.style : resolvePrimitiveStyleInput(\n getSpecifiedStyle(element), element, basis, 'value',\n ),\n };\n}\n\nexport function resolvePrimitiveStyleInput(\n input: unknown,\n element: PibblElement<any> | undefined,\n basis: QueryBasis | undefined,\n mode: 'value',\n): Readonly<Record<PropertyKey, unknown>> | undefined;\nexport function resolvePrimitiveStyleInput(\n input: unknown,\n element?: PibblElement<any>,\n basis?: QueryBasis,\n): Readonly<Record<PropertyKey, unknown>> | ResponsiveStylePreparation | undefined;\nexport function resolvePrimitiveStyleInput(\n input: unknown,\n element?: PibblElement<any>,\n basis?: QueryBasis,\n mode: 'value' | 'preparation' = 'preparation',\n): Readonly<Record<PropertyKey, unknown>> | ResponsiveStylePreparation | undefined {\n let style = input;\n if (isSignal(style)) {\n recordSignalInputResolution();\n style = style.get();\n } else if (style !== undefined) {\n recordPlainInputResolution();\n }\n if (style === undefined) return undefined;\n if (style === null || typeof style !== 'object') {\n return style as Readonly<Record<PropertyKey, unknown>>;\n }\n\n const source = style as Readonly<Record<PropertyKey, unknown>>;\n if (source.when !== undefined) {\n const prepared = resolveResponsiveStyle(source, element, basis);\n return mode === 'value' ? preparedStyleValue(prepared) : prepared;\n }\n let resolved: Record<PropertyKey, unknown> | undefined;\n for (const key in source) {\n if (key === 'custom') continue;\n const value = source[key];\n if (isSignal(value)) {\n recordSignalInputResolution();\n if (resolved === undefined) {\n resolved = { ...source };\n recordShallowInputCopy();\n }\n resolved[key] = value.get();\n } else {\n recordPlainInputResolution();\n }\n }\n return resolved ?? source;\n}\n"],
|
|
5
|
-
"mappings": "AAAA,SAAS,wBAAwB,0BAA4E;AAC7G;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AAEP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAOA,SAAS,uBACd,SACA,YACA,UACA,OACyB;AACzB,QAAM,WAAW,yBAAyB,OAAO;AAGjD,QAAM,WAAW,WAAW;AAE5B,MAAI;AAEJ,aAAW,OAAO,UAAU;AAC1B,UAAM,QAAQ,SAAS,GAAG;AAC1B,QAAI,QAAQ,cAAc,UAAU,SAAS,GAAG,KAAK,wBAAwB,QAAQ,IAAI,GAAG,SAAS,GAAG,GAAG;AACzG,UAAI,iBAAiB,OAAW,cAAa,GAAG,IAAI;AACpD;AAAA,IACF;AACA,QAAI,SAAS,KAAK,GAAG;AACnB,kCAA4B;AAC5B,UAAI,iBAAiB,QAAW;AAC9B,uBAAe,EAAE,GAAG,SAAS;AAC7B,+BAAuB;AAAA,MACzB;AACA,mBAAa,GAAG,IAAI,MAAM,IAAI;AAAA,
|
|
4
|
+
"sourcesContent": ["import { resolveResponsiveStyle, preparedStyleValue, type ResponsiveStylePreparation, type QueryBasis } from '../style/responsive.js';\nimport {\n getPrimitiveProgramProps,\n getOpaquePrimitiveProps,\n getSpecifiedStyle,\n type PrimitiveDefinition,\n} from './metadata.js';\nimport type { PibblElement } from './types.js';\nimport {\n isSignal,\n recordPlainInputResolution,\n recordShallowInputCopy,\n recordSignalInputResolution,\n withSignalDependencyRole,\n} from '../signals/graph.js';\n\nexport interface ResolvedPrimitiveInputs {\n readonly props: Readonly<Record<PropertyKey, unknown>>;\n readonly style: Readonly<Record<PropertyKey, unknown>> | undefined;\n}\n\nexport function resolvePrimitiveInputs(\n element: PibblElement<any>,\n definition: PrimitiveDefinition,\n prepared?: { style: Readonly<Record<PropertyKey, unknown>> },\n basis?: QueryBasis,\n): ResolvedPrimitiveInputs {\n const rawProps = getPrimitiveProgramProps(element) as Readonly<\n Record<PropertyKey, unknown>\n >;\n const preserve = definition.preserveSignalProps as\n readonly PropertyKey[] | undefined;\n let programProps: Record<PropertyKey, unknown> | undefined;\n\n for (const key in rawProps) {\n const value = rawProps[key];\n if (key === 'children' || preserve?.includes(key) || getOpaquePrimitiveProps(element.type)?.includes(key)) {\n if (programProps !== undefined) programProps[key] = value;\n continue;\n }\n if (isSignal(value)) {\n recordSignalInputResolution();\n if (programProps === undefined) {\n programProps = { ...rawProps };\n recordShallowInputCopy();\n }\n programProps[key] = key === 'pointerEvents' || key === 'keyboardFocusable' || key === 'keyboardNavigationBounds'\n ? withSignalDependencyRole('interaction', () => value.get()) : value.get();\n } else {\n recordPlainInputResolution();\n if (programProps !== undefined) programProps[key] = value;\n }\n }\n\n return {\n props: programProps ?? rawProps,\n style: prepared ? prepared.style : resolvePrimitiveStyleInput(\n getSpecifiedStyle(element), element, basis, 'value',\n ),\n };\n}\n\nexport function resolvePrimitiveStyleInput(\n input: unknown,\n element: PibblElement<any> | undefined,\n basis: QueryBasis | undefined,\n mode: 'value',\n): Readonly<Record<PropertyKey, unknown>> | undefined;\nexport function resolvePrimitiveStyleInput(\n input: unknown,\n element?: PibblElement<any>,\n basis?: QueryBasis,\n): Readonly<Record<PropertyKey, unknown>> | ResponsiveStylePreparation | undefined;\nexport function resolvePrimitiveStyleInput(\n input: unknown,\n element?: PibblElement<any>,\n basis?: QueryBasis,\n mode: 'value' | 'preparation' = 'preparation',\n): Readonly<Record<PropertyKey, unknown>> | ResponsiveStylePreparation | undefined {\n let style = input;\n if (isSignal(style)) {\n recordSignalInputResolution();\n style = style.get();\n } else if (style !== undefined) {\n recordPlainInputResolution();\n }\n if (style === undefined) return undefined;\n if (style === null || typeof style !== 'object') {\n return style as Readonly<Record<PropertyKey, unknown>>;\n }\n\n const source = style as Readonly<Record<PropertyKey, unknown>>;\n if (source.when !== undefined) {\n const prepared = resolveResponsiveStyle(source, element, basis);\n return mode === 'value' ? preparedStyleValue(prepared) : prepared;\n }\n let resolved: Record<PropertyKey, unknown> | undefined;\n for (const key in source) {\n if (key === 'custom') continue;\n const value = source[key];\n if (isSignal(value)) {\n recordSignalInputResolution();\n if (resolved === undefined) {\n resolved = { ...source };\n recordShallowInputCopy();\n }\n resolved[key] = withSignalDependencyRole(\n styleInputRole(key),\n () => value.get(),\n );\n } else {\n recordPlainInputResolution();\n }\n }\n return resolved ?? source;\n}\n\n/** @internal Shared receiver input roles for numeric allocation comparisons. */\nexport function styleInputRole(\n key: string,\n): 'layout' | 'measurement' | 'paint' | 'interaction' | 'transform' | 'unknown' {\n if (key === 'fill' || key === 'stroke' || key === 'strokeWidth' || key === 'opacity' || key === 'filter') return 'paint';\n if (key === 'translateX' || key === 'translateY' || key === 'scaleX' || key === 'scaleY' || key === 'rotationDegrees' || key === 'rotationOrigin' || key === 'skewX' || key === 'skewY') return 'transform';\n if (key === 'cursor' || key === 'pointerEvents' || key === 'lineInteractionWidth') return 'interaction';\n if (key === 'font' || key === 'textBaseline' || key === 'textAlign' || key === 'lineHeight' || key === 'wrap' || key === 'fit') return 'measurement';\n if (key === 'layoutParticipation' || key === 'gridAutoFlow' || key === 'gridAutoColumns' || key === 'gridAutoRows' || key === 'gridTemplateColumns' || key === 'gridTemplateRows' || key === 'gridColumnStart' || key === 'gridColumnSpan' || key === 'gridRowStart' || key === 'gridRowSpan' || key === 'aspectRatio' || key === 'borderWidth' || key === 'borderStartWidth' || key === 'borderEndWidth' || key === 'boxSizing' || key === 'width' || key === 'height' || key === 'minWidth' || key === 'minHeight' || key === 'maxWidth' || key === 'maxHeight' || key === 'position' || key === 'left' || key === 'right' || key === 'top' || key === 'bottom' || key === 'insetStart' || key === 'insetEnd' || key === 'flexBasis' || key === 'flexGrow' || key === 'flexShrink' || key === 'layoutDirection' || key === 'flexDirection' || key === 'flexWrap' || key === 'justifyContent' || key === 'alignItems' || key === 'alignSelf' || key === 'alignContent' || key === 'gap' || key === 'rowGap' || key === 'columnGap' || key === 'padding' || key === 'paddingStart' || key === 'paddingEnd' || key === 'margin' || key === 'marginTop' || key === 'marginRight' || key === 'marginBottom' || key === 'marginLeft' || key === 'marginStart' || key === 'marginEnd') return 'layout';\n return 'unknown';\n}\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,wBAAwB,0BAA4E;AAC7G;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AAEP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAOA,SAAS,uBACd,SACA,YACA,UACA,OACyB;AACzB,QAAM,WAAW,yBAAyB,OAAO;AAGjD,QAAM,WAAW,WAAW;AAE5B,MAAI;AAEJ,aAAW,OAAO,UAAU;AAC1B,UAAM,QAAQ,SAAS,GAAG;AAC1B,QAAI,QAAQ,cAAc,UAAU,SAAS,GAAG,KAAK,wBAAwB,QAAQ,IAAI,GAAG,SAAS,GAAG,GAAG;AACzG,UAAI,iBAAiB,OAAW,cAAa,GAAG,IAAI;AACpD;AAAA,IACF;AACA,QAAI,SAAS,KAAK,GAAG;AACnB,kCAA4B;AAC5B,UAAI,iBAAiB,QAAW;AAC9B,uBAAe,EAAE,GAAG,SAAS;A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
7
|
}
|
|
@@ -12,7 +12,25 @@ export interface CreatePibblEventInput<K extends PibblEventType> {
|
|
|
12
12
|
readonly x?: number;
|
|
13
13
|
/** Root-logical coordinate supplied by the family adapter. */
|
|
14
14
|
readonly y?: number;
|
|
15
|
+
/** HtmlBox border-local coordinates, fixed across the logical path. */
|
|
16
|
+
readonly localX?: number;
|
|
17
|
+
readonly localY?: number;
|
|
18
|
+
/** Native host paths preserve the original DOM bubbling flag. */
|
|
19
|
+
readonly nativeBubbles?: boolean;
|
|
15
20
|
}
|
|
21
|
+
/** Private opt-in dispatch ownership; ordinary events allocate no resource map.
|
|
22
|
+
* @param event - The currently dispatched logical event.
|
|
23
|
+
* @param key - Identity of this optional integration resource.
|
|
24
|
+
* @param create - Lazy initializer with an exact dispatch-end disposer.
|
|
25
|
+
* @returns Shared resource for this logical dispatch.
|
|
26
|
+
* @see {@link PibblEvent}
|
|
27
|
+
*/
|
|
28
|
+
export declare function borrowDispatchResource<T>(event: PibblEvent, key: object, create: () => {
|
|
29
|
+
value: T;
|
|
30
|
+
dispose: () => void;
|
|
31
|
+
}): T;
|
|
32
|
+
/** Releases optional synchronous resources even when a handler fails. */
|
|
33
|
+
export declare function finishEventDispatch(event: PibblEvent): void;
|
|
16
34
|
export declare function createPibblEvent<K extends PibblEventType>(input: CreatePibblEventInput<K>): PibblEventMap[K];
|
|
17
35
|
export declare function setPibblEventInvocation(event: PibblEvent, currentTarget: PibblEventTarget, eventPhase: PibblEventPhase): void;
|
|
18
36
|
export declare function isPibblPropagationStopped(event: PibblEvent): boolean;
|
|
@@ -2,6 +2,27 @@ import {
|
|
|
2
2
|
getPibblEventDefinition
|
|
3
3
|
} from "./event-definitions.js";
|
|
4
4
|
const states = /* @__PURE__ */ new WeakMap();
|
|
5
|
+
function borrowDispatchResource(event, key, create) {
|
|
6
|
+
const state = requiredState(event);
|
|
7
|
+
if (state.dispatchFinished) throw new Error("Inspection dispatch has expired.");
|
|
8
|
+
const resources = state.resources ??= /* @__PURE__ */ new Map();
|
|
9
|
+
let resource = resources.get(key);
|
|
10
|
+
if (!resource) {
|
|
11
|
+
resource = create();
|
|
12
|
+
resources.set(key, resource);
|
|
13
|
+
}
|
|
14
|
+
return resource.value;
|
|
15
|
+
}
|
|
16
|
+
function finishEventDispatch(event) {
|
|
17
|
+
const state = requiredState(event);
|
|
18
|
+
state.dispatchFinished = true;
|
|
19
|
+
const resources = state.resources;
|
|
20
|
+
if (resources) {
|
|
21
|
+
for (const resource of resources.values()) resource.dispose();
|
|
22
|
+
resources.clear();
|
|
23
|
+
state.resources = void 0;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
5
26
|
function createPibblEvent(input) {
|
|
6
27
|
const definition = requiredDefinition(input.type);
|
|
7
28
|
const originalEvent = input.originalEvent;
|
|
@@ -20,7 +41,7 @@ function createPibblEvent(input) {
|
|
|
20
41
|
type: input.type,
|
|
21
42
|
target: input.target.publicTarget,
|
|
22
43
|
relatedTarget: input.relatedTarget?.publicTarget ?? null,
|
|
23
|
-
bubbles: definition.bubbles,
|
|
44
|
+
bubbles: input.nativeBubbles ?? definition.bubbles,
|
|
24
45
|
cancelable,
|
|
25
46
|
timeStamp: originalEvent.timeStamp,
|
|
26
47
|
originalEvent,
|
|
@@ -32,7 +53,7 @@ function createPibblEvent(input) {
|
|
|
32
53
|
return state.eventPhase;
|
|
33
54
|
},
|
|
34
55
|
get defaultPrevented() {
|
|
35
|
-
return state.defaultPrevented;
|
|
56
|
+
return state.defaultPrevented || originalEvent.defaultPrevented;
|
|
36
57
|
},
|
|
37
58
|
composedPath() {
|
|
38
59
|
return publicPath;
|
|
@@ -81,6 +102,9 @@ function projectFamilyFields(facade, definition, input) {
|
|
|
81
102
|
const original = input.originalEvent;
|
|
82
103
|
if (definition.coordinate) {
|
|
83
104
|
Object.assign(facade, { x: input.x ?? 0, y: input.y ?? 0 });
|
|
105
|
+
if (input.localX !== void 0 && input.localY !== void 0) {
|
|
106
|
+
Object.assign(facade, { localX: input.localX, localY: input.localY });
|
|
107
|
+
}
|
|
84
108
|
}
|
|
85
109
|
switch (definition.family) {
|
|
86
110
|
case "pointer":
|
|
@@ -180,7 +204,9 @@ function pick(value, keys) {
|
|
|
180
204
|
return result;
|
|
181
205
|
}
|
|
182
206
|
export {
|
|
207
|
+
borrowDispatchResource,
|
|
183
208
|
createPibblEvent,
|
|
209
|
+
finishEventDispatch,
|
|
184
210
|
isPibblImmediatePropagationStopped,
|
|
185
211
|
isPibblPropagationStopped,
|
|
186
212
|
setPibblEventInvocation
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/lib/events/event-facade.ts"],
|
|
4
|
-
"sourcesContent": ["import {\n getPibblEventDefinition,\n type PibblEventDefinition,\n} from './event-definitions.js';\nimport type { PibblEventNode } from './registrations.js';\nimport type {\n PibblEvent,\n PibblEventMap,\n PibblEventPhase,\n PibblEventTarget,\n PibblEventType,\n} from './types.js';\n\nexport type PibblOriginalEvent<K extends PibblEventType> =\n PibblEventMap[K] extends PibblEvent<infer TOriginal> ? TOriginal : Event;\n\nexport interface CreatePibblEventInput<K extends PibblEventType> {\n readonly type: K;\n readonly target: PibblEventNode;\n readonly path: readonly PibblEventNode[];\n readonly relatedTarget?: PibblEventNode | null;\n readonly originalEvent: PibblOriginalEvent<K>;\n readonly sourceEvent?: Event;\n /** Root-logical coordinate supplied by the family adapter. */\n readonly x?: number;\n /** Root-logical coordinate supplied by the family adapter. */\n readonly y?: number;\n}\n\ninterface PibblEventFacadeState {\n currentTarget: PibblEventTarget;\n eventPhase: PibblEventPhase;\n defaultPrevented: boolean;\n propagationStopped: boolean;\n immediatePropagationStopped: boolean;\n}\n\nconst states = new WeakMap<object, PibblEventFacadeState>();\n\nexport function createPibblEvent<K extends PibblEventType>(\n input: CreatePibblEventInput<K>,\n): PibblEventMap[K] {\n const definition = requiredDefinition(input.type);\n const originalEvent = input.originalEvent;\n const cancelable = definition.cancelable && originalEvent.cancelable;\n const publicPath = Object.freeze(\n input.path.map(node => node.publicTarget),\n );\n const state: PibblEventFacadeState = {\n currentTarget: input.target.publicTarget,\n eventPhase: 2,\n defaultPrevented: cancelable && originalEvent.defaultPrevented,\n propagationStopped: false,\n immediatePropagationStopped: false,\n };\n const facade = {\n type: input.type,\n target: input.target.publicTarget,\n relatedTarget: input.relatedTarget?.publicTarget ?? null,\n bubbles: definition.bubbles,\n cancelable,\n timeStamp: originalEvent.timeStamp,\n originalEvent,\n sourceEvent: input.sourceEvent,\n get currentTarget() {\n return state.currentTarget;\n },\n get eventPhase() {\n return state.eventPhase;\n },\n get defaultPrevented() {\n return state.defaultPrevented;\n },\n composedPath() {\n return publicPath;\n },\n preventDefault() {\n if (!cancelable) return;\n state.defaultPrevented = true;\n originalEvent.preventDefault();\n },\n stopPropagation() {\n state.propagationStopped = true;\n originalEvent.stopPropagation();\n },\n stopImmediatePropagation() {\n state.propagationStopped = true;\n state.immediatePropagationStopped = true;\n originalEvent.stopImmediatePropagation();\n },\n } as PibblEvent & Record<string, unknown>;\n states.set(facade, state);\n projectFamilyFields(facade, definition, input);\n return facade as unknown as PibblEventMap[K];\n}\n\nexport function setPibblEventInvocation(\n event: PibblEvent,\n currentTarget: PibblEventTarget,\n eventPhase: PibblEventPhase,\n): void {\n const state = requiredState(event);\n state.currentTarget = currentTarget;\n state.eventPhase = eventPhase;\n}\n\nexport function isPibblPropagationStopped(event: PibblEvent): boolean {\n return requiredState(event).propagationStopped;\n}\n\nexport function isPibblImmediatePropagationStopped(event: PibblEvent): boolean {\n return requiredState(event).immediatePropagationStopped;\n}\n\nfunction requiredState(event: PibblEvent): PibblEventFacadeState {\n const state = states.get(event);\n if (!state) throw new Error('Pibbl event facade state is unavailable.');\n return state;\n}\n\nfunction requiredDefinition(type: PibblEventType): PibblEventDefinition {\n const definition = getPibblEventDefinition(type);\n if (!definition) throw new Error(`Unsupported Pibbl event type: ${type}`);\n return definition;\n}\n\nfunction projectFamilyFields<K extends PibblEventType>(\n facade: PibblEvent & Record<string, unknown>,\n definition: PibblEventDefinition,\n input: CreatePibblEventInput<K>,\n): void {\n const original: unknown = input.originalEvent;\n if (definition.coordinate) {\n Object.assign(facade, { x: input.x ?? 0, y: input.y ?? 0 });\n }\n\n switch (definition.family) {\n case 'pointer':\n projectMouseFields(facade, original as PointerEvent);\n Object.assign(facade, pick(original as PointerEvent, [\n 'pointerId',\n 'width',\n 'height',\n 'pressure',\n 'tangentialPressure',\n 'tiltX',\n 'tiltY',\n 'twist',\n 'pointerType',\n 'isPrimary',\n ]));\n break;\n case 'mouse':\n projectMouseFields(facade, original as MouseEvent);\n break;\n case 'touch':\n projectModifierFields(facade, original as TouchEvent);\n Object.assign(facade, pick(original as TouchEvent, [\n 'touches',\n 'targetTouches',\n 'changedTouches',\n ]));\n break;\n case 'wheel':\n projectMouseFields(facade, original as WheelEvent);\n Object.assign(facade, pick(original as WheelEvent, [\n 'deltaX',\n 'deltaY',\n 'deltaZ',\n 'deltaMode',\n ]));\n break;\n case 'keyboard':\n projectModifierFields(facade, original as KeyboardEvent);\n Object.assign(facade, pick(original as KeyboardEvent, [\n 'key',\n 'code',\n 'location',\n 'repeat',\n 'isComposing',\n ]));\n break;\n case 'input':\n if (definition.type === 'beforeinput' || definition.type === 'input') {\n Object.assign(facade, pick(original as InputEvent, [\n 'data',\n 'dataTransfer',\n 'inputType',\n 'isComposing',\n ]));\n }\n break;\n case 'composition':\n Object.assign(facade, pick(original as CompositionEvent, ['data']));\n break;\n case 'clipboard':\n Object.assign(facade, pick(original as ClipboardEvent, ['clipboardData']));\n break;\n case 'drag':\n projectMouseFields(facade, original as DragEvent);\n Object.assign(facade, pick(original as DragEvent, ['dataTransfer']));\n break;\n case 'focus':\n break;\n }\n}\n\nfunction projectMouseFields(\n facade: PibblEvent & Record<string, unknown>,\n original: MouseEvent,\n): void {\n projectModifierFields(facade, original);\n Object.assign(facade, pick(original, [\n 'clientX',\n 'clientY',\n 'screenX',\n 'screenY',\n 'movementX',\n 'movementY',\n 'button',\n 'buttons',\n 'detail',\n ]));\n}\n\nfunction projectModifierFields(\n facade: PibblEvent & Record<string, unknown>,\n original: MouseEvent | TouchEvent | KeyboardEvent,\n): void {\n Object.assign(facade, pick(original, [\n 'altKey',\n 'ctrlKey',\n 'metaKey',\n 'shiftKey',\n ]));\n}\n\nfunction pick<T extends object, K extends keyof T>(\n value: T,\n keys: readonly K[],\n): Pick<T, K> {\n const result = {} as Pick<T, K>;\n for (const key of keys) result[key] = value[key];\n return result;\n}\n"],
|
|
5
|
-
"mappings": "AAAA;AAAA,EACE;AAAA,OAEK;
|
|
4
|
+
"sourcesContent": ["import {\n getPibblEventDefinition,\n type PibblEventDefinition,\n} from './event-definitions.js';\nimport type { PibblEventNode } from './registrations.js';\nimport type {\n PibblEvent,\n PibblEventMap,\n PibblEventPhase,\n PibblEventTarget,\n PibblEventType,\n} from './types.js';\n\nexport type PibblOriginalEvent<K extends PibblEventType> =\n PibblEventMap[K] extends PibblEvent<infer TOriginal> ? TOriginal : Event;\n\nexport interface CreatePibblEventInput<K extends PibblEventType> {\n readonly type: K;\n readonly target: PibblEventNode;\n readonly path: readonly PibblEventNode[];\n readonly relatedTarget?: PibblEventNode | null;\n readonly originalEvent: PibblOriginalEvent<K>;\n readonly sourceEvent?: Event;\n /** Root-logical coordinate supplied by the family adapter. */\n readonly x?: number;\n /** Root-logical coordinate supplied by the family adapter. */\n readonly y?: number;\n /** HtmlBox border-local coordinates, fixed across the logical path. */\n readonly localX?: number;\n readonly localY?: number;\n /** Native host paths preserve the original DOM bubbling flag. */\n readonly nativeBubbles?: boolean;\n}\n\ninterface PibblEventFacadeState {\n dispatchFinished?: boolean;\n resources?: Map<object, { value: unknown; dispose: () => void }>;\n currentTarget: PibblEventTarget;\n eventPhase: PibblEventPhase;\n defaultPrevented: boolean;\n propagationStopped: boolean;\n immediatePropagationStopped: boolean;\n}\n\nconst states = new WeakMap<object, PibblEventFacadeState>();\n\n/** Private opt-in dispatch ownership; ordinary events allocate no resource map.\n * @param event - The currently dispatched logical event.\n * @param key - Identity of this optional integration resource.\n * @param create - Lazy initializer with an exact dispatch-end disposer.\n * @returns Shared resource for this logical dispatch.\n * @see {@link PibblEvent}\n */\nexport function borrowDispatchResource<T>(event: PibblEvent, key: object, create: () => {value:T;dispose:()=>void}): T {\n const state = requiredState(event);\n if (state.dispatchFinished) throw new Error('Inspection dispatch has expired.');\n const resources = state.resources ??= new Map();\n let resource = resources.get(key);\n if (!resource) { resource = create(); resources.set(key,resource); }\n return resource.value as T;\n}\n\n/** Releases optional synchronous resources even when a handler fails. */\nexport function finishEventDispatch(event: PibblEvent): void {\n const state = requiredState(event);\n state.dispatchFinished = true;\n const resources = state.resources;\n if (resources) {\n for (const resource of resources.values()) resource.dispose();\n resources.clear();\n state.resources = undefined;\n }\n}\n\nexport function createPibblEvent<K extends PibblEventType>(\n input: CreatePibblEventInput<K>,\n): PibblEventMap[K] {\n const definition = requiredDefinition(input.type);\n const originalEvent = input.originalEvent;\n const cancelable = definition.cancelable && originalEvent.cancelable;\n const publicPath = Object.freeze(\n input.path.map(node => node.publicTarget),\n );\n const state: PibblEventFacadeState = {\n currentTarget: input.target.publicTarget,\n eventPhase: 2,\n defaultPrevented: cancelable && originalEvent.defaultPrevented,\n propagationStopped: false,\n immediatePropagationStopped: false,\n };\n const facade = {\n type: input.type,\n target: input.target.publicTarget,\n relatedTarget: input.relatedTarget?.publicTarget ?? null,\n bubbles: input.nativeBubbles ?? definition.bubbles,\n cancelable,\n timeStamp: originalEvent.timeStamp,\n originalEvent,\n sourceEvent: input.sourceEvent,\n get currentTarget() {\n return state.currentTarget;\n },\n get eventPhase() {\n return state.eventPhase;\n },\n get defaultPrevented() {\n return state.defaultPrevented || originalEvent.defaultPrevented;\n },\n composedPath() {\n return publicPath;\n },\n preventDefault() {\n if (!cancelable) return;\n state.defaultPrevented = true;\n originalEvent.preventDefault();\n },\n stopPropagation() {\n state.propagationStopped = true;\n originalEvent.stopPropagation();\n },\n stopImmediatePropagation() {\n state.propagationStopped = true;\n state.immediatePropagationStopped = true;\n originalEvent.stopImmediatePropagation();\n },\n } as PibblEvent & Record<string, unknown>;\n states.set(facade, state);\n projectFamilyFields(facade, definition, input);\n return facade as unknown as PibblEventMap[K];\n}\n\nexport function setPibblEventInvocation(\n event: PibblEvent,\n currentTarget: PibblEventTarget,\n eventPhase: PibblEventPhase,\n): void {\n const state = requiredState(event);\n state.currentTarget = currentTarget;\n state.eventPhase = eventPhase;\n}\n\nexport function isPibblPropagationStopped(event: PibblEvent): boolean {\n return requiredState(event).propagationStopped;\n}\n\nexport function isPibblImmediatePropagationStopped(event: PibblEvent): boolean {\n return requiredState(event).immediatePropagationStopped;\n}\n\nfunction requiredState(event: PibblEvent): PibblEventFacadeState {\n const state = states.get(event);\n if (!state) throw new Error('Pibbl event facade state is unavailable.');\n return state;\n}\n\nfunction requiredDefinition(type: PibblEventType): PibblEventDefinition {\n const definition = getPibblEventDefinition(type);\n if (!definition) throw new Error(`Unsupported Pibbl event type: ${type}`);\n return definition;\n}\n\nfunction projectFamilyFields<K extends PibblEventType>(\n facade: PibblEvent & Record<string, unknown>,\n definition: PibblEventDefinition,\n input: CreatePibblEventInput<K>,\n): void {\n const original: unknown = input.originalEvent;\n if (definition.coordinate) {\n Object.assign(facade, { x: input.x ?? 0, y: input.y ?? 0 });\n if (input.localX !== undefined && input.localY !== undefined) {\n Object.assign(facade, { localX: input.localX, localY: input.localY });\n }\n }\n\n switch (definition.family) {\n case 'pointer':\n projectMouseFields(facade, original as PointerEvent);\n Object.assign(facade, pick(original as PointerEvent, [\n 'pointerId',\n 'width',\n 'height',\n 'pressure',\n 'tangentialPressure',\n 'tiltX',\n 'tiltY',\n 'twist',\n 'pointerType',\n 'isPrimary',\n ]));\n break;\n case 'mouse':\n projectMouseFields(facade, original as MouseEvent);\n break;\n case 'touch':\n projectModifierFields(facade, original as TouchEvent);\n Object.assign(facade, pick(original as TouchEvent, [\n 'touches',\n 'targetTouches',\n 'changedTouches',\n ]));\n break;\n case 'wheel':\n projectMouseFields(facade, original as WheelEvent);\n Object.assign(facade, pick(original as WheelEvent, [\n 'deltaX',\n 'deltaY',\n 'deltaZ',\n 'deltaMode',\n ]));\n break;\n case 'keyboard':\n projectModifierFields(facade, original as KeyboardEvent);\n Object.assign(facade, pick(original as KeyboardEvent, [\n 'key',\n 'code',\n 'location',\n 'repeat',\n 'isComposing',\n ]));\n break;\n case 'input':\n if (definition.type === 'beforeinput' || definition.type === 'input') {\n Object.assign(facade, pick(original as InputEvent, [\n 'data',\n 'dataTransfer',\n 'inputType',\n 'isComposing',\n ]));\n }\n break;\n case 'composition':\n Object.assign(facade, pick(original as CompositionEvent, ['data']));\n break;\n case 'clipboard':\n Object.assign(facade, pick(original as ClipboardEvent, ['clipboardData']));\n break;\n case 'drag':\n projectMouseFields(facade, original as DragEvent);\n Object.assign(facade, pick(original as DragEvent, ['dataTransfer']));\n break;\n case 'focus':\n break;\n }\n}\n\nfunction projectMouseFields(\n facade: PibblEvent & Record<string, unknown>,\n original: MouseEvent,\n): void {\n projectModifierFields(facade, original);\n Object.assign(facade, pick(original, [\n 'clientX',\n 'clientY',\n 'screenX',\n 'screenY',\n 'movementX',\n 'movementY',\n 'button',\n 'buttons',\n 'detail',\n ]));\n}\n\nfunction projectModifierFields(\n facade: PibblEvent & Record<string, unknown>,\n original: MouseEvent | TouchEvent | KeyboardEvent,\n): void {\n Object.assign(facade, pick(original, [\n 'altKey',\n 'ctrlKey',\n 'metaKey',\n 'shiftKey',\n ]));\n}\n\nfunction pick<T extends object, K extends keyof T>(\n value: T,\n keys: readonly K[],\n): Pick<T, K> {\n const result = {} as Pick<T, K>;\n for (const key of keys) result[key] = value[key];\n return result;\n}\n"],
|
|
5
|
+
"mappings": "AAAA;AAAA,EACE;AAAA,OAEK;AAyCP,MAAM,SAAS,oBAAI,QAAuC;AASnD,SAAS,uBAA0B,OAAmB,KAAa,QAA6C;AACrH,QAAM,QAAQ,cAAc,KAAK;A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IACF,KAAK;AACH;AAAA,EACJ;AACF;AAEA,SAAS,mBACP,QACA,UACM;AACN,wBAAsB,QAAQ,QAAQ;AACtC,SAAO,OAAO,QAAQ,KAAK,UAAU;AAAA,IACnC;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC,CAAC;AACJ;AAEA,SAAS,sBACP,QACA,UACM;AACN,SAAO,OAAO,QAAQ,KAAK,UAAU;AAAA,IACnC;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC,CAAC;AACJ;AAEA,SAAS,KACP,OACA,MACY;AACZ,QAAM,SAAS,CAAC;AAChB,aAAW,OAAO,KAAM,QAAO,GAAG,IAAI,MAAM,GAAG;AAC/C,SAAO;AACT;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { committedLayoutPaintEntries } from "../layout/geometry-publication.js";
|
|
1
2
|
import { isHit } from "../util/is-hit.js";
|
|
2
3
|
import {
|
|
3
4
|
PibblHitDisposition,
|
|
@@ -37,7 +38,7 @@ function resolveCoordinateOutput(eventRoot, point) {
|
|
|
37
38
|
return output;
|
|
38
39
|
}
|
|
39
40
|
function resolveInstanceHit(eventRoot, instance, canvas, rootX, rootY, transform, output) {
|
|
40
|
-
const entries = Array.from(instance.paintEntries);
|
|
41
|
+
const entries = committedLayoutPaintEntries(instance) ?? Array.from(instance.paintEntries);
|
|
41
42
|
for (let index = entries.length - 1; index >= 0; index--) {
|
|
42
43
|
const entry = entries[index];
|
|
43
44
|
reset(output);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/lib/events/hit-test.ts"],
|
|
4
|
-
"sourcesContent": ["import type { PibblClippingStackEntry, PibblEventRoot, PibblInstance } from '../types.js';\nimport { isHit } from '../util/is-hit.js';\nimport {\n PibblHitDisposition,\n PibblPaintEntryKind,\n hitTestScratchFactory,\n type PibblHitTestInput,\n type PibblHitTestOutput,\n type PibblPathPaintEntry,\n} from './paint-entry.js';\nimport type { PibblEventTargetRegistration } from './registrations.js';\n\nexport interface PibblCoordinatePoint {\n readonly x: number;\n readonly y: number;\n}\n\n/** Resolves one paint entry in reverse global paint order without allocating. */\nexport function resolveCoordinateHit(\n eventRoot: PibblEventRoot,\n input: PibblHitTestInput,\n output: PibblHitTestOutput,\n): PibblHitTestOutput {\n const instance = eventRoot.rootInstance;\n const canvas = eventRoot.canvas;\n reset(output);\n if (!instance || !canvas || !instance.surface.snapshot) return output;\n return resolveInstanceHit(\n eventRoot,\n instance,\n canvas,\n input.rootX,\n input.rootY,\n new DOMMatrix(),\n output,\n );\n}\n\n/** Compatibility wrapper for coordinate event dispatch. */\nexport function resolveCoordinateTarget(\n eventRoot: PibblEventRoot,\n point: PibblCoordinatePoint,\n): PibblEventTargetRegistration | undefined {\n const output = resolveCoordinateOutput(eventRoot, point);\n return output.disposition === PibblHitDisposition.Target ?\n output.target ?? undefined :\n undefined;\n}\n\n/** Borrows the root scratch result for immediate coordinate dispatch. */\nexport function resolveCoordinateOutput(\n eventRoot: PibblEventRoot,\n point: PibblCoordinatePoint,\n): PibblHitTestOutput {\n let input = eventRoot.coordinateHitInput;\n let output = eventRoot.coordinateHitOutput;\n if (!input || !output) {\n const scratch = hitTestScratchFactory.create();\n input = eventRoot.coordinateHitInput = scratch.input;\n output = eventRoot.coordinateHitOutput = scratch.output;\n }\n input.rootX = point.x;\n input.rootY = point.y;\n resolveCoordinateHit(eventRoot, input, output);\n return output;\n}\n\nfunction resolveInstanceHit(\n eventRoot: PibblEventRoot,\n instance: PibblInstance,\n canvas: HTMLCanvasElement,\n rootX: number,\n rootY: number,\n transform: DOMMatrix,\n output: PibblHitTestOutput,\n): PibblHitTestOutput {\n const entries = Array.from(instance.paintEntries);\n for (let index = entries.length - 1; index >= 0; index--) {\n const entry = entries[index]!;\n reset(output);\n switch (entry.paintKind) {\n case PibblPaintEntryKind.Path:\n resolvePathHit(eventRoot, canvas, entry, rootX, rootY, transform, output);\n break;\n case PibblPaintEntryKind.NestedInstance:\n case PibblPaintEntryKind.Resolver: {\n if (entry.instance.mainTeardowns.closed) continue;\n const childTransform = multiplyTransforms(transform, entry.transform);\n const boundaryClippingStack = composeClippingStack(\n entry.clippingStack,\n transform,\n );\n if (!isHit({\n canvas,\n path: entry.bounds,\n transform: childTransform,\n x: rootX,\n y: rootY,\n fill: true,\n lineInteractionWidth: 0,\n currentClippingStack: boundaryClippingStack,\n })) break;\n try {\n if (entry.paintKind === PibblPaintEntryKind.NestedInstance) {\n resolveInstanceHit(\n eventRoot,\n entry.instance,\n canvas,\n rootX,\n rootY,\n childTransform,\n output,\n );\n } else if (entry.resolveLocal) {\n const local = childTransform.inverse().transformPoint(\n new DOMPoint(rootX, rootY),\n );\n entry.resolveLocal(local.x, local.y, output);\n }\n } finally {\n // Child clipping and local coordinates are stack-local to this call.\n }\n break;\n }\n }\n if (output.disposition !== PibblHitDisposition.Miss) return output;\n }\n return output;\n}\n\nfunction resolvePathHit(\n eventRoot: PibblEventRoot,\n canvas: HTMLCanvasElement,\n entry: PibblPathPaintEntry,\n rootX: number,\n rootY: number,\n transform: DOMMatrix,\n output: PibblHitTestOutput,\n): void {\n const target = entry.target;\n if (!isLiveTarget(eventRoot, target)) return;\n if (isHit({\n canvas,\n path: entry.path,\n transform: multiplyTransforms(transform, entry.transform),\n x: rootX,\n y: rootY,\n fill: entry.fill,\n lineInteractionWidth: entry.lineInteractionWidth,\n currentClippingStack: composeClippingStack(entry.clippingStack, transform),\n })) {\n output.disposition = PibblHitDisposition.Target;\n output.target = target;\n }\n}\n\nfunction reset(output: PibblHitTestOutput): void {\n output.disposition = PibblHitDisposition.Miss;\n output.target = null;\n delete output.winner;\n delete output.winnerState;\n}\n\nfunction isLiveTarget(\n eventRoot: PibblEventRoot,\n target: PibblEventTargetRegistration,\n): boolean {\n return target.live &&\n !target.owner.mainTeardowns.closed &&\n target.owner.eventRoot === eventRoot &&\n eventRoot.targets.has(target);\n}\n\nfunction composeClippingStack(\n clippingStack: readonly PibblClippingStackEntry[],\n transform: DOMMatrix,\n): readonly PibblClippingStackEntry[] {\n if (clippingStack.length === 0 || transform.isIdentity) return clippingStack;\n return clippingStack.map(entry => ({\n ...entry,\n transform: multiplyTransforms(transform, entry.transform),\n }));\n}\n\nfunction multiplyTransforms(parent: DOMMatrix, child: DOMMatrix): DOMMatrix {\n if (parent.isIdentity) return child;\n if (child.isIdentity) return parent;\n return parent.multiply(child);\n}\n"],
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["import { committedLayoutPaintEntries } from '../layout/geometry-publication.js';\nimport type { PibblClippingStackEntry, PibblEventRoot, PibblInstance } from '../types.js';\nimport { isHit } from '../util/is-hit.js';\nimport {\n PibblHitDisposition,\n PibblPaintEntryKind,\n hitTestScratchFactory,\n type PibblHitTestInput,\n type PibblHitTestOutput,\n type PibblPathPaintEntry,\n} from './paint-entry.js';\nimport type { PibblEventTargetRegistration } from './registrations.js';\n\nexport interface PibblCoordinatePoint {\n readonly x: number;\n readonly y: number;\n}\n\n/** Resolves one paint entry in reverse global paint order without allocating. */\nexport function resolveCoordinateHit(\n eventRoot: PibblEventRoot,\n input: PibblHitTestInput,\n output: PibblHitTestOutput,\n): PibblHitTestOutput {\n const instance = eventRoot.rootInstance;\n const canvas = eventRoot.canvas;\n reset(output);\n if (!instance || !canvas || !instance.surface.snapshot) return output;\n return resolveInstanceHit(\n eventRoot,\n instance,\n canvas,\n input.rootX,\n input.rootY,\n new DOMMatrix(),\n output,\n );\n}\n\n/** Compatibility wrapper for coordinate event dispatch. */\nexport function resolveCoordinateTarget(\n eventRoot: PibblEventRoot,\n point: PibblCoordinatePoint,\n): PibblEventTargetRegistration | undefined {\n const output = resolveCoordinateOutput(eventRoot, point);\n return output.disposition === PibblHitDisposition.Target ?\n output.target ?? undefined :\n undefined;\n}\n\n/** Borrows the root scratch result for immediate coordinate dispatch. */\nexport function resolveCoordinateOutput(\n eventRoot: PibblEventRoot,\n point: PibblCoordinatePoint,\n): PibblHitTestOutput {\n let input = eventRoot.coordinateHitInput;\n let output = eventRoot.coordinateHitOutput;\n if (!input || !output) {\n const scratch = hitTestScratchFactory.create();\n input = eventRoot.coordinateHitInput = scratch.input;\n output = eventRoot.coordinateHitOutput = scratch.output;\n }\n input.rootX = point.x;\n input.rootY = point.y;\n resolveCoordinateHit(eventRoot, input, output);\n return output;\n}\n\nfunction resolveInstanceHit(\n eventRoot: PibblEventRoot,\n instance: PibblInstance,\n canvas: HTMLCanvasElement,\n rootX: number,\n rootY: number,\n transform: DOMMatrix,\n output: PibblHitTestOutput,\n): PibblHitTestOutput {\n const entries = committedLayoutPaintEntries(instance) ?? Array.from(instance.paintEntries);\n for (let index = entries.length - 1; index >= 0; index--) {\n const entry = entries[index]!;\n reset(output);\n switch (entry.paintKind) {\n case PibblPaintEntryKind.Path:\n resolvePathHit(eventRoot, canvas, entry, rootX, rootY, transform, output);\n break;\n case PibblPaintEntryKind.NestedInstance:\n case PibblPaintEntryKind.Resolver: {\n if (entry.instance.mainTeardowns.closed) continue;\n const childTransform = multiplyTransforms(transform, entry.transform);\n const boundaryClippingStack = composeClippingStack(\n entry.clippingStack,\n transform,\n );\n if (!isHit({\n canvas,\n path: entry.bounds,\n transform: childTransform,\n x: rootX,\n y: rootY,\n fill: true,\n lineInteractionWidth: 0,\n currentClippingStack: boundaryClippingStack,\n })) break;\n try {\n if (entry.paintKind === PibblPaintEntryKind.NestedInstance) {\n resolveInstanceHit(\n eventRoot,\n entry.instance,\n canvas,\n rootX,\n rootY,\n childTransform,\n output,\n );\n } else if (entry.resolveLocal) {\n const local = childTransform.inverse().transformPoint(\n new DOMPoint(rootX, rootY),\n );\n entry.resolveLocal(local.x, local.y, output);\n }\n } finally {\n // Child clipping and local coordinates are stack-local to this call.\n }\n break;\n }\n }\n if (output.disposition !== PibblHitDisposition.Miss) return output;\n }\n return output;\n}\n\nfunction resolvePathHit(\n eventRoot: PibblEventRoot,\n canvas: HTMLCanvasElement,\n entry: PibblPathPaintEntry,\n rootX: number,\n rootY: number,\n transform: DOMMatrix,\n output: PibblHitTestOutput,\n): void {\n const target = entry.target;\n if (!isLiveTarget(eventRoot, target)) return;\n if (isHit({\n canvas,\n path: entry.path,\n transform: multiplyTransforms(transform, entry.transform),\n x: rootX,\n y: rootY,\n fill: entry.fill,\n lineInteractionWidth: entry.lineInteractionWidth,\n currentClippingStack: composeClippingStack(entry.clippingStack, transform),\n })) {\n output.disposition = PibblHitDisposition.Target;\n output.target = target;\n }\n}\n\nfunction reset(output: PibblHitTestOutput): void {\n output.disposition = PibblHitDisposition.Miss;\n output.target = null;\n delete output.winner;\n delete output.winnerState;\n}\n\nfunction isLiveTarget(\n eventRoot: PibblEventRoot,\n target: PibblEventTargetRegistration,\n): boolean {\n return target.live &&\n !target.owner.mainTeardowns.closed &&\n target.owner.eventRoot === eventRoot &&\n eventRoot.targets.has(target);\n}\n\nfunction composeClippingStack(\n clippingStack: readonly PibblClippingStackEntry[],\n transform: DOMMatrix,\n): readonly PibblClippingStackEntry[] {\n if (clippingStack.length === 0 || transform.isIdentity) return clippingStack;\n return clippingStack.map(entry => ({\n ...entry,\n transform: multiplyTransforms(transform, entry.transform),\n }));\n}\n\nfunction multiplyTransforms(parent: DOMMatrix, child: DOMMatrix): DOMMatrix {\n if (parent.isIdentity) return child;\n if (child.isIdentity) return parent;\n return parent.multiply(child);\n}\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,mCAAmC;AAE5C,SAAS,aAAa;AACtB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OAIK;AASA,SAAS,qBACd,WACA,OACA,QACoB;AACpB,QAAM,WAAW,UAAU;AAC3B,QAAM,SAAS,UAAU;AACzB,QAAM,MAAM;AACZ,MAAI,CAAC,YAAY,CAAC,UAAU,CAAC,SAAS,QAAQ,SAAU,QAAO;AA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AAEA,SAAS,qBACP,eACA,WACoC;AACpC,MAAI,cAAc,WAAW,KAAK,UAAU,WAAY,QAAO;AAC/D,SAAO,cAAc,IAAI,YAAU;AAAA,IACjC,GAAG;AAAA,IACH,WAAW,mBAAmB,WAAW,MAAM,SAAS;AAAA,EAC1D,EAAE;AACJ;AAEA,SAAS,mBAAmB,QAAmB,OAA6B;AAC1E,MAAI,OAAO,WAAY,QAAO;AAC9B,MAAI,MAAM,WAAY,QAAO;AAC7B,SAAO,OAAO,SAAS,KAAK;AAC9B;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { type CreatePibblEventInput } from './event-facade.js';
|
|
2
2
|
import type { PibblEventNode } from './registrations.js';
|
|
3
|
-
import type { PibblEventMap, PibblEventType } from './types.js';
|
|
3
|
+
import type { PibblEvent, PibblEventMap, PibblEventPhase, PibblEventType } from './types.js';
|
|
4
4
|
export interface DispatchEventPathInput<K extends PibblEventType> extends Omit<CreatePibblEventInput<K>, 'path'> {
|
|
5
5
|
readonly target: PibblEventNode;
|
|
6
6
|
}
|
|
7
7
|
export declare function dispatchEventPath<K extends PibblEventType>(input: DispatchEventPathInput<K>): PibblEventMap[K];
|
|
8
|
+
export declare function invokePibblEventHandler(node: PibblEventNode, type: PibblEventType, capture: boolean, phase: PibblEventPhase, event: PibblEvent): void;
|